diff options
1156 files changed, 30095 insertions, 17493 deletions
@@ -1,5 +1,8 @@ bin/ +build/ target/ +.gradle/ .settings/ .project -.classpath
\ No newline at end of file +.classpath +ardorSettings.properties
\ No newline at end of file @@ -1,7 +1,7 @@ Ardor3D is licensed as follows: /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -1,4 +1,4 @@ -Ardor3D +JogAmp’s Ardor3D Continuation ======= -Ardor3D is a free Java based, professionally oriented, open source 3D graphics engine.
\ No newline at end of file +JogAmp’s Ardor3D Continuation is a general-purpose, professionally oriented, open source, scenegraph based 3D Java engine for desktop and embedded environments, using JOGL for its hardware graphics acceleration [User's Guide](http://tinyurl.com/mpuu8or)
\ No newline at end of file diff --git a/ardor3d-animation/.settings/org.eclipse.jdt.core.prefs b/ardor3d-animation/.settings/org.eclipse.jdt.core.prefs index 692a876..65ceabb 100644 --- a/ardor3d-animation/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-animation/.settings/org.eclipse.jdt.core.prefs @@ -81,12 +81,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-animation/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-animation/.settings/org.eclipse.jdt.ui.prefs index 583471d..a5040dc 100644 --- a/ardor3d-animation/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-animation/.settings/org.eclipse.jdt.ui.prefs @@ -2,7 +2,7 @@ cleanup_settings_version=2 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true org.eclipse.jdt.ui.javadoc=false -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-JSDoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-JSDoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -25,7 +25,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=true diff --git a/ardor3d-animation/build.gradle b/ardor3d-animation/build.gradle new file mode 100644 index 0000000..21005d4 --- /dev/null +++ b/ardor3d-animation/build.gradle @@ -0,0 +1,5 @@ + +description = 'Ardor 3D Skinning and Animation System' +dependencies { + compile project(':ardor3d-core') +} diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationApplier.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationApplier.java index ced1a80..c42249f 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationApplier.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationApplier.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationListener.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationListener.java index 4259e9a..afbad93 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationListener.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java index 9bda101..9f18697 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java @@ -1,17 +1,19 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.animation.skeletal; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.extension.animation.skeletal.clip.AnimationClip; import com.ardor3d.extension.animation.skeletal.clip.AnimationClipInstance; @@ -21,8 +23,6 @@ import com.ardor3d.extension.animation.skeletal.util.LoggingMap; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.util.ReadOnlyTimer; import com.ardor3d.util.Timer; -import com.google.common.collect.Lists; -import com.google.common.collect.MapMaker; /** * <p> @@ -55,19 +55,19 @@ public class AnimationManager { protected final Spatial _sceneRoot; /** Local instance information for any clips referenced by the layers/blend trees in this manager. */ - protected final Map<AnimationClip, AnimationClipInstance> _clipInstances = new MapMaker().weakKeys().makeMap(); + protected final Map<AnimationClip, AnimationClipInstance> _clipInstances = new WeakHashMap<>(); /** A logic object responsible for taking animation data and applying it to skeleton poses. */ protected AnimationApplier _applier; /** Our animation layers. */ - protected final List<AnimationLayer> _layers = Lists.newArrayList(); + protected final List<AnimationLayer> _layers = new ArrayList<>(); /** - * A map of key->Double values, allowing control over elements under this manager without needing precise knowledge + * A map of key / Double values, allowing control over elements under this manager without needing precise knowledge * of the layout of those layers, blend trees, etc. Missing keys will return 0.0 and log a warning. */ - protected final LoggingMap<String, Double> _valuesStore = new LoggingMap<String, Double>(); + protected final LoggingMap<String, Double> _valuesStore = new LoggingMap<>(); /** * The throttle rate of animation. Default is 60fps (1/60.0). Set to 0 to disable throttling. @@ -97,11 +97,11 @@ public class AnimationManager { /** * Listeners for changes to this manager's AnimationUpdateState. */ - protected final List<AnimationUpdateStateListener> _updateStateListeners = Lists.newArrayList(); + protected final List<AnimationUpdateStateListener> _updateStateListeners = new ArrayList<>(); /** * Construct a new AnimationManager. - * + * * @param globalTimer * the timer to use for global time keeping. * @param pose @@ -113,7 +113,7 @@ public class AnimationManager { /** * Construct a new AnimationManager. - * + * * @param globalTimer * the timer to use for global time keeping. * @param pose @@ -130,10 +130,9 @@ public class AnimationManager { layer.setManager(this); _layers.add(layer); + _applyToPoses = new ArrayList<>(); if (pose != null) { - _applyToPoses = Lists.newArrayList(pose); - } else { - _applyToPoses = Lists.newArrayList(); + _applyToPoses.add(pose); } _valuesStore.setLogOnReplace(false); @@ -163,7 +162,7 @@ public class AnimationManager { } /** - * + * * @return True if clips will reset if the currentUpdateState is Stop. */ public boolean isResetClipsOnStop() { @@ -173,8 +172,8 @@ public class AnimationManager { /** * @param resetClipsOnStop * True if clips are to be reset when currentUpdateState is Stop, false otherwise. - * - * + * + * */ public void setResetClipsOnStop(final boolean resetClipsOnStop) { _resetClipsOnStop = resetClipsOnStop; @@ -259,7 +258,7 @@ public class AnimationManager { /** * Notify any listeners of the state change - * + * * @param oldState * previous state */ @@ -271,7 +270,7 @@ public class AnimationManager { /** * Add an AnimationUpdateStateListener to this manager. - * + * * @param listener * the listener to add. */ @@ -281,7 +280,7 @@ public class AnimationManager { /** * Remove an AnimationUpdateStateListener from this manager. - * + * * @param listener * the listener to remove. * @return true if the listener was found @@ -427,7 +426,7 @@ public class AnimationManager { /** * Retrieve and track an instance of an animation clip to be used with this manager. - * + * * @param clip * the clip to instance. * @return our new clip instance. @@ -445,7 +444,7 @@ public class AnimationManager { /** * Retrieve an existing clip instance being tracked by this manager. - * + * * @param clipName * the name of the clip to find an existing instance of. Case sensitive. * @return our existing clip instance, or null if we were not tracking a clip of the given name. @@ -462,7 +461,7 @@ public class AnimationManager { /** * Retrieve an existing clip tracked by this manager. - * + * * @param clipName * the name of the clip to find. Case sensitive. * @return our existing clip, or null if we were not tracking a clip of the given name. @@ -479,7 +478,7 @@ public class AnimationManager { /** * Rewind and reactivate the clip instance associated with the given clip. - * + * * @param clip * the clip to pull the instance for. * @param globalStartTime @@ -521,7 +520,7 @@ public class AnimationManager { /** * Add a new layer to our list of animation layers. - * + * * @param layer * the layer to add. * @return the index of our added layer in our list of animation layers. @@ -534,7 +533,7 @@ public class AnimationManager { /** * Insert a given animation layer into our list of layers. - * + * * @param layer * the layer to insert. * @param index diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationUpdateStateListener.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationUpdateStateListener.java index 1afd8c5..11df8fb 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationUpdateStateListener.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationUpdateStateListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AttachmentPoint.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AttachmentPoint.java index be9f18d..b47844b 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AttachmentPoint.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AttachmentPoint.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -102,6 +102,7 @@ public class AttachmentPoint implements PoseListener { * Move our managed spatial to align with the referenced joint's position in the given pose, modified by our offset. * See class javadoc for more information. */ + @Override public void poseUpdated(final SkeletonPose pose) { // only update if we have something attached. if (_attachment != null) { diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/Joint.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/Joint.java index b5a0e4e..c56a9e4 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/Joint.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/Joint.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -41,7 +41,7 @@ public class Joint implements Savable { /** * Construct a new Joint object using the given name. - * + * * @param name * the name */ @@ -50,7 +50,7 @@ public class Joint implements Savable { } /** - * @return the inverse of the joint space -> model space transformation. + * @return the inverse of the joint space to model space transformation. */ public ReadOnlyTransform getInverseBindPose() { return _inverseBindPose; @@ -69,7 +69,7 @@ public class Joint implements Savable { /** * Set the index of this joint's parent within the containing Skeleton's joint array. - * + * * @param parentIndex * the index, or NO_PARENT if this Joint is root (has no parent) */ @@ -98,10 +98,12 @@ public class Joint implements Savable { // Methods for Savable // ///////////////// + @Override public Class<? extends Joint> getClassTag() { return this.getClass(); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_name, "name", null); capsule.write(_index, "index", (short) 0); @@ -109,6 +111,7 @@ public class Joint implements Savable { capsule.write(_inverseBindPose, "inverseBindPose", (Savable) Transform.IDENTITY); } + @Override public void read(final InputCapsule capsule) throws IOException { final String name = capsule.readString("name", null); try { diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/PoseListener.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/PoseListener.java index 780395c..0a9de7e 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/PoseListener.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/PoseListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/Skeleton.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/Skeleton.java index ba4d69e..0ec3a15 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/Skeleton.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/Skeleton.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -80,15 +80,18 @@ public class Skeleton implements Savable { // Methods for Savable // ///////////////// + @Override public Class<? extends Skeleton> getClassTag() { return this.getClass(); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_name, "name", null); capsule.write(_joints, "joints", null); } + @Override public void read(final InputCapsule capsule) throws IOException { final String name = capsule.readString("name", null); final Joint[] joints = CapsuleUtils.asArray(capsule.readSavableArray("joints", null), Joint.class); diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkeletonPose.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkeletonPose.java index a0fa4c1..cb887a0 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkeletonPose.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkeletonPose.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,6 +12,7 @@ package com.ardor3d.extension.animation.skeletal; import java.io.IOException; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.List; import com.ardor3d.annotation.SavableFactory; @@ -21,7 +22,6 @@ import com.ardor3d.util.export.CapsuleUtils; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; -import com.google.common.collect.Lists; /** * Joins a Skeleton with an array of joint poses. This allows the skeleton to exist and be reused between multiple @@ -48,7 +48,7 @@ public class SkeletonPose implements Savable { /** * The list of elements interested in notification when this SkeletonPose updates. Not saved to savable. */ - private transient final List<PoseListener> _poseListeners = Lists.newArrayListWithCapacity(1); + private transient final List<PoseListener> _poseListeners = new ArrayList<>(1); /** * Construct a new SkeletonPose using the given Skeleton. @@ -234,15 +234,18 @@ public class SkeletonPose implements Savable { // Methods for Savable // ///////////////// + @Override public Class<? extends SkeletonPose> getClassTag() { return this.getClass(); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_skeleton, "skeleton", null); capsule.write(_localTransforms, "localTransforms", null); } + @Override public void read(final InputCapsule capsule) throws IOException { final Skeleton skeleton = (Skeleton) capsule.readSavable("skeleton", null); final Transform[] localTransforms = CapsuleUtils.asArray(capsule.readSavableArray("localTransforms", null), diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinPoseApplyLogic.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinPoseApplyLogic.java index 177a1fc..f42d355 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinPoseApplyLogic.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinPoseApplyLogic.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMesh.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMesh.java index aef1d9a..8fa4351 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMesh.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMesh.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,6 +12,7 @@ package com.ardor3d.extension.animation.skeletal; import java.io.IOException; import java.nio.FloatBuffer; +import java.util.Objects; import java.util.TreeSet; import com.ardor3d.bounding.CollisionTreeManager; @@ -28,7 +29,6 @@ import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Sets; /** * Mesh supporting deformation via skeletal animation. @@ -92,7 +92,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { * Flag for enabling automatically updating the skin's model bound when the pose changes. Only effective in CPU * skinning mode. Default is false as this is currently expensive. * </p> - * + * * XXX: If we can find a better way to update the bounds, maybe we should make this default to true or remove this * altogether. */ @@ -112,7 +112,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { /** * Constructs a new SkinnedMesh with a given name. - * + * * @param name * the name of the skinned mesh. */ @@ -129,7 +129,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { /** * Sets the bind pose mesh data object used by this skinned mesh. - * + * * @param poseData * the new bind pose */ @@ -198,8 +198,9 @@ public class SkinnedMesh extends Mesh implements PoseListener { /** * Sets the joint indices used by this skinned mesh to compute mesh deformation. Each entry is interpreted as an * 16bit signed integer index into a Skeleton's Joint. - * + * * @param jointIndices + * the joint indices */ public void setJointIndices(final short[] jointIndices) { _jointIndices = jointIndices; @@ -210,7 +211,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { /** * @return this skinned mesh's joint weights. - * @see #setWeights(FloatBuffer) + * @see #setWeights(float[]) */ public float[] getWeights() { return _weights; @@ -218,7 +219,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { /** * Sets the joint weights used by this skinned mesh. - * + * * @param weights * the new weights. */ @@ -276,7 +277,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { /** * This should be set after setting up gpu attribute params. - * + * * @param useGPU * true if we should do skinning on the card (GPU) or false if on the CPU. */ @@ -338,7 +339,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { * Set custom logic for how this skin should react when it is told its pose has updated. This might include * throttling skin application, ignoring skin application when the skin is outside of the camera view, etc. If null, * (the default) the skin will always apply the new pose and optionally update the model bound. - * + * * @param customApplier * the new custom logic, or null to use the default behavior. */ @@ -483,6 +484,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { /** * Calls to apply our pose on pose update. */ + @Override public void poseUpdated(final SkeletonPose pose) { // custom behavior? if (_customApplier != null) { @@ -609,9 +611,10 @@ public class SkinnedMesh extends Mesh implements PoseListener { /** * Rewrites the weights on this SkinnedMesh, if necessary, to reduce the number of weights per vert to the given * max. This is done by dropping the least significant weight and balancing the remainder to total 1.0 again. - * + * * @param maxCount - * the desired maximum weightsPerVert. If this is >= the current weightsPerVert, this method is a NOOP. + * the desired maximum weightsPerVert. If this is greater than or equal to the current weightsPerVert, + * this method is a NOOP. */ public void constrainWeightCount(final int maxCount) { if (maxCount >= _weightsPerVert) { @@ -623,7 +626,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { final short[] joints = new short[vcount * maxCount]; final float[] weights = new float[vcount * maxCount]; - final TreeSet<JointWeight> weightSort = Sets.newTreeSet(); + final TreeSet<JointWeight> weightSort = new TreeSet<>(); // Walk through old data vertex by vertex int index; for (int i = 0; i < vcount; i++) { @@ -721,12 +724,7 @@ public class SkinnedMesh extends Mesh implements PoseListener { @Override public int hashCode() { - int result = 17; - - // only care about joint - result += 31 * result + joint; - - return result; + return Objects.hashCode(Short.valueOf(joint)); } @Override diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMeshCombineLogic.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMeshCombineLogic.java index 9b57f10..f5a0d8a 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMeshCombineLogic.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMeshCombineLogic.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/AbstractTwoPartSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/AbstractTwoPartSource.java index 677520e..f4d3bd8 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/AbstractTwoPartSource.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/AbstractTwoPartSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BinaryLERPSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BinaryLERPSource.java index 5edb64d..5afe838 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BinaryLERPSource.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BinaryLERPSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,13 +10,13 @@ package com.ardor3d.extension.animation.skeletal.blendtree; +import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import com.ardor3d.extension.animation.skeletal.AnimationManager; import com.ardor3d.extension.animation.skeletal.clip.TransformData; import com.ardor3d.math.MathUtils; -import com.google.common.collect.Maps; /** * <p> @@ -47,6 +47,7 @@ public class BinaryLERPSource extends AbstractTwoPartSource { setSourceB(sourceB); } + @Override public Map<String, ? extends Object> getSourceData(final AnimationManager manager) { // grab our data maps from the two sources final Map<String, ? extends Object> sourceAData = getSourceA() != null ? getSourceA().getSourceData(manager) @@ -58,6 +59,7 @@ public class BinaryLERPSource extends AbstractTwoPartSource { .combineSourceData(sourceAData, sourceBData, manager.getValuesStore().get(getBlendKey())); } + @Override public boolean setTime(final double globalTime, final AnimationManager manager) { // set our time on the two sub sources boolean foundActive = false; @@ -70,6 +72,7 @@ public class BinaryLERPSource extends AbstractTwoPartSource { return foundActive; } + @Override public void resetClips(final AnimationManager manager, final double globalStartTime) { // reset our two sub sources if (getSourceA() != null) { @@ -112,7 +115,7 @@ public class BinaryLERPSource extends AbstractTwoPartSource { Map<String, Object> rVal = store; if (rVal == null) { - rVal = Maps.newHashMap(); + rVal = new HashMap<>(); } for (final Entry<String, ? extends Object> entryAData : sourceAData.entrySet()) { diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BlendTreeSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BlendTreeSource.java index 7dfcbb9..4189e38 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BlendTreeSource.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BlendTreeSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ClipSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ClipSource.java index 9674c8f..509dbbc 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ClipSource.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ClipSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -61,6 +61,7 @@ public class ClipSource implements BlendTreeSource { /** * Sets the current time on our AnimationClip instance, accounting for looping and time scaling. */ + @Override public boolean setTime(final double globalTime, final AnimationManager manager) { final AnimationClipInstance instance = manager.getClipInstance(_clip); if (instance.isActive()) { @@ -98,6 +99,7 @@ public class ClipSource implements BlendTreeSource { return instance.isActive(); } + @Override public void resetClips(final AnimationManager manager, final double globalStartTime) { manager.resetClipInstance(_clip, globalStartTime); } diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ExclusiveClipSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ExclusiveClipSource.java index 3d65439..9218dec 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ExclusiveClipSource.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ExclusiveClipSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,8 @@ package com.ardor3d.extension.animation.skeletal.blendtree; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -17,8 +19,6 @@ import com.ardor3d.extension.animation.skeletal.AnimationManager; import com.ardor3d.extension.animation.skeletal.clip.AnimationClip; import com.ardor3d.extension.animation.skeletal.clip.JointChannel; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; /** * Similar to a ClipSource, this class samples and returns values from the channels of an AnimationClip. @@ -27,7 +27,7 @@ import com.google.common.collect.Maps; public class ExclusiveClipSource extends ClipSource { /** Our List of channels to exclude by name. */ - private final List<String> _disabledChannels = Lists.newArrayList(); + private final List<String> _disabledChannels = new ArrayList<>(); /** * Construct a new source. Clip and Manager must be set separately before use. @@ -91,7 +91,7 @@ public class ExclusiveClipSource extends ClipSource { final Map<String, ? extends Object> orig = super.getSourceData(manager); // make a copy, removing specific channels - final Map<String, ? extends Object> data = Maps.newHashMap(orig); + final Map<String, Object> data = new HashMap<>(orig); if (_disabledChannels != null) { for (final String key : _disabledChannels) { data.remove(key); diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/FrozenTreeSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/FrozenTreeSource.java index 192d522..cf6c18d 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/FrozenTreeSource.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/FrozenTreeSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -31,6 +31,7 @@ public class FrozenTreeSource implements BlendTreeSource { _time = frozenTime; } + @Override public Map<String, ? extends Object> getSourceData(final AnimationManager manager) { return _source.getSourceData(manager); } @@ -38,6 +39,7 @@ public class FrozenTreeSource implements BlendTreeSource { /** * Ignores the command to reset our subtree. */ + @Override public void resetClips(final AnimationManager manager, final double globalStartTime) { _source.resetClips(manager, 0); } @@ -45,6 +47,7 @@ public class FrozenTreeSource implements BlendTreeSource { /** * Ignores the command to set time on our subtree */ + @Override public boolean setTime(final double globalTime, final AnimationManager manager) { _source.setTime(_time, manager); return true; diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/InclusiveClipSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/InclusiveClipSource.java index f8a260f..688f0dc 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/InclusiveClipSource.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/InclusiveClipSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,8 @@ package com.ardor3d.extension.animation.skeletal.blendtree; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -17,8 +19,6 @@ import com.ardor3d.extension.animation.skeletal.AnimationManager; import com.ardor3d.extension.animation.skeletal.clip.AnimationClip; import com.ardor3d.extension.animation.skeletal.clip.JointChannel; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; /** * Similar to a ClipSource, this class samples and returns values from the channels of an AnimationClip. @@ -28,7 +28,7 @@ import com.google.common.collect.Maps; public class InclusiveClipSource extends ClipSource { /** Our List of channels to include by name. */ - private final List<String> _enabledChannels = Lists.newArrayList(); + private final List<String> _enabledChannels = new ArrayList<>(); /** * Construct a new source. Clip and Manager must be set separately before use. @@ -92,7 +92,7 @@ public class InclusiveClipSource extends ClipSource { final Map<String, ? extends Object> orig = super.getSourceData(manager); // make a copy, only bringing across specific channels - final Map<String, Object> data = Maps.newHashMap(); + final Map<String, Object> data = new HashMap<>(); if (_enabledChannels != null) { for (final String key : _enabledChannels) { if (orig.containsKey(key)) { diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ManagedTransformSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ManagedTransformSource.java index 1806e6a..17b788c 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ManagedTransformSource.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ManagedTransformSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.animation.skeletal.blendtree; +import java.util.HashMap; import java.util.Map; import com.ardor3d.extension.animation.skeletal.AnimationManager; @@ -20,7 +21,6 @@ import com.ardor3d.extension.animation.skeletal.clip.JointData; import com.ardor3d.math.type.ReadOnlyQuaternion; import com.ardor3d.math.type.ReadOnlyVector3; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; /** * This tree source maintains its own source data, which can be modified directly using setJointXXX. This source is @@ -29,7 +29,7 @@ import com.google.common.collect.Maps; public class ManagedTransformSource implements BlendTreeSource { /** Our local source data. */ - private final Map<String, JointData> data = Maps.newHashMap(); + private final Map<String, JointData> data = new HashMap<>(); /** optional: name of source we were initialized from, if given. */ private String sourceName; @@ -113,6 +113,7 @@ public class ManagedTransformSource implements BlendTreeSource { /** * Returns an immutable COPY of our local source data. */ + @Override public Map<String, JointData> getSourceData(final AnimationManager manager) { return ImmutableMap.copyOf(data); } @@ -120,6 +121,7 @@ public class ManagedTransformSource implements BlendTreeSource { /** * Does nothing. */ + @Override public boolean setTime(final double globalTime, final AnimationManager manager) { return true; } @@ -127,6 +129,7 @@ public class ManagedTransformSource implements BlendTreeSource { /** * Does nothing. */ + @Override public void resetClips(final AnimationManager manager, final double globalStartTime) { ; // ignore } diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java index 31fef67..5772568 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -11,6 +11,7 @@ package com.ardor3d.extension.animation.skeletal.blendtree; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.extension.animation.skeletal.AnimationApplier; import com.ardor3d.extension.animation.skeletal.AnimationManager; @@ -22,7 +23,6 @@ import com.ardor3d.extension.animation.skeletal.clip.TriggerData; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.Spatial; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.MapMaker; import com.google.common.collect.Multimap; /** @@ -32,7 +32,7 @@ public class SimpleAnimationApplier implements AnimationApplier { private final Multimap<String, TriggerCallback> _triggerCallbacks = ArrayListMultimap.create(0, 0); - private final Map<String, Spatial> _spatialCache = new MapMaker().weakValues().makeMap(); + private final Map<String, Spatial> _spatialCache = new WeakHashMap<>(); @Override public void apply(final Spatial root, final AnimationManager manager) { diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AbstractAnimationChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AbstractAnimationChannel.java index 199f80e..f4e4028 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AbstractAnimationChannel.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AbstractAnimationChannel.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -27,12 +27,15 @@ public abstract class AbstractAnimationChannel implements Savable { /** The name of this channel. */ protected final String _channelName; - /** Our time indices. Each index of the array should contain a value that is > the value in the previous index. */ + /** + * Our time indices. Each index of the array should contain a value that is greater than the value in the previous + * index. + */ protected final float[] _times; /** * Construct a new channel. - * + * * @param channelName * the name of our channel. This is immutable to this instance of the class. * @param times @@ -42,7 +45,7 @@ public abstract class AbstractAnimationChannel implements Savable { _channelName = channelName; _times = times == null ? null : new float[times.length]; if (_times != null) { - System.arraycopy(times, 0, _times, 0, times.length); + System.arraycopy(times, 0, _times, 0, _times.length); } } @@ -63,7 +66,7 @@ public abstract class AbstractAnimationChannel implements Savable { /** * Update the given applyTo object with information from this channel at the given time position. - * + * * @param clockTime * the current local clip time (where 0 == start of clip) * @param applyTo @@ -98,7 +101,7 @@ public abstract class AbstractAnimationChannel implements Savable { /** * Sets data on the given applyTo Object for the given sampleIndex and a percent progress towards the sample * following it. - * + * * @param sampleIndex * the sample to pull information from. * @param progressPercent @@ -118,7 +121,7 @@ public abstract class AbstractAnimationChannel implements Savable { /** * Returns a new channel of the same name and content as this, but trimmed to just the times between start and end * sample. - * + * * @param startSample * the sample to start with (inclusive). Sample counting starts at 0. * @param endSample @@ -130,9 +133,9 @@ public abstract class AbstractAnimationChannel implements Savable { } /** - * + * * Returns a new channel of the same content as this, but trimmed to just the times between start and end sample. - * + * * @param name * the new name for our subchannel. * @param startSample @@ -141,14 +144,14 @@ public abstract class AbstractAnimationChannel implements Savable { * the sample to end with (inclusive). max is getSampleCount() - 1. * @return the new channel. * @throws IllegalArgumentException - * if start > end or end >= getSampleCount. + * if start greater than end or end greater than or equal to getSampleCount. */ public abstract AbstractAnimationChannel getSubchannelBySample(String name, int startSample, int endSample); /** * Returns a new channel of the same name and content as this, but trimmed to just the times between start and end * times. - * + * * @param startTime * the time to start with (inclusive) * @param endTime @@ -160,9 +163,9 @@ public abstract class AbstractAnimationChannel implements Savable { } /** - * + * * Returns a new channel of the same content as this, but trimmed to just the times between start and end sample. - * + * * @param name * the new name for our subchannel. * @param startTime @@ -171,7 +174,7 @@ public abstract class AbstractAnimationChannel implements Savable { * the time to end with (inclusive) * @return the new channel. * @throws IllegalArgumentException - * if start > end or end >= getSampleCount. + * if start greater than end or end greater than or equal to getSampleCount. */ public abstract AbstractAnimationChannel getSubchannelByTime(String name, float startTime, float endTime); @@ -190,11 +193,13 @@ public abstract class AbstractAnimationChannel implements Savable { // Methods for Savable // ///////////////// + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_channelName, "channelName", null); capsule.write(_times, "times", null); } + @Override public void read(final InputCapsule capsule) throws IOException { final String channelName = capsule.readString("channelName", null); final float[] times = capsule.readFloatArray("times", null); diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClip.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClip.java index cb10165..cd12b4b 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClip.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClip.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,6 +12,7 @@ package com.ardor3d.extension.animation.skeletal.clip; import java.io.IOException; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.List; import com.ardor3d.annotation.SavableFactory; @@ -19,7 +20,6 @@ import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; /** * AnimationClip manages a set of animation channels as a single clip entity. @@ -38,21 +38,27 @@ public class AnimationClip implements Savable { /** * Construct a new animation clip with no channels. + * + * @param name + * clip's name, should be unique */ public AnimationClip(final String name) { _name = name; - _channels = Lists.newArrayList(); + _channels = new ArrayList<>(); } /** * Construct a new animation clip, copying in a given list of channels. - * + * + * @param name + * clip's name, should be unique + * * @param channels * a list of channels to shallow copy locally. */ public AnimationClip(final String name, final List<AbstractAnimationChannel> channels) { _name = name; - _channels = Lists.newArrayList(channels); + _channels = new ArrayList<>(channels); updateMaxTimeIndex(); } @@ -65,7 +71,7 @@ public class AnimationClip implements Savable { /** * Update an instance of this clip. - * + * * @param clockTime * the current local clip time (where 0 == start of clip) * @param instance @@ -82,7 +88,7 @@ public class AnimationClip implements Savable { /** * Add a channel to this clip. - * + * * @param channel * the channel to add. */ @@ -93,7 +99,7 @@ public class AnimationClip implements Savable { /** * Locate a channel in this clip using its channel name. - * + * * @param channelName * the name to match against. * @return the first channel with a name matching the given channelName, or null if no matches are found. @@ -109,7 +115,7 @@ public class AnimationClip implements Savable { /** * Remove a given channel from this clip. - * + * * @param channel * the channel to remove. * @return true if this clip had the given channel and it was removed. @@ -157,15 +163,18 @@ public class AnimationClip implements Savable { // Methods for Savable // ///////////////// + @Override public Class<? extends AnimationClip> getClassTag() { return this.getClass(); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_name, "name", null); capsule.writeSavableList(_channels, "channels", null); } + @Override public void read(final InputCapsule capsule) throws IOException { final String name = capsule.readString("name", null); try { diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClipInstance.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClipInstance.java index 14f8816..49c1857 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClipInstance.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClipInstance.java @@ -1,22 +1,22 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.animation.skeletal.clip; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import com.ardor3d.extension.animation.skeletal.AnimationListener; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; /** * Maintains state information about an instance of a specific animation clip, such as time scaling applied, active @@ -39,28 +39,28 @@ public class AnimationClipInstance { /** The global start time of our clip instance. */ private double _startTime = 0.0; - /** Map of channel name -> state tracking objects. */ - private final Map<String, Object> _clipStateObjects = Maps.newHashMap(); + /** Map of channel name to state tracking objects. */ + private final Map<String, Object> _clipStateObjects = new HashMap<>(); /** List of callbacks for animation events. */ private List<AnimationListener> animationListeners = null; /** * Add an animation listener to our callback list. - * + * * @param animationListener * the listener to add. */ public void addAnimationListener(final AnimationListener animationListener) { if (animationListeners == null) { - animationListeners = Lists.newArrayList(); + animationListeners = new ArrayList<>(); } animationListeners.add(animationListener); } /** * Remove an animation listener from our callback list. - * + * * @param animationListener * the listener to remove. * @return true if the listener was found in our list diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/GuaranteedTriggerChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/GuaranteedTriggerChannel.java index 394a585..4d07c15 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/GuaranteedTriggerChannel.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/GuaranteedTriggerChannel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,10 +10,10 @@ package com.ardor3d.extension.animation.skeletal.clip; +import java.util.ArrayList; import java.util.List; import com.ardor3d.annotation.SavableFactory; -import com.google.common.collect.Lists; /** * An animation source channel consisting of keyword samples indicating when a specific trigger condition is met. Each @@ -49,7 +49,7 @@ public class GuaranteedTriggerChannel extends TriggerChannel { if (oldIndex == newIndex) { triggerData.arm(newIndex, _keys[newIndex]); } else { - final List<String> triggers = Lists.newArrayList(); + final List<String> triggers = new ArrayList<>(); for (int i = oldIndex + 1; i <= newIndex; i++) { if (_keys[i] != null) { triggers.add(_keys[i]); @@ -85,8 +85,8 @@ public class GuaranteedTriggerChannel extends TriggerChannel { if (startTime > endTime) { throw new IllegalArgumentException("startTime > endTime"); } - final List<Float> times = Lists.newArrayList(); - final List<String> keys = Lists.newArrayList(); + final List<Float> times = new ArrayList<>(); + final List<String> keys = new ArrayList<>(); final TriggerData tData = new TriggerData(); diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedDoubleChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedDoubleChannel.java index 25dc43e..1fff8a5 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedDoubleChannel.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedDoubleChannel.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,12 +12,12 @@ package com.ardor3d.extension.animation.skeletal.clip; import java.io.IOException; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.List; import com.ardor3d.math.MathUtils; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; -import com.google.common.collect.Lists; /** * An animation source channel consisting of double value samples. These samples are interpolated between key frames. @@ -31,19 +31,19 @@ public class InterpolatedDoubleChannel extends AbstractAnimationChannel { /** * Construct a new InterpolatedDoubleChannel. - * + * * @param channelName * the name of this channel. * @param times * the time samples - * @param keys + * @param values * our key samples. Entries may be null. Should have as many entries as the times array. */ public InterpolatedDoubleChannel(final String channelName, final float[] times, final double[] values) { super(channelName, times); _values = values == null ? null : new double[values.length]; if (_values != null) { - System.arraycopy(values, 0, _values, 0, values.length); + System.arraycopy(values, 0, _values, 0, _values.length); } } @@ -65,7 +65,8 @@ public class InterpolatedDoubleChannel extends AbstractAnimationChannel { } @Override - public InterpolatedDoubleChannel getSubchannelBySample(final String name, final int startSample, final int endSample) { + public InterpolatedDoubleChannel getSubchannelBySample(final String name, final int startSample, + final int endSample) { if (startSample > endSample) { throw new IllegalArgumentException("startSample > endSample"); } @@ -86,12 +87,13 @@ public class InterpolatedDoubleChannel extends AbstractAnimationChannel { } @Override - public InterpolatedDoubleChannel getSubchannelByTime(final String name, final float startTime, final float endTime) { + public InterpolatedDoubleChannel getSubchannelByTime(final String name, final float startTime, + final float endTime) { if (startTime > endTime) { throw new IllegalArgumentException("startTime > endTime"); } - final List<Float> times = Lists.newArrayList(); - final List<Double> keys = Lists.newArrayList(); + final List<Float> times = new ArrayList<>(); + final List<Double> keys = new ArrayList<>(); final double[] data = new double[1]; @@ -133,6 +135,7 @@ public class InterpolatedDoubleChannel extends AbstractAnimationChannel { // Methods for Savable // ///////////////// + @Override public Class<? extends InterpolatedDoubleChannel> getClassTag() { return this.getClass(); } diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedFloatChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedFloatChannel.java index 17f24d3..0ddad39 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedFloatChannel.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedFloatChannel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,12 +12,12 @@ package com.ardor3d.extension.animation.skeletal.clip; import java.io.IOException; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.List; import com.ardor3d.math.MathUtils; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; -import com.google.common.collect.Lists; /** * An animation source channel consisting of float value samples. These samples are interpolated between key frames. @@ -43,7 +43,7 @@ public class InterpolatedFloatChannel extends AbstractAnimationChannel { super(channelName, times); _values = values == null ? null : new float[values.length]; if (_values != null) { - System.arraycopy(values, 0, _values, 0, values.length); + System.arraycopy(values, 0, _values, 0, _values.length); } } @@ -90,8 +90,8 @@ public class InterpolatedFloatChannel extends AbstractAnimationChannel { if (startTime > endTime) { throw new IllegalArgumentException("startTime > endTime"); } - final List<Float> times = Lists.newArrayList(); - final List<Float> keys = Lists.newArrayList(); + final List<Float> times = new ArrayList<>(); + final List<Float> keys = new ArrayList<>(); final float[] data = new float[1]; @@ -133,6 +133,7 @@ public class InterpolatedFloatChannel extends AbstractAnimationChannel { // Methods for Savable // ///////////////// + @Override public Class<? extends InterpolatedFloatChannel> getClassTag() { return this.getClass(); } diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/JointChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/JointChannel.java index 9f3c8cd..159e60d 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/JointChannel.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/JointChannel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/JointData.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/JointData.java index af97ebd..36e327d 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/JointData.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/JointData.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.extension.animation.skeletal.clip;
import java.io.IOException;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
/**
* Describes transform of a joint.
*/
public class JointData extends TransformData {
private int _jointIndex;
/**
* Construct a new, identity joint data object.
*/
public JointData(final int index) {
_jointIndex = index;
}
/**
* Construct a new joint data object, copying the value of the given source.
*
* @param source
* our source to copy.
* @throws NullPointerException
* if source is null.
*/
public JointData(final JointData source) {
set(source);
}
/**
* Construct a new, identity joint data object.
*/
public JointData() {}
/**
* Copy the source's values into this transform data object.
*
* @param source
* our source to copy.
* @throws NullPointerException
* if source is null.
*/
public void set(final JointData source) {
super.set(source);
_jointIndex = source._jointIndex;
}
public int getJointIndex() {
return _jointIndex;
}
public void setJointIndex(final int jointIndex) {
_jointIndex = jointIndex;
}
/**
* Blend this transform with the given transform.
*
* @param blendTo
* The transform to blend to
* @param blendWeight
* The blend weight
* @param store
* The transform store.
* @return The blended transform.
*/
@Override
public TransformData blend(final TransformData blendTo, final double blendWeight, final TransformData store) {
TransformData rVal = store;
if (rVal == null) {
rVal = new JointData(_jointIndex);
} else if (rVal instanceof JointData) {
((JointData) rVal).setJointIndex(_jointIndex);
}
return super.blend(blendTo, blendWeight, rVal);
}
// /////////////////
// Methods for Savable
// /////////////////
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
capsule.write(_jointIndex, "jointIndex", 0);
}
@Override
public void read(final InputCapsule capsule) throws IOException {
super.read(capsule);
_jointIndex = capsule.readInt("jointIndex", 0);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.extension.animation.skeletal.clip;
import java.io.IOException;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
/**
* Describes transform of a joint.
*/
public class JointData extends TransformData {
private int _jointIndex;
/**
* Construct a new, identity joint data object.
*
* @param index
* the index
*/
public JointData(final int index) {
_jointIndex = index;
}
/**
* Construct a new joint data object, copying the value of the given source.
*
* @param source
* our source to copy.
* @throws NullPointerException
* if source is null.
*/
public JointData(final JointData source) {
set(source);
}
/**
* Construct a new, identity joint data object.
*/
public JointData() {}
/**
* Copy the source's values into this transform data object.
*
* @param source
* our source to copy.
* @throws NullPointerException
* if source is null.
*/
public void set(final JointData source) {
super.set(source);
_jointIndex = source._jointIndex;
}
public int getJointIndex() {
return _jointIndex;
}
public void setJointIndex(final int jointIndex) {
_jointIndex = jointIndex;
}
/**
* Blend this transform with the given transform.
*
* @param blendTo
* The transform to blend to
* @param blendWeight
* The blend weight
* @param store
* The transform store.
* @return The blended transform.
*/
@Override
public TransformData blend(final TransformData blendTo, final double blendWeight, final TransformData store) {
TransformData rVal = store;
if (rVal == null) {
rVal = new JointData(_jointIndex);
} else if (rVal instanceof JointData) {
((JointData) rVal).setJointIndex(_jointIndex);
}
return super.blend(blendTo, blendWeight, rVal);
}
// /////////////////
// Methods for Savable
// /////////////////
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
capsule.write(_jointIndex, "jointIndex", 0);
}
@Override
public void read(final InputCapsule capsule) throws IOException {
super.read(capsule);
_jointIndex = capsule.readInt("jointIndex", 0);
}
}
\ No newline at end of file diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformChannel.java index 07598f5..5f15ddc 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformChannel.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformChannel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,6 +12,7 @@ package com.ardor3d.extension.animation.skeletal.clip; import java.io.IOException; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; @@ -25,7 +26,6 @@ import com.ardor3d.util.export.CapsuleUtils; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; /** * An animation channel consisting of a series of transforms interpolated over time. @@ -200,10 +200,10 @@ public class TransformChannel extends AbstractAnimationChannel { if (startTime > endTime) { throw new IllegalArgumentException("startTime > endTime"); } - final List<Float> times = Lists.newArrayList(); - final List<ReadOnlyQuaternion> rotations = Lists.newArrayList(); - final List<ReadOnlyVector3> translations = Lists.newArrayList(); - final List<ReadOnlyVector3> scales = Lists.newArrayList(); + final List<Float> times = new ArrayList<>(); + final List<ReadOnlyQuaternion> rotations = new ArrayList<>(); + final List<ReadOnlyVector3> translations = new ArrayList<>(); + final List<ReadOnlyVector3> scales = new ArrayList<>(); final TransformData tData = new TransformData(); @@ -269,6 +269,7 @@ public class TransformChannel extends AbstractAnimationChannel { // Methods for Savable // ///////////////// + @Override public Class<? extends TransformChannel> getClassTag() { return this.getClass(); } diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformData.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformData.java index 15d4bc3..f4a7773 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformData.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -172,16 +172,19 @@ public class TransformData implements Savable { // Methods for Savable // ///////////////// + @Override public Class<? extends TransformData> getClassTag() { return this.getClass(); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_rotation, "rotation", new Quaternion(Quaternion.IDENTITY)); capsule.write(_scale, "scale", new Vector3(Vector3.ONE)); capsule.write(_translation, "translation", new Vector3(Vector3.ZERO)); } + @Override public void read(final InputCapsule capsule) throws IOException { setRotation((Quaternion) capsule.readSavable("rotation", new Quaternion(Quaternion.IDENTITY))); setScale((Vector3) capsule.readSavable("scale", new Vector3(Vector3.ONE))); diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerCallback.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerCallback.java index 292c497..d30638f 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerCallback.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerCallback.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -21,9 +21,11 @@ public interface TriggerCallback { /** * Called once per encounter of a TriggerParam. Not guaranteed to be called if, for example, the window defined in * the TriggerParam is very small and/or the frame rate is really bad. - * + * * @param applyToPose + * apply to pose * @param manager + * animation manager */ void doTrigger(SkeletonPose applyToPose, AnimationManager manager); diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerChannel.java index e6af818..79a56cd 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerChannel.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerChannel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,12 +12,12 @@ package com.ardor3d.extension.animation.skeletal.clip; import java.io.IOException; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.List; import com.ardor3d.annotation.SavableFactory; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; -import com.google.common.collect.Lists; /** * An animation source channel consisting of keyword samples indicating when a specific trigger condition is met. Each @@ -43,7 +43,7 @@ public class TriggerChannel extends AbstractAnimationChannel { super(channelName, times); _keys = keys == null ? null : new String[keys.length]; if (_keys != null) { - System.arraycopy(keys, 0, _keys, 0, keys.length); + System.arraycopy(keys, 0, _keys, 0, _keys.length); } } @@ -94,8 +94,8 @@ public class TriggerChannel extends AbstractAnimationChannel { if (startTime > endTime) { throw new IllegalArgumentException("startTime > endTime"); } - final List<Float> times = Lists.newArrayList(); - final List<String> keys = Lists.newArrayList(); + final List<Float> times = new ArrayList<>(); + final List<String> keys = new ArrayList<>(); final TriggerData tData = new TriggerData(); @@ -132,6 +132,7 @@ public class TriggerChannel extends AbstractAnimationChannel { // Methods for Savable // ///////////////// + @Override public Class<? extends TriggerChannel> getClassTag() { return this.getClass(); } diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerData.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerData.java index 7c0220f..add20eb 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerData.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerData.java @@ -1,26 +1,25 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.animation.skeletal.clip; +import java.util.ArrayList; import java.util.List; -import com.google.common.collect.Lists; - /** * Transient class that maintains the current triggers and armed status for a TriggerChannel. */ public class TriggerData { /** The current trigger name. */ - private final List<String> _currentTriggers = Lists.newArrayList(); + private final List<String> _currentTriggers = new ArrayList<>(); /** * The current channel sample index. We keep this to make sure we don't miss two channels in a row with the same @@ -54,11 +53,11 @@ public class TriggerData { /** * Try to set a given trigger/index as armed. If we already have this trigger and index set, we don't change the * state of armed. - * - * @param trigger - * our trigger name + * * @param index * our sample index + * @param triggers + * our triggers names */ public synchronized void arm(final int index, final String... triggers) { if (triggers == null || triggers.length == 0) { diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/AnimationLayer.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/AnimationLayer.java index eebf755..f98f492 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/AnimationLayer.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/AnimationLayer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.animation.skeletal.layer; +import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.logging.Logger; @@ -19,7 +20,6 @@ import com.ardor3d.extension.animation.skeletal.state.AbstractFiniteState; import com.ardor3d.extension.animation.skeletal.state.AbstractTransitionState; import com.ardor3d.extension.animation.skeletal.state.StateOwner; import com.ardor3d.extension.animation.skeletal.state.SteadyState; -import com.google.common.collect.Maps; /** * Animation layers are essentially independent state machines, managed by a single AnimationManager. Each maintains a @@ -36,7 +36,7 @@ public class AnimationLayer implements StateOwner { private static final Logger logger = Logger.getLogger(AnimationLayer.class.getName()); /** Our animation states */ - private final Map<String, SteadyState> _steadyStates = Maps.newHashMap(); + private final Map<String, SteadyState> _steadyStates = new HashMap<>(); /** Our current animation state */ private AbstractFiniteState _currentState; @@ -51,7 +51,7 @@ public class AnimationLayer implements StateOwner { private final String _name; /** A map of general transitions for moving from the current state to another. */ - private final Map<String, AbstractTransitionState> _transitions = Maps.newHashMap(); + private final Map<String, AbstractTransitionState> _transitions = new HashMap<>(); /** * Construct a new AnimationLayer. diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/LayerBlender.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/LayerBlender.java index 77075c1..0935418 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/LayerBlender.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/LayerBlender.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/LayerLERPBlender.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/LayerLERPBlender.java index d1c8043..3276acb 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/LayerLERPBlender.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/LayerLERPBlender.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -19,7 +19,6 @@ import com.ardor3d.extension.animation.skeletal.blendtree.BinaryLERPSource; * <p> * A layer blender that uses linear interpolation to merge the results of two layers. * </p> - * See also {@link BinaryLERPSource#combineSourceData(Map, Map, double)} */ public class LayerLERPBlender implements LayerBlender { @@ -32,10 +31,12 @@ public class LayerLERPBlender implements LayerBlender { /** Our second layer... generally the layer we were added to. */ private AnimationLayer _layerB; + @Override public String getBlendKey() { return _blendKey; } + @Override public void setBlendKey(final String blendKey) { _blendKey = blendKey; } @@ -44,6 +45,7 @@ public class LayerLERPBlender implements LayerBlender { return _layerA; } + @Override public void setLayerA(final AnimationLayer layer) { _layerA = layer; } @@ -52,17 +54,19 @@ public class LayerLERPBlender implements LayerBlender { return _layerB; } + @Override public void setLayerB(final AnimationLayer layer) { _layerB = layer; } + @Override public Map<String, ? extends Object> getBlendedSourceData(final AnimationManager manager) { // grab our data maps from the two layers... // set A final Map<String, ? extends Object> sourceAData = getLayerA().getCurrentSourceData(); // set B - final Map<String, ? extends Object> sourceBData = getLayerB().getCurrentState() != null ? getLayerB() - .getCurrentState().getCurrentSourceData(manager) : null; + final Map<String, ? extends Object> sourceBData = getLayerB().getCurrentState() != null + ? getLayerB().getCurrentState().getCurrentSourceData(manager) : null; return BinaryLERPSource.combineSourceData(sourceAData, sourceBData, manager.getValuesStore().get(_blendKey)); } diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractFiniteState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractFiniteState.java index 0353f93..b1ac50d 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractFiniteState.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractFiniteState.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -32,7 +32,7 @@ public abstract class AbstractFiniteState { /** * Reset the clip instances held by this state's blend tree (or other leaf nodes in our blend tree) to a start time * using the current global time from the given manager. - * + * * @param manager * our manager. */ @@ -43,7 +43,7 @@ public abstract class AbstractFiniteState { /** * Reset the clip instances held by this state's blend tree (or other leaf nodes in our blend tree) to given start * time. - * + * * @param manager * our manager. * @param globalStartTime @@ -55,7 +55,7 @@ public abstract class AbstractFiniteState { /** * Update this state using the current global time. - * + * * @param globalTime * the current global time. * @param layer @@ -65,13 +65,16 @@ public abstract class AbstractFiniteState { /** * Post update. If the state has no more clips and no end transition, this will clear this state from the layer. - * + * * @param layer * the layer this state belongs to. */ public abstract void postUpdate(final AnimationLayer layer); /** + * @param manager + * animation manager + * * @return the current map of source channel data for this layer. */ public abstract Map<String, ? extends Object> getCurrentSourceData(AnimationManager manager); diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTransitionState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTransitionState.java index 66efc81..e2ebe46 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTransitionState.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTransitionState.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -18,12 +18,12 @@ import com.ardor3d.extension.animation.skeletal.layer.AnimationLayer; public abstract class AbstractTransitionState extends AbstractFiniteState { /** - * @see {@link AbstractTransitionState#setStartWindow(double)} + * @see AbstractTransitionState#setStartWindow(double) */ private double _startWindow = -1; /** - * @see {@link AbstractTransitionState#setEndWindow(double)} + * @see AbstractTransitionState#setEndWindow(double) */ private double _endWindow = -1; @@ -34,7 +34,7 @@ public abstract class AbstractTransitionState extends AbstractFiniteState { /** * Construct a new transition state. - * + * * @param targetState * the name of the steady state we want the Animation Layer to be in at the end of the transition. */ @@ -51,9 +51,10 @@ public abstract class AbstractTransitionState extends AbstractFiniteState { /** * @param startWindow - * our new start window value. If greater than 0, this transition is only valid if the current time is >= - * startWindow. Note that animations are separate from states, so time scaling an animation will not - * affect transition windows directly and must be factored into the start/end values. + * our new start window value. If greater than 0, this transition is only valid if the current time is + * greater than or equal to startWindow. Note that animations are separate from states, so time scaling + * an animation will not affect transition windows directly and must be factored into the start/end + * values. */ public void setStartWindow(final double startWindow) { _startWindow = startWindow; @@ -69,9 +70,9 @@ public abstract class AbstractTransitionState extends AbstractFiniteState { /** * @param endWindow - * our new end window value. If greater than 0, this transition is only valid if the current time is <= - * endWindow. Note that animations are separate from states, so time scaling an animation will not affect - * transition windows directly and must be factored into the start/end values. + * our new end window value. If greater than 0, this transition is only valid if the current time is less + * than or equal to endWindow. Note that animations are separate from states, so time scaling an + * animation will not affect transition windows directly and must be factored into the start/end values. */ public void setEndWindow(final double endWindow) { _endWindow = endWindow; @@ -87,7 +88,7 @@ public abstract class AbstractTransitionState extends AbstractFiniteState { /** * Request that this state perform a transition to another. - * + * * @param callingState * the state calling for this transition. * @param layer @@ -137,7 +138,7 @@ public abstract class AbstractTransitionState extends AbstractFiniteState { /** * Do the transition logic for this transition state. - * + * * @param callingState * the state calling for this transition. * @param layer diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTwoStateLerpTransition.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTwoStateLerpTransition.java index 57d9d6f..26614f3 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTwoStateLerpTransition.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTwoStateLerpTransition.java @@ -1,22 +1,22 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.animation.skeletal.state; +import java.util.HashMap; import java.util.Map; import com.ardor3d.extension.animation.skeletal.AnimationManager; import com.ardor3d.extension.animation.skeletal.blendtree.BinaryLERPSource; import com.ardor3d.extension.animation.skeletal.layer.AnimationLayer; import com.ardor3d.math.MathUtils; -import com.google.common.collect.Maps; /** * An abstract transition state that blends between two other states. @@ -63,7 +63,7 @@ public abstract class AbstractTwoStateLerpTransition extends AbstractTransitionS /** * Construct a new AbstractTwoStateLerpTransition. - * + * * @param targetState * the name of the steady state we want the Animation Layer to be in at the end of the transition. * @param fadeTime @@ -105,7 +105,7 @@ public abstract class AbstractTwoStateLerpTransition extends AbstractTransitionS } /** - * @param stateA + * @param stateB * sets the end state. Updates the state's owner to point to this transition. */ public void setStateB(final AbstractFiniteState stateB) { @@ -186,20 +186,21 @@ public abstract class AbstractTwoStateLerpTransition extends AbstractTransitionS @Override public Map<String, ? extends Object> getCurrentSourceData(final AnimationManager manager) { // grab our data maps from the two states - final Map<String, ? extends Object> sourceAData = getStateA() != null ? getStateA().getCurrentSourceData( - manager) : null; - final Map<String, ? extends Object> sourceBData = getStateB() != null ? getStateB().getCurrentSourceData( - manager) : null; + final Map<String, ? extends Object> sourceAData = getStateA() != null + ? getStateA().getCurrentSourceData(manager) : null; + final Map<String, ? extends Object> sourceBData = getStateB() != null + ? getStateB().getCurrentSourceData(manager) : null; // reuse previous _sourceData transforms to avoid re-creating // too many new transform data objects. This assumes that a // same state always returns the same transform data objects. if (_sourceData == null) { - _sourceData = Maps.newHashMap(); + _sourceData = new HashMap<>(); } return BinaryLERPSource.combineSourceData(sourceAData, sourceBData, getPercent(), _sourceData); } + @Override public void replaceState(final AbstractFiniteState currentState, final AbstractFiniteState newState) { if (newState != null) { if (getStateA() == currentState) { diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/FadeTransitionState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/FadeTransitionState.java index 70020fe..52af894 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/FadeTransitionState.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/FadeTransitionState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/FrozenTransitionState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/FrozenTransitionState.java index 355020a..5e37ce3 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/FrozenTransitionState.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/FrozenTransitionState.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -17,16 +17,16 @@ import com.ardor3d.extension.animation.skeletal.layer.AnimationLayer; * A two state transition that freezes the starting state at its current position and blends that over time with a * target state. The target state moves forward in time during the blend as normal. * </p> - * + * * XXX: Might be able to make this more efficient by capturing the getCurrentSourceData of stateA and reusing. */ public class FrozenTransitionState extends AbstractTwoStateLerpTransition { /** * Construct a new FrozenTransitionState. - * - * @param the - * name of the steady state we want the Animation Layer to be in at the end of the transition. + * + * @param targetState + * the name of the steady state we want the Animation Layer to be in at the end of the transition. * @param fadeTime * the amount of time we should take to do the transition. * @param type diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/IgnoreTransitionState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/IgnoreTransitionState.java index 153b181..9eb1531 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/IgnoreTransitionState.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/IgnoreTransitionState.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -22,9 +22,6 @@ public class IgnoreTransitionState extends AbstractTransitionState { /** * Construct a new transition state. - * - * @param targetState - * the name of the state to transition to. */ public IgnoreTransitionState() { super(null); diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/ImmediateTransitionState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/ImmediateTransitionState.java index 58b8ccd..00caf5e 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/ImmediateTransitionState.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/ImmediateTransitionState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,11 +10,11 @@ package com.ardor3d.extension.animation.skeletal.state; +import java.util.HashMap; import java.util.Map; import com.ardor3d.extension.animation.skeletal.AnimationManager; import com.ardor3d.extension.animation.skeletal.layer.AnimationLayer; -import com.google.common.collect.Maps; /** * Cuts directly to the set target state, without any intermediate transition action. @@ -49,7 +49,7 @@ public class ImmediateTransitionState extends AbstractTransitionState { */ @Override public Map<String, ? extends Object> getCurrentSourceData(final AnimationManager manager) { - return Maps.newHashMap(); + return new HashMap<>(); } /** diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/StateOwner.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/StateOwner.java index 9de029e..46ff682 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/StateOwner.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/StateOwner.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SteadyState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SteadyState.java index 992d83d..0f838ac 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SteadyState.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SteadyState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,13 +10,13 @@ package com.ardor3d.extension.animation.skeletal.state; +import java.util.HashMap; import java.util.Map; import java.util.Set; import com.ardor3d.extension.animation.skeletal.AnimationManager; import com.ardor3d.extension.animation.skeletal.blendtree.BlendTreeSource; import com.ardor3d.extension.animation.skeletal.layer.AnimationLayer; -import com.google.common.collect.Maps; /** * A "steady" state is an animation state that is concrete and stand-alone (vs. a state that handles transitioning @@ -28,7 +28,7 @@ public class SteadyState extends AbstractFiniteState { private final String _name; /** A map of possible transitions for moving from this state to another. */ - private final Map<String, AbstractTransitionState> _transitions = Maps.newHashMap(); + private final Map<String, AbstractTransitionState> _transitions = new HashMap<>(); /** A transition to use if we reach the end of this state. May be null. */ private AbstractTransitionState _endTransition; diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SyncFadeTransitionState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SyncFadeTransitionState.java index a6a59bb..c449cbe 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SyncFadeTransitionState.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SyncFadeTransitionState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/ImportClipMap.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/ImportClipMap.java index d8ba845..56f24c6 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/ImportClipMap.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/ImportClipMap.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -16,7 +16,7 @@ import com.ardor3d.extension.animation.skeletal.clip.AnimationClip; import com.ardor3d.extension.animation.skeletal.util.LoggingMap; /** - * This class essentially just wraps a String->Animation HashMap, providing extra logging when a clip is not found, or + * This class essentially just wraps a String / Animation HashMap, providing extra logging when a clip is not found, or * duplicate clips are added. */ public class ImportClipMap extends LoggingMap<String, AnimationClip> { @@ -26,7 +26,7 @@ public class ImportClipMap extends LoggingMap<String, AnimationClip> { /** * Add a clip to the store. Logs a warning if a clip by the same name was already in the store. - * + * * @param clip * the clip to add. */ diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/InputStore.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/InputStore.java index 20ba2bc..354c1fd 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/InputStore.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/InputStore.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/JSLayerImporter.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/JSLayerImporter.java index f31e8fc..1e2e6df 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/JSLayerImporter.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/JSLayerImporter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputClipSourceMap.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputClipSourceMap.java index cc98260..ad325c5 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputClipSourceMap.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputClipSourceMap.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -16,7 +16,7 @@ import com.ardor3d.extension.animation.skeletal.blendtree.ClipSource; import com.ardor3d.extension.animation.skeletal.util.LoggingMap; /** - * This class essentially just wraps a String->ClipSource HashMap, providing extra logging when a ClipSource is not + * This class essentially just wraps a String / ClipSource HashMap, providing extra logging when a ClipSource is not * found, or duplicate ClipSources are added. */ public class OutputClipSourceMap extends LoggingMap<String, ClipSource> { @@ -26,7 +26,7 @@ public class OutputClipSourceMap extends LoggingMap<String, ClipSource> { /** * Add a ClipSource to the store. Logs a warning if a source by the same name was already in the store. - * + * * @param source * the clip source to add. */ diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputStore.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputStore.java index b72b548..f4c5d74 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputStore.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputStore.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,10 +10,10 @@ package com.ardor3d.extension.animation.skeletal.state.loader; +import java.util.ArrayList; import java.util.List; import com.ardor3d.extension.animation.skeletal.AttachmentPoint; -import com.google.common.collect.Lists; /** * Storage class for items created during Layer import. @@ -21,7 +21,7 @@ import com.google.common.collect.Lists; public class OutputStore { /** List of attachment points created during layer import. */ - private final List<AttachmentPoint> _attachments = Lists.newArrayList(); + private final List<AttachmentPoint> _attachments = new ArrayList<>(); /** List of animation clip sources encountered during layer import. */ private final OutputClipSourceMap _usedClipSources = new OutputClipSourceMap(); diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/LoggingMap.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/LoggingMap.java index ab7ea19..394757b 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/LoggingMap.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/LoggingMap.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -11,14 +11,13 @@ package com.ardor3d.extension.animation.skeletal.util; import java.util.Collection; +import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.logging.Logger; -import com.google.common.collect.Maps; - /** - * This class essentially just wraps a KEY->VALUE HashMap, providing extra logging when a VALUE is not found, or + * This class essentially just wraps a KEY/VALUE HashMap, providing extra logging when a VALUE is not found, or * duplicate VALUE objects are added. An optional callback may be provided to try to load values not present in this * map. These are loaded using the string representation of the key and casting the return from Object to the value * class. If the value is still null, a default value is returned. @@ -29,7 +28,7 @@ public class LoggingMap<KEY, VALUE> { private static final Logger logger = Logger.getLogger(LoggingMap.class.getName()); /** Our map of values. */ - protected final Map<KEY, VALUE> _wrappedMap = Maps.newHashMap(); + protected final Map<KEY, VALUE> _wrappedMap = new HashMap<>(); /** If not null, this callback is asked to load the missing value using the key. */ private MissingCallback<KEY, VALUE> _missCallback = null; @@ -46,7 +45,7 @@ public class LoggingMap<KEY, VALUE> { /** * Add a value to the store. Logs a warning if a value by the same key was already in the store and logOnReplace is * true. - * + * * @param key * the key to add. * @param value @@ -63,7 +62,7 @@ public class LoggingMap<KEY, VALUE> { /** * Retrieves a value from our store by key. Logs a warning if a value by that key is not found and logOnMissing is * true. If missing, defaultValue is returned. - * + * * @param key * the key of the value to find. * @return the associated value, or null if none is found. @@ -81,8 +80,8 @@ public class LoggingMap<KEY, VALUE> { // value still null... if (value == null) { if (isLogOnMissing()) { - LoggingMap.logger.warning("Value not found with key: " + key + " Returning defaultValue: " - + _defaultValue); + LoggingMap.logger + .warning("Value not found with key: " + key + " Returning defaultValue: " + _defaultValue); } return getDefaultValue(); } @@ -91,7 +90,7 @@ public class LoggingMap<KEY, VALUE> { /** * Removes the mapping for the given key. - * + * * @param key * the key of the value to remove. * @return the previously associated value, or null if none was found. diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/MissingCallback.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/MissingCallback.java index 391f7aa..5f8a513 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/MissingCallback.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/MissingCallback.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/SkeletalDebugger.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/SkeletalDebugger.java index 9ac819f..9e0a21a 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/SkeletalDebugger.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/SkeletalDebugger.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -50,6 +50,7 @@ public class SkeletalDebugger { protected static final BoundingSphere measureSphere = new BoundingSphere(); protected static final BasicText jointText = BasicText.createDefaultTextLabel("", ""); + static { // No lighting, replace texturing SkeletalDebugger.jointText.getSceneHints().setLightCombineMode(LightCombineMode.Off); @@ -65,7 +66,7 @@ public class SkeletalDebugger { /** * Traverse the given scene and draw the currently posed Skeleton of any SkinnedMesh we encounter. - * + * * @param scene * the scene * @param renderer @@ -78,7 +79,7 @@ public class SkeletalDebugger { /** * Traverse the given scene and draw the currently posed Skeleton of any SkinnedMesh we encounter. If showLabels is * true, joint names will be drawn over the joints. - * + * * @param scene * the scene * @param renderer @@ -130,10 +131,11 @@ public class SkeletalDebugger { /** * Draw a skeleton in a specific pose. - * + * * @param pose * the posed skeleton to draw * @param scene + * the scene * @param renderer * the Renderer to draw with. * @param showLabels @@ -165,8 +167,8 @@ public class SkeletalDebugger { final Transform t = scene.getWorldTransform().multiply(globals[i], store); point.zero(); - SkeletalDebugger.jointText.setTranslation(Camera.getCurrentCamera().getScreenCoordinates( - t.applyForward(point))); + SkeletalDebugger.jointText + .setTranslation(Camera.getCurrentCamera().getScreenCoordinates(t.applyForward(point))); final double size = SkeletalDebugger.LABEL_RATIO; SkeletalDebugger.jointText.setScale(size, size, -size); @@ -183,13 +185,14 @@ public class SkeletalDebugger { /** Our bone shape. */ private static final Pyramid bone = new Pyramid("bone", 1, 1); + static { // Alter the primitive to better represent our bone. // Set color to white SkeletalDebugger.setBoneColor(ColorRGBA.WHITE); // Rotate the vertices of our bone to point along the Z axis instead of the Y. - SkeletalDebugger.bone.getMeshData().rotatePoints( - new Quaternion().fromAngleAxis(90 * MathUtils.DEG_TO_RAD, Vector3.UNIT_X)); + SkeletalDebugger.bone.getMeshData() + .rotatePoints(new Quaternion().fromAngleAxis(90 * MathUtils.DEG_TO_RAD, Vector3.UNIT_X)); // Drop the normals SkeletalDebugger.bone.getMeshData().setNormalBuffer(null); @@ -208,12 +211,13 @@ public class SkeletalDebugger { /** * Draw a single bone using the given world-space joint transformations. - * + * * @param start * our parent joint transform * @param end * our child joint transform * @param scene + * the scene * @param renderer * the Renderer to draw with. */ @@ -254,8 +258,8 @@ public class SkeletalDebugger { SkeletalDebugger.bone.setWorldRotation(q); // Offset with skin transform - SkeletalDebugger.bone.setWorldTransform(scene.getWorldTransform().multiply( - SkeletalDebugger.bone.getWorldTransform(), null)); + SkeletalDebugger.bone + .setWorldTransform(scene.getWorldTransform().multiply(SkeletalDebugger.bone.getWorldTransform(), null)); // Release some temp vars. Matrix3.releaseTempInstance(orient); @@ -268,7 +272,7 @@ public class SkeletalDebugger { /** * Set the color of the joint label object used in showing joint names. - * + * * @param color * the new color to use for joint labels. */ @@ -278,7 +282,7 @@ public class SkeletalDebugger { /** * Set the color of the bone object used in skeleton drawing. - * + * * @param color * the new color to use for skeleton bones. */ @@ -288,6 +292,7 @@ public class SkeletalDebugger { /** Our joint shape. */ private static final Sphere joint = new Sphere("joint", 3, 4, 0.5); + static { // Alter the primitive to better represent our joint. // Set color to cyan @@ -307,15 +312,17 @@ public class SkeletalDebugger { // Update our joint and make it ready for use. SkeletalDebugger.joint.updateGeometricState(0); } + private static Transform spTransform = new Transform(); private static Matrix3 spMatrix = new Matrix3(); /** * Draw a single Joint using the given world-space joint transform. - * + * * @param jntTransform * our joint transform * @param scene + * the scene * @param renderer * the Renderer to draw with. */ @@ -337,7 +344,7 @@ public class SkeletalDebugger { /** * Set the color of the joint object used in skeleton drawing. - * + * * @param color * the new color to use for skeleton joints. */ diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/SkinUtils.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/SkinUtils.java index d94373c..f93b89a 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/SkinUtils.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/SkinUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -29,6 +29,7 @@ public class SkinUtils { */ public static void setAutoUpdateBounds(final Spatial root, final boolean doUpdate) { root.acceptVisitor(new Visitor() { + @Override public void visit(final Spatial spatial) { // we only care about SkinnedMesh if (spatial instanceof SkinnedMesh) { diff --git a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu.frag b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu.frag index dba85b4..da944a3 100644 --- a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu.frag +++ b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu.vert b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu.vert index 1f7c760..3006305 100644 --- a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu.vert +++ b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_mat4.vert b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_mat4.vert index 8e02d6e..fd6c353 100644 --- a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_mat4.vert +++ b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_mat4.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.frag b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.frag index afb5dc9..ce87f4f 100644 --- a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.frag +++ b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.vert b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.vert index fbd1748..c96d670 100644 --- a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.vert +++ b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/state/loader/functions.js b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/state/loader/functions.js index 4e0b2cd..facf0a9 100644 --- a/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/state/loader/functions.js +++ b/ardor3d-animation/src/main/resources/com/ardor3d/extension/animation/skeletal/state/loader/functions.js @@ -5,7 +5,7 @@ importPackage(Packages.com.ardor3d.extension.animation.skeletal.layer); importPackage(Packages.com.ardor3d.extension.animation.skeletal.state); /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-awt/.settings/org.eclipse.jdt.core.prefs b/ardor3d-awt/.settings/org.eclipse.jdt.core.prefs index 16496e9..941c850 100644 --- a/ardor3d-awt/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-awt/.settings/org.eclipse.jdt.core.prefs @@ -89,12 +89,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-awt/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-awt/.settings/org.eclipse.jdt.ui.prefs index 2cb0f4c..9cac248 100644 --- a/ardor3d-awt/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-awt/.settings/org.eclipse.jdt.ui.prefs @@ -59,7 +59,7 @@ org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -82,7 +82,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false diff --git a/ardor3d-awt/build.gradle b/ardor3d-awt/build.gradle new file mode 100644 index 0000000..01379e4 --- /dev/null +++ b/ardor3d-awt/build.gradle @@ -0,0 +1,5 @@ + +description = 'Ardor 3D AWT' +dependencies { + compile project(':ardor3d-core') +} diff --git a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageLoader.java b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageLoader.java index 839d03a..5ecbeb3 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageLoader.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageLoader.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -19,6 +19,7 @@ import java.awt.image.renderable.RenderableImage; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; @@ -31,7 +32,6 @@ import com.ardor3d.image.util.ImageLoader; import com.ardor3d.image.util.ImageLoaderUtil; import com.ardor3d.renderer.state.TextureState; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; /** * Image loader that makes use of AWT's ImageIO to load image file data. @@ -49,7 +49,7 @@ public class AWTImageLoader implements ImageLoader { public static void registerLoader() { if (supportedFormats == null) { - final List<String> formats = Lists.newArrayList(); + final List<String> formats = new ArrayList<>(); for (String format : ImageIO.getReaderFormatNames()) { format = "." + format.toUpperCase(); if (!formats.contains(format)) { @@ -61,6 +61,7 @@ public class AWTImageLoader implements ImageLoader { ImageLoaderUtil.registerHandler(new AWTImageLoader(), supportedFormats); } + @Override public Image load(final InputStream is, final boolean flipImage) throws IOException { final BufferedImage image = ImageIO.read(is); if (image == null) { diff --git a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageUtil.java b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageUtil.java index ef417be..d158478 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageUtil.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -13,11 +13,11 @@ package com.ardor3d.image.util.awt; import java.awt.Color; import java.awt.image.BufferedImage; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.List; import com.ardor3d.image.Image; import com.ardor3d.image.PixelDataType; -import com.google.common.collect.Lists; /** * Utility methods for converting Ardor3D Images to AWT BufferedImages. @@ -63,7 +63,7 @@ public abstract class AWTImageUtil { final int width = input.getWidth(), height = input.getHeight(); // create our return list - final List<BufferedImage> rVal = Lists.newArrayList(); + final List<BufferedImage> rVal = new ArrayList<>(); // Calculate our modulation or "tint" values per channel final double tRed = tint != null ? tint.getRed() / 255. : 1.0; diff --git a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTTextureUtil.java b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTTextureUtil.java index 76f1447..3d7525d 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTTextureUtil.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTTextureUtil.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -22,7 +22,7 @@ public abstract class AWTTextureUtil { /** * Convenience Utility for loading a BufferedImage as an Ardor3D Texture. - * + * * @param image * our buffered image * @param minFilter @@ -36,8 +36,8 @@ public abstract class AWTTextureUtil { public static final Texture loadTexture(final BufferedImage image, final Texture.MinificationFilter minFilter, final TextureStoreFormat storeFormat, final boolean flipVertically) { final Image imageData = AWTImageLoader.makeArdor3dImage(image, flipVertically); - final String fileType = (image != null) ? "" + image.hashCode() : null; - final TextureKey tkey = TextureKey.getKey(null, flipVertically, storeFormat, fileType, minFilter); + final String imageId = (image != null) ? "" + image.hashCode() : null; + final TextureKey tkey = TextureKey.getKey(null, flipVertically, storeFormat, imageId, minFilter); return TextureManager.loadFromKey(tkey, imageData, null); } } diff --git a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AwtColorUtil.java b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AwtColorUtil.java index 9f9a4fd..376834b 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AwtColorUtil.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AwtColorUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/ScreenShotImageExporter.java b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/ScreenShotImageExporter.java index e3a8e8f..a5c98c0 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/ScreenShotImageExporter.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/ScreenShotImageExporter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -67,6 +67,7 @@ public class ScreenShotImageExporter implements ScreenExportable { _useAlpha = useAlpha; } + @Override public void export(final ByteBuffer data, final int width, final int height) { final BufferedImage img = new BufferedImage(width, height, _useAlpha ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); @@ -105,6 +106,7 @@ public class ScreenShotImageExporter implements ScreenExportable { } } + @Override public ImageDataFormat getFormat() { if (_useAlpha) { return ImageDataFormat.RGBA; diff --git a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtFocusWrapper.java b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtFocusWrapper.java index 5514856..b26793c 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtFocusWrapper.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtFocusWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -28,14 +28,17 @@ public class AwtFocusWrapper implements FocusWrapper, FocusListener { _component = component; } + @Override public void focusGained(final FocusEvent e) { - // do nothing + // do nothing } + @Override public void focusLost(final FocusEvent e) { _focusLost = true; } + @Override public boolean getAndClearFocusLost() { final boolean result = _focusLost; @@ -44,6 +47,7 @@ public class AwtFocusWrapper implements FocusWrapper, FocusListener { return result; } + @Override public void init() { _component.addFocusListener(this); } diff --git a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKey.java b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKey.java index f464154..05fcdc6 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKey.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKey.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKeyboardWrapper.java b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKeyboardWrapper.java index 5aa9a4d..4db16eb 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKeyboardWrapper.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKeyboardWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -31,7 +31,7 @@ import com.google.common.collect.PeekingIterator; */ public class AwtKeyboardWrapper implements KeyboardWrapper, KeyListener { @GuardedBy("this") - protected final LinkedList<KeyEvent> _upcomingEvents = new LinkedList<KeyEvent>(); + protected final LinkedList<KeyEvent> _upcomingEvents = new LinkedList<>(); @GuardedBy("this") protected AwtKeyboardIterator _currentIterator = null; @@ -46,17 +46,21 @@ public class AwtKeyboardWrapper implements KeyboardWrapper, KeyListener { _component = Preconditions.checkNotNull(component, "component"); } + @Override public void init() { _component.addKeyListener(this); _component.addFocusListener(new FocusListener() { + @Override public void focusLost(final FocusEvent e) {} + @Override public void focusGained(final FocusEvent e) { _pressedList.clear(); } }); } + @Override public synchronized PeekingIterator<KeyEvent> getEvents() { if (_currentIterator == null || !_currentIterator.hasNext()) { _currentIterator = new AwtKeyboardIterator(); @@ -65,6 +69,7 @@ public class AwtKeyboardWrapper implements KeyboardWrapper, KeyListener { return _currentIterator; } + @Override public synchronized void keyTyped(final java.awt.event.KeyEvent e) { if (_consumeEvents) { e.consume(); @@ -72,6 +77,7 @@ public class AwtKeyboardWrapper implements KeyboardWrapper, KeyListener { } } + @Override public synchronized void keyPressed(final java.awt.event.KeyEvent e) { final Key pressed = fromKeyEventToKey(e); if (!_pressedList.contains(pressed)) { @@ -83,6 +89,7 @@ public class AwtKeyboardWrapper implements KeyboardWrapper, KeyListener { } } + @Override public synchronized void keyReleased(final java.awt.event.KeyEvent e) { final Key released = fromKeyEventToKey(e); _upcomingEvents.add(new KeyEvent(released, KeyState.UP, e.getKeyChar())); diff --git a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseManager.java b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseManager.java index 194b729..f126a5d 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseManager.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -61,6 +61,7 @@ public class AwtMouseManager implements MouseManager { } } + @Override public void setCursor(final MouseCursor cursor) { if (cursor == MouseCursor.SYSTEM_DEFAULT) { if (_grabbedState == GrabbedState.GRABBED) { @@ -87,6 +88,7 @@ public class AwtMouseManager implements MouseManager { } } + @Override public void setPosition(final int x, final int y) { if (!isSetPositionSupported()) { throw new UnsupportedOperationException(); @@ -98,6 +100,7 @@ public class AwtMouseManager implements MouseManager { setMousePosition(x, y); } else { SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { setMousePosition(x, y); } @@ -118,6 +121,7 @@ public class AwtMouseManager implements MouseManager { _robot.mouseMove(p.x, p.y); } + @Override public void setGrabbed(final GrabbedState grabbedState) { if (!isSetGrabbedSupported()) { throw new UnsupportedOperationException(); @@ -153,14 +157,17 @@ public class AwtMouseManager implements MouseManager { return _transparentCursor; } + @Override public boolean isSetPositionSupported() { return _robot != null; } + @Override public boolean isSetGrabbedSupported() { return _robot != null; } + @Override public GrabbedState getGrabbed() { return _grabbedState; } diff --git a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseWrapper.java b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseWrapper.java index c64b70b..aa36fd9 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseWrapper.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseWrapper.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -32,8 +32,6 @@ import com.ardor3d.input.MouseState; import com.ardor3d.input.MouseWrapper; import com.google.common.collect.AbstractIterator; import com.google.common.collect.EnumMultiset; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.collect.Multiset; import com.google.common.collect.PeekingIterator; @@ -42,7 +40,7 @@ import com.google.common.collect.PeekingIterator; */ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelListener, MouseMotionListener { @GuardedBy("this") - protected final LinkedList<MouseState> _upcomingEvents = Lists.newLinkedList(); + protected final LinkedList<MouseState> _upcomingEvents = new LinkedList<>(); @GuardedBy("this") protected AwtMouseIterator _currentIterator = null; @@ -57,7 +55,7 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL protected final MouseManager _manager; protected final Multiset<MouseButton> _clicks = EnumMultiset.create(MouseButton.class); - protected final EnumMap<MouseButton, Long> _lastClickTime = Maps.newEnumMap(MouseButton.class); + protected final EnumMap<MouseButton, Long> _lastClickTime = new EnumMap<>(MouseButton.class); protected final EnumSet<MouseButton> _clickArmed = EnumSet.noneOf(MouseButton.class); protected int _ignoreX = Integer.MAX_VALUE; @@ -76,12 +74,14 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL } } + @Override public void init() { _component.addMouseListener(this); _component.addMouseMotionListener(this); _component.addMouseWheelListener(this); } + @Override public synchronized PeekingIterator<MouseState> getEvents() { expireClickEvents(); @@ -102,6 +102,7 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL } } + @Override public synchronized void mousePressed(final MouseEvent e) { final MouseButton b = getButtonForEvent(e); if (_clickArmed.contains(b)) { @@ -122,6 +123,7 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL addNewState(e, buttons, null); } + @Override public synchronized void mouseReleased(final MouseEvent e) { initState(e); if (_consumeEvents) { @@ -145,11 +147,13 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL addNewState(e, buttons, null); } + @Override public synchronized void mouseDragged(final MouseEvent e) { // forward to mouseMoved. mouseMoved(e); } + @Override public synchronized void mouseMoved(final MouseEvent e) { _clickArmed.clear(); _clicks.clear(); @@ -206,6 +210,7 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL } } + @Override public void mouseWheelMoved(final MouseWheelEvent e) { initState(e); @@ -224,8 +229,9 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL private void addNewState(final MouseEvent mouseEvent, final EnumMap<MouseButton, ButtonState> enumMap, final Multiset<MouseButton> clicks) { final MouseState newState = new MouseState(mouseEvent.getX(), getArdor3DY(mouseEvent), getDX(mouseEvent), - getDY(mouseEvent), (mouseEvent instanceof MouseWheelEvent ? ((MouseWheelEvent) mouseEvent) - .getWheelRotation() : 0), enumMap, clicks); + getDY(mouseEvent), + (mouseEvent instanceof MouseWheelEvent ? ((MouseWheelEvent) mouseEvent).getWheelRotation() : 0), + enumMap, clicks); synchronized (AwtMouseWrapper.this) { _upcomingEvents.add(newState); @@ -271,6 +277,24 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL case MouseEvent.BUTTON3: button = MouseButton.RIGHT; break; + case 4: + button = MouseButton.FOUR; + break; + case 5: + button = MouseButton.FIVE; + break; + case 6: + button = MouseButton.SIX; + break; + case 7: + button = MouseButton.SEVEN; + break; + case 8: + button = MouseButton.EIGHT; + break; + case 9: + button = MouseButton.NINE; + break; default: throw new RuntimeException("unknown button: " + e.getButton()); } @@ -293,6 +317,7 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL // -- The following interface methods are not used. -- + @Override public synchronized void mouseClicked(final MouseEvent e) { // Yes, we could use the click count here, but in the interests of this working the same way as SWT and Native, // we @@ -302,6 +327,7 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL } } + @Override public synchronized void mouseEntered(final MouseEvent e) { // ignore this if (_consumeEvents) { @@ -309,6 +335,7 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL } } + @Override public synchronized void mouseExited(final MouseEvent e) { // ignore this if (_consumeEvents) { diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/AwtCopyPasteImpl.java b/ardor3d-awt/src/main/java/com/ardor3d/ui/text/awt/AwtCopyPasteImpl.java index 7a67258..43058c5 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/AwtCopyPasteImpl.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/ui/text/awt/AwtCopyPasteImpl.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -8,7 +8,7 @@ * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ -package com.ardor3d.extension.ui.text; +package com.ardor3d.ui.text.awt; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; @@ -16,6 +16,8 @@ import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; +import com.ardor3d.ui.text.CopyPasteImpl; + public class AwtCopyPasteImpl implements CopyPasteImpl { @Override diff --git a/ardor3d-awt/src/test/java/com/ardor3d/input/awt/TestAwtKeyboardWrapper.java b/ardor3d-awt/src/test/java/com/ardor3d/input/awt/TestAwtKeyboardWrapper.java index c03137a..a90cb63 100644 --- a/ardor3d-awt/src/test/java/com/ardor3d/input/awt/TestAwtKeyboardWrapper.java +++ b/ardor3d-awt/src/test/java/com/ardor3d/input/awt/TestAwtKeyboardWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-collada/.settings/org.eclipse.jdt.core.prefs b/ardor3d-collada/.settings/org.eclipse.jdt.core.prefs index 16496e9..941c850 100644 --- a/ardor3d-collada/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-collada/.settings/org.eclipse.jdt.core.prefs @@ -89,12 +89,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-collada/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-collada/.settings/org.eclipse.jdt.ui.prefs index 0750002..6456b29 100644 --- a/ardor3d-collada/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-collada/.settings/org.eclipse.jdt.ui.prefs @@ -59,7 +59,7 @@ org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2011 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -82,7 +82,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false diff --git a/ardor3d-collada/build.gradle b/ardor3d-collada/build.gradle new file mode 100644 index 0000000..1fbe271 --- /dev/null +++ b/ardor3d-collada/build.gradle @@ -0,0 +1,8 @@ + +description = 'Ardor 3D Collada Importer' +dependencies { + compile project(':ardor3d-core') + compile project(':ardor3d-animation') + compile group: 'org.jdom', name: 'jdom2', version:'2.0.4' + compile group: 'jaxen', name: 'jaxen', version:'1.1.4' +} diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java index 55dadff..c4c4365 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.EnumMap; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; @@ -65,8 +66,6 @@ import com.ardor3d.util.export.binary.BinaryImporter; import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.geom.VertMap; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.collect.Multimap; /** @@ -196,7 +195,7 @@ public class ColladaAnimUtils { final Node meshNode = _colladaMeshUtils.buildMesh(geometry); if (meshNode != null) { // Look for skeleton entries in the original <instance_controller> element - final List<Element> skeletonRoots = Lists.newArrayList(); + final List<Element> skeletonRoots = new ArrayList<>(); for (final Element sk : instanceController.getChildren("skeleton")) { final Element skroot = _colladaDOMUtil.findTargetWithId(sk.getText()); if (skroot != null) { @@ -215,9 +214,9 @@ public class ColladaAnimUtils { } // Pull out our joint names and bind matrices - final List<String> jointNames = Lists.newArrayList(); - final List<Transform> bindMatrices = Lists.newArrayList(); - final List<ColladaInputPipe.ParamType> paramTypes = Lists.newArrayList(); + final List<String> jointNames = new ArrayList<>(); + final List<Transform> bindMatrices = new ArrayList<>(); + final List<ColladaInputPipe.ParamType> paramTypes = new ArrayList<>(); for (final Element inputEL : jointsEL.getChildren("input")) { final ColladaInputPipe pipe = new ColladaInputPipe(_colladaDOMUtil, inputEL); @@ -324,8 +323,8 @@ public class ColladaAnimUtils { } // Pull out our per vertex joint indices and weights - final List<Short> jointIndices = Lists.newArrayList(); - final List<Float> jointWeights = Lists.newArrayList(); + final List<Short> jointIndices = new ArrayList<>(); + final List<Float> jointWeights = new ArrayList<>(); int indOff = 0, weightOff = 0; int maxOffset = 0; @@ -647,7 +646,7 @@ public class ColladaAnimUtils { */ private void buildAnimations(final Element parentElement, final Collection<TargetChannel> targetList) { - final List<Element> elementTransforms = new ArrayList<Element>(); + final List<Element> elementTransforms = new ArrayList<>(); for (final Element child : parentElement.getChildren()) { if (_dataCache.getTransformTypes().contains(child.getName())) { elementTransforms.add(child); @@ -670,7 +669,7 @@ public class ColladaAnimUtils { + targetNode.getName() + "(" + targetIndex + ")"); } - final EnumMap<Type, ColladaInputPipe> pipes = Maps.newEnumMap(Type.class); + final EnumMap<Type, ColladaInputPipe> pipes = new EnumMap<>(Type.class); final Element samplerElement = _colladaDOMUtil.findTargetWithId(source); for (final Element inputElement : samplerElement.getChildren("input")) { @@ -709,9 +708,9 @@ public class ColladaAnimUtils { targetChannel.currentPos = 0; } - final List<Float> finalTimeList = Lists.newArrayList(); - final List<Transform> finalTransformList = Lists.newArrayList(); - final List<TargetChannel> workingChannels = Lists.newArrayList(); + final List<Float> finalTimeList = new ArrayList<>(); + final List<Transform> finalTransformList = new ArrayList<>(); + final List<TargetChannel> workingChannels = new ArrayList<>(); for (;;) { float lowestTime = Float.MAX_VALUE; boolean found = false; @@ -765,42 +764,45 @@ public class ColladaAnimUtils { finalTransformList.add(transform); } - final float[] time = new float[finalTimeList.size()]; - for (int i = 0; i < finalTimeList.size(); i++) { - time[i] = finalTimeList.get(i); - } - final Transform[] transforms = finalTransformList.toArray(new Transform[finalTransformList.size()]); - - AnimationClip animationClip = animationItemRoot.getAnimationClip(); - if (animationClip == null) { - animationClip = new AnimationClip(animationItemRoot.getName()); - animationItemRoot.setAnimationClip(animationClip); - } + if (animationItemRoot != null) { - // Make an animation channel - first find if we have a matching joint - Joint joint = _dataCache.getElementJointMapping().get(parentElement); - if (joint == null) { - String nodeName = parentElement.getAttributeValue("name", (String) null); - if (nodeName == null) { // use id if name doesn't exist - nodeName = parentElement.getAttributeValue("id", parentElement.getName()); + final float[] time = new float[finalTimeList.size()]; + for (int i = 0; i < finalTimeList.size(); i++) { + time[i] = finalTimeList.get(i); } - if (nodeName != null) { - joint = _dataCache.getExternalJointMapping().get(nodeName); + final Transform[] transforms = finalTransformList.toArray(new Transform[finalTransformList.size()]); + + AnimationClip animationClip = animationItemRoot.getAnimationClip(); + if (animationClip == null) { + animationClip = new AnimationClip(animationItemRoot.getName()); + animationItemRoot.setAnimationClip(animationClip); } + // Make an animation channel - first find if we have a matching joint + Joint joint = _dataCache.getElementJointMapping().get(parentElement); if (joint == null) { - // no joint still, so make a transform channel. - final TransformChannel transformChannel = new TransformChannel(nodeName, time, transforms); - animationClip.addChannel(transformChannel); - _colladaStorage.getAnimationChannels().add(transformChannel); - return; + String nodeName = parentElement.getAttributeValue("name", (String) null); + if (nodeName == null) { // use id if name doesn't exist + nodeName = parentElement.getAttributeValue("id", parentElement.getName()); + } + if (nodeName != null) { + joint = _dataCache.getExternalJointMapping().get(nodeName); + } + + if (joint == null) { + // no joint still, so make a transform channel. + final TransformChannel transformChannel = new TransformChannel(nodeName, time, transforms); + animationClip.addChannel(transformChannel); + _colladaStorage.getAnimationChannels().add(transformChannel); + return; + } } - } - // create joint channel - final JointChannel jointChannel = new JointChannel(joint, time, transforms); - animationClip.addChannel(jointChannel); - _colladaStorage.getAnimationChannels().add(jointChannel); + // create joint channel + final JointChannel jointChannel = new JointChannel(joint, time, transforms); + animationClip.addChannel(jointChannel); + _colladaStorage.getAnimationChannels().add(jointChannel); + } } /** @@ -923,7 +925,7 @@ public class ColladaAnimUtils { return currentElement; } - private static final Map<String, Integer> symbolMap = Maps.newHashMap(); + private static final Map<String, Integer> symbolMap = new HashMap<>(); static { symbolMap.put("ANGLE", 3); symbolMap.put("TIME", 0); @@ -1021,7 +1023,7 @@ public class ColladaAnimUtils { * @return */ private List<TransformElement> getNodeTransformList(final List<Element> transforms) { - final List<TransformElement> transformList = Lists.newArrayList(); + final List<TransformElement> transformList = new ArrayList<>(); for (final Element transform : transforms) { final double[] array = _colladaDOMUtil.parseDoubleArray(transform); @@ -1170,7 +1172,7 @@ public class ColladaAnimUtils { private static class Target { public String id; - public List<String> sids = Lists.newArrayList(); + public List<String> sids = new ArrayList<>(); public AccessorType accessorType = AccessorType.None; public int accessorIndexX = -1, accessorIndexY = -1; diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java index 42360dc..68bf6d7 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,7 +11,6 @@ package com.ardor3d.extension.model.collada.jdom; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; @@ -23,10 +22,10 @@ import org.jdom2.CDATA; import org.jdom2.Comment; import org.jdom2.DataConversionException; import org.jdom2.Element; -import org.jdom2.JDOMException; import org.jdom2.ProcessingInstruction; import org.jdom2.Text; -import org.jdom2.xpath.XPath; +import org.jdom2.xpath.XPathExpression; +import org.jdom2.xpath.XPathFactory; import com.ardor3d.extension.model.collada.jdom.data.DataCache; import com.ardor3d.math.ColorRGBA; @@ -77,14 +76,9 @@ public class ColladaDOMUtil { * {@link CDATA}, {@link Comment}, {@link ProcessingInstruction}, Boolean, Double, or String. */ public List<?> selectNodes(final Element element, final String query) { - final XPath xPathExpression = getXPathExpression(query); + final XPathExpression<?> xPathExpression = getXPathExpression(query); - try { - return xPathExpression.selectNodes(element); - } catch (final JDOMException e) { - e.printStackTrace(); - } - return Collections.emptyList(); + return xPathExpression.evaluate(element); } /** @@ -99,14 +93,9 @@ public class ColladaDOMUtil { * <code>null</code> if no item was selected. */ public Object selectSingleNode(final Element element, final String query) { - final XPath xPathExpression = getXPathExpression(query); + final XPathExpression<?> xPathExpression = getXPathExpression(query); - try { - return xPathExpression.selectSingleNode(element); - } catch (final JDOMException e) { - e.printStackTrace(); - } - return null; + return xPathExpression.evaluateFirst(element); } private String parseUrl(String baseUrl) { @@ -126,18 +115,13 @@ public class ColladaDOMUtil { * XPath query to compile * @return new XPath expression object */ - private XPath getXPathExpression(final String query) { + private XPathExpression<?> getXPathExpression(final String query) { if (_dataCache.getxPathExpressions().containsKey(query)) { return _dataCache.getxPathExpressions().get(query); } - XPath xPathExpression = null; - try { - xPathExpression = XPath.newInstance(query); - } catch (final JDOMException e) { - e.printStackTrace(); - } + final XPathExpression<?> xPathExpression = XPathFactory.instance().compile(query); _dataCache.getxPathExpressions().put(query, xPathExpression); @@ -158,7 +142,7 @@ public class ColladaDOMUtil { final String content = node.getText(); - final List<String> list = new ArrayList<String>(); + final List<String> list = new ArrayList<>(); final StringTokenizer tokenizer = new StringTokenizer(content, " "); while (tokenizer.hasMoreTokens()) { list.add(tokenizer.nextToken()); @@ -188,7 +172,7 @@ public class ColladaDOMUtil { final String content = node.getText(); - final List<String> list = new ArrayList<String>(); + final List<String> list = new ArrayList<>(); final StringTokenizer tokenizer = new StringTokenizer(content, " "); while (tokenizer.hasMoreTokens()) { list.add(tokenizer.nextToken()); @@ -218,7 +202,7 @@ public class ColladaDOMUtil { final String content = node.getText(); - final List<String> list = new ArrayList<String>(); + final List<String> list = new ArrayList<>(); final StringTokenizer tokenizer = new StringTokenizer(content, " "); while (tokenizer.hasMoreTokens()) { list.add(tokenizer.nextToken()); @@ -248,7 +232,7 @@ public class ColladaDOMUtil { final String content = node.getText(); - final List<String> list = new ArrayList<String>(); + final List<String> list = new ArrayList<>(); final StringTokenizer tokenizer = new StringTokenizer(content, " "); while (tokenizer.hasMoreTokens()) { list.add(tokenizer.nextToken()); @@ -278,7 +262,7 @@ public class ColladaDOMUtil { final String content = node.getText(); - final List<String> list = new ArrayList<String>(); + final List<String> list = new ArrayList<>(); final StringTokenizer tokenizer = new StringTokenizer(content, " "); while (tokenizer.hasMoreTokens()) { list.add(tokenizer.nextToken()); diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaException.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaException.java index edadb0b..0c11362 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaException.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaException.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java index f448ea0..ee78ed4 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -42,6 +42,7 @@ import com.ardor3d.extension.model.collada.jdom.data.DataCache; import com.ardor3d.extension.model.collada.jdom.plugin.ColladaExtraPlugin; import com.ardor3d.scenegraph.MeshData; import com.ardor3d.scenegraph.Node; +import com.ardor3d.util.geom.GeometryTool; import com.ardor3d.util.geom.GeometryTool.MatchCondition; import com.ardor3d.util.resource.RelativeResourceLocator; import com.ardor3d.util.resource.ResourceLocator; @@ -49,7 +50,6 @@ import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.ResourceSource; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; import com.google.common.collect.Multimap; /** @@ -71,7 +71,7 @@ public class ColladaImporter { private final EnumSet<MatchCondition> _optimizeSettings = EnumSet.of(MatchCondition.UVs, MatchCondition.Normal, MatchCondition.Color); private Map<String, Joint> _externalJointMapping; - private final List<ColladaExtraPlugin> _extraPlugins = Lists.newArrayList(); + private final List<ColladaExtraPlugin> _extraPlugins = new ArrayList<>(); public boolean isLoadTextures() { return _loadTextures; @@ -170,7 +170,7 @@ public class ColladaImporter { /** * Reads a Collada file from the given resource and returns it as a ColladaStorage object. - * + * * @param resource * the name of the resource to find. ResourceLocatorTool will be used with TYPE_MODEL to find the * resource. @@ -179,6 +179,22 @@ public class ColladaImporter { * if the resource can not be located or loaded for some reason. */ public ColladaStorage load(final String resource) throws IOException { + return load(resource, new GeometryTool()); + } + + /** + * Reads a Collada file from the given resource and returns it as a ColladaStorage object. + * + * @param resource + * the name of the resource to find. ResourceLocatorTool will be used with TYPE_MODEL to find the + * resource. + * @param geometryTool + * the geometry tool used to minimize the vertex count. + * @return a ColladaStorage data object containing the Collada scene and other useful elements. + * @throws IOException + * if the resource can not be located or loaded for some reason. + */ + public ColladaStorage load(final String resource, final GeometryTool geometryTool) throws IOException { final ResourceSource source; if (_modelLocator == null) { source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, resource); @@ -190,12 +206,12 @@ public class ColladaImporter { throw new IOException("Unable to locate '" + resource + "'"); } - return load(source); + return load(source, geometryTool); } /** * Reads a Collada file from the given resource and returns it as a ColladaStorage object. - * + * * @param resource * the name of the resource to find. * @return a ColladaStorage data object containing the Collada scene and other useful elements. @@ -203,6 +219,21 @@ public class ColladaImporter { * if the resource can not be loaded for some reason. */ public ColladaStorage load(final ResourceSource resource) throws IOException { + return load(resource, new GeometryTool()); + } + + /** + * Reads a Collada file from the given resource and returns it as a ColladaStorage object. + * + * @param resource + * the name of the resource to find. + * @param geometryTool + * the geometry tool used to minimize the vertex count. + * @return a ColladaStorage data object containing the Collada scene and other useful elements. + * @throws IOException + * if the resource can not be loaded for some reason. + */ + public ColladaStorage load(final ResourceSource resource, final GeometryTool geometryTool) throws IOException { final ColladaStorage colladaStorage = new ColladaStorage(); final DataCache dataCache = new DataCache(); if (_externalJointMapping != null) { @@ -211,11 +242,11 @@ public class ColladaImporter { final ColladaDOMUtil colladaDOMUtil = new ColladaDOMUtil(dataCache); final ColladaMaterialUtils colladaMaterialUtils = new ColladaMaterialUtils(this, dataCache, colladaDOMUtil); final ColladaMeshUtils colladaMeshUtils = new ColladaMeshUtils(dataCache, colladaDOMUtil, colladaMaterialUtils, - _optimizeMeshes, _optimizeSettings); + _optimizeMeshes, _optimizeSettings, geometryTool); final ColladaAnimUtils colladaAnimUtils = new ColladaAnimUtils(colladaStorage, dataCache, colladaDOMUtil, colladaMeshUtils); - final ColladaNodeUtils colladaNodeUtils = new ColladaNodeUtils(dataCache, colladaDOMUtil, colladaMaterialUtils, - colladaMeshUtils, colladaAnimUtils); + final ColladaNodeUtils colladaNodeUtils = new ColladaNodeUtils(this, dataCache, colladaDOMUtil, + colladaMaterialUtils, colladaMeshUtils, colladaAnimUtils); try { // Pull in the DOM tree of the Collada resource. @@ -284,7 +315,7 @@ public class ColladaImporter { /** * Reads the whole Collada DOM tree from the given resource and returns its root element. Exceptions may be thrown * by underlying tools; these will be wrapped in a RuntimeException and rethrown. - * + * * @param resource * the ResourceSource to read the resource from * @return the Collada root element @@ -330,7 +361,7 @@ public class ColladaImporter { private Element currentElement; private BufferType bufferType = BufferType.None; private int count = 0; - private final List<String> list = new ArrayList<String>(); + private final List<String> list = new ArrayList<>(); ArdorFactory(final DataCache dataCache) { this.dataCache = dataCache; @@ -481,7 +512,7 @@ public class ColladaImporter { /** * Parse a numeric value. Commas are replaced by dot automaticly. Also handle special values : INF, -INF, NaN - * + * * @param number * string * @return float diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaInputPipe.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaInputPipe.java index 0505c10..ff99c48 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaInputPipe.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaInputPipe.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java index 9c2ccc6..fdd3720 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -103,7 +103,7 @@ public class ColladaMaterialUtils { * temp cache for textures, we do not want to add textures twice (for example, transparant map might point * to diffuse texture) */ - final HashMap<String, Texture> loadedTextures = new HashMap<String, Texture>(); + final HashMap<String, Texture> loadedTextures = new HashMap<>(); final Element effect = effectNode; // XXX: For now, just grab the common technique: final Element common = effect.getChild("profile_COMMON"); diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java index 6fe3de6..4b9cc29 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -43,20 +43,28 @@ public class ColladaMeshUtils { private final ColladaMaterialUtils _colladaMaterialUtils; private final boolean _optimizeMeshes; private final EnumSet<MatchCondition> _optimizeSettings; + private final GeometryTool _geometryTool; public ColladaMeshUtils(final DataCache dataCache, final ColladaDOMUtil colladaDOMUtil, final ColladaMaterialUtils colladaMaterialUtils, final boolean optimizeMeshes, final EnumSet<MatchCondition> optimizeSettings) { + this(dataCache, colladaDOMUtil, colladaMaterialUtils, optimizeMeshes, optimizeSettings, new GeometryTool()); + } + + public ColladaMeshUtils(final DataCache dataCache, final ColladaDOMUtil colladaDOMUtil, + final ColladaMaterialUtils colladaMaterialUtils, final boolean optimizeMeshes, + final EnumSet<MatchCondition> optimizeSettings, final GeometryTool geometryTool) { _dataCache = dataCache; _colladaDOMUtil = colladaDOMUtil; _colladaMaterialUtils = colladaMaterialUtils; _optimizeMeshes = optimizeMeshes; _optimizeSettings = EnumSet.copyOf(optimizeSettings); + _geometryTool = geometryTool; } /** * Builds geometry from an instance_geometry element. - * + * * @param instanceGeometry * @return our Spatial */ @@ -73,7 +81,7 @@ public class ColladaMeshUtils { * Builds a mesh from a Collada geometry element. Currently supported mesh types: mesh, polygons, polylist, * triangles, lines. Not supported yet: linestrips, trifans, tristrips. If no meshtype is found, a pointcloud is * built. - * + * * @param colladaGeometry * @return a Node containing all of the Ardor3D meshes we've parsed from this geometry element. */ @@ -212,7 +220,7 @@ public class ColladaMeshUtils { _dataCache.getVertMappings().put(colladaGeometry, mvp); if (_optimizeMeshes) { - final VertMap map = GeometryTool.minimizeVerts(points, _optimizeSettings); + final VertMap map = _geometryTool.minimizeVerts(points, _optimizeSettings); _dataCache.setMeshVertMap(points, map); } @@ -233,7 +241,7 @@ public class ColladaMeshUtils { // Build and set RenderStates for our material _colladaMaterialUtils.applyMaterial(polys.getAttributeValue("material"), polyMesh); - final LinkedList<ColladaInputPipe> pipes = new LinkedList<ColladaInputPipe>(); + final LinkedList<ColladaInputPipe> pipes = new LinkedList<>(); final int maxOffset = extractPipes(polys, pipes); final int interval = maxOffset + 1; @@ -307,7 +315,7 @@ public class ColladaMeshUtils { } if (_optimizeMeshes) { - final VertMap map = GeometryTool.minimizeVerts(polyMesh, _optimizeSettings); + final VertMap map = _geometryTool.minimizeVerts(polyMesh, _optimizeSettings); _dataCache.setMeshVertMap(polyMesh, map); } @@ -328,7 +336,7 @@ public class ColladaMeshUtils { // Build and set RenderStates for our material _colladaMaterialUtils.applyMaterial(polys.getAttributeValue("material"), polyMesh); - final LinkedList<ColladaInputPipe> pipes = new LinkedList<ColladaInputPipe>(); + final LinkedList<ColladaInputPipe> pipes = new LinkedList<>(); final int maxOffset = extractPipes(polys, pipes); final int interval = maxOffset + 1; @@ -399,7 +407,7 @@ public class ColladaMeshUtils { } if (_optimizeMeshes) { - final VertMap map = GeometryTool.minimizeVerts(polyMesh, _optimizeSettings); + final VertMap map = _geometryTool.minimizeVerts(polyMesh, _optimizeSettings); _dataCache.setMeshVertMap(polyMesh, map); } @@ -420,7 +428,7 @@ public class ColladaMeshUtils { // Build and set RenderStates for our material _colladaMaterialUtils.applyMaterial(tris.getAttributeValue("material"), triMesh); - final LinkedList<ColladaInputPipe> pipes = new LinkedList<ColladaInputPipe>(); + final LinkedList<ColladaInputPipe> pipes = new LinkedList<>(); final int maxOffset = extractPipes(tris, pipes); final int interval = maxOffset + 1; @@ -453,7 +461,7 @@ public class ColladaMeshUtils { } if (_optimizeMeshes) { - final VertMap map = GeometryTool.minimizeVerts(triMesh, _optimizeSettings); + final VertMap map = _geometryTool.minimizeVerts(triMesh, _optimizeSettings); _dataCache.setMeshVertMap(triMesh, map); } @@ -471,7 +479,7 @@ public class ColladaMeshUtils { // Build and set RenderStates for our material _colladaMaterialUtils.applyMaterial(lines.getAttributeValue("material"), lineMesh); - final LinkedList<ColladaInputPipe> pipes = new LinkedList<ColladaInputPipe>(); + final LinkedList<ColladaInputPipe> pipes = new LinkedList<>(); final int maxOffset = extractPipes(lines, pipes); final int interval = maxOffset + 1; @@ -504,7 +512,7 @@ public class ColladaMeshUtils { } if (_optimizeMeshes) { - final VertMap map = GeometryTool.minimizeVerts(lineMesh, _optimizeSettings); + final VertMap map = _geometryTool.minimizeVerts(lineMesh, _optimizeSettings); _dataCache.setMeshVertMap(lineMesh, map); } @@ -515,7 +523,7 @@ public class ColladaMeshUtils { /** * Extract our pipes from the given parent element. - * + * * @param inputsParent * @param pipesStore * the store for our pipes @@ -556,7 +564,7 @@ public class ColladaMeshUtils { /** * Push the values at the given indices of currentVal onto the buffers defined in pipes. - * + * * @param pipes * @param currentVal * @return the vertex index referenced in the given indices based on the pipes. Integer.MIN_VALUE is returned if no @@ -578,7 +586,7 @@ public class ColladaMeshUtils { /** * Extract name from xml element, some exporters don't support 'name' attribute, so we better use the material * instead of a generic name. - * + * * @param element * @return value from 'name' or 'material' attribute */ diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java index 6db31ec..fcf94c4 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -33,7 +33,6 @@ import com.ardor3d.math.Vector3; import com.ardor3d.math.Vector4; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.Spatial; -import com.google.common.collect.Lists; /** * Methods for parsing Collada data related to scenes and node hierarchy. @@ -41,15 +40,17 @@ import com.google.common.collect.Lists; public class ColladaNodeUtils { private static final Logger logger = Logger.getLogger(ColladaNodeUtils.class.getName()); + private final ColladaImporter _importer; private final DataCache _dataCache; private final ColladaDOMUtil _colladaDOMUtil; private final ColladaMaterialUtils _colladaMaterialUtils; private final ColladaMeshUtils _colladaMeshUtils; private final ColladaAnimUtils _colladaAnimUtils; - public ColladaNodeUtils(final DataCache dataCache, final ColladaDOMUtil colladaDOMUtil, - final ColladaMaterialUtils colladaMaterialUtils, final ColladaMeshUtils colladaMeshUtils, - final ColladaAnimUtils colladaAnimUtils) { + public ColladaNodeUtils(final ColladaImporter importer, final DataCache dataCache, + final ColladaDOMUtil colladaDOMUtil, final ColladaMaterialUtils colladaMaterialUtils, + final ColladaMeshUtils colladaMeshUtils, final ColladaAnimUtils colladaAnimUtils) { + _importer = importer; _dataCache = dataCache; _colladaDOMUtil = colladaDOMUtil; _colladaMaterialUtils = colladaMaterialUtils; @@ -95,7 +96,7 @@ public class ColladaNodeUtils { // build a list of joints - one list per skeleton - and build a skeleton for each joint list. for (final JointNode jointChildNode : _dataCache.getRootJointNode().getChildren()) { - final List<Joint> jointList = Lists.newArrayList(); + final List<Joint> jointList = new ArrayList<>(); buildJointLists(jointChildNode, jointList); final Joint[] joints = jointList.toArray(new Joint[jointList.size()]); final Skeleton skeleton = new Skeleton(joints[0].getName() + "_skeleton", joints); @@ -265,7 +266,7 @@ public class ColladaNodeUtils { } final Node node = new Node(nodeName); - final List<Element> transforms = new ArrayList<Element>(); + final List<Element> transforms = new ArrayList<>(); for (final Element child : dNode.getChildren()) { if (_dataCache.getTransformTypes().contains(child.getName())) { transforms.add(child); @@ -327,6 +328,12 @@ public class ColladaNodeUtils { // Cache reference _dataCache.getElementSpatialMapping().put(dNode, node); + final Element extra = dNode.getChild("extra"); + if (extra != null) { + // process with any plugins + _importer.readExtra(extra, node); + } + return node; } diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java index 400384c..1879cb0 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -20,12 +20,11 @@ import com.ardor3d.extension.animation.skeletal.clip.AnimationClip; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; -import com.google.common.collect.Lists; @SavableFactory(factoryMethod = "initSavable") public class AnimationItem implements Savable { private final String _name; - private final List<AnimationItem> _children = Lists.newArrayList(); + private final List<AnimationItem> _children = new ArrayList<>(); private AnimationClip _animationClip; public AnimationItem(final String name) { diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AssetData.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AssetData.java index 9e53f2c..46d9178 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AssetData.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AssetData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java index 8eafa20..bcbb457 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,6 +12,7 @@ package com.ardor3d.extension.model.collada.jdom.data; import java.io.IOException; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -25,7 +26,6 @@ import com.ardor3d.scenegraph.Node; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; -import com.google.common.collect.Lists; import com.google.common.collect.Multimap; /** @@ -34,10 +34,10 @@ import com.google.common.collect.Multimap; public class ColladaStorage implements Savable { private Node _scene; - private final List<SkinData> _skins = Lists.newArrayList(); + private final List<SkinData> _skins = new ArrayList<>(); private AssetData _assetData; - private final List<AbstractAnimationChannel> _transformChannels = Lists.newArrayList(); + private final List<AbstractAnimationChannel> _transformChannels = new ArrayList<>(); private AnimationItem _animationItemRoot; // List of parsed color buffers, useful if collada includes multiple color channels per meshdata object @@ -92,7 +92,7 @@ public class ColladaStorage implements Savable { /** * Extract all animation channels in the Collada file as a single, unified AnimationClip. - * + * * @param name * the name to give our new clip. * @return the new AnimationClip. diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java index 0288777..39960ff 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -11,13 +11,17 @@ package com.ardor3d.extension.model.collada.jdom.data; import java.nio.FloatBuffer; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; +import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import java.util.regex.Pattern; import org.jdom2.Element; -import org.jdom2.xpath.XPath; +import org.jdom2.xpath.XPathExpression; import com.ardor3d.extension.animation.skeletal.AttachmentPoint; import com.ardor3d.extension.animation.skeletal.Joint; @@ -29,8 +33,6 @@ import com.ardor3d.scenegraph.MeshData; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.util.geom.VertMap; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.collect.Multimap; /** @@ -41,7 +43,7 @@ public class DataCache { private final Map<String, Texture> _textures; private final Map<String, Element> _idCache; private final Map<String, Element> _sidCache; - private final Map<String, XPath> _xPathExpressions; + private final Map<String, XPathExpression<?>> _xPathExpressions; private final Pattern _pattern; private final List<String> _transformTypes; @@ -68,35 +70,35 @@ public class DataCache { private final Multimap<Joint, AttachmentPoint> _attachmentPoints = ArrayListMultimap.create(); public DataCache() { - _boundMaterials = Maps.newHashMap(); - _textures = Maps.newHashMap(); - _idCache = Maps.newHashMap(); - _sidCache = Maps.newHashMap(); - _xPathExpressions = Maps.newHashMap(); + _boundMaterials = new HashMap<>(); + _textures = new HashMap<>(); + _idCache = new HashMap<>(); + _sidCache = new HashMap<>(); + _xPathExpressions = new HashMap<>(); _pattern = Pattern.compile("\\s"); - _transformTypes = Collections.unmodifiableList(Lists.newArrayList("lookat", "matrix", "rotate", "scale", - "scew", "translate")); + _transformTypes = Collections.unmodifiableList(Arrays.asList(new String[] { "lookat", "matrix", "rotate", + "scale", "scew", "translate" })); - _floatArrays = Maps.newHashMap(); - _doubleArrays = Maps.newHashMap(); - _booleanArrays = Maps.newHashMap(); - _intArrays = Maps.newHashMap(); - _stringArrays = Maps.newHashMap(); + _floatArrays = new HashMap<>(); + _doubleArrays = new HashMap<>(); + _booleanArrays = new HashMap<>(); + _intArrays = new HashMap<>(); + _stringArrays = new HashMap<>(); _vertMappings = ArrayListMultimap.create(); - _meshVertMap = Maps.newIdentityHashMap(); + _meshVertMap = new IdentityHashMap<>(); _parsedVertexColors = ArrayListMultimap.create(); - _materialInfoMap = Maps.newHashMap(); - _meshMaterialMap = Maps.newIdentityHashMap(); + _materialInfoMap = new HashMap<>(); + _meshMaterialMap = new IdentityHashMap<>(); - _elementSpatialMapping = Maps.newHashMap(); + _elementSpatialMapping = new HashMap<>(); - _elementJointMapping = Maps.newHashMap(); - _externalJointMapping = Maps.newHashMap(); - _skeletons = Lists.newArrayList(); - _jointSkeletonMapping = Maps.newHashMap(); - _skeletonPoseMapping = Maps.newHashMap(); - _controllers = Lists.newArrayList(); + _elementJointMapping = new HashMap<>(); + _externalJointMapping = new HashMap<>(); + _skeletons = new ArrayList<>(); + _jointSkeletonMapping = new HashMap<>(); + _skeletonPoseMapping = new HashMap<>(); + _controllers = new ArrayList<>(); } public void bindMaterial(final String ref, final Element material) { @@ -133,7 +135,7 @@ public class DataCache { return _sidCache; } - public Map<String, XPath> getxPathExpressions() { + public Map<String, XPathExpression<?>> getxPathExpressions() { return _xPathExpressions; } diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java index 66a8c75..e328438 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,15 +10,15 @@ package com.ardor3d.extension.model.collada.jdom.data; +import java.util.ArrayList; import java.util.List; import com.ardor3d.extension.animation.skeletal.Joint; import com.ardor3d.scenegraph.Node; -import com.google.common.collect.Lists; public class JointNode { private JointNode parent; - private final List<JointNode> children = Lists.newArrayList(); + private final List<JointNode> children = new ArrayList<>(); private final Joint joint; /** Scene node associated with the Joint. */ diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java index 91c918d..7fd3528 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,20 +10,20 @@ package com.ardor3d.extension.model.collada.jdom.data; +import java.util.HashMap; import java.util.Map; import com.ardor3d.image.Texture; import com.ardor3d.renderer.state.MaterialState; -import com.google.common.collect.Maps; public class MaterialInfo { private String _materialName; private String _profile; private String _technique; - private final Map<String, String> _textureReferences = Maps.newHashMap(); - private final Map<String, Texture> _textures = Maps.newHashMap(); - private final Map<String, String> _textureFileNames = Maps.newHashMap(); + private final Map<String, String> _textureReferences = new HashMap<>(); + private final Map<String, Texture> _textures = new HashMap<>(); + private final Map<String, String> _textureFileNames = new HashMap<>(); private boolean _useTransparency; private float _transparency = 1.0f; diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MeshVertPairs.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MeshVertPairs.java index 95e1de0..d1c8f78 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MeshVertPairs.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MeshVertPairs.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/NodeType.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/NodeType.java index 93b8224..fe8dfdd 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/NodeType.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/NodeType.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SamplerTypes.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SamplerTypes.java index cd9c9cf..5763d65 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SamplerTypes.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SamplerTypes.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java index 7fea027..8337540 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -22,7 +22,6 @@ import com.ardor3d.scenegraph.Node; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; -import com.google.common.collect.Lists; /** * Data class used to hold references to useful objects created during parsing of a single Collada <skin> tag. @@ -32,7 +31,7 @@ public class SkinData implements Savable { private SkeletonPose _pose; private Node _skinBaseNode; - private final List<SkinnedMesh> _skins = Lists.newArrayList(); + private final List<SkinnedMesh> _skins = new ArrayList<>(); private final String _name; /** diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/TransformElement.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/TransformElement.java index 85dbfb5..260d3a8 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/TransformElement.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/TransformElement.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/plugin/ColladaExtraPlugin.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/plugin/ColladaExtraPlugin.java index d766f38..cd1fe19 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/plugin/ColladaExtraPlugin.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/plugin/ColladaExtraPlugin.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/plugin/GoogleEarthPlugin.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/plugin/GoogleEarthPlugin.java index 73621ff..67bed1a 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/plugin/GoogleEarthPlugin.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/plugin/GoogleEarthPlugin.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/.settings/org.eclipse.jdt.core.prefs b/ardor3d-core/.settings/org.eclipse.jdt.core.prefs index 4fb9310..cf92767 100644 --- a/ardor3d-core/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-core/.settings/org.eclipse.jdt.core.prefs @@ -10,7 +10,6 @@ org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 @@ -92,12 +91,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-core/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-core/.settings/org.eclipse.jdt.ui.prefs index b684f15..6456b29 100644 --- a/ardor3d-core/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-core/.settings/org.eclipse.jdt.ui.prefs @@ -59,7 +59,7 @@ org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2012 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -82,7 +82,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false diff --git a/ardor3d-core/build.gradle b/ardor3d-core/build.gradle new file mode 100644 index 0000000..805eecb --- /dev/null +++ b/ardor3d-core/build.gradle @@ -0,0 +1,6 @@ + +description = 'Ardor 3D Core' +dependencies { + compile project(':ardor3d-math') + compile group: 'com.google.guava', name: 'guava', version:'19.0' +} diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/GuardedBy.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/GuardedBy.java index fadc6b5..91608bd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/annotation/GuardedBy.java +++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/GuardedBy.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/Immutable.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/Immutable.java index c5433f8..8663f8b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/annotation/Immutable.java +++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/Immutable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/MainThread.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/MainThread.java index 6c596d1..2badda4 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/annotation/MainThread.java +++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/MainThread.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/SavableFactory.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/SavableFactory.java index 03e4c7f..f5ede4a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/annotation/SavableFactory.java +++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/SavableFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/ThreadSafe.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/ThreadSafe.java index 4be6bcc..8c3c3d2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/annotation/ThreadSafe.java +++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/ThreadSafe.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java index c7de5dc..2ad7d96 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,6 +12,7 @@ package com.ardor3d.bounding; import java.io.IOException; import java.nio.FloatBuffer; +import java.util.Objects; import com.ardor3d.intersection.IntersectionRecord; import com.ardor3d.math.MathUtils; @@ -65,15 +66,33 @@ public class BoundingBox extends BoundingVolume { } @Override - public boolean equals(final Object other) { - if (other == this) { + public int hashCode() { + return Objects.hash(Integer.valueOf(super.hashCode()), Double.valueOf(getXExtent()), + Double.valueOf(getYExtent()), Double.valueOf(getZExtent())); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { return true; } - if (!(other instanceof BoundingBox)) { + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final BoundingBox other = (BoundingBox) obj; + if (Double.doubleToLongBits(_xExtent) != Double.doubleToLongBits(other._xExtent)) { + return false; + } + if (Double.doubleToLongBits(_yExtent) != Double.doubleToLongBits(other._yExtent)) { return false; } - final BoundingBox b = (BoundingBox) other; - return _center.equals(b._center) && _xExtent == b._xExtent && _yExtent == b._yExtent && _zExtent == b._zExtent; + if (Double.doubleToLongBits(_zExtent) != Double.doubleToLongBits(other._zExtent)) { + return false; + } + return true; } @Override @@ -217,7 +236,7 @@ public class BoundingBox extends BoundingVolume { /** * <code>computeFromPoints</code> creates a new Bounding Box from a given set of points. It uses the * <code>containAABB</code> method as default. - * + * * @param points * the points to contain. */ @@ -233,10 +252,10 @@ public class BoundingBox extends BoundingVolume { return; } - final Vector3 min = _compVect1 - .set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); - final Vector3 max = _compVect2 - .set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); + final Vector3 min = _compVect1.set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, + Double.POSITIVE_INFINITY); + final Vector3 max = _compVect2.set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, + Double.NEGATIVE_INFINITY); final int vertsPerPrimitive = data.getIndexMode(section).getVertexCount(); Vector3[] store = new Vector3[vertsPerPrimitive]; @@ -282,7 +301,7 @@ public class BoundingBox extends BoundingVolume { /** * <code>containAABB</code> creates a minimum-volume axis-aligned bounding box of the points, then selects the * smallest enclosing sphere of the box with the sphere centered at the boxes center. - * + * * @param points * the list of points. */ @@ -333,7 +352,7 @@ public class BoundingBox extends BoundingVolume { /** * <code>whichSide</code> takes a plane (typically provided by a view frustum) to determine which side this bound is * on. - * + * * @param plane * the plane to check against. */ @@ -357,7 +376,7 @@ public class BoundingBox extends BoundingVolume { /** * <code>merge</code> combines this sphere with a second bounding sphere. This new sphere contains both bounding * spheres and is returned. - * + * * @param volume * the sphere to combine with this sphere. * @return the new sphere @@ -371,8 +390,8 @@ public class BoundingBox extends BoundingVolume { switch (volume.getType()) { case AABB: { final BoundingBox vBox = (BoundingBox) volume; - return merge(vBox._center, vBox.getXExtent(), vBox.getYExtent(), vBox.getZExtent(), new BoundingBox( - new Vector3(0, 0, 0), 0, 0, 0)); + return merge(vBox._center, vBox.getXExtent(), vBox.getYExtent(), vBox.getZExtent(), + new BoundingBox(new Vector3(0, 0, 0), 0, 0, 0)); } case Sphere: { @@ -395,7 +414,7 @@ public class BoundingBox extends BoundingVolume { /** * <code>mergeLocal</code> combines this sphere with a second bounding sphere locally. Altering this sphere to * contain both the original and the additional sphere volumes; - * + * * @param volume * the sphere to combine with this sphere. * @return this @@ -455,7 +474,7 @@ public class BoundingBox extends BoundingVolume { /** * Merges this AABB with the given OBB. - * + * * @param volume * the OBB to merge this AABB with. * @return This AABB extended to fit the given OBB. @@ -518,7 +537,7 @@ public class BoundingBox extends BoundingVolume { /** * <code>merge</code> combines this bounding box with another box which is defined by the center, x, y, z extents. - * + * * @param boxCenter * the center of the box to merge with * @param boxX @@ -580,7 +599,7 @@ public class BoundingBox extends BoundingVolume { /** * <code>clone</code> creates a new BoundingBox object containing the same data as this one. - * + * * @param store * where to store the cloned information. if null or wrong class, a new store is created. * @return the new BoundingBox @@ -604,7 +623,7 @@ public class BoundingBox extends BoundingVolume { /** * <code>toString</code> returns the string representation of this object. The form is: * "Radius: RRR.SSSS Center: <Vector>". - * + * * @return the string representation of this. */ @Override @@ -742,8 +761,8 @@ public class BoundingBox extends BoundingVolume { } final double[] distances = new double[] { t[0] }; - final Vector3[] points = new Vector3[] { new Vector3(ray.getDirection()).multiplyLocal(distances[0]) - .addLocal(ray.getOrigin()), }; + final Vector3[] points = new Vector3[] { + new Vector3(ray.getDirection()).multiplyLocal(distances[0]).addLocal(ray.getOrigin()), }; return new IntersectionRecord(distances, points); } @@ -802,7 +821,7 @@ public class BoundingBox extends BoundingVolume { /** * Get our corners using the bounding center and extents. - * + * * @param store * An optional store. Must be at least length of 8. If null, one will be created for you. * @return array filled with our corners. @@ -829,7 +848,7 @@ public class BoundingBox extends BoundingVolume { /** * <code>clip</code> determines if a line segment intersects the current test plane. - * + * * @param denom * the denominator of the line segment. * @param numer @@ -865,7 +884,7 @@ public class BoundingBox extends BoundingVolume { /** * Query extent. - * + * * @param store * where extent gets stored - null to return a new vector * @return store / new vector diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java index ba685e3..1f8b3e9 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,6 +12,7 @@ package com.ardor3d.bounding; import java.io.IOException; import java.nio.FloatBuffer; +import java.util.Objects; import java.util.logging.Level; import java.util.logging.Logger; @@ -55,7 +56,7 @@ public class BoundingSphere extends BoundingVolume { /** * Constructor instantiates a new <code>BoundingSphere</code> object. - * + * * @param r * the radius of the sphere. * @param c @@ -67,6 +68,29 @@ public class BoundingSphere extends BoundingVolume { } @Override + public int hashCode() { + return Objects.hash(Integer.valueOf(super.hashCode()), Double.valueOf(getRadius())); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final BoundingSphere other = (BoundingSphere) obj; + if (Double.doubleToLongBits(_radius) != Double.doubleToLongBits(other._radius)) { + return false; + } + return true; + } + + @Override public Type getType() { return Type.Sphere; } @@ -100,7 +124,7 @@ public class BoundingSphere extends BoundingVolume { /** * <code>getRadius</code> returns the radius of the bounding sphere. - * + * * @return the radius of the bounding sphere. */ @Override @@ -110,7 +134,7 @@ public class BoundingSphere extends BoundingVolume { /** * <code>setRadius</code> sets the radius of this bounding sphere. - * + * * @param radius * the new radius of the bounding sphere. */ @@ -121,7 +145,7 @@ public class BoundingSphere extends BoundingVolume { /** * <code>computeFromPoints</code> creates a new Bounding Sphere from a given set of points. It uses the * <code>calcWelzl</code> method as default. - * + * * @param points * the points to contain. */ @@ -159,7 +183,7 @@ public class BoundingSphere extends BoundingVolume { * Calculates a minimum bounding sphere for the set of points. The algorithm was originally found at * http://www.flipcode.com/cgi-bin/msg.cgi?showThread=COTD-SmallestEnclosingSpheres&forum=cotd&id=-1 in C++ and * translated to java by Cep21 - * + * * @param points * The points to calculate the minimum bounds from. */ @@ -172,7 +196,7 @@ public class BoundingSphere extends BoundingVolume { /** * Used from calcWelzl. This function recurses to calculate a minimum bounding sphere a few points at a time. - * + * * @param points * The array of points to look through. * @param p @@ -225,12 +249,14 @@ public class BoundingSphere extends BoundingVolume { } } + // FIXME move this method into an helper class public static void populateFromBuffer(final Vector3 vector, final float[] buf, final int index) { vector.setX(buf[index * 3]); vector.setY(buf[index * 3 + 1]); vector.setZ(buf[index * 3 + 2]); } + // FIXME move this method into an helper class public static void setInBuffer(final ReadOnlyVector3 vector, final float[] buf, final int index) { if (buf == null) { return; @@ -248,7 +274,7 @@ public class BoundingSphere extends BoundingVolume { /** * Calculates the minimum bounding sphere of 4 points. Used in welzl's algorithm. - * + * * @param O * The 1st point inside the sphere. * @param A @@ -264,8 +290,9 @@ public class BoundingSphere extends BoundingVolume { final Vector3 b = B.subtract(O, null); final Vector3 c = C.subtract(O, null); - final double Denominator = 2.0 * (a.getX() * (b.getY() * c.getZ() - c.getY() * b.getZ()) - b.getX() - * (a.getY() * c.getZ() - c.getY() * a.getZ()) + c.getX() * (a.getY() * b.getZ() - b.getY() * a.getZ())); + final double Denominator = 2.0 * (a.getX() * (b.getY() * c.getZ() - c.getY() * b.getZ()) + - b.getX() * (a.getY() * c.getZ() - c.getY() * a.getZ()) + + c.getX() * (a.getY() * b.getZ() - b.getY() * a.getZ())); if (Denominator == 0) { _center.set(0, 0, 0); setRadius(0); @@ -281,7 +308,7 @@ public class BoundingSphere extends BoundingVolume { /** * Calculates the minimum bounding sphere of 3 points. Used in welzl's algorithm. - * + * * @param O * The 1st point inside the sphere. * @param A @@ -311,7 +338,7 @@ public class BoundingSphere extends BoundingVolume { /** * Calculates the minimum bounding sphere of 2 points. Used in welzl's algorithm. - * + * * @param O * The 1st point inside the sphere. * @param A @@ -319,16 +346,16 @@ public class BoundingSphere extends BoundingVolume { * @see #calcWelzl(java.nio.FloatBuffer) */ private void setSphere(final Vector3 O, final Vector3 A) { - setRadius(Math.sqrt(((A.getX() - O.getX()) * (A.getX() - O.getX()) + (A.getY() - O.getY()) - * (A.getY() - O.getY()) + (A.getZ() - O.getZ()) * (A.getZ() - O.getZ())) / 4f) - + radiusEpsilon - 1); + setRadius( + Math.sqrt(((A.getX() - O.getX()) * (A.getX() - O.getX()) + (A.getY() - O.getY()) * (A.getY() - O.getY()) + + (A.getZ() - O.getZ()) * (A.getZ() - O.getZ())) / 4f) + radiusEpsilon - 1); Vector3.lerp(O, A, .5, _center); } /** * <code>averagePoints</code> selects the sphere center to be the average of the points and the sphere radius to be * the smallest value to enclose all points. - * + * * @param points * the list of points to contain. */ @@ -358,7 +385,7 @@ public class BoundingSphere extends BoundingVolume { /** * <code>whichSide</code> takes a plane (typically provided by a view frustum) to determine which side this bound is * on. - * + * * @param plane * the plane to check against. * @return side @@ -379,7 +406,7 @@ public class BoundingSphere extends BoundingVolume { /** * <code>merge</code> combines this sphere with a second bounding sphere. This new sphere contains both bounding * spheres and is returned. - * + * * @param volume * the sphere to combine with this sphere. * @return a new sphere @@ -423,7 +450,7 @@ public class BoundingSphere extends BoundingVolume { /** * <code>mergeLocal</code> combines this sphere with a second bounding sphere locally. Altering this sphere to * contain both the original and the additional sphere volumes; - * + * * @param volume * the sphere to combine with this sphere. * @return this @@ -462,7 +489,7 @@ public class BoundingSphere extends BoundingVolume { /** * Merges this sphere with the given OBB. - * + * * @param volume * The OBB to merge. * @return This sphere, after merging. @@ -512,7 +539,8 @@ public class BoundingSphere extends BoundingVolume { return this; } - private BoundingVolume merge(final double otherRadius, final ReadOnlyVector3 otherCenter, final BoundingSphere store) { + private BoundingVolume merge(final double otherRadius, final ReadOnlyVector3 otherCenter, + final BoundingSphere store) { // check for infinite bounds... is so, return infinite bounds with center at origin if (Double.isInfinite(otherRadius) || Double.isInfinite(getRadius())) { store.setCenter(Vector3.ZERO); @@ -592,7 +620,7 @@ public class BoundingSphere extends BoundingVolume { /** * <code>clone</code> creates a new BoundingSphere object containing the same data as this one. - * + * * @param store * where to store the cloned information. if null or wrong class, a new store is created. * @return the new BoundingSphere @@ -690,8 +718,8 @@ public class BoundingSphere extends BoundingVolume { discr = (a1 * a1) - a; root = Math.sqrt(discr); final double[] distances = new double[] { root - a1 }; - final Vector3[] points = new Vector3[] { ray.getDirection().multiply(distances[0], new Vector3()) - .addLocal(ray.getOrigin()) }; + final Vector3[] points = new Vector3[] { + ray.getDirection().multiply(distances[0], new Vector3()).addLocal(ray.getOrigin()) }; return new IntersectionRecord(distances, points); } @@ -715,8 +743,8 @@ public class BoundingSphere extends BoundingVolume { } final double[] distances = new double[] { -a1 }; - final Vector3[] points = new Vector3[] { ray.getDirection().multiply(distances[0], new Vector3()) - .addLocal(ray.getOrigin()) }; + final Vector3[] points = new Vector3[] { + ray.getDirection().multiply(distances[0], new Vector3()).addLocal(ray.getOrigin()) }; return new IntersectionRecord(distances, points); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java index 19a9822..e660675 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -13,6 +13,7 @@ package com.ardor3d.bounding; import java.io.IOException; import java.io.Serializable; import java.nio.FloatBuffer; +import java.util.Objects; import com.ardor3d.intersection.IntersectionRecord; import com.ardor3d.math.Vector3; @@ -45,9 +46,29 @@ public abstract class BoundingVolume implements Serializable, Savable { _center.set(center); } + @Override + public int hashCode() { + return Objects.hashCode(getCenter()); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final BoundingVolume other = (BoundingVolume) obj; + return Objects.equals(_center, other._center); + } + /** * Grabs the checkplane we should check first. - * + * */ public int getCheckPlane() { return _checkPlane; @@ -55,7 +76,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * Sets the index of the plane that should be first checked during rendering. - * + * * @param value */ public final void setCheckPlane(final int value) { @@ -68,9 +89,9 @@ public abstract class BoundingVolume implements Serializable, Savable { public abstract Type getType(); /** - * + * * <code>transform</code> alters the location of the bounding volume by a transform. - * + * * @param transform * @param store * @return @@ -78,10 +99,10 @@ public abstract class BoundingVolume implements Serializable, Savable { public abstract BoundingVolume transform(final ReadOnlyTransform transform, final BoundingVolume store); /** - * + * * <code>whichSide</code> returns the side on which the bounding volume lies on a plane. Possible values are * POSITIVE_SIDE, NEGATIVE_SIDE, and NO_SIDE. - * + * * @param plane * the plane to check against this bounding volume. * @return the side on which this bounding volume lies. @@ -89,9 +110,9 @@ public abstract class BoundingVolume implements Serializable, Savable { public abstract ReadOnlyPlane.Side whichSide(ReadOnlyPlane plane); /** - * + * * <code>computeFromPoints</code> generates a bounding volume that encompasses a collection of points. - * + * * @param points * the points to contain. */ @@ -100,7 +121,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * <code>merge</code> combines two bounding volumes into a single bounding volume that contains both this bounding * volume and the parameter volume. - * + * * @param volume * the volume to combine. * @return the new merged bounding volume. @@ -110,7 +131,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * <code>mergeLocal</code> combines two bounding volumes into a single bounding volume that contains both this * bounding volume and the parameter volume. The result is stored locally. - * + * * @param volume * the volume to combine. * @return this @@ -119,7 +140,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * <code>clone</code> creates a new BoundingVolume object containing the same data as this one. - * + * * @param store * where to store the cloned information. if null or wrong class, a new store is created. * @return the new BoundingVolume @@ -146,7 +167,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * Find the distance from the center of this Bounding Volume to the given point. - * + * * @param point * The point to get the distance to * @return distance @@ -157,7 +178,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * Find the squared distance from the center of this Bounding Volume to the given point. - * + * * @param point * The point to get the distance to * @return distance @@ -168,7 +189,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * Find the distance from the nearest edge of this Bounding Volume to the given point. - * + * * @param point * The point to get the distance to * @return distance @@ -178,7 +199,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * determines if this bounding volume and a second given volume are intersecting. Intersecting being: one volume * contains another, one volume overlaps another or one volume touches another. - * + * * @param bv * the second volume to test against. * @return true if this volume intersects the given volume. @@ -187,7 +208,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * determines if a ray intersects this bounding volume. - * + * * @param ray * the ray to test. * @return true if this volume is intersected by a given ray. @@ -196,7 +217,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * determines if a ray intersects this bounding volume and if so, where. - * + * * @param ray * the ray to test. * @return an IntersectionRecord containing information about any intersections made by the given Ray with this @@ -206,7 +227,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * determines if this bounding volume and a given bounding sphere are intersecting. - * + * * @param bs * the bounding sphere to test against. * @return true if this volume intersects the given bounding sphere. @@ -215,7 +236,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * determines if this bounding volume and a given bounding box are intersecting. - * + * * @param bb * the bounding box to test against. * @return true if this volume intersects the given bounding box. @@ -224,7 +245,7 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * determines if this bounding volume and a given bounding box are intersecting. - * + * * @param bb * the bounding box to test against. * @return true if this volume intersects the given bounding box. @@ -232,9 +253,9 @@ public abstract class BoundingVolume implements Serializable, Savable { public abstract boolean intersectsOrientedBoundingBox(OrientedBoundingBox bb); /** - * + * * determines if a given point is contained within this bounding volume. - * + * * @param point * the point to check * @return true if the point lies within this bounding volume. @@ -243,21 +264,24 @@ public abstract class BoundingVolume implements Serializable, Savable { /** * Convert this bounding volume to another, given bounding type. - * + * * @param newType * the type of bounding volume to convert to. * @return a new bounding volume of the given type, containing this bounding volume. */ public abstract BoundingVolume asType(Type newType); + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_center, "center", new Vector3(Vector3.ZERO)); } + @Override public void read(final InputCapsule capsule) throws IOException { _center.set((Vector3) capsule.readSavable("center", new Vector3(Vector3.ZERO))); } + @Override public Class<? extends BoundingVolume> getClassTag() { return this.getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java index b623327..297616e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -42,7 +42,7 @@ import com.ardor3d.scenegraph.Spatial; * intersection tests, but increases the creation time for the tree. The number of triangles a leaf node is responsible * for is defined in CollisionTreeManager. It is actually recommended to allow CollisionTreeManager to maintain the * collision trees for a scene. - * + * * @see com.ardor3d.bounding.CollisionTreeManager */ public class CollisionTree implements Serializable { @@ -87,7 +87,7 @@ public class CollisionTree implements Serializable { /** * Constructor creates a new instance of CollisionTree. - * + * * @param type * the type of collision tree to make * @see Type @@ -98,7 +98,7 @@ public class CollisionTree implements Serializable { /** * Recreate this Collision Tree for the given Node and child index. - * + * * @param childIndex * the index of the child to generate the tree for. * @param parent @@ -120,7 +120,7 @@ public class CollisionTree implements Serializable { /** * Recreate this Collision Tree for the given mesh. - * + * * @param mesh * The mesh that this tree should represent. * @param doSort @@ -199,7 +199,7 @@ public class CollisionTree implements Serializable { /** * Creates a Collision Tree by recursively creating children nodes, splitting the primitives this node is * responsible for in half until the desired primitive count is reached. - * + * * @param start * The start index of the primitivesArray, inclusive. * @param end @@ -224,6 +224,8 @@ public class CollisionTree implements Serializable { // check to see if we are a leaf, if the number of primitives we reference is less than or equal to the maximum // defined by the CollisionTreeManager we are done. if (_end - _start + 1 <= CollisionTreeManager.getInstance().getMaxPrimitivesPerLeaf()) { + _left = null; + _right = null; return; } @@ -254,7 +256,7 @@ public class CollisionTree implements Serializable { /** * Tests if the world bounds of the node at this level intersects a provided bounding volume. If an intersection * occurs, true is returned, otherwise false is returned. If the provided volume is invalid, false is returned. - * + * * @param volume * the volume to intersect with. * @return true if there is an intersect, false otherwise. @@ -276,7 +278,7 @@ public class CollisionTree implements Serializable { /** * Determines if this Collision Tree intersects the given CollisionTree. If a collision occurs, true is returned, * otherwise false is returned. If the provided collisionTree is invalid, false is returned. - * + * * @param collisionTree * The Tree to test. * @return True if they intersect, false otherwise. @@ -355,7 +357,7 @@ public class CollisionTree implements Serializable { * otherwise false is returned. If the provided collisionTree is invalid, false is returned. All collisions that * occur are stored in lists as an integer index into the mesh's triangle buffer. where aList is the primitives for * this mesh and bList is the primitives for the test tree. - * + * * @param collisionTree * The Tree to test. * @param aList @@ -437,7 +439,7 @@ public class CollisionTree implements Serializable { * intersect checks for collisions between this collision tree and a provided Ray. Any collisions are stored in a * provided list as primitive index values. The ray is assumed to have a normalized direction for accurate * calculations. - * + * * @param ray * the ray to test for intersections. * @param store @@ -447,7 +449,7 @@ public class CollisionTree implements Serializable { public List<PrimitiveKey> intersect(final Ray3 ray, final List<PrimitiveKey> store) { List<PrimitiveKey> result = store; if (result == null) { - result = new ArrayList<PrimitiveKey>(); + result = new ArrayList<>(); } // if our ray doesn't hit the bounds, then it must not hit a primitive. @@ -487,7 +489,7 @@ public class CollisionTree implements Serializable { /** * Returns the bounding volume for this tree node in local space. - * + * * @return the bounding volume for this tree node in local space. */ public BoundingVolume getBounds() { @@ -496,7 +498,7 @@ public class CollisionTree implements Serializable { /** * Returns the bounding volume for this tree node in world space. - * + * * @return the bounding volume for this tree node in world space. */ public BoundingVolume getWorldBounds() { @@ -551,13 +553,15 @@ public class CollisionTree implements Serializable { case OBB: // determine the longest length of the box, this axis will be best for sorting. if (((OrientedBoundingBox) _bounds)._extent.getX() > ((OrientedBoundingBox) _bounds)._extent.getY()) { - if (((OrientedBoundingBox) _bounds)._extent.getX() > ((OrientedBoundingBox) _bounds)._extent.getZ()) { + if (((OrientedBoundingBox) _bounds)._extent.getX() > ((OrientedBoundingBox) _bounds)._extent + .getZ()) { _comparator.setAxis(TreeComparator.Axis.X); } else { _comparator.setAxis(TreeComparator.Axis.Z); } } else { - if (((OrientedBoundingBox) _bounds)._extent.getY() > ((OrientedBoundingBox) _bounds)._extent.getZ()) { + if (((OrientedBoundingBox) _bounds)._extent.getY() > ((OrientedBoundingBox) _bounds)._extent + .getZ()) { _comparator.setAxis(TreeComparator.Axis.Y); } else { _comparator.setAxis(TreeComparator.Axis.Z); @@ -590,6 +594,6 @@ public class CollisionTree implements Serializable { * @return a new reference to the given mesh. */ private WeakReference<Mesh> makeRef(final Mesh mesh) { - return new WeakReference<Mesh>(mesh); + return new WeakReference<>(mesh); } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeController.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeController.java index 840b3af..95c4066 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java index bfe0c1d..c655b78 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,12 +14,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.Spatial; import com.google.common.collect.ImmutableList; -import com.google.common.collect.MapMaker; /** * CollisionTreeManager is an automated system for handling the creation and deletion of CollisionTrees. The manager @@ -46,7 +46,7 @@ import com.google.common.collect.MapMaker; * default, the manager will use the UsageTreeController for removing trees, but any other CollisionTreeController is * acceptable. You can create protected tree manually. These are collision trees that you request the manager to create * and not allow them to be removed by the CollisionTreeController. - * + * * @see com.ardor3d.bounding.CollisionTree * @see com.ardor3d.bounding.CollisionTreeController */ @@ -80,14 +80,14 @@ public enum CollisionTreeManager { * private constructor for the Singleton. Initializes the cache. */ private CollisionTreeManager() { - _cache = new MapMaker().weakKeys().makeMap(); + _cache = new WeakHashMap<>(); _protectedList = Collections.synchronizedList(new ArrayList<Mesh>(1)); setCollisionTreeController(new UsageTreeController()); } /** * retrieves the singleton instance of the CollisionTreeManager. - * + * * @return the singleton instance of the manager. */ public static CollisionTreeManager getInstance() { @@ -108,7 +108,7 @@ public enum CollisionTreeManager { /** * sets the CollisionTreeController used for cleaning the cache when the maximum number of elements is reached. - * + * * @param treeRemover * the controller used to clean the cache. */ @@ -119,7 +119,7 @@ public enum CollisionTreeManager { /** * getCollisionTree obtains a collision tree that is assigned to a supplied Mesh. The cache is checked for a * pre-existing tree, if none is available and generateTrees is true, a new tree is created and returned. - * + * * @param mesh * the mesh to use as the key for the tree to obtain. * @return the tree associated with a given mesh @@ -148,7 +148,7 @@ public enum CollisionTreeManager { * creates a new collision tree for the provided spatial. If the spatial is a node, it recursively calls * generateCollisionTree for each child. If it is a Mesh, a call to generateCollisionTree is made for each mesh. If * this tree(s) is to be protected, i.e. not deleted by the CollisionTreeController, set protect to true. - * + * * @param type * the type of collision tree to generate. * @param object @@ -174,7 +174,7 @@ public enum CollisionTreeManager { * The tree is placed in the cache. If the cache's size then becomes too large, the cache is sent to the * CollisionTreeController for clean-up. If this tree is to be protected, i.e. protected from the * CollisionTreeController, set protect to true. - * + * * @param type * the type of collision tree to generate. * @param mesh @@ -200,7 +200,7 @@ public enum CollisionTreeManager { * placed in the cache. If the cache's size then becomes too large, the cache is sent to the CollisionTreeController * for clean-up. If this tree is to be protected, i.e. protected from the CollisionTreeController, set protect to * true. - * + * * @param tree * the tree to use for generation * @param mesh @@ -226,7 +226,7 @@ public enum CollisionTreeManager { /** * removes a collision tree from the manager based on the mesh supplied. - * + * * @param mesh * the mesh to remove the corresponding collision tree. */ @@ -237,7 +237,7 @@ public enum CollisionTreeManager { /** * removes all collision trees associated with a Spatial object. - * + * * @param object * the spatial to remove all collision trees from. */ @@ -255,7 +255,7 @@ public enum CollisionTreeManager { /** * updates the existing tree for a supplied mesh. If this tree does not exist, the tree is not updated. If the tree * is not in the cache, no further operations are handled. - * + * * @param mesh * the mesh key for the tree to update. */ @@ -269,7 +269,7 @@ public enum CollisionTreeManager { /** * updates the existing tree(s) for a supplied spatial. If this tree does not exist, the tree is not updated. If the * tree is not in the cache, no further operations are handled. - * + * * @param object * the object on which to update the tree. */ @@ -286,7 +286,7 @@ public enum CollisionTreeManager { /** * returns true if the manager is set to sort new generated trees. False otherwise. - * + * * @return true to sort tree, false otherwise. */ public boolean isDoSort() { @@ -295,7 +295,7 @@ public enum CollisionTreeManager { /** * set if this manager should have newly generated trees sort primitives. - * + * * @param doSort * true to sort trees, false otherwise. */ @@ -305,7 +305,7 @@ public enum CollisionTreeManager { /** * returns true if the manager will automatically generate new trees as needed, false otherwise. - * + * * @return true if this manager is generating trees, false otherwise. */ public boolean isGenerateTrees() { @@ -314,7 +314,7 @@ public enum CollisionTreeManager { /** * set if this manager should generate new trees as needed. - * + * * @param generateTrees * true to generate trees, false otherwise. */ @@ -341,7 +341,7 @@ public enum CollisionTreeManager { /** * returns the maximum number of primitives a leaf of the collision tree may contain. - * + * * @return the maximum number of primitives a leaf may contain. */ public int getMaxPrimitivesPerLeaf() { @@ -350,7 +350,7 @@ public enum CollisionTreeManager { /** * set the maximum number of primitives a leaf of the collision tree may contain. - * + * * @param maxPrimitivesPerLeaf * the maximum number of primitives a leaf may contain. */ @@ -360,7 +360,7 @@ public enum CollisionTreeManager { /** * returns the maximum number of CollisionTree elements this manager will hold on to before starting to clear some. - * + * * @return the maximum number of CollisionTree elements. */ public int getMaxElements() { @@ -369,7 +369,7 @@ public enum CollisionTreeManager { /** * set the maximum number of CollisionTree elements this manager will hold on to before starting to clear some. - * + * * @param maxElements * the maximum number of CollisionTree elements. */ @@ -381,7 +381,7 @@ public enum CollisionTreeManager { * Add the given mesh to our "protected" list. This will signal to our cleanup operation that when deciding which * trees to trim in an effort to keep our cache size to a certain desired size, do not trim the tree associated with * this mesh. - * + * * @param meshToProtect * the mesh whose CollisionTree we want to protect. */ @@ -393,7 +393,7 @@ public enum CollisionTreeManager { /** * Removes the supplied mesh from the "protected" list. - * + * * @param mesh */ public void removeProtected(final Mesh mesh) { @@ -401,7 +401,7 @@ public enum CollisionTreeManager { } /** - * + * * @return an immutable copy of the list of protected meshes. */ public List<Mesh> getProtectedMeshes() { diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java index 20dd515..c68a246 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,6 +12,8 @@ package com.ardor3d.bounding; import java.io.IOException; import java.nio.FloatBuffer; +import java.util.Arrays; +import java.util.Objects; import com.ardor3d.intersection.IntersectionRecord; import com.ardor3d.math.Matrix3; @@ -61,6 +63,61 @@ public class OrientedBoundingBox extends BoundingVolume { } @Override + public int hashCode() { + return Objects.hash(Integer.valueOf(super.hashCode()), getExtent(), + Integer.valueOf(Arrays.hashCode(_vectorStore)), getXAxis(), getYAxis(), getZAxis()); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final OrientedBoundingBox other = (OrientedBoundingBox) obj; + if (_extent == null) { + if (other._extent != null) { + return false; + } + } else if (!_extent.equals(other._extent)) { + return false; + } + if (!Arrays.equals(_vectorStore, other._vectorStore)) { + return false; + } + if (_xAxis == null) { + if (other._xAxis != null) { + return false; + } + } else if (!_xAxis.equals(other._xAxis)) { + return false; + } + if (_yAxis == null) { + if (other._yAxis != null) { + return false; + } + } else if (!_yAxis.equals(other._yAxis)) { + return false; + } + if (_zAxis == null) { + if (other._zAxis != null) { + return false; + } + } else if (!_zAxis.equals(other._zAxis)) { + return false; + } + if (correctCorners != other.correctCorners) { + return false; + } + return true; + } + + @Override public Type getType() { return Type.OBB; } @@ -120,7 +177,7 @@ public class OrientedBoundingBox extends BoundingVolume { /** * Calculates an AABB of the given point values for this OBB. - * + * * @param points * The points this OBB should contain. */ @@ -537,10 +594,10 @@ public class OrientedBoundingBox extends BoundingVolume { final int vertsPerPrimitive = data.getIndexMode(section).getVertexCount(); Vector3[] store = new Vector3[vertsPerPrimitive]; - final Vector3 min = _compVect1 - .set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); - final Vector3 max = _compVect2 - .set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); + final Vector3 min = _compVect1.set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, + Double.POSITIVE_INFINITY); + final Vector3 max = _compVect2.set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, + Double.NEGATIVE_INFINITY); Vector3 point; for (int i = start; i < end; i++) { @@ -1305,7 +1362,7 @@ public class OrientedBoundingBox extends BoundingVolume { /** * <code>clip</code> determines if a line segment intersects the current test plane. - * + * * @param denom * the denominator of the line segment. * @param numer diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/TreeComparator.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/TreeComparator.java index 9f4626e..9173ac9 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/TreeComparator.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/TreeComparator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -37,6 +37,7 @@ public class TreeComparator implements Comparator<PrimitiveKey> { _mesh = mesh; } + @Override public int compare(final PrimitiveKey o1, final PrimitiveKey o2) { if (o1.equals(o2)) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/UsageTreeController.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/UsageTreeController.java index ba4d285..cb1ef49 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/UsageTreeController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/UsageTreeController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -34,6 +34,7 @@ public class UsageTreeController implements CollisionTreeController { * @param desiredSize * the final size of the cache to attempt to reach. */ + @Override public void clean(final Map<Mesh, CollisionTree> cache, final List<Mesh> protectedList, final int desiredSize) { // get the ordered keyset (this will be ordered with oldest to newest). diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/Canvas.java b/ardor3d-core/src/main/java/com/ardor3d/framework/Canvas.java index 444a3ce..2c1cc3a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/framework/Canvas.java +++ b/ardor3d-core/src/main/java/com/ardor3d/framework/Canvas.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java index 8ec45a9..62f35a2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/DisplaySettings.java b/ardor3d-core/src/main/java/com/ardor3d/framework/DisplaySettings.java index 19aed1c..1df08b1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/framework/DisplaySettings.java +++ b/ardor3d-core/src/main/java/com/ardor3d/framework/DisplaySettings.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,55 +11,105 @@ package com.ardor3d.framework; public class DisplaySettings { + /** canvas (unrotated) width */ private final int _width; + /** canvas (unrotated) height */ private final int _height; + /** number of color bits used to represent the color of a single pixel */ private final int _colorDepth; private final int _frequency; private final int _alphaBits; private final int _depthBits; private final int _stencilBits; + /** number of samples used to anti-alias */ private final int _samples; + /** true if the canvas should assume exclusive access to the screen */ private final boolean _fullScreen; + /** true if the canvas should be rendered stereoscopically (for 3D glasses) */ private final boolean _stereo; + /** OpenGL shared canvas renderer, can be null */ private final CanvasRenderer _shareContext; + /** rotation in degrees, can be equal to 0, 90, 180 or 270 */ + private final int _rotation; /** - * Convenience method equivalent to <code>DisplaySettings(width, height, 0, 0, 0, 8, 0, 0, - * false, false, null)</code> - * + * Creates a new <code>DisplaySettings</code> object. + * * @param width - * the canvas width + * the canvas (unrotated) width * @param height - * the canvas height + * the canvas (unrotated) height + * @param colorDepth + * the number of color bits used to represent the color of a single pixel + * @param frequency + * the number of times per second to repaint the canvas + * @param alphaBits + * the numner of bits used to represent the translucency of a single pixel * @param depthBits * the number of bits making up the z-buffer + * @param stencilBits + * the number of bits making up the stencil buffer * @param samples * the number of samples used to anti-alias + * @param fullScreen + * true if the canvas should assume exclusive access to the screen + * @param stereo + * true if the canvas should be rendered stereoscopically (for 3D glasses) + * @param shareContext + * the renderer used to render the canvas (see "ardor3d.useMultipleContexts" property) + * @param rotation + * the rotation of the first monitor * @see http://en.wikipedia.org/wiki/Z-buffering * @see http://en.wikipedia.org/wiki/Multisample_anti-aliasing + * @see http://en.wikipedia.org/wiki/Refresh_rate + * @see http://en.wikipedia.org/wiki/Alpha_compositing + * @see http://en.wikipedia.org/wiki/Stencil_buffer + * @see http://en.wikipedia.org/wiki/Stereoscopy + * @see http://www.ardor3d.com/forums/viewtopic.php?f=13&t=318&p=2311&hilit=ardor3d.useMultipleContexts#p2311 */ - public DisplaySettings(final int width, final int height, final int depthBits, final int samples) { + public DisplaySettings(final int width, final int height, final int colorDepth, final int frequency, + final int alphaBits, final int depthBits, final int stencilBits, final int samples, + final boolean fullScreen, final boolean stereo, final CanvasRenderer shareContext, final int rotation) { + super(); _width = width; _height = height; - _colorDepth = 0; - _frequency = 0; - _alphaBits = 0; + _colorDepth = colorDepth; + _frequency = frequency; + _alphaBits = alphaBits; _depthBits = depthBits; - _stencilBits = 0; + _stencilBits = stencilBits; _samples = samples; - _fullScreen = false; - _stereo = false; - _shareContext = null; + _fullScreen = fullScreen; + _stereo = stereo; + _shareContext = shareContext; + _rotation = rotation; + } + + /** + * Convenience method + * + * @param width + * the canvas (unrotated) width + * @param height + * the canvas (unrotated) height + * @param depthBits + * the number of bits making up the z-buffer + * @param samples + * the number of samples used to anti-alias + * @see http://en.wikipedia.org/wiki/Z-buffering + * @see http://en.wikipedia.org/wiki/Multisample_anti-aliasing + */ + public DisplaySettings(final int width, final int height, final int depthBits, final int samples) { + this(width, height, 0, 0, 0, depthBits, 0, samples, false, false, null, 0); } /** - * Convenience method equivalent to <code>DisplaySettings(width, height, colorDepth, frequency, - * 0, 8, 0, 0, fullScreen, false, null)</code> - * + * Convenience method + * * @param width - * the canvas width + * the canvas (unrotated) width * @param height - * the canvas height + * the canvas (unrotated) height * @param colorDepth * the number of color bits used to represent the color of a single pixel * @param frequency @@ -70,27 +120,17 @@ public class DisplaySettings { */ public DisplaySettings(final int width, final int height, final int colorDepth, final int frequency, final boolean fullScreen) { - _width = width; - _height = height; - _colorDepth = colorDepth; - _frequency = frequency; - _alphaBits = 0; - _depthBits = 8; - _stencilBits = 0; - _samples = 0; - _fullScreen = fullScreen; - _stereo = false; - _shareContext = null; + this(width, height, colorDepth, frequency, 0, 8, 0, 0, fullScreen, false, null, 0); } /** - * Convenience method equivalent to <code>DisplaySettings(width, height, colorDepth, frequency, - * alphaBits, depthBits, stencilBits, samples, fullScreen, stereo, null)</code> - * + * Convenience method equivalent to <code>DisplaySettings(width, height, colorDepth, frequency, + * alphaBits, depthBits, stencilBits, samples, fullScreen, stereo, null, 0)</code> + * * @param width - * the canvas width + * the canvas (unrotated) width * @param height - * the canvas height + * the canvas (unrotated) height * @param colorDepth * the number of color bits used to represent the color of a single pixel * @param frequency @@ -115,26 +155,17 @@ public class DisplaySettings { public DisplaySettings(final int width, final int height, final int colorDepth, final int frequency, final int alphaBits, final int depthBits, final int stencilBits, final int samples, final boolean fullScreen, final boolean stereo) { - _width = width; - _height = height; - _colorDepth = colorDepth; - _frequency = frequency; - _alphaBits = alphaBits; - _depthBits = depthBits; - _stencilBits = stencilBits; - _samples = samples; - _fullScreen = fullScreen; - _stereo = stereo; - _shareContext = null; + this(width, height, colorDepth, frequency, alphaBits, depthBits, stencilBits, samples, fullScreen, stereo, + null, 0); } /** - * Creates a new <code>DisplaySettings</code> object. - * + * Creates a new <code>DisplaySettings</code> object with no rotation. + * * @param width - * the canvas width + * the canvas (unrotated) width * @param height - * the canvas height + * the canvas (unrotated) height * @param colorDepth * the number of color bits used to represent the color of a single pixel * @param frequency @@ -164,17 +195,8 @@ public class DisplaySettings { public DisplaySettings(final int width, final int height, final int colorDepth, final int frequency, final int alphaBits, final int depthBits, final int stencilBits, final int samples, final boolean fullScreen, final boolean stereo, final CanvasRenderer shareContext) { - _width = width; - _height = height; - _colorDepth = colorDepth; - _frequency = frequency; - _alphaBits = alphaBits; - _depthBits = depthBits; - _stencilBits = stencilBits; - _samples = samples; - _fullScreen = fullScreen; - _stereo = stereo; - _shareContext = shareContext; + this(width, height, colorDepth, frequency, alphaBits, depthBits, stencilBits, samples, fullScreen, stereo, + shareContext, 0); } public CanvasRenderer getShareContext() { @@ -221,6 +243,42 @@ public class DisplaySettings { return _stereo; } + public int getRotation() { + return _rotation; + } + + public int getRotatedWidth() { + switch (_rotation) { + case 0: + case 180: { + return getWidth(); + } + case 90: + case 270: { + return getHeight(); + } + default: + throw new IllegalStateException("The rotation is invalid: " + _rotation + + " There is no valid rotated width"); + } + } + + public int getRotatedHeight() { + switch (_rotation) { + case 0: + case 180: { + return getHeight(); + } + case 90: + case 270: { + return getWidth(); + } + default: + throw new IllegalStateException("The rotation is invalid: " + _rotation + + " There is no valid rotated height"); + } + } + @Override public boolean equals(final Object o) { if (this == o) { @@ -234,16 +292,16 @@ public class DisplaySettings { return _colorDepth == that._colorDepth && _frequency == that._frequency - && _fullScreen != that._fullScreen - && _height != that._height - && _width != that._width - && _alphaBits != that._alphaBits - && _depthBits != that._depthBits - && _stencilBits != that._stencilBits - && _samples != that._samples - && _stereo != that._stereo + && _fullScreen == that._fullScreen + && _height == that._height + && _width == that._width + && _alphaBits == that._alphaBits + && _depthBits == that._depthBits + && _stencilBits == that._stencilBits + && _samples == that._samples + && _stereo == that._stereo && ((_shareContext == that._shareContext) || (_shareContext != null && _shareContext - .equals(that._shareContext))); + .equals(that._shareContext))) && _rotation == that._rotation; } @Override @@ -260,7 +318,8 @@ public class DisplaySettings { result = 31 * result + _samples; result = 31 * result + (_fullScreen ? 1 : 0); result = 31 * result + (_stereo ? 1 : 0); - result = 31 * result + (_shareContext != null ? _shareContext.hashCode() : 0); + result = 31 * result + (_shareContext == null ? 0 : _shareContext.hashCode()); + result = 31 * result + _rotation; return result; } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java b/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java index c5465cf..67ce66a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java +++ b/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -48,8 +48,8 @@ public final class FrameHandler { public FrameHandler(final Timer timer) { _timer = timer; - _updaters = new CopyOnWriteArrayList<Updater>(); - _canvases = new CopyOnWriteArrayList<Canvas>(); + _updaters = new CopyOnWriteArrayList<>(); + _canvases = new CopyOnWriteArrayList<>(); } @MainThread diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java b/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java index 1e912f6..21ef3c7 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java +++ b/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -21,7 +21,7 @@ public interface NativeCanvas extends Canvas { /** * <code>isActive</code> returns true if the display is active. - * + * * @return whether the display system is active. */ boolean isActive(); @@ -29,7 +29,7 @@ public interface NativeCanvas extends Canvas { /** * <code>isClosing</code> notifies if the window is currently closing. This could be caused via the application * itself or external interrupts such as alt-f4 etc. - * + * * @return true if the window is closing, false otherwise. */ boolean isClosing(); @@ -38,7 +38,7 @@ public interface NativeCanvas extends Canvas { * <code>setVSyncEnabled</code> attempts to enable or disable monitor vertical synchronization. The method is a * "best attempt" to change the monitor vertical refresh synchronization, and is <b>not </b> guaranteed to be * successful. This is dependent on OS. - * + * * @param enabled * <code>true</code> to synchronize, <code>false</code> to ignore synchronization */ @@ -46,7 +46,7 @@ public interface NativeCanvas extends Canvas { /** * Sets the title of the display system. This is usually reflected by the renderer as text in the menu bar. - * + * * @param title * The new display title. */ @@ -66,15 +66,15 @@ public interface NativeCanvas extends Canvas { * Images should be in format RGBA8888. If they are not ardor3d will try to convert them using ImageUtils. If that * fails a <code>Ardor3dException</code> could be thrown. * </p> - * + * * @param iconImages * Array of Images to be used as icons. */ void setIcon(Image[] iconImages); /** - * If running in windowed mode, move the window's position to the given display coordinates. - * + * If running in windowed mode, move the window's position to the given display coordinates in window units. + * * @param locX * @param locY */ diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/Scene.java b/ardor3d-core/src/main/java/com/ardor3d/framework/Scene.java index ba31d74..3e21e73 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/framework/Scene.java +++ b/ardor3d-core/src/main/java/com/ardor3d/framework/Scene.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/Updater.java b/ardor3d-core/src/main/java/com/ardor3d/framework/Updater.java index 5789ac0..1f1df22 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/framework/Updater.java +++ b/ardor3d-core/src/main/java/com/ardor3d/framework/Updater.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Image.java b/ardor3d-core/src/main/java/com/ardor3d/image/Image.java index 28765af..b7e2783 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/Image.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/Image.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -20,7 +20,6 @@ import java.util.List; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; -import com.google.common.collect.Lists; /** * <code>Image</code> defines a data format for a graphical image. The image is defined by a format, a height and width, @@ -43,7 +42,7 @@ public class Image implements Serializable, Savable { * Constructor instantiates a new <code>Image</code> object. All values are undefined. */ public Image() { - _data = new ArrayList<ByteBuffer>(1); + _data = new ArrayList<>(1); } /** @@ -98,7 +97,7 @@ public class Image implements Serializable, Savable { */ public Image(final ImageDataFormat format, final PixelDataType type, final int width, final int height, final ByteBuffer data, final int[] mipMapSizes) { - this(format, type, width, height, Lists.newArrayList(data), mipMapSizes); + this(format, type, width, height, new ArrayList<>(Arrays.asList(data)), mipMapSizes); } /** @@ -123,7 +122,7 @@ public class Image implements Serializable, Savable { * the data that contains the image information. */ public void setData(final ByteBuffer data) { - _data = Lists.newArrayList(data); + _data = new ArrayList<>(Arrays.asList(data)); } /** @@ -134,7 +133,7 @@ public class Image implements Serializable, Savable { */ public void addData(final ByteBuffer data) { if (_data == null) { - _data = new ArrayList<ByteBuffer>(1); + _data = new ArrayList<>(1); } _data.add(data); } @@ -351,6 +350,7 @@ public class Image implements Serializable, Savable { return true; } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_format, "dataformat", ImageDataFormat.RGBA); capsule.write(_type, "datatype", PixelDataType.UnsignedByte); @@ -361,6 +361,7 @@ public class Image implements Serializable, Savable { capsule.writeByteBufferList(_data, "data", null); } + @Override public void read(final InputCapsule capsule) throws IOException { _format = capsule.readEnum("dataformat", ImageDataFormat.class, ImageDataFormat.RGBA); _type = capsule.readEnum("datatype", PixelDataType.class, PixelDataType.UnsignedByte); @@ -371,6 +372,7 @@ public class Image implements Serializable, Savable { _data = capsule.readByteBufferList("data", null); } + @Override public Class<? extends Image> getClassTag() { return this.getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/ImageDataFormat.java b/ardor3d-core/src/main/java/com/ardor3d/image/ImageDataFormat.java index e1f8c7c..20232bd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/ImageDataFormat.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/ImageDataFormat.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/PixelDataType.java b/ardor3d-core/src/main/java/com/ardor3d/image/PixelDataType.java index c465d4b..537931c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/PixelDataType.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/PixelDataType.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Texture.java b/ardor3d-core/src/main/java/com/ardor3d/image/Texture.java index add9847..241b16a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/Texture.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/Texture.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -1409,6 +1409,7 @@ public abstract class Texture implements Savable { _texMatrix.set(matrix); } + @Override public void write(final OutputCapsule capsule) throws IOException { if (_storeImage) { capsule.write(_image, "image", null); @@ -1448,6 +1449,7 @@ public abstract class Texture implements Savable { capsule.write(_key, "textureKey", null); } + @Override public void read(final InputCapsule capsule) throws IOException { _minificationFilter = capsule.readEnum("minificationFilter", MinificationFilter.class, MinificationFilter.NearestNeighborNoMipMaps); @@ -1506,6 +1508,7 @@ public abstract class Texture implements Savable { _rttPixelDataType = capsule.readEnum("rttPixelDataType", PixelDataType.class, PixelDataType.UnsignedByte); } + @Override public Class<? extends Texture> getClassTag() { return this.getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Texture1D.java b/ardor3d-core/src/main/java/com/ardor3d/image/Texture1D.java index 5ba42cd..14a0047 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/Texture1D.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/Texture1D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Texture2D.java b/ardor3d-core/src/main/java/com/ardor3d/image/Texture2D.java index dc54a94..ddd01ba 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/Texture2D.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/Texture2D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Texture3D.java b/ardor3d-core/src/main/java/com/ardor3d/image/Texture3D.java index 8258e5e..bbd240e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/Texture3D.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/Texture3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/TextureCubeMap.java b/ardor3d-core/src/main/java/com/ardor3d/image/TextureCubeMap.java index 0253976..c0e99e2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/TextureCubeMap.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/TextureCubeMap.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/TextureStoreFormat.java b/ardor3d-core/src/main/java/com/ardor3d/image/TextureStoreFormat.java index fab3b58..4d3f8e5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/TextureStoreFormat.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/TextureStoreFormat.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/AbiLoader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/AbiLoader.java index b69ffa8..8011dad 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/AbiLoader.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/AbiLoader.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -33,6 +33,7 @@ public final class AbiLoader implements ImageLoader { * @throws IOException * if an error occurs during read. */ + @Override public Image load(final InputStream is, final boolean flip) throws IOException { return (Image) new BinaryImporter().load(is); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/ColorMipMapGenerator.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/ColorMipMapGenerator.java index 5035392..f02a8d1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/ColorMipMapGenerator.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/ColorMipMapGenerator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java index 6316b57..1d03d01 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -144,7 +144,7 @@ public abstract class GeneratedImageFactory { double val; final double rangeDiv = 1.0 / (rangeEnd - rangeStart); // prepare list of image slices. - final List<ByteBuffer> dataList = new ArrayList<ByteBuffer>(depth); + final List<ByteBuffer> dataList = new ArrayList<>(depth); final byte[] data = new byte[width * height]; for (double z = 0; z < depth; z++) { @@ -199,7 +199,7 @@ public abstract class GeneratedImageFactory { final ReadOnlyColorRGBA... colorTable) { assert (colorTable.length == 256) : "color table must be size 256."; - final List<ByteBuffer> dataList = new ArrayList<ByteBuffer>(lumImage.getDepth()); + final List<ByteBuffer> dataList = new ArrayList<>(lumImage.getDepth()); ReadOnlyColorRGBA c; for (int i = 0; i < lumImage.getDepth(); i++) { final ByteBuffer src = lumImage.getData(i); diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoader.java index 4a5bd94..e179341 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoader.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoader.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java index b12475a..197ae45 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -47,21 +47,12 @@ public abstract class ImageLoaderUtil { return TextureState.getDefaultTextureImage(); } - InputStream is = null; - try { - is = src.openStream(); + try (final InputStream is = src.openStream()) { logger.log(Level.FINER, "loadImage(ResourceSource, boolean) opened stream: {0}", src); return loadImage(type, is, flipped); } catch (final IOException e) { logger.log(Level.WARNING, "loadImage(ResourceSource, boolean): defaultTexture used", e); return TextureState.getDefaultTextureImage(); - } finally { - if (is != null) { - try { - is.close(); - } catch (final IOException ioe) { - } // ignore - } } } @@ -69,7 +60,7 @@ public abstract class ImageLoaderUtil { Image imageData = null; try { - ImageLoader loader = loaders.get(type.toLowerCase()); + ImageLoader loader = type == null ? null : loaders.get(type.toLowerCase()); if (loader == null) { loader = defaultLoader; } @@ -92,7 +83,7 @@ public abstract class ImageLoaderUtil { /** * Register an ImageLoader to handle all files with a specific type. An ImageLoader can be registered to handle * several formats without problems. - * + * * @param handler * the handler to use * @param types diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageUtils.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageUtils.java index c674d85..55f9d75 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageUtils.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,10 +10,13 @@ package com.ardor3d.image.util; +import java.nio.ByteBuffer; + import com.ardor3d.image.Image; import com.ardor3d.image.ImageDataFormat; import com.ardor3d.image.PixelDataType; import com.ardor3d.image.TextureStoreFormat; +import com.ardor3d.math.ColorRGBA; public abstract class ImageUtils { @@ -22,7 +25,8 @@ public abstract class ImageUtils { } public static final TextureStoreFormat getTextureStoreFormat(final TextureStoreFormat format, final Image image) { - if (format != TextureStoreFormat.GuessCompressedFormat && format != TextureStoreFormat.GuessNoCompressedFormat) { + if (format != TextureStoreFormat.GuessCompressedFormat + && format != TextureStoreFormat.GuessNoCompressedFormat) { return format; } if (image == null) { @@ -224,4 +228,223 @@ public abstract class ImageUtils { throw new Error("Unhandled type / format combination: " + type + " / " + dataFormat); } + + public static ColorRGBA getRGBA(final Image img, final int x, final int y, final ColorRGBA store) { + return getRGBA(img, 0, x, y, store); + } + + public static ColorRGBA getRGBA(final Image img, final int index, final int x, final int y, final ColorRGBA store) { + final ColorRGBA result = store == null ? new ColorRGBA() : store; + final int rgba = getRGBA(img, index, x, y); + return (result.fromIntRGBA(rgba)); + } + + public static int getARGB(final Image img, final int x, final int y) { + return getARGB(img, 0, x, y); + } + + public static int getARGB(final Image img, final int index, final int x, final int y) { + final ByteBuffer imgData = img.getData(index); + final int bytesPerPixel = ImageUtils.getPixelByteSize(img.getDataFormat(), img.getDataType()); + final int dataIndex = bytesPerPixel * (x + (y * img.getWidth())); + final int argb; + switch (img.getDataFormat()) { + case Alpha: + argb = ((imgData.get(dataIndex) & 0xFF) << 24); + break; + case Red: + argb = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 16); + break; + case Green: + argb = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 8); + break; + case Blue: + argb = (0xFF << 24) | (imgData.get(dataIndex) & 0xFF); + break; + case RG: + argb = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 16) + | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (0x00); + break; + case RGB: + argb = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 16) + | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (imgData.get(dataIndex + 2) & 0xFF); + break; + case BGR: + argb = (0xFF << 24) | ((imgData.get(dataIndex + 2) & 0xFF) << 16) + | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (imgData.get(dataIndex) & 0xFF); + break; + case RGBA: + argb = ((imgData.get(dataIndex + 3) & 0xFF) << 24) | ((imgData.get(dataIndex) & 0xFF) << 16) + | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (imgData.get(dataIndex + 2) & 0xFF); + break; + case BGRA: + argb = ((imgData.get(dataIndex + 3) & 0xFF) << 24) | ((imgData.get(dataIndex + 2) & 0xFF) << 16) + | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (imgData.get(dataIndex) & 0xFF); + break; + default: + throw new UnsupportedOperationException("Image data format " + img.getDataFormat() + " not supported!"); + } + return (argb); + } + + public static int getRGBA(final Image img, final int x, final int y) { + return getRGBA(img, 0, x, y); + } + + public static int getRGBA(final Image img, final int index, final int x, final int y) { + final ByteBuffer imgData = img.getData(index); + final int bytesPerPixel = ImageUtils.getPixelByteSize(img.getDataFormat(), img.getDataType()); + final int dataIndex = bytesPerPixel * (x + (y * img.getWidth())); + final int rgba; + switch (img.getDataFormat()) { + case Alpha: + rgba = (imgData.get(dataIndex) & 0xFF); + break; + case Red: + rgba = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 24); + break; + case Green: + rgba = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 16); + break; + case Blue: + rgba = (0xFF << 24) | (imgData.get(dataIndex) & 0xFF << 8); + break; + case RG: + rgba = ((imgData.get(dataIndex) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16) + | (0x00 << 8) | (0xFF); + break; + case RGB: + rgba = ((imgData.get(dataIndex) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16) + | ((imgData.get(dataIndex + 2) & 0xFF) << 8) | (0xFF); + break; + case BGR: + rgba = ((imgData.get(dataIndex + 2) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16) + | ((imgData.get(dataIndex) & 0xFF) << 8) | (0xFF); + break; + case RGBA: + rgba = ((imgData.get(dataIndex) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16) + | ((imgData.get(dataIndex + 2) & 0xFF) << 8) | (imgData.get(dataIndex + 3) & 0xFF); + break; + case BGRA: + rgba = ((imgData.get(dataIndex + 2) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16) + | ((imgData.get(dataIndex) & 0xFF) << 8) | (imgData.get(dataIndex + 3) & 0xFF); + break; + default: + throw new UnsupportedOperationException("Image data format " + img.getDataFormat() + " not supported!"); + } + return (rgba); + } + + public static void setARGB(final Image img, final int x, final int y, final int argb) { + setARGB(img, 0, x, y, argb); + } + + public static void setARGB(final Image img, final int index, final int x, final int y, final int argb) { + final ByteBuffer imgData = img.getData(index); + final int bytesPerPixel = ImageUtils.getPixelByteSize(img.getDataFormat(), img.getDataType()); + final int dataIndex = bytesPerPixel * (x + (y * img.getWidth())); + switch (img.getDataFormat()) { + case Alpha: + imgData.put(dataIndex, (byte) ((argb >> 24) & 0xFF)); + break; + case Red: + imgData.put(dataIndex, (byte) ((argb >> 16) & 0xFF)); + break; + case Green: + imgData.put(dataIndex, (byte) ((argb >> 8) & 0xFF)); + break; + case Blue: + imgData.put(dataIndex, (byte) (argb & 0xFF)); + break; + case RG: + imgData.put(dataIndex, (byte) ((argb >> 16) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF)); + break; + case RGB: + imgData.put(dataIndex, (byte) ((argb >> 16) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF)); + imgData.put(dataIndex + 2, (byte) (argb & 0xFF)); + break; + case BGR: + imgData.put(dataIndex + 2, (byte) ((argb >> 16) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF)); + imgData.put(dataIndex, (byte) (argb & 0xFF)); + break; + case RGBA: + imgData.put(dataIndex, (byte) ((argb >> 16) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF)); + imgData.put(dataIndex + 2, (byte) (argb & 0xFF)); + imgData.put(dataIndex + 3, (byte) ((argb >> 24) & 0xFF)); + break; + case BGRA: + imgData.put(dataIndex + 2, (byte) ((argb >> 16) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF)); + imgData.put(dataIndex, (byte) (argb & 0xFF)); + imgData.put(dataIndex + 3, (byte) ((argb >> 24) & 0xFF)); + break; + default: + throw new UnsupportedOperationException("Image data format " + img.getDataFormat() + " not supported!"); + } + } + + public static void setRGBA(final Image img, final int x, final int y, final ColorRGBA color) { + setRGBA(img, 0, x, y, color); + } + + public static void setRGBA(final Image img, final int index, final int x, final int y, final ColorRGBA color) { + final int rgba = color.asIntRGBA(); + setRGBA(img, index, x, y, rgba); + } + + public static void setRGBA(final Image img, final int x, final int y, final int rgba) { + setRGBA(img, 0, x, y, rgba); + } + + public static void setRGBA(final Image img, final int index, final int x, final int y, final int rgba) { + final ByteBuffer imgData = img.getData(index); + final int bytesPerPixel = ImageUtils.getPixelByteSize(img.getDataFormat(), img.getDataType()); + final int dataIndex = bytesPerPixel * (x + (y * img.getWidth())); + switch (img.getDataFormat()) { + case Alpha: + imgData.put(dataIndex, (byte) ((rgba) & 0xFF)); + break; + case Red: + imgData.put(dataIndex, (byte) ((rgba >> 24) & 0xFF)); + break; + case Green: + imgData.put(dataIndex, (byte) ((rgba >> 16) & 0xFF)); + break; + case Blue: + imgData.put(dataIndex, (byte) ((rgba >> 8) & 0xFF)); + break; + case RG: + imgData.put(dataIndex, (byte) ((rgba >> 24) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF)); + break; + case RGB: + imgData.put(dataIndex, (byte) ((rgba >> 24) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF)); + imgData.put(dataIndex + 2, (byte) ((rgba >> 8) & 0xFF)); + break; + case BGR: + imgData.put(dataIndex + 2, (byte) ((rgba >> 24) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF)); + imgData.put(dataIndex, (byte) ((rgba >> 8) & 0xFF)); + break; + case RGBA: + imgData.put(dataIndex, (byte) ((rgba >> 24) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF)); + imgData.put(dataIndex + 2, (byte) ((rgba >> 8) & 0xFF)); + imgData.put(dataIndex + 3, (byte) (rgba & 0xFF)); + break; + case BGRA: + imgData.put(dataIndex + 2, (byte) ((rgba >> 24) & 0xFF)); + imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF)); + imgData.put(dataIndex, (byte) ((rgba >> 8) & 0xFF)); + imgData.put(dataIndex + 3, (byte) (rgba & 0xFF)); + break; + default: + throw new UnsupportedOperationException("Image data format " + img.getDataFormat() + " not supported!"); + } + } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/TextureProjector.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/TextureProjector.java index b166cca..aaff340 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/TextureProjector.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/TextureProjector.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/TgaLoader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/TgaLoader.java index 8068501..dddb9bf 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/TgaLoader.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/TgaLoader.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -63,6 +63,7 @@ public final class TgaLoader implements ImageLoader { * @throws IOException * if an error occurs during read. */ + @Override public Image load(final InputStream is, boolean flip) throws IOException { boolean flipH = false; // open a stream to the file @@ -377,49 +378,51 @@ public final class TgaLoader implements ImageLoader { } } else if (imageType == TYPE_COLORMAPPED) { - final int bytesPerIndex = pixelDepth / 8; + if (cMapEntries != null) { + final int bytesPerIndex = pixelDepth / 8; - if (bytesPerIndex == 1) { - for (int i = 0; i <= (height - 1); i++) { - if (!flip) { - rawDataIndex = (height - 1 - i) * width * dl; - } - for (int j = 0; j < width; j++) { - final int index = dis.readUnsignedByte(); - if (index >= cMapEntries.length || index < 0) { - throw new Ardor3dException("TGA: Invalid color map entry referenced: " + index); - } - final ColorMapEntry entry = cMapEntries[index]; - rawData[rawDataIndex++] = entry.red; - rawData[rawDataIndex++] = entry.green; - rawData[rawDataIndex++] = entry.blue; - if (dl == 4) { - rawData[rawDataIndex++] = entry.alpha; + if (bytesPerIndex == 1) { + for (int i = 0; i <= (height - 1); i++) { + if (!flip) { + rawDataIndex = (height - 1 - i) * width * dl; } + for (int j = 0; j < width; j++) { + final int index = dis.readUnsignedByte(); + if (index >= cMapEntries.length || index < 0) { + throw new Ardor3dException("TGA: Invalid color map entry referenced: " + index); + } + final ColorMapEntry entry = cMapEntries[index]; + rawData[rawDataIndex++] = entry.red; + rawData[rawDataIndex++] = entry.green; + rawData[rawDataIndex++] = entry.blue; + if (dl == 4) { + rawData[rawDataIndex++] = entry.alpha; + } + } } - } - } else if (bytesPerIndex == 2) { - for (int i = 0; i <= (height - 1); i++) { - if (!flip) { - rawDataIndex = (height - 1 - i) * width * dl; - } - for (int j = 0; j < width; j++) { - final int index = flipEndian(dis.readShort()); - if (index >= cMapEntries.length || index < 0) { - throw new Ardor3dException("TGA: Invalid color map entry referenced: " + index); + } else if (bytesPerIndex == 2) { + for (int i = 0; i <= (height - 1); i++) { + if (!flip) { + rawDataIndex = (height - 1 - i) * width * dl; } - final ColorMapEntry entry = cMapEntries[index]; - rawData[rawDataIndex++] = entry.red; - rawData[rawDataIndex++] = entry.green; - rawData[rawDataIndex++] = entry.blue; - if (dl == 4) { - rawData[rawDataIndex++] = entry.alpha; + for (int j = 0; j < width; j++) { + final int index = flipEndian(dis.readShort()); + if (index >= cMapEntries.length || index < 0) { + throw new Ardor3dException("TGA: Invalid color map entry referenced: " + index); + } + final ColorMapEntry entry = cMapEntries[index]; + rawData[rawDataIndex++] = entry.red; + rawData[rawDataIndex++] = entry.green; + rawData[rawDataIndex++] = entry.blue; + if (dl == 4) { + rawData[rawDataIndex++] = entry.alpha; + } } } + } else { + throw new Ardor3dException("TGA: unknown colormap indexing size used: " + bytesPerIndex); } - } else { - throw new Ardor3dException("TGA: unknown colormap indexing size used: " + bytesPerIndex); } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/D3d10ResourceDimension.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/D3d10ResourceDimension.java index b777d12..e4d75fe 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/D3d10ResourceDimension.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/D3d10ResourceDimension.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeader.java index e624f2f..00afd41 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeader.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeader.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeaderDX10.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeaderDX10.java index 7ef5c62..400b5ad 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeaderDX10.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeaderDX10.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java index 8d551ac..48f7ce1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -18,6 +18,7 @@ import static com.ardor3d.image.util.dds.DdsUtils.shiftCount; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; @@ -28,7 +29,6 @@ import com.ardor3d.image.util.ImageLoader; import com.ardor3d.image.util.ImageUtils; import com.ardor3d.util.LittleEndianDataInput; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; /** * <p> @@ -56,40 +56,42 @@ import com.google.common.collect.Lists; public class DdsLoader implements ImageLoader { private static final Logger logger = Logger.getLogger(DdsLoader.class.getName()); + @Override public Image load(final InputStream is, final boolean flipVertically) throws IOException { - final LittleEndianDataInput in = new LittleEndianDataInput(is); + try (final LittleEndianDataInput in = new LittleEndianDataInput(is)) { - // Read and check magic word... - final int dwMagic = in.readInt(); - if (dwMagic != getInt("DDS ")) { - throw new Error("Not a dds file."); - } - logger.finest("Reading DDS file."); + // Read and check magic word... + final int dwMagic = in.readInt(); + if (dwMagic != getInt("DDS ")) { + throw new Error("Not a dds file."); + } + logger.finest("Reading DDS file."); - // Create our data store; - final DdsImageInfo info = new DdsImageInfo(); + // Create our data store; + final DdsImageInfo info = new DdsImageInfo(); - info.flipVertically = flipVertically; + info.flipVertically = flipVertically; - // Read standard dds header - info.header = DdsHeader.read(in); + // Read standard dds header + info.header = DdsHeader.read(in); - // if applicable, read DX10 header - info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null; + // if applicable, read DX10 header + info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null; - // Create our new image - final Image image = new Image(); - image.setWidth(info.header.dwWidth); - image.setHeight(info.header.dwHeight); + // Create our new image + final Image image = new Image(); + image.setWidth(info.header.dwWidth); + image.setHeight(info.header.dwHeight); - // update depth based on flags / header - updateDepth(image, info); + // update depth based on flags / header + updateDepth(image, info); - // add our format and image data. - populateImage(image, info, in); + // add our format and image data. + populateImage(image, info, in); - // return the loaded image - return image; + // return the loaded image + return image; + } } private static final void updateDepth(final Image image, final DdsImageInfo info) { @@ -253,7 +255,7 @@ public class DdsLoader implements ImageLoader { } // Go through and load in image data - final List<ByteBuffer> imageData = Lists.newArrayList(); + final List<ByteBuffer> imageData = new ArrayList<>(); for (int i = 0; i < image.getDepth(); i++) { // read in compressed data if (compressedFormat) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsPixelFormat.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsPixelFormat.java index 71ee4b0..843ba3a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsPixelFormat.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsPixelFormat.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsUtils.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsUtils.java index 0cfff85..373adbb 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsUtils.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DxgiFormat.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DxgiFormat.java index 3c99126..13306e6 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DxgiFormat.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DxgiFormat.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ButtonState.java b/ardor3d-core/src/main/java/com/ardor3d/input/ButtonState.java index 9699db2..f2fa597 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/ButtonState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/ButtonState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerEvent.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerEvent.java index c257b32..ec429f3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerEvent.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerEvent.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java index a7e7c92..f8298c6 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -13,8 +13,6 @@ package com.ardor3d.input; import java.util.ArrayList; import java.util.List; -import com.google.common.collect.Lists; - public class ControllerInfo { private final String _controllerName; @@ -23,8 +21,8 @@ public class ControllerInfo { public ControllerInfo(final String controllerName, final List<String> axisNames, final List<String> buttonNames) { _controllerName = controllerName; - _axisNames = Lists.newArrayList(axisNames); - _buttonNames = Lists.newArrayList(buttonNames); + _axisNames = new ArrayList<>(axisNames); + _buttonNames = new ArrayList<>(buttonNames); } public String getControllerName() { diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java index 15d3106..da1c7fe 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -17,18 +17,17 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import com.ardor3d.annotation.Immutable; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; @Immutable public class ControllerState { public static final ControllerState NOTHING = new ControllerState(0); - protected final Map<String, Map<String, Float>> _controllerStates = Maps.newLinkedHashMap(); - protected final List<ControllerEvent> _eventsSinceLastState = Lists.newArrayList(); + protected final Map<String, Map<String, Float>> _controllerStates = new LinkedHashMap<>(); + protected final List<ControllerEvent> _eventsSinceLastState = new ArrayList<>(); protected ControllerState(final int ignore) {} @@ -52,7 +51,7 @@ public class ControllerState { if (_controllerStates.containsKey(controllerName)) { controllerState = _controllerStates.get(controllerName); } else { - controllerState = new LinkedHashMap<String, Float>(); + controllerState = new LinkedHashMap<>(); _controllerStates.put(controllerName, controllerState); } @@ -70,6 +69,11 @@ public class ControllerState { } @Override + public int hashCode() { + return Objects.hashCode(_controllerStates); + } + + @Override public String toString() { final StringBuilder stateString = new StringBuilder("ControllerState: "); @@ -96,7 +100,7 @@ public class ControllerState { private void duplicateStates(final Map<String, Map<String, Float>> store) { store.clear(); for (final Entry<String, Map<String, Float>> entry : _controllerStates.entrySet()) { - store.put(entry.getKey(), Maps.newLinkedHashMap(entry.getValue())); + store.put(entry.getKey(), new LinkedHashMap<>(entry.getValue())); } } @@ -107,6 +111,7 @@ public class ControllerState { public List<ControllerEvent> getEvents() { Collections.sort(_eventsSinceLastState, new Comparator<ControllerEvent>() { + @Override public int compare(final ControllerEvent o1, final ControllerEvent o2) { return (int) (o2.getNanos() - o1.getNanos()); } @@ -120,11 +125,11 @@ public class ControllerState { } public List<String> getControllerNames() { - return new ArrayList<String>(_controllerStates.keySet()); + return new ArrayList<>(_controllerStates.keySet()); } public List<String> getControllerComponentNames(final String controller) { - return new ArrayList<String>(_controllerStates.get(controller).keySet()); + return new ArrayList<>(_controllerStates.get(controller).keySet()); } public Map<String, Float> getControllerComponentValues(final String controller) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerWrapper.java index ab4a408..4b2ee59 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerWrapper.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/FocusWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/FocusWrapper.java index a0db729..975445b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/FocusWrapper.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/FocusWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/GrabbedState.java b/ardor3d-core/src/main/java/com/ardor3d/input/GrabbedState.java index 9a3716b..3c34eb7 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/GrabbedState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/GrabbedState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/InputState.java b/ardor3d-core/src/main/java/com/ardor3d/input/InputState.java index 2b8e33e..263d4a3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/InputState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/InputState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/Key.java b/ardor3d-core/src/main/java/com/ardor3d/input/Key.java index d9a2c28..73aaa90 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/Key.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/Key.java @@ -1,5 +1,5 @@ /** - * Copyright 2008-2012 Ardor Labs, Inc. + * Copyright 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyEvent.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyEvent.java index 3a13675..a2a49d8 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyEvent.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyEvent.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyNotFoundException.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyNotFoundException.java index 7a0383c..a65d038 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyNotFoundException.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyNotFoundException.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyState.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyState.java index ffdac8c..f12a848 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardState.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardState.java index d5f73bb..35fe07d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardWrapper.java index 4d0d64b..1ccc49a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardWrapper.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java index 6d2e378..ab09893 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,13 +12,18 @@ package com.ardor3d.input; import java.util.EnumMap; -import com.google.common.collect.Maps; - public enum MouseButton { LEFT, RIGHT, MIDDLE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE; public static EnumMap<MouseButton, ButtonState> makeMap(final ButtonState left, final ButtonState right, final ButtonState middle) { + return makeMap(left, right, middle, ButtonState.UNDEFINED, ButtonState.UNDEFINED, ButtonState.UNDEFINED, + ButtonState.UNDEFINED, ButtonState.UNDEFINED, ButtonState.UNDEFINED); + } + + public static EnumMap<MouseButton, ButtonState> makeMap(final ButtonState left, final ButtonState right, + final ButtonState middle, final ButtonState four, final ButtonState five, final ButtonState six, + final ButtonState seven, final ButtonState eight, final ButtonState nine) { if (left == null) { throw new NullPointerException("left"); } @@ -28,10 +33,34 @@ public enum MouseButton { if (middle == null) { throw new NullPointerException("middle"); } - final EnumMap<MouseButton, ButtonState> map = Maps.newEnumMap(MouseButton.class); + if (four == null) { + throw new NullPointerException("four"); + } + if (five == null) { + throw new NullPointerException("five"); + } + if (six == null) { + throw new NullPointerException("six"); + } + if (seven == null) { + throw new NullPointerException("seven"); + } + if (eight == null) { + throw new NullPointerException("eight"); + } + if (nine == null) { + throw new NullPointerException("nine"); + } + final EnumMap<MouseButton, ButtonState> map = new EnumMap<>(MouseButton.class); map.put(LEFT, left); map.put(RIGHT, right); map.put(MIDDLE, middle); + map.put(FOUR, four); + map.put(FIVE, five); + map.put(SIX, six); + map.put(SEVEN, seven); + map.put(EIGHT, eight); + map.put(NINE, nine); return map; } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java index e24e4ce..e7fbf20 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,6 +12,8 @@ package com.ardor3d.input; import static com.google.common.base.Preconditions.checkArgument; +import java.util.Objects; + import com.ardor3d.annotation.Immutable; import com.ardor3d.image.Image; import com.ardor3d.image.ImageDataFormat; @@ -21,7 +23,7 @@ import com.ardor3d.util.geom.BufferUtils; /** * An immutable representation of a mouse cursor. A mouse cursor consists of an image and a hotspot where clicking is * done. - * + * */ @Immutable public class MouseCursor { @@ -29,8 +31,9 @@ public class MouseCursor { * This constant is used to identify that the native operating system's default cursor should be used. It is not a * valid mouse cursor in itself. */ - public static final MouseCursor SYSTEM_DEFAULT = new MouseCursor("system default", new Image(ImageDataFormat.RGBA, - PixelDataType.UnsignedByte, 1, 1, BufferUtils.createByteBuffer(4), null), 0, 0); + public static final MouseCursor SYSTEM_DEFAULT = new MouseCursor("system default", + new Image(ImageDataFormat.RGBA, PixelDataType.UnsignedByte, 1, 1, BufferUtils.createByteBuffer(4), null), 0, + 0); private final String _name; private final Image _image; @@ -39,7 +42,7 @@ public class MouseCursor { /** * Instantiates a MouseCursor. - * + * * @param name * the name of this cursor, for debugging purposes. * @param image @@ -55,10 +58,10 @@ public class MouseCursor { _hotspotX = hotspotX; _hotspotY = hotspotY; - checkArgument(hotspotX >= 0 && hotspotX < image.getWidth(), "hotspot X is out of bounds: 0 <= %s < " - + image.getWidth(), hotspotX); - checkArgument(hotspotY >= 0 && hotspotY < image.getHeight(), "hotspot Y is out of bounds: 0 <= %s < " - + image.getHeight(), hotspotY); + checkArgument(hotspotX >= 0 && hotspotX < image.getWidth(), + "hotspot X is out of bounds: 0 <= %s < " + image.getWidth(), hotspotX); + checkArgument(hotspotY >= 0 && hotspotY < image.getHeight(), + "hotspot Y is out of bounds: 0 <= %s < " + image.getHeight(), hotspotY); } public String getName() { @@ -102,11 +105,10 @@ public class MouseCursor { if (_hotspotY != that._hotspotY) { return false; } - if (_image != null ? !_image.equals(that._image) : that._image != null) { + if (!Objects.equals(_image, that._image)) { return false; } - // noinspection RedundantIfStatement - if (_name != null ? !_name.equals(that._name) : that._name != null) { + if (!Objects.equals(_name, that._name)) { return false; } @@ -115,10 +117,6 @@ public class MouseCursor { @Override public int hashCode() { - int result = _name != null ? _name.hashCode() : 0; - result = 31 * result + (_image != null ? _image.hashCode() : 0); - result = 31 * result + _hotspotX; - result = 31 * result + _hotspotY; - return result; + return Objects.hash(getName(), getImage(), Integer.valueOf(getHotspotX()), Integer.valueOf(getHotspotY())); } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseManager.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseManager.java index 641df06..f4d0751 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java index 8ee44ce..e05ea87 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -17,9 +17,8 @@ import com.ardor3d.annotation.Immutable; import com.google.common.collect.EnumMultiset; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultiset; -import com.google.common.collect.Maps; -import com.google.common.collect.Multiset; import com.google.common.collect.ImmutableMultiset.Builder; +import com.google.common.collect.Multiset; /** * Describes the mouse state at some point in time. @@ -139,7 +138,7 @@ public class MouseState { public EnumMap<MouseButton, ButtonState> getButtonStates(final EnumMap<MouseButton, ButtonState> store) { EnumMap<MouseButton, ButtonState> rVal = store; if (store == null) { - rVal = Maps.newEnumMap(MouseButton.class); + rVal = new EnumMap<>(MouseButton.class); } rVal.clear(); rVal.putAll(_buttonStates); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseWrapper.java index bc8d663..b74e367 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseWrapper.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java b/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java index 5948094..ba5b18d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -67,7 +67,7 @@ public class PhysicalLayer { _mouseWrapper = mouseWrapper; _focusWrapper = focusWrapper; _controllerWrapper = controllerWrapper; - _stateQueue = new LinkedBlockingQueue<InputState>(); + _stateQueue = new LinkedBlockingQueue<>(); _currentKeyboardState = KeyboardState.NOTHING; _currentMouseState = MouseState.NOTHING; @@ -189,7 +189,7 @@ public class PhysicalLayer { return EMPTY_LIST; } - final LinkedList<InputState> result = new LinkedList<InputState>(); + final LinkedList<InputState> result = new LinkedList<>(); _stateQueue.drainTo(result); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/control/FirstPersonControl.java b/ardor3d-core/src/main/java/com/ardor3d/input/control/FirstPersonControl.java index d93f9c0..ddb773e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/control/FirstPersonControl.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/control/FirstPersonControl.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -227,6 +227,7 @@ public class FirstPersonControl { // Test boolean to allow us to ignore first mouse event. First event can wildly vary based on platform. private boolean firstPing = true; + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final MouseState mouse = inputStates.getCurrent().getMouseState(); if (mouse.getDx() != 0 || mouse.getDy() != 0) { @@ -249,6 +250,7 @@ public class FirstPersonControl { final Predicate<TwoInputStates> keysHeld = new Predicate<TwoInputStates>() { Key[] keys = new Key[] { Key.W, Key.A, Key.S, Key.D, Key.LEFT, Key.RIGHT, Key.UP, Key.DOWN }; + @Override public boolean apply(final TwoInputStates states) { for (final Key k : keys) { if (states.getCurrent() != null && states.getCurrent().getKeyboardState().isDown(k)) { @@ -260,6 +262,7 @@ public class FirstPersonControl { }; final TriggerAction moveAction = new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { FirstPersonControl.this.move(source.getCanvasRenderer().getCamera(), inputStates.getCurrent() .getKeyboardState(), tpf); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/control/OrbitCamControl.java b/ardor3d-core/src/main/java/com/ardor3d/input/control/OrbitCamControl.java index 2be9c8b..60afb21 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/control/OrbitCamControl.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/control/OrbitCamControl.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -349,8 +349,8 @@ public class OrbitCamControl { public void setupMouseTriggers(final LogicalLayer layer, final boolean dragOnly) { // Mouse look - final Predicate<TwoInputStates> someMouseDown = Predicates.or(TriggerConditions.leftButtonDown(), Predicates - .or(TriggerConditions.rightButtonDown(), TriggerConditions.middleButtonDown())); + final Predicate<TwoInputStates> someMouseDown = Predicates.or(TriggerConditions.leftButtonDown(), + Predicates.or(TriggerConditions.rightButtonDown(), TriggerConditions.middleButtonDown())); final Predicate<TwoInputStates> scrollWheelMoved = new MouseWheelMovedCondition(); final Predicate<TwoInputStates> dragged = Predicates.and(TriggerConditions.mouseMoved(), someMouseDown); final TriggerAction mouseAction = new TriggerAction() { @@ -358,6 +358,7 @@ public class OrbitCamControl { // Test boolean to allow us to ignore first mouse event. First event can wildly vary based on platform. private boolean firstPing = true; + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final MouseState mouse = inputStates.getCurrent().getMouseState(); if (mouse.getDx() != 0 || mouse.getDy() != 0) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyControllerCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyControllerCondition.java index 8626a5f..4819f48 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyControllerCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyControllerCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -15,6 +15,7 @@ import com.google.common.base.Predicate; public final class AnyControllerCondition implements Predicate<TwoInputStates> { + @Override public boolean apply(final TwoInputStates states) { final ControllerState oldState = states.getPrevious().getControllerState(); final ControllerState currentState = states.getCurrent().getControllerState(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyKeyCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyKeyCondition.java index 5ab407f..b114357 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyKeyCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyKeyCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -17,6 +17,7 @@ import com.google.common.base.Predicate; * Applicable whenever 'any' key has been pressed. */ public class AnyKeyCondition implements Predicate<TwoInputStates> { + @Override public boolean apply(final TwoInputStates twoInputStates) { final InputState currentState = twoInputStates.getCurrent(); final InputState previousState = twoInputStates.getPrevious(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/BasicTriggersApplier.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/BasicTriggersApplier.java index 5b77235..1a94132 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/BasicTriggersApplier.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/BasicTriggersApplier.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -16,6 +16,7 @@ import com.ardor3d.framework.Canvas; public class BasicTriggersApplier implements LogicalTriggersApplier { + @Override public void checkAndPerformTriggers(final Set<InputTrigger> triggers, final Canvas source, final TwoInputStates states, final double tpf) { for (final InputTrigger trigger : triggers) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentActiveCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentActiveCondition.java index 6289c88..cfe1cbf 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentActiveCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentActiveCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -24,6 +24,7 @@ public final class ControllerComponentActiveCondition implements Predicate<TwoIn componentNames = components; } + @Override public boolean apply(final TwoInputStates states) { final Map<String, Float> currentStates = states.getCurrent().getControllerState() .getControllerComponentValues(controllerName); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentCondition.java index a088149..d3ee877 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -33,6 +33,7 @@ public final class ControllerComponentCondition implements Predicate<TwoInputSta componentName = component; } + @Override public boolean apply(final TwoInputStates states) { boolean apply = false; final ControllerState currentState = states.getCurrent().getControllerState(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerCondition.java index 757b2b6..59a32fd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -29,6 +29,7 @@ public final class ControllerCondition implements Predicate<TwoInputStates> { controllerName = controller; } + @Override public boolean apply(final TwoInputStates states) { boolean apply = false; final ControllerState currentState = states.getCurrent().getControllerState(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyControllerWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyControllerWrapper.java index 2194704..c1cce53 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyControllerWrapper.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyControllerWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -19,25 +19,31 @@ public class DummyControllerWrapper implements ControllerWrapper { public static final DummyControllerWrapper INSTANCE = new DummyControllerWrapper(); PeekingIterator<ControllerEvent> empty = new PeekingIterator<ControllerEvent>() { + @Override public boolean hasNext() { return false; } + @Override public void remove() {} + @Override public ControllerEvent peek() { return null; } + @Override public ControllerEvent next() { return null; } }; + @Override public PeekingIterator<ControllerEvent> getEvents() { return empty; } + @Override public void init() { ; // ignore, does nothing } diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyFocusWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyFocusWrapper.java index 7ff0c3e..24be667 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyFocusWrapper.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyFocusWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -18,10 +18,12 @@ import com.ardor3d.input.FocusWrapper; public class DummyFocusWrapper implements FocusWrapper { public static final DummyFocusWrapper INSTANCE = new DummyFocusWrapper(); + @Override public void init() { ; // ignore, does nothing } + @Override public boolean getAndClearFocusLost() { return false; } diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyKeyboardWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyKeyboardWrapper.java index 3de004e..9d5102f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyKeyboardWrapper.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyKeyboardWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -22,25 +22,31 @@ public class DummyKeyboardWrapper implements KeyboardWrapper { PeekingIterator<KeyEvent> empty = new PeekingIterator<KeyEvent>() { + @Override public boolean hasNext() { return false; } + @Override public void remove() {} + @Override public KeyEvent peek() { return null; } + @Override public KeyEvent next() { return null; } }; + @Override public PeekingIterator<KeyEvent> getEvents() { return empty; } + @Override public void init() { ; // ignore, does nothing. } diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyMouseWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyMouseWrapper.java index dc47f24..a46e80d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyMouseWrapper.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyMouseWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -22,25 +22,31 @@ public class DummyMouseWrapper implements MouseWrapper { PeekingIterator<MouseState> empty = new PeekingIterator<MouseState>() { + @Override public boolean hasNext() { return false; } + @Override public void remove() {} + @Override public MouseState peek() { return null; } + @Override public MouseState next() { return null; } }; + @Override public PeekingIterator<MouseState> getEvents() { return empty; } + @Override public void init() { ; // ignore, does nothing } diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/InputTrigger.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/InputTrigger.java index 5c126f4..5a2d34d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/InputTrigger.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/InputTrigger.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyHeldCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyHeldCondition.java index ce2b600..188093f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyHeldCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyHeldCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -37,6 +37,7 @@ public final class KeyHeldCondition implements Predicate<TwoInputStates> { this.key = key; } + @Override public boolean apply(final TwoInputStates states) { return states.getCurrent().getKeyboardState().isDown(key); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyPressedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyPressedCondition.java index cdb19d6..ebfa102 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyPressedCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyPressedCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -38,6 +38,7 @@ public final class KeyPressedCondition implements Predicate<TwoInputStates> { this.key = key; } + @Override public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyReleasedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyReleasedCondition.java index b08f5ef..15dd2ba 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyReleasedCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyReleasedCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -38,6 +38,7 @@ public final class KeyReleasedCondition implements Predicate<TwoInputStates> { this.key = key; } + @Override public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java index ed57f8c..5e5bc7d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -27,8 +27,8 @@ import com.ardor3d.input.PhysicalLayer; */ @ThreadSafe public final class LogicalLayer { - private final Set<InputSource> _inputs = new CopyOnWriteArraySet<InputSource>(); - private final Set<InputTrigger> _triggers = new CopyOnWriteArraySet<InputTrigger>(); + private final Set<InputSource> _inputs = new CopyOnWriteArraySet<>(); + private final Set<InputTrigger> _triggers = new CopyOnWriteArraySet<>(); private LogicalTriggersApplier _applier = new BasicTriggersApplier(); public LogicalLayer() {} diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalTriggersApplier.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalTriggersApplier.java index d034ce8..83f070d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalTriggersApplier.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalTriggersApplier.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonClickedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonClickedCondition.java index 4c2a5ff..d8cf4a1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonClickedCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonClickedCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -39,6 +39,7 @@ public final class MouseButtonClickedCondition implements Predicate<TwoInputStat _button = button; } + @Override public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java index af19920..107d26a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -17,20 +17,26 @@ import com.ardor3d.input.ButtonState; import com.ardor3d.input.InputState; import com.ardor3d.input.MouseButton; import com.google.common.base.Predicate; -import com.google.common.collect.Maps; /** * A condition that checks the state of the two most commonly used mouse buttons. */ @Immutable public final class MouseButtonCondition implements Predicate<TwoInputStates> { - private final EnumMap<MouseButton, ButtonState> _states = Maps.newEnumMap(MouseButton.class); + private final EnumMap<MouseButton, ButtonState> _states = new EnumMap<>(MouseButton.class); public MouseButtonCondition(final EnumMap<MouseButton, ButtonState> states) { _states.putAll(states); } public MouseButtonCondition(final ButtonState left, final ButtonState right, final ButtonState middle) { + this(left, right, middle, ButtonState.UNDEFINED, ButtonState.UNDEFINED, ButtonState.UNDEFINED, + ButtonState.UNDEFINED, ButtonState.UNDEFINED, ButtonState.UNDEFINED); + } + + public MouseButtonCondition(final ButtonState left, final ButtonState right, final ButtonState middle, + final ButtonState four, final ButtonState five, final ButtonState six, final ButtonState seven, + final ButtonState eight, final ButtonState nine) { if (left != ButtonState.UNDEFINED) { _states.put(MouseButton.LEFT, left); } @@ -40,8 +46,27 @@ public final class MouseButtonCondition implements Predicate<TwoInputStates> { if (middle != ButtonState.UNDEFINED) { _states.put(MouseButton.MIDDLE, middle); } + if (four != ButtonState.UNDEFINED) { + _states.put(MouseButton.FOUR, four); + } + if (five != ButtonState.UNDEFINED) { + _states.put(MouseButton.FIVE, five); + } + if (six != ButtonState.UNDEFINED) { + _states.put(MouseButton.SIX, six); + } + if (seven != ButtonState.UNDEFINED) { + _states.put(MouseButton.SEVEN, seven); + } + if (eight != ButtonState.UNDEFINED) { + _states.put(MouseButton.EIGHT, eight); + } + if (nine != ButtonState.UNDEFINED) { + _states.put(MouseButton.NINE, nine); + } } + @Override public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonPressedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonPressedCondition.java index a460517..2d4bee6 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonPressedCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonPressedCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -39,6 +39,7 @@ public final class MouseButtonPressedCondition implements Predicate<TwoInputStat _button = button; } + @Override public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonReleasedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonReleasedCondition.java index f9b0ebb..69310db 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonReleasedCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonReleasedCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -39,6 +39,7 @@ public final class MouseButtonReleasedCondition implements Predicate<TwoInputSta _button = button; } + @Override public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseMovedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseMovedCondition.java index cf3b47d..acbd2d2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseMovedCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseMovedCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -19,6 +19,7 @@ import com.google.common.base.Predicate; */ @Immutable public final class MouseMovedCondition implements Predicate<TwoInputStates> { + @Override public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseWheelMovedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseWheelMovedCondition.java index 59ccb97..283ca22 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseWheelMovedCondition.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseWheelMovedCondition.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -19,6 +19,7 @@ import com.google.common.base.Predicate; */ @Immutable public final class MouseWheelMovedCondition implements Predicate<TwoInputStates> { + @Override public boolean apply(final TwoInputStates states) { final InputState currentState = states.getCurrent(); final InputState previousState = states.getPrevious(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerAction.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerAction.java index 216c28e..407aa41 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerAction.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerAction.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java index a36e8a5..cc0036d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -27,6 +27,12 @@ public final class TriggerConditions { private static final MouseButtonCondition RIGHT_DOWN_CONDITION = makeCondition(MouseButton.RIGHT, ButtonState.DOWN); private static final MouseButtonCondition MIDDLE_DOWN_CONDITION = makeCondition(MouseButton.MIDDLE, ButtonState.DOWN); + private static final MouseButtonCondition FOUR_DOWN_CONDITION = makeCondition(MouseButton.FOUR, ButtonState.DOWN); + private static final MouseButtonCondition FIVE_DOWN_CONDITION = makeCondition(MouseButton.FIVE, ButtonState.DOWN); + private static final MouseButtonCondition SIX_DOWN_CONDITION = makeCondition(MouseButton.SIX, ButtonState.DOWN); + private static final MouseButtonCondition SEVEN_DOWN_CONDITION = makeCondition(MouseButton.SEVEN, ButtonState.DOWN); + private static final MouseButtonCondition EIGHT_DOWN_CONDITION = makeCondition(MouseButton.EIGHT, ButtonState.DOWN); + private static final MouseButtonCondition NINE_DOWN_CONDITION = makeCondition(MouseButton.NINE, ButtonState.DOWN); private static final Predicate<TwoInputStates> ALWAYS_TRUE = new Predicate<TwoInputStates>() { @Override @@ -43,7 +49,7 @@ public final class TriggerConditions { }; private static MouseButtonCondition makeCondition(final MouseButton button, final ButtonState state) { - final EnumMap<MouseButton, ButtonState> map = new EnumMap<MouseButton, ButtonState>(MouseButton.class); + final EnumMap<MouseButton, ButtonState> map = new EnumMap<>(MouseButton.class); for (final MouseButton b : MouseButton.values()) { map.put(b, button != b ? ButtonState.UNDEFINED : state); } @@ -63,7 +69,7 @@ public final class TriggerConditions { } /** - * + * * @return a condition that is true if the left button is down */ public static MouseButtonCondition leftButtonDown() { @@ -71,7 +77,7 @@ public final class TriggerConditions { } /** - * + * * @return a condition that is true if the right button is down */ public static MouseButtonCondition rightButtonDown() { @@ -79,7 +85,7 @@ public final class TriggerConditions { } /** - * + * * @return a condition that is true if the middle button is down */ public static MouseButtonCondition middleButtonDown() { @@ -87,6 +93,54 @@ public final class TriggerConditions { } /** + * + * @return a condition that is true if the fourth button is down + */ + public static MouseButtonCondition fourButtonDown() { + return FOUR_DOWN_CONDITION; + } + + /** + * + * @return a condition that is true if the fifth button is down + */ + public static MouseButtonCondition fiveButtonDown() { + return FIVE_DOWN_CONDITION; + } + + /** + * + * @return a condition that is true if the sixth button is down + */ + public static MouseButtonCondition sixButtonDown() { + return SIX_DOWN_CONDITION; + } + + /** + * + * @return a condition that is true if the seventh button is down + */ + public static MouseButtonCondition sevenButtonDown() { + return SEVEN_DOWN_CONDITION; + } + + /** + * + * @return a condition that is true if the eighth button is down + */ + public static MouseButtonCondition eightButtonDown() { + return EIGHT_DOWN_CONDITION; + } + + /** + * + * @return a condition that is true if the ninth button is down + */ + public static MouseButtonCondition nineButtonDown() { + return NINE_DOWN_CONDITION; + } + + /** * @return a condition that is always true. */ public static Predicate<TwoInputStates> alwaysTrue() { diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java index 2e058e1..76cff2e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,6 +12,8 @@ package com.ardor3d.input.logical; import static com.google.common.base.Preconditions.checkNotNull; +import java.util.Objects; + import com.ardor3d.annotation.Immutable; import com.ardor3d.input.InputState; @@ -27,12 +29,12 @@ public final class TwoInputStates { /** * Instantiates a new TwoInputStates. It is safe for both parameters to point to the same instance, but they cannot * be null. - * + * * @param previous * the previous input state * @param current * the current input state - * + * * @throws NullPointerException * if either parameter is null */ @@ -51,9 +53,7 @@ public final class TwoInputStates { @Override public int hashCode() { - // we don't expect this to be used in a map. - assert false : "hashCode not designed"; - return 42; + return Objects.hash(getPrevious(), getCurrent()); } @Override @@ -65,6 +65,6 @@ public final class TwoInputStates { return false; } final TwoInputStates comp = (TwoInputStates) o; - return _previous == comp._previous && _current == comp._current; + return Objects.equals(_previous, comp._previous) && Objects.equals(_current, comp._current); } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingCollisionResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingCollisionResults.java index b90a7eb..f9b73ba 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingCollisionResults.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingCollisionResults.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingPickResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingPickResults.java index ac3b284..04cd113 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingPickResults.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingPickResults.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionData.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionData.java index bd616a8..f912009 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java index 0d4d693..2f4933b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -26,7 +26,7 @@ public abstract class CollisionResults { * Constructor instantiates a new <code>PickResults</code> object. */ public CollisionResults() { - _nodeList = new ArrayList<CollisionData>(); + _nodeList = new ArrayList<>(); } /** diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/Intersection.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/Intersection.java index 8245aa4..643e3f4 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/Intersection.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/Intersection.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/IntersectionRecord.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/IntersectionRecord.java index eb5fb3f..11e1360 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/IntersectionRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/IntersectionRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickData.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickData.java index 4e2de16..f250dd3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java index 402b934..4f3ec5c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -32,7 +32,7 @@ public abstract class PickResults { * Constructor instantiates a new <code>PickResults</code> object. */ public PickResults() { - _nodeList = new ArrayList<PickData>(); + _nodeList = new ArrayList<>(); } /** @@ -42,7 +42,7 @@ public abstract class PickResults { /** * Places a new geometry (enclosed in PickData) into the results list. - * + * * @param data * the PickData to be placed in the results list. */ @@ -53,7 +53,7 @@ public abstract class PickResults { /** * <code>getNumber</code> retrieves the number of geometries that have been placed in the results. - * + * * @return the number of Mesh objects in the list. */ public int getNumber() { @@ -62,7 +62,7 @@ public abstract class PickResults { /** * Retrieves a geometry (enclosed in PickData) from a specific index. - * + * * @param i * the index requested. * @return the data at the specified index. @@ -87,7 +87,7 @@ public abstract class PickResults { /** * <code>addPick</code> generates an entry to be added to the list of picked objects. If checkDistance is true, the * implementing class should order the object. - * + * * @param ray * the ray that was cast for the pick calculation. * @param p @@ -98,13 +98,13 @@ public abstract class PickResults { /** * Optional method that can be implemented by sub classes to define methods for handling picked objects. After * calculating all pick results this method is called. - * + * */ public void processPick() {} /** * Reports if these pick results will order the data by distance from the origin of the Ray. - * + * * @return true if objects will be ordered by distance, false otherwise. */ public boolean willCheckDistance() { @@ -113,7 +113,7 @@ public abstract class PickResults { /** * Sets if these pick results will order the data by distance from the origin of the Ray. - * + * * @param checkDistance * true if objects will be ordered by distance, false otherwise. */ @@ -129,8 +129,12 @@ public abstract class PickResults { */ private static class DistanceComparator implements Comparator<PickData> { + @Override public int compare(final PickData o1, final PickData o2) { - if (o1.getIntersectionRecord().getClosestDistance() <= o2.getIntersectionRecord().getClosestDistance()) { + if (o1.getIntersectionRecord().getClosestDistance() == o2.getIntersectionRecord().getClosestDistance()) { + return 0; + } + if (o1.getIntersectionRecord().getClosestDistance() < o2.getIntersectionRecord().getClosestDistance()) { return -1; } diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/Pickable.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/Pickable.java index 832162b..8c50057 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/Pickable.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/Pickable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickingUtil.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickingUtil.java index 0c3c066..d657eeb 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickingUtil.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickingUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java index 133312d..8318e09 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -34,8 +34,8 @@ public class PrimitiveCollisionResults extends CollisionResults { public void addCollision(final Mesh s, final Mesh t) { // find the triangle that is being hit. // add this node and the triangle to the CollisionResults list. - final List<PrimitiveKey> a = new ArrayList<PrimitiveKey>(); - final List<PrimitiveKey> b = new ArrayList<PrimitiveKey>(); + final List<PrimitiveKey> a = new ArrayList<>(); + final List<PrimitiveKey> b = new ArrayList<>(); PickingUtil.findPrimitiveCollision(s, t, a, b); final CollisionData data = new CollisionData(s, t, a, b); addCollisionData(data); diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java index c23d085..b209bc8 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java @@ -1,15 +1,17 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.intersection; +import java.util.Objects; + public class PrimitiveKey { private final int _primitiveIndex; private final int _section; @@ -35,12 +37,7 @@ public class PrimitiveKey { @Override public int hashCode() { - int result = 17; - - result += 31 * result + _primitiveIndex; - result += 31 * result + _section; - - return result; + return Objects.hash(Integer.valueOf(getPrimitiveIndex()), Integer.valueOf(getSection())); } @Override diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickData.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickData.java index 33fd1f5..23f9c5c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickResults.java index 76fb345..7a9bcdd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickResults.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickResults.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/TriangleTriangleIntersect.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/TriangleTriangleIntersect.java index 972c3fb..04cb32f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/intersection/TriangleTriangleIntersect.java +++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/TriangleTriangleIntersect.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/light/DirectionalLight.java b/ardor3d-core/src/main/java/com/ardor3d/light/DirectionalLight.java index 6bd3c58..95dab25 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/light/DirectionalLight.java +++ b/ardor3d-core/src/main/java/com/ardor3d/light/DirectionalLight.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/light/Light.java b/ardor3d-core/src/main/java/com/ardor3d/light/Light.java index cf1a9cd..5c17840 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/light/Light.java +++ b/ardor3d-core/src/main/java/com/ardor3d/light/Light.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -202,7 +202,7 @@ public abstract class Light implements Serializable, Savable { * the specular color value of the light. */ public void setSpecular(final ReadOnlyColorRGBA specular) { - this._specular.set(specular); + _specular.set(specular); } /** @@ -221,7 +221,7 @@ public abstract class Light implements Serializable, Savable { * the diffuse color value for this light. */ public void setDiffuse(final ReadOnlyColorRGBA diffuse) { - this._diffuse.set(diffuse); + _diffuse.set(diffuse); } /** @@ -240,7 +240,7 @@ public abstract class Light implements Serializable, Savable { * the ambient color value for this light. */ public void setAmbient(final ReadOnlyColorRGBA ambient) { - this._ambient.set(ambient); + _ambient.set(ambient); } /** @@ -316,9 +316,10 @@ public abstract class Light implements Serializable, Savable { } public void setName(final String name) { - this._name = name; + _name = name; } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_ambient, "ambient", new ColorRGBA(DEFAULT_AMBIENT)); capsule.write(_diffuse, "diffuse", new ColorRGBA(DEFAULT_DIFFUSE)); @@ -334,6 +335,7 @@ public abstract class Light implements Serializable, Savable { capsule.write(_name, "name", null); } + @Override public void read(final InputCapsule capsule) throws IOException { _ambient.set((ColorRGBA) capsule.readSavable("ambient", new ColorRGBA(DEFAULT_AMBIENT))); _diffuse.set((ColorRGBA) capsule.readSavable("diffuse", new ColorRGBA(DEFAULT_DIFFUSE))); @@ -349,6 +351,7 @@ public abstract class Light implements Serializable, Savable { _name = capsule.readString("name", null); } + @Override public Class<? extends Light> getClassTag() { return this.getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/light/PointLight.java b/ardor3d-core/src/main/java/com/ardor3d/light/PointLight.java index beace3f..49dfc8f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/light/PointLight.java +++ b/ardor3d-core/src/main/java/com/ardor3d/light/PointLight.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/light/SpotLight.java b/ardor3d-core/src/main/java/com/ardor3d/light/SpotLight.java index f44e2a3..72c9a0f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/light/SpotLight.java +++ b/ardor3d-core/src/main/java/com/ardor3d/light/SpotLight.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java index f7a8c2e..ce4c339 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -30,7 +30,7 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer { private static final Logger logger = Logger.getLogger(AbstractFBOTextureRenderer.class.getName()); /** List of states that override any set states on a spatial if not null. */ - protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<RenderState.StateType, RenderState>( + protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<>( RenderState.StateType.class); protected final Camera _camera = new Camera(1, 1); @@ -102,18 +102,22 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer { * * @return the camera this renderer is using. */ + @Override public Camera getCamera() { return _camera; } + @Override public void setBackgroundColor(final ReadOnlyColorRGBA c) { _backgroundColor.set(c); } + @Override public ReadOnlyColorRGBA getBackgroundColor() { return _backgroundColor; } + @Override public void render(final Spatial toDraw, final Texture tex, final int clear) { try { ContextManager.getCurrentContext().pushFBOTextureRenderer(this); @@ -140,6 +144,7 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer { } } + @Override public void render(final Scene toDraw, final Texture tex, final int clear) { try { ContextManager.getCurrentContext().pushFBOTextureRenderer(this); @@ -166,6 +171,7 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer { } } + @Override public void render(final List<? extends Spatial> toDraw, final Texture tex, final int clear) { try { ContextManager.getCurrentContext().pushFBOTextureRenderer(this); @@ -257,10 +263,12 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer { toDraw.renderUnto(_parentRenderer); } + @Override public int getWidth() { return _width; } + @Override public int getHeight() { return _height; } @@ -269,22 +277,27 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer { return _parentRenderer; } + @Override public void setMultipleTargets(final boolean multi) { - // ignore. Does not matter to FBO. + // ignore. Does not matter to FBO. } + @Override public void enforceState(final RenderState state) { _enforcedStates.put(state.getType(), state); } + @Override public void enforceStates(final EnumMap<StateType, RenderState> states) { _enforcedStates.putAll(states); } + @Override public void clearEnforcedState(final StateType type) { _enforcedStates.remove(type); } + @Override public void clearEnforcedStates() { _enforcedStates.clear(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java index a428526..82966c5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -28,7 +28,7 @@ public abstract class AbstractPbufferTextureRenderer implements TextureRenderer private static final Logger logger = Logger.getLogger(AbstractPbufferTextureRenderer.class.getName()); /** List of states that override any set states on a spatial if not null. */ - protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<RenderState.StateType, RenderState>( + protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<>( RenderState.StateType.class); protected final Camera _camera = new Camera(1, 1); @@ -139,39 +139,48 @@ public abstract class AbstractPbufferTextureRenderer implements TextureRenderer * * @return the camera this renderer is using. */ + @Override public Camera getCamera() { return _camera; } + @Override public void setBackgroundColor(final ReadOnlyColorRGBA c) { _backgroundColor.set(c); _bgColorDirty = true; } + @Override public ReadOnlyColorRGBA getBackgroundColor() { return _backgroundColor; } + @Override public int getWidth() { return _width; } + @Override public int getHeight() { return _height; } + @Override public void enforceState(final RenderState state) { _enforcedStates.put(state.getType(), state); } + @Override public void enforceStates(final EnumMap<StateType, RenderState> states) { _enforcedStates.putAll(states); } + @Override public void clearEnforcedState(final StateType type) { _enforcedStates.remove(type); } + @Override public void clearEnforcedStates() { _enforcedStates.clear(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java index 8aa7f94..18f1347 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -47,7 +47,7 @@ public abstract class AbstractRenderer implements Renderer { protected RenderLogic renderLogic; /** List of default rendering states for this specific renderer type */ - protected final EnumMap<RenderState.StateType, RenderState> defaultStateList = new EnumMap<RenderState.StateType, RenderState>( + protected final EnumMap<RenderState.StateType, RenderState> defaultStateList = new EnumMap<>( RenderState.StateType.class); public AbstractRenderer() { @@ -58,22 +58,27 @@ public abstract class AbstractRenderer implements Renderer { } } + @Override public boolean isInOrthoMode() { return _inOrthoMode; } + @Override public ReadOnlyColorRGBA getBackgroundColor() { return _backgroundColor; } + @Override public RenderQueue getQueue() { return _queue; } + @Override public boolean isProcessingQueue() { return _processingQueue; } + @Override public void applyState(final StateType type, final RenderState state) { if (Constants.stats) { StatCollector.startStat(StatType.STAT_STATES_TIMER); @@ -165,12 +170,14 @@ public abstract class AbstractRenderer implements Renderer { _stencilClearValue = stencilClearValue; } + @Override public boolean isClipTestEnabled() { final RenderContext context = ContextManager.getCurrentContext(); final RendererRecord record = context.getRendererRecord(); return record.isClippingTestEnabled(); } + @Override public RenderState getProperRenderState(final StateType type, final RenderState current) { final RenderContext context = ContextManager.getCurrentContext(); @@ -189,6 +196,7 @@ public abstract class AbstractRenderer implements Renderer { } } + @Override public void setRenderLogic(final RenderLogic renderLogic) { this.renderLogic = renderLogic; } diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/Camera.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/Camera.java index 3b72a92..3012d90 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/Camera.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/Camera.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -1498,6 +1498,7 @@ public class Camera implements Savable, Externalizable { renderer.setModelViewMatrix(_matrixBuffer); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_location, "location", new Vector3(Vector3.ZERO)); capsule.write(_left, "left", new Vector3(Vector3.UNIT_X)); @@ -1524,6 +1525,7 @@ public class Camera implements Savable, Externalizable { capsule.write(_depthRangeFar, "depthRangeFar", 1.0); } + @Override public void read(final InputCapsule capsule) throws IOException { _location.set((Vector3) capsule.readSavable("location", new Vector3(Vector3.ZERO))); _left.set((Vector3) capsule.readSavable("left", new Vector3(Vector3.UNIT_X))); @@ -1550,6 +1552,7 @@ public class Camera implements Savable, Externalizable { _depthRangeFar = capsule.readDouble("depthRangeFar", 1.0); } + @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { _location.set((Vector3) in.readObject()); _left.set((Vector3) in.readObject()); @@ -1576,6 +1579,7 @@ public class Camera implements Savable, Externalizable { _depthRangeFar = in.readDouble(); } + @Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeObject(_location); out.writeObject(_left); @@ -1609,6 +1613,7 @@ public class Camera implements Savable, Externalizable { + " left - " + Arrays.toString(getLeft().toArray(null)); } + @Override public Class<? extends Camera> getClassTag() { return getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java index 9599e0e..3d65cda 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -40,6 +40,7 @@ public class ContextCapabilities { protected boolean _geometryShader4Supported = false; protected boolean _geometryInstancingSupported = false; protected boolean _tessellationShadersSupported = false; + protected boolean _computeShaderSupported = false; protected int _maxGLSLVertexAttribs; protected boolean _pbufferSupported = false; @@ -153,6 +154,7 @@ public class ContextCapabilities { _glslSupported = source._glslSupported; _geometryInstancingSupported = source._geometryInstancingSupported; _tessellationShadersSupported = source._tessellationShadersSupported; + _computeShaderSupported = source._computeShaderSupported; _maxAnisotropic = source._maxAnisotropic; _maxFBOColorAttachments = source._maxFBOColorAttachments; _maxFBOSamples = source._maxFBOSamples; @@ -338,6 +340,14 @@ public class ContextCapabilities { } /** + * @return <code>true</code> if the GLSL is supported and GL_ARB_compute_shader is supported by current graphics + * configuration + */ + public boolean isComputeShaderSupported() { + return _computeShaderSupported; + } + + /** * @return true if the ARB_shader_objects extension is supported by current graphics configuration. */ public boolean isGLSLSupported() { @@ -391,7 +401,7 @@ public class ContextCapabilities { /** * <code>getNumberOfAuxiliaryDrawBuffers</code> returns the total number of available auxiliary draw buffers this * context supports. - * + * * @return the number of available auxiliary draw buffers supported by the context. */ public int getNumberOfAuxiliaryDrawBuffers() { @@ -400,7 +410,7 @@ public class ContextCapabilities { /** * <code>getTotalNumberOfUnits</code> returns the total number of texture units this context supports. - * + * * @return the total number of texture units supported by the context. */ public int getTotalNumberOfUnits() { @@ -410,7 +420,7 @@ public class ContextCapabilities { /** * <code>getNumberOfFixedUnits</code> returns the number of texture units this context supports, for use in the * fixed pipeline. - * + * * @return the number units. */ public int getNumberOfFixedTextureUnits() { @@ -420,7 +430,7 @@ public class ContextCapabilities { /** * <code>getNumberOfVertexUnits</code> returns the number of texture units available to a vertex shader that this * context supports. - * + * * @return the number of units. */ public int getNumberOfVertexUnits() { @@ -430,7 +440,7 @@ public class ContextCapabilities { /** * <code>getNumberOfFragmentUnits</code> returns the number of texture units available to a fragment shader that * this context supports. - * + * * @return the number of units. */ public int getNumberOfFragmentTextureUnits() { @@ -440,7 +450,7 @@ public class ContextCapabilities { /** * <code>getNumberOfFragmentTexCoordUnits</code> returns the number of texture coordinate sets available that this * context supports. - * + * * @return the number of units. */ public int getNumberOfFragmentTexCoordUnits() { @@ -456,7 +466,7 @@ public class ContextCapabilities { /** * <code>getNumberOfTotalUnits</code> returns the number of texture units this context supports. - * + * * @return the number of units. */ public int getNumberOfTotalTextureUnits() { @@ -465,7 +475,7 @@ public class ContextCapabilities { /** * <code>getMaxFBOColorAttachments</code> returns the MAX_COLOR_ATTACHMENTS for FBOs that this context supports. - * + * * @return the number of buffers. */ public int getMaxFBOColorAttachments() { @@ -474,7 +484,7 @@ public class ContextCapabilities { /** * Returns the maximum anisotropic filter. - * + * * @return The maximum anisotropic filter. */ public float getMaxAnisotropic() { @@ -525,7 +535,7 @@ public class ContextCapabilities { /** * Returns if S3TC compression is available for textures. - * + * * @return true if S3TC is available. */ public boolean isS3TCSupported() { @@ -534,7 +544,7 @@ public class ContextCapabilities { /** * Returns if LATC compression is available for textures. - * + * * @return true if LATC is available. */ public boolean isLATCSupported() { @@ -543,7 +553,7 @@ public class ContextCapabilities { /** * Returns if generic (non-specific) compression is available for textures. - * + * * @return true if available. */ public boolean isGenericTCSupported() { @@ -552,7 +562,7 @@ public class ContextCapabilities { /** * Returns if Texture3D is available for textures. - * + * * @return true if Texture3D is available. */ public boolean isTexture3DSupported() { @@ -561,7 +571,7 @@ public class ContextCapabilities { /** * Returns if TextureCubeMap is available for textures. - * + * * @return true if TextureCubeMap is available. */ public boolean isTextureCubeMapSupported() { @@ -570,7 +580,7 @@ public class ContextCapabilities { /** * Returns if AutomaticMipmap generation is available for textures. - * + * * @return true if AutomaticMipmap generation is available. */ public boolean isAutomaticMipmapsSupported() { @@ -652,7 +662,7 @@ public class ContextCapabilities { /** * Returns the vendor of the graphics adapter - * + * * @return The vendor of the graphics adapter */ public String getDisplayVendor() { @@ -661,7 +671,7 @@ public class ContextCapabilities { /** * Returns renderer details of the adapter - * + * * @return The adapter details */ public String getDisplayRenderer() { @@ -670,7 +680,7 @@ public class ContextCapabilities { /** * Returns the version supported - * + * * @return The version supported */ public String getDisplayVersion() { @@ -679,7 +689,7 @@ public class ContextCapabilities { /** * Returns the supported shading language version. Needs OpenGL 2.0 support to query. - * + * * @return The shading language version supported */ public String getShadingLanguageVersion() { diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCleanListener.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCleanListener.java index 839ac23..735bfb5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCleanListener.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCleanListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java index a72ffd5..658f4a2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java @@ -1,28 +1,27 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.renderer; +import java.util.ArrayList; import java.util.List; import java.util.Map; - -import com.google.common.collect.Lists; -import com.google.common.collect.MapMaker; +import java.util.WeakHashMap; public class ContextManager { protected static RenderContext currentContext = null; - private static List<ContextCleanListener> _cleanListeners = Lists.newArrayList(); + private static List<ContextCleanListener> _cleanListeners = new ArrayList<>(); - protected static final Map<Object, RenderContext> contextStore = new MapMaker().weakKeys().makeMap(); + protected static final Map<Object, RenderContext> contextStore = new WeakHashMap<>(); /** * @return a RenderContext object representing the current OpenGL context. @@ -53,7 +52,7 @@ public class ContextManager { /** * Find the first context we manage that uses the given shared opengl context. - * + * * @param glref * @return */ diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/DrawBufferTarget.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/DrawBufferTarget.java index 0dba3b5..5818377 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/DrawBufferTarget.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/DrawBufferTarget.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/IndexMode.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/IndexMode.java index 305e914..cef4761 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/IndexMode.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/IndexMode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java index eaaeb57..7676e67 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -26,18 +26,18 @@ import com.ardor3d.renderer.state.record.StateRecord; public class RenderContext { /** List of states that override any set states on a spatial if not null. */ - protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<RenderState.StateType, RenderState>( + protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<>( RenderState.StateType.class); - protected final Stack<EnumMap<StateType, RenderState>> _enforcedBackStack = new Stack<EnumMap<StateType, RenderState>>(); + protected final Stack<EnumMap<StateType, RenderState>> _enforcedBackStack = new Stack<>(); - protected final Stack<AbstractFBOTextureRenderer> _textureRenderers = new Stack<AbstractFBOTextureRenderer>(); + protected final Stack<AbstractFBOTextureRenderer> _textureRenderers = new Stack<>(); /** RenderStates a Spatial contains during rendering. */ - protected final EnumMap<RenderState.StateType, RenderState> _currentStates = new EnumMap<RenderState.StateType, RenderState>( + protected final EnumMap<RenderState.StateType, RenderState> _currentStates = new EnumMap<>( RenderState.StateType.class); - protected final EnumMap<RenderState.StateType, StateRecord> _stateRecords = new EnumMap<RenderState.StateType, StateRecord>( + protected final EnumMap<RenderState.StateType, StateRecord> _stateRecords = new EnumMap<>( RenderState.StateType.class); protected final LineRecord _lineRecord = new LineRecord(); @@ -105,7 +105,7 @@ public class RenderContext { * Enforce a particular state. In other words, the given state will override any state of the same type set on a * scene object. Remember to clear the state when done enforcing. Very useful for multipass techniques where * multiple sets of states need to be applied to a scenegraph drawn multiple times. - * + * * @param state * state to enforce */ @@ -122,7 +122,7 @@ public class RenderContext { /** * Clears an enforced render state index by setting it to null. This allows object specific states to be used. - * + * * @param type * The type of RenderState to clear enforcement on. */ @@ -188,12 +188,12 @@ public class RenderContext { * Saves the currently set states to a stack. Does not changes the currently enforced states. */ public void pushEnforcedStates() { - _enforcedBackStack.push(new EnumMap<StateType, RenderState>(_enforcedStates)); + _enforcedBackStack.push(new EnumMap<>(_enforcedStates)); } /** * Restores the enforced states from the stack. Any states enforced or cleared since the last push are reverted. - * + * * @throws EmptyStackException * if this method is called without first calling {@link #pushEnforcedStates()} */ diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderLogic.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderLogic.java index 1cd4869..6ff5135 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderLogic.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderLogic.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/Renderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/Renderer.java index a5b0e10..bad2af3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/Renderer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/Renderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -472,7 +472,7 @@ public interface Renderer { /** * This is a workaround until we make shared Record classes, or open up lower level opengl calls abstracted from - * lwjgl/jogl. + * jogl. * * @param lineWidth * @param stippleFactor @@ -483,7 +483,7 @@ public interface Renderer { /** * This is a workaround until we make shared Record classes, or open up lower level opengl calls abstracted from - * lwjgl/jogl. + * jogl. * * @param pointSize * @param antialiased diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/RendererCallable.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/RendererCallable.java index 665317d..138055c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/RendererCallable.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/RendererCallable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/StereoCamera.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/StereoCamera.java index cf3eb10..fa4d2ba 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/StereoCamera.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/StereoCamera.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRenderer.java index 7972f98..41b334b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRenderer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererFactory.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererFactory.java index 31bace1..17604c4 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererFactory.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererProvider.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererProvider.java index b775643..3522eec 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererProvider.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java index c5780bd..41fb48d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,7 +10,9 @@ package com.ardor3d.renderer.effect; +import java.util.ArrayList; import java.util.EnumMap; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -27,14 +29,12 @@ import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.hint.CullHint; import com.ardor3d.scenegraph.hint.LightCombineMode; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; public class EffectManager { protected final DisplaySettings _canvasSettings; - protected final List<RenderEffect> _effects = Lists.newArrayList(); - protected final Map<String, RenderTarget> _renderTargetMap = Maps.newHashMap(); + protected final List<RenderEffect> _effects = new ArrayList<>(); + protected final Map<String, RenderTarget> _renderTargetMap = new HashMap<>(); protected Renderer _currentRenderer = null; protected RenderTarget _currentRenderTarget = null; protected Camera _fsqCamera, _sceneCamera; diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep.java index 4971d58..8831b6d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java index 777daee..651984f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,18 +11,18 @@ package com.ardor3d.renderer.effect; import java.util.EnumMap; +import java.util.HashMap; import java.util.Map; import com.ardor3d.renderer.state.RenderState; -import com.ardor3d.renderer.state.TextureState; import com.ardor3d.renderer.state.RenderState.StateType; -import com.google.common.collect.Maps; +import com.ardor3d.renderer.state.TextureState; public class EffectStep_RenderScreenOverlay implements EffectStep { - private final EnumMap<StateType, RenderState> _states = Maps.newEnumMap(StateType.class); + private final EnumMap<StateType, RenderState> _states = new EnumMap<>(StateType.class); private final TextureState _texState = new TextureState(); - private final Map<String, Integer> _targetMap = Maps.newHashMap(); + private final Map<String, Integer> _targetMap = new HashMap<>(); public EffectStep_RenderScreenOverlay() { _states.put(StateType.Texture, _texState); diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java index ee03266..72d7f35 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.renderer.effect; +import java.util.ArrayList; import java.util.EnumMap; import java.util.List; @@ -17,12 +18,10 @@ import com.ardor3d.renderer.Camera; import com.ardor3d.renderer.state.RenderState; import com.ardor3d.renderer.state.RenderState.StateType; import com.ardor3d.scenegraph.Spatial; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; public class EffectStep_RenderSpatials implements EffectStep { - private final EnumMap<StateType, RenderState> _states = Maps.newEnumMap(StateType.class); - private final List<Spatial> _spatials = Lists.newArrayList(); + private final EnumMap<StateType, RenderState> _states = new EnumMap<>(StateType.class); + private final List<Spatial> _spatials = new ArrayList<>(); private final Camera _trackedCamera; public EffectStep_RenderSpatials(final Camera trackedCamera) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_SetRenderTarget.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_SetRenderTarget.java index 8b36d29..cbc6e63 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_SetRenderTarget.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_SetRenderTarget.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java index 6fda5a9..6c77243 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,10 +10,9 @@ package com.ardor3d.renderer.effect; +import java.util.ArrayList; import java.util.List; -import com.google.common.collect.Lists; - /** * A RenderEffect object represents a complete set of instructions necessary for applying a specific effect to our * render output. Each effect is comprised of a set of 1 or more steps (EffectStep). @@ -21,7 +20,7 @@ import com.google.common.collect.Lists; public abstract class RenderEffect { /** A list of logical steps that comprise our effect. */ - protected final List<EffectStep> _steps = Lists.newArrayList(); + protected final List<EffectStep> _steps = new ArrayList<>(); /** Is this render effect active? */ protected boolean _enabled = true; diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget.java index 7a4a55f..df5987d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Framebuffer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Framebuffer.java index 54eec7f..1b03307 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Framebuffer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Framebuffer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Texture2D.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Texture2D.java index 338bda8..b78f16b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Texture2D.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Texture2D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java index 4f42df3..3cfcd32 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,18 +11,18 @@ package com.ardor3d.renderer.effect; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.Renderer; import com.ardor3d.renderer.TextureRenderer; import com.ardor3d.renderer.TextureRendererFactory; -import com.google.common.collect.Lists; public enum TextureRendererPool { INSTANCE; - private final List<TextureRenderer> renderers = Lists.newLinkedList(); + private final List<TextureRenderer> renderers = new LinkedList<>(); public static TextureRenderer fetch(final int width, final int height, final Renderer renderer) { for (final Iterator<TextureRenderer> it = INSTANCE.renderers.iterator(); it.hasNext();) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java index 6597e59..894a600 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -22,7 +22,7 @@ import com.ardor3d.renderer.TextureRenderer; */ public class BasicPassManager { - protected List<Pass> _passes = new ArrayList<Pass>(); + protected List<Pass> _passes = new ArrayList<>(); public void add(final Pass toAdd) { if (toAdd != null) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/OutlinePass.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/OutlinePass.java index e4896fc..d4674a5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/OutlinePass.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/OutlinePass.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java index 12fadf3..d2395fb 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -38,7 +38,7 @@ public abstract class Pass implements Serializable { private static final long serialVersionUID = 1L; /** list of Spatial objects registered with this pass. */ - protected List<Spatial> _spatials = new ArrayList<Spatial>(); + protected List<Spatial> _spatials = new ArrayList<>(); /** if false, pass will not be updated or rendered. */ protected boolean _enabled = true; @@ -47,7 +47,7 @@ public abstract class Pass implements Serializable { * RenderStates registered with this pass - if a given state is not null it overrides the corresponding state set * during rendering. */ - protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<RenderState.StateType, RenderState>( + protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<>( RenderState.StateType.class); protected RenderContext _context = null; diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/RenderPass.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/RenderPass.java index e814a54..10fdc29 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/RenderPass.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/RenderPass.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java index 3350df3..a049906 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -28,15 +28,16 @@ public class AbstractRenderBucket implements RenderBucket { protected Spatial[] _currentList, _tempList; protected int _currentListSize; - protected Stack<Spatial[]> _listStack = new Stack<Spatial[]>(); - protected Stack<Spatial[]> _listStackPool = new Stack<Spatial[]>(); - protected Stack<Integer> _listSizeStack = new Stack<Integer>(); + protected Stack<Spatial[]> _listStack = new Stack<>(); + protected Stack<Spatial[]> _listStackPool = new Stack<>(); + protected Stack<Integer> _listSizeStack = new Stack<>(); public AbstractRenderBucket() { _currentList = new Spatial[32]; _tempList = new Spatial[_currentList.length]; } + @Override public void add(final Spatial spatial) { spatial._queueDistance = Double.NEGATIVE_INFINITY; if (_currentListSize >= _currentList.length) { @@ -51,6 +52,7 @@ public class AbstractRenderBucket implements RenderBucket { _currentList[_currentListSize++] = spatial; } + @Override public void remove(final Spatial spatial) { int index = 0; for (int i = 0; i < _currentListSize; i++) { @@ -66,6 +68,7 @@ public class AbstractRenderBucket implements RenderBucket { _currentListSize--; } + @Override public void clear() { if (_currentListSize > 0) { Arrays.fill(_currentList, 0, _currentListSize, null); @@ -73,12 +76,14 @@ public class AbstractRenderBucket implements RenderBucket { } } + @Override public void render(final Renderer renderer) { for (int i = 0; i < _currentListSize; i++) { _currentList[i].draw(renderer); } } + @Override public void sort() { // only sort if we have more than one item in our bucket. if (_currentListSize > 1) { @@ -98,6 +103,7 @@ public class AbstractRenderBucket implements RenderBucket { } } + @Override public void pushBucket() { _listStack.push(_currentList); if (_listStackPool.isEmpty()) { @@ -110,6 +116,7 @@ public class AbstractRenderBucket implements RenderBucket { _currentListSize = 0; } + @Override public void popBucket() { if (_currentList != null) { _listStackPool.push(_currentList); diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OpaqueRenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OpaqueRenderBucket.java index f74e9a3..2f1483c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OpaqueRenderBucket.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OpaqueRenderBucket.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -27,6 +27,7 @@ public class OpaqueRenderBucket extends AbstractRenderBucket { } private class OpaqueComparator implements Comparator<Spatial> { + @Override public int compare(final Spatial o1, final Spatial o2) { if (o1 instanceof Mesh && o2 instanceof Mesh) { return compareByStates((Mesh) o1, (Mesh) o2); @@ -50,12 +51,20 @@ public class OpaqueRenderBucket extends AbstractRenderBucket { private int compareByStates(final Mesh mesh1, final Mesh mesh2) { final TextureState ts1 = (TextureState) mesh1.getWorldRenderState(RenderState.StateType.Texture); final TextureState ts2 = (TextureState) mesh2.getWorldRenderState(RenderState.StateType.Texture); - if (ts1 == ts2) { - return 0; - } else if (ts1 == null && ts2 != null) { - return -1; - } else if (ts2 == null && ts1 != null) { - return 1; + if (ts1 == null) { + if (ts2 == null) { + return 0; + } else { + return -1; + } + } else { + if (ts2 == null) { + return 1; + } else { + if (ts1 == ts2) { + return 0; + } + } } for (int x = 0, maxIndex = Math.min(ts1.getMaxTextureIndexUsed(), ts2.getMaxTextureIndexUsed()); x <= maxIndex; x++) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OrthoRenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OrthoRenderBucket.java index fa4f8c3..f21d82c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OrthoRenderBucket.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OrthoRenderBucket.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -38,6 +38,7 @@ public class OrthoRenderBucket extends AbstractRenderBucket { } private static class OrthoComparator implements Comparator<Spatial> { + @Override public int compare(final Spatial o1, final Spatial o2) { if (o2.getSceneHints().getOrthoOrder() == o1.getSceneHints().getOrthoOrder()) { return 0; diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucket.java index d3a4c53..c2c69c4 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucket.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucket.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java index d5f881d..a5547dd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -28,7 +28,7 @@ public final class RenderBucketType { return bucketType; } - private static final Map<String, RenderBucketType> bucketTypeMap = new HashMap<String, RenderBucketType>(); + private static final Map<String, RenderBucketType> bucketTypeMap = new HashMap<>(); private final String name; diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java index facd51c..7f333fd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.renderer.queue; +import java.util.LinkedHashMap; import java.util.Map; import com.ardor3d.renderer.Renderer; @@ -18,11 +19,10 @@ import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.util.Ardor3dException; import com.ardor3d.util.Constants; -import com.google.common.collect.Maps; public class RenderQueue { - private final Map<RenderBucketType, RenderBucket> renderBuckets = Maps.newLinkedHashMap(); + private final Map<RenderBucketType, RenderBucket> renderBuckets = new LinkedHashMap<>(); public RenderQueue() { setupDefaultBuckets(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/TransparentRenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/TransparentRenderBucket.java index fe3e73d..c655941 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/TransparentRenderBucket.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/TransparentRenderBucket.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -16,10 +16,10 @@ import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; import com.ardor3d.renderer.Renderer; import com.ardor3d.renderer.state.CullState; -import com.ardor3d.renderer.state.RenderState; -import com.ardor3d.renderer.state.ZBufferState; import com.ardor3d.renderer.state.CullState.Face; +import com.ardor3d.renderer.state.RenderState; import com.ardor3d.renderer.state.RenderState.StateType; +import com.ardor3d.renderer.state.ZBufferState; import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.scenegraph.hint.TransparencyType; @@ -120,6 +120,7 @@ public class TransparentRenderBucket extends AbstractRenderBucket { } private class TransparentComparator implements Comparator<Spatial> { + @Override public int compare(final Spatial o1, final Spatial o2) { final double d1 = distanceToCam(o1); final double d2 = distanceToCam(o2); diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/BlendState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/BlendState.java index a8a638b..44ab9cc 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/BlendState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/BlendState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ClipState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ClipState.java index 5d9adb8..281cdf5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ClipState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ClipState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ColorMaskState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ColorMaskState.java index 1ca3504..6dac657 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ColorMaskState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ColorMaskState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/CullState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/CullState.java index 62d47fc..35629b2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/CullState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/CullState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FogState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FogState.java index 610742e..c2ffb0e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FogState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FogState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java index 13b6f6d..e5cba5e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -39,7 +39,7 @@ public class FragmentProgramState extends RenderState { /** * <code>setEnvParameter</code> sets an environmental fragment program parameter that is accessable by all fragment * programs in memory. - * + * * @param param * four-element array of floating point numbers * @param paramID @@ -50,7 +50,7 @@ public class FragmentProgramState extends RenderState { * public static void setEnvParameter(float[] param, int paramID){ if (paramID < 0 || paramID > 95) throw new * IllegalArgumentException("Invalid parameter ID"); if (param != null && param.length != 4) throw new * IllegalArgumentException("Vertex program parameters must be of type float[4]"); - * + * * envparameters[paramID] = param; } */ @@ -60,7 +60,7 @@ public class FragmentProgramState extends RenderState { /** * <code>setParameter</code> sets a parameter for this fragment program. - * + * * @param paramID * identity number of the parameter, ranging from 0 to 23 * @param param @@ -86,14 +86,12 @@ public class FragmentProgramState extends RenderState { /** * Loads the fragment program into a byte array. - * + * * @see com.ardor3d.renderer.state.FragmentProgramState#load(java.net.URL) */ public void load(final java.net.URL file) { - InputStream inputStream = null; - try { - final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024); - inputStream = new BufferedInputStream(file.openStream()); + try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024); + final InputStream inputStream = new BufferedInputStream(file.openStream())) { final byte[] buffer = new byte[1024]; int byteCount = -1; @@ -107,7 +105,6 @@ public class FragmentProgramState extends RenderState { // Release resources inputStream.close(); - outputStream.close(); program = BufferUtils.createByteBuffer(data.length); program.put(data); @@ -117,21 +114,12 @@ public class FragmentProgramState extends RenderState { } catch (final Exception e) { logger.severe("Could not load fragment program: " + e); logger.logp(Level.SEVERE, getClass().getName(), "load(URL)", "Exception", e); - } finally { - // Ensure that the stream is closed, even if there is an exception. - if (inputStream != null) { - try { - inputStream.close(); - } catch (final IOException closeFailure) { - logger.log(Level.WARNING, "Failed to close the fragment program", closeFailure); - } - } } } /** * Loads the fragment program into a byte array. - * + * * @see com.ardor3d.renderer.state.FragmentProgramState#load(java.net.URL) */ public void load(final String programContents) { @@ -170,7 +158,7 @@ public class FragmentProgramState extends RenderState { /** * Used with Serialization. Do not call this directly. - * + * * @param s * @throws IOException * @see java.io.Serializable @@ -190,7 +178,7 @@ public class FragmentProgramState extends RenderState { /** * Used with Serialization. Do not call this directly. - * + * * @param s * @throws IOException * @throws ClassNotFoundException diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderDataLogic.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderDataLogic.java index a2a5036..e514e63 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderDataLogic.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderDataLogic.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java index ce4c799..d9ababd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -70,11 +70,11 @@ public class GLSLShaderObjectsState extends RenderState { private static final Logger logger = Logger.getLogger(GLSLShaderObjectsState.class.getName()); /** Storage for shader uniform values */ - protected List<ShaderVariable> _shaderUniforms = new ArrayList<ShaderVariable>(); + protected List<ShaderVariable> _shaderUniforms = new ArrayList<>(); /** Storage for shader attribute values */ - protected List<ShaderVariable> _shaderAttributes = new ArrayList<ShaderVariable>(); + protected List<ShaderVariable> _shaderAttributes = new ArrayList<>(); - protected ByteBuffer _vertShader, _fragShader, _geomShader, _tessControlShader, _tessEvalShader; + protected ByteBuffer _vertShader, _fragShader, _geomShader, _tessControlShader, _tessEvalShader, _compShader; // XXX: The below fields are public for brevity mostly as a way to remember that this class needs revisiting. @@ -107,6 +107,9 @@ public class GLSLShaderObjectsState extends RenderState { /** OpenGL id for the attached tessellation evaluation shader. */ public int _tessellationEvaluationShaderID = -1; + /** OpenGL id for the attached compute shader. */ + public int _computeShaderID = -1; + /** if true, we'll send our vertex attributes to the shader via vbo */ private boolean _useAttributeVBO; @@ -125,9 +128,12 @@ public class GLSLShaderObjectsState extends RenderState { /** optional name for our tessellation evaluation shader, used for debugging details. */ public String _tessellationEvaluationShaderName; + /** optional name for our compute shader, used for debugging details. */ + public String _computeShaderName; + /** * Gets the currently loaded vertex shader. - * + * * @return */ public ByteBuffer getVertexShader() { @@ -136,7 +142,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Gets the currently loaded fragment shader. - * + * * @return */ public ByteBuffer getFragmentShader() { @@ -145,7 +151,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Gets the currently loaded geometry shader. - * + * * @return */ public ByteBuffer getGeometryShader() { @@ -154,7 +160,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Gets the currently loaded tessellation control shader. - * + * * @return */ public ByteBuffer getTessellationControlShader() { @@ -163,13 +169,22 @@ public class GLSLShaderObjectsState extends RenderState { /** * Gets the currently loaded tessellation evaluation shader. - * + * * @return */ public ByteBuffer getTessellationEvaluationShader() { return _tessEvalShader; } + /** + * Gets the currently loaded compute shader. + * + * @return + */ + public ByteBuffer getComputeShader() { + return _compShader; + } + public void setVertexShader(final InputStream stream) throws IOException { setVertexShader(stream, ""); } @@ -215,35 +230,30 @@ public class GLSLShaderObjectsState extends RenderState { _tessellationEvaluationShaderName = name; } + public void setComputeShader(final InputStream stream) throws IOException { + setComputeShader(stream, ""); + } + + public void setComputeShader(final InputStream stream, final String name) throws IOException { + setComputeShader(load(stream)); + _computeShaderName = name; + } + protected ByteBuffer load(final InputStream in) throws IOException { - DataInputStream dataStream = null; - try { - final BufferedInputStream bufferedInputStream = new BufferedInputStream(in); - dataStream = new DataInputStream(bufferedInputStream); + try (final BufferedInputStream bufferedInputStream = new BufferedInputStream(in); + final DataInputStream dataStream = new DataInputStream(bufferedInputStream)) { final byte shaderCode[] = new byte[bufferedInputStream.available()]; dataStream.readFully(shaderCode); - bufferedInputStream.close(); - dataStream.close(); final ByteBuffer shaderByteBuffer = BufferUtils.createByteBuffer(shaderCode.length); shaderByteBuffer.put(shaderCode); shaderByteBuffer.rewind(); - return shaderByteBuffer; - } finally { - // Ensure that the stream is closed, even if there is an exception. - if (dataStream != null) { - try { - dataStream.close(); - } catch (final IOException closeFailure) { - logger.log(Level.WARNING, "Failed to close the shader object", closeFailure); - } - } } } /** * Set the contents for our vertex shader - * + * * @param shader * the shader contents. */ @@ -253,7 +263,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our vertex shader - * + * * @param shader * the shader contents. * @param name @@ -266,7 +276,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our fragment shader - * + * * @param shader * the shader contents. */ @@ -276,7 +286,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our fragment shader - * + * * @param shader * the shader contents. * @param name @@ -289,7 +299,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our geometry shader - * + * * @param shader * the shader contents. */ @@ -299,7 +309,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our geometry shader - * + * * @param shader * the shader contents. * @param name @@ -312,7 +322,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our tessellation control shader - * + * * @param shader * the shader contents. */ @@ -322,7 +332,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our tessellation control shader - * + * * @param shader * the shader contents. * @param name @@ -335,7 +345,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our tessellation evaluation shader - * + * * @param shader * the shader contents. */ @@ -345,7 +355,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our tessellation evaluation shader - * + * * @param shader * the shader contents. * @param name @@ -357,8 +367,31 @@ public class GLSLShaderObjectsState extends RenderState { } /** + * Set the contents for our compute shader + * + * @param shader + * the shader contents. + */ + public void setComputeShader(final ByteBuffer shader) { + setComputeShader(shader, ""); + } + + /** + * Set the contents for our compute shader + * + * @param shader + * the shader contents. + * @param name + * a label for this shader, displayer upon shader errors. + */ + public void setComputeShader(final ByteBuffer shader, final String name) { + _compShader = shader; + _computeShaderName = name; + } + + /** * Set the contents for our vertex shader - * + * * @param shader * the shader contents. */ @@ -368,7 +401,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our vertex shader - * + * * @param shader * the shader contents. * @param name @@ -381,7 +414,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our fragment shader - * + * * @param shader * the shader contents. */ @@ -391,7 +424,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our fragment shader - * + * * @param shader * the shader contents. * @param name @@ -404,7 +437,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our geometry shader - * + * * @param shader * the shader contents. */ @@ -414,7 +447,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our geometry shader - * + * * @param shader * the shader contents. * @param name @@ -427,7 +460,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our tessellation control shader - * + * * @param shader * the shader contents. */ @@ -437,7 +470,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our tessellation control shader - * + * * @param shader * the shader contents. * @param name @@ -450,7 +483,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our tessellation evaluation shader - * + * * @param shader * the shader contents. */ @@ -460,7 +493,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set the contents for our tessellation evaluation shader - * + * * @param shader * the shader contents. * @param name @@ -471,6 +504,29 @@ public class GLSLShaderObjectsState extends RenderState { _tessellationEvaluationShaderName = name; } + /** + * Set the contents for our compute shader + * + * @param shader + * the shader contents. + */ + public void setComputeShader(final String shader) { + setComputeShader(shader, ""); + } + + /** + * Set the contents for our compute shader + * + * @param shader + * the shader contents. + * @param name + * a label for this shader, displayer upon shader errors. + */ + public void setComputeShader(final String shader, final String name) { + _compShader = stringToByteBuffer(shader); + _computeShaderName = name; + } + private ByteBuffer stringToByteBuffer(final String str) { final byte[] bytes = str.getBytes(); final ByteBuffer buf = BufferUtils.createByteBuffer(bytes.length); @@ -481,7 +537,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Gets all shader uniforms variables. - * + * * @return */ public List<ShaderVariable> getShaderUniforms() { @@ -490,7 +546,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Retrieves a shader uniform by name. - * + * * @param uniformName * @return */ @@ -506,7 +562,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Gets all shader attribute variables. - * + * * @return */ public List<ShaderVariable> getShaderAttributes() { @@ -515,7 +571,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Retrieves a shader attribute by name. - * + * * @param uniformName * @return */ @@ -530,7 +586,7 @@ public class GLSLShaderObjectsState extends RenderState { } /** - * + * * @param meshData */ public void setMesh(final Mesh mesh) { @@ -539,7 +595,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Logic to handle setting mesh-specific data to a shader before rendering - * + * * @param shaderDataLogic */ public void setShaderDataLogic(final GLSLShaderDataLogic shaderDataLogic) { @@ -564,7 +620,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -579,7 +635,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -594,7 +650,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -609,7 +665,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value1 @@ -627,7 +683,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value1 @@ -645,7 +701,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value1 @@ -663,7 +719,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value1 @@ -684,7 +740,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value1 @@ -705,7 +761,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value1 @@ -726,7 +782,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value1 @@ -751,7 +807,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value1 @@ -775,7 +831,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value1 @@ -800,7 +856,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -819,7 +875,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -834,7 +890,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -849,7 +905,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -864,7 +920,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -880,7 +936,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -897,7 +953,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -915,7 +971,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -933,7 +989,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -951,7 +1007,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -973,7 +1029,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -995,7 +1051,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform Matrix4 variable to change * @param value @@ -1015,7 +1071,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an uniform value for this shader object. - * + * * @param name * uniform variable to change * @param value @@ -1051,7 +1107,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an attribute pointer value for this shader object. - * + * * @param name * attribute variable to change * @param size @@ -1079,7 +1135,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an attribute pointer value for this shader object. - * + * * @param name * attribute variable to change * @param size @@ -1103,7 +1159,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an attribute pointer value for this shader object. - * + * * @param name * attribute variable to change * @param size @@ -1120,8 +1176,8 @@ public class GLSLShaderObjectsState extends RenderState { * @param data * The actual data to use as attribute pointer */ - public void setAttributePointer(final String name, final int size, final boolean normalized, - final boolean unsigned, final int stride, final ByteBufferData data) { + public void setAttributePointer(final String name, final int size, final boolean normalized, final boolean unsigned, + final int stride, final ByteBufferData data) { final ShaderVariablePointerByte shaderUniform = getShaderAttribute(name, ShaderVariablePointerByte.class); shaderUniform.size = size; shaderUniform.normalized = normalized; @@ -1134,7 +1190,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an attribute pointer value for this shader object. - * + * * @param name * attribute variable to change * @param size @@ -1151,8 +1207,8 @@ public class GLSLShaderObjectsState extends RenderState { * @param data * The actual data to use as attribute pointer */ - public void setAttributePointer(final String name, final int size, final boolean normalized, - final boolean unsigned, final int stride, final IntBufferData data) { + public void setAttributePointer(final String name, final int size, final boolean normalized, final boolean unsigned, + final int stride, final IntBufferData data) { final ShaderVariablePointerInt shaderUniform = getShaderAttribute(name, ShaderVariablePointerInt.class); shaderUniform.size = size; shaderUniform.normalized = normalized; @@ -1165,7 +1221,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Set an attribute pointer value for this shader object. - * + * * @param name * attribute variable to change * @param size @@ -1182,8 +1238,8 @@ public class GLSLShaderObjectsState extends RenderState { * @param data * The actual data to use as attribute pointer */ - public void setAttributePointer(final String name, final int size, final boolean normalized, - final boolean unsigned, final int stride, final ShortBufferData data) { + public void setAttributePointer(final String name, final int size, final boolean normalized, final boolean unsigned, + final int stride, final ShortBufferData data) { final ShaderVariablePointerShort shaderUniform = getShaderAttribute(name, ShaderVariablePointerShort.class); shaderUniform.size = size; shaderUniform.normalized = normalized; @@ -1208,7 +1264,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Creates or retrieves a uniform shadervariable. - * + * * @param name * Name of the uniform shadervariable to retrieve or create * @param classz @@ -1222,7 +1278,7 @@ public class GLSLShaderObjectsState extends RenderState { /** * Creates or retrieves a attribute shadervariable. - * + * * @param name * Name of the attribute shadervariable to retrieve or create * @param classz @@ -1262,11 +1318,11 @@ public class GLSLShaderObjectsState extends RenderState { return shaderUniform; } catch (final InstantiationException e) { - logger.logp(Level.SEVERE, this.getClass().toString(), - "getShaderVariable(name, classz, shaderVariableList)", "Exception", e); + logger.logp(Level.SEVERE, this.getClass().toString(), "getShaderVariable(name, classz, shaderVariableList)", + "Exception", e); } catch (final IllegalAccessException e) { - logger.logp(Level.SEVERE, this.getClass().toString(), - "getShaderVariable(name, classz, shaderVariableList)", "Exception", e); + logger.logp(Level.SEVERE, this.getClass().toString(), "getShaderVariable(name, classz, shaderVariableList)", + "Exception", e); } return null; diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java index a5ce713..5224c13 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -95,7 +95,7 @@ public class LightState extends RenderState { * Constructor instantiates a new <code>LightState</code> object. Initially there are no lights set. */ public LightState() { - lightList = new ArrayList<Light>(); + lightList = new ArrayList<>(); } @Override diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightUtil.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightUtil.java index 112a955..291ab3e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightUtil.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -32,6 +32,7 @@ public abstract class LightUtil { _sp = sp; } + @Override public int compare(final Light l1, final Light l2) { final double v1 = getValueFor(l1, _sp.getWorldBound()); final double v2 = getValueFor(l2, _sp.getWorldBound()); diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/MaterialState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/MaterialState.java index 5591212..eb361da 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/MaterialState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/MaterialState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/OffsetState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/OffsetState.java index b6d0699..5279f25 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/OffsetState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/OffsetState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java index 560daf7..62267b3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -24,7 +24,6 @@ import com.ardor3d.util.Constants; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; -import com.google.common.collect.Maps; /** * <code>RenderState</code> is the base class for all states that affect the rendering of a piece of geometry. They @@ -96,8 +95,8 @@ public abstract class RenderState implements Savable { static public class StateStack implements Poolable { - private final EnumMap<RenderState.StateType, Stack<RenderState>> stacks = Maps - .newEnumMap(RenderState.StateType.class); + private final EnumMap<RenderState.StateType, Stack<RenderState>> stacks = new EnumMap<>( + RenderState.StateType.class); public StateStack() {} @@ -123,7 +122,7 @@ public abstract class RenderState implements Savable { public void push(final RenderState state) { Stack<RenderState> stack = stacks.get(state.getType()); if (stack == null) { - stack = new Stack<RenderState>(); + stack = new Stack<>(); stacks.put(state.getType(), stack); } stack.push(state); @@ -196,14 +195,17 @@ public abstract class RenderState implements Savable { return stack.peek(); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_enabled, "enabled", true); } + @Override public void read(final InputCapsule capsule) throws IOException { _enabled = capsule.readBoolean("enabled", true); } + @Override public Class<? extends RenderState> getClassTag() { return this.getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ShadingState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ShadingState.java index c0fa922..9827dfb 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ShadingState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ShadingState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/StencilState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/StencilState.java index 55b2b9d..586243f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/StencilState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/StencilState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java index 9b8d4ea..37a0653 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -62,7 +62,7 @@ public class TextureState extends RenderState { } /** The texture(s). */ - protected List<Texture> _texture = new ArrayList<Texture>(1); + protected List<Texture> _texture = new ArrayList<>(1); /** * Perspective correction to use for the object rendered with this texture state. Default is diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java index 44e49b4..e5eafa6 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -46,7 +46,7 @@ public class VertexProgramState extends RenderState { /** * <code>setEnvParameter</code> sets an environmental vertex program parameter that is accessible by all vertex * programs in memory. - * + * * @param param * four-element array of floating point numbers * @param paramID @@ -72,7 +72,7 @@ public class VertexProgramState extends RenderState { /** * <code>setParameter</code> sets a parameter for this vertex program. - * + * * @param paramID * identity number of the parameter, ranging from 0 to 95 * @param param @@ -97,10 +97,8 @@ public class VertexProgramState extends RenderState { } public void load(final java.net.URL file) { - InputStream inputStream = null; - try { - final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024); - inputStream = new BufferedInputStream(file.openStream()); + try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024); + final InputStream inputStream = new BufferedInputStream(file.openStream())) { final byte[] buffer = new byte[1024]; int byteCount = -1; @@ -112,10 +110,6 @@ public class VertexProgramState extends RenderState { // Set data with byte content from stream final byte[] data = outputStream.toByteArray(); - // Release resources - inputStream.close(); - outputStream.close(); - _program = BufferUtils.createByteBuffer(data.length); _program.put(data); _program.rewind(); @@ -125,22 +119,12 @@ public class VertexProgramState extends RenderState { } catch (final Exception e) { logger.severe("Could not load vertex program: " + e); logger.logp(Level.SEVERE, getClass().getName(), "load(URL)", "Exception", e); - } finally { - // Ensure that the stream is closed, even if there is an exception. - if (inputStream != null) { - try { - inputStream.close(); - } catch (final IOException closeFailure) { - logger.log(Level.WARNING, "Failed to close the vertex program", closeFailure); - } - } - } } /** * Loads the vertex program into a byte array. - * + * * @see com.ardor3d.renderer.state.VertexProgramState#load(java.net.URL) */ public void load(final String programContents) { @@ -184,7 +168,7 @@ public class VertexProgramState extends RenderState { /** * Used with Serialization. Do not call this directly. - * + * * @param s * @throws IOException * @see java.io.Serializable @@ -204,7 +188,7 @@ public class VertexProgramState extends RenderState { /** * Used with Serialization. Do not call this directly. - * + * * @param s * @throws IOException * @throws ClassNotFoundException diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/WireframeState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/WireframeState.java index db92612..27a67a4 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/WireframeState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/WireframeState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ZBufferState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ZBufferState.java index b3ee5d8..84449e5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ZBufferState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ZBufferState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/BlendStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/BlendStateRecord.java index 4687bba..dc1ee42 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/BlendStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/BlendStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java index 2c5a5ad..3d006a2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ColorMaskStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ColorMaskStateRecord.java index 559050a..00ef738 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ColorMaskStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ColorMaskStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/CullStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/CullStateRecord.java index 55a39f8..b496aa5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/CullStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/CullStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FogStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FogStateRecord.java index 7217f88..6617c90 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FogStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FogStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FragmentProgramStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FragmentProgramStateRecord.java index 3c5e6bc..1ecdbe8 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FragmentProgramStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FragmentProgramStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightRecord.java index cee7c73..6702554 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java index 3a04e45..f640f51 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -18,7 +18,7 @@ import com.ardor3d.math.ColorRGBA; import com.ardor3d.util.geom.BufferUtils; public class LightStateRecord extends StateRecord { - private final List<LightRecord> lightList = new ArrayList<LightRecord>(); + private final List<LightRecord> lightList = new ArrayList<>(); private int lightMask; private int backLightMask; private boolean twoSidedOn; diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LineRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LineRecord.java index 64a1c1b..7804a59 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LineRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LineRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/MaterialStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/MaterialStateRecord.java index a61c5e0..c1a12e2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/MaterialStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/MaterialStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/OffsetStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/OffsetStateRecord.java index b982024..75052ab 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/OffsetStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/OffsetStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java index 9f51cbc..e66f591 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -26,7 +26,7 @@ public class RendererRecord extends StateRecord { private boolean _clippingTestEnabled; private transient final ColorRGBA _tempColor = new ColorRGBA(); private DrawBufferTarget _drawBufferTarget = null; - private final Stack<ReadOnlyRectangle2> _clips = new Stack<ReadOnlyRectangle2>(); + private final Stack<ReadOnlyRectangle2> _clips = new Stack<>(); private int _normalMode = -1; // signifies disabled private int _enabledTextures = 0; private boolean _texturesValid = false; diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java index b542051..dc012ef 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,11 +10,11 @@ package com.ardor3d.renderer.state.record; +import java.util.ArrayList; import java.util.List; import com.ardor3d.renderer.state.GLSLShaderObjectsState; import com.ardor3d.util.shader.ShaderVariable; -import com.google.common.collect.Lists; public class ShaderObjectsStateRecord extends StateRecord { // XXX NOTE: This is non-standard. Due to the fact that shader implementations @@ -22,7 +22,7 @@ public class ShaderObjectsStateRecord extends StateRecord { // XXX checking system. GLSLShaderObjectsState reference = null; - public List<ShaderVariable> enabledAttributes = Lists.newArrayList(); + public List<ShaderVariable> enabledAttributes = new ArrayList<>(); public int shaderId = -1; diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShadingStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShadingStateRecord.java index a561eed..0ada9b3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShadingStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShadingStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StateRecord.java index 1c6aead..1b47cd1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StencilStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StencilStateRecord.java index de76d39..7e2362a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StencilStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StencilStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureRecord.java index 3baf5d5..7ed8ac2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java index 062c555..095744f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -20,7 +20,6 @@ import com.ardor3d.math.Vector3; import com.ardor3d.math.type.ReadOnlyVector4; import com.ardor3d.renderer.state.TextureState; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Maps; public class TextureStateRecord extends StateRecord { @@ -47,7 +46,7 @@ public class TextureStateRecord extends StateRecord { public final DoubleBuffer tmp_matrixBuffer = BufferUtils.createDoubleBuffer(16); public TextureStateRecord() { - textures = Maps.newHashMap(); + textures = new HashMap<>(); units = new TextureUnitRecord[TextureState.MAX_TEXTURES]; for (int i = 0; i < units.length; i++) { units[i] = new TextureUnitRecord(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureUnitRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureUnitRecord.java index 64a0133..0a33b6b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureUnitRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureUnitRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/VertexProgramStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/VertexProgramStateRecord.java index f630739..366db9d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/VertexProgramStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/VertexProgramStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/WireframeStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/WireframeStateRecord.java index 1f27367..ebcb6b9 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/WireframeStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/WireframeStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ZBufferStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ZBufferStateRecord.java index 88c63c1..1e881bd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ZBufferStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ZBufferStateRecord.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java index 9274fb0..817a8df 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -15,6 +15,7 @@ import java.lang.ref.ReferenceQueue; import java.nio.Buffer; import java.util.Map; import java.util.Set; +import java.util.WeakHashMap; import com.ardor3d.renderer.ContextCleanListener; import com.ardor3d.renderer.ContextManager; @@ -27,18 +28,18 @@ import com.ardor3d.util.GameTaskQueueManager; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.MapMaker; import com.google.common.collect.Multimap; public abstract class AbstractBufferData<T extends Buffer> { - private static Map<AbstractBufferData<?>, Object> _identityCache = new MapMaker().weakKeys().makeMap(); + private static Map<AbstractBufferData<?>, Object> _identityCache = new WeakHashMap<>(); private static final Object STATIC_REF = new Object(); - private static ReferenceQueue<AbstractBufferData<?>> _vboRefQueue = new ReferenceQueue<AbstractBufferData<?>>(); + private static ReferenceQueue<AbstractBufferData<?>> _vboRefQueue = new ReferenceQueue<>(); static { ContextManager.addContextCleanListener(new ContextCleanListener() { + @Override public void cleanForContext(final RenderContext renderContext) { AbstractBufferData.cleanAllVBOs(null, renderContext); } @@ -72,7 +73,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Gets the count. - * + * * @return the count */ public int getBufferLimit() { @@ -85,7 +86,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Gets the count. - * + * * @return the count */ public int getBufferCapacity() { @@ -98,7 +99,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Get the buffer holding the data. - * + * * @return the buffer */ public T getBuffer() { @@ -107,7 +108,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Set the buffer holding the data. - * + * * @param buffer * the buffer to set */ @@ -133,7 +134,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Removes any vbo id from this buffer's data for the given OpenGL context. - * + * * @param glContext * the object representing the OpenGL context a vbo would belong to. See * {@link RenderContext#getGlContextRep()} @@ -149,7 +150,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Sets the id for a vbo based on this buffer's data in regards to the given OpenGL context. - * + * * @param glContextRep * the object representing the OpenGL context a vbo belongs to. See * {@link RenderContext#getGlContextRep()} @@ -164,7 +165,7 @@ public abstract class AbstractBufferData<T extends Buffer> { } if (_vboIdCache == null) { - _vboIdCache = new ContextIdReference<AbstractBufferData<T>>(this, _vboRefQueue); + _vboIdCache = new ContextIdReference<>(this, _vboRefQueue); } _vboIdCache.put(glContextRep, vboId); } @@ -234,7 +235,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Clean any VBO ids from the hardware, using the given Renderer object to do the work immediately, if given. If * not, we will delete in the next execution of the appropriate context's game task render queue. - * + * * @param deleter * the Renderer to use. If null, execution will not occur immediately. */ @@ -299,8 +300,9 @@ public abstract class AbstractBufferData<T extends Buffer> { } // Otherwise, add a delete request to that context's render task queue. else { - GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)).render( - new RendererCallable<Void>() { + GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)) + .render(new RendererCallable<Void>() { + @Override public Void call() throws Exception { getRenderer().deleteVBOs(idMap.get(glref)); return null; diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ByteBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ByteBufferData.java index 4091e06..15120e0 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ByteBufferData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ByteBufferData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -50,6 +50,7 @@ public class ByteBufferData extends IndexBufferData<ByteBuffer> implements Savab _buffer = buffer; } + @Override public Class<? extends ByteBufferData> getClassTag() { return getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferData.java index 19d0a16..a354372 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -126,6 +126,7 @@ public class FloatBufferData extends AbstractBufferData<FloatBuffer> implements return copy; } + @Override public Class<? extends FloatBufferData> getClassTag() { return getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferDataUtil.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferDataUtil.java index b0afc37..25a74dd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferDataUtil.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferDataUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IndexBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IndexBufferData.java index 4ca77b5..1b4654e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IndexBufferData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IndexBufferData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java index e6673a5..e788161 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.scenegraph; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.List; import com.ardor3d.math.Matrix4; @@ -21,12 +22,11 @@ import com.ardor3d.renderer.Renderer; import com.ardor3d.renderer.state.GLSLShaderObjectsState; import com.ardor3d.util.Ardor3dException; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; public class InstancingManager { private int _maxBatchSize = 30; - private final List<Mesh> _visibleMeshes = Lists.newArrayListWithCapacity(_maxBatchSize); + private final List<Mesh> _visibleMeshes = new ArrayList<>(_maxBatchSize); private FloatBuffer _transformBuffer; private int _primCount; private int _meshesToDraw = 0; diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IntBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IntBufferData.java index 219a729..3cb43d3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IntBufferData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IntBufferData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -49,6 +49,7 @@ public class IntBufferData extends IndexBufferData<IntBuffer> implements Savable _buffer = buffer; } + @Override public Class<? extends IntBufferData> getClassTag() { return getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Line.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Line.java index 164f769..7267232 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Line.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Line.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java index 3822eae..18a6086 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,6 +12,7 @@ package com.ardor3d.scenegraph; import java.io.IOException; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.EnumMap; import java.util.List; @@ -47,7 +48,6 @@ import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.scenegraph.RenderDelegate; import com.ardor3d.util.stat.StatCollector; import com.ardor3d.util.stat.StatType; -import com.google.common.collect.Lists; /** * A Mesh is a spatial describing a renderable geometric object. Data about the mesh is stored locally using MeshData. @@ -66,7 +66,7 @@ public class Mesh extends Spatial implements Renderable, Pickable { * The compiled list of renderstates for this mesh, taking into account ancestors states - updated with * updateRenderStates() */ - protected final EnumMap<RenderState.StateType, RenderState> _states = new EnumMap<RenderState.StateType, RenderState>( + protected final EnumMap<RenderState.StateType, RenderState> _states = new EnumMap<>( RenderState.StateType.class); /** The compiled lightState for this mesh */ @@ -238,6 +238,7 @@ public class Mesh extends Spatial implements Renderable, Pickable { return store; } + @Override public void render(final Renderer renderer) { if (isVisible()) { render(renderer, getMeshData()); @@ -570,7 +571,7 @@ public class Mesh extends Spatial implements Renderable, Pickable { @Override public IntersectionRecord intersectsPrimitivesWhere(final Ray3 ray) { - final List<PrimitiveKey> primitives = Lists.newArrayList(); + final List<PrimitiveKey> primitives = new ArrayList<>(); // What about Lines and Points? final CollisionTree ct = CollisionTreeManager.getInstance().getCollisionTree(this); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java index 3c02967..7a86fb3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -19,6 +19,7 @@ import java.nio.ShortBuffer; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import java.util.logging.Logger; import com.ardor3d.math.MathUtils; @@ -32,8 +33,6 @@ import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; -import com.google.common.collect.MapMaker; /** * MeshData contains all the commonly used buffers for rendering a mesh. @@ -58,7 +57,7 @@ public class MeshData implements Savable { protected FloatBufferData _colorCoords; protected FloatBufferData _fogCoords; protected FloatBufferData _tangentCoords; - protected List<FloatBufferData> _textureCoords = Lists.newArrayListWithCapacity(1); + protected List<FloatBufferData> _textureCoords = new ArrayList<>(1); /** Interleaved data (for VBO id use). */ protected FloatBufferData _interleaved; @@ -72,7 +71,7 @@ public class MeshData implements Savable { /** * Gets the vertex count. - * + * * @return the vertex count */ public int getVertexCount() { @@ -81,7 +80,7 @@ public class MeshData implements Savable { /** * Gets the vertex buffer. - * + * * @return the vertex buffer */ public FloatBuffer getVertexBuffer() { @@ -93,7 +92,7 @@ public class MeshData implements Savable { /** * Sets the vertex buffer. - * + * * @param vertexBuffer * the new vertex buffer */ @@ -108,7 +107,7 @@ public class MeshData implements Savable { /** * Gets the vertex coords. - * + * * @return the vertex coords */ public FloatBufferData getVertexCoords() { @@ -123,7 +122,7 @@ public class MeshData implements Savable { /** * Sets the vertex coords. - * + * * @param bufferData * the new vertex coords */ @@ -135,7 +134,7 @@ public class MeshData implements Savable { /** * Gets the normal buffer. - * + * * @return the normal buffer */ public FloatBuffer getNormalBuffer() { @@ -147,7 +146,7 @@ public class MeshData implements Savable { /** * Sets the normal buffer. - * + * * @param normalBuffer * the new normal buffer */ @@ -162,7 +161,7 @@ public class MeshData implements Savable { /** * Gets the normal coords. - * + * * @return the normal coords */ public FloatBufferData getNormalCoords() { @@ -171,7 +170,7 @@ public class MeshData implements Savable { /** * Sets the normal coords. - * + * * @param bufferData * the new normal coords */ @@ -182,7 +181,7 @@ public class MeshData implements Savable { /** * Gets the color buffer. - * + * * @return the color buffer */ public FloatBuffer getColorBuffer() { @@ -194,7 +193,7 @@ public class MeshData implements Savable { /** * Sets the color buffer. - * + * * @param colorBuffer * the new color buffer */ @@ -209,7 +208,7 @@ public class MeshData implements Savable { /** * Gets the color coords. - * + * * @return the color coords */ public FloatBufferData getColorCoords() { @@ -218,7 +217,7 @@ public class MeshData implements Savable { /** * Sets the color coords. - * + * * @param bufferData * the new color coords */ @@ -229,7 +228,7 @@ public class MeshData implements Savable { /** * Gets the fog buffer. - * + * * @return the fog buffer */ public FloatBuffer getFogBuffer() { @@ -241,7 +240,7 @@ public class MeshData implements Savable { /** * Sets the fog buffer. - * + * * @param fogBuffer * the new fog buffer */ @@ -255,7 +254,7 @@ public class MeshData implements Savable { /** * Gets the fog coords. - * + * * @return the fog coords */ public FloatBufferData getFogCoords() { @@ -264,7 +263,7 @@ public class MeshData implements Savable { /** * Sets the fog coords. - * + * * @param bufferData * the new fog coords */ @@ -274,7 +273,7 @@ public class MeshData implements Savable { /** * Gets the tangent buffer. - * + * * @return the tangent buffer */ public FloatBuffer getTangentBuffer() { @@ -286,7 +285,7 @@ public class MeshData implements Savable { /** * Sets the tangent buffer. - * + * * @param tangentBuffer * the new tangent buffer */ @@ -300,7 +299,7 @@ public class MeshData implements Savable { /** * Gets the tangent coords. - * + * * @return the tangent coords */ public FloatBufferData getTangentCoords() { @@ -309,7 +308,7 @@ public class MeshData implements Savable { /** * Sets the tangent coords. - * + * * @param bufferData * the new tangent coords */ @@ -319,10 +318,10 @@ public class MeshData implements Savable { /** * Gets the FloatBuffer of the FloatBufferData set on a given texture unit. - * + * * @param index * the unit index - * + * * @return the texture buffer for the given index, or null if none was set. */ public FloatBuffer getTextureBuffer(final int index) { @@ -339,7 +338,7 @@ public class MeshData implements Savable { /** * Sets the texture buffer for a given texture unit index. Interprets it as a 2 component float buffer data. If you * need other sizes, use setTextureCoords instead. - * + * * @param textureBuffer * the texture buffer * @param index @@ -360,7 +359,7 @@ public class MeshData implements Savable { /** * Gets the texture coords. - * + * * @return the texture coords */ public List<FloatBufferData> getTextureCoords() { @@ -369,10 +368,10 @@ public class MeshData implements Savable { /** * Gets the texture coords assigned to a specific texture unit index of this MeshData. - * + * * @param index * the texture unit index - * + * * @return the texture coords */ public FloatBufferData getTextureCoords(final int index) { @@ -384,7 +383,7 @@ public class MeshData implements Savable { /** * Sets all texture coords on this MeshData. - * + * * @param textureCoords * the new texture coords */ @@ -395,7 +394,7 @@ public class MeshData implements Savable { /** * Sets the texture coords of a specific texture unit index to the given FloatBufferData. - * + * * @param textureCoords * the texture coords * @param index @@ -411,7 +410,7 @@ public class MeshData implements Savable { /** * Retrieves the interleaved buffer, if set or created through packInterleaved. - * + * * @return the interleaved buffer */ public FloatBuffer getInterleavedBuffer() { @@ -423,7 +422,7 @@ public class MeshData implements Savable { /** * Gets the interleaved data. - * + * * @return the interleaved data */ public FloatBufferData getInterleavedData() { @@ -432,7 +431,7 @@ public class MeshData implements Savable { /** * Sets the interleaved data. - * + * * @param interleavedData * the interleaved data */ @@ -459,7 +458,7 @@ public class MeshData implements Savable { /** * <code>copyTextureCoords</code> copies the texture coordinates of a given texture unit to another location. If the * texture unit is not valid, then the coordinates are ignored. Coords are multiplied by the given factor. - * + * * @param fromIndex * the coordinates to copy. * @param toIndex @@ -505,7 +504,7 @@ public class MeshData implements Savable { /** * <code>copyTextureCoords</code> copies the texture coordinates of a given texture unit to another location. If the * texture unit is not valid, then the coordinates are ignored. Coords are multiplied by the given S and T factors. - * + * * @param fromIndex * the coordinates to copy. * @param toIndex @@ -556,7 +555,7 @@ public class MeshData implements Savable { /** * <code>getNumberOfUnits</code> returns the number of texture units this geometry is currently using. - * + * * @return the number of texture units in use. */ public int getNumberOfUnits() { @@ -568,7 +567,7 @@ public class MeshData implements Savable { /** * Gets the index buffer. - * + * * @return the index buffer */ public Buffer getIndexBuffer() { @@ -580,7 +579,7 @@ public class MeshData implements Savable { /** * Sets the index buffer. - * + * * @param indices * the new index buffer */ @@ -596,7 +595,7 @@ public class MeshData implements Savable { /** * Sets the index buffer. - * + * * @param indices * the new index buffer */ @@ -612,7 +611,7 @@ public class MeshData implements Savable { /** * Sets the index buffer. - * + * * @param indices * the new index buffer */ @@ -628,7 +627,7 @@ public class MeshData implements Savable { /** * Gets the indices. - * + * * @return the indices */ public IndexBufferData<?> getIndices() { @@ -637,7 +636,7 @@ public class MeshData implements Savable { /** * Sets the indices - * + * * @param bufferData * the new indices */ @@ -649,7 +648,7 @@ public class MeshData implements Savable { /** * Gets the index mode. - * + * * @return the IndexMode of the first section of this MeshData. * @deprecated Please switch to {@link #getIndexMode(int)} */ @@ -660,7 +659,7 @@ public class MeshData implements Savable { /** * Sets the index mode. - * + * * @param indexMode * the new IndexMode to use for the first section of this MeshData. */ @@ -672,7 +671,7 @@ public class MeshData implements Savable { /** * Gets the index lengths. - * + * * @return the index lengths */ public int[] getIndexLengths() { @@ -681,7 +680,7 @@ public class MeshData implements Savable { /** * Sets the index lengths. - * + * * @param indexLengths * the new index lengths */ @@ -693,7 +692,7 @@ public class MeshData implements Savable { /** * Gets the index modes. - * + * * @return the index modes */ public IndexMode[] getIndexModes() { @@ -702,10 +701,10 @@ public class MeshData implements Savable { /** * Gets the index mode. - * + * * @param sectionIndex * the section index - * + * * @return the index mode */ public IndexMode getIndexMode(final int sectionIndex) { @@ -717,7 +716,7 @@ public class MeshData implements Savable { /** * Note: Also updates primitive counts. - * + * * @param indexModes * the index modes to use for this MeshData. */ @@ -729,7 +728,7 @@ public class MeshData implements Savable { /** * Gets the section count. - * + * * @return the number of sections (lengths, indexModes, etc.) this MeshData contains. */ public int getSectionCount() { @@ -738,7 +737,7 @@ public class MeshData implements Savable { /** * Gets the total primitive count. - * + * * @return the sum of the primitive counts on all sections of this mesh data. */ public int getTotalPrimitiveCount() { @@ -751,10 +750,10 @@ public class MeshData implements Savable { /** * Gets the primitive count. - * + * * @param section * the section - * + * * @return the number of primitives (triangles, quads, lines, points, etc.) on a given section of this mesh data. */ public int getPrimitiveCount(final int section) { @@ -763,7 +762,7 @@ public class MeshData implements Savable { /** * Returns the vertex indices of a specified primitive. - * + * * @param primitiveIndex * which triangle, quad, etc * @param section @@ -771,9 +770,9 @@ public class MeshData implements Savable { * @param store * an int array to store the results in. if null, or the length < the size of the primitive, a new array * is created and returned. - * + * * @return the primitive's vertex indices as an array - * + * * @throws IndexOutOfBoundsException * if primitiveIndex is outside of range [0, count-1] where count is the number of primitives in the * given section. @@ -807,14 +806,14 @@ public class MeshData implements Savable { /** * Gets the vertices that make up the given primitive. - * + * * @param primitiveIndex * the primitive index * @param section * the section * @param store * the store. If null or the wrong size, we'll make a new array and return that instead. - * + * * @return the primitive */ public Vector3[] getPrimitiveVertices(final int primitiveIndex, final int section, final Vector3[] store) { @@ -841,7 +840,7 @@ public class MeshData implements Savable { } else { // non-indexed geometry BufferUtils - .populateFromBuffer(result[i], getVertexBuffer(), getVertexIndex(primitiveIndex, i, section)); + .populateFromBuffer(result[i], getVertexBuffer(), getVertexIndex(primitiveIndex, i, section)); } } @@ -850,7 +849,7 @@ public class MeshData implements Savable { /** * Gets the texture coordinates of the primitive. - * + * * @param primitiveIndex * the primitive index * @param section @@ -859,7 +858,7 @@ public class MeshData implements Savable { * the texture index * @param store * the store - * + * * @return the texture coordinates of the primitive */ public Vector2[] getPrimitiveTextureCoords(final int primitiveIndex, final int section, final int textureIndex, @@ -895,14 +894,14 @@ public class MeshData implements Savable { /** * Gets the vertex index. - * + * * @param primitiveIndex * which triangle, quad, etc. * @param point * which point on the triangle, quad, etc. (triangle has three points, so this would be 0-2, etc.) * @param section * which section to pull from (corresponds to array position in indexmodes and lengths) - * + * * @return the position you would expect to find the given point in the index buffer */ public int getVertexIndex(final int primitiveIndex, final int point, final int section) { @@ -957,10 +956,10 @@ public class MeshData implements Savable { /** * Random vertex. - * + * * @param store * the vector object to store the result in. if null, a new one is created. - * + * * @return a random vertex from the vertices stored in this MeshData. null is returned if there are no vertices. */ public Vector3 randomVertex(final Vector3 store) { @@ -981,10 +980,10 @@ public class MeshData implements Savable { /** * Random point on primitives. - * + * * @param store * the vector object to store the result in. if null, a new one is created. - * + * * @return a random point from the surface of a primitive stored in this MeshData. null is returned if there are no * vertices or indices. */ @@ -1083,7 +1082,7 @@ public class MeshData implements Savable { /** * Translate points. - * + * * @param x * the x * @param y @@ -1097,7 +1096,7 @@ public class MeshData implements Savable { /** * Translate points. - * + * * @param amount * the amount */ @@ -1130,7 +1129,7 @@ public class MeshData implements Savable { /** * Rotate points. - * + * * @param rotate * the rotate */ @@ -1145,7 +1144,7 @@ public class MeshData implements Savable { /** * Rotate normals. - * + * * @param rotate * the rotate */ @@ -1190,7 +1189,7 @@ public class MeshData implements Savable { /** * Sets the id for a vbo based on interleaving this MeshData's buffer, in regards to the given OpenGL context. - * + * * @param glContext * the object representing the OpenGL context a vbo belongs to. See * {@link RenderContext#getGlContextRep()} @@ -1205,7 +1204,7 @@ public class MeshData implements Savable { } if (_vboIdCache == null) { - _vboIdCache = new MapMaker().initialCapacity(1).weakKeys().makeMap(); + _vboIdCache = new WeakHashMap<>(1); } _vboIdCache.put(glContext, vboId); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java index f03c447..1518f8d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -494,7 +494,7 @@ public class Node extends Spatial { @Override public void write(final OutputCapsule capsule) throws IOException { super.write(capsule); - capsule.writeSavableList(new ArrayList<Spatial>(_children), "children", null); + capsule.writeSavableList(new ArrayList<>(_children), "children", null); } @Override diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Point.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Point.java index c23330d..6fac9d2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Point.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Point.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -40,7 +40,6 @@ public class Point extends Mesh { /** * Distance Attenuation fields. */ - // XXX: LWJGL requires 4 floats, but only 3 coefficients are mentioned in the specification? // JOGL works fine with 3. private final FloatBuffer _attenuationCoefficients = BufferUtils.createFloatBuffer(new float[] { 0.0f, 0f, 0.000004f, 0f }); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Renderable.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Renderable.java index 369b7d2..e8b77ea 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Renderable.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Renderable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ShortBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ShortBufferData.java index 5d8f8f8..92f9cda 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ShortBufferData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ShortBufferData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -50,6 +50,7 @@ public class ShortBufferData extends IndexBufferData<ShortBuffer> implements Sav _buffer = buffer; } + @Override public Class<? extends ShortBufferData> getClassTag() { return getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java index 6f636ff..0aab2e2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -17,6 +17,7 @@ import java.util.EnumMap; import java.util.EnumSet; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -52,7 +53,6 @@ import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; import com.ardor3d.util.scenegraph.RenderDelegate; -import com.google.common.collect.MapMaker; /** * Base class for all scenegraph objects. @@ -79,7 +79,7 @@ public abstract class Spatial implements Savable, Hintable { protected List<SpatialController<?>> _controllers; /** The render states of this spatial. */ - protected EnumMap<RenderState.StateType, RenderState> _renderStateList = new EnumMap<RenderState.StateType, RenderState>( + protected EnumMap<RenderState.StateType, RenderState> _renderStateList = new EnumMap<>( RenderState.StateType.class); /** Listener for dirty events. */ @@ -124,7 +124,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Constructs a new <code>Spatial</code> with a given name. - * + * * @param name * the name of the spatial. This is required for identification purposes. */ @@ -135,7 +135,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the name of this spatial. - * + * * @return This spatial's name. */ public String getName() { @@ -144,7 +144,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the name of this Spatial. - * + * * @param name * new name */ @@ -154,7 +154,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the render delegate. - * + * * @param delegate * the new delegate, or null for default behavior * @param glContextRef @@ -166,7 +166,7 @@ public abstract class Spatial implements Savable, Hintable { if (delegate == null) { return; } else { - _delegateMap = new MapMaker().weakKeys().makeMap(); + _delegateMap = new WeakHashMap<>(); } } if (delegate != null) { @@ -189,7 +189,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the render delegate. - * + * * @param glContextRef * if null, retrieve the default render delegate for this spatial. Otherwise, retrieve the delegate used * when this Spatial is rendered in a RenderContext tied to the given glContextRef. @@ -208,7 +208,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>getParent</code> retrieve's this node's parent. If the parent is null this is the root node. - * + * * @return the parent of this node. */ public Node getParent() { @@ -218,7 +218,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Called by {@link Node#attachChild(Spatial)} and {@link Node#detachChild(Spatial)} - don't call directly. * <code>setParent</code> sets the parent of this node. - * + * * @param parent * the parent of this node. */ @@ -228,7 +228,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>removeFromParent</code> removes this Spatial from it's parent. - * + * * @return true if it has a parent and performed the remove. */ public boolean removeFromParent() { @@ -241,7 +241,7 @@ public abstract class Spatial implements Savable, Hintable { /** * determines if the provided Node is the parent, or parent's parent, etc. of this Spatial. - * + * * @param ancestor * the ancestor object to look for. * @return true if the ancestor is found, false otherwise. @@ -259,22 +259,24 @@ public abstract class Spatial implements Savable, Hintable { /** * @see Hintable#getParentHintable() */ + @Override public Hintable getParentHintable() { return _parent; } /** * Gets the scene hints. - * + * * @return the scene hints set on this Spatial */ + @Override public SceneHints getSceneHints() { return _sceneHints; } /** * Returns the listener for dirty events on this node, if set. - * + * * @return the listener */ public DirtyEventListener getListener() { @@ -283,7 +285,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the listener for dirty events on this node. - * + * * @param listener * listener to use. */ @@ -293,7 +295,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Mark this node as dirty. Can be marked as Transform, Bounding, Attached, Detached, Destroyed or RenderState - * + * * @param dirtyType * the dirty type */ @@ -303,7 +305,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Mark this node as dirty. Can be marked as Transform, Bounding, Attached, Detached, Destroyed or RenderState - * + * * @param caller * the spatial where the marking was initiated * @param dirtyType @@ -345,7 +347,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Test if this spatial is marked as dirty in respect to the supplied DirtyType. - * + * * @param dirtyType * dirty type to test against * @return true if spatial marked dirty against the supplied dirty type @@ -356,7 +358,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Clears the dirty flag set at this spatial for the supplied dirty type. - * + * * @param dirtyType * dirty type to clear flag for */ @@ -366,7 +368,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Clears the dirty flag set at this spatial for the supplied dirty type. - * + * * @param caller * the spatial where the clearing was initiated * @param dirtyType @@ -380,7 +382,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Propagate the dirty mark up the tree hierarchy. - * + * * @param dirtyTypes * the dirty types */ @@ -394,7 +396,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Propagate the dirty mark down the tree hierarchy. - * + * * @param dirtyTypes * the dirty types */ @@ -405,7 +407,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Propagate the dirty event up the hierarchy. If a listener is found on the spatial the event is fired and the * propagation is stopped. - * + * * @param spatial * the spatial * @param dirtyType @@ -430,7 +432,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the local rotation matrix. - * + * * @return the rotation */ public ReadOnlyMatrix3 getRotation() { @@ -439,7 +441,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the local scale vector. - * + * * @return the scale */ public ReadOnlyVector3 getScale() { @@ -448,7 +450,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the local translation vector. - * + * * @return the translation */ public ReadOnlyVector3 getTranslation() { @@ -457,7 +459,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the local transform. - * + * * @return the transform */ public ReadOnlyTransform getTransform() { @@ -466,7 +468,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the local transform. - * + * * @param transform * the new transform */ @@ -477,7 +479,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world rotation matrix. - * + * * @param rotation * the new world rotation */ @@ -487,7 +489,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world rotation quaternion. - * + * * @param rotation * the new world rotation */ @@ -497,7 +499,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world scale. - * + * * @param scale * the new world scale vector */ @@ -507,7 +509,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world scale. - * + * * @param x * the x coordinate * @param y @@ -521,7 +523,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world scale. - * + * * @param scale * the new world scale */ @@ -531,7 +533,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world translation vector. - * + * * @param translation * the new world translation */ @@ -541,7 +543,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world translation. - * + * * @param x * the x coordinate * @param y @@ -555,7 +557,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world transform. - * + * * @param transform * the new world transform */ @@ -565,7 +567,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the rotation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param rotation * the new rotation of this spatial * @see Transform#setRotation(Matrix3) @@ -577,7 +579,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the rotation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param rotation * the new rotation of this spatial * @see Transform#setRotation(Quaternion) @@ -589,7 +591,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>setScale</code> sets the scale of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param scale * the new scale of this spatial */ @@ -600,7 +602,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>setScale</code> sets the scale of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param scale * the new scale of this spatial */ @@ -611,7 +613,7 @@ public abstract class Spatial implements Savable, Hintable { /** * sets the scale of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param x * the x scale factor * @param y @@ -626,7 +628,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>setTranslation</code> sets the translation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param translation * the new translation of this spatial */ @@ -637,7 +639,7 @@ public abstract class Spatial implements Savable, Hintable { /** * sets the translation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param x * the x coordinate * @param y @@ -653,7 +655,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>addTranslation</code> adds the given translation to the translation of this spatial. This marks the spatial * as DirtyType.Transform. - * + * * @param translation * the translation vector */ @@ -663,7 +665,7 @@ public abstract class Spatial implements Savable, Hintable { /** * adds to the current translation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param x * the x amount * @param y @@ -678,7 +680,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the world rotation matrix. - * + * * @return the world rotation */ public ReadOnlyMatrix3 getWorldRotation() { @@ -687,7 +689,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the world scale vector. - * + * * @return the world scale */ public ReadOnlyVector3 getWorldScale() { @@ -696,7 +698,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the world translation vector. - * + * * @return the world translation */ public ReadOnlyVector3 getWorldTranslation() { @@ -705,7 +707,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the world transform. - * + * * @return the world transform */ public ReadOnlyTransform getWorldTransform() { @@ -714,7 +716,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>getWorldBound</code> retrieves the world bound at this level. - * + * * @return the world bound at this level. */ public BoundingVolume getWorldBound() { @@ -726,7 +728,7 @@ public abstract class Spatial implements Savable, Hintable { * method is called. * <p> * This method is called by the renderer. Usually it should not be called directly. - * + * * @param r * the renderer used for display. */ @@ -761,7 +763,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>draw</code> abstract method that handles drawing data to the renderer if it is geometry and passing the * call to it's children if it is a node. - * + * * @param renderer * the renderer used for display. */ @@ -769,7 +771,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Grab the render delegate for this spatial based on the currently set RenderContext. - * + * * @return the delegate or null if a delegate was not found. */ protected RenderDelegate getCurrentRenderDelegate() { @@ -793,7 +795,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Update geometric state. - * + * * @param time * The time in seconds between the last two consecutive frames (time per frame). See * {@link ReadOnlyTimer#getTimePerFrame()} @@ -805,7 +807,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>updateGeometricState</code> updates all the geometry information for the node. - * + * * @param time * The time in seconds between the last two consecutive frames (time per frame). See * {@link ReadOnlyTimer#getTimePerFrame()} @@ -840,7 +842,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Override to allow objects like Node to update their children. - * + * * @param time * The time in seconds between the last two consecutive frames (time per frame). See * {@link ReadOnlyTimer#getTimePerFrame()} @@ -849,7 +851,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Update all controllers set on this spatial. - * + * * @param time * The time in seconds between the last two consecutive frames (time per frame). See * {@link ReadOnlyTimer#getTimePerFrame()} @@ -874,7 +876,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Updates the worldTransform. - * + * * @param recurse * usually false when updating the tree. Set to true when you just want to update the world transforms * for a branch without updating geometric state. @@ -890,7 +892,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Convert a vector (in) from this spatial's local coordinate space to world coordinate space. - * + * * @param in * vector to read from * @param store @@ -907,7 +909,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Convert a vector (in) from world coordinate space to this spatial's local coordinate space. - * + * * @param in * vector to read from * @param store @@ -925,7 +927,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Updates the render state values of this Spatial and and children it has. Should be called whenever render states * change. - * + * * @param recurse * true to recurse down the scenegraph tree */ @@ -935,7 +937,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Called internally. Updates the render states of this Spatial. The stack contains parent render states. - * + * * @param recurse * true to recurse down the scenegraph tree * @param stateStack @@ -966,7 +968,7 @@ public abstract class Spatial implements Savable, Hintable { /** * The method actually implements how the render states are applied to this spatial and (if recurse is true) any * children it may have. By default, this function does nothing. - * + * * @param recurse * true to recurse down the scenegraph tree * @param stack @@ -981,7 +983,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Retrieves the complete renderstate list. - * + * * @return the list of renderstates */ public EnumMap<StateType, RenderState> getLocalRenderStates() { @@ -992,7 +994,7 @@ public abstract class Spatial implements Savable, Hintable { * <code>setRenderState</code> sets a render state for this node. Note, there can only be one render state per type * per node. That is, there can only be a single BlendState a single TextureState, etc. If there is already a render * state for a type set the old render state will be returned. Otherwise, null is returned. - * + * * @param rs * the render state to add. * @return the old render state. @@ -1013,7 +1015,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the requested RenderState that this Spatial currently has set or null if none is set. - * + * * @param type * the state type to retrieve * @return a render state at the given position or null @@ -1024,7 +1026,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Clears a given render state index by setting it to null. - * + * * @param type * The type of RenderState to clear */ @@ -1036,7 +1038,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Called during updateRenderState(Stack[]), this function goes up the scene graph tree until the parent is null and * pushes RenderStates onto the states Stack array. - * + * * @param stack * The stack to push any parent states onto. */ @@ -1056,7 +1058,7 @@ public abstract class Spatial implements Savable, Hintable { * updates the bounding volume of the world. Abstract, geometry transforms the bound while node merges the * children's bound. In most cases, users will want to call updateModelBound() and let this function be called * automatically during updateGeometricState(). - * + * * @param recurse * true to recurse down the scenegraph tree */ @@ -1074,7 +1076,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the Spatial specific user data. - * + * * @return the user data */ public Object getUserData() { @@ -1083,7 +1085,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the Spatial specific user data. - * + * * @param userData * Some Spatial specific user data. Note: If this object is not explicitly of type Savable, it will be * ignored during read/write. @@ -1094,21 +1096,21 @@ public abstract class Spatial implements Savable, Hintable { /** * Adds a SpatialController to this Spatial's list of controllers. - * + * * @param controller * The SpatialController to add * @see com.ardor3d.scenegraph.controller.SpatialController */ public void addController(final SpatialController<?> controller) { if (_controllers == null) { - _controllers = new ArrayList<SpatialController<?>>(1); + _controllers = new ArrayList<>(1); } _controllers.add(controller); } /** * Removes a SpatialController from this Spatial's list of controllers, if it exist. - * + * * @param controller * The SpatialController to remove * @return True if the SpatialController was in the list to remove. @@ -1123,7 +1125,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Removes a SpatialController from this Spatial's list of controllers by index. - * + * * @param index * The index of the controller to remove * @return The SpatialController removed or null if nothing was removed. @@ -1138,7 +1140,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Removes all Controllers from this Spatial's list of controllers. - * + * * @see com.ardor3d.scenegraph.controller.SpatialController */ public void clearControllers() { @@ -1149,7 +1151,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the controller in this list of controllers at index i. - * + * * @param i * The index to get a controller from. * @return The controller at index i. @@ -1157,26 +1159,26 @@ public abstract class Spatial implements Savable, Hintable { */ public SpatialController<?> getController(final int i) { if (_controllers == null) { - _controllers = new ArrayList<SpatialController<?>>(1); + _controllers = new ArrayList<>(1); } return _controllers.get(i); } /** * Returns the ArrayList that contains this spatial's SpatialControllers. - * + * * @return This spatial's _controllers. */ public List<SpatialController<?>> getControllers() { if (_controllers == null) { - _controllers = new ArrayList<SpatialController<?>>(1); + _controllers = new ArrayList<>(1); } return _controllers; } /** * Gets the controller count. - * + * * @return the number of controllers set on this Spatial. */ public int getControllerCount() { @@ -1190,7 +1192,7 @@ public abstract class Spatial implements Savable, Hintable { * Returns this spatial's last frustum intersection result. This int is set when a check is made to determine if the * bounds of the object fall inside a camera's frustum. If a parent is found to fall outside the frustum, the value * for this spatial will not be updated. - * + * * @return The spatial's last frustum intersection result. */ public Camera.FrustumIntersect getLocalLastFrustumIntersection() { @@ -1200,7 +1202,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Tries to find the most accurate last frustum intersection for this spatial by checking the parent for possible * Outside value. - * + * * @return Outside, if this, or any ancestor was Outside, otherwise the local intersect value. */ public Camera.FrustumIntersect getLastFrustumIntersection() { @@ -1217,7 +1219,7 @@ public abstract class Spatial implements Savable, Hintable { * Overrides the last intersection result. This is useful for operations that want to start rendering at the middle * of a scene tree and don't want the parent of that node to influence culling. (See texture renderer code for * example.) - * + * * @param frustumIntersects * the new frustum intersection value */ @@ -1227,7 +1229,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Execute the given Visitor on this Spatial, and any Spatials managed by this Spatial as appropriate. - * + * * @param visitor * the Visitor object to use. * @param preexecute @@ -1241,7 +1243,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the Spatial's name followed by the class of the spatial <br> * Example: "MyNode (com.ardor3d.scene.Spatial) - * + * * @return Spatial's name followed by the class of the Spatial */ @Override @@ -1251,7 +1253,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Create a copy of this spatial. - * + * * @param shareGeometricData * if true, reuse any data fields describing the geometric shape of the spatial, as applicable. * @return the copy as described. @@ -1318,7 +1320,7 @@ public abstract class Spatial implements Savable, Hintable { * Creates and returns a new instance of this spatial. Used for instanced rendering. All instances visible on the * screen will be drawn in one draw call. The new instance will share all data (meshData and renderStates) with the * current mesh and all other instances created from this spatial. - * + * * @return an instanced copy of this node */ public Spatial makeInstanced() { @@ -1350,6 +1352,7 @@ public abstract class Spatial implements Savable, Hintable { /** * @see Savable#getClassTag() */ + @Override public Class<? extends Spatial> getClassTag() { return this.getClass(); } @@ -1361,6 +1364,7 @@ public abstract class Spatial implements Savable, Hintable { * Signals that an I/O exception has occurred. * @see Savable#read(InputCapsule) */ + @Override public void read(final InputCapsule capsule) throws IOException { _name = capsule.readString("name", null); @@ -1399,6 +1403,7 @@ public abstract class Spatial implements Savable, Hintable { * Signals that an I/O exception has occurred. * @see Savable#write(OutputCapsule) */ + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_name, "name", null); @@ -1412,7 +1417,7 @@ public abstract class Spatial implements Savable, Hintable { } if (_controllers != null) { - final List<Savable> list = new ArrayList<Savable>(); + final List<Savable> list = new ArrayList<>(); for (final SpatialController<?> sc : _controllers) { if (sc instanceof Savable) { list.add((Savable) sc); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/ComplexSpatialController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/ComplexSpatialController.java index 909a004..366e9f9 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/ComplexSpatialController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/ComplexSpatialController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -199,8 +199,10 @@ public abstract class ComplexSpatialController<T extends Spatial> implements Spa return RepeatType.CYCLE.equals(getRepeatType()); } + @Override public abstract void update(double time, T caller); + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_repeatType, "repeatType", RepeatType.CLAMP); capsule.write(_minTime, "minTime", 0); @@ -209,6 +211,7 @@ public abstract class ComplexSpatialController<T extends Spatial> implements Spa capsule.write(_active, "active", true); } + @Override public void read(final InputCapsule capsule) throws IOException { _repeatType = capsule.readEnum("repeatType", RepeatType.class, RepeatType.CLAMP); _minTime = capsule.readDouble("minTime", 0); @@ -217,6 +220,7 @@ public abstract class ComplexSpatialController<T extends Spatial> implements Spa _active = capsule.readBoolean("active", true); } + @Override @SuppressWarnings("rawtypes") public Class<? extends ComplexSpatialController> getClassTag() { return this.getClass(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/SpatialController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/SpatialController.java index 7a3881e..2c060f4 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/SpatialController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/SpatialController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveInterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveInterpolationController.java index cd04c05..e9758f3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveInterpolationController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveInterpolationController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveLookAtController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveLookAtController.java index ef322fc..2c1bf29 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveLookAtController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveLookAtController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/DefaultColorInterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/DefaultColorInterpolationController.java index d268600..7b8875c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/DefaultColorInterpolationController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/DefaultColorInterpolationController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java index 0baf1d5..c8b0658 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -23,7 +23,7 @@ import com.ardor3d.scenegraph.controller.ComplexSpatialController; * Implementation note: This class is comprised of quite a few protected methods, this is mainly to allow maximum * flexibility for overriding classes. * </p> - * + * * @param <C> * The control 'points' being interpolated, for example Vectors or Quaternions. * @param <T> @@ -54,7 +54,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp /** * This method is automatically called by {@link #update(double, Spatial)} from this controller. - * + * * @param from * The control to interpolate from. * @param to @@ -73,7 +73,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp * It will only update the given object if this controller is {@link #isActive() active}, caller isn't * <code>null</code> and it's {@link #getSpeed() speed} is greater than zero. * </p> - * + * * @param time * The passed since this controller was last called. * @param caller @@ -92,7 +92,8 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp clampIndex(); - assert (getIndex() < getControls().size()) : "_index was greater than the number of controls, clampIndex() has probably been overriden incorrectly"; + assert (getIndex() < getControls() + .size()) : "_index was greater than the number of controls, clampIndex() has probably been overriden incorrectly"; assert (getIndex() >= 0) : "_index was negative, clampIndex() has probably been overriden incorrectly"; interpolate(getControlFrom(), getControlTo(), getDelta(), caller); @@ -139,7 +140,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp * The new values to set, can not be <code>null</code> or size 0. * @see #getControls() */ - public void setControls(final C... controlArray) { + public void setControls(@SuppressWarnings("unchecked") final C... controlArray) { if (null == controlArray) { throw new IllegalArgumentException("controlArray can not be null!"); } @@ -153,14 +154,15 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp */ public List<C> getControls() { assert (null != _controls) : "_controls was null, it must be set before use!"; - assert (!_controls.isEmpty()) : "_controls was empty, it must contain at least 1 element for this class to work!"; + assert (!_controls + .isEmpty()) : "_controls was empty, it must contain at least 1 element for this class to work!"; return _controls; } /** * Updates the {@link #getDelta() delta} and {@link #getIndex() index}. - * + * * @param time * The raw time since this was last called. */ @@ -224,7 +226,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp /** * This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly. - * + * * @return The control to interpolate from, will not be <code>null</code>. * @see #getControlTo() */ @@ -254,7 +256,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp /** * This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly. - * + * * @return The control to interpolate to, will not be <code>null</code>. * @see #getControlFrom() */ @@ -288,7 +290,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp /** * Increments the index by 1. - * + * * @return The new index value as a convenience. */ protected int incrementIndex() { @@ -297,7 +299,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp /** * Decrements the index by 1. - * + * * @return The new index value as a convenience. */ protected int decrementIndex() { @@ -386,7 +388,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp /** * Also {@link #reset() resets} this controller for safety, because changing the repeat type part way through an * interpolation can cause problems. - * + * * @param repeatType * The new repeat type to use. */ diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/LinearVector3InterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/LinearVector3InterpolationController.java index 3784db9..60e0b6f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/LinearVector3InterpolationController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/LinearVector3InterpolationController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/QuaternionInterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/QuaternionInterpolationController.java index 06d6c82..fb9e5d5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/QuaternionInterpolationController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/QuaternionInterpolationController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/Vector3InterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/Vector3InterpolationController.java index 44ad32a..9740177 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/Vector3InterpolationController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/Vector3InterpolationController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyEventListener.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyEventListener.java index fdf5bd6..da56324 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyEventListener.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyEventListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyType.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyType.java index 2c81ad9..3aa1ea1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyType.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyType.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java index 3300c6d..8a08412 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -24,7 +24,7 @@ public class SceneGraphManager implements DirtyEventListener { private final List<DirtyEventListener> _listeners; private SceneGraphManager() { - _listeners = new ArrayList<DirtyEventListener>(); + _listeners = new ArrayList<>(); } public static SceneGraphManager getSceneGraphManager() { @@ -47,6 +47,7 @@ public class SceneGraphManager implements DirtyEventListener { _listeners.remove(listener); } + @Override public boolean spatialDirty(final Spatial spatial, final DirtyType dirtyType) { for (final DirtyEventListener listener : _listeners) { listener.spatialDirty(spatial, dirtyType); @@ -54,6 +55,7 @@ public class SceneGraphManager implements DirtyEventListener { return false; } + @Override public boolean spatialClean(final Spatial spatial, final DirtyType dirtyType) { for (final DirtyEventListener listener : _listeners) { listener.spatialClean(spatial, dirtyType); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/BillboardNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/BillboardNode.java index 4ce8c3d..7c29fc8 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/BillboardNode.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/BillboardNode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -235,6 +235,7 @@ public class BillboardNode extends Node { _left.setX(_left.getX() * invLength); _left.setY(0.0); _left.setZ(_left.getZ() * invLength); + _left.normalizeLocal(); // compute the local orientation matrix for the billboard _orient.setValue(0, 0, _left.getZ()); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/CameraNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/CameraNode.java index fb965b8..1181f25 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/CameraNode.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/CameraNode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java index 8d2377d..6a24957 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -24,7 +24,7 @@ import com.ardor3d.util.export.OutputCapsule; public class PassNode extends Node { - private List<PassNodeState> _passNodeStates = new ArrayList<PassNodeState>(); + private List<PassNodeState> _passNodeStates = new ArrayList<>(); public PassNode(final String name) { super(name); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java index c34d4f9..473a70b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -33,7 +33,7 @@ public class PassNodeState implements Savable, Serializable { * RenderStates registered with this pass - if a given state is not null it overrides the corresponding state set * during rendering. */ - protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<RenderState.StateType, RenderState>( + protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<>( RenderState.StateType.class); /** @@ -99,16 +99,19 @@ public class PassNodeState implements Savable, Serializable { _enabled = enabled; } + @Override public Class<? extends PassNodeState> getClassTag() { return this.getClass(); } + @Override public void write(final OutputCapsule capsule) throws IOException { final OutputCapsule oc = capsule; oc.write(_enabled, "enabled", true); oc.write(_passStates.values().toArray(new RenderState[0]), "passStates", null); } + @Override public void read(final InputCapsule capsule) throws IOException { final InputCapsule ic = capsule; _enabled = ic.readBoolean("enabled", true); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/QuadImposterNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/QuadImposterNode.java index 1500c5d..5ea9c5c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/QuadImposterNode.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/QuadImposterNode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/Skybox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/Skybox.java index c396e0b..3567b54 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/Skybox.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/Skybox.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/SwitchNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/SwitchNode.java index 34b3ff4..88bb6f6 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/SwitchNode.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/SwitchNode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/CullHint.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/CullHint.java index 74a9399..d391914 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/CullHint.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/CullHint.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/DataMode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/DataMode.java index ba4673d..c2ea681 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/DataMode.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/DataMode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/Hintable.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/Hintable.java index 0df2795..fd68b8a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/Hintable.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/Hintable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/NormalsMode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/NormalsMode.java index 84b6a9c..870dd38 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/NormalsMode.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/NormalsMode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/PickingHint.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/PickingHint.java index 54e4098..f07b844 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/PickingHint.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/PickingHint.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/SceneHints.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/SceneHints.java index 36a239c..a56d106 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/SceneHints.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/SceneHints.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -448,10 +448,12 @@ public class SceneHints implements Savable { // Methods for Savable // ///////////////// + @Override public Class<? extends SceneHints> getClassTag() { return this.getClass(); } + @Override public void read(final InputCapsule capsule) throws IOException { _orthoOrder = capsule.readInt("orthoOrder", 0); _cullHint = capsule.readEnum("cullMode", CullHint.class, CullHint.Inherit); @@ -478,6 +480,7 @@ public class SceneHints implements Savable { } } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_orthoOrder, "orthoOrder", 0); capsule.write(_cullHint, "cullMode", CullHint.Inherit); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/TransparencyType.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/TransparencyType.java index 71520a4..f92c1d4 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/TransparencyType.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/TransparencyType.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Arrow.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Arrow.java index e1e8e7d..0c48c7d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Arrow.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Arrow.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/AxisRods.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/AxisRods.java index 3d2914b..c717311 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/AxisRods.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/AxisRods.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Box.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Box.java index 11acbfd..c9a12aa 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Box.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Box.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -40,7 +40,7 @@ public class Box extends Mesh implements Cloneable { /** * Constructs a new 1x1x1 <code>Box</code> with the given name. - * + * * @param name * the name to give this new box. This is required for identification and comparison purposes. */ @@ -52,7 +52,7 @@ public class Box extends Mesh implements Cloneable { /** * Constructs a new <code>Box</code> object using the given two points as opposite corners of the box. These two * points may be in any order. - * + * * @param name * the name to give this new box. This is required for identification and comparison purposes. * @param pntA @@ -68,7 +68,7 @@ public class Box extends Mesh implements Cloneable { /** * Constructs a new <code>Box</code> object using the given center and extents. Since the extents represent the * distance from the center of the box to the edge, the full length of a side is actually 2 * extent. - * + * * @param name * the name to give this new box. This is required for identification and comparison purposes. * @param center @@ -117,7 +117,7 @@ public class Box extends Mesh implements Cloneable { /** * Updates the center point and extents of this box to match an axis-aligned box defined by the two given opposite * corners. - * + * * @param pntA * the first point * @param pntB @@ -134,7 +134,7 @@ public class Box extends Mesh implements Cloneable { /** * Updates the center point and extents of this box using the defined values. - * + * * @param center * The center of the box. * @param xExtent @@ -144,7 +144,8 @@ public class Box extends Mesh implements Cloneable { * @param zExtent * z extent of the box */ - public void setData(final ReadOnlyVector3 center, final double xExtent, final double yExtent, final double zExtent) { + public void setData(final ReadOnlyVector3 center, final double xExtent, final double yExtent, + final double zExtent) { if (center != null) { _center.set(center); } @@ -244,12 +245,13 @@ public class Box extends Mesh implements Cloneable { for (int i = 0; i < 4; i++) { _meshData.getNormalBuffer().put(0).put(-1).put(0); } + _meshData.getNormalBuffer().rewind(); } } /** * <code>setTextureData</code> sets the points that define the texture of the box. It's a one-to-one ratio, where - * each plane of the box has it's own copy of the texture. That is, the texture is repeated one time for each six + * each plane of the box has its own copy of the texture. That is, the texture is repeated one time for each six * faces. */ private void setTextureData() { @@ -263,6 +265,7 @@ public class Box extends Mesh implements Cloneable { tex.put(0).put(1); tex.put(1).put(1); } + tex.rewind(); } } @@ -283,7 +286,7 @@ public class Box extends Mesh implements Cloneable { /** * <code>clone</code> creates a new Box object containing the same data as this one. - * + * * @return the new Box */ @Override diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Capsule.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Capsule.java index 7dce5dd..ccffa38 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Capsule.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Capsule.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cone.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cone.java index 1e5b6c4..3db1709 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cone.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cone.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cylinder.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cylinder.java index fd56cb6..f29beec 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cylinder.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cylinder.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Disk.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Disk.java index 3ada7d3..bc03418 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Disk.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Disk.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dodecahedron.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dodecahedron.java index adf1ce5..7c65392 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dodecahedron.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dodecahedron.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dome.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dome.java index 121f33c..a7031de 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dome.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dome.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java index 6fb83ae..ea6e3ee 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -266,7 +266,7 @@ public class Extrusion extends Mesh { final double d[][] = new double[3][np]; // Newton form coefficients final double x[] = new double[np]; // x-coordinates of nodes - final List<ReadOnlyVector3> path = new ArrayList<ReadOnlyVector3>(); + final List<ReadOnlyVector3> path = new ArrayList<>(); for (int i = 0; i < np; i++) { ReadOnlyVector3 p; diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/GeoSphere.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/GeoSphere.java index eaa2580..d5b3be8 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/GeoSphere.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/GeoSphere.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Hexagon.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Hexagon.java index 5aaecc3..7082250 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Hexagon.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Hexagon.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Icosahedron.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Icosahedron.java index 4725e36..b399d03 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Icosahedron.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Icosahedron.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/MultiFaceBox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/MultiFaceBox.java index 4698562..473c71f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/MultiFaceBox.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/MultiFaceBox.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Octahedron.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Octahedron.java index b4e1785..7971281 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Octahedron.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Octahedron.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/OrientedBox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/OrientedBox.java index 6983a9c..82c485b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/OrientedBox.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/OrientedBox.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/PQTorus.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/PQTorus.java index f1380a0..4aa3af5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/PQTorus.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/PQTorus.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Pyramid.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Pyramid.java index 9a008f6..db75d76 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Pyramid.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Pyramid.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Quad.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Quad.java index e2036fd..84c7493 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Quad.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Quad.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/RoundedBox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/RoundedBox.java index 31b52d1..267cbfc 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/RoundedBox.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/RoundedBox.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Sphere.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Sphere.java index 46e1e18..8c9ff84 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Sphere.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Sphere.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/StripBox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/StripBox.java index 72bc15a..4d5f2c9 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/StripBox.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/StripBox.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Teapot.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Teapot.java index 06945f2..82057ad 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Teapot.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Teapot.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Torus.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Torus.java index 6f36c28..25d236e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Torus.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Torus.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Tube.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Tube.java index 898f9e9..b48bb4d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Tube.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Tube.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/DeleteVBOsVisitor.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/DeleteVBOsVisitor.java index 03c075a..d2b1500 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/DeleteVBOsVisitor.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/DeleteVBOsVisitor.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -22,6 +22,7 @@ public class DeleteVBOsVisitor implements Visitor { _deleter = deleter; } + @Override public void visit(final Spatial spatial) { if (spatial instanceof Mesh) { final Mesh mesh = (Mesh) spatial; diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/SetModelBoundVisitor.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/SetModelBoundVisitor.java index 9e809df..a6a263a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/SetModelBoundVisitor.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/SetModelBoundVisitor.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -21,6 +21,7 @@ public class SetModelBoundVisitor implements Visitor { _bound = bound; } + @Override public void visit(final Spatial spatial) { if (spatial instanceof Mesh) { ((Mesh) spatial).setModelBound(_bound.clone(null)); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/UpdateModelBoundVisitor.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/UpdateModelBoundVisitor.java index b313613..931b2d9 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/UpdateModelBoundVisitor.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/UpdateModelBoundVisitor.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -14,6 +14,7 @@ import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.Spatial; public class UpdateModelBoundVisitor implements Visitor { + @Override public void visit(final Spatial spatial) { if (spatial instanceof Mesh) { ((Mesh) spatial).updateModelBound(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/Visitor.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/Visitor.java index d861a5c..ea22b8e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/Visitor.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/Visitor.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java b/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java index df2fc6c..73e9784 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java +++ b/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -172,7 +172,7 @@ public class ArcLengthTable { throw new IllegalArgumentException("step must be > 0! step=" + step); } - _lookupTable = new HashMap<Integer, List<ArcLengthEntry>>(); + _lookupTable = new HashMap<>(); final Vector3 target = Vector3.fetchTempInstance(); final Vector3 previous = Vector3.fetchTempInstance(); @@ -187,7 +187,7 @@ public class ArcLengthTable { previous.set(_curve.getControlPoints().get(i)); - final ArrayList<ArcLengthEntry> entries = new ArrayList<ArcLengthEntry>(); + final ArrayList<ArcLengthEntry> entries = new ArrayList<>(); entries.add(new ArcLengthEntry(0f, 0)); final int endIndex = reverse ? startIndex - 1 : startIndex + 1; diff --git a/ardor3d-core/src/main/java/com/ardor3d/spline/CatmullRomSpline.java b/ardor3d-core/src/main/java/com/ardor3d/spline/CatmullRomSpline.java index 14ceb0c..020c89a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/spline/CatmullRomSpline.java +++ b/ardor3d-core/src/main/java/com/ardor3d/spline/CatmullRomSpline.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -32,6 +32,7 @@ public class CatmullRomSpline implements Spline { /** * @see #interpolate(ReadOnlyVector3, ReadOnlyVector3, ReadOnlyVector3, ReadOnlyVector3, double, Vector3) */ + @Override public Vector3 interpolate(final ReadOnlyVector3 p0, final ReadOnlyVector3 p1, final ReadOnlyVector3 p2, final ReadOnlyVector3 p3, final double t) { @@ -56,6 +57,7 @@ public class CatmullRomSpline implements Spline { * The results from the interpolation will be stored in this vector. * @return The result vector as a convenience. */ + @Override public Vector3 interpolate(final ReadOnlyVector3 p0, final ReadOnlyVector3 p1, final ReadOnlyVector3 p2, final ReadOnlyVector3 p3, final double t, final Vector3 result) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/spline/Curve.java b/ardor3d-core/src/main/java/com/ardor3d/spline/Curve.java index 07121a6..76b1c40 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/spline/Curve.java +++ b/ardor3d-core/src/main/java/com/ardor3d/spline/Curve.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/spline/Spline.java b/ardor3d-core/src/main/java/com/ardor3d/spline/Spline.java index 963b0c5..f7dcff0 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/spline/Spline.java +++ b/ardor3d-core/src/main/java/com/ardor3d/spline/Spline.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java index 9878f92..8aeda6a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java +++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -14,6 +14,7 @@ import java.io.IOException; import java.io.OutputStream; import java.net.MalformedURLException; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -42,8 +43,6 @@ import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; import com.ardor3d.util.resource.ResourceSource; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; /** * Loads a font generated by BMFont ({@link http://www.angelcode.com/products/bmfont/}). @@ -56,11 +55,11 @@ import com.google.common.collect.Maps; public class BMFont implements Savable { private static Logger logger = Logger.getLogger(BMFont.class.getName()); - private final Map<Integer, Char> _charMap = Maps.newHashMap(); - private final Map<Integer, Map<Integer, Integer>> _kernMap = Maps.newHashMap(); + private final Map<Integer, Char> _charMap = new HashMap<>(); + private final Map<Integer, Map<Integer, Integer>> _kernMap = new HashMap<>(); private String _styleName; // e.g. "Courier-12-bold" - private final List<Page> _pages = Lists.newArrayList(); + private final ArrayList<Page> _pages = new ArrayList<>(); private Texture _pageTexture; private RenderStateSetter _blendStateSetter = null; private RenderStateSetter _alphaStateSetter = null; @@ -430,7 +429,7 @@ public class BMFont implements Savable { } public List<Integer> getMappedChars() { - return Lists.newArrayList(_charMap.keySet()); + return new ArrayList<>(_charMap.keySet()); } public Map<Integer, Integer> getKerningsForCharacter(final int val) { @@ -562,7 +561,7 @@ public class BMFont implements Savable { Map<Integer, Integer> amtHash; amtHash = _kernMap.get(first); if (amtHash == null) { - amtHash = Maps.newHashMap(); + amtHash = new HashMap<>(); _kernMap.put(first, amtHash); } amtHash.put(second, amount); @@ -890,10 +889,10 @@ public class BMFont implements Savable { // Pages capsule.writeSavableList(_pages, "pages", _pages); // Chars - capsule.writeSavableList(new ArrayList<Char>(_charMap.values()), "charMap", null); + capsule.writeSavableList(new ArrayList<>(_charMap.values()), "charMap", null); // Kernings - final List<Kerning> kernings = new ArrayList<Kerning>(); + final List<Kerning> kernings = new ArrayList<>(); for (final Iterator<Integer> iterator = _kernMap.keySet().iterator(); iterator.hasNext();) { final Integer first = iterator.next(); final Map<Integer, Integer> amtHash = _kernMap.get(first); @@ -944,7 +943,7 @@ public class BMFont implements Savable { Map<Integer, Integer> amtHash; amtHash = _kernMap.get(k.first); if (amtHash == null) { - amtHash = Maps.newHashMap(); + amtHash = new HashMap<>(); _kernMap.put(k.first, amtHash); } amtHash.put(k.second, k.amount); diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFontManager.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFontManager.java index 9287193..3578eec 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFontManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFontManager.java @@ -25,7 +25,7 @@ public class BMFontManager { private static final BMFontManager INSTANCE = new BMFontManager(); - private final HashMap<String, BMFont> _loadedFonts = new HashMap<String, BMFont>(); + private final HashMap<String, BMFont> _loadedFonts = new HashMap<>(); public enum FontStyle { ArialMedium("arial-24-bold-regular"), // diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMText.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMText.java index b00cf26..b357e54 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMText.java +++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMText.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.ui.text; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; @@ -30,7 +31,6 @@ import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.hint.LightCombineMode; import com.ardor3d.scenegraph.hint.TextureCombineMode; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; /** * Text spatial which uses textures generated by BMFont @@ -55,7 +55,7 @@ public class BMText extends Mesh { protected ColorRGBA _textClr = new ColorRGBA(1, 1, 1, 1); protected ColorRGBA _tempClr = new ColorRGBA(1, 1, 1, 1); - final protected List<BMTextChangeListener> _listeners = Lists.newArrayList(); + final protected List<BMTextChangeListener> _listeners = new ArrayList<>(); public enum AutoScale { /** diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BasicText.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BasicText.java index 36c9e27..325f9ac 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BasicText.java +++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BasicText.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CopyPasteImpl.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/CopyPasteImpl.java index b059b98..e80b667 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CopyPasteImpl.java +++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/CopyPasteImpl.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -8,7 +8,7 @@ * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ -package com.ardor3d.extension.ui.text; +package com.ardor3d.ui.text; public interface CopyPasteImpl { String getClipBoardContents(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/NullCopyPasteImpl.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/NullCopyPasteImpl.java new file mode 100644 index 0000000..132671c --- /dev/null +++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/NullCopyPasteImpl.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.ui.text; + + +public class NullCopyPasteImpl implements CopyPasteImpl { + + @Override + public String getClipBoardContents() { + return null; + } + + @Override + public void setClipBoardContents(final String contents) {} + +} diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/Ardor3dException.java b/ardor3d-core/src/main/java/com/ardor3d/util/Ardor3dException.java index d851b96..50e20fd 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/Ardor3dException.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/Ardor3dException.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java b/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java index cc8a793..71210ac 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ContextGarbageCollector.java b/ardor3d-core/src/main/java/com/ardor3d/util/ContextGarbageCollector.java index 8ee7111..89d32ea 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/ContextGarbageCollector.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/ContextGarbageCollector.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java b/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java index 427b6cd..b613b1b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,19 +12,18 @@ package com.ardor3d.util; import java.lang.ref.PhantomReference; import java.lang.ref.ReferenceQueue; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; - -import com.google.common.collect.Lists; -import com.google.common.collect.MapMaker; +import java.util.WeakHashMap; public class ContextIdReference<T> extends PhantomReference<T> { /** * Keep a strong reference to these objects until their reference is cleared. */ - private static final List<ContextIdReference<?>> REFS = Lists.newLinkedList(); + private static final List<ContextIdReference<?>> REFS = new LinkedList<>(); private final Map<Object, Integer> _idCache; private Integer _singleContextId; @@ -32,7 +31,7 @@ public class ContextIdReference<T> extends PhantomReference<T> { public ContextIdReference(final T reference, final ReferenceQueue<? super T> queue) { super(reference, queue); if (Constants.useMultipleContexts) { - _idCache = new MapMaker().initialCapacity(2).weakKeys().makeMap(); + _idCache = new WeakHashMap<>(2); } else { _idCache = null; } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/DrawableCamera.java b/ardor3d-core/src/main/java/com/ardor3d/util/DrawableCamera.java index e4ca2a8..6c7101b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/DrawableCamera.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/DrawableCamera.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ExtendedCamera.java b/ardor3d-core/src/main/java/com/ardor3d/util/ExtendedCamera.java index 23833f2..41db466 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/ExtendedCamera.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/ExtendedCamera.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java b/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java index 6811d5c..46e4e4c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -42,6 +42,7 @@ public class GameTask<V> implements Future<V> { * @param mayInterruptIfRunning * ignored by this implementation. */ + @Override public boolean cancel(final boolean mayInterruptIfRunning) { _stateLock.lock(); try { @@ -58,6 +59,7 @@ public class GameTask<V> implements Future<V> { } } + @Override public V get() throws InterruptedException, ExecutionException { _stateLock.lock(); try { @@ -73,6 +75,7 @@ public class GameTask<V> implements Future<V> { } } + @Override public V get(final long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { _stateLock.lock(); @@ -92,6 +95,7 @@ public class GameTask<V> implements Future<V> { } } + @Override public boolean isCancelled() { _stateLock.lock(); try { @@ -101,6 +105,7 @@ public class GameTask<V> implements Future<V> { } } + @Override public boolean isDone() { _stateLock.lock(); try { diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java index 2a0e17c..130f6b1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -38,13 +38,13 @@ public class GameTaskQueue { public static final String RENDER = "render"; public static final String UPDATE = "update"; - private final ConcurrentLinkedQueue<GameTask<?>> _queue = new ConcurrentLinkedQueue<GameTask<?>>(); + private final ConcurrentLinkedQueue<GameTask<?>> _queue = new ConcurrentLinkedQueue<>(); private final AtomicBoolean _executeMultiple = new AtomicBoolean(); // Default execution time is 0, which means only 1 task will be executed at a time. private long _executionTime = 0; - private final List<ExecutionExceptionListener> _executionExceptionListeners = new LinkedList<ExecutionExceptionListener>(); + private final List<ExecutionExceptionListener> _executionExceptionListeners = new LinkedList<>(); public void addExecutionExceptionListener(final ExecutionExceptionListener l) { _executionExceptionListeners.add(l); @@ -111,7 +111,7 @@ public class GameTaskQueue { * @return */ public <V> Future<V> enqueue(final Callable<V> callable) { - final GameTask<V> task = new GameTask<V>(callable); + final GameTask<V> task = new GameTask<>(callable); _queue.add(task); return task; } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java index 4f57874..3000bd1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -25,7 +25,7 @@ public final class GameTaskQueueManager { private static final Object MAP_LOCK = new Object(); private static final ConcurrentMap<Object, GameTaskQueueManager> _managers = new MapMaker().weakKeys().makeMap(); - private final ConcurrentMap<String, GameTaskQueue> _managedQueues = new ConcurrentHashMap<String, GameTaskQueue>(2); + private final ConcurrentMap<String, GameTaskQueue> _managedQueues = new ConcurrentHashMap<>(2); public static GameTaskQueueManager getManager(final Object key) { synchronized (MAP_LOCK) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java index c3c8ec4..4f32a19 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -20,7 +20,7 @@ import java.io.InputStream; * LittleEndianDataInput is a class to read little-endian stored data via a InputStream. All functions work as defined * in DataInput, but assume they come from a LittleEndian input stream. */ -public class LittleEndianDataInput implements DataInput { +public class LittleEndianDataInput implements DataInput, AutoCloseable { private final BufferedInputStream _stream; @@ -33,7 +33,7 @@ public class LittleEndianDataInput implements DataInput { /** * Creates a new LittleEndian reader from the given input stream. The stream is wrapped in a BufferedInputStream * automatically. - * + * * @param in * The input stream to read from. */ @@ -41,6 +41,7 @@ public class LittleEndianDataInput implements DataInput { _stream = new BufferedInputStream(in); } + @Override public final int readUnsignedShort() throws IOException { return (_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8); } @@ -49,54 +50,65 @@ public class LittleEndianDataInput implements DataInput { * read an unsigned int as a long */ public final long readUnsignedInt() throws IOException { - return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16) | (((long) (_stream - .read() & 0xff)) << 24)); + return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16) + | (((long) (_stream.read() & 0xff)) << 24)); } + @Override public final boolean readBoolean() throws IOException { return (_stream.read() != 0); } + @Override public final byte readByte() throws IOException { return (byte) _stream.read(); } + @Override public final int readUnsignedByte() throws IOException { return _stream.read(); } + @Override public final short readShort() throws IOException { return (short) readUnsignedShort(); } + @Override public final char readChar() throws IOException { return (char) readUnsignedShort(); } + @Override public final int readInt() throws IOException { - return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16) | ((_stream - .read() & 0xff) << 24)); + return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16) + | ((_stream.read() & 0xff) << 24)); } + @Override public final long readLong() throws IOException { - return ((_stream.read() & 0xff) | ((long) (_stream.read() & 0xff) << 8) - | ((long) (_stream.read() & 0xff) << 16) | ((long) (_stream.read() & 0xff) << 24) - | ((long) (_stream.read() & 0xff) << 32) | ((long) (_stream.read() & 0xff) << 40) - | ((long) (_stream.read() & 0xff) << 48) | ((long) (_stream.read() & 0xff) << 56)); + return ((_stream.read() & 0xff) | ((long) (_stream.read() & 0xff) << 8) | ((long) (_stream.read() & 0xff) << 16) + | ((long) (_stream.read() & 0xff) << 24) | ((long) (_stream.read() & 0xff) << 32) + | ((long) (_stream.read() & 0xff) << 40) | ((long) (_stream.read() & 0xff) << 48) + | ((long) (_stream.read() & 0xff) << 56)); } + @Override public final float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); } + @Override public final double readDouble() throws IOException { return Double.longBitsToDouble(readLong()); } + @Override public final void readFully(final byte b[]) throws IOException { readFully(b, 0, b.length); } + @Override public final void readFully(final byte b[], final int off, final int len) throws IOException { // this may look over-complicated, but the problem is that the InputStream.read() methods are // not guaranteed to fill up the buffer you pass to it. So we need to loop until we have filled @@ -114,18 +126,22 @@ public class LittleEndianDataInput implements DataInput { } } + @Override public final int skipBytes(final int n) throws IOException { return (int) _stream.skip(n); } + @Override public final String readLine() throws IOException { throw new IOException("Unsupported operation"); } + @Override public final String readUTF() throws IOException { throw new IOException("Unsupported operation"); } + @Override public final void close() throws IOException { _stream.close(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianRandomAccessDataInput.java b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianRandomAccessDataInput.java index 33ced8f..a53312e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianRandomAccessDataInput.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianRandomAccessDataInput.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -59,6 +59,7 @@ public class LittleEndianRandomAccessDataInput implements DataInput { _contents = contents; } + @Override public final int readUnsignedShort() throws IOException { return (readByte() & 0xff) | ((readByte() & 0xff) << 8); } @@ -67,48 +68,59 @@ public class LittleEndianRandomAccessDataInput implements DataInput { return ((readByte() & 0xff) | ((readByte() & 0xff) << 8) | ((readByte() & 0xff) << 16) | (((long) (readByte() & 0xff)) << 24)); } + @Override public final boolean readBoolean() throws IOException { return (readByte() != 0); } + @Override public final byte readByte() throws IOException { return _contents.get(); } + @Override public final int readUnsignedByte() throws IOException { return readByte() & 0xff; } + @Override public final short readShort() throws IOException { return (short) readUnsignedShort(); } + @Override public final char readChar() throws IOException { return (char) readUnsignedShort(); } + @Override public final int readInt() throws IOException { return ((readByte() & 0xff) | ((readByte() & 0xff) << 8) | ((readByte() & 0xff) << 16) | ((readByte() & 0xff) << 24)); } + @Override public final long readLong() throws IOException { return ((readByte() & 0xff) | ((long) (readByte() & 0xff) << 8) | ((long) (readByte() & 0xff) << 16) | ((long) (readByte() & 0xff) << 24) | ((long) (readByte() & 0xff) << 32) | ((long) (readByte() & 0xff) << 40) | ((long) (readByte() & 0xff) << 48) | ((long) (readByte() & 0xff) << 56)); } + @Override public final float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); } + @Override public final double readDouble() throws IOException { return Double.longBitsToDouble(readLong()); } + @Override public final void readFully(final byte b[]) throws IOException { readFully(b, 0, b.length); } + @Override public final void readFully(final byte b[], final int off, final int len) throws IOException { if (len - off + _contents.position() > _contents.capacity()) { throw new EOFException("EOF reached"); @@ -117,6 +129,7 @@ public class LittleEndianRandomAccessDataInput implements DataInput { } } + @Override public final int skipBytes(final int n) throws IOException { if (_contents.remaining() >= n) { _contents.position(_contents.position() + n); @@ -155,6 +168,7 @@ public class LittleEndianRandomAccessDataInput implements DataInput { * @throws IOException * if this method is called. */ + @Override public final String readLine() throws IOException { throw new IOException("operation unsupported."); } @@ -165,6 +179,7 @@ public class LittleEndianRandomAccessDataInput implements DataInput { * @throws IOException * if this method is called. */ + @Override public final String readUTF() throws IOException { throw new IOException("operation unsupported."); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ReadOnlyTimer.java b/ardor3d-core/src/main/java/com/ardor3d/util/ReadOnlyTimer.java index 281add4..e5840f4 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/ReadOnlyTimer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/ReadOnlyTimer.java @@ -1,5 +1,5 @@ /** -/ * Copyright (c) 2008-2012 Ardor Labs, Inc. +/ * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java b/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java index 74adc79..f573051 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,16 +12,15 @@ package com.ardor3d.util; import java.lang.ref.PhantomReference; import java.lang.ref.ReferenceQueue; +import java.util.LinkedList; import java.util.List; -import com.google.common.collect.Lists; - public class SimpleContextIdReference<T> extends PhantomReference<T> { /** * Keep a string reference to these objects until their reference is cleared. */ - private static final List<SimpleContextIdReference<?>> REFS = Lists.newLinkedList(); + private static final List<SimpleContextIdReference<?>> REFS = new LinkedList<>(); private final int _id; private final Object _glContext; diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/SortUtil.java b/ardor3d-core/src/main/java/com/ardor3d/util/SortUtil.java index da15d1b..d669ea1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/SortUtil.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/SortUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java b/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java index a8b7bb9..ce08108 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,8 +12,11 @@ package com.ardor3d.util; import java.io.IOException; import java.lang.ref.WeakReference; +import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; @@ -26,7 +29,6 @@ import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; import com.ardor3d.util.resource.ResourceSource; -import com.google.common.collect.Lists; /** * <code>TextureKey</code> provides a way for the TextureManager to cache and retrieve <code>Texture</code> objects. @@ -66,14 +68,14 @@ final public class TextureKey implements Savable { private boolean _dirty; /** cache of OpenGL context specific texture ids for the associated texture. */ - protected final transient ContextIdReference<TextureKey> _idCache = new ContextIdReference<TextureKey>(this, + protected final transient ContextIdReference<TextureKey> _idCache = new ContextIdReference<>(this, TextureManager.getRefQueue()); /** cached hashcode value. */ protected transient int _code = Integer.MAX_VALUE; /** cache of texturekey objects allowing us to find an existing texture key. */ - protected static final List<WeakReference<TextureKey>> _keyCache = Lists.newLinkedList(); + protected static final List<WeakReference<TextureKey>> _keyCache = new LinkedList<>(); private static final Integer ZERO = new Integer(0); @@ -83,7 +85,7 @@ final public class TextureKey implements Savable { /** DO NOT USE. FOR INTERNAL USE ONLY */ protected TextureKey() { if (Constants.useMultipleContexts) { - _dirtyContexts = Lists.newArrayList(); + _dirtyContexts = new ArrayList<>(); } else { _dirtyContexts = null; } @@ -100,7 +102,7 @@ final public class TextureKey implements Savable { _dirtyContexts.clear(); // grab all contexts we currently have ids for and add them all as dirty for (final Object context : _idCache.getContextObjects()) { - final WeakReference<Object> ref = new WeakReference<Object>(context); + final WeakReference<Object> ref = new WeakReference<>(context); _dirtyContexts.add(ref); } } @@ -165,7 +167,7 @@ final public class TextureKey implements Savable { /** * Get a new unique TextureKey. This is meant for use by RTT and other situations where we know we are making a * unique texture. - * + * * @param minFilter * our minification filter value. * @return the new TextureKey @@ -215,7 +217,7 @@ final public class TextureKey implements Savable { } // not found - _keyCache.add(new WeakReference<TextureKey>(key)); + _keyCache.add(new WeakReference<>(key)); return key; } @@ -263,7 +265,7 @@ final public class TextureKey implements Savable { * Note: This does not remove the texture from the card and is provided for use by code that does remove textures * from the card. * </p> - * + * * @param glContext * the object representing the OpenGL context this texture belongs to. See * {@link RenderContext#getGlContextRep()} @@ -287,7 +289,7 @@ final public class TextureKey implements Savable { /** * Sets the id for a texture in regards to the given OpenGL context. - * + * * @param glContext * the object representing the OpenGL context a texture belongs to. See * {@link RenderContext#getGlContextRep()} @@ -346,13 +348,8 @@ final public class TextureKey implements Savable { @Override public int hashCode() { if (_code == Integer.MAX_VALUE) { - _code = 17; - - _code += 31 * _code + (_source != null ? _source.hashCode() : 0); - _code += 31 * _code + (_id != null ? _id.hashCode() : 0); - _code += 31 * _code + _minFilter.hashCode(); - _code += 31 * _code + _format.hashCode(); - _code += 31 * _code + (_flipped ? 1 : 0); + _code = Objects.hash(getSource(), getId(), getMinificationFilter(), getFormat(), + Boolean.valueOf(isFlipped())); } return _code; } @@ -394,10 +391,12 @@ final public class TextureKey implements Savable { // Methods for Savable // ///////////////// + @Override public Class<? extends TextureKey> getClassTag() { return this.getClass(); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_source, "source", null); capsule.write(_flipped, "flipped", false); @@ -406,6 +405,7 @@ final public class TextureKey implements Savable { capsule.write(_id, "id", null); } + @Override public void read(final InputCapsule capsule) throws IOException { _source = (ResourceSource) capsule.readSavable("source", null); _flipped = capsule.readBoolean("flipped", false); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java b/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java index 8a39852..d8c5315 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -46,10 +46,11 @@ final public class TextureManager { private static Map<TextureKey, Texture> _tCache = new MapMaker().weakKeys().weakValues().makeMap(); - private static ReferenceQueue<TextureKey> _textureRefQueue = new ReferenceQueue<TextureKey>(); + private static ReferenceQueue<TextureKey> _textureRefQueue = new ReferenceQueue<>(); static { ContextManager.addContextCleanListener(new ContextCleanListener() { + @Override public void cleanForContext(final RenderContext renderContext) { TextureManager.cleanAllTextures(null, renderContext, null); } @@ -438,9 +439,12 @@ final public class TextureManager { private static void handleTextureDelete(final Renderer deleter, final Multimap<Object, Integer> idMap, final Map<Object, Future<Void>> futureStore) { + if (deleter == null) { + return; + } Object currentGLRef = null; // Grab the current context, if any. - if (deleter != null && ContextManager.getCurrentContext() != null) { + if (ContextManager.getCurrentContext() != null) { currentGLRef = ContextManager.getCurrentContext().getGlContextRep(); } // For each affected context... @@ -453,6 +457,7 @@ final public class TextureManager { else { final Future<Void> future = GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)) .render(new RendererCallable<Void>() { + @Override public Void call() throws Exception { getRenderer().deleteTextureIds(idMap.get(glref)); return null; diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/Timer.java b/ardor3d-core/src/main/java/com/ardor3d/util/Timer.java index 4f99a60..1268066 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/Timer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/Timer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -27,22 +27,27 @@ public class Timer implements ReadOnlyTimer { _startTime = System.nanoTime(); } + @Override public double getTimeInSeconds() { return getTime() * INVERSE_TIMER_RESOLUTION; } + @Override public long getTime() { return System.nanoTime() - _startTime; } + @Override public long getResolution() { return TIMER_RESOLUTION; } + @Override public double getFrameRate() { return _fps; } + @Override public double getTimePerFrame() { return _tpf; } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java b/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java index d504892..7690b35 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassField.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassField.java index d76d5fa..c71b664 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassField.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassField.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassObject.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassObject.java index 06e2595..ad5c953 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassObject.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassObject.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryCloner.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryCloner.java index c2fbc08..c30e166 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryCloner.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryCloner.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java index 1c3359c..f8d1fc8 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -17,6 +17,7 @@ import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; +import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -28,8 +29,6 @@ import com.ardor3d.math.MathUtils; import com.ardor3d.util.export.Ardor3dExporter; import com.ardor3d.util.export.ByteUtils; import com.ardor3d.util.export.Savable; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; /** * Exports to the ardor3d Binary Format. Format descriptor: (each numbered item denotes a series of bytes that follows @@ -124,14 +123,14 @@ public class BinaryExporter implements Ardor3dExporter { protected int _aliasCount = 1; protected int _idCount = 1; - protected final Map<Savable, BinaryIdContentPair> _contentTable = Maps.newIdentityHashMap(); + protected final Map<Savable, BinaryIdContentPair> _contentTable = new IdentityHashMap<>(); - protected final Map<Integer, Integer> _locationTable = Maps.newHashMap(); + protected final Map<Integer, Integer> _locationTable = new HashMap<>(); // key - class name, value = bco - protected final Map<String, BinaryClassObject> _classes = Maps.newHashMap(); + protected final Map<String, BinaryClassObject> _classes = new HashMap<>(); - protected final List<Savable> _contentKeys = Lists.newArrayList(); + protected final List<Savable> _contentKeys = new ArrayList<>(); public BinaryExporter() { this(DEFAULT_COMPRESSION); @@ -139,7 +138,7 @@ public class BinaryExporter implements Ardor3dExporter { /** * Construct a new exporter, specifying some options. - * + * * @param compression * the compression type to use. One of the constants from {@link java.util.zip.Deflater} */ @@ -147,6 +146,7 @@ public class BinaryExporter implements Ardor3dExporter { _compression = compression; } + @Override public void save(final Savable object, final OutputStream os) throws IOException { try { GZIPOutputStream zos = new GZIPOutputStream(os) { @@ -196,8 +196,7 @@ public class BinaryExporter implements Ardor3dExporter { // write out data to a seperate stream int location = 0; // keep track of location for each piece - final HashMap<String, List<BinaryIdContentPair>> alreadySaved = new HashMap<String, List<BinaryIdContentPair>>( - _contentTable.size()); + final HashMap<String, List<BinaryIdContentPair>> alreadySaved = new HashMap<>(_contentTable.size()); for (final Savable savable : _contentKeys) { // look back at previous written data for matches final String savableName = savable.getClassTag().getName(); @@ -211,7 +210,7 @@ public class BinaryExporter implements Ardor3dExporter { _locationTable.put(pair.getId(), location); if (bucket == null) { - bucket = new ArrayList<BinaryIdContentPair>(); + bucket = new ArrayList<>(); alreadySaved.put(savableName + getChunk(pair), bucket); } bucket.add(pair); @@ -297,15 +296,16 @@ public class BinaryExporter implements Ardor3dExporter { return bytes; } + @Override public void save(final Savable object, final File file) throws IOException { final File parentDirectory = file.getParentFile(); if (parentDirectory != null && !parentDirectory.exists()) { parentDirectory.mkdirs(); } - final FileOutputStream fos = new FileOutputStream(file); - save(object, fos); - fos.close(); + try (final FileOutputStream fos = new FileOutputStream(file)) { + save(object, fos); + } } public int processBinarySavable(final Savable object) throws IOException { @@ -317,7 +317,7 @@ public class BinaryExporter implements Ardor3dExporter { if (bco == null) { bco = new BinaryClassObject(); bco._alias = generateTag(); - bco._nameFields = new HashMap<String, BinaryClassField>(); + bco._nameFields = new HashMap<>(); _classes.put(object.getClassTag().getName(), bco); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryIdContentPair.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryIdContentPair.java index 228f314..f82bf23 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryIdContentPair.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryIdContentPair.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java index 6e2c847..f77c220 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -19,6 +19,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.HashMap; +import java.util.IdentityHashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -31,25 +32,25 @@ import com.ardor3d.util.export.Ardor3dImporter; import com.ardor3d.util.export.ByteUtils; import com.ardor3d.util.export.ReadListener; import com.ardor3d.util.export.Savable; -import com.google.common.collect.Maps; public class BinaryImporter implements Ardor3dImporter { private static final Logger logger = Logger.getLogger(BinaryImporter.class.getName()); // Key - alias, object - bco - protected final Map<String, BinaryClassObject> _classes = Maps.newHashMap(); + protected final Map<String, BinaryClassObject> _classes = new HashMap<>(); // Key - id, object - the savable - protected final Map<Integer, Savable> _contentTable = Maps.newHashMap(); + protected final Map<Integer, Savable> _contentTable = new HashMap<>(); // Key - savable, object - capsule - protected final Map<Savable, BinaryInputCapsule> _capsuleTable = Maps.newIdentityHashMap(); + protected final Map<Savable, BinaryInputCapsule> _capsuleTable = new IdentityHashMap<>(); // Key - id, opject - location in the file - protected final Map<Integer, Integer> _locationTable = Maps.newHashMap(); + protected final Map<Integer, Integer> _locationTable = new HashMap<>(); protected byte[] _dataArray = null; protected int _aliasWidth = 0; public BinaryImporter() {} + @Override public Savable load(final InputStream is) throws IOException { return load(is, null, null); } @@ -78,8 +79,8 @@ public class BinaryImporter implements Ardor3dImporter { final int fields = ByteUtils.readInt(bis); bytes += (8 + _aliasWidth + classLength); - bco._nameFields = new HashMap<String, BinaryClassField>(fields); - bco._aliasFields = new HashMap<Byte, BinaryClassField>(fields); + bco._nameFields = new HashMap<>(fields); + bco._aliasFields = new HashMap<>(fields); for (int x = 0; x < fields; x++) { final byte fieldAlias = (byte) bis.read(); final byte fieldType = (byte) bis.read(); @@ -155,33 +156,36 @@ public class BinaryImporter implements Ardor3dImporter { } } + @Override public Savable load(final URL url) throws IOException { return load(url, null); } public Savable load(final URL url, final ReadListener listener) throws IOException { - final InputStream is = url.openStream(); - final Savable rVal = load(is, listener); - is.close(); - return rVal; + try (final InputStream is = url.openStream()) { + final Savable rVal = load(is, listener); + return rVal; + } } + @Override public Savable load(final File file) throws IOException { return load(file, null); } public Savable load(final File file, final ReadListener listener) throws IOException { - final FileInputStream fis = new FileInputStream(file); - final Savable rVal = load(fis, listener); - fis.close(); - return rVal; + try (final FileInputStream fis = new FileInputStream(file)) { + final Savable rVal = load(fis, listener); + return rVal; + } } + @Override public Savable load(final byte[] data) throws IOException { - final ByteArrayInputStream bais = new ByteArrayInputStream(data); - final Savable rVal = load(bais); - bais.close(); - return rVal; + try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) { + final Savable rVal = load(bais); + return rVal; + } } protected String readString(final InputStream is, final int length) throws IOException { @@ -214,8 +218,8 @@ public class BinaryImporter implements Ardor3dImporter { final BinaryClassObject bco = _classes.get(alias); if (bco == null) { - logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int id)", "NULL class object: " - + alias); + logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int id)", + "NULL class object: " + alias); return null; } @@ -240,18 +244,14 @@ public class BinaryImporter implements Ardor3dImporter { } catch (final InstantiationException e) { logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int)", "Could not access constructor of class '" + bco._className + "'! \n" - + "Some types may require the annotation SavableFactory. Please double check.", e); + + "Some types may require the annotation SavableFactory. Please double check.", + e); throw new Ardor3dException(e); } catch (final NoSuchMethodException e) { - logger - .logp( - Level.SEVERE, - this.getClass().toString(), - "readObject(int)", - e.getMessage() - + " \n" - + "Method specified in annotation does not appear to exist or has an invalid method signature.", - e); + logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int)", + e.getMessage() + " \n" + + "Method specified in annotation does not appear to exist or has an invalid method signature.", + e); throw new Ardor3dException(e); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java index ade60ff..7580c62 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -46,7 +46,7 @@ public class BinaryInputCapsule implements InputCapsule { } public void setContent(final byte[] content, final int start, final int limit) { - _fieldData = new HashMap<Byte, Object>(); + _fieldData = new HashMap<>(); for (_index = start; _index < limit;) { final byte alias = content[_index]; @@ -227,6 +227,7 @@ public class BinaryInputCapsule implements InputCapsule { } } + @Override public BitSet readBitSet(final String name, final BitSet defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -235,6 +236,7 @@ public class BinaryInputCapsule implements InputCapsule { return (BitSet) _fieldData.get(field._alias); } + @Override public boolean readBoolean(final String name, final boolean defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -243,6 +245,7 @@ public class BinaryInputCapsule implements InputCapsule { return ((Boolean) _fieldData.get(field._alias)).booleanValue(); } + @Override public boolean[] readBooleanArray(final String name, final boolean[] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -251,6 +254,7 @@ public class BinaryInputCapsule implements InputCapsule { return (boolean[]) _fieldData.get(field._alias); } + @Override public boolean[][] readBooleanArray2D(final String name, final boolean[][] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -259,6 +263,7 @@ public class BinaryInputCapsule implements InputCapsule { return (boolean[][]) _fieldData.get(field._alias); } + @Override public byte readByte(final String name, final byte defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -267,6 +272,7 @@ public class BinaryInputCapsule implements InputCapsule { return ((Byte) _fieldData.get(field._alias)).byteValue(); } + @Override public byte[] readByteArray(final String name, final byte[] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -275,6 +281,7 @@ public class BinaryInputCapsule implements InputCapsule { return (byte[]) _fieldData.get(field._alias); } + @Override public byte[][] readByteArray2D(final String name, final byte[][] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -283,6 +290,7 @@ public class BinaryInputCapsule implements InputCapsule { return (byte[][]) _fieldData.get(field._alias); } + @Override public ByteBuffer readByteBuffer(final String name, final ByteBuffer defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -291,6 +299,7 @@ public class BinaryInputCapsule implements InputCapsule { return (ByteBuffer) _fieldData.get(field._alias); } + @Override @SuppressWarnings("unchecked") public List<ByteBuffer> readByteBufferList(final String name, final List<ByteBuffer> defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); @@ -300,6 +309,7 @@ public class BinaryInputCapsule implements InputCapsule { return (List<ByteBuffer>) _fieldData.get(field._alias); } + @Override public double readDouble(final String name, final double defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -308,6 +318,7 @@ public class BinaryInputCapsule implements InputCapsule { return ((Double) _fieldData.get(field._alias)).doubleValue(); } + @Override public double[] readDoubleArray(final String name, final double[] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -316,6 +327,7 @@ public class BinaryInputCapsule implements InputCapsule { return (double[]) _fieldData.get(field._alias); } + @Override public double[][] readDoubleArray2D(final String name, final double[][] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -324,6 +336,7 @@ public class BinaryInputCapsule implements InputCapsule { return (double[][]) _fieldData.get(field._alias); } + @Override public float readFloat(final String name, final float defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -332,6 +345,7 @@ public class BinaryInputCapsule implements InputCapsule { return ((Float) _fieldData.get(field._alias)).floatValue(); } + @Override public float[] readFloatArray(final String name, final float[] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -340,6 +354,7 @@ public class BinaryInputCapsule implements InputCapsule { return (float[]) _fieldData.get(field._alias); } + @Override public float[][] readFloatArray2D(final String name, final float[][] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -348,6 +363,7 @@ public class BinaryInputCapsule implements InputCapsule { return (float[][]) _fieldData.get(field._alias); } + @Override public FloatBuffer readFloatBuffer(final String name, final FloatBuffer defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -356,6 +372,7 @@ public class BinaryInputCapsule implements InputCapsule { return (FloatBuffer) _fieldData.get(field._alias); } + @Override @SuppressWarnings("unchecked") public List<FloatBuffer> readFloatBufferList(final String name, final List<FloatBuffer> defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); @@ -365,6 +382,7 @@ public class BinaryInputCapsule implements InputCapsule { return (List<FloatBuffer>) _fieldData.get(field._alias); } + @Override public int readInt(final String name, final int defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -373,6 +391,7 @@ public class BinaryInputCapsule implements InputCapsule { return ((Integer) _fieldData.get(field._alias)).intValue(); } + @Override public int[] readIntArray(final String name, final int[] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -381,6 +400,7 @@ public class BinaryInputCapsule implements InputCapsule { return (int[]) _fieldData.get(field._alias); } + @Override public int[][] readIntArray2D(final String name, final int[][] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -389,6 +409,7 @@ public class BinaryInputCapsule implements InputCapsule { return (int[][]) _fieldData.get(field._alias); } + @Override public IntBuffer readIntBuffer(final String name, final IntBuffer defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -397,6 +418,7 @@ public class BinaryInputCapsule implements InputCapsule { return (IntBuffer) _fieldData.get(field._alias); } + @Override public long readLong(final String name, final long defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -405,6 +427,7 @@ public class BinaryInputCapsule implements InputCapsule { return ((Long) _fieldData.get(field._alias)).longValue(); } + @Override public long[] readLongArray(final String name, final long[] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -413,6 +436,7 @@ public class BinaryInputCapsule implements InputCapsule { return (long[]) _fieldData.get(field._alias); } + @Override public long[][] readLongArray2D(final String name, final long[][] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -421,6 +445,7 @@ public class BinaryInputCapsule implements InputCapsule { return (long[][]) _fieldData.get(field._alias); } + @Override public Savable readSavable(final String name, final Savable defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -438,6 +463,7 @@ public class BinaryInputCapsule implements InputCapsule { } } + @Override public Savable[] readSavableArray(final String name, final Savable[] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -466,6 +492,7 @@ public class BinaryInputCapsule implements InputCapsule { } } + @Override public Savable[][] readSavableArray2D(final String name, final Savable[][] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -516,7 +543,7 @@ public class BinaryInputCapsule implements InputCapsule { if (savables == null) { return null; } - final List<Savable> list = new ArrayList<Savable>(savables.length); + final List<Savable> list = new ArrayList<>(savables.length); for (int x = 0; x < savables.length; x++) { list.add(savables[x]); } @@ -528,7 +555,7 @@ public class BinaryInputCapsule implements InputCapsule { if (savables == null) { return null; } - final Map<Savable, Savable> map = new HashMap<Savable, Savable>(savables.length); + final Map<Savable, Savable> map = new HashMap<>(savables.length); for (int x = 0; x < savables.length; x++) { map.put(savables[x][0], savables[x][1]); } @@ -540,7 +567,7 @@ public class BinaryInputCapsule implements InputCapsule { return null; } - final Map<String, Savable> map = new HashMap<String, Savable>(keys.length); + final Map<String, Savable> map = new HashMap<>(keys.length); for (int x = 0; x < keys.length; x++) { map.put(keys[x], values[x]); } @@ -548,6 +575,7 @@ public class BinaryInputCapsule implements InputCapsule { return map; } + @Override @SuppressWarnings("unchecked") public <E extends Savable> List<E> readSavableList(final String name, final List<E> defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); @@ -564,6 +592,7 @@ public class BinaryInputCapsule implements InputCapsule { return (List<E>) value; } + @Override @SuppressWarnings("unchecked") public <E extends Savable> List<E>[] readSavableListArray(final String name, final List<E>[] defVal) throws IOException { @@ -589,6 +618,7 @@ public class BinaryInputCapsule implements InputCapsule { return (List<E>[]) value; } + @Override @SuppressWarnings("unchecked") public <E extends Savable> List<E>[][] readSavableListArray2D(final String name, final List<E>[][] defVal) throws IOException { @@ -617,6 +647,7 @@ public class BinaryInputCapsule implements InputCapsule { return (List<E>[][]) value; } + @Override @SuppressWarnings("unchecked") public <K extends Savable, V extends Savable> Map<K, V> readSavableMap(final String name, final Map<K, V> defVal) throws IOException { @@ -634,6 +665,7 @@ public class BinaryInputCapsule implements InputCapsule { return (Map<K, V>) value; } + @Override @SuppressWarnings("unchecked") public <V extends Savable> Map<String, V> readStringSavableMap(final String name, final Map<String, V> defVal) throws IOException { @@ -652,6 +684,7 @@ public class BinaryInputCapsule implements InputCapsule { return (Map<String, V>) value; } + @Override public short readShort(final String name, final short defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -660,6 +693,7 @@ public class BinaryInputCapsule implements InputCapsule { return ((Short) _fieldData.get(field._alias)).shortValue(); } + @Override public short[] readShortArray(final String name, final short[] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -668,6 +702,7 @@ public class BinaryInputCapsule implements InputCapsule { return (short[]) _fieldData.get(field._alias); } + @Override public short[][] readShortArray2D(final String name, final short[][] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -676,6 +711,7 @@ public class BinaryInputCapsule implements InputCapsule { return (short[][]) _fieldData.get(field._alias); } + @Override public ShortBuffer readShortBuffer(final String name, final ShortBuffer defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -684,6 +720,7 @@ public class BinaryInputCapsule implements InputCapsule { return (ShortBuffer) _fieldData.get(field._alias); } + @Override public String readString(final String name, final String defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -692,6 +729,7 @@ public class BinaryInputCapsule implements InputCapsule { return (String) _fieldData.get(field._alias); } + @Override public String[] readStringArray(final String name, final String[] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -700,6 +738,7 @@ public class BinaryInputCapsule implements InputCapsule { return (String[]) _fieldData.get(field._alias); } + @Override public String[][] readStringArray2D(final String name, final String[][] defVal) throws IOException { final BinaryClassField field = _cObj._nameFields.get(name); if (field == null || !_fieldData.containsKey(field._alias)) { @@ -1200,7 +1239,7 @@ public class BinaryInputCapsule implements InputCapsule { if (length == BinaryOutputCapsule.NULL_OBJECT) { return null; } - final List<FloatBuffer> rVal = new ArrayList<FloatBuffer>(length); + final List<FloatBuffer> rVal = new ArrayList<>(length); for (int x = 0; x < length; x++) { rVal.add(readFloatBuffer(content)); } @@ -1214,7 +1253,7 @@ public class BinaryInputCapsule implements InputCapsule { if (length == BinaryOutputCapsule.NULL_OBJECT) { return null; } - final List<ByteBuffer> rVal = new ArrayList<ByteBuffer>(length); + final List<ByteBuffer> rVal = new ArrayList<>(length); for (int x = 0; x < length; x++) { rVal.add(readByteBuffer(content)); } @@ -1389,6 +1428,7 @@ public class BinaryInputCapsule implements InputCapsule { public ID[] values; } + @Override public <T extends Enum<T>> T readEnum(final String name, final Class<T> enumType, final T defVal) throws IOException { final String eVal = readString(name, defVal != null ? defVal.name() : null); @@ -1399,6 +1439,7 @@ public class BinaryInputCapsule implements InputCapsule { } } + @Override @SuppressWarnings("unchecked") public <T extends Enum<T>> T[] readEnumArray(final String name, final Class<T> enumType, final T[] defVal) throws IOException { diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java index 82a14dd..0eecb51 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -53,6 +53,7 @@ public class BinaryOutputCapsule implements OutputCapsule { _forceDirectNioBuffers = forceDirectNioBuffers; } + @Override public void write(final byte value, final String name, final byte defVal) throws IOException { if (value == defVal) { return; @@ -61,6 +62,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final byte[] value, final String name, final byte[] defVal) throws IOException { if (value == defVal) { return; @@ -69,6 +71,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final byte[][] value, final String name, final byte[][] defVal) throws IOException { if (value == defVal) { return; @@ -77,6 +80,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final int value, final String name, final int defVal) throws IOException { if (value == defVal) { return; @@ -85,6 +89,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final int[] value, final String name, final int[] defVal) throws IOException { if (value == defVal) { return; @@ -93,6 +98,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final int[][] value, final String name, final int[][] defVal) throws IOException { if (value == defVal) { return; @@ -101,6 +107,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final float value, final String name, final float defVal) throws IOException { if (value == defVal) { return; @@ -109,6 +116,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final float[] value, final String name, final float[] defVal) throws IOException { if (value == defVal) { return; @@ -117,6 +125,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final float[][] value, final String name, final float[][] defVal) throws IOException { if (value == defVal) { return; @@ -125,6 +134,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final double value, final String name, final double defVal) throws IOException { if (value == defVal) { return; @@ -133,6 +143,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final double[] value, final String name, final double[] defVal) throws IOException { if (value == defVal) { return; @@ -141,6 +152,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final double[][] value, final String name, final double[][] defVal) throws IOException { if (value == defVal) { return; @@ -149,6 +161,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final long value, final String name, final long defVal) throws IOException { if (value == defVal) { return; @@ -157,6 +170,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final long[] value, final String name, final long[] defVal) throws IOException { if (value == defVal) { return; @@ -165,6 +179,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final long[][] value, final String name, final long[][] defVal) throws IOException { if (value == defVal) { return; @@ -173,6 +188,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final short value, final String name, final short defVal) throws IOException { if (value == defVal) { return; @@ -181,6 +197,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final short[] value, final String name, final short[] defVal) throws IOException { if (value == defVal) { return; @@ -189,6 +206,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final short[][] value, final String name, final short[][] defVal) throws IOException { if (value == defVal) { return; @@ -197,6 +215,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final boolean value, final String name, final boolean defVal) throws IOException { if (value == defVal) { return; @@ -205,6 +224,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final boolean[] value, final String name, final boolean[] defVal) throws IOException { if (value == defVal) { return; @@ -213,6 +233,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final boolean[][] value, final String name, final boolean[][] defVal) throws IOException { if (value == defVal) { return; @@ -221,6 +242,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final String value, final String name, final String defVal) throws IOException { if (value == null ? defVal == null : value.equals(defVal)) { return; @@ -229,6 +251,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final String[] value, final String name, final String[] defVal) throws IOException { if (value == defVal) { return; @@ -237,6 +260,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final String[][] value, final String name, final String[][] defVal) throws IOException { if (value == defVal) { return; @@ -245,6 +269,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final BitSet value, final String name, final BitSet defVal) throws IOException { if (value == defVal) { return; @@ -253,6 +278,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final Savable object, final String name, final Savable defVal) throws IOException { if (object == defVal) { return; @@ -261,6 +287,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(object); } + @Override public void write(final Savable[] objects, final String name, final Savable[] defVal) throws IOException { if (objects == defVal) { return; @@ -269,6 +296,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(objects); } + @Override public void write(final Savable[][] objects, final String name, final Savable[][] defVal) throws IOException { if (objects == defVal) { return; @@ -277,6 +305,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(objects); } + @Override public void write(final FloatBuffer value, final String name, final FloatBuffer defVal) throws IOException { if (value == defVal) { return; @@ -285,6 +314,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final IntBuffer value, final String name, final IntBuffer defVal) throws IOException { if (value == defVal) { return; @@ -293,6 +323,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final ByteBuffer value, final String name, final ByteBuffer defVal) throws IOException { if (value == defVal) { return; @@ -301,6 +332,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void write(final ShortBuffer value, final String name, final ShortBuffer defVal) throws IOException { if (value == defVal) { return; @@ -309,6 +341,7 @@ public class BinaryOutputCapsule implements OutputCapsule { write(value); } + @Override public void writeFloatBufferList(final List<FloatBuffer> array, final String name, final List<FloatBuffer> defVal) throws IOException { if (array == defVal) { @@ -318,6 +351,7 @@ public class BinaryOutputCapsule implements OutputCapsule { writeFloatBufferArrayList(array); } + @Override public void writeByteBufferList(final List<ByteBuffer> array, final String name, final List<ByteBuffer> defVal) throws IOException { if (array == defVal) { @@ -327,6 +361,7 @@ public class BinaryOutputCapsule implements OutputCapsule { writeByteBufferArrayList(array); } + @Override public void writeSavableList(final List<? extends Savable> array, final String name, final List<? extends Savable> defVal) throws IOException { if (array == defVal) { @@ -336,6 +371,7 @@ public class BinaryOutputCapsule implements OutputCapsule { writeSavableArrayList(array); } + @Override public void writeSavableListArray(final List<? extends Savable>[] array, final String name, final List<? extends Savable>[] defVal) throws IOException { if (array == defVal) { @@ -345,6 +381,7 @@ public class BinaryOutputCapsule implements OutputCapsule { writeSavableArrayListArray(array); } + @Override public void writeSavableListArray2D(final List<? extends Savable>[][] array, final String name, final List<? extends Savable>[][] defVal) throws IOException { if (array == defVal) { @@ -354,6 +391,7 @@ public class BinaryOutputCapsule implements OutputCapsule { writeSavableArrayListArray2D(array); } + @Override public void writeSavableMap(final Map<? extends Savable, ? extends Savable> map, final String name, final Map<? extends Savable, ? extends Savable> defVal) throws IOException { if (map == defVal) { @@ -363,6 +401,7 @@ public class BinaryOutputCapsule implements OutputCapsule { writeSavableMap(map); } + @Override public void writeStringSavableMap(final Map<String, ? extends Savable> map, final String name, final Map<String, ? extends Savable> defVal) throws IOException { if (map == defVal) { @@ -402,6 +441,11 @@ public class BinaryOutputCapsule implements OutputCapsule { return Arrays.equals(_bytes, other); } + @Override + public int hashCode() { + return Arrays.hashCode(_bytes); + } + public void finish() { // renamed to finish as 'finalize' in java.lang.Object should not be // overridden like this @@ -987,6 +1031,7 @@ public class BinaryOutputCapsule implements OutputCapsule { _baos.write(array); } + @Override public void write(final Enum<?> value, final String name, final Enum<?> defVal) throws IOException { if (value == defVal) { return; @@ -998,6 +1043,7 @@ public class BinaryOutputCapsule implements OutputCapsule { } } + @Override public void write(final Enum<?>[] value, final String name) throws IOException { if (value == null) { write(NULL_OBJECT); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java index 00babb9..0cbeea8 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -39,7 +39,6 @@ import com.ardor3d.util.TextureManager; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.Savable; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; /** * Part of the ardor3d XML IO system @@ -49,7 +48,7 @@ public class DOMInputCapsule implements InputCapsule { private final Document _doc; private Element _currentElem; private boolean _isAtRoot = true; - private final Map<String, Savable> _referencedSavables = new HashMap<String, Savable>(); + private final Map<String, Savable> _referencedSavables = new HashMap<>(); public DOMInputCapsule(final Document doc) { _doc = doc; @@ -94,6 +93,7 @@ public class DOMInputCapsule implements InputCapsule { return null; } + @Override public byte readByte(final String name, final byte defVal) throws IOException { byte ret = defVal; try { @@ -106,6 +106,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public byte[] readByteArray(final String name, final byte[] defVal) throws IOException { byte[] ret = defVal; try { @@ -133,6 +134,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public byte[][] readByteArray2D(final String name, final byte[][] defVal) throws IOException { byte[][] ret = defVal; try { @@ -169,6 +171,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public int readInt(final String name, final int defVal) throws IOException { int ret = defVal; try { @@ -184,6 +187,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public int[] readIntArray(final String name, final int[] defVal) throws IOException { int[] ret = defVal; try { @@ -211,6 +215,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public int[][] readIntArray2D(final String name, final int[][] defVal) throws IOException { int[][] ret = defVal; try { @@ -247,6 +252,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public float readFloat(final String name, final float defVal) throws IOException { float ret = defVal; try { @@ -262,6 +268,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public float[] readFloatArray(final String name, final float[] defVal) throws IOException { float[] ret = defVal; try { @@ -289,6 +296,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public float[][] readFloatArray2D(final String name, final float[][] defVal) throws IOException { float[][] ret = defVal; try { @@ -322,6 +330,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public double readDouble(final String name, final double defVal) throws IOException { double ret = defVal; try { @@ -337,6 +346,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public double[] readDoubleArray(final String name, final double[] defVal) throws IOException { double[] ret = defVal; try { @@ -364,6 +374,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public double[][] readDoubleArray2D(final String name, final double[][] defVal) throws IOException { double[][] ret = defVal; try { @@ -400,6 +411,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public long readLong(final String name, final long defVal) throws IOException { long ret = defVal; try { @@ -415,6 +427,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public long[] readLongArray(final String name, final long[] defVal) throws IOException { long[] ret = defVal; try { @@ -442,6 +455,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public long[][] readLongArray2D(final String name, final long[][] defVal) throws IOException { long[][] ret = defVal; try { @@ -478,6 +492,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public short readShort(final String name, final short defVal) throws IOException { short ret = defVal; try { @@ -493,6 +508,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public short[] readShortArray(final String name, final short[] defVal) throws IOException { short[] ret = defVal; try { @@ -520,6 +536,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public short[][] readShortArray2D(final String name, final short[][] defVal) throws IOException { short[][] ret = defVal; try { @@ -556,6 +573,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public boolean readBoolean(final String name, final boolean defVal) throws IOException { boolean ret = defVal; try { @@ -571,6 +589,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public boolean[] readBooleanArray(final String name, final boolean[] defVal) throws IOException { boolean[] ret = defVal; try { @@ -598,6 +617,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public boolean[][] readBooleanArray2D(final String name, final boolean[][] defVal) throws IOException { boolean[][] ret = defVal; try { @@ -634,6 +654,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public String readString(final String name, final String defVal) throws IOException { String ret = defVal; try { @@ -646,6 +667,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public String[] readStringArray(final String name, final String[] defVal) throws IOException { String[] ret = defVal; try { @@ -682,6 +704,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public String[][] readStringArray2D(final String name, final String[][] defVal) throws IOException { String[][] ret = defVal; try { @@ -718,6 +741,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public BitSet readBitSet(final String name, final BitSet defVal) throws IOException { BitSet ret = defVal; try { @@ -739,6 +763,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public Savable readSavable(final String name, final Savable defVal) throws IOException { Savable ret = defVal; @@ -857,7 +882,7 @@ public class DOMInputCapsule implements InputCapsule { private Savable[] readRenderStateList(final Element fromElement, final Savable[] defVal) { Savable[] ret = defVal; try { - final List<RenderState> tmp = new ArrayList<RenderState>(); + final List<RenderState> tmp = new ArrayList<>(); _currentElem = findFirstChildElement(fromElement); while (_currentElem != null) { final Element el = _currentElem; @@ -880,6 +905,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public Savable[] readSavableArray(final String name, final Savable[] defVal) throws IOException { Savable[] ret = defVal; try { @@ -912,6 +938,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public Savable[][] readSavableArray2D(final String name, final Savable[][] defVal) throws IOException { Savable[][] ret = defVal; try { @@ -944,6 +971,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override @SuppressWarnings("unchecked") public <E extends Savable> List<E> readSavableList(final String name, final List<E> defVal) throws IOException { List<E> ret = defVal; @@ -956,7 +984,7 @@ public class DOMInputCapsule implements InputCapsule { final String s = tmpEl.getAttribute("size"); final int size = Integer.parseInt(s); @SuppressWarnings("rawtypes") - final List tmp = Lists.newArrayList(); + final List tmp = new ArrayList(); _currentElem = findFirstChildElement(tmpEl); for (int i = 0; i < size; i++) { tmp.add(readSavableFromCurrentElem(null)); @@ -975,6 +1003,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override @SuppressWarnings("unchecked") public <E extends Savable> List<E>[] readSavableListArray(final String name, final List<E>[] defVal) throws IOException { @@ -1007,6 +1036,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public <E extends Savable> List<E>[][] readSavableListArray2D(final String name, final List<E>[][] defVal) throws IOException { @@ -1034,6 +1064,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public List<FloatBuffer> readFloatBufferList(final String name, final List<FloatBuffer> defVal) throws IOException { List<FloatBuffer> ret = defVal; try { @@ -1043,7 +1074,7 @@ public class DOMInputCapsule implements InputCapsule { } final int size = Integer.parseInt(tmpEl.getAttribute("size")); - final List<FloatBuffer> tmp = new ArrayList<FloatBuffer>(size); + final List<FloatBuffer> tmp = new ArrayList<>(size); _currentElem = findFirstChildElement(tmpEl); for (int i = 0; i < size; i++) { tmp.add(readFloatBuffer(null, null)); @@ -1062,6 +1093,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override @SuppressWarnings("unchecked") public <K extends Savable, V extends Savable> Map<K, V> readSavableMap(final String name, final Map<K, V> defVal) throws IOException { @@ -1073,7 +1105,7 @@ public class DOMInputCapsule implements InputCapsule { } else { tempEl = _currentElem; } - ret = new HashMap<K, V>(); + ret = new HashMap<>(); final NodeList nodes = tempEl.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { @@ -1090,6 +1122,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override @SuppressWarnings("unchecked") public <V extends Savable> Map<String, V> readStringSavableMap(final String name, final Map<String, V> defVal) throws IOException { @@ -1102,7 +1135,7 @@ public class DOMInputCapsule implements InputCapsule { tempEl = _currentElem; } if (tempEl != null) { - ret = new HashMap<String, V>(); + ret = new HashMap<>(); final NodeList nodes = tempEl.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { @@ -1125,6 +1158,7 @@ public class DOMInputCapsule implements InputCapsule { /** * reads from currentElem if name is null */ + @Override public FloatBuffer readFloatBuffer(final String name, final FloatBuffer defVal) throws IOException { FloatBuffer ret = defVal; try { @@ -1155,6 +1189,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public IntBuffer readIntBuffer(final String name, final IntBuffer defVal) throws IOException { IntBuffer ret = defVal; try { @@ -1181,6 +1216,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public ByteBuffer readByteBuffer(final String name, final ByteBuffer defVal) throws IOException { ByteBuffer ret = defVal; try { @@ -1207,6 +1243,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public ShortBuffer readShortBuffer(final String name, final ShortBuffer defVal) throws IOException { ShortBuffer ret = defVal; try { @@ -1233,6 +1270,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public List<ByteBuffer> readByteBufferList(final String name, final List<ByteBuffer> defVal) throws IOException { List<ByteBuffer> ret = defVal; try { @@ -1242,7 +1280,7 @@ public class DOMInputCapsule implements InputCapsule { } final int size = Integer.parseInt(tmpEl.getAttribute("size")); - final List<ByteBuffer> tmp = new ArrayList<ByteBuffer>(size); + final List<ByteBuffer> tmp = new ArrayList<>(size); _currentElem = findFirstChildElement(tmpEl); for (int i = 0; i < size; i++) { tmp.add(readByteBuffer(null, null)); @@ -1261,6 +1299,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override public <T extends Enum<T>> T readEnum(final String name, final Class<T> enumType, final T defVal) throws IOException { T ret = defVal; @@ -1277,6 +1316,7 @@ public class DOMInputCapsule implements InputCapsule { return ret; } + @Override @SuppressWarnings("unchecked") public <T extends Enum<T>> T[] readEnumArray(final String name, final Class<T> enumType, final T[] defVal) throws IOException { diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java index ce2e9c7..911f2f2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -37,7 +37,7 @@ public class DOMOutputCapsule implements OutputCapsule { private static final String _dataAttributeName = "data"; private final Document _doc; private Element _currentElement; - private final Map<Savable, Element> _writtenSavables = new IdentityHashMap<Savable, Element>(); + private final Map<Savable, Element> _writtenSavables = new IdentityHashMap<>(); public DOMOutputCapsule(final Document doc) { _doc = doc; @@ -72,6 +72,7 @@ public class DOMOutputCapsule implements OutputCapsule { return s; } + @Override public void write(final byte value, final String name, final byte defVal) throws IOException { if (value == defVal) { return; @@ -79,6 +80,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement.setAttribute(name, String.valueOf(value)); } + @Override public void write(byte[] value, final String name, final byte[] defVal) throws IOException { final StringBuilder buf = new StringBuilder(); if (value == null) { @@ -97,6 +99,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(byte[][] value, final String name, final byte[][] defVal) throws IOException { final StringBuilder buf = new StringBuilder(); if (value == null) { @@ -119,6 +122,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(final int value, final String name, final int defVal) throws IOException { if (value == defVal) { return; @@ -126,6 +130,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement.setAttribute(name, String.valueOf(value)); } + @Override public void write(final int[] value, final String name, final int[] defVal) throws IOException { final StringBuilder buf = new StringBuilder(); if (value == null) { @@ -148,6 +153,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(final int[][] value, final String name, final int[][] defVal) throws IOException { if (value == null) { return; @@ -166,6 +172,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void write(final float value, final String name, final float defVal) throws IOException { if (value == defVal) { return; @@ -173,6 +180,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement.setAttribute(name, String.valueOf(value)); } + @Override public void write(float[] value, final String name, final float[] defVal) throws IOException { final StringBuilder buf = new StringBuilder(); if (value == null) { @@ -191,6 +199,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(final float[][] value, final String name, final float[][] defVal) throws IOException { final StringBuilder buf = new StringBuilder(); if (value == null) { @@ -216,6 +225,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(final double value, final String name, final double defVal) throws IOException { if (value == defVal) { return; @@ -223,6 +233,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement.setAttribute(name, String.valueOf(value)); } + @Override public void write(double[] value, final String name, final double[] defVal) throws IOException { final StringBuilder buf = new StringBuilder(); if (value == null) { @@ -241,6 +252,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(final double[][] value, final String name, final double[][] defVal) throws IOException { if (value == null) { return; @@ -259,6 +271,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void write(final long value, final String name, final long defVal) throws IOException { if (value == defVal) { return; @@ -266,6 +279,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement.setAttribute(name, String.valueOf(value)); } + @Override public void write(long[] value, final String name, final long[] defVal) throws IOException { final StringBuilder buf = new StringBuilder(); if (value == null) { @@ -284,6 +298,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(final long[][] value, final String name, final long[][] defVal) throws IOException { if (value == null) { return; @@ -302,6 +317,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void write(final short value, final String name, final short defVal) throws IOException { if (value == defVal) { return; @@ -309,6 +325,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement.setAttribute(name, String.valueOf(value)); } + @Override public void write(short[] value, final String name, final short[] defVal) throws IOException { final StringBuilder buf = new StringBuilder(); if (value == null) { @@ -327,6 +344,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(final short[][] value, final String name, final short[][] defVal) throws IOException { if (value == null) { return; @@ -345,6 +363,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void write(final boolean value, final String name, final boolean defVal) throws IOException { if (value == defVal) { return; @@ -352,6 +371,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement.setAttribute(name, String.valueOf(value)); } + @Override public void write(boolean[] value, final String name, final boolean[] defVal) throws IOException { final StringBuilder buf = new StringBuilder(); if (value == null) { @@ -370,6 +390,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(final boolean[][] value, final String name, final boolean[][] defVal) throws IOException { if (value == null) { return; @@ -388,6 +409,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void write(final String value, final String name, final String defVal) throws IOException { if (value == null || value.equals(defVal)) { return; @@ -395,6 +417,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement.setAttribute(name, encodeString(value)); } + @Override public void write(String[] value, final String name, final String[] defVal) throws IOException { final Element el = appendElement(name); @@ -414,6 +437,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void write(final String[][] value, final String name, final String[][] defVal) throws IOException { if (value == null) { return; @@ -432,6 +456,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void write(final BitSet value, final String name, final BitSet defVal) throws IOException { if (value == null || value.equals(defVal)) { return; @@ -446,6 +471,7 @@ public class DOMOutputCapsule implements OutputCapsule { } + @Override public void write(final Savable object, String name, final Savable defVal) throws IOException { if (object == null) { return; @@ -488,6 +514,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = old; } + @Override public void write(final Savable[] objects, final String name, final Savable[] defVal) throws IOException { if (objects == null) { return; @@ -515,6 +542,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = old; } + @Override public void write(final Savable[][] value, final String name, final Savable[][] defVal) throws IOException { if (value == null) { return; @@ -534,6 +562,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) _currentElement.getParentNode(); } + @Override public void writeSavableList(final List<? extends Savable> array, final String name, final List<? extends Savable> defVal) throws IOException { if (array == null) { @@ -559,6 +588,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = old; } + @Override public void writeSavableListArray(final List<? extends Savable>[] objects, final String name, final List<? extends Savable>[] defVal) throws IOException { if (objects == null) { @@ -586,6 +616,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = old; } + @Override public void writeSavableListArray2D(final List<? extends Savable>[][] value, final String name, final List<? extends Savable>[][] defVal) throws IOException { if (value == null) { @@ -606,6 +637,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void writeFloatBufferList(final List<FloatBuffer> array, final String name, final List<FloatBuffer> defVal) throws IOException { if (array == null) { @@ -622,6 +654,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void writeSavableMap(final Map<? extends Savable, ? extends Savable> map, final String name, final Map<? extends Savable, ? extends Savable> defVal) throws IOException { if (map == null) { @@ -645,6 +678,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) stringMap.getParentNode(); } + @Override public void writeStringSavableMap(final Map<String, ? extends Savable> map, final String name, final Map<String, ? extends Savable> defVal) throws IOException { if (map == null) { @@ -668,6 +702,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) stringMap.getParentNode(); } + @Override public void write(final FloatBuffer value, final String name, final FloatBuffer defVal) throws IOException { if (value == null) { return; @@ -688,6 +723,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void write(final IntBuffer value, final String name, final IntBuffer defVal) throws IOException { if (value == null) { return; @@ -711,6 +747,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void write(final ByteBuffer value, final String name, final ByteBuffer defVal) throws IOException { if (value == null) { return; @@ -734,6 +771,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void write(final ShortBuffer value, final String name, final ShortBuffer defVal) throws IOException { if (value == null) { return; @@ -757,6 +795,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement = (Element) el.getParentNode(); } + @Override public void writeByteBufferList(final List<ByteBuffer> array, final String name, final List<ByteBuffer> defVal) throws IOException { if (array == null) { @@ -774,6 +813,7 @@ public class DOMOutputCapsule implements OutputCapsule { } + @Override public void write(final Enum<?> value, final String name, final Enum<?> defVal) throws IOException { if (value == defVal || value == null) { return; @@ -781,6 +821,7 @@ public class DOMOutputCapsule implements OutputCapsule { _currentElement.setAttribute(name, String.valueOf(value)); } + @Override public void write(final Enum<?>[] value, final String name) throws IOException { if (value == null) { return; diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java index 34000f0..41943bb 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -26,7 +26,7 @@ import org.w3c.dom.NodeList; /** * The DOMSerializer was based primarily off the DOMSerializer.java class from the "Java and XML" 3rd Edition book by * Brett McLaughlin, and Justin Edelson. Some modifications were made to support formatting of elements and attributes. - * + * */ public class DOMSerializer { @@ -51,7 +51,7 @@ public class DOMSerializer { } public void setIndent(final int numSpaces) { - final StringBuffer buffer = new StringBuffer(); + final StringBuilder buffer = new StringBuilder(); for (int i = 0; i < numSpaces; i++) { buffer.append('\t'); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOM_PrettyPrint.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOM_PrettyPrint.java index 03d3818..73c3c4c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOM_PrettyPrint.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOM_PrettyPrint.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLExporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLExporter.java index e23bf32..93d356a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLExporter.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLExporter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -34,6 +34,7 @@ public class XMLExporter implements Ardor3dExporter { } + @Override public void save(final Savable object, final OutputStream os) throws IOException { try { // Initialize Document when saving so we don't retain state of previous exports @@ -49,6 +50,7 @@ public class XMLExporter implements Ardor3dExporter { } } + @Override public void save(final Savable object, final File f) throws IOException { save(object, new FileOutputStream(f)); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLImporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLImporter.java index a5caa2a..18e9f65 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLImporter.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLImporter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -32,6 +32,7 @@ public class XMLImporter implements Ardor3dImporter { public XMLImporter() {} + @Override public Savable load(final InputStream is) throws IOException { try { final DOMInputCapsule _domIn = new DOMInputCapsule(DocumentBuilderFactory.newInstance() @@ -48,14 +49,17 @@ public class XMLImporter implements Ardor3dImporter { } } + @Override public Savable load(final URL url) throws IOException { return load(url.openStream()); } + @Override public Savable load(final File f) throws IOException { return load(new FileInputStream(f)); } + @Override public Savable load(final byte[] data) throws IOException { return load(new ByteArrayInputStream(data)); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java index a0a3478..17f7c2c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -20,6 +20,7 @@ import java.nio.ShortBuffer; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.Vector2; @@ -36,7 +37,6 @@ import com.ardor3d.scenegraph.IntBufferData; import com.ardor3d.scenegraph.ShortBufferData; import com.ardor3d.util.Ardor3dException; import com.ardor3d.util.Constants; -import com.google.common.collect.MapMaker; /** * <code>BufferUtils</code> is a helper class for generating nio buffers from ardor3d data classes such as Vectors and @@ -45,7 +45,7 @@ import com.google.common.collect.MapMaker; public final class BufferUtils { // // -- TRACKER HASH -- //// - private static final Map<Buffer, Object> trackingHash = new MapMaker().weakKeys().makeMap(); + private static final Map<Buffer, Object> trackingHash = new WeakHashMap<>(); private static final Object ref = new Object(); // // -- COLORRGBA METHODS -- //// @@ -53,7 +53,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of ColorRGBA objects. The FloatBuffer will be 4 * data.length * long and contain the color data as data[0].r, data[0].g, data[0].b, data[0].a, data[1].r... etc. - * + * * @param data * array of ColorRGBA objects to place into a new FloatBuffer */ @@ -67,7 +67,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of ColorRGBA objects. The FloatBuffer will be 4 * data.length * long and contain the color data as data[0].r, data[0].g, data[0].b, data[0].a, data[1].r... etc. - * + * * @param offset * the starting index to read from in our data array * @param length @@ -93,7 +93,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of ColorRGBA object data. - * + * * @param colors * number of colors that need to be held by the newly created buffer * @return the requested new FloatBuffer @@ -105,7 +105,7 @@ public final class BufferUtils { /** * Sets the data contained in the given color into the FloatBuffer at the specified index. - * + * * @param color * the data to insert * @param buf @@ -123,7 +123,7 @@ public final class BufferUtils { /** * Updates the values of the given color from the specified buffer at the index provided. - * + * * @param store * the color to set data on * @param buf @@ -140,7 +140,7 @@ public final class BufferUtils { /** * Generates a ColorRGBA array from the given FloatBuffer. - * + * * @param buff * the FloatBuffer to read from * @return a newly generated array of ColorRGBA objects @@ -157,7 +157,7 @@ public final class BufferUtils { /** * Generates a ColorRGBA array from the given FloatBufferData. - * + * * @param buff * the FloatBufferData to read from * @param defaults @@ -193,7 +193,7 @@ public final class BufferUtils { /** * Copies a ColorRGBA from one position in the buffer to another. The index values are in terms of color number (eg, * color number 0 is positions 0-3 in the FloatBuffer.) - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -207,7 +207,7 @@ public final class BufferUtils { /** * Checks to see if the given ColorRGBA is equals to the data stored in the buffer at the given data index. - * + * * @param check * the color to check against - null will return false. * @param buf @@ -227,7 +227,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector4 objects. The FloatBuffer will be 4 * data.length long * and contain the vector data as data[0].x, data[0].y, data[0].z, data[0].w, data[1].x... etc. - * + * * @param offset * the starting index to read from in our data array * @param length @@ -245,7 +245,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector4 objects. The FloatBuffer will be 4 * data.length long * and contain the vector data as data[0].x, data[0].y, data[0].z, data[0].w, data[1].x... etc. - * + * * @param data * array of Vector4 objects to place into a new FloatBuffer */ @@ -267,7 +267,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector4 object data. - * + * * @param vertices * number of vertices that need to be held by the newly created buffer * @return the requested new FloatBuffer @@ -280,7 +280,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector4 object data only if the * given buffer if not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param vertices @@ -298,7 +298,7 @@ public final class BufferUtils { /** * Sets the data contained in the given Vector4 into the FloatBuffer at the specified index. - * + * * @param vector * the data to insert * @param buf @@ -325,7 +325,7 @@ public final class BufferUtils { /** * Updates the values of the given vector from the specified buffer at the index provided. - * + * * @param vector * the vector to set data on * @param buf @@ -342,7 +342,7 @@ public final class BufferUtils { /** * Generates a Vector4 array from the given FloatBuffer. - * + * * @param buff * the FloatBuffer to read from * @return a newly generated array of Vector3 objects @@ -359,7 +359,7 @@ public final class BufferUtils { /** * Generates a Vector4 array from the given FloatBufferData. - * + * * @param buff * the FloatBufferData to read from * @param defaults @@ -395,7 +395,7 @@ public final class BufferUtils { /** * Copies a Vector3 from one position in the buffer to another. The index values are in terms of vector number (eg, * vector number 0 is positions 0-2 in the FloatBuffer.) - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -409,7 +409,7 @@ public final class BufferUtils { /** * Normalize a Vector4 in-buffer. - * + * * @param buf * the buffer to find the Vector4 within * @param index @@ -425,7 +425,7 @@ public final class BufferUtils { /** * Add to a Vector4 in-buffer. - * + * * @param toAdd * the vector to add from * @param buf @@ -443,7 +443,7 @@ public final class BufferUtils { /** * Multiply and store a Vector3 in-buffer. - * + * * @param toMult * the vector to multiply against * @param buf @@ -461,7 +461,7 @@ public final class BufferUtils { /** * Checks to see if the given Vector3 is equals to the data stored in the buffer at the given data index. - * + * * @param check * the vector to check against - null will return false. * @param buf @@ -483,7 +483,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector3 objects. The FloatBuffer will be 3 * data.length long * and contain the vector data as data[0].x, data[0].y, data[0].z, data[1].x... etc. - * + * * @param data * array of Vector3 objects to place into a new FloatBuffer */ @@ -497,7 +497,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector3 objects. The FloatBuffer will be 3 * data.length long * and contain the vector data as data[0].x, data[0].y, data[0].z, data[1].x... etc. - * + * * @param offset * the starting index to read from in our data array * @param length @@ -523,7 +523,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector3 object data. - * + * * @param vertices * number of vertices that need to be held by the newly created buffer * @return the requested new FloatBuffer @@ -536,7 +536,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector3 object data only if the * given buffer is not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param vertices @@ -554,7 +554,7 @@ public final class BufferUtils { /** * Sets the data contained in the given Vector3 into the FloatBuffer at the specified index. - * + * * @param vector * the data to insert * @param buf @@ -579,7 +579,7 @@ public final class BufferUtils { /** * Updates the values of the given vector from the specified buffer at the index provided. - * + * * @param vector * the vector to set data on * @param buf @@ -595,7 +595,7 @@ public final class BufferUtils { /** * Generates a Vector3 array from the given FloatBuffer. - * + * * @param buff * the FloatBuffer to read from * @return a newly generated array of Vector3 objects @@ -612,7 +612,7 @@ public final class BufferUtils { /** * Generates a Vector3 array from the given FloatBufferData. - * + * * @param buff * the FloatBufferData to read from * @param defaults @@ -645,7 +645,7 @@ public final class BufferUtils { /** * Copies a Vector3 from one position in the buffer to another. The index values are in terms of vector number (eg, * vector number 0 is positions 0-2 in the FloatBuffer.) - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -659,7 +659,7 @@ public final class BufferUtils { /** * Normalize a Vector3 in-buffer. - * + * * @param buf * the buffer to find the Vector3 within * @param index @@ -675,7 +675,7 @@ public final class BufferUtils { /** * Add to a Vector3 in-buffer. - * + * * @param toAdd * the vector to add from * @param buf @@ -693,7 +693,7 @@ public final class BufferUtils { /** * Multiply and store a Vector3 in-buffer. - * + * * @param toMult * the vector to multiply against * @param buf @@ -711,7 +711,7 @@ public final class BufferUtils { /** * Checks to see if the given Vector3 is equals to the data stored in the buffer at the given data index. - * + * * @param check * the vector to check against - null will return false. * @param buf @@ -733,7 +733,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector2 objects. The FloatBuffer will be 2 * data.length long * and contain the vector data as data[0].x, data[0].y, data[1].x... etc. - * + * * @param data * array of Vector2 objects to place into a new FloatBuffer */ @@ -747,7 +747,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector2 objects. The FloatBuffer will be 2 * data.length long * and contain the vector data as data[0].x, data[0].y, data[1].x... etc. - * + * * @param offset * the starting index to read from in our data array * @param length @@ -773,7 +773,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector2 object data. - * + * * @param vertices * number of vertices that need to be held by the newly created buffer * @return the requested new FloatBuffer @@ -786,7 +786,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector2 object data only if the * given buffer if not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param vertices @@ -804,7 +804,7 @@ public final class BufferUtils { /** * Sets the data contained in the given Vector2 into the FloatBuffer at the specified index. - * + * * @param vector * the data to insert * @param buf @@ -819,7 +819,7 @@ public final class BufferUtils { /** * Updates the values of the given vector from the specified buffer at the index provided. - * + * * @param vector * the vector to set data on * @param buf @@ -834,7 +834,7 @@ public final class BufferUtils { /** * Generates a Vector2 array from the given FloatBuffer. - * + * * @param buff * the FloatBuffer to read from * @return a newly generated array of Vector2 objects @@ -851,7 +851,7 @@ public final class BufferUtils { /** * Generates a Vector2 array from the given FloatBufferData. - * + * * @param buff * the FloatBufferData to read from * @param defaults @@ -881,7 +881,7 @@ public final class BufferUtils { /** * Copies a Vector2 from one position in the buffer to another. The index values are in terms of vector number (eg, * vector number 0 is positions 0-1 in the FloatBuffer.) - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -895,7 +895,7 @@ public final class BufferUtils { /** * Normalize a Vector2 in-buffer. - * + * * @param buf * the buffer to find the Vector2 within * @param index @@ -911,7 +911,7 @@ public final class BufferUtils { /** * Add to a Vector2 in-buffer. - * + * * @param toAdd * the vector to add from * @param buf @@ -929,7 +929,7 @@ public final class BufferUtils { /** * Multiply and store a Vector2 in-buffer. - * + * * @param toMult * the vector to multiply against * @param buf @@ -947,7 +947,7 @@ public final class BufferUtils { /** * Checks to see if the given Vector2 is equals to the data stored in the buffer at the given data index. - * + * * @param check * the vector to check against - null will return false. * @param buf @@ -969,7 +969,7 @@ public final class BufferUtils { /** * Generate a new IntBuffer using the given array of ints. The IntBuffer will be data.length long and contain the * int data as data[0], data[1]... etc. - * + * * @param data * array of ints to place into a new IntBuffer */ @@ -986,7 +986,7 @@ public final class BufferUtils { /** * Create a new int[] array and populate it with the given IntBuffer's contents. - * + * * @param buff * the IntBuffer to read from * @return a new int array populated from the IntBuffer @@ -1005,7 +1005,7 @@ public final class BufferUtils { /** * Create a new int[] array and populate it with the given IndexBufferData's contents. - * + * * @param buff * the IndexBufferData to read from * @return a new int array populated from the IndexBufferData @@ -1024,7 +1024,7 @@ public final class BufferUtils { /** * Create a new float[] array and populate it with the given FloatBuffer's contents. - * + * * @param buff * the FloatBuffer to read from * @return a new float array populated from the FloatBuffer @@ -1045,7 +1045,7 @@ public final class BufferUtils { /** * Create a new DoubleBuffer of the specified size. - * + * * @param size * required number of double to store. * @return the new DoubleBuffer @@ -1058,7 +1058,7 @@ public final class BufferUtils { /** * Create a new DoubleBuffer of the specified size. - * + * * @param size * required number of double to store. * @return the new DoubleBuffer @@ -1075,7 +1075,7 @@ public final class BufferUtils { /** * Create a new DoubleBuffer of an appropriate size to hold the specified number of doubles only if the given buffer * if not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1096,7 +1096,7 @@ public final class BufferUtils { * Creates a new DoubleBuffer with the same contents as the given DoubleBuffer. The new DoubleBuffer is seperate * from the old one and changes are not reflected across. If you want to reflect changes, consider using * Buffer.duplicate(). - * + * * @param buf * the DoubleBuffer to copy * @return the copy @@ -1122,7 +1122,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of the specified size. - * + * * @param size * required number of floats to store. * @return the new FloatBuffer @@ -1138,7 +1138,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of the specified size. - * + * * @param size * required number of floats to store. * @return the new FloatBuffer @@ -1151,7 +1151,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of float primitives. - * + * * @param data * array of float primitives to place into a new FloatBuffer */ @@ -1161,7 +1161,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of float primitives. - * + * * @param data * array of float primitives to place into a new FloatBuffer */ @@ -1182,6 +1182,88 @@ public final class BufferUtils { return buff; } + /** + * Generate a new FloatBuffer using the given array of Vector2 objects. The FloatBuffer will be 2 * data.length long + * and contain the vector data as data[0].x, data[0].y, data[1].x... etc. + * + * @param offset + * the starting index to read from in our data array + * @param length + * the number of vectors to read + * @param data + * array of Vector2 objects to place into a new FloatBuffer + */ + public static FloatBuffer createFloatBufferOnHeap(final int offset, final int length, final ReadOnlyVector2... data) { + if (data == null) { + return null; + } + final FloatBuffer buff = BufferUtils.createFloatBufferOnHeap(2 * length); + for (int x = offset; x < length; x++) { + if (data[x] != null) { + buff.put(data[x].getXf()).put(data[x].getYf()); + } else { + buff.put(0).put(0); + } + } + buff.flip(); + return buff; + } + + /** + * Generate a new FloatBuffer using the given array of Vector3 objects. The FloatBuffer will be 3 * data.length long + * and contain the vector data as data[0].x, data[0].y, data[0].z, data[1].x... etc. + * + * @param offset + * the starting index to read from in our data array + * @param length + * the number of vectors to read + * @param data + * array of Vector3 objects to place into a new FloatBuffer + */ + public static FloatBuffer createFloatBufferOnHeap(final int offset, final int length, final ReadOnlyVector3... data) { + if (data == null) { + return null; + } + final FloatBuffer buff = BufferUtils.createFloatBufferOnHeap(3 * length); + for (int x = offset; x < length; x++) { + if (data[x] != null) { + buff.put(data[x].getXf()).put(data[x].getYf()).put(data[x].getZf()); + } else { + buff.put(0).put(0).put(0); + } + } + buff.flip(); + return buff; + } + + /** + * Generate a new FloatBuffer using the given array of ColorRGBA objects. The FloatBuffer will be 4 * data.length + * long and contain the color data as data[0].r, data[0].g, data[0].b, data[0].a, data[1].r... etc. + * + * @param offset + * the starting index to read from in our data array + * @param length + * the number of colors to read + * @param data + * array of ColorRGBA objects to place into a new FloatBuffer + */ + public static FloatBuffer createFloatBufferOnHeap(final int offset, final int length, + final ReadOnlyColorRGBA... data) { + if (data == null) { + return null; + } + final FloatBuffer buff = BufferUtils.createFloatBufferOnHeap(4 * length); + for (int x = offset; x < length; x++) { + if (data[x] != null) { + buff.put(data[x].getRed()).put(data[x].getGreen()).put(data[x].getBlue()).put(data[x].getAlpha()); + } else { + buff.put(0).put(0).put(0).put(0); + } + } + buff.flip(); + return buff; + } + public static IntBuffer createIntBuffer(final IntBuffer reuseStore, final int... data) { if (data == null) { return null; @@ -1201,7 +1283,7 @@ public final class BufferUtils { /** * Copies floats from one buffer to another. - * + * * @param source * the buffer to copy from * @param fromPos @@ -1225,7 +1307,7 @@ public final class BufferUtils { /** * Copies floats from one position in the buffer to another. - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -1247,7 +1329,7 @@ public final class BufferUtils { * Creates a new FloatBuffer with the same contents as the given FloatBuffer. The new FloatBuffer is seperate from * the old one and changes are not reflected across. If you want to reflect changes, consider using * Buffer.duplicate(). - * + * * @param buf * the FloatBuffer to copy * @return the copy @@ -1273,7 +1355,7 @@ public final class BufferUtils { /** * Create a new IntBuffer of the specified size. - * + * * @param size * required number of ints to store. * @return the new IntBuffer @@ -1286,7 +1368,7 @@ public final class BufferUtils { /** * Create a new IntBuffer of the specified size. - * + * * @param size * required number of ints to store. * @return the new IntBuffer @@ -1303,7 +1385,7 @@ public final class BufferUtils { /** * Create a new IntBuffer of an appropriate size to hold the specified number of ints only if the given buffer if * not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1323,7 +1405,7 @@ public final class BufferUtils { /** * Creates a new IntBuffer with the same contents as the given IntBuffer. The new IntBuffer is seperate from the old * one and changes are not reflected across. If you want to reflect changes, consider using Buffer.duplicate(). - * + * * @param buf * the IntBuffer to copy * @return the copy @@ -1349,7 +1431,7 @@ public final class BufferUtils { /** * Create a new ByteBuffer of the specified size. - * + * * @param size * required number of ints to store. * @return the new IntBuffer @@ -1366,7 +1448,7 @@ public final class BufferUtils { /** * Create a new ByteBuffer of an appropriate size to hold the specified number of ints only if the given buffer if * not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1386,7 +1468,7 @@ public final class BufferUtils { /** * Creates a new ByteBuffer with the same contents as the given ByteBuffer. The new ByteBuffer is seperate from the * old one and changes are not reflected across. If you want to reflect changes, consider using Buffer.duplicate(). - * + * * @param buf * the ByteBuffer to copy * @return the copy @@ -1412,7 +1494,7 @@ public final class BufferUtils { /** * Create a new ShortBuffer of the specified size. - * + * * @param size * required number of shorts to store. * @return the new ShortBuffer @@ -1425,7 +1507,7 @@ public final class BufferUtils { /** * Create a new ShortBuffer of the specified size. - * + * * @param size * required number of shorts to store. * @return the new ShortBuffer @@ -1441,7 +1523,7 @@ public final class BufferUtils { /** * Generate a new ShortBuffer using the given array of short primitives. - * + * * @param data * array of short primitives to place into a new ShortBuffer */ @@ -1459,7 +1541,7 @@ public final class BufferUtils { /** * Create a new ShortBuffer of an appropriate size to hold the specified number of shorts only if the given buffer * if not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1480,7 +1562,7 @@ public final class BufferUtils { * Creates a new ShortBuffer with the same contents as the given ShortBuffer. The new ShortBuffer is seperate from * the old one and changes are not reflected across. If you want to reflect changes, consider using * Buffer.duplicate(). - * + * * @param buf * the ShortBuffer to copy * @return the copy @@ -1505,7 +1587,7 @@ public final class BufferUtils { /** * Ensures there is at least the <code>required</code> number of entries left after the current position of the * buffer. If the buffer is too small a larger one is created and the old one copied to the new buffer. - * + * * @param buffer * buffer that should be checked/copied (may be null) * @param required @@ -1533,7 +1615,7 @@ public final class BufferUtils { * Create a new IndexBufferData of the specified size. The specific implementation will be chosen based on the max * value you need to store in your buffer. If that value is less than 2^8, a ByteBufferData is used. If it is less * than 2^16, a ShortBufferData is used. Otherwise an IntBufferData is used. - * + * * @param size * required number of values to store. * @param maxValue @@ -1552,10 +1634,32 @@ public final class BufferUtils { } /** + * Create a new IndexBufferData of the specified size. The specific implementation will be chosen based on the max + * value you need to store in your buffer. If that value is less than 2^8, a ByteBufferData is used. If it is less + * than 2^16, a ShortBufferData is used. Otherwise an IntBufferData is used. + * + * @param size + * required number of values to store. + * @param maxValue + * the largest value you will need to store in your buffer. Often this is equal to + * ("size of vertex buffer" - 1). + * @return the new IndexBufferData + */ + public static IndexBufferData<?> createIndexBufferDataOnHeap(final int size, final int maxValue) { + if (maxValue < 256) { // 2^8 + return new ByteBufferData(BufferUtils.createByteBufferOnHeap(size)); + } else if (maxValue < 65536) { // 2^16 + return new ShortBufferData(BufferUtils.createShortBufferOnHeap(size)); + } else { + return new IntBufferData(BufferUtils.createIntBufferOnHeap(size)); + } + } + + /** * Create a new IndexBufferData large enough to fit the contents of the given array. The specific implementation * will be chosen based on the max value you need to store in your buffer. If that value is less than 2^8, a * ByteBufferData is used. If it is less than 2^16, a ShortBufferData is used. Otherwise an IntBufferData is used. - * + * * @param contents * an array of index values to store in your newly created IndexBufferData. * @param maxValue @@ -1578,7 +1682,7 @@ public final class BufferUtils { /** * Create a new IndexBufferData of the specified size and class. - * + * * @param size * required number of values to store. * @param clazz @@ -1597,7 +1701,7 @@ public final class BufferUtils { /** * Creates a new IndexBufferData with the same contents as the given IndexBufferData. The new IndexBufferData is * separate from the old one and changes are not reflected across. - * + * * @param buf * the IndexBufferData to copy * @return the copy @@ -1624,7 +1728,7 @@ public final class BufferUtils { /** * Create a new ByteBuffer of the specified size. - * + * * @param size * required number of ints to store. * @return the new IntBuffer @@ -1638,7 +1742,7 @@ public final class BufferUtils { /** * Create a new ByteBuffer of an appropriate size to hold the specified number of ints only if the given buffer if * not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1658,7 +1762,7 @@ public final class BufferUtils { /** * Creates a new ByteBuffer with the same contents as the given ByteBuffer. The new ByteBuffer is seperate from the * old one and changes are not reflected across. If you want to reflect changes, consider using Buffer.duplicate(). - * + * * @param buf * the ByteBuffer to copy * @return the copy @@ -1678,7 +1782,7 @@ public final class BufferUtils { public static void printCurrentDirectMemory(StringBuilder store) { long totalHeld = 0; // make a new set to hold the keys to prevent concurrency issues. - final List<Buffer> bufs = new ArrayList<Buffer>(trackingHash.keySet()); + final List<Buffer> bufs = new ArrayList<>(trackingHash.keySet()); int fBufs = 0, bBufs = 0, iBufs = 0, sBufs = 0, dBufs = 0; int fBufsM = 0, bBufsM = 0, iBufsM = 0, sBufsM = 0, dBufsM = 0; for (final Buffer b : bufs) { @@ -1710,11 +1814,11 @@ public final class BufferUtils { } store.append("Existing buffers: ").append(bufs.size()).append('\n'); store.append("(b: ").append(bBufs).append(" f: ").append(fBufs).append(" i: ").append(iBufs).append(" s: ") - .append(sBufs).append(" d: ").append(dBufs).append(')').append('\n'); + .append(sBufs).append(" d: ").append(dBufs).append(')').append('\n'); store.append("Total direct memory held: ").append(totalHeld / 1024).append("kb\n"); store.append("(b: ").append(bBufsM / 1024).append("kb f: ").append(fBufsM / 1024).append("kb i: ") - .append(iBufsM / 1024).append("kb s: ").append(sBufsM / 1024).append("kb d: ").append(dBufsM / 1024) - .append("kb)").append('\n'); + .append(iBufsM / 1024).append("kb s: ").append(sBufsM / 1024).append("kb d: ").append(dBufsM / 1024) + .append("kb)").append('\n'); if (printStout) { System.out.println(store.toString()); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/CopyLogic.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/CopyLogic.java index f581103..4d8dd4f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/CopyLogic.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/CopyLogic.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/Debugger.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/Debugger.java index 56b2fbe..c81dd94 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/Debugger.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/Debugger.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java index 71fd338..7676b88 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,18 +10,23 @@ package com.ardor3d.util.geom; +import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.logging.Logger; import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.Vector2; import com.ardor3d.math.Vector3; +import com.ardor3d.scenegraph.FloatBufferData; import com.ardor3d.scenegraph.IndexBufferData; import com.ardor3d.scenegraph.Mesh; +import com.ardor3d.scenegraph.MeshData; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.Spatial; -import com.google.common.collect.Maps; /** * This tool assists in reducing geometry information.<br> @@ -29,10 +34,15 @@ import com.google.common.collect.Maps; * Note: Does not work with geometry using texcoords other than 2d coords. <br> * TODO: Consider adding an option for "close enough" vertex matches... ie, smaller than X distance apart.<br> */ -public final class GeometryTool { +public class GeometryTool { private static final Logger logger = Logger.getLogger(GeometryTool.class.getName()); /** + * flag indicating whether the NIO buffers are allocated on the heap + */ + private final boolean nioBuffersAllocationOnHeapEnabled; + + /** * Condition options for determining if one vertex is "equal" to another. */ public enum MatchCondition { @@ -46,8 +56,13 @@ public final class GeometryTool { Group; } - private GeometryTool() { + public GeometryTool() { + this(false); + } + + public GeometryTool(final boolean nioBuffersAllocationOnHeapEnabled) { super(); + this.nioBuffersAllocationOnHeapEnabled = nioBuffersAllocationOnHeapEnabled; } /** @@ -61,7 +76,7 @@ public final class GeometryTool { * our match conditions. * @return a mapping of old vertex positions to their new positions. */ - public static VertMap minimizeVerts(final Mesh mesh, final EnumSet<MatchCondition> conditions) { + public VertMap minimizeVerts(final Mesh mesh, final EnumSet<MatchCondition> conditions) { final VertGroupData groupData = new VertGroupData(); groupData.setGroupConditions(VertGroupData.DEFAULT_GROUP, conditions); return minimizeVerts(mesh, groupData); @@ -77,7 +92,7 @@ public final class GeometryTool { * grouping data for the vertices in this mesh. * @return a mapping of old vertex positions to their new positions. */ - public static VertMap minimizeVerts(final Mesh mesh, final VertGroupData groupData) { + public VertMap minimizeVerts(final Mesh mesh, final VertGroupData groupData) { final long start = System.currentTimeMillis(); int vertCount = -1; @@ -111,14 +126,14 @@ public final class GeometryTool { } } - final Map<VertKey, Integer> store = Maps.newHashMap(); - final Map<Integer, Integer> indexRemap = Maps.newHashMap(); + final Map<VertKey, Integer> store = new HashMap<>(); + final Map<Integer, Integer> indexRemap = new HashMap<>(); int good = 0; long group; for (int x = 0, max = verts.length; x < max; x++) { group = groupData.getGroupForVertex(x); - final VertKey vkey = new VertKey(verts[x], norms != null ? norms[x] : null, colors != null ? colors[x] - : null, getTexs(tex, x), groupData.getGroupConditions(group), group); + final VertKey vkey = new VertKey(verts[x], norms != null ? norms[x] : null, + colors != null ? colors[x] : null, getTexs(tex, x), groupData.getGroupConditions(group), group); // if we've already seen it, swap it for the max, and decrease max. if (store.containsKey(vkey)) { final int newInd = store.get(vkey); @@ -163,22 +178,33 @@ public final class GeometryTool { } } - mesh.getMeshData().setVertexBuffer(BufferUtils.createFloatBuffer(0, good, verts)); + mesh.getMeshData().setVertexBuffer( + nioBuffersAllocationOnHeapEnabled ? BufferUtils.createFloatBufferOnHeap(0, good, verts) + : BufferUtils.createFloatBuffer(0, good, verts)); if (norms != null) { - mesh.getMeshData().setNormalBuffer(BufferUtils.createFloatBuffer(0, good, norms)); + mesh.getMeshData().setNormalBuffer( + nioBuffersAllocationOnHeapEnabled ? BufferUtils.createFloatBufferOnHeap(0, good, norms) + : BufferUtils.createFloatBuffer(0, good, norms)); } if (colors != null) { - mesh.getMeshData().setColorBuffer(BufferUtils.createFloatBuffer(0, good, colors)); + mesh.getMeshData().setColorBuffer( + nioBuffersAllocationOnHeapEnabled ? BufferUtils.createFloatBufferOnHeap(0, good, colors) + : BufferUtils.createFloatBuffer(0, good, colors)); } for (int x = 0; x < tex.length; x++) { if (tex[x] != null) { - mesh.getMeshData().setTextureBuffer(BufferUtils.createFloatBuffer(0, good, tex[x]), x); + mesh.getMeshData() + .setTextureBuffer(nioBuffersAllocationOnHeapEnabled + ? BufferUtils.createFloatBufferOnHeap(0, good, tex[x]) + : BufferUtils.createFloatBuffer(0, good, tex[x]), x); } } if (mesh.getMeshData().getIndices() == null || mesh.getMeshData().getIndices().getBufferCapacity() == 0) { - final IndexBufferData<?> indexBuffer = BufferUtils.createIndexBufferData(oldCount, oldCount); + final IndexBufferData<?> indexBuffer = nioBuffersAllocationOnHeapEnabled + ? BufferUtils.createIndexBufferDataOnHeap(oldCount, oldCount) + : BufferUtils.createIndexBufferData(oldCount, oldCount); mesh.getMeshData().setIndices(indexBuffer); for (int i = 0; i < oldCount; i++) { if (indexRemap.containsKey(i)) { @@ -209,7 +235,7 @@ public final class GeometryTool { return result; } - private static Vector2[] getTexs(final Vector2[][] tex, final int i) { + private Vector2[] getTexs(final Vector2[][] tex, final int i) { final Vector2[] res = new Vector2[tex.length]; for (int x = 0; x < tex.length; x++) { if (tex[x] != null) { @@ -219,7 +245,7 @@ public final class GeometryTool { return res; } - public static void trimEmptyBranches(final Spatial spatial) { + public void trimEmptyBranches(final Spatial spatial) { if (spatial instanceof Node) { final Node node = (Node) spatial; for (int i = node.getNumberOfChildren(); --i >= 0;) { @@ -230,4 +256,127 @@ public final class GeometryTool { } } } + + /** + * Converts an indexed geometry into a non indexed geometry + * + * + * @param meshData + * mesh data + */ + public void convertIndexedGeometryIntoNonIndexedGeometry(final MeshData meshData) { + final IndexBufferData<?> indices = meshData.getIndices(); + if (indices != null) { + final FloatBuffer previousVertexBuffer = meshData.getVertexBuffer(); + if (previousVertexBuffer != null) { + final int valuesPerVertexTuple = meshData.getVertexCoords().getValuesPerTuple(); + final FloatBuffer nextVertexBuffer = nioBuffersAllocationOnHeapEnabled + ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerVertexTuple) + : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerVertexTuple); + for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) { + final int vertexIndex = indices.get(indexIndex); + for (int coordIndex = 0; coordIndex < valuesPerVertexTuple; coordIndex++) { + final float vertexCoordValue = previousVertexBuffer + .get((vertexIndex * valuesPerVertexTuple) + coordIndex); + nextVertexBuffer.put((indexIndex * valuesPerVertexTuple) + coordIndex, vertexCoordValue); + } + } + meshData.setVertexCoords(new FloatBufferData(nextVertexBuffer, valuesPerVertexTuple)); + } + final FloatBuffer previousNormalBuffer = meshData.getNormalBuffer(); + if (previousNormalBuffer != null) { + final int valuesPerNormalTuple = meshData.getNormalCoords().getValuesPerTuple(); + final FloatBuffer nextNormalBuffer = nioBuffersAllocationOnHeapEnabled + ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerNormalTuple) + : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerNormalTuple); + for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) { + final int vertexIndex = indices.get(indexIndex); + for (int coordIndex = 0; coordIndex < valuesPerNormalTuple; coordIndex++) { + final float normalCoordValue = previousNormalBuffer + .get((vertexIndex * valuesPerNormalTuple) + coordIndex); + nextNormalBuffer.put((indexIndex * valuesPerNormalTuple) + coordIndex, normalCoordValue); + } + } + meshData.setNormalCoords(new FloatBufferData(nextNormalBuffer, valuesPerNormalTuple)); + } + final FloatBuffer previousColorBuffer = meshData.getColorBuffer(); + if (previousColorBuffer != null) { + final int valuesPerColorTuple = meshData.getColorCoords().getValuesPerTuple(); + final FloatBuffer nextColorBuffer = nioBuffersAllocationOnHeapEnabled + ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerColorTuple) + : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerColorTuple); + for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) { + final int vertexIndex = indices.get(indexIndex); + for (int coordIndex = 0; coordIndex < valuesPerColorTuple; coordIndex++) { + final float colorCoordValue = previousColorBuffer + .get((vertexIndex * valuesPerColorTuple) + coordIndex); + nextColorBuffer.put((indexIndex * valuesPerColorTuple) + coordIndex, colorCoordValue); + } + } + meshData.setColorCoords(new FloatBufferData(nextColorBuffer, valuesPerColorTuple)); + } + final FloatBuffer previousFogBuffer = meshData.getFogBuffer(); + if (previousFogBuffer != null) { + final int valuesPerFogTuple = meshData.getFogCoords().getValuesPerTuple(); + final FloatBuffer nextFogBuffer = nioBuffersAllocationOnHeapEnabled + ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerFogTuple) + : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerFogTuple); + for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) { + final int vertexIndex = indices.get(indexIndex); + for (int coordIndex = 0; coordIndex < valuesPerFogTuple; coordIndex++) { + final float fogCoordValue = previousFogBuffer + .get((vertexIndex * valuesPerFogTuple) + coordIndex); + nextFogBuffer.put((indexIndex * valuesPerFogTuple) + coordIndex, fogCoordValue); + } + } + meshData.setFogCoords(new FloatBufferData(nextFogBuffer, valuesPerFogTuple)); + } + final FloatBuffer previousTangentBuffer = meshData.getTangentBuffer(); + if (previousTangentBuffer != null) { + final int valuesPerTangentTuple = meshData.getTangentCoords().getValuesPerTuple(); + final FloatBuffer nextTangentBuffer = nioBuffersAllocationOnHeapEnabled + ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerTangentTuple) + : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerTangentTuple); + for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) { + final int vertexIndex = indices.get(indexIndex); + for (int coordIndex = 0; coordIndex < valuesPerTangentTuple; coordIndex++) { + final float tangentCoordValue = previousTangentBuffer + .get((vertexIndex * valuesPerTangentTuple) + coordIndex); + nextTangentBuffer.put((indexIndex * valuesPerTangentTuple) + coordIndex, tangentCoordValue); + } + } + meshData.setTangentCoords(new FloatBufferData(nextTangentBuffer, valuesPerTangentTuple)); + } + final int numberOfUnits = meshData.getNumberOfUnits(); + if (numberOfUnits > 0) { + final List<FloatBufferData> previousTextureCoordsList = meshData.getTextureCoords(); + final List<FloatBufferData> nextTextureCoordsList = new ArrayList<>(); + for (int unitIndex = 0; unitIndex < numberOfUnits; unitIndex++) { + final FloatBufferData previousTextureCoords = previousTextureCoordsList.get(unitIndex); + if (previousTextureCoords == null) { + nextTextureCoordsList.add(null); + } else { + final FloatBuffer previousTextureBuffer = previousTextureCoords.getBuffer(); + final int valuesPerTextureTuple = previousTextureCoords.getValuesPerTuple(); + final FloatBuffer nextTextureBuffer = nioBuffersAllocationOnHeapEnabled + ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerTextureTuple) + : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerTextureTuple); + for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) { + final int vertexIndex = indices.get(indexIndex); + for (int coordIndex = 0; coordIndex < valuesPerTextureTuple; coordIndex++) { + final float textureCoordValue = previousTextureBuffer + .get((vertexIndex * valuesPerTextureTuple) + coordIndex); + nextTextureBuffer.put((indexIndex * valuesPerTextureTuple) + coordIndex, + textureCoordValue); + } + } + nextTextureCoordsList.add(new FloatBufferData(nextTextureBuffer, valuesPerTextureTuple)); + } + } + meshData.setTextureCoords(nextTextureCoordsList); + } + // removes the index buffer + meshData.setIndices(null); + } + } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java index fdc3f7c..8e27e45 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,6 +12,8 @@ package com.ardor3d.util.geom; import java.nio.FloatBuffer; import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.EnumMap; import java.util.List; @@ -28,7 +30,6 @@ import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.scenegraph.visitor.Visitor; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Lists; import com.google.common.collect.Multimap; /** @@ -62,7 +63,7 @@ public class MeshCombiner { } public final static Mesh combine(final Spatial source, final MeshCombineLogic logic) { - final List<Mesh> sources = Lists.newArrayList(); + final List<Mesh> sources = new ArrayList<>(); source.acceptVisitor(new Visitor() { @Override public void visit(final Spatial spatial) { @@ -85,7 +86,7 @@ public class MeshCombiner { * @return the combined Mesh. */ public final static Mesh combine(final Mesh... sources) { - return combine(Lists.newArrayList(sources)); + return combine(new ArrayList<>(Arrays.asList(sources))); } /** @@ -128,7 +129,7 @@ public class MeshCombiner { protected EnumMap<StateType, RenderState> states = null; protected MeshData data = new MeshData(); protected BoundingVolume volumeType = null; - protected List<Mesh> sources = Lists.newArrayList(); + protected List<Mesh> sources = new ArrayList<>(); private FloatBufferData vertices; private FloatBufferData colors; private FloatBufferData normals; @@ -236,7 +237,7 @@ public class MeshCombiner { normals = useNormals ? new FloatBufferData(totalVertices * 3, 3) : null; data.setNormalCoords(normals); - texCoordsList = Lists.newArrayListWithCapacity(maxTextures); + texCoordsList = new ArrayList<>(maxTextures); for (int i = 0; i < maxTextures; i++) { texCoordsList.add(new FloatBufferData(totalVertices * texCoords, texCoords)); } @@ -358,8 +359,8 @@ class IndexCombiner { } public void saveTo(final MeshData data) { - final List<IntBuffer> sections = Lists.newArrayList(); - final List<IndexMode> modes = Lists.newArrayList(); + final List<IntBuffer> sections = new ArrayList<>(); + final List<IndexMode> modes = new ArrayList<>(); int max = 0; // walk through index modes and combine those we can. for (final IndexMode mode : sectionMap.keySet()) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NonIndexedNormalGenerator.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NonIndexedNormalGenerator.java index 78ef6d2..bc10271 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NonIndexedNormalGenerator.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NonIndexedNormalGenerator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java index 8eb80a4..3efa843 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2018 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -250,12 +250,12 @@ public class NormalGenerator { */ private void initialize() { // Copy the source vertices as a base for the normal generation - _destVerts = new ArrayList<Vector3>(_sourceVerts.length); + _destVerts = new ArrayList<>(_sourceVerts.length); for (int i = 0; i < _sourceVerts.length; i++) { _destVerts.add(_sourceVerts[i]); } if (_sourceColors != null) { - _destColors = new ArrayList<ColorRGBA>(_sourceColors.length); + _destColors = new ArrayList<>(_sourceColors.length); for (int i = 0; i < _sourceColors.length; i++) { _destColors.add(_sourceColors[i]); } @@ -263,7 +263,7 @@ public class NormalGenerator { _destColors = null; } if (_sourceTexCoords != null) { - _destTexCoords = new ArrayList<Vector2>(_sourceTexCoords.length); + _destTexCoords = new ArrayList<>(_sourceTexCoords.length); for (int i = 0; i < _sourceTexCoords.length; i++) { _destTexCoords.add(_sourceTexCoords[i]); } @@ -272,7 +272,7 @@ public class NormalGenerator { } // Set up the base triangles of the mesh and their face normals - _triangles = new LinkedList<Triangle>(); + _triangles = new LinkedList<>(); for (int i = 0; i * 3 < _sourceInds.length; i++) { final Triangle tri = new Triangle(_sourceInds[i * 3 + 0], _sourceInds[i * 3 + 1], _sourceInds[i * 3 + 2]); tri.computeNormal(_sourceVerts); @@ -281,12 +281,12 @@ public class NormalGenerator { // Set up the lists to store the created mesh split data if (_splitMeshes == null) { - _splitMeshes = new LinkedList<LinkedList<Triangle>>(); + _splitMeshes = new LinkedList<>(); } else { _splitMeshes.clear(); } if (_splitMeshBorders == null) { - _splitMeshBorders = new LinkedList<LinkedList<Edge>>(); + _splitMeshBorders = new LinkedList<>(); } else { _splitMeshBorders.clear(); } @@ -298,8 +298,8 @@ public class NormalGenerator { * border of the split mesh in splitMeshBorders. */ private void createMeshSplit() { - _destTris = new LinkedList<Triangle>(); - _edges = new LinkedList<Edge>(); + _destTris = new LinkedList<>(); + _edges = new LinkedList<>(); final Triangle tri = _triangles.removeFirst(); _destTris.addLast(tri); _edges.addLast(tri.edges[0]); @@ -322,6 +322,7 @@ public class NormalGenerator { * * @return The triangle, if one was found, or <code>null</code> otherwise */ + @SuppressWarnings("null") private Triangle insertTriangle() { final ListIterator<Triangle> triIt = _triangles.listIterator(); ListIterator<Edge> edgeIt = null; diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/SceneCopier.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/SceneCopier.java index cb018e6..58d1596 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/SceneCopier.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/SceneCopier.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/SharedCopyLogic.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/SharedCopyLogic.java index 048086f..21fcdc4 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/SharedCopyLogic.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/SharedCopyLogic.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -27,6 +27,7 @@ import com.ardor3d.scenegraph.Spatial; public class SharedCopyLogic implements CopyLogic { private static final Logger logger = Logger.getLogger(SharedCopyLogic.class.getName()); + @Override public Spatial copy(final Spatial source, final AtomicBoolean recurse) { recurse.set(false); if (source instanceof Node) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/TangentUtil.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/TangentUtil.java index afa63c8..a907213 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/TangentUtil.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/TangentUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java index 91bc14a..e5d1746 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,16 +11,16 @@ package com.ardor3d.util.geom; import java.util.EnumSet; +import java.util.HashMap; import java.util.Map; import com.ardor3d.util.geom.GeometryTool.MatchCondition; -import com.google.common.collect.Maps; public class VertGroupData { public static final int DEFAULT_GROUP = 0; - private final Map<Long, EnumSet<MatchCondition>> _groupConditions = Maps.newHashMap(); + private final Map<Long, EnumSet<MatchCondition>> _groupConditions = new HashMap<>(); private long[] _vertGroups = null; public VertGroupData() {} diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertKey.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertKey.java index 2d0621b..f398d32 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertKey.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertKey.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertMap.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertMap.java index bb33c38..dc89242 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertMap.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertMap.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/MultiFormatResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/MultiFormatResourceLocator.java index 7ed7ce2..e84e64f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/MultiFormatResourceLocator.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/MultiFormatResourceLocator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java index 5f959f9..3ed501f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -20,7 +20,7 @@ public class RelativeResourceLocator implements ResourceLocator { /** * Construct a new RelativeResourceLocator using the given source as our base. - * + * * @param resource * our base source. */ @@ -34,6 +34,7 @@ public class RelativeResourceLocator implements ResourceLocator { return _baseSource; } + @Override public ResourceSource locateResource(String resourceName) { // Trim off any prepended local dir. while (resourceName.startsWith("./") && resourceName.length() > 2) { @@ -53,4 +54,9 @@ public class RelativeResourceLocator implements ResourceLocator { } return false; } + + @Override + public int hashCode() { + return _baseSource.hashCode(); + } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocator.java index 8353527..235caab 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocator.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java index 2fdc2cc..85185fc 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -18,14 +18,13 @@ import java.net.URLDecoder; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import com.google.common.collect.Sets; - /** * Manager class for locator utility classes used to find various assets. (XXX: Needs more documentation) */ @@ -38,7 +37,7 @@ public class ResourceLocatorTool { public static final String TYPE_AUDIO = "audio"; public static final String TYPE_SHADER = "shader"; - private static final Map<String, List<ResourceLocator>> _locatorMap = new HashMap<String, List<ResourceLocator>>(); + private static final Map<String, List<ResourceLocator>> _locatorMap = new HashMap<>(); public static ResourceSource locateResource(final String resourceType, String resourceName) { if (resourceName == null) { @@ -69,11 +68,11 @@ public class ResourceLocatorTool { return new URLResourceSource(u); } } catch (final Exception e) { - logger.logp(Level.WARNING, ResourceLocatorTool.class.getName(), "locateResource(String, String)", e - .getMessage(), e); + logger.logp(Level.WARNING, ResourceLocatorTool.class.getName(), "locateResource(String, String)", + e.getMessage(), e); } - logger.warning("Unable to locate: " + resourceName); + logger.warning("Unable to locate: " + resourceName + " of type " + resourceType); return null; } } @@ -85,7 +84,7 @@ public class ResourceLocatorTool { synchronized (_locatorMap) { List<ResourceLocator> bases = _locatorMap.get(resourceType); if (bases == null) { - bases = new ArrayList<ResourceLocator>(); + bases = new ArrayList<>(); _locatorMap.put(resourceType, bases); } @@ -163,7 +162,7 @@ public class ResourceLocatorTool { * @return a set containing the located URLs of the named resource. */ public static Set<URL> getClassPathResources(final Class<?> clazz, final String name) { - final Set<URL> results = Sets.newHashSet(); + final Set<URL> results = new HashSet<>(); Enumeration<URL> urls = null; try { urls = Thread.currentThread().getContextClassLoader().getResources(name); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceSource.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceSource.java index 0e6f024..895c186 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceSource.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java index 580f408..b7a73c3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -27,7 +27,7 @@ public class SimpleResourceLocator implements ResourceLocator { /** * Construct a new SimpleResourceLocator using the given URI as our context. - * + * * @param baseDir * our base context. This is meant to be a "directory" wherein we will search for resources. Therefore, * if it does not end in /, a / will be added to ensure we are talking about children of the given @@ -52,7 +52,7 @@ public class SimpleResourceLocator implements ResourceLocator { /** * Construct a new SimpleResourceLocator using the given URL as our context. - * + * * @param baseDir * our base context. This is converted to a URI. This is meant to be a "directory" wherein we will search * for resources. Therefore, if it does not end in /, a / will be added to ensure we are talking about @@ -71,6 +71,7 @@ public class SimpleResourceLocator implements ResourceLocator { return _baseDir; } + @Override public ResourceSource locateResource(final String resourceName) { return doRecursiveLocate(cleanup(resourceName)); } @@ -135,4 +136,9 @@ public class SimpleResourceLocator implements ResourceLocator { } return false; } + + @Override + public int hashCode() { + return _baseDir.hashCode(); + } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/StringResourceSource.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/StringResourceSource.java index 69a2339..e0c1432 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/StringResourceSource.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/StringResourceSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -60,6 +60,7 @@ public class StringResourceSource implements ResourceSource { /** * Returns "string resource" as strings have no name. */ + @Override public String getName() { return "string resource"; } @@ -67,6 +68,7 @@ public class StringResourceSource implements ResourceSource { /** * Returns null and logs a warning as this is not supported. */ + @Override public ResourceSource getRelativeSource(final String name) { if (logger.isLoggable(Level.WARNING)) { logger.logp(Level.WARNING, getClass().getName(), "getRelativeSource(String)", @@ -75,6 +77,7 @@ public class StringResourceSource implements ResourceSource { return null; } + @Override public String getType() { return _type; } @@ -82,6 +85,7 @@ public class StringResourceSource implements ResourceSource { /** * Grabs our data as a UTF8 byte array and returns it in a ByteArrayInputStream. */ + @Override public InputStream openStream() throws IOException { return new ByteArrayInputStream(_data.getBytes("UTF8")); } @@ -90,15 +94,18 @@ public class StringResourceSource implements ResourceSource { // Methods for Savable // ///////////////// + @Override public Class<?> getClassTag() { return StringResourceSource.class; } + @Override public void read(final InputCapsule capsule) throws IOException { _data = capsule.readString("data", null); _type = capsule.readString("type", null); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_data, "data", null); capsule.write(_type, "type", null); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java index 9bcc3c0..ae1885c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -15,6 +15,7 @@ import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; +import java.util.Objects; import java.util.logging.Level; import java.util.logging.Logger; @@ -38,7 +39,7 @@ public class URLResourceSource implements ResourceSource { /** * Construct a new URLResourceSource from a specific URL. - * + * * @param sourceUrl * The url to load the resource from. Must not be null. If the URL has a valid URL filename (see * {@link URL#getFile()}) and an extension (eg. http://url/myFile.png) then the extension (.png in this @@ -62,7 +63,7 @@ public class URLResourceSource implements ResourceSource { /** * Construct a new URLResourceSource from a specific URL and type. - * + * * @param sourceUrl * The url to load the resource from. Must not be null. * @param type @@ -76,6 +77,7 @@ public class URLResourceSource implements ResourceSource { _type = type; } + @Override public ResourceSource getRelativeSource(final String name) { try { final URL srcURL = UrlUtils.resolveRelativeURL(_url, "./" + name); @@ -106,10 +108,12 @@ public class URLResourceSource implements ResourceSource { return _url; } + @Override public String getName() { return _urlToString; } + @Override public String getType() { return _type; } @@ -118,6 +122,7 @@ public class URLResourceSource implements ResourceSource { _type = type; } + @Override public InputStream openStream() throws IOException { return _url.openStream(); } @@ -132,11 +137,7 @@ public class URLResourceSource implements ResourceSource { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((_type == null) ? 0 : _type.hashCode()); - result = prime * result + ((_urlToString == null) ? 0 : _urlToString.hashCode()); - return result; + return Objects.hash(getType(), getName()); } @Override @@ -168,10 +169,12 @@ public class URLResourceSource implements ResourceSource { return true; } + @Override public Class<?> getClassTag() { return URLResourceSource.class; } + @Override public void read(final InputCapsule capsule) throws IOException { final String protocol = capsule.readString("protocol", null); final String host = capsule.readString("host", null); @@ -194,6 +197,7 @@ public class URLResourceSource implements ResourceSource { _type = capsule.readString("type", null); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_url.getProtocol(), "protocol", null); capsule.write(_url.getHost(), "host", null); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/CompileOptions.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/CompileOptions.java index 3f9af0e..7782137 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/CompileOptions.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/CompileOptions.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java index b8f5680..64f569b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,6 +12,7 @@ package com.ardor3d.util.scenegraph; import java.lang.ref.ReferenceQueue; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.renderer.ContextCleanListener; import com.ardor3d.renderer.ContextManager; @@ -22,20 +23,20 @@ import com.ardor3d.scenegraph.Spatial; import com.ardor3d.util.GameTaskQueueManager; import com.ardor3d.util.SimpleContextIdReference; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.MapMaker; import com.google.common.collect.Multimap; public class DisplayListDelegate implements RenderDelegate { - private static Map<DisplayListDelegate, Object> _identityCache = new MapMaker().weakKeys().makeMap(); + private static Map<DisplayListDelegate, Object> _identityCache = new WeakHashMap<>(); private static final Object STATIC_REF = new Object(); - private static ReferenceQueue<DisplayListDelegate> _refQueue = new ReferenceQueue<DisplayListDelegate>(); + private static ReferenceQueue<DisplayListDelegate> _refQueue = new ReferenceQueue<>(); static { ContextManager.addContextCleanListener(new ContextCleanListener() { + @Override public void cleanForContext(final RenderContext renderContext) { - // TODO: Need a way to call back to the creator of the display list? + // TODO: Need a way to call back to the creator of the display list? } }); } @@ -43,10 +44,11 @@ public class DisplayListDelegate implements RenderDelegate { private final SimpleContextIdReference<DisplayListDelegate> _id; public DisplayListDelegate(final int id, final Object glContext) { - _id = new SimpleContextIdReference<DisplayListDelegate>(this, _refQueue, id, glContext); + _id = new SimpleContextIdReference<>(this, _refQueue, id, glContext); _identityCache.put(this, STATIC_REF); } + @Override public void render(final Spatial spatial, final Renderer renderer) { // do transforms final boolean transformed = renderer.doTransforms(spatial.getWorldTransform()); @@ -118,6 +120,7 @@ public class DisplayListDelegate implements RenderDelegate { else { GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)).render( new RendererCallable<Void>() { + @Override public Void call() throws Exception { getRenderer().deleteDisplayLists(idMap.get(glref)); return null; diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/RenderDelegate.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/RenderDelegate.java index 3b43e29..76597ee 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/RenderDelegate.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/RenderDelegate.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/SceneCompiler.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/SceneCompiler.java index 285806e..9b4d34b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/SceneCompiler.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/SceneCompiler.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -75,6 +75,7 @@ public class SceneCompiler { _renderer = renderer; } + @Override public void visit(final Spatial spatial) { if (spatial instanceof Mesh) { final Mesh mesh = (Mesh) spatial; diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExportable.java b/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExportable.java index 2031798..3125ae2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExportable.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExportable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExporter.java index 1b50d69..68545b5 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExporter.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExporter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java index a425753..bd88b4b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -11,6 +11,7 @@ package com.ardor3d.util.shader; import java.io.IOException; +import java.util.Objects; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; @@ -40,33 +41,53 @@ public class ShaderVariable implements Savable { } @Override - public boolean equals(final Object o) { - if (this == o) { + public int hashCode() { + return Objects.hash(name, Integer.valueOf(variableID)); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { return true; } - if (!(o instanceof ShaderVariable)) { + if (obj == null) { return false; } - final ShaderVariable comp = (ShaderVariable) o; + if (getClass() != obj.getClass()) { + return false; + } + final ShaderVariable other = (ShaderVariable) obj; if (variableID != -1) { - return comp.variableID == variableID; - } else if (comp.variableID != -1) { - return comp.variableID == variableID; + return other.variableID == variableID; + } else if (other.variableID != -1) { + return other.variableID == variableID; } else { - return (name.equals(comp.name)); + return (equals(name, other.name)); } } + // TODO replace it by java.util.Objects.equals(Object, Object) + private boolean equals(final Object a, final Object b) { + if (a == b) { + return true; + } else { + return a != null && a.equals(b); + } + } + + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(name, "name", ""); capsule.write(variableID, "variableID", -1); } + @Override public void read(final InputCapsule capsule) throws IOException { name = capsule.readString("name", ""); variableID = capsule.readInt("variableID", -1); } + @Override public Class<? extends ShaderVariable> getClassTag() { return this.getClass(); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat.java index ea380fa..4c2de57 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat2.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat2.java index ff6f7b1..28a821c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat2.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat2.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat3.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat3.java index 076f5de..e263986 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat3.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat4.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat4.java index 2aef387..02891ad 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat4.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat4.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloatArray.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloatArray.java index fbbd891..25193ef 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloatArray.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloatArray.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.util.shader.uniformtypes;
import java.io.IOException;
import java.nio.FloatBuffer;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.shader.ShaderVariable;
/** ShaderVariableFloatArray */
public class ShaderVariableFloatArray extends ShaderVariable {
public FloatBuffer value;
/**
* Specifies the number of values for each element of the array. Must be 1, 2, 3, or 4.
*/
public int size = 1;
@Override
public boolean hasData() {
return value != null;
}
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
capsule.write(value, "value", null);
capsule.write(size, "size", 1);
}
@Override
public void read(final InputCapsule capsule) throws IOException {
super.read(capsule);
value = capsule.readFloatBuffer("value", null);
size = capsule.readInt("size", 1);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.util.shader.uniformtypes;
import java.io.IOException;
import java.nio.FloatBuffer;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.shader.ShaderVariable;
/** ShaderVariableFloatArray */
public class ShaderVariableFloatArray extends ShaderVariable {
public FloatBuffer value;
/**
* Specifies the number of values for each element of the array. Must be 1, 2, 3, or 4.
*/
public int size = 1;
@Override
public boolean hasData() {
return value != null;
}
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
capsule.write(value, "value", null);
capsule.write(size, "size", 1);
}
@Override
public void read(final InputCapsule capsule) throws IOException {
super.read(capsule);
value = capsule.readFloatBuffer("value", null);
size = capsule.readInt("size", 1);
}
}
\ No newline at end of file diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt.java index d3f09a9..021b22b 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt2.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt2.java index fc9e4ca..b9b00d3 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt2.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt2.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt3.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt3.java index ac859cd..665a02f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt3.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt4.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt4.java index 52184bc..487423d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt4.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt4.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableIntArray.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableIntArray.java index ca3f21b..9c85dfb 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableIntArray.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableIntArray.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.util.shader.uniformtypes;
import java.io.IOException;
import java.nio.IntBuffer;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.shader.ShaderVariable;
/** ShaderVariableIntArray */
public class ShaderVariableIntArray extends ShaderVariable {
public IntBuffer value;
/**
* Specifies the number of values for each element of the array. Must be 1, 2, 3, or 4.
*/
public int size = 1;
@Override
public boolean hasData() {
return value != null;
}
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
capsule.write(value, "value", null);
capsule.write(size, "size", 1);
}
@Override
public void read(final InputCapsule capsule) throws IOException {
super.read(capsule);
value = capsule.readIntBuffer("value", null);
size = capsule.readInt("size", 1);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.util.shader.uniformtypes;
import java.io.IOException;
import java.nio.IntBuffer;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.shader.ShaderVariable;
/** ShaderVariableIntArray */
public class ShaderVariableIntArray extends ShaderVariable {
public IntBuffer value;
/**
* Specifies the number of values for each element of the array. Must be 1, 2, 3, or 4.
*/
public int size = 1;
@Override
public boolean hasData() {
return value != null;
}
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
capsule.write(value, "value", null);
capsule.write(size, "size", 1);
}
@Override
public void read(final InputCapsule capsule) throws IOException {
super.read(capsule);
value = capsule.readIntBuffer("value", null);
size = capsule.readInt("size", 1);
}
}
\ No newline at end of file diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix2.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix2.java index 2727fad..66acda2 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix2.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix2.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix3.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix3.java index ab2320c..a3a74b6 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix3.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4.java index eb2a4d0..486187f 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4Array.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4Array.java index a638270..a6d71bc 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4Array.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4Array.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.util.shader.uniformtypes;
import java.io.IOException;
import java.nio.FloatBuffer;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.shader.ShaderVariable;
/** ShaderVariableMatrix4Array */
public class ShaderVariableMatrix4Array extends ShaderVariable {
public FloatBuffer matrixBuffer;
public boolean rowMajor;
@Override
public boolean hasData() {
return matrixBuffer != null;
}
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
capsule.write(matrixBuffer, "matrixBuffer", null);
capsule.write(rowMajor, "rowMajor", false);
}
@Override
public void read(final InputCapsule capsule) throws IOException {
super.read(capsule);
matrixBuffer = capsule.readFloatBuffer("matrixBuffer", null);
rowMajor = capsule.readBoolean("rowMajor", false);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.util.shader.uniformtypes;
import java.io.IOException;
import java.nio.FloatBuffer;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.shader.ShaderVariable;
/** ShaderVariableMatrix4Array */
public class ShaderVariableMatrix4Array extends ShaderVariable {
public FloatBuffer matrixBuffer;
public boolean rowMajor;
@Override
public boolean hasData() {
return matrixBuffer != null;
}
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
capsule.write(matrixBuffer, "matrixBuffer", null);
capsule.write(rowMajor, "rowMajor", false);
}
@Override
public void read(final InputCapsule capsule) throws IOException {
super.read(capsule);
matrixBuffer = capsule.readFloatBuffer("matrixBuffer", null);
rowMajor = capsule.readBoolean("rowMajor", false);
}
}
\ No newline at end of file diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerByte.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerByte.java index 4c8e7bf..dda2961 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerByte.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerByte.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloat.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloat.java index 6da1c17..c5aa956 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloat.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloat.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloatMatrix.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloatMatrix.java index 6f5a5f7..8e3c802 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloatMatrix.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloatMatrix.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerInt.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerInt.java index eaa90cb..f835a7c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerInt.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerInt.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerShort.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerShort.java index 48a0d37..3f901df 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerShort.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerShort.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java index 1674c86..d3d6295 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -13,10 +13,8 @@ package com.ardor3d.util.stat; import java.util.HashMap; import java.util.Set; -import com.google.common.collect.Maps; - public class MultiStatSample { - private final HashMap<StatType, StatValue> _values = Maps.newHashMap(); + private final HashMap<StatType, StatValue> _values = new HashMap<>(); private double _elapsedTime = 0.0; public static MultiStatSample createNew(final HashMap<StatType, StatValue> current) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java index 51e3432..52af43a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.util.stat; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -19,7 +20,6 @@ import java.util.Stack; import java.util.logging.Logger; import com.ardor3d.util.Timer; -import com.google.common.collect.Lists; /** * This class acts as a centralized data store for statistics. As data is added to the collector, a sum total is kept as @@ -38,7 +38,7 @@ public abstract class StatCollector { * Our map of current stat values. Current means values that have been collected within the current time sample. For * example, if sampleRate = 1.0, then current will hold values collected since the last 1 second ping. */ - protected static HashMap<StatType, StatValue> current = new HashMap<StatType, StatValue>(); + protected static HashMap<StatType, StatValue> current = new HashMap<>(); protected static List<MultiStatSample> historical = Collections.synchronizedList(new LinkedList<MultiStatSample>()); @@ -51,14 +51,14 @@ public abstract class StatCollector { protected static double lastTimeCheckMS = 0; - protected static List<StatListener> listeners = Lists.newArrayList(); + protected static List<StatListener> listeners = new ArrayList<>(); protected static double startOffset = 0; protected static boolean ignoreStats = false; - protected static Stack<StatType> timeStatStack = new Stack<StatType>(); - protected static HashSet<StatType> timedStats = new HashSet<StatType>(); + protected static Stack<StatType> timeStatStack = new Stack<>(); + protected static HashSet<StatType> timedStats = new HashSet<>(); protected static Timer timer = new Timer(); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatListener.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatListener.java index 845b681..7818fa9 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatListener.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java index 2d4436f..6fba998 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java @@ -1,15 +1,17 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.util.stat; +import java.util.Objects; + public class StatType implements Comparable<StatType> { public static final StatType STAT_FRAMES = new StatType("_frames"); @@ -56,10 +58,10 @@ public class StatType implements Comparable<StatType> { @Override public int hashCode() { - final int hash = _statName.hashCode(); - return hash; + return Objects.hashCode(getStatName()); } + @Override public int compareTo(final StatType obj) { final StatType other = obj; return _statName.compareTo(other._statName); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatValue.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatValue.java index 6e748cf..591c849 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatValue.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatValue.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java index 10dc3b9..5e901de 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -31,14 +31,21 @@ public abstract class AbstractStatGrapher implements StatListener { protected Texture2D _texture; protected int _gWidth, _gHeight; - protected TreeMap<StatType, HashMap<String, Object>> _config = new TreeMap<StatType, HashMap<String, Object>>(); + protected TreeMap<StatType, HashMap<String, Object>> _config = new TreeMap<>(); protected boolean _enabled = true; /** * Must be constructed in the GL thread. - * - * @param factory + * + * @param width + * width + * @param height + * height + * @param renderer + * GL renderer + * @param caps + * context capabilities */ public AbstractStatGrapher(final int width, final int height, final Renderer renderer, final ContextCapabilities caps) { @@ -85,7 +92,7 @@ public abstract class AbstractStatGrapher implements StatListener { public void addConfig(final StatType type, final String key, final Object value) { HashMap<String, Object> vals = _config.get(type); if (vals == null) { - vals = new HashMap<String, Object>(); + vals = new HashMap<>(); _config.put(type, vals); } vals.put(key, value); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/DefColorFadeController.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/DefColorFadeController.java index c69b02f..6b12247 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/DefColorFadeController.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/DefColorFadeController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -61,6 +61,7 @@ public class DefColorFadeController implements SpatialController<Spatial> { _rate = rate; } + @Override public void update(final double time, final Spatial caller) { if (_target == null) { return; diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/GraphFactory.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/GraphFactory.java index a93c02e..949594d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/GraphFactory.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/GraphFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java index 544b530..3d7943a 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -53,7 +53,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable { private static final int majorHBar = 20; private static final int majorVBar = 10; - private final HashMap<StatType, LineEntry> _entries = new HashMap<StatType, LineEntry>(); + private final HashMap<StatType, LineEntry> _entries = new HashMap<>(); private BlendState _defBlendState = null; @@ -72,6 +72,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable { _graphRoot.getSceneHints().setCullHint(CullHint.Never); } + @Override public void statsUpdated() { if (!isEnabled() || !Constants.updateGraphs) { return; @@ -266,7 +267,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable { } class LineEntry { - public List<Vector3> verts = new ArrayList<Vector3>(); + public List<Vector3> verts = new ArrayList<>(); public int maxSamples; public double min = 0; public double max = 10; @@ -301,6 +302,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable { } } + @Override public Line updateLineKey(final StatType type, Line lineKey) { if (lineKey == null) { lineKey = new Line("lk", BufferUtils.createVector3Buffer(2), null, null, null); diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TableLinkable.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TableLinkable.java index 2cdd290..91ef72e 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TableLinkable.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TableLinkable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java index bd32181..82371f1 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -48,7 +48,7 @@ public class TabledLabelGrapher extends AbstractStatGrapher { protected BlendState _defBlendState = null; - private final HashMap<StatType, LabelEntry> _entries = new HashMap<StatType, LabelEntry>(); + private final HashMap<StatType, LabelEntry> _entries = new HashMap<>(); private boolean _minimalBackground; @@ -69,6 +69,7 @@ public class TabledLabelGrapher extends AbstractStatGrapher { _graphRoot.getSceneHints().setCullHint(CullHint.Never); } + @Override public void statsUpdated() { if (!isEnabled() || !Constants.updateGraphs) { return; diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java index bc336d5..0d6cfb6 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -53,7 +53,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab private static final int majorHBar = 20; private static final int majorVBar = 10; - private final HashMap<StatType, AreaEntry> _entries = new HashMap<StatType, AreaEntry>(); + private final HashMap<StatType, AreaEntry> _entries = new HashMap<>(); private BlendState _defBlendState = null; @@ -72,6 +72,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab _graphRoot.getSceneHints().setCullHint(CullHint.Never); } + @Override public void statsUpdated() { if (!isEnabled() || !Constants.updateGraphs) { return; @@ -262,7 +263,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab } class AreaEntry { - public List<Vector3> verts = new ArrayList<Vector3>(); + public List<Vector3> verts = new ArrayList<>(); public int maxSamples; public boolean visited; public Mesh area; @@ -282,6 +283,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab } } + @Override public Line updateLineKey(final StatType type, Line lineKey) { if (lineKey == null) { lineKey = new Line("lk", BufferUtils.createVector3Buffer(2), null, null, null); diff --git a/ardor3d-core/src/test/java/com/ardor3d/bounding/TestBounding.java b/ardor3d-core/src/test/java/com/ardor3d/bounding/TestBounding.java index 5a9fbab..3201975 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/bounding/TestBounding.java +++ b/ardor3d-core/src/test/java/com/ardor3d/bounding/TestBounding.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/test/java/com/ardor3d/bounding/TestRayBounding.java b/ardor3d-core/src/test/java/com/ardor3d/bounding/TestRayBounding.java index 9c28b6c..2db251d 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/bounding/TestRayBounding.java +++ b/ardor3d-core/src/test/java/com/ardor3d/bounding/TestRayBounding.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/TestKeyboardState.java b/ardor3d-core/src/test/java/com/ardor3d/input/TestKeyboardState.java index b5b40e8..eafd591 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/input/TestKeyboardState.java +++ b/ardor3d-core/src/test/java/com/ardor3d/input/TestKeyboardState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java b/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java index cc0dbb8..002fb97 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java +++ b/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -38,15 +38,15 @@ public class TestPhysicalLayer { Object[] mocks; - List<KeyEvent> noKeys = new LinkedList<KeyEvent>(); - List<KeyEvent> Adown = new LinkedList<KeyEvent>(); - List<KeyEvent> AdownBdown = new LinkedList<KeyEvent>(); - List<KeyEvent> AdownAup = new LinkedList<KeyEvent>(); + List<KeyEvent> noKeys = new LinkedList<>(); + List<KeyEvent> Adown = new LinkedList<>(); + List<KeyEvent> AdownBdown = new LinkedList<>(); + List<KeyEvent> AdownAup = new LinkedList<>(); - List<ControllerEvent> nothing = new LinkedList<ControllerEvent>(); + List<ControllerEvent> nothing = new LinkedList<>(); - List<MouseState> buttonDown = new LinkedList<MouseState>(); - List<MouseState> noMice = new LinkedList<MouseState>(); + List<MouseState> buttonDown = new LinkedList<>(); + List<MouseState> noMice = new LinkedList<>(); List<InputState> inputStates; InputState is; diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java index dc13728..3ae0237 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java +++ b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -91,8 +91,8 @@ public class TestLogicalLayer { final double tpf = 14; - final LinkedList<InputState> states1 = new LinkedList<InputState>(); - final LinkedList<InputState> states2 = new LinkedList<InputState>(); + final LinkedList<InputState> states1 = new LinkedList<>(); + final LinkedList<InputState> states2 = new LinkedList<>(); states1.add(state1); states2.add(state2); @@ -120,8 +120,8 @@ public class TestLogicalLayer { final double tpf = 14; - final LinkedList<InputState> states1 = new LinkedList<InputState>(); - final LinkedList<InputState> states2 = new LinkedList<InputState>(); + final LinkedList<InputState> states1 = new LinkedList<>(); + final LinkedList<InputState> states2 = new LinkedList<>(); states1.add(state1); states2.add(state2); @@ -154,8 +154,8 @@ public class TestLogicalLayer { final double tpf = 14; - final LinkedList<InputState> states1 = new LinkedList<InputState>(); - final LinkedList<InputState> states2 = new LinkedList<InputState>(); + final LinkedList<InputState> states1 = new LinkedList<>(); + final LinkedList<InputState> states2 = new LinkedList<>(); states1.add(state1); states2.add(state2); @@ -188,8 +188,8 @@ public class TestLogicalLayer { final double tpf = 14; - final LinkedList<InputState> states1 = new LinkedList<InputState>(); - final LinkedList<InputState> states2 = new LinkedList<InputState>(); + final LinkedList<InputState> states1 = new LinkedList<>(); + final LinkedList<InputState> states2 = new LinkedList<>(); states1.add(state1); @@ -223,8 +223,8 @@ public class TestLogicalLayer { final double tpf = 14; - final LinkedList<InputState> states1 = new LinkedList<InputState>(); - final LinkedList<InputState> states2 = new LinkedList<InputState>(); + final LinkedList<InputState> states1 = new LinkedList<>(); + final LinkedList<InputState> states2 = new LinkedList<>(); states1.add(state1); states2.add(InputState.LOST_FOCUS); diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java index 2fde296..b9350a2 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java +++ b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java @@ -1,21 +1,19 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.input.logical; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; - import java.util.EnumMap; import java.util.EnumSet; +import org.junit.Assert; import org.junit.Test; import com.ardor3d.input.ButtonState; @@ -29,8 +27,8 @@ import com.ardor3d.input.MouseState; public class TestStandardConditions { final KeyboardState ks = new KeyboardState(EnumSet.noneOf(Key.class), KeyEvent.NOTHING); - final MouseState ms = new MouseState(0, 0, 0, 0, 0, MouseButton.makeMap(ButtonState.UP, ButtonState.UP, - ButtonState.UP), null); + final MouseState ms = new MouseState(0, 0, 0, 0, 0, + MouseButton.makeMap(ButtonState.UP, ButtonState.UP, ButtonState.UP), null); final ControllerState cs = new ControllerState(); InputState is1, is2, is3, is4, is5; @@ -40,8 +38,8 @@ public class TestStandardConditions { EnumMap<MouseButton, ButtonState> bothUp = MouseButton.makeMap(ButtonState.UP, ButtonState.UP, ButtonState.UP); EnumMap<MouseButton, ButtonState> upDown = MouseButton.makeMap(ButtonState.UP, ButtonState.DOWN, ButtonState.UP); EnumMap<MouseButton, ButtonState> downUp = MouseButton.makeMap(ButtonState.DOWN, ButtonState.UP, ButtonState.UP); - EnumMap<MouseButton, ButtonState> bothDown = MouseButton - .makeMap(ButtonState.DOWN, ButtonState.DOWN, ButtonState.UP); + EnumMap<MouseButton, ButtonState> bothDown = MouseButton.makeMap(ButtonState.DOWN, ButtonState.DOWN, + ButtonState.UP); @Test public void testKeyHeld1() throws Exception { @@ -51,16 +49,16 @@ public class TestStandardConditions { is2 = new InputState(aDown, ms, cs); is3 = new InputState(bDown, ms, cs); - assertFalse("not down", kh.apply(new TwoInputStates(is1, is1))); - assertTrue("down", kh.apply(new TwoInputStates(is1, is2))); - assertFalse("not down", kh.apply(new TwoInputStates(is1, is3))); - assertFalse("not down", kh.apply(new TwoInputStates(is2, is3))); - assertTrue("not down", kh.apply(new TwoInputStates(is2, is2))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is1))); + Assert.assertTrue("down", kh.apply(new TwoInputStates(is1, is2))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is3))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is3))); + Assert.assertTrue("not down", kh.apply(new TwoInputStates(is2, is2))); - assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); - assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY))); - assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1))); - assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2))); + Assert.assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); + Assert.assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY))); + Assert.assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1))); + Assert.assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2))); } @Test(expected = NullPointerException.class) @@ -76,16 +74,16 @@ public class TestStandardConditions { is2 = new InputState(aDown, ms, cs); is3 = new InputState(bDown, ms, cs); - assertFalse("not down", kh.apply(new TwoInputStates(is1, is1))); - assertTrue("down", kh.apply(new TwoInputStates(is1, is2))); - assertFalse("not down", kh.apply(new TwoInputStates(is1, is3))); - assertFalse("not down", kh.apply(new TwoInputStates(is2, is3))); - assertFalse("not down", kh.apply(new TwoInputStates(is2, is2))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is1))); + Assert.assertTrue("down", kh.apply(new TwoInputStates(is1, is2))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is3))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is3))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is2))); - assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); - assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY))); - assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1))); - assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2))); + Assert.assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); + Assert.assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY))); + Assert.assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1))); + Assert.assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2))); } @Test(expected = NullPointerException.class) @@ -101,16 +99,16 @@ public class TestStandardConditions { is2 = new InputState(aDown, ms, cs); is3 = new InputState(bDown, ms, cs); - assertFalse("not down", kh.apply(new TwoInputStates(is1, is1))); - assertFalse("not down", kh.apply(new TwoInputStates(is1, is2))); - assertFalse("not down", kh.apply(new TwoInputStates(is1, is3))); - assertTrue("not down", kh.apply(new TwoInputStates(is2, is3))); - assertFalse("not down", kh.apply(new TwoInputStates(is2, is2))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is1))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is2))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is3))); + Assert.assertTrue("not down", kh.apply(new TwoInputStates(is2, is3))); + Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is2))); - assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); - assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY))); - assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1))); - assertFalse("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2))); + Assert.assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); + Assert.assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY))); + Assert.assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1))); + Assert.assertFalse("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2))); } @Test(expected = NullPointerException.class) @@ -133,17 +131,17 @@ public class TestStandardConditions { is4 = new InputState(ks, ms4, cs); is5 = new InputState(ks, ms5, cs); - assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1))); - assertTrue("mm2", mm.apply(new TwoInputStates(is1, is2))); - assertFalse("mm3", mm.apply(new TwoInputStates(is2, is3))); - assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4))); - assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5))); - assertFalse("mm6", mm.apply(new TwoInputStates(is2, is2))); - - assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); - assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY))); - assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1))); - assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is2))); + Assert.assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1))); + Assert.assertTrue("mm2", mm.apply(new TwoInputStates(is1, is2))); + Assert.assertFalse("mm3", mm.apply(new TwoInputStates(is2, is3))); + Assert.assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4))); + Assert.assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5))); + Assert.assertFalse("mm6", mm.apply(new TwoInputStates(is2, is2))); + + Assert.assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); + Assert.assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY))); + Assert.assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1))); + Assert.assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is2))); } @Test @@ -161,16 +159,16 @@ public class TestStandardConditions { is4 = new InputState(ks, ms4, cs); is5 = new InputState(ks, ms5, cs); - assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1))); - assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2))); - assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3))); - assertFalse("mm4", mm.apply(new TwoInputStates(is3, is4))); - assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5))); + Assert.assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1))); + Assert.assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2))); + Assert.assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3))); + Assert.assertFalse("mm4", mm.apply(new TwoInputStates(is3, is4))); + Assert.assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5))); - assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); - assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY))); - assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1))); - assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3))); + Assert.assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); + Assert.assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY))); + Assert.assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1))); + Assert.assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3))); } @Test @@ -188,15 +186,15 @@ public class TestStandardConditions { is4 = new InputState(ks, ms4, cs); is5 = new InputState(ks, ms5, cs); - assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1))); - assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2))); - assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3))); - assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4))); - assertFalse("mm5", mm.apply(new TwoInputStates(is4, is5))); + Assert.assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1))); + Assert.assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2))); + Assert.assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3))); + Assert.assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4))); + Assert.assertFalse("mm5", mm.apply(new TwoInputStates(is4, is5))); - assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); - assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY))); - assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1))); - assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3))); + Assert.assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY))); + Assert.assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY))); + Assert.assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1))); + Assert.assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3))); } } diff --git a/ardor3d-core/src/test/java/com/ardor3d/renderer/queue/RenderBucketTypeTest.java b/ardor3d-core/src/test/java/com/ardor3d/renderer/queue/RenderBucketTypeTest.java index 93e0786..8faf1c7 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/renderer/queue/RenderBucketTypeTest.java +++ b/ardor3d-core/src/test/java/com/ardor3d/renderer/queue/RenderBucketTypeTest.java @@ -1,38 +1,39 @@ -package com.ardor3d.renderer.queue; -import org.junit.Test; +package com.ardor3d.renderer.queue; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.fail; +import org.junit.Test; + public class RenderBucketTypeTest { - @Test - public void getPrebucket() throws Exception { - RenderBucketType preBucket = RenderBucketType.getRenderBucketType("PreBucket"); - assertNotNull(preBucket); - - RenderBucketType preBucket2 = RenderBucketType.getRenderBucketType("PreBucket"); - assertSame(preBucket, preBucket2); - assertSame(RenderBucketType.PreBucket, preBucket); - } - - @Test - public void getUserDefined() throws Exception { - RenderBucketType myBucket = RenderBucketType.getRenderBucketType("MyBucket"); - assertNotNull(myBucket); - - RenderBucketType myBucket2 = RenderBucketType.getRenderBucketType("MyBucket"); - assertSame(myBucket, myBucket2); - } - - @Test - public void getWithNull() throws Exception { - try { - RenderBucketType nullBucket = RenderBucketType.getRenderBucketType(null); - fail(); - } catch (IllegalArgumentException e) { - } - } + @Test + public void getPrebucket() throws Exception { + final RenderBucketType preBucket = RenderBucketType.getRenderBucketType("PreBucket"); + assertNotNull(preBucket); + + final RenderBucketType preBucket2 = RenderBucketType.getRenderBucketType("PreBucket"); + assertSame(preBucket, preBucket2); + assertSame(RenderBucketType.PreBucket, preBucket); + } + + @Test + public void getUserDefined() throws Exception { + final RenderBucketType myBucket = RenderBucketType.getRenderBucketType("MyBucket"); + assertNotNull(myBucket); + + final RenderBucketType myBucket2 = RenderBucketType.getRenderBucketType("MyBucket"); + assertSame(myBucket, myBucket2); + } + + @Test + public void getWithNull() throws Exception { + try { + RenderBucketType.getRenderBucketType(null); + fail(); + } catch (final IllegalArgumentException e) { + } + } } diff --git a/ardor3d-core/src/test/java/com/ardor3d/util/MockInputStream.java b/ardor3d-core/src/test/java/com/ardor3d/util/MockInputStream.java index c0525b4..e6f1050 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/util/MockInputStream.java +++ b/ardor3d-core/src/test/java/com/ardor3d/util/MockInputStream.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianDataInput.java b/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianDataInput.java index b779190..dd94e56 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianDataInput.java +++ b/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianDataInput.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -20,17 +20,15 @@ import org.junit.Before; import org.junit.Test; /** - * These tests are fairly brittle, since they rely on the implementation of BufferedInputStream. - * It is necessary for the bytes available to always be larger than the buffer size of the buffered - * input stream for the tests to work. This size is currently 8192, but if it changes, or if the - * implementation changes, these tests can break. + * These tests are fairly brittle, since they rely on the implementation of BufferedInputStream. It is necessary for the + * bytes available to always be larger than the buffer size of the buffered input stream for the tests to work. This + * size is currently 8192, but if it changes, or if the implementation changes, these tests can break. */ public class TestLittleEndianDataInput { MockInputStream in; byte[] array; LittleEndianDataInput littleEndien; - @Before public void setup() throws Exception { in = new MockInputStream(); @@ -40,7 +38,6 @@ public class TestLittleEndianDataInput { littleEndien = new LittleEndianDataInput(in); } - @Test public void testReadFully1() throws Exception { in.addBytesAvailable(11111); @@ -53,7 +50,7 @@ public class TestLittleEndianDataInput { @Test public void testReadFully2() throws Exception { in.addBytesAvailable(11240); - + littleEndien.readFully(array, 0, 4); // not caring about whether the bytes were actually copied successfully in this test @@ -63,11 +60,12 @@ public class TestLittleEndianDataInput { public void testReadFully3() throws Exception { array = new byte[30003]; - Thread testThread = new Thread(new Runnable() { + final Thread testThread = new Thread(new Runnable() { + @Override public void run() { try { littleEndien.readFully(array); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); fail("ioexception"); } @@ -92,7 +90,7 @@ public class TestLittleEndianDataInput { // not caring about whether the bytes were actually copied successfully in this test } - @Test (expected = EOFException.class) + @Test(expected = EOFException.class) public void testReadFully4() throws Exception { in.setEof(true); diff --git a/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianRandomAccessDataInput.java b/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianRandomAccessDataInput.java index dee87f2..24002f1 100644 --- a/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianRandomAccessDataInput.java +++ b/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianRandomAccessDataInput.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-distribution/assembly-all.xml b/ardor3d-distribution/assembly-all.xml index f9e1f26..82d6dec 100644 --- a/ardor3d-distribution/assembly-all.xml +++ b/ardor3d-distribution/assembly-all.xml @@ -19,7 +19,6 @@ <include>com.ardor3d:ardor3d-effects</include> <include>com.ardor3d:ardor3d-extras</include> <include>com.ardor3d:ardor3d-jogl</include> - <include>com.ardor3d:ardor3d-lwjgl</include> <include>com.ardor3d:ardor3d-math</include> <include>com.ardor3d:ardor3d-savable</include> <include>com.ardor3d:ardor3d-swt</include> @@ -32,7 +31,6 @@ <dependencySets> <dependencySet> <excludes> - <exclude>*:lwjgl*:*:natives-*</exclude> <exclude>*:jinput*:*:natives-*</exclude> </excludes> </dependencySet> diff --git a/ardor3d-distribution/assembly-lwjgl.xml b/ardor3d-distribution/assembly-lwjgl.xml deleted file mode 100644 index 642a5ea..0000000 --- a/ardor3d-distribution/assembly-lwjgl.xml +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<assembly> - - <id>lwjgl</id> - <formats> - <format>zip</format> - </formats> - <includeBaseDirectory>false</includeBaseDirectory> - - <moduleSets> - <moduleSet> - <useAllReactorProjects>true</useAllReactorProjects> - - <includes> - <include>com.ardor3d:ardor3d-animation</include> - <include>com.ardor3d:ardor3d-awt</include> - <include>com.ardor3d:ardor3d-collada</include> - <include>com.ardor3d:ardor3d-core</include> - <include>com.ardor3d:ardor3d-effects</include> - <include>com.ardor3d:ardor3d-extras</include> - <include>com.ardor3d:ardor3d-lwjgl</include> - <include>com.ardor3d:ardor3d-math</include> - <include>com.ardor3d:ardor3d-savable</include> - <include>com.ardor3d:ardor3d-swt</include> - <include>com.ardor3d:ardor3d-terrain</include> - <include>com.ardor3d:ardor3d-ui</include> - </includes> - - <binaries> - <unpack>false</unpack> - <dependencySets> - <dependencySet> - <excludes> - <exclude>*:lwjgl*:*:natives-*</exclude> - <exclude>*:jinput*:*:natives-*</exclude> - </excludes> - </dependencySet> - </dependencySets> - </binaries> - </moduleSet> - </moduleSets> - - <fileSets> - <fileSet> - <directory>target/natives</directory> - <outputDirectory>natives</outputDirectory> - <!-- This is kind of a workaround. Ideally, we would tell the maven-nativedependencies-plugin - to *not* unpack the jogl/gluegen native jars. Jogl has its own native library - classloader which unpacks the jars. At the moment, there is no other choice - if all platforms should be supported, because the filenames of the native - libs are overlapping each other in jogl (e.g. for natives-linux-amd64 and - natives-linux-i586). --> - <excludes> - <exclude>*jogl*</exclude> - <exclude>*nativewindow*</exclude> - <exclude>*newt*</exclude> - <exclude>*gluegen*</exclude> - <exclude>META-INF/</exclude> - </excludes> - </fileSet> - </fileSets> -</assembly> diff --git a/ardor3d-distribution/pom.xml b/ardor3d-distribution/pom.xml index bf38583..5284907 100644 --- a/ardor3d-distribution/pom.xml +++ b/ardor3d-distribution/pom.xml @@ -53,7 +53,6 @@ <descriptors> <descriptor>assembly-all.xml</descriptor> <descriptor>assembly-jogl.xml</descriptor> - <descriptor>assembly-lwjgl.xml</descriptor> </descriptors> </configuration> </execution> diff --git a/ardor3d-effects/.settings/org.eclipse.jdt.core.prefs b/ardor3d-effects/.settings/org.eclipse.jdt.core.prefs index 16496e9..941c850 100644 --- a/ardor3d-effects/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-effects/.settings/org.eclipse.jdt.core.prefs @@ -89,12 +89,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-effects/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-effects/.settings/org.eclipse.jdt.ui.prefs index 2cb0f4c..9cac248 100644 --- a/ardor3d-effects/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-effects/.settings/org.eclipse.jdt.ui.prefs @@ -59,7 +59,7 @@ org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -82,7 +82,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false diff --git a/ardor3d-effects/build.gradle b/ardor3d-effects/build.gradle new file mode 100644 index 0000000..4643caf --- /dev/null +++ b/ardor3d-effects/build.gradle @@ -0,0 +1,5 @@ + +description = 'Ardor 3D Effects' +dependencies { + compile project(':ardor3d-core') +} diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/ColorReplaceEffect.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/ColorReplaceEffect.java index dcd3b80..300d3d6 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/ColorReplaceEffect.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/ColorReplaceEffect.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/HDREffect.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/HDREffect.java index 27cb7db..a0f54d9 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/HDREffect.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/HDREffect.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/SimpleBloomEffect.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/SimpleBloomEffect.java index bca0512..0db6106 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/SimpleBloomEffect.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/SimpleBloomEffect.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.effect; +import java.util.ArrayList; import java.util.List; import com.ardor3d.extension.effect.bloom.BloomRenderPass; @@ -25,14 +26,13 @@ import com.ardor3d.renderer.state.GLSLShaderObjectsState; import com.ardor3d.renderer.state.RenderState.StateType; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.util.resource.ResourceLocatorTool; -import com.google.common.collect.Lists; public class SimpleBloomEffect extends RenderEffect { protected static final String RT_MAIN = "LDRBloomEffect.MAIN"; protected static final String RT_SECONDARY = "LDRBloomEffect.SECONDARY"; protected String shaderDirectory = "com/ardor3d/extension/effect/"; - protected final List<Spatial> _bloomItems = Lists.newArrayList(); + protected final List<Spatial> _bloomItems = new ArrayList<>(); protected float _downsampleRatio = .33f; private final GLSLShaderObjectsState _extractionShader, _blurHorizShader, _blurVertShader; @@ -102,8 +102,8 @@ public class SimpleBloomEffect extends RenderEffect { final int downsampledHeight = Math.round(canvas.getHeight() * _downsampleRatio); final int downsampledWidth = Math.round(canvas.getWidth() * _downsampleRatio); - final RenderTarget_Texture2D main = new RenderTarget_Texture2D(downsampledWidth, downsampledHeight, manager - .getOutputFormat()); + final RenderTarget_Texture2D main = new RenderTarget_Texture2D(downsampledWidth, downsampledHeight, + manager.getOutputFormat()); main.getTexture().setWrap(WrapMode.Clamp); manager.getRenderTargetMap().put(RT_MAIN, main); diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/bloom/BloomRenderPass.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/bloom/BloomRenderPass.java index 00a8260..3c9c9ac 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/bloom/BloomRenderPass.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/bloom/BloomRenderPass.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/AnimationEntry.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/AnimationEntry.java index 13d2554..e99850d 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/AnimationEntry.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/AnimationEntry.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -51,16 +51,19 @@ public class AnimationEntry implements Savable { _rate = rate; } + @Override public Class<? extends AnimationEntry> getClassTag() { return getClass(); } + @Override public void read(final InputCapsule capsule) throws IOException { _offset = capsule.readDouble("offsetMS", 0.05); _rate = capsule.readDouble("rate", 0.2); _frames = capsule.readIntArray("frames", null); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_offset, "offsetMS", 0.05); capsule.write(_rate, "rate", 0.2); diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/FloorInfluence.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/FloorInfluence.java index 5891b13..89edc77 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/FloorInfluence.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/FloorInfluence.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/Particle.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/Particle.java index 7099bae..1d2d7c5 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/Particle.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/Particle.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -460,6 +460,7 @@ public class Particle implements Savable { // Savable interface methods // ///// + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(startIndex, "startIndex", 0); capsule.write(_position, "position", new Vector3(Vector3.ZERO)); @@ -471,6 +472,7 @@ public class Particle implements Savable { capsule.write(type, "type", ParticleSystem.ParticleType.Quad); } + @Override public void read(final InputCapsule capsule) throws IOException { startIndex = capsule.readInt("startIndex", 0); _position.set((Vector3) capsule.readSavable("position", new Vector3(Vector3.ZERO))); @@ -482,6 +484,7 @@ public class Particle implements Savable { type = capsule.readEnum("type", ParticleSystem.ParticleType.class, ParticleSystem.ParticleType.Quad); } + @Override public Class<? extends Particle> getClassTag() { return this.getClass(); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleAppearanceRamp.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleAppearanceRamp.java index c55f504..00a365f 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleAppearanceRamp.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleAppearanceRamp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -23,7 +23,7 @@ import com.ardor3d.util.export.Savable; public class ParticleAppearanceRamp implements Savable { - protected List<RampEntry> _entries = new ArrayList<RampEntry>(); + protected List<RampEntry> _entries = new ArrayList<>(); public void addEntry(final RampEntry entry) { _entries.add(entry); @@ -154,17 +154,20 @@ public class ParticleAppearanceRamp implements Savable { } } + @Override public Class<? extends ParticleAppearanceRamp> getClassTag() { return getClass(); } + @Override public void read(final InputCapsule capsule) throws IOException { _entries = capsule.readSavableList("entries", null); if (_entries == null) { - _entries = new ArrayList<RampEntry>(); + _entries = new ArrayList<>(); } } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.writeSavableList(_entries, "entries", null); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java index aaa5e6d..5d1d6be 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -387,7 +387,7 @@ public class ParticleController extends ComplexSpatialController<ParticleSystem> */ public void addInfluence(final ParticleInfluence influence) { if (influences == null) { - influences = new ArrayList<ParticleInfluence>(1); + influences = new ArrayList<>(1); } influences.add(influence); } @@ -429,7 +429,7 @@ public class ParticleController extends ComplexSpatialController<ParticleSystem> */ public void addListener(final ParticleControllerListener listener) { if (listeners == null) { - listeners = new ArrayList<ParticleControllerListener>(); + listeners = new ArrayList<>(); } listeners.add(listener); diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleControllerListener.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleControllerListener.java index d50e39e..e3072f9 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleControllerListener.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleControllerListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleFactory.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleFactory.java index e0ebd1e..ae2f979 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleFactory.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleInfluence.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleInfluence.java index 3cd6906..689ba05 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleInfluence.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleInfluence.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -69,14 +69,17 @@ public abstract class ParticleInfluence implements Savable { */ public abstract void apply(double dt, Particle particle, int index); + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_enabled, "enabled", true); } + @Override public void read(final InputCapsule capsule) throws IOException { _enabled = capsule.readBoolean("enabled", true); } + @Override public Class<? extends ParticleInfluence> getClassTag() { return this.getClass(); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleLines.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleLines.java index 5bc25a5..f1e71ad 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleLines.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleLines.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleMesh.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleMesh.java index 2d70080..c397b08 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleMesh.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleMesh.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticlePoints.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticlePoints.java index c14ff07..2218d76 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticlePoints.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticlePoints.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleSystem.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleSystem.java index 63dd52f..0f74bcc 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleSystem.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleSystem.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/RampEntry.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/RampEntry.java index 690532a..4092745 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/RampEntry.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/RampEntry.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -113,10 +113,12 @@ public class RampEntry implements Savable { _offset = offset; } + @Override public Class<? extends RampEntry> getClassTag() { return getClass(); } + @Override public void read(final InputCapsule capsule) throws IOException { _offset = capsule.readDouble("offsetMS", DEFAULT_OFFSET); _size = capsule.readDouble("size", DEFAULT_SIZE); @@ -125,6 +127,7 @@ public class RampEntry implements Savable { _color = (ColorRGBA) capsule.readSavable("color", DEFAULT_COLOR); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_offset, "offsetMS", DEFAULT_OFFSET); capsule.write(_size, "size", DEFAULT_SIZE); diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/SimpleParticleInfluenceFactory.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/SimpleParticleInfluenceFactory.java index 09b422c..7953500 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/SimpleParticleInfluenceFactory.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/SimpleParticleInfluenceFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/SwarmInfluence.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/SwarmInfluence.java index 08e4ffb..ca9ac7f 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/SwarmInfluence.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/SwarmInfluence.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/TexAnimation.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/TexAnimation.java index 3b73b03..a4e230e 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/TexAnimation.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/TexAnimation.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -21,7 +21,7 @@ import com.ardor3d.util.export.Savable; public class TexAnimation implements Savable { - protected List<AnimationEntry> _entries = new ArrayList<AnimationEntry>(); + protected List<AnimationEntry> _entries = new ArrayList<>(); public void addEntry(final AnimationEntry entry) { _entries.add(entry); @@ -73,17 +73,20 @@ public class TexAnimation implements Savable { } } + @Override public Class<? extends TexAnimation> getClassTag() { return getClass(); } + @Override public void read(final InputCapsule capsule) throws IOException { _entries = capsule.readSavableList("entries", null); if (_entries == null) { - _entries = new ArrayList<AnimationEntry>(); + _entries = new ArrayList<>(); } } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.writeSavableList(_entries, "entries", null); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/WanderInfluence.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/WanderInfluence.java index 5a0481a..24a59a6 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/WanderInfluence.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/WanderInfluence.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -28,13 +28,13 @@ public class WanderInfluence extends ParticleInfluence { private double _wanderDistance = DEFAULT_DISTANCE; private double _wanderJitter = DEFAULT_JITTER; - private ArrayList<Vector3> _wanderTargets = new ArrayList<Vector3>(1); + private ArrayList<Vector3> _wanderTargets = new ArrayList<>(1); private final Vector3 _workVect = new Vector3(); @Override public void prepare(final ParticleSystem system) { if (_wanderTargets.size() != system.getNumParticles()) { - _wanderTargets = new ArrayList<Vector3>(system.getNumParticles()); + _wanderTargets = new ArrayList<>(system.getNumParticles()); for (int x = system.getNumParticles(); --x >= 0;) { _wanderTargets.add(new Vector3(system.getEmissionDirection()).normalizeLocal()); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/LineSegmentEmitter.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/LineSegmentEmitter.java index 9e2a75c..432ed6c 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/LineSegmentEmitter.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/LineSegmentEmitter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -41,6 +41,7 @@ public class LineSegmentEmitter extends SavableParticleEmitter { return _source; } + @Override public Vector3 randomEmissionPoint(final Vector3 store) { Vector3 rVal = store; if (rVal == null) { @@ -55,10 +56,12 @@ public class LineSegmentEmitter extends SavableParticleEmitter { // Methods for Savable // ///////////////// + @Override public void read(final InputCapsule capsule) throws IOException { _source = (LineSegment3) capsule.readSavable("source", null); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_source, "source", null); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/MeshEmitter.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/MeshEmitter.java index 48fb32d..821971e 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/MeshEmitter.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/MeshEmitter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -52,6 +52,7 @@ public class MeshEmitter extends SavableParticleEmitter { return _onlyVertices; } + @Override public Vector3 randomEmissionPoint(final Vector3 store) { Vector3 rVal = store; if (rVal == null) { @@ -70,11 +71,13 @@ public class MeshEmitter extends SavableParticleEmitter { // Methods for Savable // ///////////////// + @Override public void read(final InputCapsule capsule) throws IOException { _source = (Mesh) capsule.readSavable("source", null); _onlyVertices = capsule.readBoolean("onlyVertices", false); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_source, "source", null); capsule.write(_onlyVertices, "onlyVertices", false); diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/ParticleEmitter.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/ParticleEmitter.java index b382596..faa42a3 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/ParticleEmitter.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/ParticleEmitter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/PointEmitter.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/PointEmitter.java index 9e6b84d..900923b 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/PointEmitter.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/PointEmitter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -20,6 +20,7 @@ public class PointEmitter extends SavableParticleEmitter { public PointEmitter() {} + @Override public Vector3 randomEmissionPoint(final Vector3 store) { Vector3 rVal = store; if (rVal == null) { @@ -34,7 +35,9 @@ public class PointEmitter extends SavableParticleEmitter { // Methods for Savable // ///////////////// + @Override public void read(final InputCapsule capsule) throws IOException {} + @Override public void write(final OutputCapsule capsule) throws IOException {} } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/RectangleEmitter.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/RectangleEmitter.java index 18264f4..ae9a7df 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/RectangleEmitter.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/RectangleEmitter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -41,6 +41,7 @@ public class RectangleEmitter extends SavableParticleEmitter { return _source; } + @Override public Vector3 randomEmissionPoint(final Vector3 store) { Vector3 rVal = store; if (rVal == null) { @@ -55,10 +56,12 @@ public class RectangleEmitter extends SavableParticleEmitter { // Methods for Savable // ///////////////// + @Override public void read(final InputCapsule capsule) throws IOException { _source = (Rectangle3) capsule.readSavable("source", null); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_source, "source", null); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/RingEmitter.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/RingEmitter.java index 738bb60..d0516e8 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/RingEmitter.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/RingEmitter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -41,6 +41,7 @@ public class RingEmitter extends SavableParticleEmitter { return _source; } + @Override public Vector3 randomEmissionPoint(final Vector3 store) { Vector3 rVal = store; if (rVal == null) { @@ -55,10 +56,12 @@ public class RingEmitter extends SavableParticleEmitter { // Methods for Savable // ///////////////// + @Override public void read(final InputCapsule capsule) throws IOException { _source = (Ring) capsule.readSavable("source", null); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_source, "source", null); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/SavableParticleEmitter.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/SavableParticleEmitter.java index a11413a..1fd6371 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/SavableParticleEmitter.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/emitter/SavableParticleEmitter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -18,6 +18,7 @@ public abstract class SavableParticleEmitter implements Savable, ParticleEmitter // Methods for Savable // ///////////////// + @Override public Class<? extends SavableParticleEmitter> getClassTag() { return this.getClass(); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ImprovedNoise.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ImprovedNoise.java index 85cad35..0fe17ac 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ImprovedNoise.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ImprovedNoise.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java index bfe48d5..d758609 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java @@ -84,7 +84,7 @@ public class ProjectedGrid extends Mesh { private int nrUpdateThreads = 1; private final ExecutorService executorService = Executors.newCachedThreadPool(new DeamonThreadFactory()); - private final Stack<Future<?>> futureStack = new Stack<Future<?>>(); + private final Stack<Future<?>> futureStack = new Stack<>(); private final int connections[] = { 0, 1, 2, 3, 0, 4, 1, 5, 2, 6, 3, 7, 4, 5, 6, 7, }; @@ -315,6 +315,7 @@ public class ProjectedGrid extends Mesh { final int from = sizeY * i / (nrUpdateThreads); final int to = sizeY * (i + 1) / (nrUpdateThreads); final Future<?> future = executorService.submit(new Runnable() { + @Override public void run() { updateGrid(from, to); } @@ -631,6 +632,7 @@ public class ProjectedGrid extends Mesh { namePrefix = "ProjectedGrid Pool-" + poolNumber.getAndIncrement() + "-thread-"; } + @Override public Thread newThread(final Runnable r) { final Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0); if (!t.isDaemon()) { diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterHeightGenerator.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterHeightGenerator.java index b7e86ef..47d22e8 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterHeightGenerator.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterHeightGenerator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -24,6 +24,7 @@ public class WaterHeightGenerator implements HeightGenerator { private double speedbig = 0.5; private int octaves = 2; + @Override public double getHeight(final double x, final double z, final double time) { final double zval = z * scaleybig * 4 + time * speedbig * 4; double height = Math.sin(zval); diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterNode.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterNode.java index 3d82ca9..d5ee47c 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterNode.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterNode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,6 +12,7 @@ package com.ardor3d.extension.effect.water; import java.io.IOException; import java.util.ArrayList; +import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -47,7 +48,6 @@ import com.ardor3d.scenegraph.hint.TextureCombineMode; import com.ardor3d.scenegraph.shape.Quad; import com.ardor3d.util.TextureManager; import com.ardor3d.util.resource.ResourceLocatorTool; -import com.google.common.collect.Lists; /** * The WaterNode handles rendering of a water effect on all of it's children. What is reflected in the water is @@ -70,8 +70,8 @@ public class WaterNode extends Node { protected Texture2D textureRefract; protected Texture2D textureDepth; - protected ArrayList<Spatial> renderList = Lists.newArrayList(); - protected ArrayList<Texture> texArray = Lists.newArrayList(); + protected List<Spatial> renderList = new ArrayList<>(); + protected List<Texture> texArray = new ArrayList<>(); protected Node skyBox; protected GLSLShaderObjectsState waterShader; diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/PSSMCamera.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/PSSMCamera.java index b3e7b82..bee98a2 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/PSSMCamera.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/PSSMCamera.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java index 2e7b06c..4c6a122 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -13,6 +13,7 @@ package com.ardor3d.extension.shadow.map; import java.io.IOException; import java.lang.ref.WeakReference; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -74,7 +75,6 @@ import com.ardor3d.scenegraph.hint.LightCombineMode; import com.ardor3d.scenegraph.shape.Sphere; import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.resource.ResourceLocatorTool; -import com.google.common.collect.Lists; /** * A pass providing a parallel split shadow mapping (PSSM) layer across the top of an existing scene. @@ -101,10 +101,10 @@ public class ParallelSplitShadowMapPass extends Pass { private Texture2D _shadowMapTexture[]; /** The list of occluding nodes - filled from ShadowCasterManager. */ - private final List<Spatial> _occluderNodes = Lists.newArrayList(); + private final List<Spatial> _occluderNodes = new ArrayList<>(); /** Extra bounds receivers, when rendering shadows other ways than through overlay */ - private final List<Spatial> _boundsReceiver = Lists.newArrayList(); + private final List<Spatial> _boundsReceiver = new ArrayList<>(); // Various optimizations for rendering shadow maps... /** Culling front faces when rendering shadow maps. */ @@ -236,7 +236,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Create a pssm shadow map pass casting shadows from a light with the direction given. - * + * * @param shadowMapSize * The size of the shadow map texture * @param numOfSplits @@ -289,7 +289,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Initialize the pass render states. - * + * * @param r * the r */ @@ -347,7 +347,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Reinit texture size. Sets up texture renderer. - * + * * @param r * the Renderer */ @@ -426,7 +426,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Render the pass. - * + * * @param r * the Renderer */ @@ -556,7 +556,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Calculate optimal light frustum perspective. - * + * * @param frustumCorners * the frustum corners * @param center @@ -626,7 +626,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Saving this around until we fully support a good solution for non-directional lights. Like dual paraboloid shadow * maps... - * + * * @param frustumCorners * @param center */ @@ -709,7 +709,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Render the overlay scene with shadows. - * + * * @param r * The renderer to use */ @@ -753,6 +753,7 @@ public class ParallelSplitShadowMapPass extends Pass { private Face cullFace; private boolean isVisible; + @Override public void apply(final Renderable renderable) { if (renderable instanceof Mesh) { final Mesh mesh = (Mesh) renderable; @@ -772,6 +773,7 @@ public class ParallelSplitShadowMapPass extends Pass { } } + @Override public void restore(final Renderable renderable) { if (renderable instanceof Mesh) { final Mesh mesh = (Mesh) renderable; @@ -787,7 +789,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Update the shadow map. - * + * * @param index * shadow map texture index to update */ @@ -817,7 +819,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Update texture matrix. - * + * * @param index * the index */ @@ -832,7 +834,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Checks if this pass is initialized. - * + * * @return true, if is initialized */ public boolean isInitialised() { @@ -840,7 +842,7 @@ public class ParallelSplitShadowMapPass extends Pass { } /** - * + * * @return the offset state used for drawing the shadow textures. */ public OffsetState getShadowOffsetState() { @@ -864,8 +866,8 @@ public class ParallelSplitShadowMapPass extends Pass { for (int i = 0, cSize = _boundsReceiver.size(); i < cSize; i++) { final Spatial child = _boundsReceiver.get(i); - if (child != null && child.getSceneHints().getCullHint() != CullHint.Always - && child.getWorldBound() != null && boundIsValid(child.getWorldBound())) { + if (child != null && child.getSceneHints().getCullHint() != CullHint.Always && child.getWorldBound() != null + && boundIsValid(child.getWorldBound())) { if (firstRun) { _receiverBounds.setCenter(child.getWorldBound().getCenter()); _receiverBounds.setXExtent(0); @@ -880,8 +882,8 @@ public class ParallelSplitShadowMapPass extends Pass { for (int i = 0, cSize = _spatials.size(); i < cSize; i++) { final Spatial child = _spatials.get(i); - if (child != null && child.getSceneHints().getCullHint() != CullHint.Always - && child.getWorldBound() != null && boundIsValid(child.getWorldBound())) { + if (child != null && child.getSceneHints().getCullHint() != CullHint.Always && child.getWorldBound() != null + && boundIsValid(child.getWorldBound())) { if (firstRun) { _receiverBounds.setCenter(child.getWorldBound().getCenter()); _receiverBounds.setXExtent(0); @@ -897,7 +899,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Checks if a bounding volume is valid. - * + * * @param volume * @return */ @@ -930,10 +932,10 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Gets the shadow map texture. - * + * * @param index * the index - * + * * @return the shadow map texture */ public Texture2D getShadowMapTexture(final int index) { @@ -942,7 +944,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Gets the number of splits. - * + * * @return the number of splits */ public int getNumOfSplits() { @@ -952,7 +954,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Sets the number of frustum splits and thus the number of shadow textures created by this pass. More splits * creates crisper shadows at the cost of increased texture memory. - * + * * @param numOfSplits * the new number of splits */ @@ -968,7 +970,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Gets the shadow map size. - * + * * @return the shadow map size */ public int getShadowMapSize() { @@ -977,7 +979,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Sets the shadow map size. - * + * * @param shadowMapSize * the new shadow map size */ @@ -989,7 +991,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Gets the maximum distance for shadowing. - * + * * @return max distance * @see com.ardor3d.extension.shadow.map.PSSMCamera#getMaxFarPlaneDistance() */ @@ -999,7 +1001,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Sets the maximum distance for shadowing. - * + * * @param maxShadowDistance * distance to set * @see com.ardor3d.extension.shadow.map.PSSMCamera#setMaxFarPlaneDistance(double) @@ -1010,7 +1012,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Gets the minimum z distance for the light. - * + * * @return the minimumLightDistance */ public double getMinimumLightDistance() { @@ -1019,7 +1021,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Sets the minimum z distance for the light. - * + * * @param minimumLightDistance * the minimumLightDistance to set */ @@ -1029,7 +1031,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Gets shadow color and transparency. - * + * * @return the shadowColor */ public ReadOnlyColorRGBA getShadowColor() { @@ -1038,7 +1040,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Sets shadow color and transparency. - * + * * @param shadowColor * the shadowColor to set */ @@ -1056,7 +1058,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Clean up. - * + * * @see com.ardor3d.renderer.pass.Pass#cleanUp() */ @Override @@ -1078,7 +1080,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Simple clamp. - * + * * @param val * value to clamp * @param from @@ -1235,7 +1237,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Draw debug frustum. - * + * * @param r * the r * @param cam @@ -1252,7 +1254,7 @@ public class ParallelSplitShadowMapPass extends Pass { /** * Draw debug frustum. - * + * * @param r * the r * @param cam diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ShadowCasterManager.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ShadowCasterManager.java index 23214dd..8457aeb 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ShadowCasterManager.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ShadowCasterManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2018 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -20,8 +20,8 @@ public class ShadowCasterManager { public static final ShadowCasterManager INSTANCE = new ShadowCasterManager(); - protected List<WeakReference<Spatial>> _spatialRefs = new ArrayList<WeakReference<Spatial>>(); - protected List<WeakReference<Spatial>> _cleanup = new ArrayList<WeakReference<Spatial>>(); + protected List<WeakReference<Spatial>> _spatialRefs = new ArrayList<>(); + protected List<WeakReference<Spatial>> _cleanup = new ArrayList<>(); public void addSpatial(final Spatial spatial) { for (final WeakReference<Spatial> ref : _spatialRefs) { @@ -33,7 +33,7 @@ public class ShadowCasterManager { return; } } - _spatialRefs.add(new WeakReference<Spatial>(spatial)); + _spatialRefs.add(new WeakReference<>(spatial)); _spatialRefs.removeAll(_cleanup); _cleanup.clear(); } diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ShadowRenderCallback.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ShadowRenderCallback.java index 0d3bc5d..96929a1 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ShadowRenderCallback.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ShadowRenderCallback.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/add2textures.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/add2textures.frag index 52ec17d..90b5d72 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/add2textures.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/add2textures.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur.frag index c42d1e1..27f428a 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur.vert index 3e8fc35..2a9493a 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal5.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal5.frag index d1f3aa1..7975113 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal5.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal5.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal7.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal7.frag index 8cdcb5c..d1bc8f9 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal7.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal7.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal9.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal9.frag index c6acf9d..75d584a 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal9.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_horizontal9.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical5.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical5.frag index 61a0eb4..14c0d30 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical5.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical5.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical5_down.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical5_down.frag index 48cf7f4..1ae69b0 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical5_down.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical5_down.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical7.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical7.frag index f0103c5..ccf4f2a 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical7.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical7.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical9.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical9.frag index cdd819c..726118b 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical9.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_blur_vertical9.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_extract.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_extract.frag index a64c171..8010370 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_extract.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_extract.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_extract.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_extract.vert index 499ee56..7e55e64 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_extract.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_extract.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_final.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_final.frag index 7f1c2e0..ae98423 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_final.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_final.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_final.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_final.vert index 499ee56..7e55e64 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_final.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom/bloom_final.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom_extract.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom_extract.frag index 1a947e2..851908a 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom_extract.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/bloom_extract.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/color_replace.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/color_replace.frag index 7caf050..f16948a 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/color_replace.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/color_replace.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/fsq.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/fsq.vert index 9396569..6544bda 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/fsq.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/fsq.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/gausian_blur_horizontal9.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/gausian_blur_horizontal9.frag index c7df3be..6b03599 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/gausian_blur_horizontal9.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/gausian_blur_horizontal9.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/gausian_blur_vertical9.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/gausian_blur_vertical9.frag index 5640e04..8976f00 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/gausian_blur_vertical9.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/gausian_blur_vertical9.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/luminance.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/luminance.frag index 1d6916a..32fab2d 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/luminance.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/luminance.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/texture/textureClipmapShader.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/texture/textureClipmapShader.frag index a69fbcc..dce49d7 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/texture/textureClipmapShader.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/texture/textureClipmapShader.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/texture/textureClipmapShader.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/texture/textureClipmapShader.vert index 9f2cd70..ec36704 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/texture/textureClipmapShader.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/texture/textureClipmapShader.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader.frag index 93ded63..db4143f 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader.vert index 75296f2..043c221 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader_refraction.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader_refraction.frag index ffbed26..085bb21 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader_refraction.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader_refraction.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader_refraction.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader_refraction.vert index 75296f2..043c221 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader_refraction.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/flatwatershader_refraction.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader.frag index 92a337e..22b136d 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader.vert index 799bfaf..ec6dfda 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader_refraction.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader_refraction.frag index ca7fb59..0a9f891 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader_refraction.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader_refraction.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader_refraction.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader_refraction.vert index 799bfaf..ec6dfda 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader_refraction.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/effect/water/projectedwatershader_refraction.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssm.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssm.frag index f081926..a36bcd9 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssm.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssm.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2011 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssm.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssm.vert index 3809872..3a36163 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssm.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssm.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmDebug.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmDebug.frag index 152488b..7e8d417 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmDebug.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmDebug.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmDebug.vert b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmDebug.vert index 077f216..6ca7db7 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmDebug.vert +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmDebug.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmPCF.frag b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmPCF.frag index ecbac9a..abf829a 100644 --- a/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmPCF.frag +++ b/ardor3d-effects/src/main/resources/com/ardor3d/extension/shadow/map/pssmPCF.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/MockPSSMCamera.java b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/MockPSSMCamera.java index 664df03..ffb0bcc 100644 --- a/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/MockPSSMCamera.java +++ b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/MockPSSMCamera.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java index de74a4f..5d5cf54 100644 --- a/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java +++ b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java @@ -1,17 +1,16 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.shadow.map; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; import com.ardor3d.bounding.BoundingBox; @@ -53,7 +52,7 @@ public class TestPSSMCamera { Assert.assertEquals(new Vector3(2, 2, 2), camera.getExtents()); - Assert.assertEquals(boxNear1, boxNear2); - Assert.assertEquals(boxFar1, boxFar2); + Assert.assertEquals(boxNear1, boxNear2, 0.0); + Assert.assertEquals(boxFar1, boxFar2, 0.0); } } diff --git a/ardor3d-examples/.gitignore b/ardor3d-examples/.gitignore deleted file mode 100644 index 15ef5ce..0000000 --- a/ardor3d-examples/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/ardorSettings.properties diff --git a/ardor3d-examples/.settings/org.eclipse.jdt.core.prefs b/ardor3d-examples/.settings/org.eclipse.jdt.core.prefs index 16496e9..941c850 100644 --- a/ardor3d-examples/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-examples/.settings/org.eclipse.jdt.core.prefs @@ -89,12 +89,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-examples/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-examples/.settings/org.eclipse.jdt.ui.prefs index 2cb0f4c..9cac248 100644 --- a/ardor3d-examples/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-examples/.settings/org.eclipse.jdt.ui.prefs @@ -59,7 +59,7 @@ org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -82,7 +82,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false diff --git a/ardor3d-examples/assembly.xml b/ardor3d-examples/assembly.xml index be12458..ce3091c 100644 --- a/ardor3d-examples/assembly.xml +++ b/ardor3d-examples/assembly.xml @@ -39,7 +39,6 @@ <useProjectArtifact>false</useProjectArtifact> <useStrictFiltering>true</useStrictFiltering> <excludes> - <exclude>*:lwjgl*:*:natives-*</exclude> <exclude>*:jinput*:*:natives-*</exclude> </excludes> <outputDirectory>lib</outputDirectory> diff --git a/ardor3d-examples/build.gradle b/ardor3d-examples/build.gradle new file mode 100644 index 0000000..f07954b --- /dev/null +++ b/ardor3d-examples/build.gradle @@ -0,0 +1,15 @@ + +description = 'Ardor 3D Examples' +dependencies { + compile project(':ardor3d-awt') + compile project(':ardor3d-swt') + compile project(':ardor3d-jinput') + compile project(':ardor3d-jogl') + compile project(':ardor3d-jogl-awt') + compile project(':ardor3d-jogl-swt') + compile project(':ardor3d-effects') + compile project(':ardor3d-extras') + compile project(':ardor3d-collada') + compile project(':ardor3d-terrain') + compile project(':ardor3d-ui') +} diff --git a/ardor3d-examples/pom.xml b/ardor3d-examples/pom.xml index 07cebd2..7350176 100644 --- a/ardor3d-examples/pom.xml +++ b/ardor3d-examples/pom.xml @@ -109,27 +109,32 @@ <dependencies> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>ardor3d-lwjgl</artifactId> + <artifactId>ardor3d-awt</artifactId> <version>${project.version}</version> </dependency> - <!-- because we use org.lwjgl.LWJGLException in LwjglSwtExample --> <dependency> - <groupId>org.lwjgl.lwjgl</groupId> - <artifactId>lwjgl</artifactId> + <groupId>${project.groupId}</groupId> + <artifactId>ardor3d-swt</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>ardor3d-awt</artifactId> + <artifactId>ardor3d-jinput</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>ardor3d-swt</artifactId> + <artifactId>ardor3d-jogl</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ardor3d-jogl-awt</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>ardor3d-jogl</artifactId> + <artifactId>ardor3d-jogl-swt</artifactId> <version>${project.version}</version> </dependency> <dependency> diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java index 30ca4dd..1ac5650 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -28,11 +28,9 @@ import com.ardor3d.framework.Scene; import com.ardor3d.framework.Updater; import com.ardor3d.framework.jogl.JoglCanvasRenderer; import com.ardor3d.framework.jogl.JoglNewtWindow; -import com.ardor3d.framework.lwjgl.LwjglCanvas; -import com.ardor3d.framework.lwjgl.LwjglCanvasRenderer; import com.ardor3d.image.TextureStoreFormat; -import com.ardor3d.image.util.awt.AWTImageLoader; import com.ardor3d.image.util.awt.ScreenShotImageExporter; +import com.ardor3d.image.util.jogl.JoglImageLoader; import com.ardor3d.input.GrabbedState; import com.ardor3d.input.Key; import com.ardor3d.input.MouseButton; @@ -53,10 +51,6 @@ import com.ardor3d.input.logical.MouseButtonPressedCondition; import com.ardor3d.input.logical.MouseButtonReleasedCondition; import com.ardor3d.input.logical.TriggerAction; import com.ardor3d.input.logical.TwoInputStates; -import com.ardor3d.input.lwjgl.LwjglControllerWrapper; -import com.ardor3d.input.lwjgl.LwjglKeyboardWrapper; -import com.ardor3d.input.lwjgl.LwjglMouseManager; -import com.ardor3d.input.lwjgl.LwjglMouseWrapper; import com.ardor3d.intersection.PickData; import com.ardor3d.intersection.PickResults; import com.ardor3d.intersection.PickingUtil; @@ -71,7 +65,6 @@ import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.Renderer; import com.ardor3d.renderer.TextureRendererFactory; import com.ardor3d.renderer.jogl.JoglTextureRendererProvider; -import com.ardor3d.renderer.lwjgl.LwjglTextureRendererProvider; import com.ardor3d.renderer.queue.RenderBucketType; import com.ardor3d.renderer.state.LightState; import com.ardor3d.renderer.state.WireframeState; @@ -91,6 +84,8 @@ import com.ardor3d.util.screen.ScreenExporter; import com.ardor3d.util.stat.StatCollector; import com.google.common.base.Predicate; import com.google.common.base.Predicates; +import com.jogamp.newt.event.WindowAdapter; +import com.jogamp.newt.event.WindowEvent; public abstract class ExampleBase implements Runnable, Updater, Scene { private static final Logger logger = Logger.getLogger(ExampleBase.class.getName()); @@ -139,25 +134,48 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { protected static int _minAlphaBits = -1; protected static int _minStencilBits = -1; + @Override public void run() { try { + if (_canvas instanceof JoglNewtWindow) { + ((JoglNewtWindow) _canvas).addWindowListener(new WindowAdapter() { + @Override + public void windowDestroyNotify(final WindowEvent e) { + final CanvasRenderer cr = _canvas.getCanvasRenderer(); + // grab the graphics context so cleanup will work out. + cr.makeCurrentContext(); + ContextGarbageCollector.doFinalCleanup(cr.getRenderer()); + cr.releaseCurrentContext(); + } + }); + } + // else if (_canvas instanceof JoglAwtWindow) { + // ((JoglAwtWindow) _canvas).addWindowListener(new java.awt.event.WindowAdapter() { + // @Override + // public void windowClosing(final java.awt.event.WindowEvent e) { + // final CanvasRenderer cr = _canvas.getCanvasRenderer(); + // // grab the graphics context so cleanup will work out. + // cr.makeCurrentContext(); + // ContextGarbageCollector.doFinalCleanup(cr.getRenderer()); + // cr.releaseCurrentContext(); + // } + // }); + // } + _frameHandler.init(); while (!_exit) { _frameHandler.updateFrame(); Thread.yield(); } - // grab the graphics context so cleanup will work out. - final CanvasRenderer cr = _canvas.getCanvasRenderer(); - cr.makeCurrentContext(); - quit(cr.getRenderer()); - cr.releaseCurrentContext(); - if (QUIT_VM_ON_EXIT) { - System.exit(0); - } } catch (final Throwable t) { System.err.println("Throwable caught in MainThread - exiting"); t.printStackTrace(System.err); + } finally { + // quit even though the cleanup has just failed + if (QUIT_VM_ON_EXIT) { + System.exit(0); + } } } @@ -165,6 +183,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { _exit = true; } + @Override @MainThread public void init() { final ContextCapabilities caps = ContextManager.getCurrentContext().getCapabilities(); @@ -175,7 +194,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { registerInputTriggers(); - AWTImageLoader.registerLoader(); + JoglImageLoader.registerLoader(); try { SimpleResourceLocator srl = new SimpleResourceLocator(ResourceLocatorTool.getClassPathResource( @@ -223,6 +242,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { protected abstract void initExample(); + @Override @MainThread public void update(final ReadOnlyTimer timer) { if (_canvas.isClosing()) { @@ -258,6 +278,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { // does nothing } + @Override @MainThread public boolean renderUnto(final Renderer renderer) { // Execute renderQueue item @@ -305,6 +326,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { } } + @Override public PickResults doPick(final Ray3 pickRay) { final PrimitivePickResults pickResults = new PrimitivePickResults(); pickResults.setCheckDistance(true); @@ -358,22 +380,13 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { example._settings = settings; // get our framework - if (prefs.getRenderer().startsWith("LWJGL")) { - final LwjglCanvasRenderer canvasRenderer = new LwjglCanvasRenderer(example); - example._canvas = new LwjglCanvas(settings, canvasRenderer); - example._physicalLayer = new PhysicalLayer(new LwjglKeyboardWrapper(), new LwjglMouseWrapper(), - new LwjglControllerWrapper(), (LwjglCanvas) example._canvas); - example._mouseManager = new LwjglMouseManager(); - TextureRendererFactory.INSTANCE.setProvider(new LwjglTextureRendererProvider()); - } else if (prefs.getRenderer().startsWith("JOGL")) { - final JoglCanvasRenderer canvasRenderer = new JoglCanvasRenderer(example); - example._canvas = new JoglNewtWindow(canvasRenderer, settings); - final JoglNewtWindow canvas = (JoglNewtWindow) example._canvas; - example._mouseManager = new JoglNewtMouseManager(canvas); - example._physicalLayer = new PhysicalLayer(new JoglNewtKeyboardWrapper(canvas), new JoglNewtMouseWrapper( - canvas, example._mouseManager), DummyControllerWrapper.INSTANCE, new JoglNewtFocusWrapper(canvas)); - TextureRendererFactory.INSTANCE.setProvider(new JoglTextureRendererProvider()); - } + final JoglCanvasRenderer canvasRenderer = new JoglCanvasRenderer(example); + example._canvas = new JoglNewtWindow(canvasRenderer, settings); + final JoglNewtWindow canvas = (JoglNewtWindow) example._canvas; + example._mouseManager = new JoglNewtMouseManager(canvas); + example._physicalLayer = new PhysicalLayer(new JoglNewtKeyboardWrapper(canvas), new JoglNewtMouseWrapper( + canvas, example._mouseManager), DummyControllerWrapper.INSTANCE, new JoglNewtFocusWrapper(canvas)); + TextureRendererFactory.INSTANCE.setProvider(new JoglTextureRendererProvider()); example._logicalLayer.registerInput(example._canvas, example._physicalLayer); @@ -404,13 +417,14 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { } final URL dialogImageRef = dialogImage; - final AtomicReference<PropertiesDialog> dialogRef = new AtomicReference<PropertiesDialog>(); - final Stack<Runnable> mainThreadTasks = new Stack<Runnable>(); + final AtomicReference<PropertiesDialog> dialogRef = new AtomicReference<>(); + final Stack<Runnable> mainThreadTasks = new Stack<>(); try { if (EventQueue.isDispatchThread()) { dialogRef.set(new PropertiesDialog(settings, dialogImageRef, mainThreadTasks)); } else { EventQueue.invokeLater(new Runnable() { + @Override public void run() { dialogRef.set(new PropertiesDialog(settings, dialogImageRef, mainThreadTasks)); } @@ -455,6 +469,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonClickedCondition(MouseButton.RIGHT), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final Vector2 pos = Vector2.fetchTempInstance().set( @@ -468,12 +483,14 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { }, "pickTrigger")); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ESCAPE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { exit(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.L), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _lightState.setEnabled(!_lightState.isEnabled()); // Either an update or a markDirty is needed here since we did not touch the affected spatial directly. @@ -482,12 +499,14 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F4), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _showDepth = !_showDepth; } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.T), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _wireframeState.setEnabled(!_wireframeState.isEnabled()); // Either an update or a markDirty is needed here since we did not touch the affected spatial directly. @@ -496,24 +515,28 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.B), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _showBounds = !_showBounds; } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.C), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { System.out.println("Camera: " + _canvas.getCanvasRenderer().getCamera()); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.N), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _showNormals = !_showNormals; } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F1), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _doShot = true; } @@ -523,6 +546,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { MouseButton.LEFT), new MouseButtonClickedCondition(MouseButton.RIGHT)); _logicalLayer.registerTrigger(new InputTrigger(clickLeftOrRight, new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { System.err.println("clicked: " + inputStates.getCurrent().getMouseState().getClickCounts()); } @@ -530,6 +554,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonPressedCondition(MouseButton.LEFT), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { if (_mouseManager.isSetGrabbedSupported()) { _mouseManager.setGrabbed(GrabbedState.GRABBED); @@ -538,6 +563,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { })); _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonReleasedCondition(MouseButton.LEFT), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { if (_mouseManager.isSetGrabbedSupported()) { _mouseManager.setGrabbed(GrabbedState.NOT_GRABBED); @@ -546,6 +572,7 @@ public abstract class ExampleBase implements Runnable, Updater, Scene { })); _logicalLayer.registerTrigger(new InputTrigger(new AnyKeyCondition(), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { System.out.println("Key character pressed: " + inputState.getCurrent().getKeyboardState().getKeyEvent().getKeyChar()); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java index d3708be..a3fd849 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -29,6 +29,7 @@ import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.net.URLDecoder; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Enumeration; @@ -84,7 +85,6 @@ import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; import com.ardor3d.util.resource.ResourceLocatorTool; -import com.google.common.collect.Lists; /** * starter for Ardor3D examples @@ -114,6 +114,7 @@ public class ExampleRunner extends JFrame { "com/ardor3d/example/media/images/ardor3d_white_256.jpg") + "\"></p></body></html>"; private static Comparator<Class<?>> classComparator = new Comparator<Class<?>>() { + @Override public int compare(final Class<?> o1, final Class<?> o2) { return o1.getCanonicalName().compareTo(o2.getCanonicalName()); } @@ -130,14 +131,17 @@ public class ExampleRunner extends JFrame { tfPattern = new ErasableTextField(10); tfPattern.getDocument().addDocumentListener(new DocumentListener() { + @Override public void removeUpdate(final DocumentEvent e) { search(); } + @Override public void insertUpdate(final DocumentEvent e) { search(); } + @Override public void changedUpdate(final DocumentEvent e) { search(); } @@ -152,6 +156,7 @@ public class ExampleRunner extends JFrame { putValue(Action.SHORT_DESCRIPTION, "Expand all branches"); } + @Override public void actionPerformed(final ActionEvent e) { if (((JToggleButton) e.getSource()).isSelected()) { for (int row = 0; row < tree.getRowCount(); row++) { @@ -192,6 +197,7 @@ public class ExampleRunner extends JFrame { putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control R")); } + @Override public void actionPerformed(final ActionEvent e) { runSelected(); } @@ -209,6 +215,7 @@ public class ExampleRunner extends JFrame { putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control B")); } + @Override public void actionPerformed(final ActionEvent e) { browseSelected(); } @@ -224,6 +231,7 @@ public class ExampleRunner extends JFrame { putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control P")); } + @Override public void actionPerformed(final ActionEvent e) { navigateInMatches(-1); } @@ -239,6 +247,7 @@ public class ExampleRunner extends JFrame { putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control N")); } + @Override public void actionPerformed(final ActionEvent e) { navigateInMatches(1); } @@ -254,6 +263,7 @@ public class ExampleRunner extends JFrame { putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control F")); } + @Override public void actionPerformed(final ActionEvent e) { tree.setSelectionRow(0); navigateInMatches(1); @@ -306,6 +316,7 @@ public class ExampleRunner extends JFrame { tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { + @Override public void valueChanged(final TreeSelectionEvent e) { updateDescription(); updateActionStatus(); @@ -438,7 +449,7 @@ public class ExampleRunner extends JFrame { final Class<?> clazz = (Class<?>) selected; final boolean isWindows = System.getProperty("os.name").contains("Windows"); - final List<String> args = Lists.newArrayList(); + final List<String> args = new ArrayList<>(); args.add(isWindows ? "javaw" : "java"); args.add("-Xmx" + maxHeapMemory + "M"); args.add("-cp"); @@ -498,28 +509,31 @@ public class ExampleRunner extends JFrame { class ClassTreeModel implements TreeModel, SearchFilter { private final EventListenerList listeners = new EventListenerList(); - private final LinkedHashMap<Package, Vector<Class<?>>> classes = new LinkedHashMap<Package, Vector<Class<?>>>(); + private final LinkedHashMap<Package, Vector<Class<?>>> classes = new LinkedHashMap<>(); // the next two maps are for caching the status for the search filter - private final HashMap<Class<?>, Boolean> classMatches = new HashMap<Class<?>, Boolean>(); - private final HashMap<Package, Boolean> packageMatches = new HashMap<Package, Boolean>(); + private final HashMap<Class<?>, Boolean> classMatches = new HashMap<>(); + private final HashMap<Package, Boolean> packageMatches = new HashMap<>(); private String root = "all examples"; private FileFilter classFileFilter; private int size; private int matchCount = 0; + @Override public void addTreeModelListener(final TreeModelListener l) { listeners.add(TreeModelListener.class, l); } + @Override public Object getChild(final Object parent, final int index) { if (root.equals(parent)) { - final Vector<Package> vec = new Vector<Package>(classes.keySet()); + final Vector<Package> vec = new Vector<>(classes.keySet()); return vec.get(index); } final Vector<Class<?>> cl = classes.get(parent); return cl == null ? null : cl.get(index); } + @Override public int getChildCount(final Object parent) { if (root.equals(parent)) { return classes.size(); @@ -528,15 +542,17 @@ public class ExampleRunner extends JFrame { return cl == null ? 0 : cl.size(); } + @Override public int getIndexOfChild(final Object parent, final Object child) { if (root.equals(parent)) { - final Vector<Package> vec = new Vector<Package>(classes.keySet()); + final Vector<Package> vec = new Vector<>(classes.keySet()); return vec.indexOf(child); } final Vector<Class<?>> cl = classes.get(parent); return cl == null ? 0 : cl.indexOf(child); } + @Override public Object getRoot() { return root; } @@ -550,7 +566,7 @@ public class ExampleRunner extends JFrame { classMatches.put(clazz, false); Vector<Class<?>> cl = classes.get(clazz.getPackage()); if (cl == null) { - cl = new Vector<Class<?>>(); + cl = new Vector<>(); classes.put(clazz.getPackage(), cl); } size++; @@ -558,6 +574,7 @@ public class ExampleRunner extends JFrame { Collections.sort(cl, classComparator); } + @Override public int updateMatches(final String pattern) { int numberMatches = 0; final String lcPattern = pattern.toLowerCase(); @@ -610,6 +627,7 @@ public class ExampleRunner extends JFrame { return numberMatches; } + @Override public boolean matches(final Object value) { if (value instanceof Class<?>) { return classMatches.get(value); @@ -619,14 +637,17 @@ public class ExampleRunner extends JFrame { return res == null ? false : res; } + @Override public boolean isLeaf(final Object node) { return node instanceof Class<?>; } + @Override public void removeTreeModelListener(final TreeModelListener l) { listeners.remove(TreeModelListener.class, l); } + @Override public void valueForPathChanged(final TreePath path, final Object newValue) { fireTreeNodeChanged(path); } @@ -641,6 +662,7 @@ public class ExampleRunner extends JFrame { /** * @see FileFilter */ + @Override public boolean accept(final File pathname) { return (pathname.isDirectory() && (pathname.getName().length() == 0 || pathname.getName() .charAt(0) != '.')) @@ -838,16 +860,17 @@ public class ExampleRunner extends JFrame { this.searchFilter = searchFilter; } + @Override public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { if (value == null) { classNameLabel.setText("Null"); // Throw an exception? classNameLabel.setFont(defaultFont); } else { - if ((value != null) && (value instanceof Class<?>)) { + if (value instanceof Class<?>) { final Class<?> clazz = (Class<?>) value; classNameLabel.setText(clazz.getSimpleName()); - } else if ((value != null) && value instanceof Package) { + } else if (value instanceof Package) { String name = ((Package) value).getName(); if (name.startsWith(tree.getModel().getRoot().toString())) { name = name.substring(tree.getModel().getRoot().toString().length() + 1); @@ -969,6 +992,7 @@ public class ExampleRunner extends JFrame { putValue(Action.SMALL_ICON, getIcon("edit-clear-locationbar-rtl.png")); } + @Override public void actionPerformed(final ActionEvent e) { textField.setText(""); } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/GameThread.java b/ardor3d-examples/src/main/java/com/ardor3d/example/GameThread.java index 97bb1d7..357c164 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/GameThread.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/GameThread.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java index 6392202..83c93a9 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -266,13 +266,15 @@ public final class PropertiesDialog extends JDialog { displayResCombo.addKeyListener(aListener); samplesCombo = setUpSamplesChooser(); samplesCombo.addKeyListener(aListener); - colorDepthCombo = new JComboBox<String>(); + colorDepthCombo = new JComboBox<>(); colorDepthCombo.addKeyListener(aListener); - displayFreqCombo = new JComboBox<String>(); + displayFreqCombo = new JComboBox<>(); + displayFreqCombo.addKeyListener(aListener); fullscreenBox = new JCheckBox("Fullscreen?"); fullscreenBox.setSelected(source.isFullscreen()); fullscreenBox.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent e) { updateResolutionChoices(); } @@ -295,6 +297,7 @@ public final class PropertiesDialog extends JDialog { // Set the button action listeners. Cancel disposes without saving, OK // saves. ok.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent e) { if (verifyAndSaveCurrentSelection()) { dispose(); @@ -303,6 +306,7 @@ public final class PropertiesDialog extends JDialog { }); cancel.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent e) { cancelled = true; dispose(); @@ -410,10 +414,11 @@ public final class PropertiesDialog extends JDialog { */ private JComboBox<String> setUpResolutionChooser() { final String[] res = getResolutions(modes); - final JComboBox<String> resolutionBox = new JComboBox<String>(res); + final JComboBox<String> resolutionBox = new JComboBox<>(res); resolutionBox.setSelectedItem(source.getWidth() + " x " + source.getHeight()); resolutionBox.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent e) { updateDisplayChoices(); } @@ -429,20 +434,20 @@ public final class PropertiesDialog extends JDialog { * @return the list of renderers. */ private JComboBox<String> setUpRendererChooser() { - final JComboBox<String> nameBox = new JComboBox<String>(new String[] { "LWJGL 2.8.4", "JOGL 2.0rc11" }); - final String old = source.getRenderer(); - if (old != null) { - if (old.startsWith("LWJGL")) { - nameBox.setSelectedIndex(0); - } else if (old.startsWith("JOGL")) { - nameBox.setSelectedIndex(1); - } - } + final JComboBox<String> nameBox = new JComboBox<>(new String[] { "JOGL 2" }); + // final String old = source.getRenderer(); + /* + * if (old != null) { if (old.startsWith("JOGL")) { + */ + nameBox.setSelectedIndex(0); + /* + * } } + */ return nameBox; } private JComboBox<String> setUpSamplesChooser() { - final JComboBox<String> nameBox = new JComboBox<String>(samples); + final JComboBox<String> nameBox = new JComboBox<>(samples); nameBox.setSelectedItem(source.getRenderer()); return nameBox; } @@ -468,11 +473,11 @@ public final class PropertiesDialog extends JDialog { // grab available depths final String[] depths = getDepths(resolution, modes); - colorDepthCombo.setModel(new DefaultComboBoxModel<String>(depths)); + colorDepthCombo.setModel(new DefaultComboBoxModel<>(depths)); colorDepthCombo.setSelectedItem(colorDepth); // grab available frequencies final String[] freqs = getFrequencies(resolution, modes); - displayFreqCombo.setModel(new DefaultComboBoxModel<String>(freqs)); + displayFreqCombo.setModel(new DefaultComboBoxModel<>(freqs)); // Try to reset freq displayFreqCombo.setSelectedItem(displayFreq); } @@ -484,12 +489,12 @@ public final class PropertiesDialog extends JDialog { */ private void updateResolutionChoices() { if (!fullscreenBox.isSelected()) { - displayResCombo.setModel(new DefaultComboBoxModel<String>(windowedResolutions)); - colorDepthCombo.setModel(new DefaultComboBoxModel<String>(new String[] { "24 bpp", "16 bpp" })); - displayFreqCombo.setModel(new DefaultComboBoxModel<String>(new String[] { "n/a" })); + displayResCombo.setModel(new DefaultComboBoxModel<>(windowedResolutions)); + colorDepthCombo.setModel(new DefaultComboBoxModel<>(new String[] { "24 bpp", "16 bpp" })); + displayFreqCombo.setModel(new DefaultComboBoxModel<>(new String[] { "n/a" })); displayFreqCombo.setEnabled(false); } else { - displayResCombo.setModel(new DefaultComboBoxModel<String>(getResolutions(modes))); + displayResCombo.setModel(new DefaultComboBoxModel<>(getResolutions(modes))); displayFreqCombo.setEnabled(true); updateDisplayChoices(); } @@ -522,7 +527,7 @@ public final class PropertiesDialog extends JDialog { * Returns every unique resolution from an array of <code>DisplayMode</code>s. */ private static String[] getResolutions(final DisplayMode[] modes) { - final List<String> resolutions = new ArrayList<String>(modes.length); + final List<String> resolutions = new ArrayList<>(modes.length); for (int i = 0; i < modes.length; i++) { final String res = modes[i].getWidth() + " x " + modes[i].getHeight(); if (!resolutions.contains(res)) { @@ -539,7 +544,8 @@ public final class PropertiesDialog extends JDialog { * Returns every possible bit depth for the given resolution. */ private static String[] getDepths(final String resolution, final DisplayMode[] modes) { - final Set<String> depths = new TreeSet<String>(new Comparator<String>() { + final Set<String> depths = new TreeSet<>(new Comparator<String>() { + @Override public int compare(final String o1, final String o2) { // reverse order return -o1.compareTo(o2); @@ -568,7 +574,7 @@ public final class PropertiesDialog extends JDialog { * Returns every possible refresh rate for the given resolution. */ private static String[] getFrequencies(final String resolution, final DisplayMode[] modes) { - final List<String> freqs = new ArrayList<String>(4); + final List<String> freqs = new ArrayList<>(4); for (int i = 0; i < modes.length; i++) { final String res = modes[i].getWidth() + " x " + modes[i].getHeight(); final String freq = modes[i].getRefreshRate() + " Hz"; @@ -590,6 +596,7 @@ public final class PropertiesDialog extends JDialog { /** * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ + @Override public int compare(final DisplayMode a, final DisplayMode b) { // Width if (a.getWidth() != b.getWidth()) { @@ -630,10 +637,9 @@ public final class PropertiesDialog extends JDialog { this.renderer = renderer; } + @Override public void run() { - if (renderer.startsWith("LWJGL")) { - // TODO: can we implement this? - } else if (renderer.startsWith("JOGL")) { + if (renderer.startsWith("JOGL")) { // TODO: can we implement this? } ready = true; @@ -657,6 +663,7 @@ public final class PropertiesDialog extends JDialog { ModesRetriever() {} + @Override public void run() { try { modes = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayModes(); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesGameSettings.java b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesGameSettings.java index c180576..996cc57 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesGameSettings.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesGameSettings.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,7 +12,6 @@ package com.ardor3d.example; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -26,11 +25,11 @@ import com.ardor3d.util.resource.ResourceLocatorTool; /** * <code>PropertiesGameSettings</code> handles loading and saving a properties file that defines the display settings. A * property file is identified during creation of the object. The properties file should have the following format: - * + * * <PRE> * <CODE> * FREQ=60 - * RENDERER=LWJGL + * RENDERER=JOGL * WIDTH=1280 * HEIGHT=1024 * DEPTH=32 @@ -64,7 +63,7 @@ public class PropertiesGameSettings { /** * The default renderer flag, used if there is a problem with the properties file. */ - static String DEFAULT_RENDERER = "LWJGL"; + static String DEFAULT_RENDERER = "JOGL"; static boolean DEFAULT_VERTICAL_SYNC = true; static int DEFAULT_DEPTH_BITS = 8; @@ -106,7 +105,7 @@ public class PropertiesGameSettings { /** * Constructor creates the <code>PropertiesGameSettings</code> object for use. - * + * * @param personalFilename * the properties file to use, read from filesystem. Must not be null. * @param dfltsFilename @@ -138,7 +137,7 @@ public class PropertiesGameSettings { /** * <code>get</code> takes an arbitrary string as a key and returns any value associated with it, null if none. - * + * * @param key * the key to use for data retrieval. * @return the string associated with the key, null if none. @@ -154,7 +153,7 @@ public class PropertiesGameSettings { /** * If the properties file does not contain the setting or was not read properly, the default value is returned. - * + * * @throws InternalError * in all cases */ @@ -183,7 +182,7 @@ public class PropertiesGameSettings { /** * <code>getDepth</code> returns the depth as read from the properties file. If the properties file does not contain * depth or was not read properly, the default depth is returned. - * + * * @return the depth determined by the properties file, or the default. */ public int getDepth() { @@ -197,7 +196,7 @@ public class PropertiesGameSettings { /** * If the properties file does not contain the setting or was not read properly, the default value is returned. - * + * * @throws InternalError * in all cases */ @@ -218,7 +217,7 @@ public class PropertiesGameSettings { /** * If the properties file does not contain the setting or was not read properly, the default value is returned. - * + * * @throws InternalError * in all cases */ @@ -230,7 +229,7 @@ public class PropertiesGameSettings { /** * <code>getFrequency</code> returns the frequency of the monitor as read from the properties file. If the * properties file does not contain frequency or was not read properly the default frequency is returned. - * + * * @return the frequency determined by the properties file, or the default. */ public int getFrequency() { @@ -244,7 +243,7 @@ public class PropertiesGameSettings { /** * Legacy method. - * + * * @deprecated Use method isFullscreen instead. * @see #isFullscreen() */ @@ -256,7 +255,7 @@ public class PropertiesGameSettings { /** * <code>getHeight</code> returns the height as read from the properties file. If the properties file does not * contain height or was not read properly, the default height is returned. - * + * * @return the height determined by the properties file, or the default. */ public int getHeight() { @@ -284,9 +283,9 @@ public class PropertiesGameSettings { } /** - * + * * <code>getRenderer</code> returns the requested rendering API, or the default. - * + * * @return the rendering API or the default. */ public String getRenderer() { @@ -300,7 +299,7 @@ public class PropertiesGameSettings { /** * If the properties file does not contain the setting or was not read properly, the default value is returned. - * + * * @throws InternalError * in all cases */ @@ -311,7 +310,7 @@ public class PropertiesGameSettings { /** * If the properties file does not contain the setting or was not read properly, the default value is returned. - * + * * @throws InternalError * in all cases */ @@ -323,7 +322,7 @@ public class PropertiesGameSettings { /** * <code>getWidth</code> returns the width as read from the properties file. If the properties file does not contain * width or was not read properly, the default width is returned. - * + * * @return the width determined by the properties file, or the default. */ public int getWidth() { @@ -338,7 +337,7 @@ public class PropertiesGameSettings { /** * <code>isFullscreen</code> returns the fullscreen flag as read from the properties file. If the properties file * does not contain the fullscreen flag or was not read properly, the default value is returned. - * + * * @return the fullscreen flag determined by the properties file, or the default. */ public boolean isFullscreen() { @@ -352,7 +351,7 @@ public class PropertiesGameSettings { /** * If the properties file does not contain the setting or was not read properly, the default value is returned. - * + * * @throws InternalError * in all cases */ @@ -367,7 +366,7 @@ public class PropertiesGameSettings { /** * If the properties file does not contain the setting or was not read properly, the default value is returned. - * + * * @throws InternalError * in all cases */ @@ -378,7 +377,7 @@ public class PropertiesGameSettings { /** * If the properties file does not contain the setting or was not read properly, the default value is returned. - * + * * @throws InternalError * in all cases */ @@ -390,35 +389,26 @@ public class PropertiesGameSettings { /** * <code>load</code> attempts to load the properties file defined during instantiation and put all properties in the * table. If there is a problem loading or reading the file, false is returned. If all goes well, true is returned. - * + * * @return the success of the load, true indicated success and false indicates failure. */ public boolean load() { - FileInputStream fin = null; - try { - fin = new FileInputStream(filename); - } catch (final FileNotFoundException e) { - logger.warning("Could not load properties. Creating a new one."); - return false; - } - - try { + try (final FileInputStream fin = new FileInputStream(filename)) { prop.load(fin); - fin.close(); + + // confirm that the properties file has all the data we need. + if (null == prop.getProperty("WIDTH") || null == prop.getProperty("HEIGHT") + || null == prop.getProperty("DEPTH") || null == prop.getProperty("FULLSCREEN")) { + logger.warning("Properties file not complete."); + return false; + } + + logger.finer("Read properties"); + return true; } catch (final IOException e) { logger.warning("Could not load properties. Creating a new one."); return false; } - - // confirm that the properties file has all the data we need. - if (null == prop.getProperty("WIDTH") || null == prop.getProperty("HEIGHT") - || null == prop.getProperty("DEPTH") || null == prop.getProperty("FULLSCREEN")) { - logger.warning("Properties file not complete."); - return false; - } - - logger.finer("Read properties"); - return true; } /** @@ -430,21 +420,20 @@ public class PropertiesGameSettings { /** * Persists current property mappings to designated file, overwriting if file already present. - * + * * @throws IOException * for I/O failures */ public void save() throws IOException { - final FileOutputStream fout = new FileOutputStream(filename); - prop.store(fout, "Game Settings written by " + getClass().getName() + " at " + new java.util.Date()); - - fout.close(); + try (final FileOutputStream fout = new FileOutputStream(filename)) { + prop.store(fout, "Game Settings written by " + getClass().getName() + " at " + new java.util.Date()); + } logger.finer("Saved properties"); } /** * <code>save(int, int, int, int, boolean, String)</code> overwrites the properties file with the given parameters. - * + * * @param width * the width of the resolution. * @param height @@ -595,7 +584,7 @@ public class PropertiesGameSettings { /** * Not implemented. Properties can not store an arbitrary Object in human-readable format. Use set(String, String) * instead. - * + * * @see #set(String, String) * @throws InternalError * in all cases @@ -648,7 +637,7 @@ public class PropertiesGameSettings { /** * save() method which throws only a RuntimeExceptin. - * + * * @throws RuntimeSetting * for IO failure * @see #save() @@ -675,7 +664,7 @@ public class PropertiesGameSettings { * AbstractGameSettings.assignDefaults(propfilename). * <P/> * Property file paths are relative to CLASSPATH element roots. - * + * * @param propFileName * Properties file read as CLASSPATH resource. If you give null, no properties file will be loaded. */ @@ -745,8 +734,9 @@ public class PropertiesGameSettings { try { p.load(istream); } catch (final IOException ioe) { - logger.log(Level.WARNING, "Failed to load customizations from '" + propFileName - + "'. Continuing without customizations.", ioe); + logger.log(Level.WARNING, + "Failed to load customizations from '" + propFileName + "'. Continuing without customizations.", + ioe); return; } Integer i; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/Purpose.java b/ardor3d-examples/src/main/java/com/ardor3d/example/Purpose.java index 0fb9e41..f6ea79d 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/Purpose.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/Purpose.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/applet/JoglBaseApplet.java b/ardor3d-examples/src/main/java/com/ardor3d/example/applet/JoglBaseApplet.java deleted file mode 100644 index 0c3f726..0000000 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/applet/JoglBaseApplet.java +++ /dev/null @@ -1,328 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.example.applet; - -import java.applet.Applet; -import java.awt.BorderLayout; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.net.URISyntaxException; -import java.util.concurrent.Callable; - -import javax.media.nativewindow.util.DimensionImmutable; - -import com.ardor3d.annotation.MainThread; -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.framework.FrameHandler; -import com.ardor3d.framework.Scene; -import com.ardor3d.framework.Updater; -import com.ardor3d.framework.jogl.JoglCanvasRenderer; -import com.ardor3d.framework.jogl.JoglNewtAwtCanvas; -import com.ardor3d.image.util.awt.AWTImageLoader; -import com.ardor3d.input.GrabbedState; -import com.ardor3d.input.Key; -import com.ardor3d.input.MouseButton; -import com.ardor3d.input.PhysicalLayer; -import com.ardor3d.input.control.FirstPersonControl; -import com.ardor3d.input.jogl.JoglNewtFocusWrapper; -import com.ardor3d.input.jogl.JoglNewtKeyboardWrapper; -import com.ardor3d.input.jogl.JoglNewtMouseManager; -import com.ardor3d.input.jogl.JoglNewtMouseWrapper; -import com.ardor3d.input.logical.InputTrigger; -import com.ardor3d.input.logical.KeyReleasedCondition; -import com.ardor3d.input.logical.LogicalLayer; -import com.ardor3d.input.logical.MouseButtonPressedCondition; -import com.ardor3d.input.logical.MouseButtonReleasedCondition; -import com.ardor3d.input.logical.TriggerAction; -import com.ardor3d.input.logical.TwoInputStates; -import com.ardor3d.intersection.PickResults; -import com.ardor3d.math.Ray3; -import com.ardor3d.math.Vector3; -import com.ardor3d.renderer.Camera; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.TextureRendererFactory; -import com.ardor3d.renderer.jogl.JoglTextureRendererProvider; -import com.ardor3d.renderer.state.ZBufferState; -import com.ardor3d.scenegraph.Node; -import com.ardor3d.util.Constants; -import com.ardor3d.util.ContextGarbageCollector; -import com.ardor3d.util.GameTaskQueue; -import com.ardor3d.util.GameTaskQueueManager; -import com.ardor3d.util.ReadOnlyTimer; -import com.ardor3d.util.Timer; -import com.ardor3d.util.resource.ResourceLocatorTool; -import com.ardor3d.util.resource.SimpleResourceLocator; -import com.ardor3d.util.stat.StatCollector; - -/** - * An example base class for ardor3d/jogl applets. This is not meant to be a "best-practices" applet, just a rough demo - * showing possibilities. As such, there are likely bugs, etc. Please report these. :) - */ -public abstract class JoglBaseApplet extends Applet implements Scene { - - private static final long serialVersionUID = 1L; - - protected DisplaySettings _settings; - protected JoglNewtAwtCanvas _glCanvas; - protected LogicalLayer _logicalLayer; - protected PhysicalLayer _physicalLayer; - protected JoglNewtMouseManager _mouseManager; - - protected FirstPersonControl _controlHandle; - protected Vector3 _worldUp = new Vector3(0, 1, 0); - - protected Thread _gameThread; - protected boolean _running = false; - - protected final Timer _timer = new Timer(); - protected final Node _root = new Node(); - protected final FrameHandler frameHandler = new FrameHandler(_timer); - - @Override - public void init() { - _settings = getSettings(); - setLayout(new BorderLayout(0, 0)); - try { - TextureRendererFactory.INSTANCE.setProvider(new JoglTextureRendererProvider()); - final JoglCanvasRenderer canvasRenderer = new JoglCanvasRenderer(this); - _glCanvas = new JoglNewtAwtCanvas(_settings, canvasRenderer) { - private static final long serialVersionUID = 1L; - - @Override - public final void removeNotify() { - stopJOGL(); - super.removeNotify(); - } - }; - ; - _glCanvas.setSize(getWidth(), getHeight()); - _glCanvas.setFocusable(true); - _glCanvas.requestFocus(); - _glCanvas.setIgnoreRepaint(true); - _glCanvas.addComponentListener(new ComponentAdapter() { - @Override - public void componentResized(final ComponentEvent e) { - GameTaskQueueManager.getManager(_glCanvas.getCanvasRenderer().getRenderContext()).update( - new Callable<Void>() { - public Void call() throws Exception { - final Camera cam = _glCanvas.getCanvasRenderer().getCamera(); - cam.resize(getWidth(), getHeight()); - cam.setFrustumPerspective(cam.getFovY(), getWidth() / (double) getHeight(), - cam.getFrustumNear(), cam.getFrustumFar()); - appletResized(getWidth(), getHeight()); - return null; - } - }); - } - }); - frameHandler.addCanvas(_glCanvas); - frameHandler.addUpdater(new Updater() { - - @Override - @MainThread - public void update(final ReadOnlyTimer timer) { - JoglBaseApplet.this.update(); - } - - @Override - @MainThread - public void init() { - initInput(); - initBaseScene(); - initAppletScene(); - } - }); - add(_glCanvas, BorderLayout.CENTER); - setVisible(true); - startJOGL(); - } catch (final Exception e) { - System.err.println(e); - throw new RuntimeException("Unable to create display"); - } - } - - protected DisplaySettings getSettings() { - return new DisplaySettings(getWidth(), getHeight(), 8, 0); - } - - @Override - public void destroy() { - remove(_glCanvas); - } - - protected void startJOGL() { - frameHandler.init(); - _gameThread = new Thread() { - @Override - public void run() { - _running = true; - gameLoop(); - } - }; - _gameThread.start(); - } - - protected void stopJOGL() { - _running = false; - try { - _gameThread.join(); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - } - - protected void gameLoop() { - while (_running) { - frameHandler.updateFrame(); - Thread.yield(); - } - } - - public void update() { - _timer.update(); - - /** update stats, if enabled. */ - if (Constants.stats) { - StatCollector.update(); - } - updateLogicalLayer(_timer); - - // Execute updateQueue item - GameTaskQueueManager.getManager(_glCanvas.getCanvasRenderer().getRenderContext()) - .getQueue(GameTaskQueue.UPDATE).execute(); - updateAppletScene(_timer); - - // Update controllers/render states/transforms/bounds for rootNode. - _root.updateGeometricState(_timer.getTimePerFrame(), true); - } - - protected void updateLogicalLayer(final ReadOnlyTimer timer) { - // check and execute any input triggers, if we are concerned with input - if (_logicalLayer != null) { - _logicalLayer.checkTriggers(timer.getTimePerFrame()); - } - } - - protected void initInput() { - _mouseManager = new JoglNewtMouseManager(_glCanvas); - _logicalLayer = new LogicalLayer(); - _physicalLayer = new PhysicalLayer(new JoglNewtKeyboardWrapper(_glCanvas), new JoglNewtMouseWrapper(_glCanvas, - _mouseManager), new JoglNewtFocusWrapper(_glCanvas)); - _logicalLayer.registerInput(_glCanvas, _physicalLayer); - _controlHandle = FirstPersonControl.setupTriggers(_logicalLayer, _worldUp, true); - - _logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.F), new TriggerAction() { - - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - - _glCanvas.getNewtWindow().setFullscreen(!_glCanvas.getNewtWindow().isFullscreen()); - final Camera cam = _glCanvas.getCanvasRenderer().getCamera(); - if (_glCanvas.getNewtWindow().isFullscreen()) { - final DimensionImmutable screenSizeMM = _glCanvas.getNewtWindow().getMainMonitor().getSizeMM(); - cam.resize(screenSizeMM.getWidth(), screenSizeMM.getHeight()); - cam.setFrustumPerspective(cam.getFovY(), - screenSizeMM.getWidth() / (float) screenSizeMM.getHeight(), cam.getFrustumNear(), - cam.getFrustumFar()); - appletResized(screenSizeMM.getWidth(), screenSizeMM.getHeight()); - } else { - cam.resize(getWidth(), getHeight()); - cam.setFrustumPerspective(cam.getFovY(), getWidth() / (float) getHeight(), cam.getFrustumNear(), - cam.getFrustumFar()); - appletResized(getWidth(), getHeight()); - } - } - })); - - _logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.V), new TriggerAction() { - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - _glCanvas.setVSyncEnabled(true); - } - })); - - _logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.B), new TriggerAction() { - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - _glCanvas.setVSyncEnabled(false); - } - })); - - _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonPressedCondition(MouseButton.LEFT), - new TriggerAction() { - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - if (_mouseManager.isSetGrabbedSupported()) { - _mouseManager.setGrabbed(GrabbedState.GRABBED); - } - } - })); - - _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonReleasedCondition(MouseButton.LEFT), - new TriggerAction() { - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - if (_mouseManager.isSetGrabbedSupported()) { - _mouseManager.setGrabbed(GrabbedState.NOT_GRABBED); - } - } - })); - } - - protected void initBaseScene() { - // Add our awt based image loader. - AWTImageLoader.registerLoader(); - - // Set the location of our example resources. - try { - final SimpleResourceLocator srl = new SimpleResourceLocator(ResourceLocatorTool.getClassPathResource( - LwjglBaseApplet.class, "com/ardor3d/example/media/")); - ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, srl); - } catch (final URISyntaxException ex) { - ex.printStackTrace(); - } - - // Create a ZBuffer to display pixels closest to the camera above farther ones. - final ZBufferState buf = new ZBufferState(); - buf.setEnabled(true); - buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo); - _root.setRenderState(buf); - } - - public PickResults doPick(final Ray3 pickRay) { - // ignore - return null; - } - - public boolean renderUnto(final Renderer renderer) { - // Execute renderQueue item - GameTaskQueueManager.getManager(_glCanvas.getCanvasRenderer().getRenderContext()) - .getQueue(GameTaskQueue.RENDER).execute(renderer); - - // Clean up card garbage such as textures, vbos, etc. - ContextGarbageCollector.doRuntimeCleanup(renderer); - - renderScene(renderer); - - return true; - } - - protected abstract void initAppletScene(); - - protected void updateAppletScene(final ReadOnlyTimer timer) {}; - - protected void renderScene(final Renderer renderer) { - // Draw the root and all its children. - renderer.draw(_root); - } - - protected void appletResized(final int width, final int height) {} -} diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/applet/LwjglBaseApplet.java b/ardor3d-examples/src/main/java/com/ardor3d/example/applet/LwjglBaseApplet.java deleted file mode 100644 index ab1d9f9..0000000 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/applet/LwjglBaseApplet.java +++ /dev/null @@ -1,335 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.example.applet; - -import java.applet.Applet; -import java.awt.BorderLayout; -import java.awt.Canvas; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.net.URISyntaxException; -import java.util.concurrent.Callable; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.DisplayMode; - -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.framework.Scene; -import com.ardor3d.framework.lwjgl.LwjglCanvasRenderer; -import com.ardor3d.framework.lwjgl.LwjglDisplayCanvas; -import com.ardor3d.image.util.awt.AWTImageLoader; -import com.ardor3d.input.GrabbedState; -import com.ardor3d.input.Key; -import com.ardor3d.input.MouseButton; -import com.ardor3d.input.PhysicalLayer; -import com.ardor3d.input.control.FirstPersonControl; -import com.ardor3d.input.logical.InputTrigger; -import com.ardor3d.input.logical.KeyReleasedCondition; -import com.ardor3d.input.logical.LogicalLayer; -import com.ardor3d.input.logical.MouseButtonPressedCondition; -import com.ardor3d.input.logical.MouseButtonReleasedCondition; -import com.ardor3d.input.logical.TriggerAction; -import com.ardor3d.input.logical.TwoInputStates; -import com.ardor3d.input.lwjgl.LwjglControllerWrapper; -import com.ardor3d.input.lwjgl.LwjglKeyboardWrapper; -import com.ardor3d.input.lwjgl.LwjglMouseManager; -import com.ardor3d.input.lwjgl.LwjglMouseWrapper; -import com.ardor3d.intersection.PickResults; -import com.ardor3d.math.Ray3; -import com.ardor3d.math.Vector3; -import com.ardor3d.renderer.Camera; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.TextureRendererFactory; -import com.ardor3d.renderer.lwjgl.LwjglTextureRendererProvider; -import com.ardor3d.renderer.state.ZBufferState; -import com.ardor3d.scenegraph.Node; -import com.ardor3d.util.Constants; -import com.ardor3d.util.ContextGarbageCollector; -import com.ardor3d.util.GameTaskQueue; -import com.ardor3d.util.GameTaskQueueManager; -import com.ardor3d.util.ReadOnlyTimer; -import com.ardor3d.util.Timer; -import com.ardor3d.util.resource.ResourceLocatorTool; -import com.ardor3d.util.resource.SimpleResourceLocator; -import com.ardor3d.util.stat.StatCollector; - -/** - * An example base class for ardor3d/lwjgl applets. This is not meant to be a "best-practices" applet, just a rough demo - * showing possibilities. As such, there are likely bugs, etc. Please report these. :) - */ -public abstract class LwjglBaseApplet extends Applet implements Scene { - - private static final long serialVersionUID = 1L; - - protected DisplaySettings _settings; - protected LwjglDisplayCanvas _glCanvas; - protected LogicalLayer _logicalLayer; - protected PhysicalLayer _physicalLayer; - protected Canvas _displayCanvas; - protected LwjglMouseManager _mouseManager; - - protected FirstPersonControl _controlHandle; - protected Vector3 _worldUp = new Vector3(0, 1, 0); - - protected Thread _gameThread; - protected boolean _running = false; - - protected final Timer _timer = new Timer(); - protected final Node _root = new Node(); - - @Override - public void init() { - _settings = getSettings(); - setLayout(new BorderLayout(0, 0)); - try { - _displayCanvas = new Canvas() { - private static final long serialVersionUID = 1L; - - @Override - public final void addNotify() { - super.addNotify(); - startLWJGL(); - } - - @Override - public final void removeNotify() { - stopLWJGL(); - super.removeNotify(); - } - }; - _displayCanvas.setSize(getWidth(), getHeight()); - add(_displayCanvas, BorderLayout.CENTER); - _displayCanvas.setFocusable(true); - _displayCanvas.requestFocus(); - _displayCanvas.setIgnoreRepaint(true); - _displayCanvas.addComponentListener(new ComponentAdapter() { - @Override - public void componentResized(final ComponentEvent e) { - GameTaskQueueManager.getManager(_glCanvas.getCanvasRenderer().getRenderContext()).update( - new Callable<Void>() { - public Void call() throws Exception { - final Camera cam = _glCanvas.getCanvasRenderer().getCamera(); - cam.resize(getWidth(), getHeight()); - cam.setFrustumPerspective(cam.getFovY(), getWidth() / (double) getHeight(), - cam.getFrustumNear(), cam.getFrustumFar()); - appletResized(getWidth(), getHeight()); - return null; - } - }); - } - }); - setVisible(true); - } catch (final Exception e) { - System.err.println(e); - throw new RuntimeException("Unable to create display"); - } - } - - protected DisplaySettings getSettings() { - return new DisplaySettings(getWidth(), getHeight(), 8, 0); - } - - @Override - public void destroy() { - remove(_displayCanvas); - } - - protected void startLWJGL() { - _gameThread = new Thread() { - @Override - public void run() { - _running = true; - try { - initGL(); - initInput(); - initBaseScene(); - initAppletScene(); - gameLoop(); - } catch (final LWJGLException ex) { - ex.printStackTrace(); - } - } - }; - _gameThread.start(); - } - - protected void stopLWJGL() { - _running = false; - try { - _gameThread.join(); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - } - - protected void gameLoop() { - while (_running) { - update(); - _glCanvas.draw(null); - Thread.yield(); - } - } - - protected void update() { - _timer.update(); - - /** update stats, if enabled. */ - if (Constants.stats) { - StatCollector.update(); - } - - updateLogicalLayer(_timer); - - // Execute updateQueue item - GameTaskQueueManager.getManager(_glCanvas.getCanvasRenderer().getRenderContext()) - .getQueue(GameTaskQueue.UPDATE).execute(); - - updateAppletScene(_timer); - - // Update controllers/render states/transforms/bounds for rootNode. - _root.updateGeometricState(_timer.getTimePerFrame(), true); - } - - protected void updateLogicalLayer(final ReadOnlyTimer timer) { - // check and execute any input triggers, if we are concerned with input - if (_logicalLayer != null) { - _logicalLayer.checkTriggers(timer.getTimePerFrame()); - } - } - - protected void initGL() throws LWJGLException { - TextureRendererFactory.INSTANCE.setProvider(new LwjglTextureRendererProvider()); - final LwjglCanvasRenderer canvasRenderer = new LwjglCanvasRenderer(this); - _glCanvas = new LwjglDisplayCanvas(_displayCanvas, _settings, canvasRenderer); - _glCanvas.init(); - - // by default, we'll keep it vsync'd - _glCanvas.setVSyncEnabled(true); - } - - protected void initInput() { - _mouseManager = new LwjglMouseManager(); - _logicalLayer = new LogicalLayer(); - _physicalLayer = new PhysicalLayer(new LwjglKeyboardWrapper(), new LwjglMouseWrapper(), - new LwjglControllerWrapper(), _glCanvas); - _logicalLayer.registerInput(_glCanvas, _physicalLayer); - _controlHandle = FirstPersonControl.setupTriggers(_logicalLayer, _worldUp, true); - - _logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.F), new TriggerAction() { - - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - try { - _glCanvas.setFullScreen(!_glCanvas.isFullScreen()); - final Camera cam = _glCanvas.getCanvasRenderer().getCamera(); - if (_glCanvas.isFullScreen()) { - final DisplayMode mode = Display.getDisplayMode(); - cam.resize(mode.getWidth(), mode.getHeight()); - cam.setFrustumPerspective(cam.getFovY(), mode.getWidth() / (float) mode.getHeight(), - cam.getFrustumNear(), cam.getFrustumFar()); - appletResized(mode.getWidth(), mode.getHeight()); - } else { - cam.resize(getWidth(), getHeight()); - cam.setFrustumPerspective(cam.getFovY(), getWidth() / (float) getHeight(), - cam.getFrustumNear(), cam.getFrustumFar()); - appletResized(getWidth(), getHeight()); - } - } catch (final LWJGLException ex) { - ex.printStackTrace(); - } - } - })); - - _logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.V), new TriggerAction() { - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - _glCanvas.setVSyncEnabled(true); - } - })); - - _logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.B), new TriggerAction() { - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - _glCanvas.setVSyncEnabled(false); - } - })); - - _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonPressedCondition(MouseButton.LEFT), - new TriggerAction() { - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - if (_mouseManager.isSetGrabbedSupported()) { - _mouseManager.setGrabbed(GrabbedState.GRABBED); - } - } - })); - - _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonReleasedCondition(MouseButton.LEFT), - new TriggerAction() { - public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState, - final double tpf) { - if (_mouseManager.isSetGrabbedSupported()) { - _mouseManager.setGrabbed(GrabbedState.NOT_GRABBED); - } - } - })); - } - - protected void initBaseScene() { - // Add our awt based image loader. - AWTImageLoader.registerLoader(); - - // Set the location of our example resources. - try { - final SimpleResourceLocator srl = new SimpleResourceLocator(ResourceLocatorTool.getClassPathResource( - LwjglBaseApplet.class, "com/ardor3d/example/media/")); - ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, srl); - } catch (final URISyntaxException ex) { - ex.printStackTrace(); - } - - // Create a ZBuffer to display pixels closest to the camera above farther ones. - final ZBufferState buf = new ZBufferState(); - buf.setEnabled(true); - buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo); - _root.setRenderState(buf); - } - - public PickResults doPick(final Ray3 pickRay) { - // ignore - return null; - } - - public boolean renderUnto(final Renderer renderer) { - // Execute renderQueue item - GameTaskQueueManager.getManager(_glCanvas.getCanvasRenderer().getRenderContext()) - .getQueue(GameTaskQueue.RENDER).execute(renderer); - - // Clean up card garbage such as textures, vbos, etc. - ContextGarbageCollector.doRuntimeCleanup(renderer); - - renderScene(renderer); - - return true; - } - - protected abstract void initAppletScene(); - - protected void updateAppletScene(final ReadOnlyTimer timer) {}; - - protected void renderScene(final Renderer renderer) { - // Draw the root and all its children. - renderer.draw(_root); - } - - protected void appletResized(final int width, final int height) {} -} diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/applet/LwjglBoxApplet.java b/ardor3d-examples/src/main/java/com/ardor3d/example/applet/LwjglBoxApplet.java deleted file mode 100644 index 2d43ba7..0000000 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/applet/LwjglBoxApplet.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.example.applet; - -import com.ardor3d.bounding.BoundingBox; -import com.ardor3d.image.Texture; -import com.ardor3d.math.MathUtils; -import com.ardor3d.math.Matrix3; -import com.ardor3d.math.Vector3; -import com.ardor3d.renderer.state.TextureState; -import com.ardor3d.scenegraph.Spatial; -import com.ardor3d.scenegraph.controller.SpatialController; -import com.ardor3d.scenegraph.shape.Box; -import com.ardor3d.util.TextureManager; - -/** - * The classic "Box Example" as an Ardor3D/LWJGL applet. - */ -public class LwjglBoxApplet extends LwjglBaseApplet { - - private static final long serialVersionUID = 1L; - - @Override - protected void initAppletScene() { - // Make a box... - final Box box = new Box("Box", Vector3.ZERO, 5, 5, 5); - - // Make it a bit more colorful. - box.setRandomColors(); - - // Setup a bounding box for it. - box.setModelBound(new BoundingBox()); - - // Set its location in space. - box.setTranslation(new Vector3(0, 0, -15)); - - // Add to root. - _root.attachChild(box); - - // set it to rotate: - box.addController(new SpatialController<Spatial>() { - private final Vector3 _axis = new Vector3(1, 1, 0.5f).normalizeLocal(); - private final Matrix3 _rotate = new Matrix3(); - private double _angle = 0; - - public void update(final double time, final Spatial caller) { - // update our rotation - _angle = _angle + (_timer.getTimePerFrame() * 25); - if (_angle > 180) { - _angle = -180; - } - - _rotate.fromAngleNormalAxis(_angle * MathUtils.DEG_TO_RAD, _axis); - box.setRotation(_rotate); - } - }); - - // Create a texture from the Ardor3D logo. - final TextureState ts = new TextureState(); - ts.setEnabled(true); - ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true)); - box.setRenderState(ts); - } -} diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/BoxExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/BoxExample.java index c000f3b..ca6d103 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/BoxExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/BoxExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/JoglBasicExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/JoglBasicExample.java index 4e6bd8b..f0c23f6 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/JoglBasicExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/JoglBasicExample.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,12 +14,13 @@ import java.net.URISyntaxException; import com.ardor3d.bounding.BoundingBox; import com.ardor3d.example.Purpose; +import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.Scene; -import com.ardor3d.framework.jogl.JoglCanvas; import com.ardor3d.framework.jogl.JoglCanvasRenderer; +import com.ardor3d.framework.jogl.JoglNewtWindow; import com.ardor3d.image.Texture; -import com.ardor3d.image.util.awt.AWTImageLoader; +import com.ardor3d.image.util.jogl.JoglImageLoader; import com.ardor3d.intersection.PickResults; import com.ardor3d.math.MathUtils; import com.ardor3d.math.Matrix3; @@ -36,13 +37,15 @@ import com.ardor3d.util.TextureManager; import com.ardor3d.util.Timer; import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.SimpleResourceLocator; +import com.jogamp.newt.event.WindowAdapter; +import com.jogamp.newt.event.WindowEvent; /** * <p> * This jogl-based example is meant to show how to use Ardor3D at the most primitive level, forsaking the use of * ExampleBase and much of our framework classes and interfaces. * </p> - * + * * <p> * Also of note, this example does not allow choosing of properties on launch. It also does not handle input or show any * special debugging. This is to simplify the example to the basic essentials. @@ -54,7 +57,7 @@ maxHeapMemory = 64) public class JoglBasicExample implements Scene { // Our native window, not the gl surface itself. - private final JoglCanvas _canvas; + private final JoglNewtWindow _canvas; // Our timer. private final Timer _timer = new Timer(); @@ -85,28 +88,34 @@ public class JoglBasicExample implements Scene { private void start() { initExample(); + _canvas.addWindowListener(new WindowAdapter() { + @Override + public void windowDestroyNotify(final WindowEvent e) { + final CanvasRenderer cr = _canvas.getCanvasRenderer(); + cr.makeCurrentContext(); + // Done, do cleanup + ContextGarbageCollector.doFinalCleanup(cr.getRenderer()); + cr.releaseCurrentContext(); + } + }); + // Run in this same thread. while (!_exit) { updateExample(); _canvas.draw(null); Thread.yield(); } - _canvas.getCanvasRenderer().makeCurrentContext(); - - // Done, do cleanup - ContextGarbageCollector.doFinalCleanup(_canvas.getCanvasRenderer().getRenderer()); - _canvas.close(); } /** * Setup a jogl canvas and canvas renderer. - * + * * @return the canvas. */ - private JoglCanvas initJogl() { + private JoglNewtWindow initJogl() { final JoglCanvasRenderer canvasRenderer = new JoglCanvasRenderer(this); final DisplaySettings settings = new DisplaySettings(800, 600, 24, 0, 0, 8, 0, 0, false, false); - return new JoglCanvas(canvasRenderer, settings); + return new JoglNewtWindow(canvasRenderer, settings); } /** @@ -136,6 +145,7 @@ public class JoglBasicExample implements Scene { private final Matrix3 _rotate = new Matrix3(); private double _angle = 0; + @Override public void update(final double time, final Box caller) { // update our rotation _angle = _angle + (_timer.getTimePerFrame() * 25); @@ -148,8 +158,8 @@ public class JoglBasicExample implements Scene { } }); - // Add our awt based image loader. - AWTImageLoader.registerLoader(); + // Add our newt based image loader. + JoglImageLoader.registerLoader(); // Set the location of our example resources. try { @@ -191,6 +201,7 @@ public class JoglBasicExample implements Scene { // ------ Scene methods ------ + @Override public boolean renderUnto(final Renderer renderer) { if (!_canvas.isClosing()) { @@ -202,6 +213,7 @@ public class JoglBasicExample implements Scene { return false; } + @Override public PickResults doPick(final Ray3 pickRay) { // Ignore return null; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LineExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LineExample.java index a4fcfa8..8442598 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LineExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LineExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -107,7 +107,7 @@ public class LineExample extends ExampleBase { private Line makeLine(final Grapher grapher, final double min, final double max, final double step) { // This is just one way to make a line... You can also generate the FloatBuffer directly. // Make an array to hold the Vector3 points that will make up our Line. - final ArrayList<Vector3> vertexList = new ArrayList<Vector3>(); + final ArrayList<Vector3> vertexList = new ArrayList<>(); // Step through our range [min, max] by our step amount. for (double x = min; x <= max; x += step) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LwjglBasicExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LwjglBasicExample.java deleted file mode 100644 index 26f5118..0000000 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LwjglBasicExample.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.example.basic; - -import java.net.URISyntaxException; - -import com.ardor3d.bounding.BoundingBox; -import com.ardor3d.example.Purpose; -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.framework.Scene; -import com.ardor3d.framework.lwjgl.LwjglCanvas; -import com.ardor3d.framework.lwjgl.LwjglCanvasRenderer; -import com.ardor3d.image.Texture; -import com.ardor3d.image.util.awt.AWTImageLoader; -import com.ardor3d.intersection.PickResults; -import com.ardor3d.math.MathUtils; -import com.ardor3d.math.Matrix3; -import com.ardor3d.math.Ray3; -import com.ardor3d.math.Vector3; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.state.TextureState; -import com.ardor3d.renderer.state.ZBufferState; -import com.ardor3d.scenegraph.Node; -import com.ardor3d.scenegraph.Spatial; -import com.ardor3d.scenegraph.controller.SpatialController; -import com.ardor3d.scenegraph.shape.Box; -import com.ardor3d.util.ContextGarbageCollector; -import com.ardor3d.util.TextureManager; -import com.ardor3d.util.Timer; -import com.ardor3d.util.resource.ResourceLocatorTool; -import com.ardor3d.util.resource.SimpleResourceLocator; - -/** - * <p> - * This lwjgl-based example is meant to show how to use Ardor3D at the most primitive level, forsaking the use of - * ExampleBase and much of Ardor3D's framework classes and interfaces. - * </p> - * - * <p> - * Also of note, this example does not allow choosing of properties on launch. It also does not handle input or show any - * special debugging. This is to simplify the example to the basic essentials. - * </p> - */ - -@Purpose(htmlDescriptionKey = "com.ardor3d.example.basic.LwjglBasicExample", // -thumbnailPath = "com/ardor3d/example/media/thumbnails/basic_LwjglBasicExample.jpg", // -maxHeapMemory = 64) -public class LwjglBasicExample implements Scene { - - // Our native window, not the gl surface itself. - private final LwjglCanvas _canvas; - - // Our timer. - private final Timer _timer = new Timer(); - - // A boolean allowing us to "pull the plug" from anywhere. - private boolean _exit = false; - - // The root of our scene - private final Node _root = new Node(); - - public static void main(final String[] args) { - final LwjglBasicExample example = new LwjglBasicExample(); - example.start(); - } - - /** - * Constructs the example class, also creating the native window and GL surface. - */ - public LwjglBasicExample() { - _canvas = initLwjgl(); - _canvas.init(); - } - - /** - * Kicks off the example logic, first setting up the scene, then continuously updating and rendering it until exit - * is flagged. Afterwards, the scene and gl surface are cleaned up. - */ - private void start() { - initExample(); - - // Run in this same thread. - while (!_exit) { - updateExample(); - _canvas.draw(null); - Thread.yield(); - } - _canvas.getCanvasRenderer().makeCurrentContext(); - - // Done, do cleanup - ContextGarbageCollector.doFinalCleanup(_canvas.getCanvasRenderer().getRenderer()); - _canvas.close(); - - _canvas.getCanvasRenderer().releaseCurrentContext(); - } - - /** - * Setup an lwjgl canvas and canvas renderer. - * - * @return the canvas. - */ - private LwjglCanvas initLwjgl() { - final LwjglCanvasRenderer canvasRenderer = new LwjglCanvasRenderer(this); - final DisplaySettings settings = new DisplaySettings(800, 600, 24, 0, 0, 8, 0, 0, false, false); - return new LwjglCanvas(settings, canvasRenderer); - } - - /** - * Initialize our scene. - */ - private void initExample() { - _canvas.setTitle("LwjglBasicExample - close window to exit"); - - // Make a box... - final Box _box = new Box("Box", Vector3.ZERO, 5, 5, 5); - - // Make it a bit more colorful. - _box.setRandomColors(); - - // Setup a bounding box for it. - _box.setModelBound(new BoundingBox()); - - // Set its location in space. - _box.setTranslation(new Vector3(0, 0, -15)); - - // Add to root. - _root.attachChild(_box); - - // set it to rotate: - _box.addController(new SpatialController<Spatial>() { - private final Vector3 _axis = new Vector3(1, 1, 0.5f).normalizeLocal(); - private final Matrix3 _rotate = new Matrix3(); - private double _angle = 0; - - public void update(final double time, final Spatial caller) { - // update our rotation - _angle = _angle + (_timer.getTimePerFrame() * 25); - if (_angle > 180) { - _angle = -180; - } - - _rotate.fromAngleNormalAxis(_angle * MathUtils.DEG_TO_RAD, _axis); - _box.setRotation(_rotate); - } - }); - - // Add our awt based image loader. - AWTImageLoader.registerLoader(); - - // Set the location of our example resources. - try { - final SimpleResourceLocator srl = new SimpleResourceLocator(ResourceLocatorTool.getClassPathResource( - LwjglBasicExample.class, "com/ardor3d/example/media/")); - ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, srl); - } catch (final URISyntaxException ex) { - ex.printStackTrace(); - } - - // Create a ZBuffer to display pixels closest to the camera above farther ones. - final ZBufferState buf = new ZBufferState(); - buf.setEnabled(true); - buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo); - _root.setRenderState(buf); - - // Create a texture from the Ardor3D logo. - final TextureState ts = new TextureState(); - ts.setEnabled(true); - ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true)); - _root.setRenderState(ts); - } - - /** - * Update our scene... Check if the window is closing. Then update our timer and finally update the geometric state - * of the root and its children. - */ - private void updateExample() { - if (_canvas.isClosing()) { - _exit = true; - return; - } - - _timer.update(); - - // Update controllers/render states/transforms/bounds for rootNode. - _root.updateGeometricState(_timer.getTimePerFrame(), true); - } - - // ------ Scene methods ------ - - public boolean renderUnto(final Renderer renderer) { - if (!_canvas.isClosing()) { - - // Draw the root and all its children. - renderer.draw(_root); - - return true; - } - return false; - } - - public PickResults doPick(final Ray3 pickRay) { - // Ignore - return null; - } -} diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LwjglHeadlessExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LwjglHeadlessExample.java deleted file mode 100644 index e1e8fe4..0000000 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LwjglHeadlessExample.java +++ /dev/null @@ -1,292 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.example.basic; - -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.image.BufferedImage; -import java.awt.image.DataBufferInt; -import java.net.URISyntaxException; -import java.nio.IntBuffer; -import java.util.concurrent.Callable; - -import javax.swing.ImageIcon; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.SwingConstants; -import javax.swing.WindowConstants; - -import com.ardor3d.bounding.BoundingBox; -import com.ardor3d.example.Purpose; -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.framework.Scene; -import com.ardor3d.framework.lwjgl.LwjglHeadlessCanvas; -import com.ardor3d.image.Texture; -import com.ardor3d.image.util.awt.AWTImageLoader; -import com.ardor3d.intersection.PickResults; -import com.ardor3d.light.PointLight; -import com.ardor3d.math.ColorRGBA; -import com.ardor3d.math.MathUtils; -import com.ardor3d.math.Matrix3; -import com.ardor3d.math.Ray3; -import com.ardor3d.math.Vector3; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.state.LightState; -import com.ardor3d.renderer.state.TextureState; -import com.ardor3d.renderer.state.ZBufferState; -import com.ardor3d.scenegraph.Node; -import com.ardor3d.scenegraph.Spatial; -import com.ardor3d.scenegraph.controller.SpatialController; -import com.ardor3d.scenegraph.shape.Box; -import com.ardor3d.util.GameTaskQueue; -import com.ardor3d.util.GameTaskQueueManager; -import com.ardor3d.util.TextureManager; -import com.ardor3d.util.Timer; -import com.ardor3d.util.resource.ResourceLocatorTool; -import com.ardor3d.util.resource.SimpleResourceLocator; - -/** - * <p> - * A demonstration of the LwjglHeadlessCanvas class, which is canvas used to draw Scene data to an offscreen target. - * </p> - * - * <p> - * Also of note, this example does not allow choosing of properties on launch. It also does not handle input or show any - * special debugging. This is to simplify the example to the basic essentials. - * </p> - */ -@Purpose(htmlDescriptionKey = "com.ardor3d.example.basic.LwjglHeadlessExample", // -thumbnailPath = "com/ardor3d/example/media/thumbnails/basic_LwjglHeadlessExample.jpg", // -maxHeapMemory = 64) -public class LwjglHeadlessExample implements Scene { - - // Our headless canvas - private final LwjglHeadlessCanvas canvas; - - // Our timer. - private final Timer timer = new Timer(); - - // The root of our scene - private final Node _root = new Node(); - - // The settings for our canvas - private final DisplaySettings settings; - - // A label we'll set our image into for viewing. - private final JLabel label; - - // The frame we'll show to the user. - private final JFrame frame; - - // The buffered image we'll reuse. - private final BufferedImage labelImage; - - // A int array we'll reuse when transferring data between opengl and the labelImage. - private final int[] tmpData; - - private boolean run = true; - - /** - * Our main entry point to the example. News up the example and calls start. - * - * @param args - * unused. - */ - public static void main(final String[] args) { - final LwjglHeadlessExample example = new LwjglHeadlessExample(); - example.start(); - } - - /** - * Constructs the example class, creating our frame, label, bufferedimage and the headless canvas. - */ - public LwjglHeadlessExample() { - // Setup our headless canvas for rendering. - // settings = new DisplaySettings(800, 600, 0, 0, 0, 16, 0, 4, false, false); // use this to try MSAA - settings = new DisplaySettings(800, 600, 0, 0, 0, 16, 0, 0, false, false); - canvas = new LwjglHeadlessCanvas(settings, this); - canvas.getRenderer().setBackgroundColor(ColorRGBA.BLACK_NO_ALPHA); - - // Set up an image to show our 3d content in. - labelImage = new BufferedImage(settings.getWidth(), settings.getHeight(), BufferedImage.TYPE_INT_ARGB); - tmpData = ((DataBufferInt) labelImage.getRaster().getDataBuffer()).getData(); - - // Set up a frame and label with icon to show our image in. - frame = new JFrame("Headless Example - close window to exit"); - frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - label = new JLabel("View of Headless Content:"); - label.setVerticalTextPosition(SwingConstants.TOP); - label.setHorizontalTextPosition(SwingConstants.CENTER); - label.setIcon(new ImageIcon(labelImage)); - frame.getContentPane().add(label); - frame.pack(); - frame.setLocationRelativeTo(null); - frame.setVisible(true); - - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(final WindowEvent e) { - GameTaskQueueManager.getManager(canvas).render(new Callable<Void>() { - @Override - public Void call() throws Exception { - run = false; - return null; - } - }); - } - }); - } - - /** - * Kicks off the example logic, first setting up the scene, then continuously updating and rendering. - */ - private void start() { - initExample(); - - while (run) { - updateExample(); - - GameTaskQueueManager.getManager(canvas).getQueue(GameTaskQueue.RENDER).execute(); - if (run) { // still run? - canvas.draw(); - } else { - break; - } - - final IntBuffer data = canvas.getDataBuffer(); - - final int width = settings.getWidth(); - - for (int x = settings.getHeight(); --x >= 0;) { - data.get(tmpData, x * width, width); - } - - label.setIcon(new ImageIcon(labelImage)); - } - - canvas.cleanup(); - System.exit(0); - } - - /** - * Initialize our scene. - */ - private void initExample() { - // Make a box... - final Box _box = new Box("Box", Vector3.ZERO, 5, 5, 5); - - // Setup a bounding box for it -- updateModelBound is called automatically internally. - _box.setModelBound(new BoundingBox()); - - // Set its location in space. - _box.setTranslation(new Vector3(0, 0, -25)); - - // Add to root. - _root.attachChild(_box); - - // set it to rotate: - _box.addController(new SpatialController<Spatial>() { - private final Vector3 _axis = new Vector3(1, 1, 0.5f).normalizeLocal(); - private final Matrix3 _rotate = new Matrix3(); - private double _angle = 0; - - public void update(final double time, final Spatial caller) { - // update our rotation - _angle = _angle + (timer.getTimePerFrame() * 25); - if (_angle > 180) { - _angle = -180; - } - - _rotate.fromAngleNormalAxis(_angle * MathUtils.DEG_TO_RAD, _axis); - _box.setRotation(_rotate); - } - }); - - // Add our awt based image loader. - AWTImageLoader.registerLoader(); - - // Set the location of our example resources. - try { - final SimpleResourceLocator srl = new SimpleResourceLocator(ResourceLocatorTool.getClassPathResource( - LwjglHeadlessExample.class, "com/ardor3d/example/media/")); - ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, srl); - } catch (final URISyntaxException ex) { - ex.printStackTrace(); - } - - // Create a ZBuffer to display pixels closest to the camera above farther ones. - final ZBufferState buf = new ZBufferState(); - buf.setEnabled(true); - buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo); - _root.setRenderState(buf); - - // Create a texture from the Ardor3D logo. - final TextureState ts = new TextureState(); - ts.setEnabled(true); - ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true)); - _root.setRenderState(ts); - - // Set up a basic, default light. - final PointLight light = new PointLight(); - light.setDiffuse(new ColorRGBA(0.75f, 0.75f, 0.75f, 0.75f)); - light.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f)); - light.setLocation(new Vector3(100, 100, 100)); - light.setEnabled(true); - - // Attach the light to a lightState and the lightState to rootNode. - final LightState lightState = new LightState(); - lightState.setEnabled(true); - lightState.attach(light); - _root.setRenderState(lightState); - - } - - // Used for calculating fps. - private double counter = 0; - private int frames = 0; - - /** - * Update our scene... Update our timer, print the current fps (once per second) and finally update the geometric - * state of the root and its children. - */ - private void updateExample() { - timer.update(); - - GameTaskQueueManager.getManager(canvas).getQueue(GameTaskQueue.UPDATE).execute(); - - counter += timer.getTimePerFrame(); - frames++; - if (counter > 1) { - final double fps = (frames / counter); - counter = 0; - frames = 0; - System.out.printf("%7.1f FPS\n", fps); - } - - // Update controllers/render states/transforms/bounds for rootNode. - _root.updateGeometricState(timer.getTimePerFrame(), true); - } - - // ------ Scene methods ------ - - public boolean renderUnto(final Renderer renderer) { - - // Draw the root and all its children. - renderer.draw(_root); - - return true; - } - - public PickResults doPick(final Ray3 pickRay) { - // Ignore - return null; - } -} diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MatrixLookAtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MatrixLookAtExample.java index 5bf947d..83787a8 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MatrixLookAtExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MatrixLookAtExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -39,7 +39,7 @@ maxHeapMemory = 64) public class MatrixLookAtExample extends ExampleBase { private Mesh targetMesh; - private final List<Mesh> boxes = new ArrayList<Mesh>(); + private final List<Mesh> boxes = new ArrayList<>(); private double time = 0.0; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MouseManagerExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MouseManagerExample.java index 6f29e91..8894dd6 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MouseManagerExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MouseManagerExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -107,6 +107,7 @@ public class MouseManagerExample extends ExampleBase { _cursor2 = createMouseCursor(awtImageLoader, "com/ardor3d/example/media/input/movedata.gif"); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.H), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { if (useCursorOne) { _mouseManager.setCursor(_cursor1); @@ -118,11 +119,13 @@ public class MouseManagerExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.J), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { _mouseManager.setCursor(MouseCursor.SYSTEM_DEFAULT); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.K), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { if (_mouseManager.isSetPositionSupported()) { _mouseManager.setPosition(0, 0); @@ -132,6 +135,7 @@ public class MouseManagerExample extends ExampleBase { _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonPressedCondition(MouseButton.LEFT), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { if (_mouseManager.isSetGrabbedSupported()) { _mouseManager.setGrabbed(GrabbedState.GRABBED); @@ -140,6 +144,7 @@ public class MouseManagerExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonReleasedCondition(MouseButton.LEFT), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { if (_mouseManager.isSetGrabbedSupported()) { _mouseManager.setGrabbed(GrabbedState.NOT_GRABBED); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/OrbitCamExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/OrbitCamExample.java index 8d4bc82..cb44ba0 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/OrbitCamExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/OrbitCamExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/RTTShaderExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/RTTShaderExample.java index 25a1fe9..215dc77 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/RTTShaderExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/RTTShaderExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/ShapesExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/ShapesExample.java index e070de4..4add4e0 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/ShapesExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/ShapesExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -197,6 +197,7 @@ public class ShapesExample extends ExampleBase { // Add mouse-over to show labels _logicalLayer.registerTrigger(new InputTrigger(new MouseMovedCondition(), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { // Put together a pick ray final Vector2 pos = Vector2.fetchTempInstance().set(inputStates.getCurrent().getMouseState().getX(), diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/SwitchNodeExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/SwitchNodeExample.java index 6752d8b..1410eea 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/SwitchNodeExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/SwitchNodeExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -77,6 +77,7 @@ public class SwitchNodeExample extends ExampleBase { _root.getSceneHints().setCullHint(CullHint.Never); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { switchNode.shiftVisibleRight(); } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/Ball.java b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/Ball.java index 9b286fd..b290c94 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/Ball.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/Ball.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BallComponent.java b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BallComponent.java index d6fc129..7de0281 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BallComponent.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BallComponent.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BallSprite.java b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BallSprite.java index 8a8d0ca..5b432fd 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BallSprite.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BallSprite.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BubbleMarkExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BubbleMarkExample.java index 54fd6e7..c7cd8bb 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BubbleMarkExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BubbleMarkExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -18,10 +18,8 @@ import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.NativeCanvas; import com.ardor3d.framework.Scene; -import com.ardor3d.framework.jogl.JoglCanvas; import com.ardor3d.framework.jogl.JoglCanvasRenderer; -import com.ardor3d.framework.lwjgl.LwjglCanvas; -import com.ardor3d.framework.lwjgl.LwjglCanvasRenderer; +import com.ardor3d.framework.jogl.JoglNewtWindow; import com.ardor3d.image.Texture; import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.image.util.awt.AWTImageLoader; @@ -49,7 +47,6 @@ import com.ardor3d.util.resource.SimpleResourceLocator; * <p> * There are several system params you can use to modify the test: * <ul> - * <li>-Djogl=true -- use JoglRenderer and canvas instead of Lwjgl.</li> * <li>-Dvsync=true -- ask the canvas to use vertical sync to lock to the monitor refresh rate.</li> * <li>-DnoBallCollide=true -- do not do ball-to-ball collision checks.</li> * <li>-Dballs=# -- change the number of balls to some integer value. (default is 16)</li> @@ -138,15 +135,9 @@ public class BubbleMarkExample implements Scene { * @return the canvas. */ private NativeCanvas initCanvas() { - if ("true".equalsIgnoreCase(System.getProperty("jogl"))) { - final JoglCanvasRenderer canvasRenderer = new JoglCanvasRenderer(this); - final DisplaySettings settings = new DisplaySettings(width, height, 24, 0, 0, 8, 0, 0, false, false); - return new JoglCanvas(canvasRenderer, settings); - } else { - final LwjglCanvasRenderer canvasRenderer = new LwjglCanvasRenderer(this); - final DisplaySettings settings = new DisplaySettings(width, height, 24, 0, 0, 8, 0, 0, false, false); - return new LwjglCanvas(settings, canvasRenderer); - } + final JoglCanvasRenderer canvasRenderer = new JoglCanvasRenderer(this); + final DisplaySettings settings = new DisplaySettings(width, height, 24, 0, 0, 8, 0, 0, false, false); + return new JoglNewtWindow(canvasRenderer, settings); } /** @@ -283,6 +274,7 @@ public class BubbleMarkExample implements Scene { // ------ Scene methods ------ + @Override public boolean renderUnto(final Renderer renderer) { if (!canvas.isClosing()) { @@ -294,6 +286,7 @@ public class BubbleMarkExample implements Scene { return false; } + @Override public PickResults doPick(final Ray3 pickRay) { // Ignore return null; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BubbleMarkUIExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BubbleMarkUIExample.java index 8e8e2d4..16797b9 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BubbleMarkUIExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/benchmark/ball/BubbleMarkUIExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -117,6 +117,7 @@ public class BubbleMarkUIExample extends ExampleBase { Alignment.TOP_LEFT, 5, -5)); vsync.setSelectable(true); vsync.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { _canvas.setVSyncEnabled(vsync.isSelected()); } @@ -128,6 +129,7 @@ public class BubbleMarkUIExample extends ExampleBase { collide.setSelectable(true); collide.setSelected(!skipBallCollide); collide.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { skipBallCollide = !collide.isSelected(); } @@ -145,6 +147,7 @@ public class BubbleMarkUIExample extends ExampleBase { balls16.setSelectable(true); balls16.setSelected(true); balls16.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { resetBalls(16); } @@ -157,6 +160,7 @@ public class BubbleMarkUIExample extends ExampleBase { balls32.setSelectable(true); balls32.setSelected(true); balls32.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { resetBalls(32); } @@ -169,6 +173,7 @@ public class BubbleMarkUIExample extends ExampleBase { balls64.setSelectable(true); balls64.setSelected(true); balls64.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { resetBalls(64); } @@ -181,6 +186,7 @@ public class BubbleMarkUIExample extends ExampleBase { balls128.setSelectable(true); balls128.setSelected(true); balls128.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { resetBalls(128); } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/ExampleScene.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/ExampleScene.java index 9011c80..ac9a77e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/ExampleScene.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/ExampleScene.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/Exit.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/Exit.java index 0019c95..0930ec4 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/Exit.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/Exit.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java index 57128bf..7af08d5 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -29,8 +29,8 @@ import com.ardor3d.example.Purpose; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.FrameHandler; -import com.ardor3d.framework.jogl.JoglAwtCanvas; import com.ardor3d.framework.jogl.JoglCanvasRenderer; +import com.ardor3d.framework.jogl.awt.JoglAwtCanvas; import com.ardor3d.image.util.awt.AWTImageLoader; import com.ardor3d.input.ControllerWrapper; import com.ardor3d.input.Key; @@ -61,7 +61,7 @@ public class JoglAwtDesktopExample { static MouseCursor _cursor1; static MouseCursor _cursor2; - static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>(); + static Map<Canvas, Boolean> _showCursor1 = new HashMap<>(); public static void main(final String[] args) throws Exception { System.setProperty("ardor3d.useMultipleContexts", "true"); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java index 9b902f1..aae1162 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -27,8 +27,8 @@ import com.ardor3d.example.Purpose; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.FrameHandler; -import com.ardor3d.framework.jogl.JoglAwtCanvas; import com.ardor3d.framework.jogl.JoglCanvasRenderer; +import com.ardor3d.framework.jogl.awt.JoglAwtCanvas; import com.ardor3d.image.util.awt.AWTImageLoader; import com.ardor3d.input.ControllerWrapper; import com.ardor3d.input.Key; @@ -58,7 +58,7 @@ public class JoglAwtExample { static MouseCursor _cursor1; static MouseCursor _cursor2; - static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>(); + static Map<Canvas, Boolean> _showCursor1 = new HashMap<>(); public static void main(final String[] args) throws Exception { System.setProperty("ardor3d.useMultipleContexts", "true"); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java index b3778f6..9770e36 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -28,7 +28,8 @@ import com.ardor3d.framework.Canvas; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.FrameHandler; import com.ardor3d.framework.jogl.JoglCanvasRenderer; -import com.ardor3d.framework.jogl.JoglNewtAwtCanvas; +import com.ardor3d.framework.jogl.awt.JoglNewtAwtCanvas; +import com.ardor3d.image.util.ImageLoaderUtil; import com.ardor3d.image.util.jogl.JoglImageLoader; import com.ardor3d.input.ControllerWrapper; import com.ardor3d.input.Key; @@ -47,6 +48,7 @@ import com.ardor3d.input.logical.TwoInputStates; import com.ardor3d.util.Timer; import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.SimpleResourceLocator; +import com.ardor3d.util.resource.URLResourceSource; /** * This examples demonstrates how to render OpenGL (via JOGL) on a NEWT AWT canvas. FIXME update the thumbnail and the @@ -59,7 +61,7 @@ public class JoglNewtAwtExample { static MouseCursor _cursor1; static MouseCursor _cursor2; - static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>(); + static Map<Canvas, Boolean> _showCursor1 = new HashMap<>(); public static void main(final String[] args) throws Exception { System.setProperty("ardor3d.useMultipleContexts", "true"); @@ -99,9 +101,8 @@ public class JoglNewtAwtExample { ex.printStackTrace(); } - final JoglImageLoader joglImageLoader = new JoglImageLoader(); - _cursor1 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/wait_cursor.png"); - _cursor2 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/movedata.gif"); + _cursor1 = createMouseCursor("com/ardor3d/example/media/input/wait_cursor.png"); + _cursor2 = createMouseCursor("com/ardor3d/example/media/input/movedata.gif"); addCanvas(frame, scene1, logicalLayer, frameWork); frame.add(new JLabel( @@ -139,10 +140,11 @@ public class JoglNewtAwtExample { System.exit(0); } - private static MouseCursor createMouseCursor(final JoglImageLoader joglImageLoader, final String resourceName) - throws IOException { - final com.ardor3d.image.Image image = joglImageLoader.load( - ResourceLocatorTool.getClassPathResourceAsStream(JoglNewtAwtExample.class, resourceName), false); + private static MouseCursor createMouseCursor(final String resourceName) throws IOException { + final com.ardor3d.image.Image image = ImageLoaderUtil + .loadImage( + new URLResourceSource(ResourceLocatorTool.getClassPathResource(JoglNewtAwtExample.class, + resourceName)), false); return new MouseCursor("cursor1", image, 0, image.getHeight() - 1); } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java index 59f54b6..8626d11 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -38,7 +38,8 @@ import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.FrameHandler; import com.ardor3d.framework.jogl.JoglCanvasRenderer; -import com.ardor3d.framework.jogl.JoglNewtSwtCanvas; +import com.ardor3d.framework.jogl.swt.JoglNewtSwtCanvas; +import com.ardor3d.image.util.ImageLoaderUtil; import com.ardor3d.image.util.jogl.JoglImageLoader; import com.ardor3d.input.ControllerWrapper; import com.ardor3d.input.GrabbedState; @@ -59,6 +60,7 @@ import com.ardor3d.renderer.Camera; import com.ardor3d.util.Timer; import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.SimpleResourceLocator; +import com.ardor3d.util.resource.URLResourceSource; /** * This examples demonstrates how to render OpenGL (via JOGL) in a NEWT SWT canvas. FIXME update the thumbnail and the @@ -71,7 +73,7 @@ public class JoglNewtSwtExample { static MouseCursor _cursor1; static MouseCursor _cursor2; - static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>(); + static Map<Canvas, Boolean> _showCursor1 = new HashMap<>(); private static final Logger logger = Logger.getLogger(JoglNewtSwtExample.class.toString()); private static int i = 0; @@ -248,10 +250,9 @@ public class JoglNewtSwtExample { } })); - final JoglImageLoader joglImageLoader = new JoglImageLoader(); try { - _cursor1 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/wait_cursor.png"); - _cursor2 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/movedata.gif"); + _cursor1 = createMouseCursor("com/ardor3d/example/media/input/wait_cursor.png"); + _cursor2 = createMouseCursor("com/ardor3d/example/media/input/movedata.gif"); } catch (final IOException ioe) { ioe.printStackTrace(); } @@ -259,10 +260,11 @@ public class JoglNewtSwtExample { _showCursor1.put(canvas1, true); } - private static MouseCursor createMouseCursor(final JoglImageLoader joglImageLoader, final String resourceName) - throws IOException { - final com.ardor3d.image.Image image = joglImageLoader.load( - ResourceLocatorTool.getClassPathResourceAsStream(JoglNewtSwtExample.class, resourceName), false); + private static MouseCursor createMouseCursor(final String resourceName) throws IOException { + final com.ardor3d.image.Image image = ImageLoaderUtil + .loadImage( + new URLResourceSource(ResourceLocatorTool.getClassPathResource(JoglNewtSwtExample.class, + resourceName)), false); return new MouseCursor("cursor1", image, 0, image.getHeight() - 1); } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/LwjglAwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwingExample.java index a45df8f..06b1034 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/LwjglAwtExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwingExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -27,8 +27,8 @@ import com.ardor3d.example.Purpose; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.FrameHandler; -import com.ardor3d.framework.lwjgl.LwjglAwtCanvas; -import com.ardor3d.framework.lwjgl.LwjglCanvasRenderer; +import com.ardor3d.framework.jogl.JoglCanvasRenderer; +import com.ardor3d.framework.jogl.awt.JoglSwingCanvas; import com.ardor3d.image.util.awt.AWTImageLoader; import com.ardor3d.input.ControllerWrapper; import com.ardor3d.input.Key; @@ -49,16 +49,17 @@ import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.SimpleResourceLocator; /** - * This examples demonstrates how to render OpenGL (via LWJGL) on a AWT canvas. + * This examples demonstrates how to render OpenGL (via JOGL) on a Swing canvas. FIXME: fix the thumbnail and the + * description */ -@Purpose(htmlDescriptionKey = "com.ardor3d.example.canvas.LwjglAwtExample", // -thumbnailPath = "com/ardor3d/example/media/thumbnails/canvas_LwjglAwtExample.jpg", // +@Purpose(htmlDescriptionKey = "com.ardor3d.example.canvas.JoglAwtExample", // +thumbnailPath = "com/ardor3d/example/media/thumbnails/canvas_JoglAwtExample.jpg", // maxHeapMemory = 64) -public class LwjglAwtExample { +public class JoglSwingExample { static MouseCursor _cursor1; static MouseCursor _cursor2; - static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>(); + static Map<Canvas, Boolean> _showCursor1 = new HashMap<>(); public static void main(final String[] args) throws Exception { System.setProperty("ardor3d.useMultipleContexts", "true"); @@ -92,7 +93,7 @@ public class LwjglAwtExample { try { final SimpleResourceLocator srl = new SimpleResourceLocator(ResourceLocatorTool.getClassPathResource( - LwjglAwtExample.class, "com/ardor3d/example/media/")); + JoglSwingExample.class, "com/ardor3d/example/media/")); ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, srl); } catch (final URISyntaxException ex) { ex.printStackTrace(); @@ -140,17 +141,17 @@ public class LwjglAwtExample { private static MouseCursor createMouseCursor(final AWTImageLoader awtImageLoader, final String resourceName) throws IOException { final com.ardor3d.image.Image image = awtImageLoader.load( - ResourceLocatorTool.getClassPathResourceAsStream(LwjglAwtExample.class, resourceName), false); + ResourceLocatorTool.getClassPathResourceAsStream(JoglSwingExample.class, resourceName), false); return new MouseCursor("cursor1", image, 0, image.getHeight() - 1); } private static void addCanvas(final JFrame frame, final ExampleScene scene, final LogicalLayer logicalLayer, final FrameHandler frameWork) throws Exception { - final LwjglCanvasRenderer canvasRenderer = new LwjglCanvasRenderer(scene); + final JoglCanvasRenderer canvasRenderer = new JoglCanvasRenderer(scene); final DisplaySettings settings = new DisplaySettings(400, 300, 24, 0, 0, 16, 0, 0, false, false); - final LwjglAwtCanvas theCanvas = new LwjglAwtCanvas(settings, canvasRenderer); + final JoglSwingCanvas theCanvas = new JoglSwingCanvas(settings, canvasRenderer); frame.add(theCanvas); @@ -170,6 +171,7 @@ public class LwjglAwtExample { logicalLayer.registerInput(theCanvas, pl); logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.H), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { if (source != theCanvas) { return; @@ -185,6 +187,7 @@ public class LwjglAwtExample { } })); logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.J), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { if (source != theCanvas) { return; @@ -201,6 +204,7 @@ public class LwjglAwtExample { private static class MyExit implements Exit { private volatile boolean exit = false; + @Override public void exit() { exit = true; } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java index 3026828..29a4929 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -39,7 +39,8 @@ import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.FrameHandler; import com.ardor3d.framework.jogl.JoglCanvasRenderer; -import com.ardor3d.framework.jogl.JoglSwtCanvas; +import com.ardor3d.framework.jogl.swt.JoglSwtCanvas; +import com.ardor3d.image.util.ImageLoaderUtil; import com.ardor3d.image.util.jogl.JoglImageLoader; import com.ardor3d.input.ControllerWrapper; import com.ardor3d.input.GrabbedState; @@ -60,6 +61,7 @@ import com.ardor3d.renderer.Camera; import com.ardor3d.util.Timer; import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.SimpleResourceLocator; +import com.ardor3d.util.resource.URLResourceSource; /** * This examples demonstrates how to render OpenGL (via JOGL) in a SWT canvas. @@ -71,7 +73,7 @@ public class JoglSwtExample { static MouseCursor _cursor1; static MouseCursor _cursor2; - static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>(); + static Map<Canvas, Boolean> _showCursor1 = new HashMap<>(); private static final Logger logger = Logger.getLogger(JoglSwtExample.class.toString()); private static int i = 0; @@ -251,11 +253,9 @@ public class JoglSwtExample { : GrabbedState.NOT_GRABBED); } })); - - final JoglImageLoader joglImageLoader = new JoglImageLoader(); try { - _cursor1 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/wait_cursor.png"); - _cursor2 = createMouseCursor(joglImageLoader, "com/ardor3d/example/media/input/movedata.gif"); + _cursor1 = createMouseCursor("com/ardor3d/example/media/input/wait_cursor.png"); + _cursor2 = createMouseCursor("com/ardor3d/example/media/input/movedata.gif"); } catch (final IOException ioe) { ioe.printStackTrace(); } @@ -263,10 +263,10 @@ public class JoglSwtExample { _showCursor1.put(canvas1, true); } - private static MouseCursor createMouseCursor(final JoglImageLoader joglImageLoader, final String resourceName) - throws IOException { - final com.ardor3d.image.Image image = joglImageLoader.load( - ResourceLocatorTool.getClassPathResourceAsStream(JoglSwtExample.class, resourceName), false); + private static MouseCursor createMouseCursor(final String resourceName) throws IOException { + final com.ardor3d.image.Image image = ImageLoaderUtil.loadImage( + new URLResourceSource(ResourceLocatorTool.getClassPathResource(JoglSwtExample.class, resourceName)), + false); return new MouseCursor("cursor1", image, 0, image.getHeight() - 1); } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/LwjglSwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/LwjglSwtExample.java deleted file mode 100644 index e564393..0000000 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/LwjglSwtExample.java +++ /dev/null @@ -1,348 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.example.canvas; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Logger; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.ControlListener; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.opengl.GLData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.lwjgl.LWJGLException; - -import com.ardor3d.example.Purpose; -import com.ardor3d.framework.Canvas; -import com.ardor3d.framework.CanvasRenderer; -import com.ardor3d.framework.FrameHandler; -import com.ardor3d.framework.lwjgl.LwjglCanvasCallback; -import com.ardor3d.framework.lwjgl.LwjglCanvasRenderer; -import com.ardor3d.framework.swt.SwtCanvas; -import com.ardor3d.image.util.awt.AWTImageLoader; -import com.ardor3d.input.ControllerWrapper; -import com.ardor3d.input.GrabbedState; -import com.ardor3d.input.Key; -import com.ardor3d.input.MouseCursor; -import com.ardor3d.input.PhysicalLayer; -import com.ardor3d.input.logical.DummyControllerWrapper; -import com.ardor3d.input.logical.InputTrigger; -import com.ardor3d.input.logical.KeyPressedCondition; -import com.ardor3d.input.logical.LogicalLayer; -import com.ardor3d.input.logical.TriggerAction; -import com.ardor3d.input.logical.TwoInputStates; -import com.ardor3d.input.swt.SwtFocusWrapper; -import com.ardor3d.input.swt.SwtKeyboardWrapper; -import com.ardor3d.input.swt.SwtMouseManager; -import com.ardor3d.input.swt.SwtMouseWrapper; -import com.ardor3d.renderer.Camera; -import com.ardor3d.util.Timer; -import com.ardor3d.util.resource.ResourceLocatorTool; -import com.ardor3d.util.resource.SimpleResourceLocator; - -/** - * This examples demonstrates how to render OpenGL (via LWJGL) on a SWT canvas. - */ -@Purpose(htmlDescriptionKey = "com.ardor3d.example.canvas.LwjglSwtExample", // -thumbnailPath = "com/ardor3d/example/media/thumbnails/canvas_LwjglSwtExample.jpg", // -maxHeapMemory = 64) -public class LwjglSwtExample { - static MouseCursor _cursor1; - static MouseCursor _cursor2; - - static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>(); - - private static final Logger logger = Logger.getLogger(LwjglSwtExample.class.toString()); - private static int i = 0; - - public static void main(final String[] args) { - System.setProperty("ardor3d.useMultipleContexts", "true"); - - final Timer timer = new Timer(); - final FrameHandler frameWork = new FrameHandler(timer); - final LogicalLayer logicalLayer = new LogicalLayer(); - - final MyExit exit = new MyExit(); - final ExampleScene scene = new ExampleScene(); - final RotatingCubeGame game = new RotatingCubeGame(scene, exit, logicalLayer, Key.T); - - frameWork.addUpdater(game); - - // INIT SWT STUFF - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - - // This is our tab folder, it will be accepting our 3d canvases - final TabFolder tabFolder = new TabFolder(shell, SWT.BORDER); - - // Add a menu item that will create and add a new canvas. - final Menu bar = new Menu(shell, SWT.BAR); - shell.setMenuBar(bar); - - final MenuItem fileItem = new MenuItem(bar, SWT.CASCADE); - fileItem.setText("&Tasks"); - - final Menu submenu = new Menu(shell, SWT.DROP_DOWN); - fileItem.setMenu(submenu); - final MenuItem item = new MenuItem(submenu, SWT.PUSH); - item.addListener(SWT.Selection, new Listener() { - public void handleEvent(final Event e) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - addNewCanvas(tabFolder, scene, frameWork, logicalLayer); - } - }); - } - }); - item.setText("Add &3d Canvas"); - item.setAccelerator(SWT.MOD1 + '3'); - - AWTImageLoader.registerLoader(); - - try { - final SimpleResourceLocator srl = new SimpleResourceLocator(ResourceLocatorTool.getClassPathResource( - LwjglSwtExample.class, "com/ardor3d/example/media/")); - ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, srl); - } catch (final URISyntaxException ex) { - ex.printStackTrace(); - } - - addNewCanvas(tabFolder, scene, frameWork, logicalLayer); - - shell.open(); - - game.init(); - // frameWork.init(); - - while (!shell.isDisposed() && !exit.isExit()) { - display.readAndDispatch(); - frameWork.updateFrame(); - Thread.yield(); - - // using the below way makes things really jerky. Not sure how to handle that. - - // if (display.readAndDispatch()) { - // frameWork.updateFrame(); - // } - // else { - // display.sleep(); - // } - } - - display.dispose(); - System.exit(0); - } - - private static void addNewCanvas(final TabFolder tabFolder, final ExampleScene scene, final FrameHandler frameWork, - final LogicalLayer logicalLayer) { - i++; - logger.info("Adding canvas"); - - // Add a new tab to hold our canvas - final TabItem item = new TabItem(tabFolder, SWT.NONE); - item.setText("Canvas #" + i); - tabFolder.setSelection(item); - final Composite canvasParent = new Composite(tabFolder, SWT.NONE); - canvasParent.setLayout(new FillLayout()); - item.setControl(canvasParent); - - final GLData data = new GLData(); - data.depthSize = 8; - data.doubleBuffer = true; - - final SashForm splitter = new SashForm(canvasParent, SWT.HORIZONTAL); - - final SashForm splitterLeft = new SashForm(splitter, SWT.VERTICAL); - final Composite topLeft = new Composite(splitterLeft, SWT.NONE); - topLeft.setLayout(new FillLayout()); - final Composite bottomLeft = new Composite(splitterLeft, SWT.NONE); - bottomLeft.setLayout(new FillLayout()); - - final SashForm splitterRight = new SashForm(splitter, SWT.VERTICAL); - final Composite topRight = new Composite(splitterRight, SWT.NONE); - topRight.setLayout(new FillLayout()); - final Composite bottomRight = new Composite(splitterRight, SWT.NONE); - bottomRight.setLayout(new FillLayout()); - - canvasParent.layout(); - - final SwtCanvas canvas1 = new SwtCanvas(topLeft, SWT.NONE, data); - final LwjglCanvasRenderer lwjglCanvasRenderer1 = new LwjglCanvasRenderer(scene); - addCallback(canvas1, lwjglCanvasRenderer1); - canvas1.setCanvasRenderer(lwjglCanvasRenderer1); - frameWork.addCanvas(canvas1); - canvas1.addControlListener(newResizeHandler(canvas1, lwjglCanvasRenderer1)); - canvas1.setFocus(); - - final SwtCanvas canvas2 = new SwtCanvas(bottomLeft, SWT.NONE, data); - final LwjglCanvasRenderer lwjglCanvasRenderer2 = new LwjglCanvasRenderer(scene); - addCallback(canvas2, lwjglCanvasRenderer2); - canvas2.setCanvasRenderer(lwjglCanvasRenderer2); - frameWork.addCanvas(canvas2); - canvas2.addControlListener(newResizeHandler(canvas2, lwjglCanvasRenderer2)); - - final SwtCanvas canvas3 = new SwtCanvas(topRight, SWT.NONE, data); - final LwjglCanvasRenderer lwjglCanvasRenderer3 = new LwjglCanvasRenderer(scene); - addCallback(canvas3, lwjglCanvasRenderer3); - canvas3.setCanvasRenderer(lwjglCanvasRenderer3); - frameWork.addCanvas(canvas3); - canvas3.addControlListener(newResizeHandler(canvas3, lwjglCanvasRenderer3)); - - final SwtCanvas canvas4 = new SwtCanvas(bottomRight, SWT.NONE, data); - final LwjglCanvasRenderer lwjglCanvasRenderer4 = new LwjglCanvasRenderer(scene); - addCallback(canvas4, lwjglCanvasRenderer4); - canvas4.setCanvasRenderer(lwjglCanvasRenderer4); - frameWork.addCanvas(canvas4); - canvas4.addControlListener(newResizeHandler(canvas4, lwjglCanvasRenderer4)); - - final SwtKeyboardWrapper keyboardWrapper = new SwtKeyboardWrapper(canvas1); - final SwtMouseWrapper mouseWrapper = new SwtMouseWrapper(canvas1); - final SwtFocusWrapper focusWrapper = new SwtFocusWrapper(canvas1); - final SwtMouseManager mouseManager = new SwtMouseManager(canvas1); - final ControllerWrapper controllerWrapper = new DummyControllerWrapper(); - - final PhysicalLayer pl = new PhysicalLayer(keyboardWrapper, mouseWrapper, controllerWrapper, focusWrapper); - - logicalLayer.registerInput(canvas1, pl); - - logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.H), new TriggerAction() { - public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { - if (source != canvas1) { - return; - } - - if (_showCursor1.get(canvas1)) { - mouseManager.setCursor(_cursor1); - } else { - mouseManager.setCursor(_cursor2); - } - - _showCursor1.put(canvas1, !_showCursor1.get(canvas1)); - } - })); - logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.J), new TriggerAction() { - public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { - if (source != canvas1) { - return; - } - - mouseManager.setCursor(MouseCursor.SYSTEM_DEFAULT); - } - })); - logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() { - public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { - if (source != canvas1) { - return; - } - - mouseManager.setGrabbed(mouseManager.getGrabbed() == GrabbedState.NOT_GRABBED ? GrabbedState.GRABBED - : GrabbedState.NOT_GRABBED); - } - })); - - final AWTImageLoader awtImageLoader = new AWTImageLoader(); - try { - _cursor1 = createMouseCursor(awtImageLoader, "com/ardor3d/example/media/input/wait_cursor.png"); - _cursor2 = createMouseCursor(awtImageLoader, "com/ardor3d/example/media/input/movedata.gif"); - } catch (final IOException ioe) { - ioe.printStackTrace(); - } - - _showCursor1.put(canvas1, true); - } - - private static void addCallback(final SwtCanvas canvas, final LwjglCanvasRenderer renderer) { - renderer.setCanvasCallback(new LwjglCanvasCallback() { - @Override - public void makeCurrent() throws LWJGLException { - canvas.setCurrent(); - } - - @Override - public void releaseContext() throws LWJGLException { - ; // do nothing? - } - }); - } - - private static MouseCursor createMouseCursor(final AWTImageLoader awtImageLoader, final String resourceName) - throws IOException { - final com.ardor3d.image.Image image = awtImageLoader.load( - ResourceLocatorTool.getClassPathResourceAsStream(LwjglSwtExample.class, resourceName), false); - - return new MouseCursor("cursor1", image, 0, image.getHeight() - 1); - } - - static ControlListener newResizeHandler(final SwtCanvas swtCanvas, final CanvasRenderer canvasRenderer) { - final ControlListener retVal = new ControlListener() { - public void controlMoved(final ControlEvent e) {} - - public void controlResized(final ControlEvent event) { - final Rectangle size = swtCanvas.getClientArea(); - if ((size.width == 0) && (size.height == 0)) { - return; - } - final float aspect = (float) size.width / (float) size.height; - final Camera camera = canvasRenderer.getCamera(); - if (camera != null) { - final double fovY = camera.getFovY(); - final double near = camera.getFrustumNear(); - final double far = camera.getFrustumFar(); - camera.setFrustumPerspective(fovY, aspect, near, far); - camera.resize(size.width, size.height); - } - } - }; - return retVal; - } - - private static class MyExit implements Exit { - private volatile boolean exit = false; - - public void exit() { - exit = true; - } - - public boolean isExit() { - return exit; - } - } -} - -// class LwjglSwtModule extends AbstractModule { -// public LwjglSwtModule() {} -// -// @Override -// protected void configure() { -// // enforce a single instance of SwtKeyboardWrapper will handle both the KeyListener and the KeyboardWrapper -// // interfaces -// bind(SwtKeyboardWrapper.class).in(Scopes.SINGLETON); -// bind(KeyboardWrapper.class).to(SwtKeyboardWrapper.class); -// bind(KeyListener.class).to(SwtKeyboardWrapper.class); -// -// bind(MouseWrapper.class).to(SwtMouseWrapper.class); -// } -// }
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/RotatingCubeGame.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/RotatingCubeGame.java index 395a411..e69363e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/RotatingCubeGame.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/RotatingCubeGame.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -64,6 +64,7 @@ public class RotatingCubeGame implements Updater { this.toggleRotationKey = toggleRotationKey; } + @Override @MainThread public void init() { if (inited) { @@ -119,34 +120,40 @@ public class RotatingCubeGame implements Updater { control.setMoveSpeed(MOVE_SPEED); logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ESCAPE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { exit.exit(); } })); logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(toggleRotationKey), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { toggleRotation(); } })); logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.U), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { toggleRotation(); } })); logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { resetCamera(source); } })); logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { lookAtZero(source); } })); logicalLayer.registerTrigger(new InputTrigger(new AnyKeyCondition(), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final InputState current = inputStates.getCurrent(); @@ -172,6 +179,7 @@ public class RotatingCubeGame implements Updater { rotationSign *= -1; } + @Override @MainThread public void update(final ReadOnlyTimer timer) { final double tpf = timer.getTimePerFrame(); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/collision/CollisionTreeExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/collision/CollisionTreeExample.java index e2e8196..377d6ba 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/collision/CollisionTreeExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/collision/CollisionTreeExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -81,6 +81,7 @@ public class CollisionTreeExample extends ExampleBase { torus.addController(new SpatialController<PQTorus>() { private double currentTime; + @Override public void update(final double time, final PQTorus caller) { currentTime += time * 0.2; final ReadOnlyVector3 t = caller.getTranslation(); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/collision/ManyCollisionsExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/collision/ManyCollisionsExample.java index 95133d7..64e93cd 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/collision/ManyCollisionsExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/collision/ManyCollisionsExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/BloomExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/BloomExample.java index 643dde5..d229dbe 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/BloomExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/BloomExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -92,6 +92,7 @@ public class BloomExample extends ExampleBase { _canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { updateText(); } @@ -147,72 +148,84 @@ public class BloomExample extends ExampleBase { _passManager.add(renderPass); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setEnabled(!bloomRenderPass.isEnabled()); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setBlurSize(bloomRenderPass.getBlurSize() - 0.001f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setBlurSize(bloomRenderPass.getBlurSize() + 0.001f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setExposurePow(bloomRenderPass.getExposurePow() - 1.0f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setExposurePow(bloomRenderPass.getExposurePow() + 1.0f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setExposureCutoff(bloomRenderPass.getExposureCutoff() - 0.1f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setExposureCutoff(bloomRenderPass.getExposureCutoff() + 0.1f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setBlurIntensityMultiplier(bloomRenderPass.getBlurIntensityMultiplier() - 0.1f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setBlurIntensityMultiplier(bloomRenderPass.getBlurIntensityMultiplier() + 0.1f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.resetParameters(); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.J), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setUseCurrentScene(!bloomRenderPass.useCurrentScene()); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { bloomRenderPass.setUseSeparateConvolution(!bloomRenderPass.isUseSeparateConvolution()); updateText(); @@ -250,6 +263,7 @@ public class BloomExample extends ExampleBase { private double timer = 0; private final Matrix3 rotation = new Matrix3(); + @Override public void update(final double time, final Torus caller) { timer += time * 0.5; caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ExtrusionExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ExtrusionExample.java index deb199f..acff3e7 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ExtrusionExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ExtrusionExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.example.effect; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -22,7 +23,6 @@ import com.ardor3d.scenegraph.Line; import com.ardor3d.scenegraph.shape.Extrusion; import com.ardor3d.spline.CatmullRomSpline; import com.ardor3d.spline.Curve; -import com.google.common.collect.Lists; /** * A demonstration of the Extrusion class - showing how a set of point can be converted into a 3d shape. @@ -42,7 +42,7 @@ public class ExtrusionExample extends ExampleBase { _canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 0, 80)); _canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(), Vector3.UNIT_Y); - final List<ReadOnlyVector3> path = Lists.newArrayList(); + final List<ReadOnlyVector3> path = new ArrayList<>(); path.add(new Vector3(0, 0, 0)); path.add(new Vector3(0, 0, 4)); path.add(new Vector3(1, 0, 8)); @@ -97,7 +97,7 @@ public class ExtrusionExample extends ExampleBase { private Line createLineStrip(final boolean loop) { // Create a line with our example "makeLine" method. See method below. - final ReadOnlyVector3[] vectors = { // + final ReadOnlyVector3[] vectors = { // new Vector3(0, 0, 0), // new Vector3(5, 0, 0), // new Vector3(5, 5, 0), // diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/NewDynamicSmokerExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/NewDynamicSmokerExample.java index 739beba..4eee5ca 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/NewDynamicSmokerExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/NewDynamicSmokerExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -127,6 +127,7 @@ public class NewDynamicSmokerExample extends ExampleBase { FirstPersonControl.removeTriggers(_logicalLayer, _controlHandle); _logicalLayer.registerTrigger(new InputTrigger(new MouseMovedCondition(), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final MouseState mouse = inputStates.getCurrent().getMouseState(); mouseLoc.set(mouse.getX(), mouse.getY()); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParallelSplitShadowMapExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParallelSplitShadowMapExample.java index 57d703f..56dc5f7 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParallelSplitShadowMapExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParallelSplitShadowMapExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.effect;
import com.ardor3d.bounding.BoundingBox;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass;
import com.ardor3d.extension.shadow.map.ShadowCasterManager;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture;
import com.ardor3d.image.Texture2D;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.light.Light;
import com.ardor3d.light.PointLight;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.pass.BasicPassManager;
import com.ardor3d.renderer.pass.RenderPass;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.BlendState;
import com.ardor3d.renderer.state.BlendState.TestFunction;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.MaterialState;
import com.ardor3d.renderer.state.MaterialState.ColorMaterial;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.scenegraph.controller.SpatialController;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.hint.TextureCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Torus;
import com.ardor3d.scenegraph.visitor.UpdateModelBoundVisitor;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing the parallel split shadow mapping technique. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.effect.ParallelSplitShadowMapExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/effect_ParallelSplitShadowMapExample.jpg", //
maxHeapMemory = 64)
public class ParallelSplitShadowMapExample extends ExampleBase {
/** Pssm shadow map pass. */
private ParallelSplitShadowMapPass _pssmPass;
/** Pass manager. */
private BasicPassManager _passManager;
/** Quads used for debug showing shadowmaps. */
private Quad _orthoQuad[];
/** Flag for turning on/off light movement. */
private boolean _updateLight = false;
/** Temp vec for updating light pos. */
private final Vector3 lightPosition = new Vector3(10000, 5000, 10000);
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[12];
/** Flag to make sure quads are updated on reinitialization of shadow renderer */
private boolean _quadsDirty = true;
/** Console fps output */
private double counter = 0;
private int frames = 0;
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(final String[] args) {
start(ParallelSplitShadowMapExample.class);
}
/**
* Update the PassManager and light.
*
* @param timer
* the application timer
*/
@Override
protected void updateExample(final ReadOnlyTimer timer) {
_passManager.updatePasses(timer.getTimePerFrame());
if (_updateLight) {
final double time = timer.getTimeInSeconds() * 0.2;
lightPosition.set(Math.sin(time) * 10000.0, 5000.0, Math.cos(time) * 10000.0);
}
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = (frames / counter);
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
}
/**
* Initialize pssm if needed. Update light position. Render scene.
*
* @param renderer
* the renderer
*/
@Override
protected void renderExample(final Renderer renderer) {
if (!_pssmPass.isInitialised()) {
_pssmPass.init(renderer);
}
updateQuadTextures(renderer);
// Update the shadowpass "light" position. Iow it's camera.
final Light light = _lightState.get(0);
if (light instanceof PointLight) {
((PointLight) light).setLocation(lightPosition);
} else if (light instanceof DirectionalLight) {
((DirectionalLight) light).setDirection(lightPosition.normalize(null).negateLocal());
}
_passManager.renderPasses(renderer);
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Parallel Split Shadow Maps - Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(250, 200, -250));
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
45.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ (float) _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0, 10000);
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y);
_controlHandle.setMoveSpeed(200);
// Setup some standard states for the scene.
final CullState cullFrontFace = new CullState();
cullFrontFace.setEnabled(true);
cullFrontFace.setCullFace(CullState.Face.Back);
_root.setRenderState(cullFrontFace);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
_root.setRenderState(ts);
final MaterialState ms = new MaterialState();
ms.setColorMaterial(ColorMaterial.Diffuse);
_root.setRenderState(ms);
_passManager = new BasicPassManager();
// setup some quads for debug viewing.
final RenderPass renderPass = new RenderPass();
final int quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10;
_orthoQuad = new Quad[ParallelSplitShadowMapPass._MAX_SPLITS];
for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) {
_orthoQuad[i] = new Quad("OrthoQuad", quadSize, quadSize);
_orthoQuad[i].setTranslation(new Vector3((quadSize / 2 + 5) + (quadSize + 5) * i, (quadSize / 2 + 5), 1));
_orthoQuad[i].getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
_orthoQuad[i].getSceneHints().setLightCombineMode(LightCombineMode.Off);
_orthoQuad[i].getSceneHints().setTextureCombineMode(TextureCombineMode.Replace);
_orthoQuad[i].getSceneHints().setCullHint(CullHint.Never);
renderPass.add(_orthoQuad[i]);
}
// Create scene objects.
setupTerrain();
final RenderPass rootPass = new RenderPass();
rootPass.add(_root);
_lightState.detachAll();
final DirectionalLight light = new DirectionalLight();
// final PointLight light = new PointLight();
light.setEnabled(true);
_lightState.attach(light);
// Create pssm pass
_pssmPass = new ParallelSplitShadowMapPass(light, 1024, 3);
_pssmPass.add(_root);
_pssmPass.setUseSceneTexturing(true);
_pssmPass.setUseObjectCullFace(true);
final Node occluders = setupOccluders();
ShadowCasterManager.INSTANCE.addSpatial(occluders);
// Populate passmanager with passes.
_passManager.add(rootPass);
_passManager.add(_pssmPass);
_passManager.add(renderPass);
// Setup textfields for presenting example info.
final Node textNodes = new Node("Text");
renderPass.add(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight();
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - (i + 1) * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
// Register keyboard triggers for manipulating example
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setDrawShaderDebug(!_pssmPass.isDrawShaderDebug());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_updateLight = !_updateLight;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setUpdateMainCamera(!_pssmPass.isUpdateMainCamera());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setDrawDebug(!_pssmPass.isDrawDebug());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (_pssmPass.getNumOfSplits() > ParallelSplitShadowMapPass._MIN_SPLITS) {
_pssmPass.setNumOfSplits(_pssmPass.getNumOfSplits() - 1);
updateText();
_quadsDirty = true;
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (_pssmPass.getNumOfSplits() < ParallelSplitShadowMapPass._MAX_SPLITS) {
_pssmPass.setNumOfSplits(_pssmPass.getNumOfSplits() + 1);
updateText();
_quadsDirty = true;
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (_pssmPass.getShadowMapSize() > 1) {
_pssmPass.setShadowMapSize(_pssmPass.getShadowMapSize() / 2);
updateText();
_quadsDirty = true;
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (_pssmPass.getShadowMapSize() < 2048) {
_pssmPass.setShadowMapSize(_pssmPass.getShadowMapSize() * 2);
updateText();
_quadsDirty = true;
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final double maxShadowDistance = _pssmPass.getMaxShadowDistance();
if (maxShadowDistance > 200.0) {
_pssmPass.setMaxShadowDistance(maxShadowDistance - 100.0);
updateText();
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final double maxShadowDistance = _pssmPass.getMaxShadowDistance();
_pssmPass.setMaxShadowDistance(maxShadowDistance + 100.0);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setNumOfSplits(1);
_pssmPass.setShadowMapSize(1024);
updateText();
_quadsDirty = true;
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.I), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setNumOfSplits(3);
_pssmPass.setShadowMapSize(512);
updateText();
_quadsDirty = true;
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.J), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setUseSceneTexturing(!_pssmPass.isUseSceneTexturing());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.K), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setUseObjectCullFace(!_pssmPass.isUseObjectCullFace());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setEnabled(!_pssmPass.isEnabled());
updateText();
_quadsDirty = true;
}
}));
// Make sure all boundings are updated.
_root.acceptVisitor(new UpdateModelBoundVisitor(), false);
}
/**
* Setup debug quads to render pssm shadowmaps.
*/
private void updateQuadTextures(final Renderer r) {
if (!_quadsDirty) {
return;
}
_quadsDirty = false;
_pssmPass.reinit(r);
for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) {
final TextureState screen = new TextureState();
final Texture2D copy = new Texture2D();
copy.setTextureKey(_pssmPass.getShadowMapTexture(i).getTextureKey());
screen.setTexture(copy);
_orthoQuad[i].setRenderState(screen);
_orthoQuad[i].getSceneHints().setCullHint(CullHint.Never);
_orthoQuad[i].updateGeometricState(0.0);
}
for (int i = _pssmPass.getNumOfSplits(); i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) {
_orthoQuad[i].getSceneHints().setCullHint(CullHint.Always);
}
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[0] Debug shader draw: " + _pssmPass.isDrawShaderDebug());
_exampleInfo[1].setText("[1] Update light: " + _updateLight);
_exampleInfo[2].setText("[2] Update main camera: " + _pssmPass.isUpdateMainCamera());
_exampleInfo[3].setText("[3] Debug draw: " + _pssmPass.isDrawDebug());
_exampleInfo[4].setText("[4/5] Number of splits: " + _pssmPass.getNumOfSplits());
_exampleInfo[5].setText("[6/7] Shadow map size: " + _pssmPass.getShadowMapSize());
_exampleInfo[6].setText("[8/9] Max shadow distance: " + _pssmPass.getMaxShadowDistance());
_exampleInfo[7].setText("[U] Setup 1 split of size 1024");
_exampleInfo[8].setText("[I] Setup 3 splits of size 512");
_exampleInfo[9].setText("[J] Use scene texturing: " + _pssmPass.isUseSceneTexturing());
_exampleInfo[10].setText("[K] Use object cull face: " + _pssmPass.isUseObjectCullFace());
_exampleInfo[11].setText("[SPACE] toggle PSSM pass: " + (_pssmPass.isEnabled() ? "enabled" : "disabled"));
}
/**
* Setup terrain.
*/
private void setupTerrain() {
final Box box = new Box("box", new Vector3(), 10000, 10, 10000);
box.setModelBound(new BoundingBox());
box.addController(new SpatialController<Box>() {
double timer = 0;
public void update(final double time, final Box caller) {
timer += time;
caller.setTranslation(Math.sin(timer) * 20.0, 0, Math.cos(timer) * 20.0);
}
});
_root.attachChild(box);
}
/**
* Setup occluders.
*/
private Node setupOccluders() {
final Node occluders = new Node("occs");
_root.attachChild(occluders);
for (int i = 0; i < 30; i++) {
final double w = Math.random() * 40 + 10;
final double y = Math.random() * 20 + 10;
final Box b = new Box("box", new Vector3(), w, y, w);
b.setModelBound(new BoundingBox());
final double x = Math.random() * 1000 - 500;
final double z = Math.random() * 1000 - 500;
b.setTranslation(new Vector3(x, y, z));
occluders.attachChild(b);
}
final Torus torusWithoutShadows = new Torus("torus", 32, 10, 15.0f, 20.0f);
torusWithoutShadows.setModelBound(new BoundingBox());
torusWithoutShadows.getSceneHints().setCastsShadows(false);
torusWithoutShadows.setTranslation(0, 50, -100);
occluders.attachChild(torusWithoutShadows);
final Torus torus = new Torus("torus", 64, 12, 10.0f, 15.0f);
torus.setModelBound(new BoundingBox());
occluders.attachChild(torus);
torus.addController(new SpatialController<Torus>() {
double timer = 0;
Matrix3 rotation = new Matrix3();
public void update(final double time, final Torus caller) {
timer += time;
caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 50.0 + 20.0, Math.cos(timer) * 40.0);
rotation.fromAngles(timer * 0.4, timer * 0.4, timer * 0.4);
caller.setRotation(rotation);
}
});
// Attach "billboard" with an alpha test.
occluders.attachChild(makeBillBoard());
return occluders;
}
private Spatial makeBillBoard() {
final Node billboard = new Node("bb");
billboard.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
final Quad q1 = new Quad("font block", 150, 200);
q1.setTranslation(0, 80, 0);
q1.setModelBound(new BoundingBox());
final CullState cs = new CullState();
cs.setCullFace(CullState.Face.None);
q1.setRenderState(cs);
billboard.attachChild(q1);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("fonts/OkasaSansSerif-35-medium-regular_00.png",
Texture.MinificationFilter.Trilinear, true));
billboard.setRenderState(ts);
final BlendState bs = new BlendState();
bs.setEnabled(true);
bs.setBlendEnabled(false);
bs.setTestEnabled(true);
bs.setTestFunction(TestFunction.GreaterThan);
bs.setReference(0.7f);
billboard.setRenderState(bs);
return billboard;
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2018 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.effect;
import com.ardor3d.bounding.BoundingBox;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass;
import com.ardor3d.extension.shadow.map.ShadowCasterManager;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture;
import com.ardor3d.image.Texture2D;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.light.Light;
import com.ardor3d.light.PointLight;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.pass.BasicPassManager;
import com.ardor3d.renderer.pass.RenderPass;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.BlendState;
import com.ardor3d.renderer.state.BlendState.TestFunction;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.MaterialState;
import com.ardor3d.renderer.state.MaterialState.ColorMaterial;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.scenegraph.controller.SpatialController;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.hint.TextureCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Torus;
import com.ardor3d.scenegraph.visitor.UpdateModelBoundVisitor;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing the parallel split shadow mapping technique. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.effect.ParallelSplitShadowMapExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/effect_ParallelSplitShadowMapExample.jpg", //
maxHeapMemory = 64)
public class ParallelSplitShadowMapExample extends ExampleBase {
/** Pssm shadow map pass. */
private ParallelSplitShadowMapPass _pssmPass;
/** Pass manager. */
private BasicPassManager _passManager;
/** Quads used for debug showing shadowmaps. */
private Quad _orthoQuad[];
/** Flag for turning on/off light movement. */
private boolean _updateLight = false;
/** Temp vec for updating light pos. */
private final Vector3 lightPosition = new Vector3(10000, 5000, 10000);
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[12];
/** Flag to make sure quads are updated on reinitialization of shadow renderer */
private boolean _quadsDirty = true;
/** Console fps output */
private double counter = 0;
private int frames = 0;
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(final String[] args) {
start(ParallelSplitShadowMapExample.class);
}
/**
* Update the PassManager and light.
*
* @param timer
* the application timer
*/
@Override
protected void updateExample(final ReadOnlyTimer timer) {
_passManager.updatePasses(timer.getTimePerFrame());
if (_updateLight) {
final double time = timer.getTimeInSeconds() * 0.2;
lightPosition.set(Math.sin(time) * 10000.0, 5000.0, Math.cos(time) * 10000.0);
}
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = (frames / counter);
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
}
/**
* Initialize pssm if needed. Update light position. Render scene.
*
* @param renderer
* the renderer
*/
@Override
protected void renderExample(final Renderer renderer) {
if (!_pssmPass.isInitialised()) {
_pssmPass.init(renderer);
}
updateQuadTextures(renderer);
// Update the shadowpass "light" position. Iow it's camera.
final Light light = _lightState.get(0);
if (light instanceof PointLight) {
((PointLight) light).setLocation(lightPosition);
} else if (light instanceof DirectionalLight) {
((DirectionalLight) light).setDirection(lightPosition.normalize(null).negateLocal());
}
_passManager.renderPasses(renderer);
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Parallel Split Shadow Maps - Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(250, 200, -250));
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
45.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ (float) _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0, 10000);
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y);
_controlHandle.setMoveSpeed(200);
// Setup some standard states for the scene.
final CullState cullFrontFace = new CullState();
cullFrontFace.setEnabled(true);
cullFrontFace.setCullFace(CullState.Face.Back);
_root.setRenderState(cullFrontFace);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
_root.setRenderState(ts);
final MaterialState ms = new MaterialState();
ms.setColorMaterial(ColorMaterial.Diffuse);
_root.setRenderState(ms);
_passManager = new BasicPassManager();
// setup some quads for debug viewing.
final RenderPass renderPass = new RenderPass();
final int quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10;
_orthoQuad = new Quad[ParallelSplitShadowMapPass._MAX_SPLITS];
for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) {
_orthoQuad[i] = new Quad("OrthoQuad", quadSize, quadSize);
_orthoQuad[i].setTranslation(new Vector3((quadSize / 2 + 5) + (quadSize + 5) * i, (quadSize / 2 + 5), 1));
_orthoQuad[i].getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
_orthoQuad[i].getSceneHints().setLightCombineMode(LightCombineMode.Off);
_orthoQuad[i].getSceneHints().setTextureCombineMode(TextureCombineMode.Replace);
_orthoQuad[i].getSceneHints().setCullHint(CullHint.Never);
renderPass.add(_orthoQuad[i]);
}
// Create scene objects.
setupTerrain();
final RenderPass rootPass = new RenderPass();
rootPass.add(_root);
_lightState.detachAll();
final DirectionalLight light = new DirectionalLight();
// final PointLight light = new PointLight();
light.setEnabled(true);
_lightState.attach(light);
// Create pssm pass
_pssmPass = new ParallelSplitShadowMapPass(light, 1024, 3);
_pssmPass.add(_root);
_pssmPass.setUseSceneTexturing(true);
_pssmPass.setUseObjectCullFace(true);
final Node occluders = setupOccluders();
ShadowCasterManager.INSTANCE.addSpatial(occluders);
// Populate passmanager with passes.
_passManager.add(rootPass);
_passManager.add(_pssmPass);
_passManager.add(renderPass);
// Setup textfields for presenting example info.
final Node textNodes = new Node("Text");
renderPass.add(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight();
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - (i + 1) * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
// Register keyboard triggers for manipulating example
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setDrawShaderDebug(!_pssmPass.isDrawShaderDebug());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_updateLight = !_updateLight;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setUpdateMainCamera(!_pssmPass.isUpdateMainCamera());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setDrawDebug(!_pssmPass.isDrawDebug());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (_pssmPass.getNumOfSplits() > ParallelSplitShadowMapPass._MIN_SPLITS) {
_pssmPass.setNumOfSplits(_pssmPass.getNumOfSplits() - 1);
updateText();
_quadsDirty = true;
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (_pssmPass.getNumOfSplits() < ParallelSplitShadowMapPass._MAX_SPLITS) {
_pssmPass.setNumOfSplits(_pssmPass.getNumOfSplits() + 1);
updateText();
_quadsDirty = true;
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (_pssmPass.getShadowMapSize() > 1) {
_pssmPass.setShadowMapSize(_pssmPass.getShadowMapSize() / 2);
updateText();
_quadsDirty = true;
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (_pssmPass.getShadowMapSize() < 2048) {
_pssmPass.setShadowMapSize(_pssmPass.getShadowMapSize() * 2);
updateText();
_quadsDirty = true;
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final double maxShadowDistance = _pssmPass.getMaxShadowDistance();
if (maxShadowDistance > 200.0) {
_pssmPass.setMaxShadowDistance(maxShadowDistance - 100.0);
updateText();
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final double maxShadowDistance = _pssmPass.getMaxShadowDistance();
_pssmPass.setMaxShadowDistance(maxShadowDistance + 100.0);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setNumOfSplits(1);
_pssmPass.setShadowMapSize(1024);
updateText();
_quadsDirty = true;
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.I), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setNumOfSplits(3);
_pssmPass.setShadowMapSize(512);
updateText();
_quadsDirty = true;
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.J), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setUseSceneTexturing(!_pssmPass.isUseSceneTexturing());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.K), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setUseObjectCullFace(!_pssmPass.isUseObjectCullFace());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setEnabled(!_pssmPass.isEnabled());
updateText();
_quadsDirty = true;
}
}));
// Make sure all boundings are updated.
_root.acceptVisitor(new UpdateModelBoundVisitor(), false);
}
/**
* Setup debug quads to render pssm shadowmaps.
*/
private void updateQuadTextures(final Renderer r) {
if (!_quadsDirty) {
return;
}
_quadsDirty = false;
_pssmPass.reinit(r);
for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) {
final TextureState screen = new TextureState();
final Texture2D copy = new Texture2D();
copy.setTextureKey(_pssmPass.getShadowMapTexture(i).getTextureKey());
screen.setTexture(copy);
_orthoQuad[i].setRenderState(screen);
_orthoQuad[i].getSceneHints().setCullHint(CullHint.Never);
_orthoQuad[i].updateGeometricState(0.0);
}
for (int i = _pssmPass.getNumOfSplits(); i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) {
_orthoQuad[i].getSceneHints().setCullHint(CullHint.Always);
}
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[0] Debug shader draw: " + _pssmPass.isDrawShaderDebug());
_exampleInfo[1].setText("[1] Update light: " + _updateLight);
_exampleInfo[2].setText("[2] Update main camera: " + _pssmPass.isUpdateMainCamera());
_exampleInfo[3].setText("[3] Debug draw: " + _pssmPass.isDrawDebug());
_exampleInfo[4].setText("[4/5] Number of splits: " + _pssmPass.getNumOfSplits());
_exampleInfo[5].setText("[6/7] Shadow map size: " + _pssmPass.getShadowMapSize());
_exampleInfo[6].setText("[8/9] Max shadow distance: " + _pssmPass.getMaxShadowDistance());
_exampleInfo[7].setText("[U] Setup 1 split of size 1024");
_exampleInfo[8].setText("[I] Setup 3 splits of size 512");
_exampleInfo[9].setText("[J] Use scene texturing: " + _pssmPass.isUseSceneTexturing());
_exampleInfo[10].setText("[K] Use object cull face: " + _pssmPass.isUseObjectCullFace());
_exampleInfo[11].setText("[SPACE] toggle PSSM pass: " + (_pssmPass.isEnabled() ? "enabled" : "disabled"));
}
/**
* Setup terrain.
*/
private void setupTerrain() {
final Box box = new Box("box", new Vector3(), 10000, 10, 10000);
box.setModelBound(new BoundingBox());
box.addController(new SpatialController<Box>() {
double timer = 0;
@Override
public void update(final double time, final Box caller) {
timer += time;
caller.setTranslation(Math.sin(timer) * 20.0, 0, Math.cos(timer) * 20.0);
}
});
_root.attachChild(box);
}
/**
* Setup occluders.
*/
private Node setupOccluders() {
final Node occluders = new Node("occs");
_root.attachChild(occluders);
for (int i = 0; i < 30; i++) {
final double w = Math.random() * 40 + 10;
final double y = Math.random() * 20 + 10;
final Box b = new Box("box", new Vector3(), w, y, w);
b.setModelBound(new BoundingBox());
final double x = Math.random() * 1000 - 500;
final double z = Math.random() * 1000 - 500;
b.setTranslation(new Vector3(x, y, z));
occluders.attachChild(b);
}
final Torus torusWithoutShadows = new Torus("torus", 32, 10, 15.0f, 20.0f);
torusWithoutShadows.setModelBound(new BoundingBox());
torusWithoutShadows.getSceneHints().setCastsShadows(false);
torusWithoutShadows.setTranslation(0, 50, -100);
occluders.attachChild(torusWithoutShadows);
final Torus torus = new Torus("torus", 64, 12, 10.0f, 15.0f);
torus.setModelBound(new BoundingBox());
occluders.attachChild(torus);
torus.addController(new SpatialController<Torus>() {
double timer = 0;
Matrix3 rotation = new Matrix3();
@Override
public void update(final double time, final Torus caller) {
timer += time;
caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 50.0 + 20.0, Math.cos(timer) * 40.0);
rotation.fromAngles(timer * 0.4, timer * 0.4, timer * 0.4);
caller.setRotation(rotation);
}
});
// Attach "billboard" with an alpha test.
occluders.attachChild(makeBillBoard());
return occluders;
}
private Spatial makeBillBoard() {
final Node billboard = new Node("bb");
billboard.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
final Quad q1 = new Quad("font block", 150, 200);
q1.setTranslation(0, 80, 0);
q1.setModelBound(new BoundingBox());
final CullState cs = new CullState();
cs.setCullFace(CullState.Face.None);
q1.setRenderState(cs);
billboard.attachChild(q1);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("fonts/OkasaSansSerif-35-medium-regular_00.png",
Texture.MinificationFilter.Trilinear, true));
billboard.setRenderState(ts);
final BlendState bs = new BlendState();
bs.setEnabled(true);
bs.setBlendEnabled(false);
bs.setTestEnabled(true);
bs.setTestFunction(TestFunction.GreaterThan);
bs.setReference(0.7f);
billboard.setRenderState(bs);
return billboard;
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleRampExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleRampExample.java index 5d48d82..643ebe1 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleRampExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleRampExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleSwarmExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleSwarmExample.java index b6c9172..9705a68 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleSwarmExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleSwarmExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleSystemExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleSystemExample.java index 7077921..2cddc0b 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleSystemExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ParticleSystemExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ProjectedGridExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ProjectedGridExample.java index 3ff01e1..0644573 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ProjectedGridExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ProjectedGridExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -96,30 +96,35 @@ public class ProjectedGridExample extends ExampleBase { _root.attachChild(projectedGrid); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { projectedGrid.setFreezeUpdate(!projectedGrid.isFreezeUpdate()); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { projectedGrid.setNrUpdateThreads(projectedGrid.getNrUpdateThreads() - 1); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { projectedGrid.setNrUpdateThreads(projectedGrid.getNrUpdateThreads() + 1); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { projectedGrid.setDrawDebug(!projectedGrid.isDrawDebug()); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { projectedGrid.setDrawDebug(true); animateExternalCamera = !animateExternalCamera; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ProjectedGridWaterExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ProjectedGridWaterExample.java index 0bb3aa5..835b751 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ProjectedGridWaterExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ProjectedGridWaterExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.effect;
import com.ardor3d.bounding.BoundingBox;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.effect.water.ProjectedGrid;
import com.ardor3d.extension.effect.water.WaterHeightGenerator;
import com.ardor3d.extension.effect.water.WaterNode;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Plane;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.MaterialState;
import com.ardor3d.renderer.state.MaterialState.ColorMaterial;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.controller.SpatialController;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Torus;
import com.ardor3d.scenegraph.visitor.UpdateModelBoundVisitor;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* A demonstration of the WaterNode and ProjectedGrid classes; which handles rendering of water effects with a projected
* grid.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.effect.ProjectedGridWaterExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/effect_ProjectedGridWaterExample.jpg", //
maxHeapMemory = 64)
public class ProjectedGridWaterExample extends ExampleBase {
/** The water instance taking care of the water rendering. */
private WaterNode waterNode;
/** The skybox. */
private Skybox skybox;
/** The ProjectedGrid used as geometry for the water. */
private ProjectedGrid projectedGrid;
/** The far plane. */
private final double farPlane = 10000.0;
/** Node containing debug quads for showing waternode render textures. */
private Node debugQuadsNode;
/** Flag for showing/hiding debug quads. */
private boolean showDebugQuads = true;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[3];
/**
* The main method.
*
* @param args
* the args
*/
public static void main(final String[] args) {
start(ProjectedGridWaterExample.class);
}
/**
* Update skybox location and waterQuad position.
*
* @param timer
* the timer
*/
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera cam = _canvas.getCanvasRenderer().getCamera();
skybox.setTranslation(cam.getLocation());
skybox.updateGeometricState(0.0f, true);
waterNode.update(timer.getTimePerFrame());
}
/**
* Render example.
*
* @param renderer
* the renderer
*/
@Override
protected void renderExample(final Renderer renderer) {
super.renderExample(renderer);
if (debugQuadsNode == null) {
createDebugQuads();
_root.attachChild(debugQuadsNode);
}
}
/**
* Initialize water node and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Projected Grid Water - Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(100, 50, 100));
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
45.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ (float) _canvas.getCanvasRenderer().getCamera().getHeight(), 1, farPlane);
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y);
// Setup some standard states for the scene.
final CullState cullFrontFace = new CullState();
cullFrontFace.setEnabled(true);
cullFrontFace.setCullFace(CullState.Face.Back);
_root.setRenderState(cullFrontFace);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
_root.setRenderState(ts);
final MaterialState ms = new MaterialState();
ms.setColorMaterial(ColorMaterial.Diffuse);
_root.setRenderState(ms);
// Need to setup fog cause the water use it for various calculations.
setupFog();
// Collect everything we want reflected in the water under a node.
final Node reflectedNode = new Node("reflectNode");
reflectedNode.attachChild(createObjects());
buildSkyBox();
reflectedNode.attachChild(skybox);
_root.attachChild(reflectedNode);
final Camera cam = _canvas.getCanvasRenderer().getCamera();
// Create a new WaterNode with refraction enabled.
waterNode = new WaterNode(cam, 4, true, true);
waterNode.setClipBias(0.5f);
waterNode.setWaterMaxAmplitude(5.0f);
// Setup textures to use for the water.
waterNode.setNormalMapTextureString("images/water/normalmap3.dds");
waterNode.setDudvMapTextureString("images/water/dudvmap.png");
waterNode.setFallbackMapTextureString("images/water/water2.png");
waterNode.setFoamMapTextureString("images/water/oceanfoam.png");
// setting to default value just to show
waterNode.setWaterPlane(new Plane(new Vector3(0.0, 1.0, 0.0), 0.0));
// Create a ProjectedGrid to use as geometry for the water.
projectedGrid = new ProjectedGrid("ProjectedGrid", cam, 100, 70, 0.01f, new WaterHeightGenerator(), _timer);
// or implement your own waves like this(or in a separate class)...
// projectedGrid = new ProjectedGrid( "ProjectedGrid", cam, 50, 50,
// 0.01f, new HeightGenerator() {
// public float getHeight( float x, float z, float time ) {
// return
// FastMath.sin(x*0.05f+time*2.0f)+FastMath.cos(z*0.1f+time*4.0f)*2;
// }
// } );
projectedGrid.setNrUpdateThreads(Runtime.getRuntime().availableProcessors());
waterNode.attachChild(projectedGrid);
waterNode.addReflectedScene(reflectedNode);
waterNode.setSkybox(skybox);
_root.attachChild(waterNode);
// Setup textfields for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
// Register keyboard triggers for manipulating example
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
switchShowDebug();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
projectedGrid.setFreezeUpdate(!projectedGrid.isFreezeUpdate());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
projectedGrid.setNrUpdateThreads(projectedGrid.getNrUpdateThreads() - 1);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
projectedGrid.setNrUpdateThreads(projectedGrid.getNrUpdateThreads() + 1);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
waterNode.reloadShader();
}
}));
// Make sure all boundings are updated.
_root.acceptVisitor(new UpdateModelBoundVisitor(), false);
}
/**
* Setup fog.
*/
private void setupFog() {
final FogState fogState = new FogState();
fogState.setDensity(1.0f);
fogState.setEnabled(true);
fogState.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fogState.setEnd((float) farPlane);
fogState.setStart((float) farPlane / 10.0f);
fogState.setDensityFunction(FogState.DensityFunction.Linear);
fogState.setQuality(FogState.Quality.PerVertex);
_root.setRenderState(fogState);
}
/**
* Builds the sky box.
*/
private void buildSkyBox() {
skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
}
/**
* Creates the scene objects.
*
* @return the node containing the objects
*/
private Node createObjects() {
final Node objects = new Node("objects");
final Torus torus = new Torus("Torus", 50, 50, 8, 17);
torus.setTranslation(new Vector3(50, -5, 20));
TextureState ts = new TextureState();
torus.addController(new SpatialController<Torus>() {
private double timer = 0;
private final Matrix3 rotation = new Matrix3();
public void update(final double time, final Torus caller) {
timer += time * 0.5;
caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0);
rotation.fromAngles(timer * 0.5, timer * 0.5, timer * 0.5);
caller.setRotation(rotation);
}
});
Texture t0 = TextureManager.load("images/ardor3d_white_256.jpg",
Texture.MinificationFilter.BilinearNearestMipMap, true);
ts.setTexture(t0, 0);
ts.setEnabled(true);
torus.setRenderState(ts);
objects.attachChild(torus);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
Box box = new Box("box1", new Vector3(-10, -10, -10), new Vector3(10, 10, 10));
box.setTranslation(new Vector3(0, -7, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box2", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(15, 10, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box3", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(0, -10, 15));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box4", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(20, 0, 0));
box.setRenderState(ts);
objects.attachChild(box);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
box = new Box("box5", new Vector3(-50, -2, -50), new Vector3(50, 2, 50));
box.setTranslation(new Vector3(0, -15, 0));
box.setRenderState(ts);
box.setModelBound(new BoundingBox());
objects.attachChild(box);
return objects;
}
/**
* Switch show debug.
*/
private void switchShowDebug() {
showDebugQuads = !showDebugQuads;
if (showDebugQuads) {
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
} else {
debugQuadsNode.getSceneHints().setCullHint(CullHint.Always);
}
}
/**
* Creates the debug quads.
*/
private void createDebugQuads() {
debugQuadsNode = new Node("quadNode");
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
final double quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10;
Quad debugQuad = new Quad("reflectionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
TextureState ts = new TextureState();
ts.setTexture(waterNode.getTextureReflect());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 1.0, 1.0);
debugQuadsNode.attachChild(debugQuad);
if (waterNode.getTextureRefract() != null) {
debugQuad = new Quad("refractionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
ts = new TextureState();
ts.setTexture(waterNode.getTextureRefract());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 2.1, 1.0);
debugQuadsNode.attachChild(debugQuad);
}
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[SPACE] Show debug quads: " + showDebugQuads);
_exampleInfo[1].setText("[1/2] Number of update threads: " + projectedGrid.getNrUpdateThreads());
_exampleInfo[2].setText("[F] Freeze update: " + projectedGrid.isFreezeUpdate());
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.effect;
import com.ardor3d.bounding.BoundingBox;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.effect.water.ProjectedGrid;
import com.ardor3d.extension.effect.water.WaterHeightGenerator;
import com.ardor3d.extension.effect.water.WaterNode;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Plane;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.MaterialState;
import com.ardor3d.renderer.state.MaterialState.ColorMaterial;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.controller.SpatialController;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Torus;
import com.ardor3d.scenegraph.visitor.UpdateModelBoundVisitor;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* A demonstration of the WaterNode and ProjectedGrid classes; which handles rendering of water effects with a projected
* grid.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.effect.ProjectedGridWaterExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/effect_ProjectedGridWaterExample.jpg", //
maxHeapMemory = 64)
public class ProjectedGridWaterExample extends ExampleBase {
/** The water instance taking care of the water rendering. */
private WaterNode waterNode;
/** The skybox. */
private Skybox skybox;
/** The ProjectedGrid used as geometry for the water. */
private ProjectedGrid projectedGrid;
/** The far plane. */
private final double farPlane = 10000.0;
/** Node containing debug quads for showing waternode render textures. */
private Node debugQuadsNode;
/** Flag for showing/hiding debug quads. */
private boolean showDebugQuads = true;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[3];
/**
* The main method.
*
* @param args
* the args
*/
public static void main(final String[] args) {
start(ProjectedGridWaterExample.class);
}
/**
* Update skybox location and waterQuad position.
*
* @param timer
* the timer
*/
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera cam = _canvas.getCanvasRenderer().getCamera();
skybox.setTranslation(cam.getLocation());
skybox.updateGeometricState(0.0f, true);
waterNode.update(timer.getTimePerFrame());
}
/**
* Render example.
*
* @param renderer
* the renderer
*/
@Override
protected void renderExample(final Renderer renderer) {
super.renderExample(renderer);
if (debugQuadsNode == null) {
createDebugQuads();
_root.attachChild(debugQuadsNode);
}
}
/**
* Initialize water node and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Projected Grid Water - Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(100, 50, 100));
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
45.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ (float) _canvas.getCanvasRenderer().getCamera().getHeight(), 1, farPlane);
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y);
// Setup some standard states for the scene.
final CullState cullFrontFace = new CullState();
cullFrontFace.setEnabled(true);
cullFrontFace.setCullFace(CullState.Face.Back);
_root.setRenderState(cullFrontFace);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
_root.setRenderState(ts);
final MaterialState ms = new MaterialState();
ms.setColorMaterial(ColorMaterial.Diffuse);
_root.setRenderState(ms);
// Need to setup fog cause the water use it for various calculations.
setupFog();
// Collect everything we want reflected in the water under a node.
final Node reflectedNode = new Node("reflectNode");
reflectedNode.attachChild(createObjects());
buildSkyBox();
reflectedNode.attachChild(skybox);
_root.attachChild(reflectedNode);
final Camera cam = _canvas.getCanvasRenderer().getCamera();
// Create a new WaterNode with refraction enabled.
waterNode = new WaterNode(cam, 4, true, true);
waterNode.setClipBias(0.5f);
waterNode.setWaterMaxAmplitude(5.0f);
// Setup textures to use for the water.
waterNode.setNormalMapTextureString("images/water/normalmap3.dds");
waterNode.setDudvMapTextureString("images/water/dudvmap.png");
waterNode.setFallbackMapTextureString("images/water/water2.png");
waterNode.setFoamMapTextureString("images/water/oceanfoam.png");
// setting to default value just to show
waterNode.setWaterPlane(new Plane(new Vector3(0.0, 1.0, 0.0), 0.0));
// Create a ProjectedGrid to use as geometry for the water.
projectedGrid = new ProjectedGrid("ProjectedGrid", cam, 100, 70, 0.01f, new WaterHeightGenerator(), _timer);
// or implement your own waves like this(or in a separate class)...
// projectedGrid = new ProjectedGrid( "ProjectedGrid", cam, 50, 50,
// 0.01f, new HeightGenerator() {
// public float getHeight( float x, float z, float time ) {
// return
// FastMath.sin(x*0.05f+time*2.0f)+FastMath.cos(z*0.1f+time*4.0f)*2;
// }
// } );
projectedGrid.setNrUpdateThreads(Runtime.getRuntime().availableProcessors());
waterNode.attachChild(projectedGrid);
waterNode.addReflectedScene(reflectedNode);
waterNode.setSkybox(skybox);
_root.attachChild(waterNode);
// Setup textfields for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
// Register keyboard triggers for manipulating example
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
switchShowDebug();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
projectedGrid.setFreezeUpdate(!projectedGrid.isFreezeUpdate());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
projectedGrid.setNrUpdateThreads(projectedGrid.getNrUpdateThreads() - 1);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
projectedGrid.setNrUpdateThreads(projectedGrid.getNrUpdateThreads() + 1);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
waterNode.reloadShader();
}
}));
// Make sure all boundings are updated.
_root.acceptVisitor(new UpdateModelBoundVisitor(), false);
}
/**
* Setup fog.
*/
private void setupFog() {
final FogState fogState = new FogState();
fogState.setDensity(1.0f);
fogState.setEnabled(true);
fogState.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fogState.setEnd((float) farPlane);
fogState.setStart((float) farPlane / 10.0f);
fogState.setDensityFunction(FogState.DensityFunction.Linear);
fogState.setQuality(FogState.Quality.PerVertex);
_root.setRenderState(fogState);
}
/**
* Builds the sky box.
*/
private void buildSkyBox() {
skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
}
/**
* Creates the scene objects.
*
* @return the node containing the objects
*/
private Node createObjects() {
final Node objects = new Node("objects");
final Torus torus = new Torus("Torus", 50, 50, 8, 17);
torus.setTranslation(new Vector3(50, -5, 20));
TextureState ts = new TextureState();
torus.addController(new SpatialController<Torus>() {
private double timer = 0;
private final Matrix3 rotation = new Matrix3();
@Override
public void update(final double time, final Torus caller) {
timer += time * 0.5;
caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0);
rotation.fromAngles(timer * 0.5, timer * 0.5, timer * 0.5);
caller.setRotation(rotation);
}
});
Texture t0 = TextureManager.load("images/ardor3d_white_256.jpg",
Texture.MinificationFilter.BilinearNearestMipMap, true);
ts.setTexture(t0, 0);
ts.setEnabled(true);
torus.setRenderState(ts);
objects.attachChild(torus);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
Box box = new Box("box1", new Vector3(-10, -10, -10), new Vector3(10, 10, 10));
box.setTranslation(new Vector3(0, -7, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box2", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(15, 10, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box3", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(0, -10, 15));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box4", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(20, 0, 0));
box.setRenderState(ts);
objects.attachChild(box);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
box = new Box("box5", new Vector3(-50, -2, -50), new Vector3(50, 2, 50));
box.setTranslation(new Vector3(0, -15, 0));
box.setRenderState(ts);
box.setModelBound(new BoundingBox());
objects.attachChild(box);
return objects;
}
/**
* Switch show debug.
*/
private void switchShowDebug() {
showDebugQuads = !showDebugQuads;
if (showDebugQuads) {
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
} else {
debugQuadsNode.getSceneHints().setCullHint(CullHint.Always);
}
}
/**
* Creates the debug quads.
*/
private void createDebugQuads() {
debugQuadsNode = new Node("quadNode");
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
final double quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10;
Quad debugQuad = new Quad("reflectionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
TextureState ts = new TextureState();
ts.setTexture(waterNode.getTextureReflect());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 1.0, 1.0);
debugQuadsNode.attachChild(debugQuad);
if (waterNode.getTextureRefract() != null) {
debugQuad = new Quad("refractionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
ts = new TextureState();
ts.setTexture(waterNode.getTextureRefract());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 2.1, 1.0);
debugQuadsNode.attachChild(debugQuad);
}
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[SPACE] Show debug quads: " + showDebugQuads);
_exampleInfo[1].setText("[1/2] Number of update threads: " + projectedGrid.getNrUpdateThreads());
_exampleInfo[2].setText("[F] Freeze update: " + projectedGrid.isFreezeUpdate());
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/QuadImposterExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/QuadImposterExample.java index f0b214c..04daefd 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/QuadImposterExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/QuadImposterExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -101,6 +101,7 @@ public class QuadImposterExample extends ExampleBase { imposter2.attachChild(scene3); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { showImposter = !showImposter; if (showImposter) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/TrailExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/TrailExample.java index bdcf643..58ce203 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/TrailExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/TrailExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -170,54 +170,63 @@ public class TrailExample extends ExampleBase { updateText(); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { trailMesh.setFacingMode(TrailMesh.FacingMode.Tangent); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { trailMesh.setFacingMode(TrailMesh.FacingMode.Billboard); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { trailMesh.setUpdateMode(TrailMesh.UpdateMode.Step); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { trailMesh.setUpdateMode(TrailMesh.UpdateMode.Interpolate); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { trailMesh.setUpdateSpeed(trailMesh.getUpdateSpeed() * 2.0f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { trailMesh.setUpdateSpeed(trailMesh.getUpdateSpeed() * 0.5f); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { updateTrail = !updateTrail; updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { variableWidth = !variableWidth; updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.E), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { trailMesh.resetPosition(sphere.getWorldTranslation()); updateText(); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/WaterExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/WaterExample.java index 8c93caf..10b769d 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/WaterExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/WaterExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.effect;
import java.nio.FloatBuffer;
import com.ardor3d.bounding.BoundingBox;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.effect.water.WaterNode;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Plane;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.MaterialState;
import com.ardor3d.renderer.state.MaterialState.ColorMaterial;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.controller.SpatialController;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Torus;
import com.ardor3d.scenegraph.visitor.UpdateModelBoundVisitor;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* A demonstration of the WaterNode class; which handles rendering of a water effect on all of it's children.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.effect.WaterExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/effect_WaterExample.jpg", //
maxHeapMemory = 64)
public class WaterExample extends ExampleBase {
/** The water instance taking care of the water rendering. */
private WaterNode waterNode;
/** The skybox. */
private Skybox skybox;
/** The quad used as geometry for the water. */
private Quad waterQuad;
/** The far plane. */
private final double farPlane = 10000.0;
/** The texture scale to use for the water quad. */
private final double textureScale = 0.02;
/** Node containing debug quads for showing waternode render textures. */
private Node debugQuadsNode;
/** Flag for showing/hiding debug quads. */
private boolean showDebugQuads = true;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[1];
/**
* The main method.
*
* @param args
* the args
*/
public static void main(final String[] args) {
start(WaterExample.class);
}
/**
* Update skybox location and waterQuad position.
*
* @param timer
* the timer
*/
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera cam = _canvas.getCanvasRenderer().getCamera();
skybox.setTranslation(cam.getLocation());
skybox.updateGeometricState(0.0f, true);
final Vector3 transVec = new Vector3(cam.getLocation().getX(), waterNode.getWaterHeight(), cam.getLocation()
.getZ());
setTextureCoords(0, transVec.getX(), -transVec.getZ(), textureScale);
// vertex coords
setVertexCoords(transVec.getX(), transVec.getY(), transVec.getZ());
waterNode.update(timer.getTimePerFrame());
}
/**
* Render example.
*
* @param renderer
* the renderer
*/
@Override
protected void renderExample(final Renderer renderer) {
super.renderExample(renderer);
if (debugQuadsNode == null) {
createDebugQuads();
_root.attachChild(debugQuadsNode);
}
}
/**
* Initialize water node and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Quad Water - Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(100, 50, 100));
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
45.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ (float) _canvas.getCanvasRenderer().getCamera().getHeight(), 1, farPlane);
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y);
// Setup some standard states for the scene.
final CullState cullFrontFace = new CullState();
cullFrontFace.setEnabled(true);
cullFrontFace.setCullFace(CullState.Face.Back);
_root.setRenderState(cullFrontFace);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
_root.setRenderState(ts);
final MaterialState ms = new MaterialState();
ms.setColorMaterial(ColorMaterial.Diffuse);
_root.setRenderState(ms);
// Need to setup fog cause the water use it for various calculations.
setupFog();
// Collect everything we want reflected in the water under a node.
final Node reflectedNode = new Node("reflectNode");
reflectedNode.attachChild(createObjects());
buildSkyBox();
reflectedNode.attachChild(skybox);
_root.attachChild(reflectedNode);
final Camera cam = _canvas.getCanvasRenderer().getCamera();
// Create a new WaterNode with refraction enabled.
waterNode = new WaterNode(cam, 4, false, true);
// Setup textures to use for the water.
waterNode.setNormalMapTextureString("images/water/normalmap3.dds");
waterNode.setDudvMapTextureString("images/water/dudvmap.png");
waterNode.setFallbackMapTextureString("images/water/water2.png");
// setting to default value just to show
waterNode.setWaterPlane(new Plane(new Vector3(0.0, 1.0, 0.0), 0.0));
// Create a quad to use as geometry for the water.
waterQuad = new Quad("waterQuad", 1, 1);
// Hack the quad normals to point up in the y-axis. Since we are manipulating the vertices as
// we move this is more convenient than rotating the quad.
final FloatBuffer normBuf = waterQuad.getMeshData().getNormalBuffer();
normBuf.clear();
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
waterNode.attachChild(waterQuad);
waterNode.addReflectedScene(reflectedNode);
waterNode.setSkybox(skybox);
_root.attachChild(waterNode);
// Setyp textfields for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
// Register keyboard triggers for manipulating example
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
switchShowDebug();
updateText();
}
}));
// Make sure all boundings are updated.
_root.acceptVisitor(new UpdateModelBoundVisitor(), false);
}
/**
* Sets the vertex coords of the quad.
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
*/
private void setVertexCoords(final double x, final double y, final double z) {
final FloatBuffer vertBuf = waterQuad.getMeshData().getVertexBuffer();
vertBuf.clear();
vertBuf.put((float) (x - farPlane)).put((float) y).put((float) (z - farPlane));
vertBuf.put((float) (x - farPlane)).put((float) y).put((float) (z + farPlane));
vertBuf.put((float) (x + farPlane)).put((float) y).put((float) (z + farPlane));
vertBuf.put((float) (x + farPlane)).put((float) y).put((float) (z - farPlane));
}
/**
* Sets the texture coords of the quad.
*
* @param buffer
* the buffer
* @param x
* the x
* @param y
* the y
* @param textureScale
* the texture scale
*/
private void setTextureCoords(final int buffer, double x, double y, double textureScale) {
x *= textureScale * 0.5f;
y *= textureScale * 0.5f;
textureScale = farPlane * textureScale;
FloatBuffer texBuf;
texBuf = waterQuad.getMeshData().getTextureBuffer(buffer);
texBuf.clear();
texBuf.put((float) x).put((float) (textureScale + y));
texBuf.put((float) x).put((float) y);
texBuf.put((float) (textureScale + x)).put((float) y);
texBuf.put((float) (textureScale + x)).put((float) (textureScale + y));
}
/**
* Setup fog.
*/
private void setupFog() {
final FogState fogState = new FogState();
fogState.setDensity(1.0f);
fogState.setEnabled(true);
fogState.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fogState.setEnd((float) farPlane);
fogState.setStart((float) farPlane / 10.0f);
fogState.setDensityFunction(FogState.DensityFunction.Linear);
fogState.setQuality(FogState.Quality.PerVertex);
_root.setRenderState(fogState);
}
/**
* Builds the sky box.
*/
private void buildSkyBox() {
skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
}
/**
* Creates the scene objects.
*
* @return the node containing the objects
*/
private Node createObjects() {
final Node objects = new Node("objects");
final Torus torus = new Torus("Torus", 50, 50, 8, 17);
torus.setTranslation(new Vector3(50, -5, 20));
TextureState ts = new TextureState();
torus.addController(new SpatialController<Torus>() {
private double timer = 0;
private final Matrix3 rotation = new Matrix3();
public void update(final double time, final Torus caller) {
timer += time * 0.5;
caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0);
rotation.fromAngles(timer * 0.5, timer * 0.5, timer * 0.5);
caller.setRotation(rotation);
}
});
Texture t0 = TextureManager.load("images/ardor3d_white_256.jpg",
Texture.MinificationFilter.BilinearNearestMipMap, true);
ts.setTexture(t0, 0);
ts.setEnabled(true);
torus.setRenderState(ts);
objects.attachChild(torus);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
Box box = new Box("box1", new Vector3(-10, -10, -10), new Vector3(10, 10, 10));
box.setTranslation(new Vector3(0, -7, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box2", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(15, 10, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box3", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(0, -10, 15));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box4", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(20, 0, 0));
box.setRenderState(ts);
objects.attachChild(box);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
box = new Box("box5", new Vector3(-50, -2, -50), new Vector3(50, 2, 50));
box.setTranslation(new Vector3(0, -15, 0));
box.setRenderState(ts);
box.setModelBound(new BoundingBox());
objects.attachChild(box);
return objects;
}
/**
* Switch show debug.
*/
private void switchShowDebug() {
showDebugQuads = !showDebugQuads;
if (showDebugQuads) {
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
} else {
debugQuadsNode.getSceneHints().setCullHint(CullHint.Always);
}
}
/**
* Creates the debug quads.
*/
private void createDebugQuads() {
debugQuadsNode = new Node("quadNode");
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
final double quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10;
Quad debugQuad = new Quad("reflectionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
TextureState ts = new TextureState();
ts.setTexture(waterNode.getTextureReflect());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 1.0, 1.0);
debugQuadsNode.attachChild(debugQuad);
if (waterNode.getTextureRefract() != null) {
debugQuad = new Quad("refractionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
ts = new TextureState();
ts.setTexture(waterNode.getTextureRefract());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 2.1, 1.0);
debugQuadsNode.attachChild(debugQuad);
}
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[SPACE] Show debug quads: " + showDebugQuads);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.effect;
import java.nio.FloatBuffer;
import com.ardor3d.bounding.BoundingBox;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.effect.water.WaterNode;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Plane;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.MaterialState;
import com.ardor3d.renderer.state.MaterialState.ColorMaterial;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.controller.SpatialController;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Torus;
import com.ardor3d.scenegraph.visitor.UpdateModelBoundVisitor;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* A demonstration of the WaterNode class; which handles rendering of a water effect on all of it's children.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.effect.WaterExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/effect_WaterExample.jpg", //
maxHeapMemory = 64)
public class WaterExample extends ExampleBase {
/** The water instance taking care of the water rendering. */
private WaterNode waterNode;
/** The skybox. */
private Skybox skybox;
/** The quad used as geometry for the water. */
private Quad waterQuad;
/** The far plane. */
private final double farPlane = 10000.0;
/** The texture scale to use for the water quad. */
private final double textureScale = 0.02;
/** Node containing debug quads for showing waternode render textures. */
private Node debugQuadsNode;
/** Flag for showing/hiding debug quads. */
private boolean showDebugQuads = true;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[1];
/**
* The main method.
*
* @param args
* the args
*/
public static void main(final String[] args) {
start(WaterExample.class);
}
/**
* Update skybox location and waterQuad position.
*
* @param timer
* the timer
*/
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera cam = _canvas.getCanvasRenderer().getCamera();
skybox.setTranslation(cam.getLocation());
skybox.updateGeometricState(0.0f, true);
final Vector3 transVec = new Vector3(cam.getLocation().getX(), waterNode.getWaterHeight(), cam.getLocation()
.getZ());
setTextureCoords(0, transVec.getX(), -transVec.getZ(), textureScale);
// vertex coords
setVertexCoords(transVec.getX(), transVec.getY(), transVec.getZ());
waterNode.update(timer.getTimePerFrame());
}
/**
* Render example.
*
* @param renderer
* the renderer
*/
@Override
protected void renderExample(final Renderer renderer) {
super.renderExample(renderer);
if (debugQuadsNode == null) {
createDebugQuads();
_root.attachChild(debugQuadsNode);
}
}
/**
* Initialize water node and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Quad Water - Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(100, 50, 100));
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
45.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ (float) _canvas.getCanvasRenderer().getCamera().getHeight(), 1, farPlane);
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y);
// Setup some standard states for the scene.
final CullState cullFrontFace = new CullState();
cullFrontFace.setEnabled(true);
cullFrontFace.setCullFace(CullState.Face.Back);
_root.setRenderState(cullFrontFace);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
_root.setRenderState(ts);
final MaterialState ms = new MaterialState();
ms.setColorMaterial(ColorMaterial.Diffuse);
_root.setRenderState(ms);
// Need to setup fog cause the water use it for various calculations.
setupFog();
// Collect everything we want reflected in the water under a node.
final Node reflectedNode = new Node("reflectNode");
reflectedNode.attachChild(createObjects());
buildSkyBox();
reflectedNode.attachChild(skybox);
_root.attachChild(reflectedNode);
final Camera cam = _canvas.getCanvasRenderer().getCamera();
// Create a new WaterNode with refraction enabled.
waterNode = new WaterNode(cam, 4, false, true);
// Setup textures to use for the water.
waterNode.setNormalMapTextureString("images/water/normalmap3.dds");
waterNode.setDudvMapTextureString("images/water/dudvmap.png");
waterNode.setFallbackMapTextureString("images/water/water2.png");
// setting to default value just to show
waterNode.setWaterPlane(new Plane(new Vector3(0.0, 1.0, 0.0), 0.0));
// Create a quad to use as geometry for the water.
waterQuad = new Quad("waterQuad", 1, 1);
// Hack the quad normals to point up in the y-axis. Since we are manipulating the vertices as
// we move this is more convenient than rotating the quad.
final FloatBuffer normBuf = waterQuad.getMeshData().getNormalBuffer();
normBuf.clear();
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
waterNode.attachChild(waterQuad);
waterNode.addReflectedScene(reflectedNode);
waterNode.setSkybox(skybox);
_root.attachChild(waterNode);
// Setyp textfields for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
// Register keyboard triggers for manipulating example
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
switchShowDebug();
updateText();
}
}));
// Make sure all boundings are updated.
_root.acceptVisitor(new UpdateModelBoundVisitor(), false);
}
/**
* Sets the vertex coords of the quad.
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
*/
private void setVertexCoords(final double x, final double y, final double z) {
final FloatBuffer vertBuf = waterQuad.getMeshData().getVertexBuffer();
vertBuf.clear();
vertBuf.put((float) (x - farPlane)).put((float) y).put((float) (z - farPlane));
vertBuf.put((float) (x - farPlane)).put((float) y).put((float) (z + farPlane));
vertBuf.put((float) (x + farPlane)).put((float) y).put((float) (z + farPlane));
vertBuf.put((float) (x + farPlane)).put((float) y).put((float) (z - farPlane));
}
/**
* Sets the texture coords of the quad.
*
* @param buffer
* the buffer
* @param x
* the x
* @param y
* the y
* @param textureScale
* the texture scale
*/
private void setTextureCoords(final int buffer, double x, double y, double textureScale) {
x *= textureScale * 0.5f;
y *= textureScale * 0.5f;
textureScale = farPlane * textureScale;
FloatBuffer texBuf;
texBuf = waterQuad.getMeshData().getTextureBuffer(buffer);
texBuf.clear();
texBuf.put((float) x).put((float) (textureScale + y));
texBuf.put((float) x).put((float) y);
texBuf.put((float) (textureScale + x)).put((float) y);
texBuf.put((float) (textureScale + x)).put((float) (textureScale + y));
}
/**
* Setup fog.
*/
private void setupFog() {
final FogState fogState = new FogState();
fogState.setDensity(1.0f);
fogState.setEnabled(true);
fogState.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fogState.setEnd((float) farPlane);
fogState.setStart((float) farPlane / 10.0f);
fogState.setDensityFunction(FogState.DensityFunction.Linear);
fogState.setQuality(FogState.Quality.PerVertex);
_root.setRenderState(fogState);
}
/**
* Builds the sky box.
*/
private void buildSkyBox() {
skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
}
/**
* Creates the scene objects.
*
* @return the node containing the objects
*/
private Node createObjects() {
final Node objects = new Node("objects");
final Torus torus = new Torus("Torus", 50, 50, 8, 17);
torus.setTranslation(new Vector3(50, -5, 20));
TextureState ts = new TextureState();
torus.addController(new SpatialController<Torus>() {
private double timer = 0;
private final Matrix3 rotation = new Matrix3();
@Override
public void update(final double time, final Torus caller) {
timer += time * 0.5;
caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0);
rotation.fromAngles(timer * 0.5, timer * 0.5, timer * 0.5);
caller.setRotation(rotation);
}
});
Texture t0 = TextureManager.load("images/ardor3d_white_256.jpg",
Texture.MinificationFilter.BilinearNearestMipMap, true);
ts.setTexture(t0, 0);
ts.setEnabled(true);
torus.setRenderState(ts);
objects.attachChild(torus);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
Box box = new Box("box1", new Vector3(-10, -10, -10), new Vector3(10, 10, 10));
box.setTranslation(new Vector3(0, -7, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box2", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(15, 10, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box3", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(0, -10, 15));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box4", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(20, 0, 0));
box.setRenderState(ts);
objects.attachChild(box);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
box = new Box("box5", new Vector3(-50, -2, -50), new Vector3(50, 2, 50));
box.setTranslation(new Vector3(0, -15, 0));
box.setRenderState(ts);
box.setModelBound(new BoundingBox());
objects.attachChild(box);
return objects;
}
/**
* Switch show debug.
*/
private void switchShowDebug() {
showDebugQuads = !showDebugQuads;
if (showDebugQuads) {
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
} else {
debugQuadsNode.getSceneHints().setCullHint(CullHint.Always);
}
}
/**
* Creates the debug quads.
*/
private void createDebugQuads() {
debugQuadsNode = new Node("quadNode");
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
final double quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10;
Quad debugQuad = new Quad("reflectionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
TextureState ts = new TextureState();
ts.setTexture(waterNode.getTextureReflect());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 1.0, 1.0);
debugQuadsNode.attachChild(debugQuad);
if (waterNode.getTextureRefract() != null) {
debugQuad = new Quad("refractionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
ts = new TextureState();
ts.setTexture(waterNode.getTextureRefract());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 2.1, 1.0);
debugQuadsNode.attachChild(debugQuad);
}
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[SPACE] Show debug quads: " + showDebugQuads);
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/interact/InteractExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/interact/InteractExample.java index 0fcbf1e..da38966 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/interact/InteractExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/interact/InteractExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/interact/TerrainHeightFilter.java b/ardor3d-examples/src/main/java/com/ardor3d/example/interact/TerrainHeightFilter.java index 18621d5..26f57f4 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/interact/TerrainHeightFilter.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/interact/TerrainHeightFilter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/interact/TerrainInteractExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/interact/TerrainInteractExample.java index 668112d..601d890 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/interact/TerrainInteractExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/interact/TerrainInteractExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.interact;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.interact.InteractManager;
import com.ardor3d.extension.interact.widget.CompoundInteractWidget;
import com.ardor3d.extension.interact.widget.InteractMatrix;
import com.ardor3d.extension.interact.widget.MovePlanarWidget.MovePlane;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Texture.MinificationFilter;
import com.ardor3d.image.Texture2D;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.shape.PQTorus;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing interact widgets with the Geometry Clipmap Terrain system. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.interact.TerrainInteractExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/interact_TerrainInteractExample.jpg", //
maxHeapMemory = 128)
public class TerrainInteractExample extends ExampleBase {
private final float farPlane = 3000.0f;
private Terrain terrain;
private InteractManager manager;
public static void main(final String[] args) {
ExampleBase.start(TerrainInteractExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
manager.update(timer);
}
@Override
protected void updateLogicalLayer(final ReadOnlyTimer timer) {
manager.getLogicalLayer().checkTriggers(timer.getTimePerFrame());
}
@Override
protected void renderExample(final Renderer renderer) {
super.renderExample(renderer);
manager.render(renderer);
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(400, 220, 715));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(430, 200, 730), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(500);
setupDefaultStates();
try {
final int SIZE = 2048;
final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.6f);
raw.setHeightRange(0.2f);
final float[] heightMap = raw.getHeightData();
final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
1, 500, 1));
terrain = new TerrainBuilder(terrainDataProvider, _canvas.getCanvasRenderer().getCamera())
.setShowDebugPanels(false).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
addControls();
// Add something to move around
final PQTorus obj = new PQTorus("obj", 4, 3, 1.5, .5, 128, 8);
obj.setScale(10);
obj.updateModelBound();
_root.attachChild(obj);
_root.updateGeometricState(0);
try {
Thread.sleep(500);
} catch (final InterruptedException e) {
}
obj.setTranslation(630, terrain.getHeightAt(630, 830) + 20, 830);
manager.setSpatialTarget(obj);
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(ColorRGBA.GRAY);
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
private void addControls() {
// create our manager
manager = new InteractManager();
manager.setupInput(_canvas, _physicalLayer, _logicalLayer);
// final add our widget
final CompoundInteractWidget widget = new CompoundInteractWidget()
.withMoveXAxis(new ColorRGBA(1, 0, 0, .65f), 1.2, .15, .5, .2)
.withMoveZAxis(new ColorRGBA(0, 0, 1, .65f), 1.2, .15, .5, .2) //
.withRotateYAxis() //
.withPlanarHandle(MovePlane.XZ, new ColorRGBA(1, 0, 1, .65f)) //
.withRingTexture((Texture2D) TextureManager.load("images/tick.png", MinificationFilter.Trilinear, true));
// widget.getHandle().setRenderState(_lightState);
manager.addWidget(widget);
manager.setActiveWidget(widget);
// add toggle for matrix mode on widget
manager.getLogicalLayer().registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
widget.setInteractMatrix(widget.getInteractMatrix() == InteractMatrix.World ? InteractMatrix.Local
: InteractMatrix.World);
widget.targetDataUpdated(manager);
}
}));
// add a filter
manager.addFilter(new TerrainHeightFilter(terrain, 20));
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.interact;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.interact.InteractManager;
import com.ardor3d.extension.interact.widget.CompoundInteractWidget;
import com.ardor3d.extension.interact.widget.InteractMatrix;
import com.ardor3d.extension.interact.widget.MovePlanarWidget.MovePlane;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Texture.MinificationFilter;
import com.ardor3d.image.Texture2D;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.shape.PQTorus;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing interact widgets with the Geometry Clipmap Terrain system. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.interact.TerrainInteractExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/interact_TerrainInteractExample.jpg", //
maxHeapMemory = 128)
public class TerrainInteractExample extends ExampleBase {
private final float farPlane = 3000.0f;
private Terrain terrain;
private InteractManager manager;
public static void main(final String[] args) {
ExampleBase.start(TerrainInteractExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
manager.update(timer);
}
@Override
protected void updateLogicalLayer(final ReadOnlyTimer timer) {
manager.getLogicalLayer().checkTriggers(timer.getTimePerFrame());
}
@Override
protected void renderExample(final Renderer renderer) {
super.renderExample(renderer);
manager.render(renderer);
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(400, 220, 715));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(430, 200, 730), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(500);
setupDefaultStates();
try {
final int SIZE = 2048;
final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.6f);
raw.setHeightRange(0.2f);
final float[] heightMap = raw.getHeightData();
final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
1, 500, 1));
terrain = new TerrainBuilder(terrainDataProvider, _canvas.getCanvasRenderer().getCamera())
.setShowDebugPanels(false).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
addControls();
// Add something to move around
final PQTorus obj = new PQTorus("obj", 4, 3, 1.5, .5, 128, 8);
obj.setScale(10);
obj.updateModelBound();
_root.attachChild(obj);
_root.updateGeometricState(0);
try {
Thread.sleep(500);
} catch (final InterruptedException e) {
}
obj.setTranslation(630, terrain.getHeightAt(630, 830) + 20, 830);
manager.setSpatialTarget(obj);
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(ColorRGBA.GRAY);
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
private void addControls() {
// create our manager
manager = new InteractManager();
manager.setupInput(_canvas, _physicalLayer, _logicalLayer);
// final add our widget
final CompoundInteractWidget widget = new CompoundInteractWidget()
.withMoveXAxis(new ColorRGBA(1, 0, 0, .65f), 1.2, .15, .5, .2)
.withMoveZAxis(new ColorRGBA(0, 0, 1, .65f), 1.2, .15, .5, .2) //
.withRotateYAxis() //
.withPlanarHandle(MovePlane.XZ, new ColorRGBA(1, 0, 1, .65f)) //
.withRingTexture((Texture2D) TextureManager.load("images/tick.png", MinificationFilter.Trilinear, true));
// widget.getHandle().setRenderState(_lightState);
manager.addWidget(widget);
manager.setActiveWidget(widget);
// add toggle for matrix mode on widget
manager.getLogicalLayer().registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
widget.setInteractMatrix(widget.getInteractMatrix() == InteractMatrix.World ? InteractMatrix.Local
: InteractMatrix.World);
widget.targetDataUpdated(manager);
}
}));
// add a filter
manager.addFilter(new TerrainHeightFilter(terrain, 20));
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/CurveInterpolationControllerExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/CurveInterpolationControllerExample.java index ca54564..2fd290e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/CurveInterpolationControllerExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/CurveInterpolationControllerExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/DefaultColorInterpolationControllerExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/DefaultColorInterpolationControllerExample.java index 2bd2a97..a673735 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/DefaultColorInterpolationControllerExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/DefaultColorInterpolationControllerExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/InterpolationControllerBase.java b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/InterpolationControllerBase.java index 78ea46e..fc8c7e2 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/InterpolationControllerBase.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/InterpolationControllerBase.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -77,6 +77,7 @@ public abstract class InterpolationControllerBase<C extends InterpolationControl // Add a trigger to change the repeat type on the controller _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { switch (controller.getRepeatType()) { case CLAMP: @@ -95,6 +96,7 @@ public abstract class InterpolationControllerBase<C extends InterpolationControl // Add a slow down command _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.LBRACKET), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { controller.setSpeed(getNewSpeed(false, controller)); speedText.setText(getSpeedText(controller)); @@ -103,6 +105,7 @@ public abstract class InterpolationControllerBase<C extends InterpolationControl // Add a speed up command _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.RBRACKET), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { controller.setSpeed(getNewSpeed(true, controller)); speedText.setText(getSpeedText(controller)); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/LinearVector3InterpolationControllerExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/LinearVector3InterpolationControllerExample.java index b907305..5c9682e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/LinearVector3InterpolationControllerExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/LinearVector3InterpolationControllerExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/QuaternionInterpolationControllerExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/QuaternionInterpolationControllerExample.java index 68f86cf..18f8ee3 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/QuaternionInterpolationControllerExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/interpolation/QuaternionInterpolationControllerExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationBlinnPhongExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationBlinnPhongExample.java index f6b1889..11401c7 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationBlinnPhongExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationBlinnPhongExample.java @@ -131,6 +131,7 @@ public class AnimationBlinnPhongExample extends ExampleBase { final BasicText t6 = createTextLabel("Text5", "[Y] Enable Light Motion.", 5); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { useDiffuseMap = !useDiffuseMap; gpuShader.setUniform("flags", useNormalMap, useDiffuseMap, useSpecularMap, false); @@ -143,6 +144,7 @@ public class AnimationBlinnPhongExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NUMPADADD), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { if (quantizationFactor > 1) { quantizationFactor /= 2f; @@ -153,6 +155,7 @@ public class AnimationBlinnPhongExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NUMPADSUBTRACT), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { if (quantizationFactor < 512) { quantizationFactor *= 2f; @@ -163,6 +166,7 @@ public class AnimationBlinnPhongExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.Y), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { updateLight = !updateLight; if (updateLight) { @@ -174,6 +178,7 @@ public class AnimationBlinnPhongExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { useSpecularMap = !useSpecularMap; gpuShader.setUniform("flags", useNormalMap, useDiffuseMap, useSpecularMap, false); @@ -186,6 +191,7 @@ public class AnimationBlinnPhongExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { useNormalMap = !useNormalMap; gpuShader.setUniform("flags", useNormalMap, useDiffuseMap, useSpecularMap, false); @@ -198,6 +204,7 @@ public class AnimationBlinnPhongExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.K), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { showSkeleton = !showSkeleton; if (showSkeleton) { @@ -209,6 +216,7 @@ public class AnimationBlinnPhongExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.M), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { showMesh = !showMesh; colladaNode.getSceneHints().setCullHint(showMesh ? CullHint.Dynamic : CullHint.Always); @@ -285,6 +293,7 @@ public class AnimationBlinnPhongExample extends ExampleBase { gpuShader.setUniform("specularMap", 2); colladaNode.acceptVisitor(new Visitor() { + @Override public void visit(final Spatial spatial) { if (spatial instanceof SkinnedMesh) { final SkinnedMesh skinnedMesh = (SkinnedMesh) spatial; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationCopyExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationCopyExample.java index 6ff67d7..055c242 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationCopyExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationCopyExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -166,6 +166,7 @@ public class AnimationCopyExample extends ExampleBase { runWalkButton.addActionListener(new ActionListener() { boolean walk = true; + @Override public void actionPerformed(final ActionEvent event) { if (!walk) { if (manager.getBaseAnimationLayer().doTransition("walk")) { @@ -186,6 +187,7 @@ public class AnimationCopyExample extends ExampleBase { punchButton .setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, runWalkButton, Alignment.BOTTOM_LEFT, 0, -5)); punchButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { manager.findAnimationLayer("punch").setCurrentState("punch_right", true); punchButton.setEnabled(false); @@ -198,6 +200,7 @@ public class AnimationCopyExample extends ExampleBase { headCheck.setSelected(true); headCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { manager.getValuesStore().put("head_blend", headCheck.isSelected() ? 1.0 : 0.0); } @@ -209,6 +212,7 @@ public class AnimationCopyExample extends ExampleBase { .setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, headCheck, Alignment.BOTTOM_LEFT, 0, -5)); gpuSkinningCheck.setSelected(false); gpuSkinningCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { _root.acceptVisitor(new Visitor() { @Override @@ -234,6 +238,7 @@ public class AnimationCopyExample extends ExampleBase { vboCheck.setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, gpuSkinningCheck, Alignment.BOTTOM_LEFT, 0, -5)); vboCheck.setSelected(false); vboCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { skNode.getSceneHints().setDataMode(vboCheck.isSelected() ? DataMode.VBO : DataMode.Arrays); gpuShader.setUseAttributeVBO(vboCheck.isSelected()); @@ -247,6 +252,7 @@ public class AnimationCopyExample extends ExampleBase { skeletonCheck.setSelected(showSkeleton); skeletonCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { showSkeleton = skeletonCheck.isSelected(); boneLabelCheck.setEnabled(showSkeleton); @@ -260,6 +266,7 @@ public class AnimationCopyExample extends ExampleBase { boneLabelCheck.setEnabled(showSkeleton); boneLabelCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { showJointLabels = boneLabelCheck.isSelected(); } @@ -373,6 +380,7 @@ public class AnimationCopyExample extends ExampleBase { // Add a call back to load clips. final InputStore input = new InputStore(); input.getClips().setMissCallback(new MissingCallback<String, AnimationClip>() { + @Override public AnimationClip getValue(final String key) { try { final ColladaStorage storage1 = colladaImporter.load("collada/skeleton/" + key + ".dae"); @@ -404,6 +412,7 @@ public class AnimationCopyExample extends ExampleBase { _root.addController(new SpatialController<Node>() { private final Quaternion headRotation = new Quaternion(); + @Override public void update(final double time, final Node caller) { // update the head's position if (headCheck != null && headCheck.isSelected()) { @@ -425,6 +434,7 @@ public class AnimationCopyExample extends ExampleBase { // add callback for our UI manager.findClipInstance("skeleton.punch").addAnimationListener(new AnimationListener() { + @Override public void animationFinished(final AnimationClipInstance source) { punchButton.setEnabled(true); } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationDemoExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationDemoExample.java index 746f0a1..43bc87c 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationDemoExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationDemoExample.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -11,6 +11,9 @@ package com.ardor3d.example.pipeline; import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Callable; @@ -51,24 +54,22 @@ import com.ardor3d.util.geom.MeshCombiner; import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.ResourceSource; import com.ardor3d.util.resource.URLResourceSource; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; /** * Illustrates loading several animations from Collada and arranging them in an animation state machine. */ @Purpose(htmlDescriptionKey = "com.ardor3d.example.pipeline.AnimationDemoExample", // -thumbnailPath = "com/ardor3d/example/media/thumbnails/pipeline_AnimationDemoExample.jpg", // -maxHeapMemory = 64) + thumbnailPath = "com/ardor3d/example/media/thumbnails/pipeline_AnimationDemoExample.jpg", // + maxHeapMemory = 64) public class AnimationDemoExample extends ExampleBase { private static final long MIN_STATE_TIME = 5000; static AnimationDemoExample instance; - private final List<AnimationManager> managers = Lists.newArrayList(); - private final List<AnimationInfo> animInfo = Lists.newArrayList(); - private final Map<SkeletonPose, SkinnedMesh> poseToMesh = Maps.newIdentityHashMap(); + private final List<AnimationManager> managers = new ArrayList<>(); + private final List<AnimationInfo> animInfo = new ArrayList<>(); + private final Map<SkeletonPose, SkinnedMesh> poseToMesh = new IdentityHashMap<>(); public static void main(final String[] args) { ExampleBase.start(AnimationDemoExample.class); @@ -147,8 +148,7 @@ public class AnimationDemoExample extends ExampleBase { try { gpuShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(AnimationDemoExample.class, "com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.vert")); - gpuShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream( - AnimationDemoExample.class, + gpuShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(AnimationDemoExample.class, "com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.frag")); gpuShader.setUniform("texture", 0); @@ -196,7 +196,7 @@ public class AnimationDemoExample extends ExampleBase { return skeleton; } - private final Map<String, AnimationClip> animationStore = Maps.newHashMap(); + private final Map<String, AnimationClip> animationStore = new HashMap<>(); private AnimationManager createAnimationManager(final SkeletonPose pose) { // Make our manager @@ -209,6 +209,7 @@ public class AnimationDemoExample extends ExampleBase { // Add a call back to load clips. final InputStore input = new InputStore(); input.getClips().setMissCallback(new MissingCallback<String, AnimationClip>() { + @Override public AnimationClip getValue(final String key) { if (!animationStore.containsKey(key)) { try { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationStateExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationStateExample.java index 44b3407..b9120a4 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationStateExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationStateExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -161,6 +161,7 @@ public class AnimationStateExample extends ExampleBase { runWalkButton.addActionListener(new ActionListener() { boolean walk = true; + @Override public void actionPerformed(final ActionEvent event) { if (!walk) { if (manager.getBaseAnimationLayer().doTransition("walk")) { @@ -181,6 +182,7 @@ public class AnimationStateExample extends ExampleBase { punchButton .setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, runWalkButton, Alignment.BOTTOM_LEFT, 0, -5)); punchButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { manager.findAnimationLayer("punch").setCurrentState("punch_right", true); punchButton.setEnabled(false); @@ -192,6 +194,7 @@ public class AnimationStateExample extends ExampleBase { playPauseButton.setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, punchButton, Alignment.BOTTOM_LEFT, 0, -5)); playPauseButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { if (playPauseButton.getText().equals("Pause")) { manager.pause(); @@ -208,6 +211,7 @@ public class AnimationStateExample extends ExampleBase { stopButton .setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, playPauseButton, Alignment.BOTTOM_LEFT, 0, -5)); stopButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { manager.stop(); playPauseButton.setButtonText("Play"); @@ -220,6 +224,7 @@ public class AnimationStateExample extends ExampleBase { .setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, stopButton, Alignment.BOTTOM_LEFT, 0, -5)); resetAnimCheck.setSelected(false); resetAnimCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { manager.setResetClipsOnStop(resetAnimCheck.isSelected()); @@ -232,6 +237,7 @@ public class AnimationStateExample extends ExampleBase { 0, -5)); gpuSkinningCheck.setSelected(false); gpuSkinningCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { _root.acceptVisitor(new Visitor() { @Override @@ -257,6 +263,7 @@ public class AnimationStateExample extends ExampleBase { vboCheck.setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, gpuSkinningCheck, Alignment.BOTTOM_LEFT, 0, -5)); vboCheck.setSelected(false); vboCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { skNode.getSceneHints().setDataMode(vboCheck.isSelected() ? DataMode.VBO : DataMode.Arrays); gpuShader.setUseAttributeVBO(vboCheck.isSelected()); @@ -270,6 +277,7 @@ public class AnimationStateExample extends ExampleBase { skeletonCheck.setSelected(showSkeleton); skeletonCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { showSkeleton = skeletonCheck.isSelected(); boneLabelCheck.setEnabled(showSkeleton); @@ -283,6 +291,7 @@ public class AnimationStateExample extends ExampleBase { boneLabelCheck.setEnabled(showSkeleton); boneLabelCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { showJointLabels = boneLabelCheck.isSelected(); } @@ -396,6 +405,7 @@ public class AnimationStateExample extends ExampleBase { // Add a call back to load clips. final InputStore input = new InputStore(); input.getClips().setMissCallback(new MissingCallback<String, AnimationClip>() { + @Override public AnimationClip getValue(final String key) { try { final ColladaStorage storage1 = colladaImporter.load("collada/skeleton/" + key + ".dae"); @@ -421,6 +431,7 @@ public class AnimationStateExample extends ExampleBase { // add callback for our UI manager.findClipInstance("skeleton.punch").addAnimationListener(new AnimationListener() { + @Override public void animationFinished(final AnimationClipInstance source) { punchButton.setEnabled(true); } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaExample.java index f9c93d2..f769883 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -151,6 +151,7 @@ public class ColladaExample extends ExampleBase { final UIButton loadSceneButton = new UIButton("Load next scene"); loadSceneButton.setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, basePanel, Alignment.TOP_LEFT, 5, -5)); loadSceneButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { final File file = daeFiles.get(fileIndex); try { @@ -169,6 +170,7 @@ public class ColladaExample extends ExampleBase { .setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, loadSceneButton, Alignment.BOTTOM_LEFT, 0, -5)); skinCheck.setSelected(true); skinCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { colladaNode.getSceneHints().setCullHint(skinCheck.isSelected() ? CullHint.Dynamic : CullHint.Always); } @@ -180,6 +182,7 @@ public class ColladaExample extends ExampleBase { skeletonCheck.setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, skinCheck, Alignment.BOTTOM_LEFT, 0, -5)); skeletonCheck.setSelected(showSkeleton); skeletonCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { showSkeleton = skeletonCheck.isSelected(); boneLabelCheck.setEnabled(showSkeleton); @@ -192,6 +195,7 @@ public class ColladaExample extends ExampleBase { boneLabelCheck.setSelected(false); boneLabelCheck.setEnabled(showSkeleton); boneLabelCheck.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { showJointLabels = boneLabelCheck.isSelected(); } @@ -355,7 +359,7 @@ public class ColladaExample extends ExampleBase { private List<File> findFiles(final File rootDir, final String name, List<File> fileList) { if (fileList == null) { - fileList = new ArrayList<File>(); + fileList = new ArrayList<>(); } final File[] files = rootDir.listFiles(); for (int i = 0; i < files.length; i++) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaManualAnimationExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaManualAnimationExample.java index f5008ac..73a93cf 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaManualAnimationExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaManualAnimationExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -232,6 +232,7 @@ public class ColladaManualAnimationExample extends ExampleBase { _root.getSceneHints().setCullHint(CullHint.Never); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.K), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { showSkeleton = !showSkeleton; if (showSkeleton) { @@ -243,6 +244,7 @@ public class ColladaManualAnimationExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.M), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { showMesh = !showMesh; colladaNode.getSceneHints().setCullHint(showMesh ? CullHint.Dynamic : CullHint.Always); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ExportImportExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ExportImportExample.java index 75fc092..c638e69 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ExportImportExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ExportImportExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/FireballTrigger.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/FireballTrigger.java index 42d1411..c783518 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/FireballTrigger.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/FireballTrigger.java @@ -33,6 +33,7 @@ public class FireballTrigger implements TriggerCallback { example = AnimationDemoExample.instance; } + @Override public void doTrigger(final SkeletonPose applyToPose, final AnimationManager manager) { GameTaskQueueManager.getManager(example.getCanvas().getCanvasRenderer().getRenderContext()).update( new Callable<Void>() { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/PrimitiveSkeletonExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/PrimitiveSkeletonExample.java index d17d162..1274866 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/PrimitiveSkeletonExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/PrimitiveSkeletonExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -181,6 +181,7 @@ public class PrimitiveSkeletonExample extends ExampleBase { _root.getSceneHints().setCullHint(CullHint.Never); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.K), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { showSkeleton = !showSkeleton; if (showSkeleton) { @@ -192,6 +193,7 @@ public class PrimitiveSkeletonExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { useGPU = !useGPU; arm1.getGPUShader().setEnabled(useGPU); @@ -207,6 +209,7 @@ public class PrimitiveSkeletonExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { runAnimation = !runAnimation; if (runAnimation) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ScenegraphTree.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ScenegraphTree.java index 38612f2..66cda26 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ScenegraphTree.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ScenegraphTree.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -59,6 +59,7 @@ public class ScenegraphTree { this.textArea = textArea; } + @Override public void valueChanged(final TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() == null || e.getNewLeadSelectionPath().getLastPathComponent() == null) { return; @@ -103,6 +104,7 @@ public class ScenegraphTree { rootNode = node; } + @Override public Object getChild(final Object parent, final int index) { if (parent instanceof Node) { final Node parentNode = (Node) parent; @@ -111,6 +113,7 @@ public class ScenegraphTree { return null; } + @Override public int getChildCount(final Object parent) { if (parent instanceof Node) { final Node parentNode = (Node) parent; @@ -119,6 +122,7 @@ public class ScenegraphTree { return 0; } + @Override public int getIndexOfChild(final Object parent, final Object child) { if (parent instanceof Node && child instanceof Spatial) { final Node parentNode = (Node) parent; @@ -127,18 +131,23 @@ public class ScenegraphTree { return 0; } + @Override public Object getRoot() { return rootNode; } + @Override public boolean isLeaf(final Object node) { return !(node instanceof Node); } + @Override public void addTreeModelListener(final TreeModelListener l) {} + @Override public void removeTreeModelListener(final TreeModelListener l) {} + @Override public void valueForPathChanged(final TreePath path, final Object newValue) {} } } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleColladaExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleColladaExample.java index 49facdd..ed63598 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleColladaExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleColladaExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleMd2Example.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleMd2Example.java index 2a92205..a4bf458 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleMd2Example.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleMd2Example.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleMd3Example.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleMd3Example.java new file mode 100644 index 0000000..b82f23f --- /dev/null +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleMd3Example.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.example.pipeline; + +import com.ardor3d.example.ExampleBase; +import com.ardor3d.example.Purpose; +import com.ardor3d.extension.model.md3.Md3DataStore; +import com.ardor3d.extension.model.md3.Md3Importer; +import com.ardor3d.math.MathUtils; +import com.ardor3d.math.Quaternion; +import com.ardor3d.math.Vector3; +import com.ardor3d.scenegraph.Node; + +/** + * Simplest example of loading a model in MD3 format. FIXME update the thumbnail + */ +@Purpose(htmlDescriptionKey = "com.ardor3d.example.pipeline.SimpleMd3Example", // +thumbnailPath = "com/ardor3d/example/media/thumbnails/pipeline_SimpleMd2Example.jpg", // +maxHeapMemory = 64) +public class SimpleMd3Example extends ExampleBase { + public static void main(final String[] args) { + ExampleBase.start(SimpleMd3Example.class); + } + + @Override + protected void initExample() { + _canvas.setTitle("Ardor3D - Simple Md3 Example"); + _canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 5, 20)); + + // Load the scene + final long time = System.currentTimeMillis(); + final Md3Importer importer = new Md3Importer(); + // try { + // importer.setTextureLocator(new MultiFormatResourceLocator(ResourceLocatorTool.getClassPathResource( + // SimpleObjExample.class, "com/ardor3d/example/media/models/md2/"), ".dds", ".jpg", ".png", ".tga", + // ".pcx")); + // } catch (final URISyntaxException ex) { + // ex.printStackTrace(); + // } + + final Md3DataStore storage = importer.load("md3/barrel1.md3"); + System.out.println("Importing Took " + (System.currentTimeMillis() - time) + " ms"); + + final Node model = storage.getScene(); + // md2 models are usually z-up - switch to y-up + model.setRotation(new Quaternion().fromAngleAxis(-MathUtils.HALF_PI, Vector3.UNIT_X)); + // attack to root + _root.attachChild(model); + + // speed us up a little + // final KeyframeController<Mesh> controller = storage.getController(); + // controller.setSpeed(8); + // controller.setRepeatType(RepeatType.WRAP); + } +} diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleObjExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleObjExample.java index 19bbe1b..09ebac6 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleObjExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleObjExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimplePlyExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimplePlyExample.java new file mode 100644 index 0000000..e038f69 --- /dev/null +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimplePlyExample.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.example.pipeline; + +import java.net.URISyntaxException; + +import com.ardor3d.example.ExampleBase; +import com.ardor3d.example.Purpose; +import com.ardor3d.extension.model.ply.PlyGeometryStore; +import com.ardor3d.extension.model.ply.PlyImporter; +import com.ardor3d.math.MathUtils; +import com.ardor3d.math.Quaternion; +import com.ardor3d.math.Vector3; +import com.ardor3d.scenegraph.Node; +import com.ardor3d.util.resource.ResourceLocatorTool; +import com.ardor3d.util.resource.SimpleResourceLocator; + +/** + * Simplest example of loading a PLY model. + */ +@Purpose(htmlDescriptionKey = "com.ardor3d.example.pipeline.SimplePlyExample", // + thumbnailPath = "com/ardor3d/example/media/thumbnails/pipeline_SimplePlyExample.jpg", // + maxHeapMemory = 64) +public class SimplePlyExample extends ExampleBase { + public static void main(final String[] args) { + ExampleBase.start(SimplePlyExample.class); + } + + @Override + protected void initExample() { + _canvas.setTitle("Ardor3D - Simple Ply Example"); + _canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(3.5, 1.5, 5)); + + // Load the PLY scene + final long time = System.currentTimeMillis(); + final PlyImporter importer = new PlyImporter(); + try { + importer.setTextureLocator(new SimpleResourceLocator(ResourceLocatorTool + .getClassPathResource(SimpleObjExample.class, "com/ardor3d/example/media/models/ply/"))); + } catch (final URISyntaxException ex) { + ex.printStackTrace(); + } + final PlyGeometryStore storage = importer.load("ply/big_spider.ply"); + System.out.println("Importing Took " + (System.currentTimeMillis() - time) + " ms"); + + final Node model = storage.getScene(); + // the ply model is usually z-up - switch to y-up + model.setRotation(new Quaternion().fromAngleAxis(-MathUtils.HALF_PI, Vector3.UNIT_X)); + _root.attachChild(model); + } +} diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleStlExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleStlExample.java new file mode 100644 index 0000000..0631511 --- /dev/null +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/SimpleStlExample.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.example.pipeline; + +import com.ardor3d.example.ExampleBase; +import com.ardor3d.example.Purpose; +import com.ardor3d.extension.model.stl.StlGeometryStore; +import com.ardor3d.extension.model.stl.StlImporter; +import com.ardor3d.math.Vector3; + +/** + * Simplest example of loading a STL model. + */ +@Purpose(htmlDescriptionKey = "com.ardor3d.example.pipeline.SimpleStlExample", // + thumbnailPath = "com/ardor3d/example/media/thumbnails/pipeline_SimpleStlExample.jpg", // + maxHeapMemory = 64) +public class SimpleStlExample extends ExampleBase { + public static void main(final String[] args) { + ExampleBase.start(SimpleStlExample.class); + } + + @Override + protected void initExample() { + _canvas.setTitle("Ardor3D - Simple Stl Example"); + _canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 0, 70)); + + // Load the STL scene + final long time = System.currentTimeMillis(); + final StlImporter importer = new StlImporter(); + final StlGeometryStore storage = importer.load("stl/space_invader_magnet.stl"); + System.out.println("Importing Took " + (System.currentTimeMillis() - time) + " ms"); + + _root.attachChild(storage.getScene()); + } +}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/BillboardNodeExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/BillboardNodeExample.java index cba3651..8e4cdc5 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/BillboardNodeExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/BillboardNodeExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -111,6 +111,7 @@ public class BillboardNodeExample extends ExampleBase { } _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { int ordinal = billboards[0].getAlignment().ordinal() + 1; if (ordinal > BillboardAlignment.values().length - 1) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ClipStateExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ClipStateExample.java index 511c0d4..d08f9c4 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ClipStateExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ClipStateExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/CombinerExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/CombinerExample.java index 0fd57d4..63828ff 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/CombinerExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/CombinerExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DegenerateTrianglesExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DegenerateTrianglesExample.java index c9a859d..9884bd5 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DegenerateTrianglesExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DegenerateTrianglesExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -105,6 +105,7 @@ public class DegenerateTrianglesExample extends ExampleBase { degenerateStripMesh.getSceneHints().setCullHint(CullHint.Always); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { showDegenerateMesh = !showDegenerateMesh; if (showDegenerateMesh) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DisplayListDelegateExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DisplayListDelegateExample.java index 2370a0f..a44fe78 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DisplayListDelegateExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DisplayListDelegateExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -153,6 +153,7 @@ public class DisplayListDelegateExample extends ExampleBase { updateText(); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { showingCompiled = !showingCompiled; if (showingCompiled) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DisplayListExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DisplayListExample.java index 14ee582..61a3984 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DisplayListExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/DisplayListExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -164,6 +164,7 @@ public class DisplayListExample extends ExampleBase { _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { private boolean useDL = true; + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { useDL = !useDL; if (useDL) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GLSLRibbonExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GLSLRibbonExample.java index 7090dbc..62d3e7e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GLSLRibbonExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GLSLRibbonExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GeneratedTexturesExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GeneratedTexturesExample.java index 4fdc002..0cb1dce 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GeneratedTexturesExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GeneratedTexturesExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -254,6 +254,7 @@ public class GeneratedTexturesExample extends ExampleBase { float ratio = zoom ? 0 : 1; float zSpeed = 1; + @Override public void update(final double time, final UIPanel caller) { // update ratio ratio += (zoom ? 1 : -1) * zSpeed * time; @@ -287,6 +288,7 @@ public class GeneratedTexturesExample extends ExampleBase { super.registerInputTriggers(); _logicalLayer.registerTrigger(new InputTrigger(TriggerConditions.mouseMoved(), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { if (!allowClicks || !zoom) { return; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GeometryInstancingExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GeometryInstancingExample.java index 52bac15..79557c5 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GeometryInstancingExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/GeometryInstancingExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -138,6 +138,7 @@ public class GeometryInstancingExample extends ExampleBase { generateSpheres(unInstancedBase, false, nrOfObjects); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.V), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { vboMode = (vboMode + 1) % 3; if (vboMode == 0) { @@ -146,6 +147,7 @@ public class GeometryInstancingExample extends ExampleBase { // run this in the opengl thread GameTaskQueueManager.getManager(_canvas.getCanvasRenderer().getRenderContext()).render( new Callable<Void>() { + @Override public Void call() throws Exception { final DeleteVBOsVisitor viz = new DeleteVBOsVisitor(_canvas.getCanvasRenderer() .getRenderer()); @@ -165,6 +167,7 @@ public class GeometryInstancingExample extends ExampleBase { _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.I), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { instancingEnabled = !instancingEnabled; if (instancingEnabled) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MandelbrotExplorerExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MandelbrotExplorerExample.java index d9d82c5..a65989e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MandelbrotExplorerExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MandelbrotExplorerExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -97,6 +97,7 @@ public class MandelbrotExplorerExample extends ExampleBase { super.registerInputTriggers(); _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonReleasedCondition(MouseButton.LEFT), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { // zoom in final MouseState mouse = inputState.getCurrent().getMouseState(); @@ -112,6 +113,7 @@ public class MandelbrotExplorerExample extends ExampleBase { })); _logicalLayer.registerTrigger(new InputTrigger(new MouseButtonReleasedCondition(MouseButton.RIGHT), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputState, final double tpf) { // zoom out final MouseState mouse = inputState.getCurrent().getMouseState(); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ManyLightsExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ManyLightsExample.java index b8d2a1c..c2b9f12 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ManyLightsExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ManyLightsExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -81,6 +81,7 @@ public class ManyLightsExample extends ExampleBase { double timeZ = rand.nextDouble() * Math.PI * 8; double speed = MathUtils.nextRandomDouble(); + @Override public void update(final double tpf, final Spatial caller) { timeX += tpf * speed; timeY += tpf * speed; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MaterialFaceExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MaterialFaceExample.java index eb84ced..716a405 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MaterialFaceExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MaterialFaceExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MeshDataSharingExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MeshDataSharingExample.java index 036632f..fc76a69 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MeshDataSharingExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MeshDataSharingExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MultiPassTextureExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MultiPassTextureExample.java index a5740ae..1407cb2 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MultiPassTextureExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MultiPassTextureExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MultiStripExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MultiStripExample.java index c5e1483..273c64f 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MultiStripExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/MultiStripExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/PointCubeExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/PointCubeExample.java index c73fa30..cb19159 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/PointCubeExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/PointCubeExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -226,21 +226,25 @@ public class PointCubeExample extends ExampleBase { super.registerInputTriggers(); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() { + @Override public void perform(final Canvas canvas, final TwoInputStates inputState, final double tpf) { _rotationEnabled = !_rotationEnabled; } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() { + @Override public void perform(final Canvas canvas, final TwoInputStates inputState, final double tpf) { _waveEnabled = !_waveEnabled; } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() { + @Override public void perform(final Canvas canvas, final TwoInputStates inputState, final double tpf) { _blurEnabled = !_blurEnabled; } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() { + @Override public void perform(final Canvas canvas, final TwoInputStates inputState, final double tpf) { _scaleEnabled = !_scaleEnabled; } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/PointsExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/PointsExample.java index 5b11bef..6c01d2e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/PointsExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/PointsExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderEffectsExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderEffectsExample.java index b38dd01..b979a7a 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderEffectsExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderEffectsExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -73,6 +73,7 @@ public class RenderEffectsExample extends ExampleBase { private final Matrix3 _rotate = new Matrix3(); private double _angle = 0; + @Override public void update(final double time, final Spatial caller) { // update our rotation _angle = _angle + (_timer.getTimePerFrame() * 25); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderQueueExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderQueueExample.java index 08483f8..5a9827c 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderQueueExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderQueueExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.renderer;
import com.ardor3d.bounding.BoundingBox;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture.MinificationFilter;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Vector2;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.BlendState;
import com.ardor3d.renderer.state.BlendState.DestinationFunction;
import com.ardor3d.renderer.state.BlendState.SourceFunction;
import com.ardor3d.renderer.state.LightState;
import com.ardor3d.renderer.state.MaterialState;
import com.ardor3d.renderer.state.MaterialState.MaterialFace;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.renderer.state.ZBufferState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.hint.TransparencyType;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Torus;
import com.ardor3d.util.TextureManager;
/**
* Illustrates the Render Queue, which controls how Nodes are drawn when overlapping occurs.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.renderer.RenderQueueExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/renderer_RenderQueueExample.jpg", //
maxHeapMemory = 64)
public class RenderQueueExample extends ExampleBase {
private boolean useQueue = false;
private boolean twoPass = false;
protected Node opaques, transps, orthos;
private boolean _updateTitle;
public static void main(final String[] args) {
start(RenderQueueExample.class);
}
@Override
protected void renderExample(final Renderer renderer) {
transps.getSceneHints().setTransparencyType(twoPass ? TransparencyType.TwoPass : TransparencyType.OnePass);
if (_updateTitle) {
_canvas.setTitle("Test Render Queue - " + useQueue + " - hit 'M' to toggle Queue mode - 'R' Two Pass: - "
+ twoPass);
_updateTitle = false;
}
if (!useQueue) {
renderer.setOrtho();
renderer.draw(orthos);
renderer.unsetOrtho();
} else {
renderer.draw(orthos);
}
transps.draw(renderer);
opaques.draw(renderer);
}
@Override
protected void initExample() {
_canvas.setTitle("Test Render Queue - false - hit 'M' to toggle Queue mode - 'R' Two Pass: - false");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(10, 0, 50));
final Vector3 max = new Vector3(5, 5, 5);
final Vector3 min = new Vector3(-5, -5, -5);
opaques = new Node("Opaques");
transps = new Node("Transps");
orthos = new Node("Orthos");
transps.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
opaques.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
orthos.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
_root.attachChild(orthos);
_root.attachChild(transps);
_root.attachChild(opaques);
final Box b1 = new Box("Box", min, max);
b1.setModelBound(new BoundingBox());
b1.setTranslation(new Vector3(0, 0, -15));
opaques.attachChild(b1);
final Box b2 = new Box("Box", min, max);
b2.setModelBound(new BoundingBox());
b2.setTranslation(new Vector3(0, 0, -30));
opaques.attachChild(b2);
final Box b3 = new Box("Box", min, max);
b3.setModelBound(new BoundingBox());
b3.setTranslation(new Vector3(0, -15, -15));
opaques.attachChild(b3);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", MinificationFilter.Trilinear, true));
opaques.setRenderState(ts);
final LightState ls = new LightState();
ls.setEnabled(true);
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setDiffuse(new ColorRGBA(1, 1, 1, 1));
dLight.setDirection(new Vector3(1, 1, 1));
ls.attach(dLight);
final DirectionalLight dLight2 = new DirectionalLight();
dLight2.setEnabled(true);
dLight2.setDiffuse(new ColorRGBA(1, 1, 1, 1));
dLight2.setDirection(new Vector3(-1, -1, -1));
ls.attach(dLight2);
ls.setTwoSidedLighting(false);
transps.setRenderState(ls);
transps.getSceneHints().setLightCombineMode(LightCombineMode.Replace);
final Box tb1 = new Box("TBox Blue", min, max);
tb1.setModelBound(new BoundingBox());
tb1.setTranslation(new Vector3(0, 15, 15));
transps.attachChild(tb1);
final MaterialState ms1 = new MaterialState();
ms1.setEnabled(true);
ms1.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(0, 0, 1, .75f));
ms1.setShininess(MaterialFace.FrontAndBack, 128);
tb1.setRenderState(ms1);
final Torus tb2 = new Torus("TBox Green", 20, 20, 3, 6);
tb2.setModelBound(new BoundingBox());
tb2.setTranslation(new Vector3(0, 0, 30));
transps.attachChild(tb2);
final MaterialState ms2 = new MaterialState();
ms2.setEnabled(true);
ms2.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(0, 1, 0, .5f));
ms2.setShininess(MaterialFace.FrontAndBack, 128);
tb2.setRenderState(ms2);
final Box tb3 = new Box("TBox Red", min, max);
tb3.setModelBound(new BoundingBox());
tb3.setTranslation(new Vector3(0, 0, 15));
transps.attachChild(tb3);
final MaterialState ms3 = new MaterialState();
ms3.setEnabled(true);
ms3.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(1, 0, 0, .5f));
ms3.setShininess(MaterialFace.FrontAndBack, 128);
tb3.setRenderState(ms3);
final BlendState as = new BlendState();
as.setEnabled(true);
as.setBlendEnabled(true);
as.setSourceFunction(SourceFunction.SourceAlpha);
as.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha);
transps.setRenderState(as);
final Vector2 center = new Vector2(_canvas.getCanvasRenderer().getCamera().getWidth() >> 1, _canvas
.getCanvasRenderer().getCamera().getWidth() >> 1);
final Quad q1 = new Quad("Ortho Q1", 40, 40);
q1.setTranslation(new Vector3(100 + center.getX(), 100 + center.getY(), 0));
q1.getSceneHints().setOrthoOrder(1);
q1.setDefaultColor(ColorRGBA.WHITE);
q1.getSceneHints().setLightCombineMode(LightCombineMode.Off);
orthos.attachChild(q1);
final Quad q2 = new Quad("Ortho Q2", 100, 100);
q2.setTranslation(new Vector3(60 + center.getX(), 60 + center.getY(), 0));
q2.getSceneHints().setOrthoOrder(5);
q2.setDefaultColor(ColorRGBA.RED);
q2.getSceneHints().setLightCombineMode(LightCombineMode.Off);
orthos.attachChild(q2);
final Quad q3 = new Quad("Ortho Q3", 120, 60);
q3.setTranslation(new Vector3(-20 + center.getX(), -150 + center.getY(), 0));
q3.getSceneHints().setOrthoOrder(2);
q3.setDefaultColor(ColorRGBA.BLUE);
q3.getSceneHints().setLightCombineMode(LightCombineMode.Off);
orthos.attachChild(q3);
final ZBufferState zstate = new ZBufferState();
zstate.setWritable(false);
zstate.setEnabled(false);
orthos.setRenderState(zstate);
orthos.setRenderState(new LightState());
_root.getSceneHints().setCullHint(CullHint.Always);
opaques.getSceneHints().setCullHint(CullHint.Dynamic);
transps.getSceneHints().setCullHint(CullHint.Dynamic);
orthos.getSceneHints().setCullHint(CullHint.Never);
}
@Override
protected void registerInputTriggers() {
super.registerInputTriggers();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.M), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (useQueue) {
transps.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
opaques.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
orthos.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
} else {
transps.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
opaques.getSceneHints().setRenderBucketType(RenderBucketType.Opaque);
orthos.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
}
useQueue = !useQueue;
_updateTitle = true;
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
twoPass = !twoPass;
_updateTitle = true;
}
}));
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.renderer;
import com.ardor3d.bounding.BoundingBox;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture.MinificationFilter;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Vector2;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.BlendState;
import com.ardor3d.renderer.state.BlendState.DestinationFunction;
import com.ardor3d.renderer.state.BlendState.SourceFunction;
import com.ardor3d.renderer.state.LightState;
import com.ardor3d.renderer.state.MaterialState;
import com.ardor3d.renderer.state.MaterialState.MaterialFace;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.renderer.state.ZBufferState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.hint.TransparencyType;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Torus;
import com.ardor3d.util.TextureManager;
/**
* Illustrates the Render Queue, which controls how Nodes are drawn when overlapping occurs.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.renderer.RenderQueueExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/renderer_RenderQueueExample.jpg", //
maxHeapMemory = 64)
public class RenderQueueExample extends ExampleBase {
private boolean useQueue = false;
private boolean twoPass = false;
protected Node opaques, transps, orthos;
private boolean _updateTitle;
public static void main(final String[] args) {
start(RenderQueueExample.class);
}
@Override
protected void renderExample(final Renderer renderer) {
transps.getSceneHints().setTransparencyType(twoPass ? TransparencyType.TwoPass : TransparencyType.OnePass);
if (_updateTitle) {
_canvas.setTitle("Test Render Queue - " + useQueue + " - hit 'M' to toggle Queue mode - 'R' Two Pass: - "
+ twoPass);
_updateTitle = false;
}
if (!useQueue) {
renderer.setOrtho();
renderer.draw(orthos);
renderer.unsetOrtho();
} else {
renderer.draw(orthos);
}
transps.draw(renderer);
opaques.draw(renderer);
}
@Override
protected void initExample() {
_canvas.setTitle("Test Render Queue - false - hit 'M' to toggle Queue mode - 'R' Two Pass: - false");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(10, 0, 50));
final Vector3 max = new Vector3(5, 5, 5);
final Vector3 min = new Vector3(-5, -5, -5);
opaques = new Node("Opaques");
transps = new Node("Transps");
orthos = new Node("Orthos");
transps.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
opaques.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
orthos.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
_root.attachChild(orthos);
_root.attachChild(transps);
_root.attachChild(opaques);
final Box b1 = new Box("Box", min, max);
b1.setModelBound(new BoundingBox());
b1.setTranslation(new Vector3(0, 0, -15));
opaques.attachChild(b1);
final Box b2 = new Box("Box", min, max);
b2.setModelBound(new BoundingBox());
b2.setTranslation(new Vector3(0, 0, -30));
opaques.attachChild(b2);
final Box b3 = new Box("Box", min, max);
b3.setModelBound(new BoundingBox());
b3.setTranslation(new Vector3(0, -15, -15));
opaques.attachChild(b3);
final TextureState ts = new TextureState();
ts.setEnabled(true);
ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", MinificationFilter.Trilinear, true));
opaques.setRenderState(ts);
final LightState ls = new LightState();
ls.setEnabled(true);
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setDiffuse(new ColorRGBA(1, 1, 1, 1));
dLight.setDirection(new Vector3(1, 1, 1));
ls.attach(dLight);
final DirectionalLight dLight2 = new DirectionalLight();
dLight2.setEnabled(true);
dLight2.setDiffuse(new ColorRGBA(1, 1, 1, 1));
dLight2.setDirection(new Vector3(-1, -1, -1));
ls.attach(dLight2);
ls.setTwoSidedLighting(false);
transps.setRenderState(ls);
transps.getSceneHints().setLightCombineMode(LightCombineMode.Replace);
final Box tb1 = new Box("TBox Blue", min, max);
tb1.setModelBound(new BoundingBox());
tb1.setTranslation(new Vector3(0, 15, 15));
transps.attachChild(tb1);
final MaterialState ms1 = new MaterialState();
ms1.setEnabled(true);
ms1.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(0, 0, 1, .75f));
ms1.setShininess(MaterialFace.FrontAndBack, 128);
tb1.setRenderState(ms1);
final Torus tb2 = new Torus("TBox Green", 20, 20, 3, 6);
tb2.setModelBound(new BoundingBox());
tb2.setTranslation(new Vector3(0, 0, 30));
transps.attachChild(tb2);
final MaterialState ms2 = new MaterialState();
ms2.setEnabled(true);
ms2.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(0, 1, 0, .5f));
ms2.setShininess(MaterialFace.FrontAndBack, 128);
tb2.setRenderState(ms2);
final Box tb3 = new Box("TBox Red", min, max);
tb3.setModelBound(new BoundingBox());
tb3.setTranslation(new Vector3(0, 0, 15));
transps.attachChild(tb3);
final MaterialState ms3 = new MaterialState();
ms3.setEnabled(true);
ms3.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(1, 0, 0, .5f));
ms3.setShininess(MaterialFace.FrontAndBack, 128);
tb3.setRenderState(ms3);
final BlendState as = new BlendState();
as.setEnabled(true);
as.setBlendEnabled(true);
as.setSourceFunction(SourceFunction.SourceAlpha);
as.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha);
transps.setRenderState(as);
final Vector2 center = new Vector2(_canvas.getCanvasRenderer().getCamera().getWidth() >> 1, _canvas
.getCanvasRenderer().getCamera().getWidth() >> 1);
final Quad q1 = new Quad("Ortho Q1", 40, 40);
q1.setTranslation(new Vector3(100 + center.getX(), 100 + center.getY(), 0));
q1.getSceneHints().setOrthoOrder(1);
q1.setDefaultColor(ColorRGBA.WHITE);
q1.getSceneHints().setLightCombineMode(LightCombineMode.Off);
orthos.attachChild(q1);
final Quad q2 = new Quad("Ortho Q2", 100, 100);
q2.setTranslation(new Vector3(60 + center.getX(), 60 + center.getY(), 0));
q2.getSceneHints().setOrthoOrder(5);
q2.setDefaultColor(ColorRGBA.RED);
q2.getSceneHints().setLightCombineMode(LightCombineMode.Off);
orthos.attachChild(q2);
final Quad q3 = new Quad("Ortho Q3", 120, 60);
q3.setTranslation(new Vector3(-20 + center.getX(), -150 + center.getY(), 0));
q3.getSceneHints().setOrthoOrder(2);
q3.setDefaultColor(ColorRGBA.BLUE);
q3.getSceneHints().setLightCombineMode(LightCombineMode.Off);
orthos.attachChild(q3);
final ZBufferState zstate = new ZBufferState();
zstate.setWritable(false);
zstate.setEnabled(false);
orthos.setRenderState(zstate);
orthos.setRenderState(new LightState());
_root.getSceneHints().setCullHint(CullHint.Always);
opaques.getSceneHints().setCullHint(CullHint.Dynamic);
transps.getSceneHints().setCullHint(CullHint.Dynamic);
orthos.getSceneHints().setCullHint(CullHint.Never);
}
@Override
protected void registerInputTriggers() {
super.registerInputTriggers();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.M), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (useQueue) {
transps.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
opaques.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
orthos.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
} else {
transps.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
opaques.getSceneHints().setRenderBucketType(RenderBucketType.Opaque);
orthos.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
}
useQueue = !useQueue;
_updateTitle = true;
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
twoPass = !twoPass;
_updateTitle = true;
}
}));
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderTextureCubeMapExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderTextureCubeMapExample.java index d515ed9..680aa38 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderTextureCubeMapExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderTextureCubeMapExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -106,6 +106,7 @@ public class RenderTextureCubeMapExample extends ExampleBase { final Pyramid b = new Pyramid("box", 2, 3); b.setRotation(new Quaternion().fromAngleNormalAxis(MathUtils.PI, Vector3.UNIT_X)); b.addController(new SpatialController<Spatial>() { + @Override public void update(final double time, final Spatial caller) { b.setTranslation(-3, 6 * MathUtils.sin(_timer.getTimeInSeconds()), 0); }; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderTextureSideBySideExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderTextureSideBySideExample.java index 32bbe37..8e62ff1 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderTextureSideBySideExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/RenderTextureSideBySideExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/SphereComparisonsExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/SphereComparisonsExample.java index dd6bd63..120286b 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/SphereComparisonsExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/SphereComparisonsExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/StereoExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/StereoExample.java index 7c5905d..08b53f2 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/StereoExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/StereoExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -115,6 +115,7 @@ public class StereoExample extends ExampleBase { _root.setTranslation(0, -1, 0); } + @SuppressWarnings("unused") @Override protected void renderExample(final Renderer renderer) { @@ -168,6 +169,6 @@ public class StereoExample extends ExampleBase { @Override protected void renderDebug(final Renderer renderer) { - // ignore. We'll call super on the individual left/right renderings. + // ignore. We'll call super on the individual left/right renderings. } } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/TexCombineExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/TexCombineExample.java index 675b32d..8be916e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/TexCombineExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/TexCombineExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/Texture3DExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/Texture3DExample.java index 9884266..e0745f7 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/Texture3DExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/Texture3DExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.example.renderer; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.List; import com.ardor3d.example.ExampleBase; @@ -31,7 +32,6 @@ import com.ardor3d.math.ColorRGBA; import com.ardor3d.renderer.state.TextureState; import com.ardor3d.scenegraph.shape.Sphere; import com.ardor3d.util.TextureKey; -import com.google.common.collect.Lists; /** * Very simple example showing use of a Texture3D texture. @@ -59,6 +59,7 @@ public class Texture3DExample extends ExampleBase { _root.attachChild(sp); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final Texture tex = createTexture(); tex.setEnvironmentalMapMode(EnvironmentalMapMode.ObjectLinear); @@ -77,7 +78,7 @@ public class Texture3DExample extends ExampleBase { img.setHeight(32); img.setDepth(32); - final List<ByteBuffer> data = Lists.newArrayList(); + final List<ByteBuffer> data = new ArrayList<>(); for (int i = 0; i < 32; i++) { final Image colorImage = GeneratedImageFactory .createSolidColorImage(ColorRGBA.randomColor(null), false, 32); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/TextureProjectionExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/TextureProjectionExample.java index 8c0fd39..a990a19 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/TextureProjectionExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/TextureProjectionExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/UpdateTextureExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/UpdateTextureExample.java index c4b5ae3..33e55aa 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/UpdateTextureExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/UpdateTextureExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -147,6 +147,7 @@ public class UpdateTextureExample extends ExampleBase { _root.attachChild(keyText); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { mode++; mode %= 3; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/VBOSpeedExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/VBOSpeedExample.java index c82a548..4406db2 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/VBOSpeedExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/VBOSpeedExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -115,6 +115,7 @@ public class VBOSpeedExample extends ExampleBase { } _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { vboMode = (vboMode + 1) % 3; if (vboMode == 0) { @@ -123,6 +124,7 @@ public class VBOSpeedExample extends ExampleBase { // run this in the opengl thread GameTaskQueueManager.getManager(_canvas.getCanvasRenderer().getRenderContext()).render( new Callable<Void>() { + @Override public Void call() throws Exception { final DeleteVBOsVisitor viz = new DeleteVBOsVisitor(_canvas.getCanvasRenderer() .getRenderer()); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ViewportExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ViewportExample.java index 1d827da..6b32e4c 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ViewportExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/ViewportExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -120,6 +120,7 @@ public class ViewportExample extends ExampleBase { super.registerInputTriggers(); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.V), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { fullViewport = !fullViewport; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/WireframeGeometryShaderExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/WireframeGeometryShaderExample.java index bbee1e9..66cb5b1 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/WireframeGeometryShaderExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/WireframeGeometryShaderExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExample.java index ce1c13e..f2eb734 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExample.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -13,6 +13,7 @@ package com.ardor3d.example.renderer.utils.atlas; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import javax.imageio.ImageIO; @@ -48,13 +49,12 @@ import com.ardor3d.ui.text.BasicText; import com.ardor3d.util.ReadOnlyTimer; import com.ardor3d.util.TextureManager; import com.ardor3d.util.geom.MeshCombiner; -import com.google.common.collect.Lists; /** * Example showing how to use the TexturePacker to create a texture atlas. Also shows the benefits of using it together * with the MeshCombiner. */ -@Purpose(htmlDescriptionKey = "com.ardor3d.example.basic.AtlasExample", // +@Purpose(htmlDescriptionKey = "com.ardor3d.example.renderer.utils.atlas.AtlasExample", // thumbnailPath = "com/ardor3d/example/media/thumbnails/basic_BoxExample.jpg", // maxHeapMemory = 64) public class AtlasExample extends ExampleBase { @@ -111,6 +111,7 @@ public class AtlasExample extends ExampleBase { // Pack textures into atlas _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { packIntoAtlas(boxNode); } @@ -118,6 +119,7 @@ public class AtlasExample extends ExampleBase { // Combine into one mesh _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final Mesh merged = MeshCombiner.combine(boxNode); boxNode.detachAllChildren(); @@ -127,6 +129,7 @@ public class AtlasExample extends ExampleBase { // Combine into one mesh _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { resetBoxes(); } @@ -155,7 +158,7 @@ public class AtlasExample extends ExampleBase { private void packIntoAtlas(final Spatial spatial) { // Gather up all meshes to do the atlas operation on - final List<Mesh> meshes = Lists.newArrayList(); + final List<Mesh> meshes = new ArrayList<>(); final Visitor visitor = new Visitor() { @Override public void visit(final Spatial spatial) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExampleMultiTextured.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExampleMultiTextured.java index e8e4921..5338aef 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExampleMultiTextured.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExampleMultiTextured.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -13,6 +13,7 @@ package com.ardor3d.example.renderer.utils.atlas; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import javax.imageio.ImageIO; @@ -49,13 +50,12 @@ import com.ardor3d.ui.text.BasicText; import com.ardor3d.util.ReadOnlyTimer; import com.ardor3d.util.TextureManager; import com.ardor3d.util.geom.MeshCombiner; -import com.google.common.collect.Lists; /** * Example showing how to use the TexturePacker to create a texture atlas. Also shows the benefits of using it together * with the MeshCombiner. */ -@Purpose(htmlDescriptionKey = "com.ardor3d.example.basic.AtlasExampleMultiTextured", // +@Purpose(htmlDescriptionKey = "com.ardor3d.example.renderer.utils.atlas.AtlasExampleMultiTextured", // thumbnailPath = "com/ardor3d/example/media/thumbnails/basic_BoxExample.jpg", // maxHeapMemory = 64) public class AtlasExampleMultiTextured extends ExampleBase { @@ -112,6 +112,7 @@ public class AtlasExampleMultiTextured extends ExampleBase { // Pack textures into atlas _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { packIntoAtlas(boxNode); } @@ -119,6 +120,7 @@ public class AtlasExampleMultiTextured extends ExampleBase { // Combine into one mesh _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final Mesh merged = MeshCombiner.combine(boxNode); boxNode.detachAllChildren(); @@ -128,6 +130,7 @@ public class AtlasExampleMultiTextured extends ExampleBase { // Combine into one mesh _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { resetBoxes(); } @@ -156,7 +159,7 @@ public class AtlasExampleMultiTextured extends ExampleBase { private void packIntoAtlas(final Spatial spatial) { // Gather up all meshes to do the atlas operation on - final List<Mesh> meshes = Lists.newArrayList(); + final List<Mesh> meshes = new ArrayList<>(); final Visitor visitor = new Visitor() { @Override public void visit(final Spatial spatial) { diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/TestAtlasPacker.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/TestAtlasPacker.java index 06db12a..2df7c4e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/TestAtlasPacker.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/TestAtlasPacker.java @@ -15,7 +15,6 @@ import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; -import com.ardor3d.extension.atlas.AtlasNode; import com.ardor3d.extension.atlas.AtlasPacker; /** @@ -30,7 +29,7 @@ public class TestAtlasPacker { final Random rand = new Random(); for (int i = 0; i < 2000; i++) { - final AtlasNode node = packer.insert(rand.nextInt(100) + 10, rand.nextInt(100) + 10); + /* final AtlasNode node = */packer.insert(rand.nextInt(100) + 10, rand.nextInt(100) + 10); } final JFrame frame = new JFrame("Pack"); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ArrayTerrainExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ArrayTerrainExample.java index bdebb18..0c7bc5b 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ArrayTerrainExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ArrayTerrainExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' where the terrain data is provided from a
* float array. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ArrayTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ArrayTerrainExample.jpg", //
maxHeapMemory = 128)
public class ArrayTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Mesh arrow = new Box("normal", new Vector3(-0.2, -0.2, 0), new Vector3(0.2, 0.2, 4));
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
private double counter = 0;
private int frames = 0;
public static void main(final String[] args) {
ExampleBase.start(ArrayTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = frames / counter;
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
final Vector3 intersectionNormal = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionNormal(0);
final Matrix3 rotation = new Matrix3();
rotation.lookAt(intersectionNormal, Vector3.UNIT_Z);
arrow.setRotation(rotation);
arrow.setTranslation(intersectionPoint);
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(200);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
arrow.getSceneHints().setAllPickingHints(false);
arrow.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(arrow);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
final int SIZE = 2048;
final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.6f);
raw.setHeightRange(0.2f);
final float[] heightMap = raw.getHeightData();
final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
1, 300, 1));
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
arrow.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
arrow.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() + 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() - 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' where the terrain data is provided from a
* float array. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ArrayTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ArrayTerrainExample.jpg", //
maxHeapMemory = 128)
public class ArrayTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Mesh arrow = new Box("normal", new Vector3(-0.2, -0.2, 0), new Vector3(0.2, 0.2, 4));
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
private double counter = 0;
private int frames = 0;
public static void main(final String[] args) {
ExampleBase.start(ArrayTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = frames / counter;
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
final Vector3 intersectionNormal = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionNormal(0);
final Matrix3 rotation = new Matrix3();
rotation.lookAt(intersectionNormal, Vector3.UNIT_Z);
arrow.setRotation(rotation);
arrow.setTranslation(intersectionPoint);
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(200);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
arrow.getSceneHints().setAllPickingHints(false);
arrow.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(arrow);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
final int SIZE = 2048;
final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.6f);
raw.setHeightRange(0.2f);
final float[] heightMap = raw.getHeightData();
final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
1, 300, 1));
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
arrow.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
arrow.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() + 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() - 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ImageMapTerrainExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ImageMapTerrainExample.java index 02a004e..4e323ab 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ImageMapTerrainExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ImageMapTerrainExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.awt.image.BufferedImage;
import java.util.concurrent.Callable;
import javax.imageio.ImageIO;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.heightmap.ImageHeightMap;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Image;
import com.ardor3d.image.util.awt.AWTImageLoader;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.resource.ResourceLocatorTool;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' where the terrain data is provided from a
* float array populated from a heightmap generated from an Image. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ImageMapTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ImageMapTerrainExample.jpg", //
maxHeapMemory = 128)
public class ImageMapTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Mesh arrow = new Box("normal", new Vector3(-0.2, -0.2, 0), new Vector3(0.2, 0.2, 4));
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
private double counter = 0;
private int frames = 0;
public static void main(final String[] args) {
ExampleBase.start(ImageMapTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = frames / counter;
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
final Vector3 intersectionNormal = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionNormal(0);
final Matrix3 rotation = new Matrix3();
rotation.lookAt(intersectionNormal, Vector3.UNIT_Z);
arrow.setRotation(rotation);
arrow.setTranslation(intersectionPoint);
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(200);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
arrow.getSceneHints().setAllPickingHints(false);
arrow.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(arrow);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
// IMAGE LOADING AND CONVERSION TO HEIGHTMAP DONE HERE
final BufferedImage logo = ImageIO.read(ResourceLocatorTool.getClassPathResource(
ImageMapTerrainExample.class, "com/ardor3d/example/media/images/water/dudvmap.png"));
final Image ardorImage = AWTImageLoader.makeArdor3dImage(logo, false);
final float[] heightMap = ImageHeightMap.generateHeightMap(ardorImage, 0.1f, .3f);
// END OF IMAGE CONVERSION
final int SIZE = ardorImage.getWidth();
final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
3, 50, 3));
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
arrow.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
arrow.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() + 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() - 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.awt.image.BufferedImage;
import java.util.concurrent.Callable;
import javax.imageio.ImageIO;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.heightmap.ImageHeightMap;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Image;
import com.ardor3d.image.util.awt.AWTImageLoader;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.resource.ResourceLocatorTool;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' where the terrain data is provided from a
* float array populated from a heightmap generated from an Image. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ImageMapTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ImageMapTerrainExample.jpg", //
maxHeapMemory = 128)
public class ImageMapTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Mesh arrow = new Box("normal", new Vector3(-0.2, -0.2, 0), new Vector3(0.2, 0.2, 4));
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
private double counter = 0;
private int frames = 0;
public static void main(final String[] args) {
ExampleBase.start(ImageMapTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = frames / counter;
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
final Vector3 intersectionNormal = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionNormal(0);
final Matrix3 rotation = new Matrix3();
rotation.lookAt(intersectionNormal, Vector3.UNIT_Z);
arrow.setRotation(rotation);
arrow.setTranslation(intersectionPoint);
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(200);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
arrow.getSceneHints().setAllPickingHints(false);
arrow.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(arrow);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
// IMAGE LOADING AND CONVERSION TO HEIGHTMAP DONE HERE
final BufferedImage logo = ImageIO.read(ResourceLocatorTool.getClassPathResource(
ImageMapTerrainExample.class, "com/ardor3d/example/media/images/water/dudvmap.png"));
final Image ardorImage = AWTImageLoader.makeArdor3dImage(logo, false);
final float[] heightMap = ImageHeightMap.generateHeightMap(ardorImage, 0.1f, .3f);
// END OF IMAGE CONVERSION
final int SIZE = ardorImage.getWidth();
final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
3, 50, 3));
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
arrow.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
arrow.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() + 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() - 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/InMemoryTerrainExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/InMemoryTerrainExample.java index 531ffd4..d1de7d6 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/InMemoryTerrainExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/InMemoryTerrainExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.providers.inmemory.InMemoryTerrainDataProvider;
import com.ardor3d.extension.terrain.providers.inmemory.data.InMemoryTerrainData;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' streaming from an in-memory data source.
* Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.InMemoryTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_InMemoryTerrainExample.jpg", //
maxHeapMemory = 128)
public class InMemoryTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
private Skybox skybox;
private InMemoryTerrainData inMemoryTerrainData;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[6];
public static void main(final String[] args) {
ExampleBase.start(InMemoryTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
skybox.setTranslation(camera.getLocation());
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
// XXX: maybe change the color of the ball for valid vs. invalid?
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(200);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
inMemoryTerrainData = new InMemoryTerrainData(2048, 9, 128, new Vector3(1, 200, 1));
final TerrainDataProvider terrainDataProvider = new InMemoryTerrainDataProvider(inMemoryTerrainData, true);
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
skybox = buildSkyBox();
skybox.getSceneHints().setAllPickingHints(false);
_root.attachChild(skybox);
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.V), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (!inMemoryTerrainData.isRunning()) {
inMemoryTerrainData.startUpdates();
} else {
inMemoryTerrainData.stopUpdates();
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() + 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() - 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Builds the sky box.
*/
private Skybox buildSkyBox() {
final Skybox skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
return skybox;
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
_exampleInfo[5].setText("[V] Updating terrain data: " + inMemoryTerrainData.isRunning());
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.providers.inmemory.InMemoryTerrainDataProvider;
import com.ardor3d.extension.terrain.providers.inmemory.data.InMemoryTerrainData;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' streaming from an in-memory data source.
* Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.InMemoryTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_InMemoryTerrainExample.jpg", //
maxHeapMemory = 128)
public class InMemoryTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
private Skybox skybox;
private InMemoryTerrainData inMemoryTerrainData;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[6];
public static void main(final String[] args) {
ExampleBase.start(InMemoryTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
skybox.setTranslation(camera.getLocation());
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
// XXX: maybe change the color of the ball for valid vs. invalid?
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(200);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
inMemoryTerrainData = new InMemoryTerrainData(2048, 9, 128, new Vector3(1, 200, 1));
final TerrainDataProvider terrainDataProvider = new InMemoryTerrainDataProvider(inMemoryTerrainData, true);
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
skybox = buildSkyBox();
skybox.getSceneHints().setAllPickingHints(false);
_root.attachChild(skybox);
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.V), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (!inMemoryTerrainData.isRunning()) {
inMemoryTerrainData.startUpdates();
} else {
inMemoryTerrainData.stopUpdates();
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() + 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() - 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Builds the sky box.
*/
private Skybox buildSkyBox() {
final Skybox skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
return skybox;
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
_exampleInfo[5].setText("[V] Updating terrain data: " + inMemoryTerrainData.isRunning());
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/MountainShadowTerrainExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/MountainShadowTerrainExample.java index d25912d..3f1efd2 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/MountainShadowTerrainExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/MountainShadowTerrainExample.java @@ -1 +1,460 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.EnumSet;
import java.util.concurrent.Callable;
import javax.imageio.ImageIO;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.model.collada.jdom.ColladaImporter;
import com.ardor3d.extension.model.collada.jdom.data.ColladaStorage;
import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass;
import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass.Filter;
import com.ardor3d.extension.shadow.map.ShadowCasterManager;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.UrlInputSupplier;
import com.ardor3d.extension.terrain.heightmap.ImageHeightMap;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.extension.ui.Orientation;
import com.ardor3d.extension.ui.UIButton;
import com.ardor3d.extension.ui.UIFrame;
import com.ardor3d.extension.ui.UIFrame.FrameButtons;
import com.ardor3d.extension.ui.UIHud;
import com.ardor3d.extension.ui.UILabel;
import com.ardor3d.extension.ui.UIPanel;
import com.ardor3d.extension.ui.UISlider;
import com.ardor3d.extension.ui.event.ActionEvent;
import com.ardor3d.extension.ui.event.ActionListener;
import com.ardor3d.extension.ui.layout.RowLayout;
import com.ardor3d.extension.ui.text.StyleConstants;
import com.ardor3d.extension.ui.util.Insets;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Image;
import com.ardor3d.image.Texture;
import com.ardor3d.image.Texture2D;
import com.ardor3d.image.util.awt.AWTImageLoader;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.MathUtils;
import com.ardor3d.math.Quaternion;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.renderer.state.RenderState.StateType;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.renderer.state.ZBufferState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.hint.TextureCombineMode;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.geom.Debugger;
import com.ardor3d.util.resource.ResourceLocatorTool;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' where the terrain data is provided from a
* float array populated from a heightmap generated from an Image. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ImageMapTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ImageMapTerrainExample.jpg", //
maxHeapMemory = 128)
public class MountainShadowTerrainExample extends ExampleBase {
private final float farPlane = 8000.0f;
/** Quads used for debug showing shadowmaps. */
private Quad _orthoQuad[];
private Terrain terrain;
private final Node terrainNode = new Node("terrain");
private boolean groundCamera = false;
private Camera terrainCamera;
/** Text fields used to present info about the example. */
private final UILabel _exampleInfo[] = new UILabel[2];
/** Pssm shadow map pass. */
private ParallelSplitShadowMapPass _pssmPass;
private DirectionalLight light;
private double lightTime;
private boolean moveLight = false;
private UIHud hud;
public static void main(final String[] args) {
ExampleBase._minDepthBits = 24;
ExampleBase.start(MountainShadowTerrainExample.class);
}
@Override
protected void renderExample(final Renderer renderer) {
// Lazy init since it needs the renderer...
if (!_pssmPass.isInitialised()) {
_pssmPass.init(renderer);
_pssmPass.setPssmShader(terrain.getGeometryClipmapShader());
for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) {
terrain.getClipTextureState().setTexture(_pssmPass.getShadowMapTexture(i), i + 1);
}
for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) {
terrain.getGeometryClipmapShader().setUniform("shadowMap" + i, i + 1);
}
}
terrain.getGeometryClipmapShader().setUniform("lightDir", light.getDirection());
for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) {
TextureState screen = (TextureState) _orthoQuad[i].getLocalRenderState(StateType.Texture);
Texture copy;
if (screen == null) {
screen = new TextureState();
_orthoQuad[i].setRenderState(screen);
copy = new Texture2D();
screen.setTexture(copy);
_orthoQuad[i].updateGeometricState(0.0);
} else {
copy = screen.getTexture();
}
copy.setTextureKey(_pssmPass.getShadowMapTexture(i).getTextureKey());
}
// XXX: Use a rougher LOD for shadows - tweak?
terrain.setMinVisibleLevel(4);
// Update shadowmaps - this will update our terrain camera to light pos
_pssmPass.updateShadowMaps(renderer);
// XXX: reset LOD for drawing from view camera
terrain.setMinVisibleLevel(0);
// Render scene and terrain with shadows
terrainNode.onDraw(renderer);
_root.onDraw(renderer);
// Render overlay shadows for all objects except the terrain
renderer.renderBuckets();
_pssmPass.renderShadowedScene(renderer);
renderer.renderBuckets();
// draw ui
renderer.draw(hud);
}
private double counter = 0;
private int frames = 0;
@Override
protected void updateExample(final ReadOnlyTimer timer) {
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = frames / counter;
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
terrainCamera.set(camera);
} else {
terrainCamera.set(_canvas.getCanvasRenderer().getCamera());
}
// move terrain to view pos
terrainNode.updateGeometricState(timer.getTimePerFrame());
hud.updateGeometricState(timer.getTimePerFrame());
if (moveLight) {
lightTime += timer.getTimePerFrame();
light.setDirection(new Vector3(Math.sin(lightTime), -.8, Math.cos(lightTime)).normalizeLocal());
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain Example");
final Camera canvasCamera = _canvas.getCanvasRenderer().getCamera();
canvasCamera.setLocation(new Vector3(2176, 790, 688));
canvasCamera.lookAt(new Vector3(canvasCamera.getLocation()).addLocal(-0.87105768019686, -0.4349655341112313,
0.22817427967541867), Vector3.UNIT_Y);
canvasCamera.setFrustumPerspective(45.0, (float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.BLUE);
return null;
}
});
_controlHandle.setMoveSpeed(400);
setupDefaultStates();
addRover();
addUI();
// Initialize PSSM shadows
_pssmPass = new ParallelSplitShadowMapPass(light, 2048, 4);
_pssmPass.setFiltering(Filter.None);
_pssmPass.setRenderShadowedScene(false);
_pssmPass.setKeepMainShader(true);
// _pssmPass.setMinimumLightDistance(500); // XXX: Tune this
_pssmPass.setUseSceneTexturing(false);
_pssmPass.setUseObjectCullFace(false);
_pssmPass.getShadowOffsetState().setFactor(1.1f);
_pssmPass.getShadowOffsetState().setUnits(4.0f);
// _pssmPass.setDrawDebug(true);
// TODO: backside lock test
final Quad floor = new Quad("floor", 2048, 2048);
floor.updateModelBound();
floor.setRotation(new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_X));
floor.setTranslation(1024, 0, 1024);
terrainNode.attachChild(floor);
_pssmPass.addBoundsReceiver(terrainNode);
// Add objects that will get shadowed through overlay render
_pssmPass.add(_root);
// Add our occluders that will produce shadows
ShadowCasterManager.INSTANCE.addSpatial(terrainNode);
ShadowCasterManager.INSTANCE.addSpatial(_root);
final int quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10;
_orthoQuad = new Quad[ParallelSplitShadowMapPass._MAX_SPLITS];
for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) {
_orthoQuad[i] = new Quad("OrthoQuad", quadSize, quadSize);
_orthoQuad[i].setTranslation(new Vector3(quadSize / 2 + 5 + (quadSize + 5) * i, quadSize / 2 + 5, 1));
_orthoQuad[i].setScale(1, -1, 1);
_orthoQuad[i].getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
_orthoQuad[i].getSceneHints().setLightCombineMode(LightCombineMode.Off);
_orthoQuad[i].getSceneHints().setTextureCombineMode(TextureCombineMode.Replace);
_orthoQuad[i].getSceneHints().setCullHint(CullHint.Never);
hud.attachChild(_orthoQuad[i]);
}
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
// IMAGE LOADING AND CONVERSION TO HEIGHTMAP DONE HERE
final BufferedImage heightmap = ImageIO.read(ResourceLocatorTool.getClassPathResource(
MountainShadowTerrainExample.class, "com/ardor3d/example/media/images/heightmap.jpg"));
final Image ardorImage = AWTImageLoader.makeArdor3dImage(heightmap, false);
final float[] heightMap = ImageHeightMap.generateHeightMap(ardorImage, 0.05f, .33f);
// END OF IMAGE CONVERSION
final int SIZE = ardorImage.getWidth();
final ArrayTerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE,
new Vector3(5, 2048, 5), true);
terrainDataProvider.setHeightMax(0.34f);
final TerrainBuilder builder = new TerrainBuilder(terrainDataProvider, terrainCamera)
.setShowDebugPanels(true);
terrain = builder.build();
terrain.setPixelShader(new UrlInputSupplier(ResourceLocatorTool.getClassPathResource(
ShadowedTerrainExample.class,
"com/ardor3d/extension/terrain/shadowedGeometryClipmapShader_normalMap.frag")));
terrain.reloadShader();
terrain.getGeometryClipmapShader().setUniform("normalMap", 5);
terrainNode.attachChild(terrain);
terrain.setCullingEnabled(false);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = new UILabel("Text");
_exampleInfo[i].setForegroundColor(ColorRGBA.WHITE, true);
_exampleInfo[i].addFontStyle(StyleConstants.KEY_SIZE, 16);
_exampleInfo[i].addFontStyle(StyleConstants.KEY_BOLD, Boolean.TRUE);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
hud.add(_exampleInfo[i]);
}
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
}
private void addRover() {
try {
final ColladaStorage storage = new ColladaImporter().load("collada/sketchup/NASA Mars Rover.dae");
final Node rover = storage.getScene();
rover.setTranslation(440, 102, 160.1);
rover.setScale(3);
rover.setRotation(new Quaternion().fromAngleAxis(-MathUtils.HALF_PI, Vector3.UNIT_X));
_root.attachChild(rover);
} catch (final IOException ex) {
ex.printStackTrace();
}
}
private void setupDefaultStates() {
terrainNode.setRenderState(_lightState);
terrainNode.setRenderState(_wireframeState);
terrainNode.setRenderState(new ZBufferState());
_lightState.detachAll();
light = new DirectionalLight();
light.setEnabled(true);
light.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
light.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
light.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
light.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(light);
_lightState.setEnabled(true);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
terrainNode.setRenderState(fs);
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3/4] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
}
@Override
protected void updateLogicalLayer(final ReadOnlyTimer timer) {
hud.getLogicalLayer().checkTriggers(timer.getTimePerFrame());
}
@Override
protected void renderDebug(final Renderer renderer) {
super.renderDebug(renderer);
if (_showBounds) {
Debugger.drawBounds(terrainNode, renderer, true);
}
}
private void addUI() {
// setup hud
hud = new UIHud();
hud.setupInput(_canvas, _physicalLayer, _logicalLayer);
hud.setMouseManager(_mouseManager);
final UIFrame frame = new UIFrame("Controls", EnumSet.noneOf(FrameButtons.class));
frame.setResizeable(false);
final UILabel distLabel = new UILabel("Max Shadow Distance: 1500");
final UISlider distSlider = new UISlider(Orientation.Horizontal, 0, 2000, 1500);
distSlider.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent event) {
_pssmPass.setMaxShadowDistance(distSlider.getValue());
distLabel.setText("Max Shadow Distance: " + distSlider.getValue());
}
});
final UIButton updateCamera = new UIButton("Update Shadow Camera");
updateCamera.setSelectable(true);
updateCamera.setSelected(true);
updateCamera.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent event) {
_pssmPass.setUpdateMainCamera(updateCamera.isSelected());
updateText();
}
});
final UIButton rotateLight = new UIButton("Rotate Light");
rotateLight.setSelectable(true);
rotateLight.setSelected(false);
rotateLight.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent event) {
moveLight = rotateLight.isSelected();
updateText();
}
});
final UIPanel panel = new UIPanel(new RowLayout(false, true, false));
panel.setPadding(new Insets(10, 20, 10, 20));
panel.add(distLabel);
panel.add(distSlider);
panel.add(updateCamera);
panel.add(rotateLight);
frame.setContentPanel(panel);
frame.pack();
final Camera cam = _canvas.getCanvasRenderer().getCamera();
frame.setLocalXY(cam.getWidth() - frame.getLocalComponentWidth(),
cam.getHeight() - frame.getLocalComponentHeight());
hud.add(frame);
}
}
\ No newline at end of file +/** + * Copyright (c) 2008-2018 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.example.terrain; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.EnumSet; +import java.util.concurrent.Callable; + +import javax.imageio.ImageIO; + +import com.ardor3d.example.ExampleBase; +import com.ardor3d.example.Purpose; +import com.ardor3d.extension.model.collada.jdom.ColladaImporter; +import com.ardor3d.extension.model.collada.jdom.data.ColladaStorage; +import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass; +import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass.Filter; +import com.ardor3d.extension.shadow.map.ShadowCasterManager; +import com.ardor3d.extension.terrain.client.Terrain; +import com.ardor3d.extension.terrain.client.TerrainBuilder; +import com.ardor3d.extension.terrain.client.UrlInputSupplier; +import com.ardor3d.extension.terrain.heightmap.ImageHeightMap; +import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider; +import com.ardor3d.extension.ui.Orientation; +import com.ardor3d.extension.ui.UIButton; +import com.ardor3d.extension.ui.UIFrame; +import com.ardor3d.extension.ui.UIFrame.FrameButtons; +import com.ardor3d.extension.ui.UIHud; +import com.ardor3d.extension.ui.UILabel; +import com.ardor3d.extension.ui.UIPanel; +import com.ardor3d.extension.ui.UISlider; +import com.ardor3d.extension.ui.event.ActionEvent; +import com.ardor3d.extension.ui.event.ActionListener; +import com.ardor3d.extension.ui.layout.RowLayout; +import com.ardor3d.extension.ui.text.StyleConstants; +import com.ardor3d.extension.ui.util.Insets; +import com.ardor3d.framework.Canvas; +import com.ardor3d.framework.CanvasRenderer; +import com.ardor3d.image.Image; +import com.ardor3d.image.Texture; +import com.ardor3d.image.Texture2D; +import com.ardor3d.image.util.awt.AWTImageLoader; +import com.ardor3d.input.Key; +import com.ardor3d.input.logical.InputTrigger; +import com.ardor3d.input.logical.KeyPressedCondition; +import com.ardor3d.input.logical.TriggerAction; +import com.ardor3d.input.logical.TwoInputStates; +import com.ardor3d.light.DirectionalLight; +import com.ardor3d.math.ColorRGBA; +import com.ardor3d.math.MathUtils; +import com.ardor3d.math.Quaternion; +import com.ardor3d.math.Vector3; +import com.ardor3d.renderer.Camera; +import com.ardor3d.renderer.RenderContext; +import com.ardor3d.renderer.Renderer; +import com.ardor3d.renderer.queue.RenderBucketType; +import com.ardor3d.renderer.state.FogState; +import com.ardor3d.renderer.state.FogState.DensityFunction; +import com.ardor3d.renderer.state.RenderState.StateType; +import com.ardor3d.renderer.state.TextureState; +import com.ardor3d.renderer.state.ZBufferState; +import com.ardor3d.scenegraph.Node; +import com.ardor3d.scenegraph.hint.CullHint; +import com.ardor3d.scenegraph.hint.LightCombineMode; +import com.ardor3d.scenegraph.hint.TextureCombineMode; +import com.ardor3d.scenegraph.shape.Quad; +import com.ardor3d.util.GameTaskQueue; +import com.ardor3d.util.GameTaskQueueManager; +import com.ardor3d.util.ReadOnlyTimer; +import com.ardor3d.util.geom.Debugger; +import com.ardor3d.util.resource.ResourceLocatorTool; + +/** + * Example showing the Geometry Clipmap Terrain system with 'MegaTextures' where the terrain data is provided from a + * float array populated from a heightmap generated from an Image. Requires GLSL support. + */ +@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.MountainShadowTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_MountainShadowTerrainExample.jpg", //
maxHeapMemory = 128) +public class MountainShadowTerrainExample extends ExampleBase { + + private final float farPlane = 8000.0f; + + /** Quads used for debug showing shadowmaps. */ + private Quad _orthoQuad[]; + + private Terrain terrain; + private final Node terrainNode = new Node("terrain"); + + private boolean groundCamera = false; + private Camera terrainCamera; + + /** Text fields used to present info about the example. */ + private final UILabel _exampleInfo[] = new UILabel[2]; + + /** Pssm shadow map pass. */ + private ParallelSplitShadowMapPass _pssmPass; + + private DirectionalLight directionalLight;
+ private double lightTime; + private boolean moveLight = false; + + private UIHud hud; + + public static void main(final String[] args) { + ExampleBase._minDepthBits = 24; + ExampleBase.start(MountainShadowTerrainExample.class); + } + + @Override + protected void renderExample(final Renderer renderer) { + // Lazy init since it needs the renderer... + if (!_pssmPass.isInitialised()) { + _pssmPass.init(renderer); + _pssmPass.setPssmShader(terrain.getGeometryClipmapShader()); + for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) { + terrain.getClipTextureState().setTexture(_pssmPass.getShadowMapTexture(i), i + 1); + } + for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) { + terrain.getGeometryClipmapShader().setUniform("shadowMap" + i, i + 1); + } + } + + terrain.getGeometryClipmapShader().setUniform("lightDir", directionalLight.getDirection());
+ for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) { + TextureState screen = (TextureState) _orthoQuad[i].getLocalRenderState(StateType.Texture); + Texture copy; + if (screen == null) { + screen = new TextureState(); + _orthoQuad[i].setRenderState(screen); + copy = new Texture2D(); + screen.setTexture(copy); + _orthoQuad[i].updateGeometricState(0.0); + } else { + copy = screen.getTexture(); + } + copy.setTextureKey(_pssmPass.getShadowMapTexture(i).getTextureKey()); + } + + // XXX: Use a rougher LOD for shadows - tweak? + terrain.setMinVisibleLevel(4); + + // Update shadowmaps - this will update our terrain camera to light pos + _pssmPass.updateShadowMaps(renderer); + + // XXX: reset LOD for drawing from view camera + terrain.setMinVisibleLevel(0); + + // Render scene and terrain with shadows + terrainNode.onDraw(renderer); + _root.onDraw(renderer); + + // Render overlay shadows for all objects except the terrain + renderer.renderBuckets(); + _pssmPass.renderShadowedScene(renderer); + renderer.renderBuckets(); + + // draw ui + renderer.draw(hud); + } + + private double counter = 0; + private int frames = 0; + + @Override + protected void updateExample(final ReadOnlyTimer timer) { + counter += timer.getTimePerFrame(); + frames++; + if (counter > 1) { + final double fps = frames / counter; + counter = 0; + frames = 0; + System.out.printf("%7.1f FPS\n", fps); + } + + final Camera camera = _canvas.getCanvasRenderer().getCamera(); + + // Make sure camera is above terrain + final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ()); + if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) { + camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ())); + terrainCamera.set(camera); + } else { + terrainCamera.set(_canvas.getCanvasRenderer().getCamera()); + } + + // move terrain to view pos + terrainNode.updateGeometricState(timer.getTimePerFrame()); + hud.updateGeometricState(timer.getTimePerFrame()); + + if (moveLight) { + lightTime += timer.getTimePerFrame(); + directionalLight.setDirection(new Vector3(Math.sin(lightTime), -.8, Math.cos(lightTime)).normalizeLocal());
} + } + + /** + * Initialize pssm pass and scene. + */ + @Override + protected void initExample() { + // Setup main camera. + _canvas.setTitle("Terrain Example"); + final Camera canvasCamera = _canvas.getCanvasRenderer().getCamera(); + canvasCamera.setLocation(new Vector3(2176, 790, 688)); + canvasCamera.lookAt(new Vector3(canvasCamera.getLocation()).addLocal(-0.87105768019686, -0.4349655341112313, + 0.22817427967541867), Vector3.UNIT_Y); + canvasCamera.setFrustumPerspective(45.0, (float) _canvas.getCanvasRenderer().getCamera().getWidth() + / _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane); + final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer(); + final RenderContext renderContext = canvasRenderer.getRenderContext(); + final Renderer renderer = canvasRenderer.getRenderer(); + GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() { + @Override + public Void call() throws Exception { + renderer.setBackgroundColor(ColorRGBA.BLUE); + return null; + } + }); + _controlHandle.setMoveSpeed(400); + + setupDefaultStates(); + addRover(); + addUI(); + + // Initialize PSSM shadows + _pssmPass = new ParallelSplitShadowMapPass(directionalLight, 2048, 4);
_pssmPass.setFiltering(Filter.None); + _pssmPass.setRenderShadowedScene(false); + _pssmPass.setKeepMainShader(true); + // _pssmPass.setMinimumLightDistance(500); // XXX: Tune this + _pssmPass.setUseSceneTexturing(false); + _pssmPass.setUseObjectCullFace(false); + _pssmPass.getShadowOffsetState().setFactor(1.1f); + _pssmPass.getShadowOffsetState().setUnits(4.0f); + // _pssmPass.setDrawDebug(true); + + // TODO: backside lock test + final Quad floor = new Quad("floor", 2048, 2048); + floor.updateModelBound(); + floor.setRotation(new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_X)); + floor.setTranslation(1024, 0, 1024); + terrainNode.attachChild(floor); + + _pssmPass.addBoundsReceiver(terrainNode); + + // Add objects that will get shadowed through overlay render + _pssmPass.add(_root); + + // Add our occluders that will produce shadows + ShadowCasterManager.INSTANCE.addSpatial(terrainNode); + ShadowCasterManager.INSTANCE.addSpatial(_root); + + final int quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10; + _orthoQuad = new Quad[ParallelSplitShadowMapPass._MAX_SPLITS]; + for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) { + _orthoQuad[i] = new Quad("OrthoQuad", quadSize, quadSize); + _orthoQuad[i].setTranslation(new Vector3(quadSize / 2 + 5 + (quadSize + 5) * i, quadSize / 2 + 5, 1)); + _orthoQuad[i].setScale(1, -1, 1); + _orthoQuad[i].getSceneHints().setRenderBucketType(RenderBucketType.Ortho); + _orthoQuad[i].getSceneHints().setLightCombineMode(LightCombineMode.Off); + _orthoQuad[i].getSceneHints().setTextureCombineMode(TextureCombineMode.Replace); + _orthoQuad[i].getSceneHints().setCullHint(CullHint.Never); + hud.attachChild(_orthoQuad[i]); + } + + try { + // Keep a separate camera to be able to freeze terrain update + final Camera camera = _canvas.getCanvasRenderer().getCamera(); + terrainCamera = new Camera(camera); + + // IMAGE LOADING AND CONVERSION TO HEIGHTMAP DONE HERE + final BufferedImage heightmap = ImageIO.read(ResourceLocatorTool.getClassPathResource( + MountainShadowTerrainExample.class, "com/ardor3d/example/media/images/heightmap.jpg")); + final Image ardorImage = AWTImageLoader.makeArdor3dImage(heightmap, false); + final float[] heightMap = ImageHeightMap.generateHeightMap(ardorImage, 0.05f, .33f); + // END OF IMAGE CONVERSION + + final int SIZE = ardorImage.getWidth(); + + final ArrayTerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, + new Vector3(5, 2048, 5), true); + terrainDataProvider.setHeightMax(0.34f); + + final TerrainBuilder builder = new TerrainBuilder(terrainDataProvider, terrainCamera) + .setShowDebugPanels(true); + + terrain = builder.build(); + terrain.setPixelShader(new UrlInputSupplier(ResourceLocatorTool.getClassPathResource(
ShadowedTerrainExample.class,
"com/ardor3d/extension/terrain/shadowedGeometryClipmapShader_normalMap.frag"))); + terrain.reloadShader(); + terrain.getGeometryClipmapShader().setUniform("normalMap", 5); + terrainNode.attachChild(terrain); + + terrain.setCullingEnabled(false); + } catch (final Exception ex1) { + System.out.println("Problem setting up terrain..."); + ex1.printStackTrace(); + } + + final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2; + for (int i = 0; i < _exampleInfo.length; i++) { + _exampleInfo[i] = new UILabel("Text"); + _exampleInfo[i].setForegroundColor(ColorRGBA.WHITE, true); + _exampleInfo[i].addFontStyle(StyleConstants.KEY_SIZE, 16); + _exampleInfo[i].addFontStyle(StyleConstants.KEY_BOLD, Boolean.TRUE); + _exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0)); + hud.add(_exampleInfo[i]); + } + + updateText(); + + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() { + @Override + public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + _controlHandle.setMoveSpeed(5); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() { + @Override + public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + _controlHandle.setMoveSpeed(50); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() { + @Override + public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + _controlHandle.setMoveSpeed(400); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() { + @Override + public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + _controlHandle.setMoveSpeed(1000); + updateText(); + } + })); + + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override + public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + groundCamera = !groundCamera; + updateText(); + } + })); + } + + private void addRover() { + try { + final ColladaStorage storage = new ColladaImporter().load("collada/sketchup/NASA Mars Rover.dae"); + final Node rover = storage.getScene(); + rover.setTranslation(440, 102, 160.1); + rover.setScale(3); + rover.setRotation(new Quaternion().fromAngleAxis(-MathUtils.HALF_PI, Vector3.UNIT_X)); + _root.attachChild(rover); + } catch (final IOException ex) { + ex.printStackTrace(); + } + + } + + private void setupDefaultStates() { + terrainNode.setRenderState(_lightState); + terrainNode.setRenderState(_wireframeState); + terrainNode.setRenderState(new ZBufferState()); + + _lightState.detachAll(); + directionalLight = new DirectionalLight();
directionalLight.setEnabled(true);
directionalLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
directionalLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
directionalLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
directionalLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(directionalLight);
_lightState.setEnabled(true); + + final FogState fs = new FogState(); + fs.setStart(farPlane / 2.0f); + fs.setEnd(farPlane); + fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f)); + fs.setDensityFunction(DensityFunction.Linear); + terrainNode.setRenderState(fs); + } + + /** + * Update text information. + */ + private void updateText() { + _exampleInfo[0].setText("[1/2/3/4] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h"); + _exampleInfo[1].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly")); + } + + @Override + protected void updateLogicalLayer(final ReadOnlyTimer timer) { + hud.getLogicalLayer().checkTriggers(timer.getTimePerFrame()); + } + + @Override + protected void renderDebug(final Renderer renderer) { + super.renderDebug(renderer); + if (_showBounds) { + Debugger.drawBounds(terrainNode, renderer, true); + } + } + + private void addUI() { + // setup hud + hud = new UIHud(); + hud.setupInput(_canvas, _physicalLayer, _logicalLayer); + hud.setMouseManager(_mouseManager); + + final UIFrame frame = new UIFrame("Controls", EnumSet.noneOf(FrameButtons.class)); + frame.setResizeable(false); + + final UILabel distLabel = new UILabel("Max Shadow Distance: 1500"); + final UISlider distSlider = new UISlider(Orientation.Horizontal, 0, 2000, 1500); + distSlider.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent event) { + _pssmPass.setMaxShadowDistance(distSlider.getValue()); + distLabel.setText("Max Shadow Distance: " + distSlider.getValue()); + } + }); + + final UIButton updateCamera = new UIButton("Update Shadow Camera"); + updateCamera.setSelectable(true); + updateCamera.setSelected(true); + updateCamera.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent event) { + _pssmPass.setUpdateMainCamera(updateCamera.isSelected()); + updateText(); + } + }); + + final UIButton rotateLight = new UIButton("Rotate Light"); + rotateLight.setSelectable(true); + rotateLight.setSelected(false); + rotateLight.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent event) { + moveLight = rotateLight.isSelected(); + updateText(); + } + }); + + final UIPanel panel = new UIPanel(new RowLayout(false, true, false)); + panel.setPadding(new Insets(10, 20, 10, 20)); + panel.add(distLabel); + panel.add(distSlider); + panel.add(updateCamera); + panel.add(rotateLight); + + frame.setContentPanel(panel); + frame.pack(); + final Camera cam = _canvas.getCanvasRenderer().getCamera(); + frame.setLocalXY(cam.getWidth() - frame.getLocalComponentWidth(), + cam.getHeight() - frame.getLocalComponentHeight()); + hud.add(frame); + } +} diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ProceduralTerrainExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ProceduralTerrainExample.java index 0483945..a647485 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ProceduralTerrainExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ProceduralTerrainExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.providers.procedural.ProceduralTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.math.functions.FbmFunction3D;
import com.ardor3d.math.functions.Function3D;
import com.ardor3d.math.functions.Functions;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' using content procedurally generated
* on-the-fly. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ProceduralTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ProceduralTerrainExample.jpg", //
maxHeapMemory = 64)
public class ProceduralTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
private Skybox skybox;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
public static void main(final String[] args) {
ExampleBase.start(ProceduralTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
skybox.setTranslation(camera.getLocation());
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
// XXX: maybe change the color of the ball for valid vs. invalid?
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Procedural Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.BLUE);
return null;
}
});
_controlHandle.setMoveSpeed(50);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
final double scale = 1.0 / 4000.0;
Function3D functionTmp = new FbmFunction3D(Functions.simplexNoise(), 9, 0.5, 0.5, 3.14);
functionTmp = Functions.clamp(functionTmp, -1.2, 1.2);
final Function3D function = Functions.scaleInput(functionTmp, scale, scale, 1);
final TerrainDataProvider terrainDataProvider = new ProceduralTerrainDataProvider(function, new Vector3(1,
200, 1), -1.2f, 1.2f);
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
skybox = buildSkyBox();
skybox.getSceneHints().setAllPickingHints(false);
_root.attachChild(skybox);
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(200);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(500);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(-5000, 500, -5000);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(5000, 500, 5000);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Builds the sky box.
*/
private Skybox buildSkyBox() {
final Skybox skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
return skybox;
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3/4] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.providers.procedural.ProceduralTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.math.functions.FbmFunction3D;
import com.ardor3d.math.functions.Function3D;
import com.ardor3d.math.functions.Functions;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' using content procedurally generated
* on-the-fly. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ProceduralTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ProceduralTerrainExample.jpg", //
maxHeapMemory = 64)
public class ProceduralTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
private Skybox skybox;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
public static void main(final String[] args) {
ExampleBase.start(ProceduralTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
skybox.setTranslation(camera.getLocation());
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
// XXX: maybe change the color of the ball for valid vs. invalid?
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Procedural Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.BLUE);
return null;
}
});
_controlHandle.setMoveSpeed(50);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
final double scale = 1.0 / 4000.0;
Function3D functionTmp = new FbmFunction3D(Functions.simplexNoise(), 9, 0.5, 0.5, 3.14);
functionTmp = Functions.clamp(functionTmp, -1.2, 1.2);
final Function3D function = Functions.scaleInput(functionTmp, scale, scale, 1);
final TerrainDataProvider terrainDataProvider = new ProceduralTerrainDataProvider(function, new Vector3(1,
200, 1), -1.2f, 1.2f);
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
skybox = buildSkyBox();
skybox.getSceneHints().setAllPickingHints(false);
_root.attachChild(skybox);
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(200);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(500);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(-5000, 500, -5000);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(5000, 500, 5000);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Builds the sky box.
*/
private Skybox buildSkyBox() {
final Skybox skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
return skybox;
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3/4] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShadowedTerrainExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShadowedTerrainExample.java index 1a895ad..1c7766e 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShadowedTerrainExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShadowedTerrainExample.java @@ -1 +1,384 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.ardor3d.bounding.BoundingBox;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass;
import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass.Filter;
import com.ardor3d.extension.shadow.map.ShadowCasterManager;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.client.UrlInputSupplier;
import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.resource.ResourceLocatorTool;
/**
* Example showing the Geometry Clipmap Terrain system combined with PSSM. (a bit experimental) Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ShadowedTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ShadowedTerrainExample.jpg", //
maxHeapMemory = 128)
public class ShadowedTerrainExample extends ExampleBase {
/** The Constant logger. */
private static final Logger logger = Logger.getLogger(ShadowedTerrainExample.class.getName());
private boolean updateTerrain = true;
private final float farPlane = 2500.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
/** Pssm shadow map pass. */
private ParallelSplitShadowMapPass _pssmPass;
private DirectionalLight light;
/** Temp vec for updating light pos. */
private final Vector3 lightPosition = new Vector3(10000, 10000, 10000);
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
public static void main(final String[] args) {
ExampleBase.start(ShadowedTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
// XXX: maybe change the color of the ball for valid vs. invalid?
}
}
}
@Override
protected void renderExample(final Renderer renderer) {
// Lazy init since it needs the renderer...
if (!_pssmPass.isInitialised()) {
_pssmPass.init(renderer);
_pssmPass.setPssmShader(terrain.getGeometryClipmapShader());
for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) {
terrain.getClipTextureState().setTexture(_pssmPass.getShadowMapTexture(i), i + 1);
}
for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) {
terrain.getGeometryClipmapShader().setUniform("shadowMap" + i, i + 1);
}
}
// Update shadowmaps
_pssmPass.updateShadowMaps(renderer);
// Render scene and terrain with shadows
super.renderExample(renderer);
renderer.renderBuckets();
// Render overlay shadows for all objects except the terrain
_pssmPass.renderShadowedScene(renderer);
// TODO: this results in text etc also being shadowed, since they are drawn in the main render...
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
_canvas.setTitle("Terrain Example");
final Camera cam = _canvas.getCanvasRenderer().getCamera();
cam.setLocation(new Vector3(440, 215, 275));
cam.lookAt(new Vector3(450, 140, 360), Vector3.UNIT_Y);
cam.setFrustumPerspective(70.0, (float) cam.getWidth() / cam.getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(200);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
try {
// Keep a separate camera to be able to freeze terrain update
terrainCamera = new Camera(cam);
final int SIZE = 2048;
final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.6f);
raw.setHeightRange(0.2f);
final float[] heightMap = raw.getHeightData();
final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
1, 300, 1));
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
terrain.setPixelShader(new UrlInputSupplier(ResourceLocatorTool
.getClassPathResource(ShadowedTerrainExample.class,
"com/ardor3d/extension/terrain/shadowedGeometryClipmapShaderPCF.frag")));
terrain.reloadShader();
_root.attachChild(terrain);
} catch (final Exception e) {
logger.log(Level.SEVERE, "Problem setting up terrain...", e);
System.exit(1);
}
// Initialize PSSM shadows
_pssmPass = new ParallelSplitShadowMapPass(light, 1024, 4);
_pssmPass.setFiltering(Filter.Pcf);
_pssmPass.setRenderShadowedScene(false);
_pssmPass.setKeepMainShader(true);
_pssmPass.setMaxShadowDistance(750); // XXX: Tune this
// _pssmPass.setMinimumLightDistance(500); // XXX: Tune this
_pssmPass.setUseSceneTexturing(false);
_pssmPass.setUseObjectCullFace(false);
// _pssmPass.setDrawDebug(true);
final Node occluders = setupOccluders();
_root.attachChild(occluders);
// TODO: could we use the shadow variable in scenehints here??
// Add objects that will get shadowed through overlay render
_pssmPass.add(occluders);
// Add terrain in as bounds receiver as well, since it's not in the overlay list
_pssmPass.addBoundsReceiver(terrain);
// Add our occluders that will produce shadows
ShadowCasterManager.INSTANCE.addSpatial(occluders);
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.C), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_pssmPass.setUpdateMainCamera(!_pssmPass.isUpdateMainCamera());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera cam = _canvas.getCanvasRenderer().getCamera();
System.out.println("camera location: " + cam.getLocation());
System.out.println("camera direction: " + cam.getDirection());
}
}));
}
private Node setupOccluders() {
final Node occluders = new Node("Occluders");
final Box box = new Box("Box", new Vector3(), 1, 40, 1);
box.setModelBound(new BoundingBox());
box.setRandomColors();
final Random rand = new Random(1337);
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 8; y++) {
final Mesh sm = box.makeCopy(true);
sm.setTranslation(500 + rand.nextDouble() * 300 - 150, 20 + rand.nextDouble() * 5.0,
500 + rand.nextDouble() * 300 - 150);
occluders.attachChild(sm);
}
}
return occluders;
}
private void setupDefaultStates() {
_lightState.detachAll();
light = new DirectionalLight();
light.setEnabled(true);
light.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
light.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
light.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
light.setDirection(lightPosition.normalize(null).negateLocal());
_lightState.attach(light);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file +/** + * Copyright (c) 2008-2018 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.example.terrain; + +import java.util.Random; +import java.util.concurrent.Callable; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ardor3d.bounding.BoundingBox; +import com.ardor3d.example.ExampleBase; +import com.ardor3d.example.Purpose; +import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass; +import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass.Filter; +import com.ardor3d.extension.shadow.map.ShadowCasterManager; +import com.ardor3d.extension.terrain.client.Terrain; +import com.ardor3d.extension.terrain.client.TerrainBuilder; +import com.ardor3d.extension.terrain.client.TerrainDataProvider; +import com.ardor3d.extension.terrain.client.UrlInputSupplier; +import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator; +import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider; +import com.ardor3d.framework.Canvas; +import com.ardor3d.framework.CanvasRenderer; +import com.ardor3d.input.Key; +import com.ardor3d.input.logical.InputTrigger; +import com.ardor3d.input.logical.KeyPressedCondition; +import com.ardor3d.input.logical.TriggerAction; +import com.ardor3d.input.logical.TwoInputStates; +import com.ardor3d.intersection.PickingUtil; +import com.ardor3d.intersection.PrimitivePickResults; +import com.ardor3d.light.DirectionalLight; +import com.ardor3d.math.ColorRGBA; +import com.ardor3d.math.Ray3; +import com.ardor3d.math.Vector3; +import com.ardor3d.renderer.Camera; +import com.ardor3d.renderer.RenderContext; +import com.ardor3d.renderer.Renderer; +import com.ardor3d.renderer.queue.RenderBucketType; +import com.ardor3d.renderer.state.CullState; +import com.ardor3d.renderer.state.FogState; +import com.ardor3d.renderer.state.FogState.DensityFunction; +import com.ardor3d.scenegraph.Mesh; +import com.ardor3d.scenegraph.Node; +import com.ardor3d.scenegraph.hint.CullHint; +import com.ardor3d.scenegraph.hint.LightCombineMode; +import com.ardor3d.scenegraph.shape.Box; +import com.ardor3d.scenegraph.shape.Sphere; +import com.ardor3d.ui.text.BasicText; +import com.ardor3d.util.GameTaskQueue; +import com.ardor3d.util.GameTaskQueueManager; +import com.ardor3d.util.ReadOnlyTimer; +import com.ardor3d.util.resource.ResourceLocatorTool; + +/** + * Example showing the Geometry Clipmap Terrain system combined with PSSM. (a bit experimental) Requires GLSL support. + */ +@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ShadowedTerrainExample", // + thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ShadowedTerrainExample.jpg", // + maxHeapMemory = 128) +public class ShadowedTerrainExample extends ExampleBase { + /** The Constant logger. */ + private static final Logger logger = Logger.getLogger(ShadowedTerrainExample.class.getName()); + + private boolean updateTerrain = true; + private final float farPlane = 2500.0f; + + private Terrain terrain; + + private final Sphere sphere = new Sphere("sp", 16, 16, 1); + private final Ray3 pickRay = new Ray3(); + + private boolean groundCamera = false; + private Camera terrainCamera; + + /** Pssm shadow map pass. */ + private ParallelSplitShadowMapPass _pssmPass; + + private DirectionalLight directionalLight;
+ /** Temp vec for updating light pos. */ + private final Vector3 lightPosition = new Vector3(10000, 10000, 10000); + + /** Text fields used to present info about the example. */ + private final BasicText _exampleInfo[] = new BasicText[5]; + + public static void main(final String[] args) { + ExampleBase.start(ShadowedTerrainExample.class); + } + + @Override + protected void updateExample(final ReadOnlyTimer timer) { + final Camera camera = _canvas.getCanvasRenderer().getCamera(); + + // Make sure camera is above terrain + final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ()); + if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) { + camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ())); + } + + if (updateTerrain) { + terrainCamera.set(camera); + } + + // if we're picking... + if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) { + // Set up our pick ray + pickRay.setOrigin(camera.getLocation()); + pickRay.setDirection(camera.getDirection()); + + // do pick and move the sphere + final PrimitivePickResults pickResults = new PrimitivePickResults(); + pickResults.setCheckDistance(true); + PickingUtil.findPick(_root, pickRay, pickResults); + if (pickResults.getNumber() != 0) { + final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord() + .getIntersectionPoint(0); + sphere.setTranslation(intersectionPoint); + // XXX: maybe change the color of the ball for valid vs. invalid? + } + } + } + + @Override + protected void renderExample(final Renderer renderer) { + // Lazy init since it needs the renderer... + if (!_pssmPass.isInitialised()) { + _pssmPass.init(renderer); + _pssmPass.setPssmShader(terrain.getGeometryClipmapShader()); + for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) { + terrain.getClipTextureState().setTexture(_pssmPass.getShadowMapTexture(i), i + 1); + } + for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) { + terrain.getGeometryClipmapShader().setUniform("shadowMap" + i, i + 1); + } + } + + // Update shadowmaps + _pssmPass.updateShadowMaps(renderer); + + // Render scene and terrain with shadows + super.renderExample(renderer); + renderer.renderBuckets(); + + // Render overlay shadows for all objects except the terrain + _pssmPass.renderShadowedScene(renderer); + + // TODO: this results in text etc also being shadowed, since they are drawn in the main render... + } + + /** + * Initialize pssm pass and scene. + */ + @Override + protected void initExample() { + _canvas.setTitle("Terrain Example"); + final Camera cam = _canvas.getCanvasRenderer().getCamera(); + cam.setLocation(new Vector3(440, 215, 275)); + cam.lookAt(new Vector3(450, 140, 360), Vector3.UNIT_Y); + cam.setFrustumPerspective(70.0, (float) cam.getWidth() / cam.getHeight(), 1.0f, farPlane); + final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer(); + final RenderContext renderContext = canvasRenderer.getRenderContext(); + final Renderer renderer = canvasRenderer.getRenderer(); + GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() { + @Override + public Void call() throws Exception { + renderer.setBackgroundColor(ColorRGBA.GRAY); + return null; + } + }); + _controlHandle.setMoveSpeed(200); + + setupDefaultStates(); + + sphere.getSceneHints().setAllPickingHints(false); + sphere.getSceneHints().setCullHint(CullHint.Always); + _root.attachChild(sphere); + + try { + // Keep a separate camera to be able to freeze terrain update + terrainCamera = new Camera(cam); + + final int SIZE = 2048; + + final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.6f); + raw.setHeightRange(0.2f); + final float[] heightMap = raw.getHeightData(); + + final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
1, 300, 1));
+ terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build(); + + terrain.setPixelShader(new UrlInputSupplier(ResourceLocatorTool
.getClassPathResource(ShadowedTerrainExample.class,
"com/ardor3d/extension/terrain/shadowedGeometryClipmapShaderPCF.frag"))); + terrain.reloadShader(); + + _root.attachChild(terrain); + } catch (final Exception e) { + logger.log(Level.SEVERE, "Problem setting up terrain...", e); + System.exit(1); + } + + // Initialize PSSM shadows + _pssmPass = new ParallelSplitShadowMapPass(directionalLight, 1024, 4);
_pssmPass.setFiltering(Filter.Pcf); + _pssmPass.setRenderShadowedScene(false); + _pssmPass.setKeepMainShader(true); + _pssmPass.setMaxShadowDistance(750); // XXX: Tune this + // _pssmPass.setMinimumLightDistance(500); // XXX: Tune this + _pssmPass.setUseSceneTexturing(false); + _pssmPass.setUseObjectCullFace(false); + // _pssmPass.setDrawDebug(true); + + final Node occluders = setupOccluders(); + _root.attachChild(occluders); + + // TODO: could we use the shadow variable in scenehints here?? + // Add objects that will get shadowed through overlay render + _pssmPass.add(occluders); + + // Add terrain in as bounds receiver as well, since it's not in the overlay list + _pssmPass.addBoundsReceiver(terrain); + + // Add our occluders that will produce shadows + ShadowCasterManager.INSTANCE.addSpatial(occluders); + + // Setup labels for presenting example info. + final Node textNodes = new Node("Text"); + _root.attachChild(textNodes); + textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho); + textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off); + + final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2; + for (int i = 0; i < _exampleInfo.length; i++) { + _exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16); + _exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0)); + textNodes.attachChild(_exampleInfo[i]); + } + + textNodes.updateGeometricState(0.0); + updateText(); + + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + updateTerrain = !updateTerrain; + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + _controlHandle.setMoveSpeed(5); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + _controlHandle.setMoveSpeed(50); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + _controlHandle.setMoveSpeed(400); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + _controlHandle.setMoveSpeed(1000); + updateText(); + } + })); + + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + groundCamera = !groundCamera; + updateText(); + } + })); + + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) { + sphere.getSceneHints().setCullHint(CullHint.Always); + } else if (sphere.getSceneHints().getCullHint() == CullHint.Always) { + sphere.getSceneHints().setCullHint(CullHint.Dynamic); + } + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug()); + terrain.reloadShader(); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + terrain.reloadShader(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2); + terrain.reloadShader(); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2); + terrain.reloadShader(); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.C), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + _pssmPass.setUpdateMainCamera(!_pssmPass.isUpdateMainCamera()); + updateText(); + } + })); + _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() { + @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { + final Camera cam = _canvas.getCanvasRenderer().getCamera(); + System.out.println("camera location: " + cam.getLocation()); + System.out.println("camera direction: " + cam.getDirection()); + } + })); + + } + + private Node setupOccluders() { + final Node occluders = new Node("Occluders"); + + final Box box = new Box("Box", new Vector3(), 1, 40, 1); + box.setModelBound(new BoundingBox()); + box.setRandomColors(); + + final Random rand = new Random(1337); + for (int x = 0; x < 8; x++) { + for (int y = 0; y < 8; y++) { + final Mesh sm = box.makeCopy(true); + + sm.setTranslation(500 + rand.nextDouble() * 300 - 150, 20 + rand.nextDouble() * 5.0, + 500 + rand.nextDouble() * 300 - 150); + occluders.attachChild(sm); + } + } + + return occluders; + } + + private void setupDefaultStates() { + _lightState.detachAll(); + directionalLight = new DirectionalLight();
directionalLight.setEnabled(true);
directionalLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
directionalLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
directionalLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
directionalLight.setDirection(lightPosition.normalize(null).negateLocal());
_lightState.attach(directionalLight);
_lightState.setEnabled(true); + + final CullState cs = new CullState(); + cs.setEnabled(true); + cs.setCullFace(CullState.Face.Back); + _root.setRenderState(cs); + + final FogState fs = new FogState(); + fs.setStart(farPlane / 2.0f); + fs.setEnd(farPlane); + fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f)); + fs.setDensityFunction(DensityFunction.Linear); + _root.setRenderState(fs); + } + + /** + * Update text information. + */ + private void updateText() { + _exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h"); + _exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic)); + _exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly")); + _exampleInfo[3].setText("[J] Regenerate heightmap/texture"); + _exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain); + } +} diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShapesPlusProceduralTerrainExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShapesPlusProceduralTerrainExample.java index ac2a1c1..e6b9b3d 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShapesPlusProceduralTerrainExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShapesPlusProceduralTerrainExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.geom.Ellipse2D;
import java.io.IOException;
import java.util.concurrent.Callable;
import javax.imageio.ImageIO;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.client.TextureClipmap;
import com.ardor3d.extension.terrain.providers.awt.AbstractAwtElement;
import com.ardor3d.extension.terrain.providers.awt.AwtImageElement;
import com.ardor3d.extension.terrain.providers.awt.AwtShapeElement;
import com.ardor3d.extension.terrain.providers.awt.AwtTextureSource;
import com.ardor3d.extension.terrain.providers.procedural.ProceduralTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.TextureStoreFormat;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.MathUtils;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Transform;
import com.ardor3d.math.Vector3;
import com.ardor3d.math.functions.FbmFunction3D;
import com.ardor3d.math.functions.Function3D;
import com.ardor3d.math.functions.Functions;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.resource.ResourceLocatorTool;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures'. We merge AWT drawing with the terrain
* texture in real time. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ShapesPlusProceduralTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ShapesPlusProceduralTerrainExample.jpg", //
maxHeapMemory = 128)
public class ShapesPlusProceduralTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private final float heightScale = 200;
private Terrain terrain;
private boolean groundCamera = false;
private Camera terrainCamera;
Transform ovalTrans = new Transform();
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
public static void main(final String[] args) {
ExampleBase.start(ShapesPlusProceduralTerrainExample.class);
}
private double counter = 0;
private int frames = 0;
private final double awtUpdate = 1.0 / 15.0; // 15 fps
private double awtCounter = 0;
@Override
protected void updateExample(final ReadOnlyTimer timer) {
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = frames / counter;
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
final Camera camera = _canvas.getCanvasRenderer().getCamera();
awtCounter += timer.getTimePerFrame();
if (awtCounter > awtUpdate) {
final double tis = timer.getTimeInSeconds() * 0.75;
ovalTrans.setTranslation(250 * MathUtils.sin(-tis), 150 * MathUtils.cos(tis), 0);
oval.setTransform(ovalTrans);
awtCounter -= awtUpdate;
}
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
}
private AwtTextureSource awtTextureSource;
private AwtShapeElement rectangle;
private AwtShapeElement oval;
private AwtImageElement bubble;
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
for (int i = 0; i < 9; i++) {
final double x = (i % 3 - 1) * 128.0;
final double z = (i / 3 - 1) * 128.0;
final Box b = new Box("" + i, new Vector3(x, 0, z), 5, 150, 5);
_root.attachChild(b);
}
// Setup main camera.
_canvas.setTitle("Shapes + Procedural Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(50);
setupDefaultStates();
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
awtTextureSource = new AwtTextureSource(8, TextureStoreFormat.RGBA8); // Same as procedural one
final double scale = 1.0 / 4000.0;
Function3D functionTmp = new FbmFunction3D(Functions.simplexNoise(), 9, 0.5, 0.5, 3.14);
functionTmp = Functions.clamp(functionTmp, -1.2, 1.2);
final Function3D function = Functions.scaleInput(functionTmp, scale, scale, 1);
final TerrainDataProvider baseTerrainDataProvider = new ProceduralTerrainDataProvider(function,
new Vector3(1, heightScale, 1), -1.2f, 1.2f);
final TerrainBuilder terrainBuilder = new TerrainBuilder(baseTerrainDataProvider, terrainCamera);
terrainBuilder.addTextureConnection(awtTextureSource);
terrain = terrainBuilder.setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
// add some shapes
rectangle = new AwtShapeElement(new Rectangle(400, 50));
Transform t = new Transform();
t.setRotation(new Matrix3().fromAngles(0, 0, 45 * MathUtils.DEG_TO_RAD));
rectangle.setTransform(t);
awtTextureSource.getProvider().addElement(rectangle);
oval = new AwtShapeElement(new Ellipse2D.Float(0, 0, 250, 150));
oval.setFillColor(Color.red);
// set transparency
oval.setCompositeOverride(AbstractAwtElement.makeAlphaComposite(.75f));
awtTextureSource.getProvider().addElement(oval);
// add an image element to test.
t = new Transform();
t.setScale(2.0);
t.translate(-250, 150, 0);
addBubble(t);
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(200);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
for (final TextureClipmap clipmap : terrain.getTextureClipmaps()) {
clipmap.setScale(terrain.getTextureClipmap().getScale() / 2);
}
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
for (final TextureClipmap clipmap : terrain.getTextureClipmaps()) {
clipmap.setScale(terrain.getTextureClipmap().getScale() * 2);
}
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(-5000, 500, -5000);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(5000, 500, 5000);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.V), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Transform t = new Transform();
t.setScale(MathUtils.nextRandomDouble() * 4.9 + 0.1);
t.translate(MathUtils.nextRandomDouble() * 500 - 250, MathUtils.nextRandomDouble() * 500 - 250, 0);
addBubble(t);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
protected void addBubble(final Transform t) {
java.awt.Image bubbleImg = null;
try {
bubbleImg = ImageIO.read(ResourceLocatorTool.getClassPathResourceAsStream(
ShapesPlusProceduralTerrainExample.class, "com/ardor3d/example/media/images/ball.png"));
} catch (final IOException e) {
e.printStackTrace();
System.exit(-1);
}
bubble = new AwtImageElement(bubbleImg);
bubble.setTransform(t);
awtTextureSource.getProvider().addElement(bubble);
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[R] Draw texture debug: " + terrain.getTextureClipmap().isShowDebug());
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.geom.Ellipse2D;
import java.io.IOException;
import java.util.concurrent.Callable;
import javax.imageio.ImageIO;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.client.TextureClipmap;
import com.ardor3d.extension.terrain.providers.awt.AbstractAwtElement;
import com.ardor3d.extension.terrain.providers.awt.AwtImageElement;
import com.ardor3d.extension.terrain.providers.awt.AwtShapeElement;
import com.ardor3d.extension.terrain.providers.awt.AwtTextureSource;
import com.ardor3d.extension.terrain.providers.procedural.ProceduralTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.TextureStoreFormat;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.MathUtils;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Transform;
import com.ardor3d.math.Vector3;
import com.ardor3d.math.functions.FbmFunction3D;
import com.ardor3d.math.functions.Function3D;
import com.ardor3d.math.functions.Functions;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Box;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.resource.ResourceLocatorTool;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures'. We merge AWT drawing with the terrain
* texture in real time. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ShapesPlusProceduralTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ShapesPlusProceduralTerrainExample.jpg", //
maxHeapMemory = 128)
public class ShapesPlusProceduralTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 8000.0f;
private final float heightScale = 200;
private Terrain terrain;
private boolean groundCamera = false;
private Camera terrainCamera;
Transform ovalTrans = new Transform();
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
public static void main(final String[] args) {
ExampleBase.start(ShapesPlusProceduralTerrainExample.class);
}
private double counter = 0;
private int frames = 0;
private final double awtUpdate = 1.0 / 15.0; // 15 fps
private double awtCounter = 0;
@Override
protected void updateExample(final ReadOnlyTimer timer) {
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = frames / counter;
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
final Camera camera = _canvas.getCanvasRenderer().getCamera();
awtCounter += timer.getTimePerFrame();
if (awtCounter > awtUpdate) {
final double tis = timer.getTimeInSeconds() * 0.75;
ovalTrans.setTranslation(250 * MathUtils.sin(-tis), 150 * MathUtils.cos(tis), 0);
oval.setTransform(ovalTrans);
awtCounter -= awtUpdate;
}
// Make sure camera is above terrain
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ());
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ()));
}
if (updateTerrain) {
terrainCamera.set(camera);
}
}
private AwtTextureSource awtTextureSource;
private AwtShapeElement rectangle;
private AwtShapeElement oval;
private AwtImageElement bubble;
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
for (int i = 0; i < 9; i++) {
final double x = (i % 3 - 1) * 128.0;
final double z = (i / 3 - 1) * 128.0;
final Box b = new Box("" + i, new Vector3(x, 0, z), 5, 150, 5);
_root.attachChild(b);
}
// Setup main camera.
_canvas.setTitle("Shapes + Procedural Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, 300, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setMoveSpeed(50);
setupDefaultStates();
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
awtTextureSource = new AwtTextureSource(8, TextureStoreFormat.RGBA8); // Same as procedural one
final double scale = 1.0 / 4000.0;
Function3D functionTmp = new FbmFunction3D(Functions.simplexNoise(), 9, 0.5, 0.5, 3.14);
functionTmp = Functions.clamp(functionTmp, -1.2, 1.2);
final Function3D function = Functions.scaleInput(functionTmp, scale, scale, 1);
final TerrainDataProvider baseTerrainDataProvider = new ProceduralTerrainDataProvider(function,
new Vector3(1, heightScale, 1), -1.2f, 1.2f);
final TerrainBuilder terrainBuilder = new TerrainBuilder(baseTerrainDataProvider, terrainCamera);
terrainBuilder.addTextureConnection(awtTextureSource);
terrain = terrainBuilder.setShowDebugPanels(true).build();
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
// add some shapes
rectangle = new AwtShapeElement(new Rectangle(400, 50));
Transform t = new Transform();
t.setRotation(new Matrix3().fromAngles(0, 0, 45 * MathUtils.DEG_TO_RAD));
rectangle.setTransform(t);
awtTextureSource.getProvider().addElement(rectangle);
oval = new AwtShapeElement(new Ellipse2D.Float(0, 0, 250, 150));
oval.setFillColor(Color.red);
// set transparency
oval.setCompositeOverride(AbstractAwtElement.makeAlphaComposite(.75f));
awtTextureSource.getProvider().addElement(oval);
// add an image element to test.
t = new Transform();
t.setScale(2.0);
t.translate(-250, 150, 0);
addBubble(t);
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(200);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
for (final TextureClipmap clipmap : terrain.getTextureClipmaps()) {
clipmap.setScale(terrain.getTextureClipmap().getScale() / 2);
}
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
for (final TextureClipmap clipmap : terrain.getTextureClipmaps()) {
clipmap.setScale(terrain.getTextureClipmap().getScale() * 2);
}
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(-5000, 500, -5000);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(5000, 500, 5000);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 1500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.V), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Transform t = new Transform();
t.setScale(MathUtils.nextRandomDouble() * 4.9 + 0.1);
t.translate(MathUtils.nextRandomDouble() * 500 - 250, MathUtils.nextRandomDouble() * 500 - 250, 0);
addBubble(t);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 1500.0);
}
}));
}
protected void addBubble(final Transform t) {
java.awt.Image bubbleImg = null;
try {
bubbleImg = ImageIO.read(ResourceLocatorTool.getClassPathResourceAsStream(
ShapesPlusProceduralTerrainExample.class, "com/ardor3d/example/media/images/ball.png"));
} catch (final IOException e) {
e.printStackTrace();
System.exit(-1);
}
bubble = new AwtImageElement(bubbleImg);
bubble.setTransform(t);
awtTextureSource.getProvider().addElement(bubble);
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[R] Draw texture debug: " + terrain.getTextureClipmap().isShowDebug());
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/TerrainWaterExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/TerrainWaterExample.java index 2958130..b17b63f 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/TerrainWaterExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/TerrainWaterExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.nio.FloatBuffer;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.effect.water.WaterNode;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.providers.procedural.ProceduralTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Plane;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.math.functions.FbmFunction3D;
import com.ardor3d.math.functions.Function3D;
import com.ardor3d.math.functions.Functions;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing how to combine the terrain and water systems. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.TerrainWaterExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_TerrainWaterExample.jpg", //
maxHeapMemory = 128)
public class TerrainWaterExample extends ExampleBase {
private final int SIZE = 2048;
private Terrain terrain;
private boolean updateTerrain = true;
private final float farPlane = 3500.0f;
private final float heightOffset = 3.0f;
/** The water instance taking care of the water rendering. */
private WaterNode waterNode;
private boolean aboveWater = true;
/** Node containing debug quads for showing waternode render textures. */
private Node debugQuadsNode;
/** The quad used as geometry for the water. */
private Quad waterQuad;
private boolean groundCamera = false;
private Camera terrainCamera;
private Skybox skybox;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final double textureScale = 0.05;
private FogState fogState;
private boolean showUI = true;
private final Ray3 pickRay = new Ray3();
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[8];
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(final String[] args) {
start(TerrainWaterExample.class);
}
private double counter = 0;
private int frames = 0;
/**
* Update the PassManager, skybox, camera position, etc.
*
* @param timer
* the application timer
*/
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ())
+ heightOffset;
if (groundCamera || camera.getLocation().getY() < height) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height, camera.getLocation().getZ()));
}
if (aboveWater && camera.getLocation().getY() < waterNode.getWaterHeight()) {
fogState.setStart(-1000f);
fogState.setEnd(farPlane / 10f);
fogState.setColor(new ColorRGBA(0.0f, 0.0f, 0.1f, 1.0f));
aboveWater = false;
} else if (!aboveWater && camera.getLocation().getY() >= waterNode.getWaterHeight()) {
fogState.setStart(farPlane / 2.0f);
fogState.setEnd(farPlane);
fogState.setColor(new ColorRGBA(0.96f, 0.97f, 1.0f, 1.0f));
aboveWater = true;
}
if (updateTerrain) {
terrainCamera.set(camera);
}
skybox.setTranslation(camera.getLocation());
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = (frames / counter);
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
// XXX: maybe change the color of the ball for valid vs. invalid?
}
}
final Vector3 transVec = new Vector3(camera.getLocation().getX(), waterNode.getWaterHeight(), camera
.getLocation().getZ());
setTextureCoords(0, transVec.getX(), -transVec.getZ(), textureScale);
// vertex coords
setVertexCoords(transVec.getX(), transVec.getY(), transVec.getZ());
waterNode.update(timer.getTimePerFrame());
}
/**
* Render example.
*
* @param renderer
* the renderer
*/
@Override
protected void renderExample(final Renderer renderer) {
super.renderExample(renderer);
if (debugQuadsNode == null) {
createDebugQuads();
_root.attachChild(debugQuadsNode);
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain + Water - Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 100, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(0, 100, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer().getCamera().setFrustumPerspective(
65.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
_controlHandle.setMoveSpeed(50);
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
fogState = new FogState();
fogState.setStart(farPlane / 2.0f);
fogState.setEnd(farPlane);
fogState.setColor(new ColorRGBA(0.96f, 0.97f, 1.0f, 1.0f));
fogState.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fogState);
// add our sphere, but have it off for now.
sphere.getSceneHints().setCullHint(CullHint.Always);
sphere.getSceneHints().setAllPickingHints(false);
_root.attachChild(sphere);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
final double scale = 1.0 / 4000.0;
Function3D functionTmp = new FbmFunction3D(Functions.simplexNoise(), 9, 0.5, 0.5, 3.14);
functionTmp = Functions.clamp(functionTmp, -1.2, 1.2);
final Function3D function = Functions.scaleInput(functionTmp, scale, scale, 1);
final TerrainDataProvider terrainDataProvider = new ProceduralTerrainDataProvider(function, new Vector3(1,
200, 1), -1.2f, 1.2f);
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
} catch (final Exception ex1) {
ex1.printStackTrace();
}
final Node reflectedNode = new Node("reflectNode");
reflectedNode.attachChild(terrain);
skybox = buildSkyBox();
skybox.getSceneHints().setAllPickingHints(false);
reflectedNode.attachChild(skybox);
final Camera cam = _canvas.getCanvasRenderer().getCamera();
// Create a new WaterNode with refraction enabled.
waterNode = new WaterNode(cam, 2, false, true);
// Setup textures to use for the water.
waterNode.setNormalMapTextureString("images/water/normalmap3.dds");
waterNode.setDudvMapTextureString("images/water/dudvmap.png");
waterNode.setFallbackMapTextureString("images/water/water2.png");
waterNode.useFadeToFogColor(true);
waterNode.setSpeedReflection(0.02);
waterNode.setSpeedReflection(-0.01);
// setting to default value just to show
waterNode.setWaterPlane(new Plane(new Vector3(0.0, 1.0, 0.0), 40.0));
// Create a quad to use as geometry for the water.
waterQuad = new Quad("waterQuad", 1, 1);
// Hack the quad normals to point up in the y-axis. Since we are manipulating the vertices as
// we move this is more convenient than rotating the quad.
final FloatBuffer normBuf = waterQuad.getMeshData().getNormalBuffer();
normBuf.clear();
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
waterNode.attachChild(waterQuad);
waterNode.addReflectedScene(reflectedNode);
waterNode.setSkybox(skybox);
_root.attachChild(reflectedNode);
_root.attachChild(waterNode);
// Setup cam above water and terrain
final Camera camera = _canvas.getCanvasRenderer().getCamera();
final double height = Math.max(terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ()),
waterNode.getWaterHeight())
+ heightOffset;
if (camera.getLocation().getY() < height) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height, camera.getLocation().getZ()));
}
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() - 20;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
sphere.getSceneHints().setCullHint(
sphere.getSceneHints().getCullHint() == CullHint.Always ? CullHint.Dynamic : CullHint.Always);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.V), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
showUI = !showUI;
if (showUI) {
textNodes.getSceneHints().setCullHint(CullHint.Never);
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
} else {
textNodes.getSceneHints().setCullHint(CullHint.Always);
debugQuadsNode.getSceneHints().setCullHint(CullHint.Always);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.B), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
waterNode.setDoBlurReflection(!waterNode.isDoBlurReflection());
waterNode.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(new Vector3(camera.getLocation().getX() + 5000, camera.getLocation().getY(), camera
.getLocation().getZ()));
updateText();
}
}));
}
/**
* Sets the vertex coords of the quad.
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
*/
private void setVertexCoords(final double x, final double y, final double z) {
final FloatBuffer vertBuf = waterQuad.getMeshData().getVertexBuffer();
vertBuf.clear();
vertBuf.put((float) (x - farPlane)).put((float) y).put((float) (z - farPlane));
vertBuf.put((float) (x - farPlane)).put((float) y).put((float) (z + farPlane));
vertBuf.put((float) (x + farPlane)).put((float) y).put((float) (z + farPlane));
vertBuf.put((float) (x + farPlane)).put((float) y).put((float) (z - farPlane));
}
/**
* Sets the texture coords of the quad.
*
* @param buffer
* the buffer
* @param x
* the x
* @param y
* the y
* @param textureScale
* the texture scale
*/
private void setTextureCoords(final int buffer, double x, double y, double textureScale) {
x *= textureScale * 0.5f;
y *= textureScale * 0.5f;
textureScale = farPlane * textureScale;
FloatBuffer texBuf;
texBuf = waterQuad.getMeshData().getTextureBuffer(buffer);
texBuf.clear();
texBuf.put((float) x).put((float) (textureScale + y));
texBuf.put((float) x).put((float) y);
texBuf.put((float) (textureScale + x)).put((float) y);
texBuf.put((float) (textureScale + x)).put((float) (textureScale + y));
}
/**
* Builds the sky box.
*/
private Skybox buildSkyBox() {
final Skybox skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
return skybox;
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("Heightmap size: " + SIZE + "x" + SIZE);
_exampleInfo[1].setText("Spec: One meter per heightmap value");
_exampleInfo[2].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() + " m/s");
_exampleInfo[3].setText("[U] Update terrain: " + updateTerrain);
_exampleInfo[4].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[5].setText("[P] Toggle showing a sphere that follows the ground using picking: "
+ (sphere.getSceneHints().getCullHint() != CullHint.Always));
_exampleInfo[6].setText("[B] Blur reflection: " + waterNode.isDoBlurReflection());
_exampleInfo[7].setText("[V] Show/Hide UI");
}
/**
* Creates the debug quads.
*/
private void createDebugQuads() {
debugQuadsNode = new Node("quadNode");
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
final double quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10;
Quad debugQuad = new Quad("reflectionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
TextureState ts = new TextureState();
ts.setTexture(waterNode.getTextureReflect());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 1.0, 1.0);
debugQuadsNode.attachChild(debugQuad);
if (waterNode.getTextureRefract() != null) {
debugQuad = new Quad("refractionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
ts = new TextureState();
ts.setTexture(waterNode.getTextureRefract());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 2.1, 1.0);
debugQuadsNode.attachChild(debugQuad);
}
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.nio.FloatBuffer;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.effect.water.WaterNode;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.providers.procedural.ProceduralTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Plane;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.math.functions.FbmFunction3D;
import com.ardor3d.math.functions.Function3D;
import com.ardor3d.math.functions.Functions;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing how to combine the terrain and water systems. Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.TerrainWaterExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_TerrainWaterExample.jpg", //
maxHeapMemory = 128)
public class TerrainWaterExample extends ExampleBase {
private final int SIZE = 2048;
private Terrain terrain;
private boolean updateTerrain = true;
private final float farPlane = 3500.0f;
private final float heightOffset = 3.0f;
/** The water instance taking care of the water rendering. */
private WaterNode waterNode;
private boolean aboveWater = true;
/** Node containing debug quads for showing waternode render textures. */
private Node debugQuadsNode;
/** The quad used as geometry for the water. */
private Quad waterQuad;
private boolean groundCamera = false;
private Camera terrainCamera;
private Skybox skybox;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final double textureScale = 0.05;
private FogState fogState;
private boolean showUI = true;
private final Ray3 pickRay = new Ray3();
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[8];
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(final String[] args) {
start(TerrainWaterExample.class);
}
private double counter = 0;
private int frames = 0;
/**
* Update the PassManager, skybox, camera position, etc.
*
* @param timer
* the application timer
*/
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ())
+ heightOffset;
if (groundCamera || camera.getLocation().getY() < height) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height, camera.getLocation().getZ()));
}
if (aboveWater && camera.getLocation().getY() < waterNode.getWaterHeight()) {
fogState.setStart(-1000f);
fogState.setEnd(farPlane / 10f);
fogState.setColor(new ColorRGBA(0.0f, 0.0f, 0.1f, 1.0f));
aboveWater = false;
} else if (!aboveWater && camera.getLocation().getY() >= waterNode.getWaterHeight()) {
fogState.setStart(farPlane / 2.0f);
fogState.setEnd(farPlane);
fogState.setColor(new ColorRGBA(0.96f, 0.97f, 1.0f, 1.0f));
aboveWater = true;
}
if (updateTerrain) {
terrainCamera.set(camera);
}
skybox.setTranslation(camera.getLocation());
counter += timer.getTimePerFrame();
frames++;
if (counter > 1) {
final double fps = (frames / counter);
counter = 0;
frames = 0;
System.out.printf("%7.1f FPS\n", fps);
}
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
// XXX: maybe change the color of the ball for valid vs. invalid?
}
}
final Vector3 transVec = new Vector3(camera.getLocation().getX(), waterNode.getWaterHeight(), camera
.getLocation().getZ());
setTextureCoords(0, transVec.getX(), -transVec.getZ(), textureScale);
// vertex coords
setVertexCoords(transVec.getX(), transVec.getY(), transVec.getZ());
waterNode.update(timer.getTimePerFrame());
}
/**
* Render example.
*
* @param renderer
* the renderer
*/
@Override
protected void renderExample(final Renderer renderer) {
super.renderExample(renderer);
if (debugQuadsNode == null) {
createDebugQuads();
_root.attachChild(debugQuadsNode);
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Terrain + Water - Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 100, 0));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(0, 100, 1), Vector3.UNIT_Y);
_canvas.getCanvasRenderer().getCamera().setFrustumPerspective(
65.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
_controlHandle.setMoveSpeed(50);
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
fogState = new FogState();
fogState.setStart(farPlane / 2.0f);
fogState.setEnd(farPlane);
fogState.setColor(new ColorRGBA(0.96f, 0.97f, 1.0f, 1.0f));
fogState.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fogState);
// add our sphere, but have it off for now.
sphere.getSceneHints().setCullHint(CullHint.Always);
sphere.getSceneHints().setAllPickingHints(false);
_root.attachChild(sphere);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
final double scale = 1.0 / 4000.0;
Function3D functionTmp = new FbmFunction3D(Functions.simplexNoise(), 9, 0.5, 0.5, 3.14);
functionTmp = Functions.clamp(functionTmp, -1.2, 1.2);
final Function3D function = Functions.scaleInput(functionTmp, scale, scale, 1);
final TerrainDataProvider terrainDataProvider = new ProceduralTerrainDataProvider(function, new Vector3(1,
200, 1), -1.2f, 1.2f);
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
} catch (final Exception ex1) {
ex1.printStackTrace();
}
final Node reflectedNode = new Node("reflectNode");
reflectedNode.attachChild(terrain);
skybox = buildSkyBox();
skybox.getSceneHints().setAllPickingHints(false);
reflectedNode.attachChild(skybox);
final Camera cam = _canvas.getCanvasRenderer().getCamera();
// Create a new WaterNode with refraction enabled.
waterNode = new WaterNode(cam, 2, false, true);
// Setup textures to use for the water.
waterNode.setNormalMapTextureString("images/water/normalmap3.dds");
waterNode.setDudvMapTextureString("images/water/dudvmap.png");
waterNode.setFallbackMapTextureString("images/water/water2.png");
waterNode.useFadeToFogColor(true);
waterNode.setSpeedReflection(0.02);
waterNode.setSpeedReflection(-0.01);
// setting to default value just to show
waterNode.setWaterPlane(new Plane(new Vector3(0.0, 1.0, 0.0), 40.0));
// Create a quad to use as geometry for the water.
waterQuad = new Quad("waterQuad", 1, 1);
// Hack the quad normals to point up in the y-axis. Since we are manipulating the vertices as
// we move this is more convenient than rotating the quad.
final FloatBuffer normBuf = waterQuad.getMeshData().getNormalBuffer();
normBuf.clear();
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
normBuf.put(0).put(1).put(0);
waterNode.attachChild(waterQuad);
waterNode.addReflectedScene(reflectedNode);
waterNode.setSkybox(skybox);
_root.attachChild(reflectedNode);
_root.attachChild(waterNode);
// Setup cam above water and terrain
final Camera camera = _canvas.getCanvasRenderer().getCamera();
final double height = Math.max(terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ()),
waterNode.getWaterHeight())
+ heightOffset;
if (camera.getLocation().getY() < height) {
camera.setLocation(new Vector3(camera.getLocation().getX(), height, camera.getLocation().getZ()));
}
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() - 20;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
sphere.getSceneHints().setCullHint(
sphere.getSceneHints().getCullHint() == CullHint.Always ? CullHint.Dynamic : CullHint.Always);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.V), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
showUI = !showUI;
if (showUI) {
textNodes.getSceneHints().setCullHint(CullHint.Never);
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
} else {
textNodes.getSceneHints().setCullHint(CullHint.Always);
debugQuadsNode.getSceneHints().setCullHint(CullHint.Always);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.B), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
waterNode.setDoBlurReflection(!waterNode.isDoBlurReflection());
waterNode.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(new Vector3(camera.getLocation().getX() + 5000, camera.getLocation().getY(), camera
.getLocation().getZ()));
updateText();
}
}));
}
/**
* Sets the vertex coords of the quad.
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
*/
private void setVertexCoords(final double x, final double y, final double z) {
final FloatBuffer vertBuf = waterQuad.getMeshData().getVertexBuffer();
vertBuf.clear();
vertBuf.put((float) (x - farPlane)).put((float) y).put((float) (z - farPlane));
vertBuf.put((float) (x - farPlane)).put((float) y).put((float) (z + farPlane));
vertBuf.put((float) (x + farPlane)).put((float) y).put((float) (z + farPlane));
vertBuf.put((float) (x + farPlane)).put((float) y).put((float) (z - farPlane));
}
/**
* Sets the texture coords of the quad.
*
* @param buffer
* the buffer
* @param x
* the x
* @param y
* the y
* @param textureScale
* the texture scale
*/
private void setTextureCoords(final int buffer, double x, double y, double textureScale) {
x *= textureScale * 0.5f;
y *= textureScale * 0.5f;
textureScale = farPlane * textureScale;
FloatBuffer texBuf;
texBuf = waterQuad.getMeshData().getTextureBuffer(buffer);
texBuf.clear();
texBuf.put((float) x).put((float) (textureScale + y));
texBuf.put((float) x).put((float) y);
texBuf.put((float) (textureScale + x)).put((float) y);
texBuf.put((float) (textureScale + x)).put((float) (textureScale + y));
}
/**
* Builds the sky box.
*/
private Skybox buildSkyBox() {
final Skybox skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
return skybox;
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("Heightmap size: " + SIZE + "x" + SIZE);
_exampleInfo[1].setText("Spec: One meter per heightmap value");
_exampleInfo[2].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() + " m/s");
_exampleInfo[3].setText("[U] Update terrain: " + updateTerrain);
_exampleInfo[4].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[5].setText("[P] Toggle showing a sphere that follows the ground using picking: "
+ (sphere.getSceneHints().getCullHint() != CullHint.Always));
_exampleInfo[6].setText("[B] Blur reflection: " + waterNode.isDoBlurReflection());
_exampleInfo[7].setText("[V] Show/Hide UI");
}
/**
* Creates the debug quads.
*/
private void createDebugQuads() {
debugQuadsNode = new Node("quadNode");
debugQuadsNode.getSceneHints().setCullHint(CullHint.Never);
final double quadSize = _canvas.getCanvasRenderer().getCamera().getWidth() / 10;
Quad debugQuad = new Quad("reflectionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
TextureState ts = new TextureState();
ts.setTexture(waterNode.getTextureReflect());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 1.0, 1.0);
debugQuadsNode.attachChild(debugQuad);
if (waterNode.getTextureRefract() != null) {
debugQuad = new Quad("refractionQuad", quadSize, quadSize);
debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
debugQuad.getSceneHints().setCullHint(CullHint.Never);
debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
ts = new TextureState();
ts.setTexture(waterNode.getTextureRefract());
debugQuad.setRenderState(ts);
debugQuad.setTranslation(quadSize * 0.6, quadSize * 2.1, 1.0);
debugQuadsNode.attachChild(debugQuad);
}
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ZupTerrainExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ZupTerrainExample.java index 29ff14a..b9369d3 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ZupTerrainExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ZupTerrainExample.java @@ -1 +1 @@ -/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.MathUtils;
import com.ardor3d.math.Quaternion;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' using Z-Up. This is done by flipping the
* terrain system from y-up to z-up and inverting interactions with it back to the y-up terrain coordinate space.
* Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ZupTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ZupTerrainExample.jpg", //
maxHeapMemory = 128)
public class ZupTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 10000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
private Skybox skybox;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
public static void main(final String[] args) {
ExampleBase.start(ZupTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(Vector3.NEG_UNIT_Z);
final PrimitivePickResults pickResultsCam = new PrimitivePickResults();
pickResultsCam.setCheckDistance(true);
PickingUtil.findPick(terrain, pickRay, pickResultsCam);
if (pickResultsCam.getNumber() != 0) {
final Vector3 intersectionPoint = pickResultsCam.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
final double height = intersectionPoint.getZ();
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getZ() < height + 5)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), camera.getLocation().getY(), height + 5));
}
}
if (updateTerrain) {
terrainCamera.set(camera);
}
skybox.setTranslation(camera.getLocation());
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
// XXX: maybe change the color of the ball for valid vs. invalid?
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Z-up Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 0, 300));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, -1, 300), Vector3.UNIT_Z);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setUpAxis(Vector3.UNIT_Z);
_controlHandle.setMoveSpeed(200);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
final int SIZE = 2048;
final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.5f);
raw.setHeightRange(0.2f);
final float[] heightMap = raw.getHeightData();
final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
1, 300, 1));
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
terrain.setRotation(new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_X));
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
skybox = buildSkyBox();
skybox.getSceneHints().setAllPickingHints(false);
_root.attachChild(skybox);
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() + 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() - 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Builds the sky box.
*/
private Skybox buildSkyBox() {
final Skybox skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
skybox.setRotation(new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_X));
return skybox;
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file +/**
* Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.example.terrain;
import java.util.concurrent.Callable;
import com.ardor3d.example.ExampleBase;
import com.ardor3d.example.Purpose;
import com.ardor3d.extension.terrain.client.Terrain;
import com.ardor3d.extension.terrain.client.TerrainBuilder;
import com.ardor3d.extension.terrain.client.TerrainDataProvider;
import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator;
import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider;
import com.ardor3d.framework.Canvas;
import com.ardor3d.framework.CanvasRenderer;
import com.ardor3d.image.Texture;
import com.ardor3d.input.Key;
import com.ardor3d.input.logical.InputTrigger;
import com.ardor3d.input.logical.KeyPressedCondition;
import com.ardor3d.input.logical.TriggerAction;
import com.ardor3d.input.logical.TwoInputStates;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.light.DirectionalLight;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.MathUtils;
import com.ardor3d.math.Quaternion;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.CullState;
import com.ardor3d.renderer.state.FogState;
import com.ardor3d.renderer.state.FogState.DensityFunction;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.extension.Skybox;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.shape.Sphere;
import com.ardor3d.ui.text.BasicText;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.ReadOnlyTimer;
import com.ardor3d.util.TextureManager;
/**
* Example showing the Geometry Clipmap Terrain system with 'MegaTextures' using Z-Up. This is done by flipping the
* terrain system from y-up to z-up and inverting interactions with it back to the y-up terrain coordinate space.
* Requires GLSL support.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ZupTerrainExample", //
thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ZupTerrainExample.jpg", //
maxHeapMemory = 128)
public class ZupTerrainExample extends ExampleBase {
private boolean updateTerrain = true;
private final float farPlane = 10000.0f;
private Terrain terrain;
private final Sphere sphere = new Sphere("sp", 16, 16, 1);
private final Ray3 pickRay = new Ray3();
private boolean groundCamera = false;
private Camera terrainCamera;
private Skybox skybox;
/** Text fields used to present info about the example. */
private final BasicText _exampleInfo[] = new BasicText[5];
public static void main(final String[] args) {
ExampleBase.start(ZupTerrainExample.class);
}
@Override
protected void updateExample(final ReadOnlyTimer timer) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
// Make sure camera is above terrain
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(Vector3.NEG_UNIT_Z);
final PrimitivePickResults pickResultsCam = new PrimitivePickResults();
pickResultsCam.setCheckDistance(true);
PickingUtil.findPick(terrain, pickRay, pickResultsCam);
if (pickResultsCam.getNumber() != 0) {
final Vector3 intersectionPoint = pickResultsCam.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
final double height = intersectionPoint.getZ();
if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getZ() < height + 5)) {
camera.setLocation(new Vector3(camera.getLocation().getX(), camera.getLocation().getY(), height + 5));
}
}
if (updateTerrain) {
terrainCamera.set(camera);
}
skybox.setTranslation(camera.getLocation());
// if we're picking...
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
// Set up our pick ray
pickRay.setOrigin(camera.getLocation());
pickRay.setDirection(camera.getDirection());
// do pick and move the sphere
final PrimitivePickResults pickResults = new PrimitivePickResults();
pickResults.setCheckDistance(true);
PickingUtil.findPick(_root, pickRay, pickResults);
if (pickResults.getNumber() != 0) {
final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord()
.getIntersectionPoint(0);
sphere.setTranslation(intersectionPoint);
// XXX: maybe change the color of the ball for valid vs. invalid?
}
}
}
/**
* Initialize pssm pass and scene.
*/
@Override
protected void initExample() {
// Setup main camera.
_canvas.setTitle("Z-up Terrain Example");
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 0, 300));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(1, -1, 300), Vector3.UNIT_Z);
_canvas.getCanvasRenderer()
.getCamera()
.setFrustumPerspective(
70.0,
(float) _canvas.getCanvasRenderer().getCamera().getWidth()
/ _canvas.getCanvasRenderer().getCamera().getHeight(), 1.0f, farPlane);
final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer();
final RenderContext renderContext = canvasRenderer.getRenderContext();
final Renderer renderer = canvasRenderer.getRenderer();
GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
renderer.setBackgroundColor(ColorRGBA.GRAY);
return null;
}
});
_controlHandle.setUpAxis(Vector3.UNIT_Z);
_controlHandle.setMoveSpeed(200);
setupDefaultStates();
sphere.getSceneHints().setAllPickingHints(false);
sphere.getSceneHints().setCullHint(CullHint.Always);
_root.attachChild(sphere);
try {
// Keep a separate camera to be able to freeze terrain update
final Camera camera = _canvas.getCanvasRenderer().getCamera();
terrainCamera = new Camera(camera);
final int SIZE = 2048;
final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.5f);
raw.setHeightRange(0.2f);
final float[] heightMap = raw.getHeightData();
final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
1, 300, 1));
terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();
terrain.setRotation(new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_X));
_root.attachChild(terrain);
} catch (final Exception ex1) {
System.out.println("Problem setting up terrain...");
ex1.printStackTrace();
}
skybox = buildSkyBox();
skybox.getSceneHints().setAllPickingHints(false);
_root.attachChild(skybox);
// Setup labels for presenting example info.
final Node textNodes = new Node("Text");
_root.attachChild(textNodes);
textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);
final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2;
for (int i = 0; i < _exampleInfo.length; i++) {
_exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16);
_exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0));
textNodes.attachChild(_exampleInfo[i]);
}
textNodes.updateGeometricState(0.0);
updateText();
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
updateTerrain = !updateTerrain;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(5);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(50);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(400);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
_controlHandle.setMoveSpeed(1000);
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
groundCamera = !groundCamera;
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) {
sphere.getSceneHints().setCullHint(CullHint.Always);
} else if (sphere.getSceneHints().getCullHint() == CullHint.Always) {
sphere.getSceneHints().setCullHint(CullHint.Dynamic);
}
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug());
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.reloadShader();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2);
terrain.reloadShader();
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SEVEN), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() + 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.EIGHT), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX() - 500.0, camera.getLocation().getY(), camera
.getLocation().getZ());
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NINE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() + 500.0);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final Camera camera = _canvas.getCanvasRenderer().getCamera();
camera.setLocation(camera.getLocation().getX(), camera.getLocation().getY(), camera.getLocation()
.getZ() - 500.0);
}
}));
}
private void setupDefaultStates() {
_lightState.detachAll();
final DirectionalLight dLight = new DirectionalLight();
dLight.setEnabled(true);
dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
_lightState.attach(dLight);
_lightState.setEnabled(true);
final CullState cs = new CullState();
cs.setEnabled(true);
cs.setCullFace(CullState.Face.Back);
_root.setRenderState(cs);
final FogState fs = new FogState();
fs.setStart(farPlane / 2.0f);
fs.setEnd(farPlane);
fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
fs.setDensityFunction(DensityFunction.Linear);
_root.setRenderState(fs);
}
/**
* Builds the sky box.
*/
private Skybox buildSkyBox() {
final Skybox skybox = new Skybox("skybox", 10, 10, 10);
final String dir = "images/skybox/";
final Texture north = TextureManager
.load(dir + "1.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture south = TextureManager
.load(dir + "3.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture east = TextureManager.load(dir + "2.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture west = TextureManager.load(dir + "4.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture up = TextureManager.load(dir + "6.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
final Texture down = TextureManager.load(dir + "5.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
skybox.setRotation(new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_X));
return skybox;
}
/**
* Update text information.
*/
private void updateText() {
_exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h");
_exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic));
_exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly"));
_exampleInfo[3].setText("[J] Regenerate heightmap/texture");
_exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain);
}
}
\ No newline at end of file diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMFontLoader.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMFontLoader.java index 73be066..0803578 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMFontLoader.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMFontLoader.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -25,7 +25,7 @@ public class BMFontLoader { static Logger logger = Logger.getLogger(BMFontLoader.class.getName()); static BMFontLoader s_instance = null; - final ArrayList<BMFont> _fontList = new ArrayList<BMFont>(); + final ArrayList<BMFont> _fontList = new ArrayList<>(); public static List<BMFont> allFonts() { return instance()._fontList; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMTextExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMTextExample.java index dc2b588..96ba209 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMTextExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMTextExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -184,6 +184,7 @@ public class BMTextExample extends ExampleBase { final int changeInterval = 20000; final List<BMFont> fonts = BMFontLoader.allFonts(); + @Override public void update(final double time, final BMText text) { final int t = (int) (System.currentTimeMillis() / changeInterval); final int index = t % fonts.size(); @@ -216,6 +217,7 @@ public class BMTextExample extends ExampleBase { final SpatialController<Node> nodeMover = new SpatialController<Node>() { Matrix3 rot = new Matrix3(); + @Override public void update(final double time, final Node caller) { final long t = System.currentTimeMillis(); final double s = Math.cos(t * Math.PI / 10000.0); diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/RotatingUIExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/RotatingUIExample.java index b66b7a2..ae76e71 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/RotatingUIExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/RotatingUIExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -94,6 +94,7 @@ public class RotatingUIExample extends ExampleBase { rotatingLabel.addController(new SpatialController<UICheckBox>() { double angle = 0; + @Override public void update(final double time, final UICheckBox caller) { angle += time * 10; angle %= 360; diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/SimpleUIExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/SimpleUIExample.java index 8c756e5..8cf69fc 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/SimpleUIExample.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/SimpleUIExample.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -90,6 +90,7 @@ public class SimpleUIExample extends ExampleBase { private double angle = 0; private final Vector3 axis = new Vector3(1, 1, 0.5f).normalizeLocal(); + @Override public void update(final double time, final Box caller) { angle += time * 50; angle %= 360; @@ -171,6 +172,7 @@ public class SimpleUIExample extends ExampleBase { tfPassword.setLayoutData(GridLayoutData.WrapAndGrow); final UIButton btLogin = new UIButton("login"); btLogin.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { System.out.println("login as user: " + tfName.getText() + " password: " + tfPassword.getText()); } @@ -202,6 +204,7 @@ public class SimpleUIExample extends ExampleBase { chatButton.setLayoutData(BorderLayoutData.EAST); final ActionListener actionListener = new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { applyChat(historyArea, chatField); } @@ -271,6 +274,7 @@ public class SimpleUIExample extends ExampleBase { final UILabel lSliderValue = new UILabel("0"); lSliderValue.setLayoutData(GridLayoutData.SpanAndWrap(2)); slider.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { lSliderValue.setText(String.valueOf(slider.getValue())); } @@ -333,6 +337,7 @@ public class SimpleUIExample extends ExampleBase { multiImgBD.addImage(minute); clockPanel.addController(new SpatialController<Spatial>() { + @Override public void update(final double time, final Spatial caller) { final double angle1 = _timer.getTimeInSeconds() % MathUtils.TWO_PI; final double angle2 = (_timer.getTimeInSeconds() / 12.) % MathUtils.TWO_PI; diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/i18n/example_descriptions.properties b/ardor3d-examples/src/main/resources/com/ardor3d/example/i18n/example_descriptions.properties index fad9b46..9b681f3 100644 --- a/ardor3d-examples/src/main/resources/com/ardor3d/example/i18n/example_descriptions.properties +++ b/ardor3d-examples/src/main/resources/com/ardor3d/example/i18n/example_descriptions.properties @@ -1,12 +1,10 @@ com.ardor3d.example.NotSet=... com.ardor3d.example.basic.BoxExample=A simple example showing a textured and lit box spinning. -com.ardor3d.example.basic.JoglBasicExample=This jogl-based example is meant to show how to use Ardor3D at the most primitive level. -com.ardor3d.example.basic.LineExample=A demonstration of antialising on a Line object. -com.ardor3d.example.basic.LwjglBasicExample=This lwjgl-based example is meant to show how to use Ardor3D at the most primitive level. -com.ardor3d.example.basic.LwjglHeadlessExample=A demonstration of the LwjglHeadlessCanvas class, which is canvas used to draw Scene data to an offscreen target. +com.ardor3d.example.basic.JoglBasicExample=This JOGL-based example is meant to show how to use Ardor3D at the most primitive level. It uses NEWT. +com.ardor3d.example.basic.LineExample=A demonstration of anti-aliasing on a Line object. com.ardor3d.example.basic.MatrixLookAtExample=A demonstration of the MathUtils.matrixLookAt function, which constructs a rotation matrix used to orient a source position to a given target position. -com.ardor3d.example.basic.MouseManagerExample=A demonstration of the MouseManager class, which is used to control properties (e.g. curser, location) of the native mouse. +com.ardor3d.example.basic.MouseManagerExample=A demonstration of the MouseManager class, which is used to control properties (e.g. cursor, location) of the native mouse. com.ardor3d.example.basic.OrbitCamExample=A demonstration of the OrbitCamControl, a controller that can position a camera in an orbit around a given target - in this case, a teapot. com.ardor3d.example.basic.RTTShaderExample=A simple example showing use of shaders inside of RTT. com.ardor3d.example.basic.ShapesExample=A display of intrinsic shapes (e.g. Box, Cone, Torus). @@ -15,12 +13,14 @@ com.ardor3d.example.benchmark.ball.BubbleMarkExample=The famous BubbleMark UI te com.ardor3d.example.benchmark.ball.BubbleMarkUIExample=The famous BubbleMark UI test, recreated using Ardor3D UI components. com.ardor3d.example.canvas.JoglAwtExample=This examples demonstrates how to render OpenGL (via JOGL) on a AWT canvas. com.ardor3d.example.canvas.JoglAwtDesktopExample=This examples demonstrates how to render OpenGL (via JOGL) inside JDesktop internal frames. +com.ardor3d.example.canvas.JoglNewtAwtExample=This example demonstrates how to render OpenGL (via JOGL) on a NEWT AWT canvas. +com.ardor3d.example.canvas.JoglNewtSwtExample=This example demonstrates how to render OpenGL (via JOGL) on a NEWT SWT canvas. com.ardor3d.example.canvas.JoglSwtExample=This examples demonstrates how to render OpenGL (via JOGL) in a SWT canvas. -com.ardor3d.example.canvas.LwjglAwtExample=This examples demonstrates how to render OpenGL (via LWJGL) on a AWT canvas. -com.ardor3d.example.canvas.LwjglSwtExample=This examples demonstrates how to render OpenGL (via LWJGL) on a SWT canvas. -com.ardor3d.example.collision.CollisionTreeExample=A demonstration of finding and retrieving collisions between two nodes +com.ardor3d.example.canvas.JoglSwingExample=This example demonstrates how to render OpenGL (via JOGL) on a Swing panel. +com.ardor3d.example.collision.CollisionTreeExample=A demonstration of finding and retrieving collisions between two nodes. com.ardor3d.example.collision.ManyCollisionsExample=A demonstration on how to determine if collisions exist between two nodes. com.ardor3d.example.effect.BloomExample=A simple example showing bloom. +com.ardor3d.example.effect.ExtrusionExample=A demonstration of extrusion, showing how a set of point can be converted into a 3d shape. com.ardor3d.example.effect.NewDynamicSmokerExample=Another particle demonstration, this one showing a smoking rocket following the cursor around the screen. com.ardor3d.example.effect.ParallelSplitShadowMapExample=Example showing the parallel split shadow mapping technique. Requires GLSL support. com.ardor3d.example.effect.ParticleRampExample=A demonstration of the ParticleSystem and RampEntry classes; which controls how an emitter's properties (e.g. size, color) change over time. @@ -32,11 +32,14 @@ com.ardor3d.example.effect.ProjectedGridWaterExample=A demonstration of the Wate com.ardor3d.example.effect.QuadImposterExample=A demonstration of the QuadImposterNode class; which sets the texture level of detail for a Node. com.ardor3d.example.effect.TrailExample=An example of using TrailMesh. com.ardor3d.example.effect.WaterExample=A demonstration of the WaterNode class; which handles rendering of a water effect on all of it's children. +com.ardor3d.example.interact.InteractExample=An example illustrating the use of the interact framework +com.ardor3d.example.interact.TerrainInteractExample=Example showing interact widgets with the Geometry Clipmap Terrain system. Requires GLSL support. com.ardor3d.example.interpolation.CurveInterpolationControllerExample=A demonstration of the CurveInterpolationController class; which will move/translate a Node each epoch through a set of 3D coordinates (via spline). com.ardor3d.example.interpolation.DefaultColorInterpolationControllerExample=A demonstration of the DefaultColorInterpolationController class; which updates the default colour each epoch by interpolating between the given colours. com.ardor3d.example.interpolation.LinearVector3InterpolationControllerExample=A demonstration of the LinearVector3InterpolationController class; which will move a Node through a set of 3D coordinates (via linear interpolation). com.ardor3d.example.interpolation.QuaternionInterpolationControllerExample=A demonstration of the QuaternionInterpolationController class; which will rotate a Node each epoch by interpolating between the given quaternions. com.ardor3d.example.pipeline.AnimationBlinnPhongExample=Illustrates gpu skinning with normal map, specular map and diffuse coloring. +com.ardor3d.example.pipeline.AnimationCopyExample=Illustrates loading several animations from Collada and arranging them in an animation state machine. com.ardor3d.example.pipeline.AnimationDemoExample=Illustrates loading several animations from Collada and arranging them in a controllable blend tree. com.ardor3d.example.pipeline.AnimationStateExample=Adds play/pause/stop controls to AnimationDemoExample. com.ardor3d.example.pipeline.ColladaExample=Illustrates loading a model from Collada. If the model also contains an animation, the animation is played as well. @@ -45,6 +48,7 @@ com.ardor3d.example.pipeline.ExportImportExample=A demonstration of the BinaryIm com.ardor3d.example.pipeline.PrimitiveSkeletonExample=A demonstration of combining the skeletal animation classes with OpenGL Shading Language. com.ardor3d.example.pipeline.SimpleColladaExample=Simplest example of loading a Collada model. com.ardor3d.example.pipeline.SimpleMd2Example=Simplest example of loading a model in MD2 format. +com.ardor3d.example.pipeline.SimpleMd3Example=Simplest example of loading a model in MD3 format. com.ardor3d.example.pipeline.SimpleObjExample=Simplest example of loading a Wavefront OBJ model. com.ardor3d.example.renderer.BillboardNodeExample=Illustrates the BillboardNode class; which defines a node that always orients towards the camera. com.ardor3d.example.renderer.BillboardNodeZExample=Illustrates the BillboardNode class - but using a Z-up camera. @@ -64,21 +68,25 @@ com.ardor3d.example.renderer.MultiPassTextureExample=Borrows from the BoxExample com.ardor3d.example.renderer.MultiStripExample=Illustrates mesh with several primitives (i.e. strip, quad, triangle). com.ardor3d.example.renderer.PointCubeExample=A more complex example of using geometry shaders. Requires support for geometry shaders (obviously). com.ardor3d.example.renderer.PointsExample=A simple demonstration of displaying numerous Point in three-dimensions. +com.ardor3d.example.renderer.RenderEffectsExample=A simple example illustrating use of RenderEffects. com.ardor3d.example.renderer.RenderQueueExample=Illustrates the Render Queue, which controls how Nodes are drawn when overlapping occurs. +com.ardor3d.example.renderer.RenderTextureCubeMapExample=Demonstrates rendering to texture, where the texture is a cubemap. com.ardor3d.example.renderer.RenderTextureSideBySideExample=Illustrates the TextureRenderer class; which renders a scene to a buffer and copying it to a texture. com.ardor3d.example.renderer.SphereComparisonsExample=Simple example showing differences between GeoSphere and Sphere and their various texture mappings. com.ardor3d.example.renderer.StereoExample=Illustrates the StereoCamera class, which allows for your stereo viewing pleasures. com.ardor3d.example.renderer.TexCombineExample=Shows interpolated textures using texture combine. com.ardor3d.example.renderer.Texture3DExample=Very simple example showing use of a Texture3D texture. -com.ardor3d.example.renderer.TextureClipmapExample=Illustrates the TextureClipmap class, which prohibits the display of textures outside a defined region. com.ardor3d.example.renderer.TextureProjectionExample=Illustrates the TextureProjector class, which projects a two-dimensional texture onto a three-dimensional surface. com.ardor3d.example.renderer.UpdateTextureExample=A demonstration of procedurally updating a texture. com.ardor3d.example.renderer.VBOSpeedExample=Illustrates the DataMode class, which describe how we prefer data to be sent to the card. com.ardor3d.example.renderer.ViewportExample=Illustrates the Camera class, which represents a view into a 3d scene and how that view should map to a 2D rendering surface. com.ardor3d.example.renderer.WireframeGeometryShaderExample=An example of using geometry shaders. Requires support for geometry shaders (obviously). +com.ardor3d.example.renderer.utils.atlas.AtlasExample=Example showing how to use the TexturePacker to create a texture atlas. Also shows the benefits of using it together with the MeshCombiner. +com.ardor3d.example.renderer.utils.atlas.AtlasExampleMultiTextured=Example showing how to use the TexturePacker to create a texture atlas. Also shows the benefits of using it together with the MeshCombiner. com.ardor3d.example.terrain.ArrayTerrainExample=Example showing the Geometry Clipmap Terrain system with 'MegaTextures' where the terrain data is provided from a float array. Requires GLSL support. com.ardor3d.example.terrain.ImageMapTerrainExample=Example showing the Geometry Clipmap Terrain system with 'MegaTextures' where the terrain data is provided from a float array populated from a heightmap generated from an Image. Requires GLSL support. com.ardor3d.example.terrain.InMemoryTerrainExample=Example showing the Geometry Clipmap Terrain system with 'MegaTextures' streaming from an in-memory data source. Requires GLSL support. +com.ardor3d.example.terrain.MountainShadowTerrainExample=Example showing the Geometry Clipmap Terrain system with 'MegaTextures' where the terrain data is provided from a float array populated from a heightmap generated from an Image. Requires GLSL support. com.ardor3d.example.terrain.ProceduralTerrainExample=Example showing the Geometry Clipmap Terrain system with 'MegaTextures' using content procedurally generated on-the-fly. Requires GLSL support. com.ardor3d.example.terrain.ShadowedTerrainExample=Example showing the Geometry Clipmap Terrain system combined with PSSM. (a bit experimental) Requires GLSL support. com.ardor3d.example.terrain.ShapesPlusProceduralTerrainExample=Example showing the Geometry Clipmap Terrain system with 'MegaTextures'. We merge AWT drawing with the terrain texture in real time. Requires GLSL support. diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/md3/barrel1.jpg b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/md3/barrel1.jpg Binary files differnew file mode 100644 index 0000000..9bda495 --- /dev/null +++ b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/md3/barrel1.jpg diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/md3/barrel1.md3 b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/md3/barrel1.md3 Binary files differnew file mode 100644 index 0000000..1a8ce49 --- /dev/null +++ b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/md3/barrel1.md3 diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/md3/barrel1.qc b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/md3/barrel1.qc new file mode 100644 index 0000000..54b95f6 --- /dev/null +++ b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/md3/barrel1.qc @@ -0,0 +1,19 @@ +// Quake III Arena MD3 control file, generated by MilkShape 3D +// +$model "models/furniture/barrel1.md3" +// reference frame +//$frames -1 -1 +// frame 1-30 +$frames 1 30 +$flags 0 +$numskins 0 + +// you can have one or no parent tag + +// tags + +// meshes (surfaces) +$mesh "barrel" +$skin "models/furniture/barrel1.jpg" +$flags 0 + diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/ply/big_spider.ply b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/ply/big_spider.ply new file mode 100644 index 0000000..96b77c4 --- /dev/null +++ b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/ply/big_spider.ply @@ -0,0 +1,13965 @@ +ply +format ascii 1.0 +element vertex 4670 +property float32 x +property float32 y +property float32 z +element face 9286 +property list uint8 int32 vertex_indices +end_header +1.8057 2.0344 1.6154 +1.8145 2.0406 1.5811 +1.8233 2.0216 1.6105 +1.849 2.0394 1.6526 +1.8312 2.0523 1.6575 +1.8711 2.0802 1.7022 +1.8815 2.0726 1.6992 +1.9169 2.1004 1.7385 +1.905 2.104 1.7444 +1.903 2.1026 1.7601 +1.9157 2.0932 1.7563 +1.9205 2.0865 1.77 +1.9009 2.1011 1.7758 +1.9884 2.1623 1.8924 +2.003 2.1513 1.8879 +2.0806 2.2269 2.0045 +2.0825 2.2282 2.0264 +2.1001 2.2144 2.0203 +2.1097 2.2095 2.0395 +2.0843 2.2295 2.0483 +2.1748 2.2929 2.1339 +2.1973 2.2739 2.1247 +2.2993 2.3556 2.1762 +2.2844 2.3696 2.1834 +2.4019 2.4519 2.2117 +2.4121 2.4389 2.2049 +2.4389 2.4393 2.2227 +2.4198 2.4644 2.2357 +2.4379 2.4771 2.2587 +2.4656 2.4399 2.2395 +2.5974 2.5332 2.2219 +2.5739 2.5723 2.2407 +2.7002 2.6608 2.1681 +2.7184 2.6222 2.1522 +2.8259 2.7016 2.0466 +2.8126 2.7395 2.0584 +2.9128 2.8096 1.9201 +2.9236 2.7732 1.9112 +2.9996 2.8296 1.7579 +2.9908 2.8642 1.7639 +3.0408 2.8993 1.5918 +3.0484 2.8668 1.5886 +3.0065 2.8752 1.581 +1.842 2.0242 1.5987 +1.8678 2.042 1.6406 +1.8976 2.0839 1.6847 +1.9289 2.0949 1.7472 +1.9411 2.0892 1.7559 +2.0182 2.1532 1.8769 +2.1048 2.2292 1.9847 +2.118 2.2161 2.0056 +2.1355 2.2119 2.0183 +2.2188 2.2746 2.1024 +2.3117 2.3542 2.1585 +2.4178 2.4346 2.1886 +2.4486 2.4302 2.1914 +2.4794 2.4261 2.1933 +2.6019 2.5134 2.1768 +2.7137 2.5977 2.1141 +2.8135 2.6734 2.0183 +2.9085 2.7444 1.8894 +2.9828 2.8009 1.743 +3.0312 2.8391 1.5809 +1.851 2.041 1.5869 +1.8767 2.0588 1.6285 +1.9177 2.1128 1.7326 +1.9351 2.1068 1.7381 +1.9506 2.1076 1.7417 +2.0251 2.1668 1.8659 +2.1256 2.2323 1.9909 +2.1465 2.2353 1.9971 +2.2268 2.2946 2.0801 +2.3147 2.3664 2.1408 +2.4156 2.4414 2.1723 +2.4433 2.4424 2.16 +2.4712 2.4437 2.147 +2.5847 2.5244 2.1319 +2.6891 2.6018 2.076 +2.7828 2.6714 1.99 +2.8763 2.7401 1.8675 +2.9501 2.795 1.728 +2.9993 2.8324 1.5732 +1.8449 2.0619 1.5821 +1.8706 2.0799 1.6236 +1.8941 2.0963 1.6818 +1.9305 2.1218 1.7343 +1.9436 2.131 1.7359 +2.0197 2.1843 1.8614 +2.091 2.2488 1.9847 +2.1186 2.2535 1.9848 +2.1364 2.266 1.9883 +2.2166 2.3221 2.071 +2.3066 2.3852 2.1336 +2.4069 2.4554 2.1656 +2.4263 2.4689 2.147 +2.4457 2.4826 2.1278 +2.556 2.5598 2.1132 +2.6592 2.632 2.0602 +2.7517 2.6968 1.9782 +2.8458 2.7627 1.8587 +2.9206 2.8151 1.7221 +2.9714 2.8507 1.57 +1.8273 2.0747 1.5869 +1.8529 2.0928 1.6285 +1.8836 2.1039 1.6847 +1.9058 2.1164 1.7385 +1.9179 2.1312 1.7381 +1.924 2.1456 1.7417 +2.0051 2.1953 1.8659 +2.101 2.2674 1.9909 +2.1111 2.286 1.9971 +2.1942 2.3411 2.0801 +2.2917 2.3992 2.1408 +2.3967 2.4684 2.1723 +2.4072 2.494 2.16 +2.4179 2.5198 2.147 +2.5326 2.5988 2.1319 +2.641 2.6705 2.076 +2.7385 2.7347 1.99 +2.835 2.7991 1.8675 +2.9118 2.8497 1.728 +2.9638 2.8831 1.5732 +1.8086 2.0721 1.5987 +1.834 2.0902 1.6406 +1.8675 2.0926 1.6992 +1.9047 2.1295 1.7472 +1.9034 2.1429 1.7559 +1.99 2.1935 1.8769 +2.0767 2.2388 2.0011 +2.0832 2.2657 2.0056 +2.0853 2.2836 2.0183 +2.1727 2.3405 2.1024 +2.2793 2.4006 2.1585 +2.3911 2.4727 2.1886 +2.3975 2.5032 2.1914 +2.4042 2.5336 2.1933 +2.5281 2.6188 2.1768 +2.6456 2.695 2.1141 +2.7508 2.7629 2.0183 +2.8501 2.8279 1.8893 +2.9286 2.8784 1.743 +2.981 2.9108 1.5809 +1.7996 2.0553 1.6105 +1.8252 2.0734 1.6526 +1.8985 2.1176 1.7563 +1.8939 2.1245 1.77 +1.983 2.1798 1.8879 +2.0755 2.2495 2.0203 +2.0742 2.2602 2.0395 +2.1647 2.3205 2.1247 +2.2763 2.3884 2.1762 +2.3932 2.4659 2.2049 +2.4028 2.491 2.2227 +2.4124 2.5159 2.2395 +2.5452 2.6078 2.2219 +2.6702 2.6911 2.1522 +2.7815 2.7649 2.0466 +2.8822 2.8322 1.9112 +2.9613 2.8844 1.7579 +3.0129 2.9175 1.5886 +2.6712 2.7678 1.3512 +2.6887 2.7207 1.2899 +2.6671 2.7781 1.34 +2.5841 2.7334 1.3396 +2.6634 2.7866 1.2952 +2.5864 2.7508 1.2828 +2.4965 2.7147 1.3142 +2.5069 2.7276 1.2697 +2.4259 2.7176 1.2458 +2.4129 2.7137 1.2733 +2.6634 2.7865 1.285 +2.6663 2.7778 1.2398 +2.5924 2.7454 1.2436 +2.518 2.7217 1.23 +2.4366 2.7205 1.2227 +2.6702 2.7674 1.2275 +2.5957 2.7374 1.2326 +2.688 2.7208 1.2179 +2.6035 2.7006 1.221 +2.5192 2.7019 1.2186 +2.7061 2.6738 1.2274 +2.6102 2.6584 1.2295 +2.5155 2.6666 1.2327 +2.7106 2.6623 1.2386 +2.6106 2.6483 1.2389 +2.7147 2.6529 1.2885 +2.6094 2.639 1.2827 +2.509 2.6593 1.2675 +2.7114 2.6626 1.3388 +2.6026 2.6456 1.3268 +2.4981 2.6664 1.3118 +2.7071 2.6742 1.3511 +2.6001 2.6551 1.338 +2.6892 2.721 1.3607 +2.591 2.6926 1.3491 +2.4953 2.6874 1.3226 +2.6261 2.8917 1.3512 +2.5373 2.862 1.3396 +2.6296 2.8811 1.34 +2.6092 2.939 1.2899 +2.3935 2.7671 1.2733 +2.406 2.7724 1.2458 +2.4744 2.8168 1.2697 +2.4582 2.82 1.3142 +2.5502 2.8502 1.2828 +2.6323 2.8723 1.2952 +2.6322 2.8723 1.285 +2.4161 2.7771 1.2227 +2.4791 2.8285 1.23 +2.5514 2.8581 1.2436 +2.6288 2.8808 1.2398 +2.5488 2.8664 1.2326 +2.6251 2.8913 1.2275 +2.4673 2.8444 1.2186 +2.531 2.8996 1.221 +2.6088 2.9384 1.2179 +2.4418 2.869 1.2327 +2.5029 2.9442 1.2389 +2.5925 2.986 1.2274 +2.5885 2.9978 1.2386 +2.4321 2.8705 1.2675 +2.496 2.9505 1.2827 +2.5856 3.0076 1.2885 +2.4284 2.8581 1.3118 +2.495 2.9412 1.3268 +2.5893 2.9981 1.3388 +2.4992 2.9322 1.338 +2.5935 2.9864 1.3511 +2.4397 2.8401 1.3226 +2.5164 2.8977 1.3491 +2.6099 2.9391 1.3607 +2.8803 2.6425 1.7478 +2.9006 2.6499 1.7989 +2.8892 2.6183 1.7547 +2.8446 2.5907 1.7365 +2.8321 2.625 1.7267 +2.7839 2.6074 1.7478 +2.7927 2.5832 1.7547 +2.7636 2.6 1.7989 +2.8956 2.6006 1.7735 +2.8537 2.5656 1.7631 +2.7992 2.5655 1.7735 +2.898 2.5941 1.7993 +2.8571 2.5565 1.7996 +2.8015 2.559 1.7993 +2.8957 2.6005 1.825 +2.8537 2.5656 1.8361 +2.7992 2.5654 1.825 +2.8892 2.6183 1.844 +2.8446 2.5907 1.8627 +2.7927 2.5832 1.844 +2.8804 2.6425 1.8509 +2.8321 2.625 1.8725 +2.7839 2.6074 1.8509 +2.8716 2.6668 1.844 +2.8197 2.6592 1.8627 +2.775 2.6317 1.844 +2.8651 2.6845 1.825 +2.8105 2.6843 1.8361 +2.7686 2.6494 1.825 +2.8628 2.691 1.7993 +2.8072 2.6935 1.7996 +2.7663 2.6558 1.7993 +2.8651 2.6844 1.7735 +2.8105 2.6843 1.7631 +2.7687 2.6493 1.7735 +2.8715 2.6667 1.7547 +2.8197 2.6592 1.7365 +2.7751 2.6316 1.7547 +2.6094 3.087 1.7478 +2.5891 3.0796 1.7989 +2.6006 3.1111 1.7547 +2.6451 3.1387 1.7365 +2.6576 3.1045 1.7267 +2.7058 3.122 1.7478 +2.697 3.1462 1.7547 +2.7261 3.1294 1.7989 +2.5941 3.1289 1.7735 +2.636 3.1638 1.7631 +2.6906 3.164 1.7735 +2.5917 3.1354 1.7993 +2.6327 3.173 1.7996 +2.6882 3.1705 1.7993 +2.5941 3.1289 1.825 +2.636 3.1638 1.8361 +2.6906 3.1641 1.825 +2.6005 3.1112 1.844 +2.6451 3.1387 1.8627 +2.697 3.1463 1.844 +2.6093 3.0869 1.8509 +2.6576 3.1045 1.8725 +2.7059 3.1221 1.8509 +2.6182 3.0627 1.844 +2.6701 3.0702 1.8627 +2.7147 3.0978 1.844 +2.6246 3.0449 1.825 +2.6792 3.0452 1.8361 +2.7211 3.0801 1.825 +2.627 3.0385 1.7993 +2.6825 3.036 1.7996 +2.7235 3.0736 1.7993 +2.6246 3.045 1.7735 +2.6792 3.0452 1.7631 +2.7211 3.0801 1.7735 +2.6182 3.0628 1.7547 +2.6701 3.0702 1.7365 +2.7146 3.0978 1.7547 +2.6043 2.7587 1.2668 +2.581 2.8035 1.2893 +2.6007 2.7714 1.2592 +2.6309 2.7459 1.2343 +2.6378 2.7176 1.2599 +2.6795 2.6839 1.2635 +2.6692 2.728 1.2148 +2.7133 2.7189 1.2007 +2.7274 2.661 1.2724 +2.7795 2.6527 1.2816 +2.7606 2.7196 1.1922 +2.809 2.7313 1.1893 +2.834 2.6625 1.2857 +2.8795 2.6905 1.2859 +2.8548 2.7557 1.1942 +2.8944 2.7886 1.206 +2.9156 2.7313 1.2863 +2.9483 2.7772 1.2868 +2.9317 2.825 1.2206 +2.9709 2.8595 1.2335 +2.9838 2.8205 1.2873 +3.0283 2.8535 1.2876 +3.016 2.887 1.2406 +3.0911 2.9224 1.2457 +3.1021 2.8924 1.2877 +3.1751 2.9328 1.288 +3.1657 2.9587 1.2516 +3.241 2.9937 1.2564 +3.2492 2.9711 1.2881 +3.4348 3.0579 1.2884 +3.4286 3.0749 1.2646 +3.5899 3.1433 1.2708 +3.5946 3.1306 1.2886 +3.7144 3.185 1.2888 +3.7076 3.2038 1.2681 +3.704 3.2135 1.2893 +2.5978 2.7793 1.2459 +2.6254 2.7609 1.2119 +2.6615 2.7491 1.1866 +2.7038 2.7448 1.1694 +2.7501 2.7486 1.1596 +2.798 2.7614 1.1565 +2.8444 2.7842 1.163 +2.8852 2.8136 1.1787 +2.9242 2.8456 1.198 +2.9648 2.8763 1.2152 +3.0107 2.9017 1.2246 +3.0864 2.9355 1.2314 +3.1616 2.9701 1.2392 +3.2374 3.0036 1.2456 +3.4227 3.0913 1.2516 +3.5855 3.1556 1.261 +2.5922 2.7947 1.2449 +2.6161 2.7866 1.2074 +2.6499 2.781 1.1773 +2.6911 2.7798 1.1551 +2.737 2.7847 1.1413 +2.7848 2.7976 1.1366 +2.8318 2.8187 1.1441 +2.8742 2.8438 1.1622 +2.9152 2.8706 1.1844 +2.9576 2.8965 1.2041 +3.0043 2.9193 1.2149 +3.0806 2.9513 1.2227 +3.1566 2.9838 1.2317 +3.233 3.0155 1.2391 +2.5881 2.8066 1.2456 +2.6064 2.8151 1.2076 +2.6342 2.8277 1.1761 +2.6695 2.8431 1.1524 +2.7107 2.8601 1.1374 +2.7558 2.8773 1.1322 +2.8039 2.8944 1.1399 +2.85 2.9101 1.1585 +2.8954 2.9254 1.1813 +2.9417 2.9411 1.2016 +2.9901 2.9582 1.2127 +3.068 2.9861 1.2208 +3.1457 3.0138 1.23 +3.2235 3.0418 1.2376 +3.4155 3.1109 1.2505 +3.5801 3.1703 1.2602 +3.7035 3.2148 1.2675 +2.5834 2.8182 1.243 +2.5945 2.8434 1.2048 +2.6142 2.8747 1.1749 +2.6426 2.9077 1.1532 +2.6797 2.938 1.1401 +2.7253 2.9612 1.1357 +2.7753 2.9743 1.1433 +2.8247 2.98 1.1614 +2.8741 2.983 1.1837 +2.9241 2.9878 1.2036 +2.9753 2.9991 1.2144 +3.0546 3.0227 1.2223 +3.1341 3.0455 1.2313 +3.2134 3.0694 1.2388 +3.408 3.1316 1.2514 +3.5745 3.1858 1.2609 +3.6958 3.2362 1.2753 +2.5767 2.8367 1.243 +2.5836 2.8733 1.208 +2.6011 2.9107 1.1829 +2.6287 2.946 1.1665 +2.6656 2.9765 1.1576 +2.7114 2.9994 1.1549 +2.7623 3.0107 1.1614 +2.8132 3.0119 1.1773 +2.8644 3.0092 1.1969 +2.9161 3.0091 1.2142 +2.9685 3.0177 1.2238 +3.0486 3.0393 1.2307 +3.1289 3.0599 1.2386 +3.2089 3.0819 1.2451 +3.4017 3.1488 1.2644 +3.5698 3.1987 1.2706 +2.5736 2.8452 1.2574 +2.5778 2.8894 1.2319 +2.593 2.9331 1.2125 +2.6188 2.9732 1.199 +2.6546 3.0068 1.191 +2.6999 3.0308 1.1884 +2.7516 3.0407 1.1933 +2.8037 3.0381 1.2053 +2.8564 3.0308 1.2199 +2.9095 3.0265 1.233 +2.9629 3.033 1.2401 +3.0436 3.053 1.2453 +3.1245 3.0718 1.2512 +3.2051 3.0923 1.2561 +2.5677 2.8586 1.2666 +2.5641 2.917 1.2604 +2.5718 2.9745 1.2652 +2.5919 3.0268 1.2754 +2.6259 3.0696 1.2856 +2.6752 3.0987 1.2902 +2.729 3.1057 1.2901 +2.7835 3.095 1.29 +2.8385 3.0775 1.2899 +2.8943 3.0642 1.2898 +2.9508 3.0661 1.2897 +3.0328 3.0827 1.2897 +3.1152 3.0974 1.2896 +3.197 3.1146 1.2896 +3.3956 3.1656 1.2895 +3.5652 3.2113 1.2895 +3.6924 3.2456 1.2894 +2.5631 2.8711 1.2868 +2.5588 2.9284 1.2919 +2.5651 2.9871 1.3209 +2.5836 3.0427 1.3531 +2.6149 3.0945 1.3769 +2.6595 3.1418 1.381 +2.7159 3.1477 1.3766 +2.7708 3.1321 1.3658 +2.8258 3.1081 1.3525 +2.8826 3.0889 1.3405 +2.9429 3.0881 1.3337 +3.0257 3.1023 1.329 +3.1089 3.1144 1.3237 +3.1916 3.1294 1.3193 +3.3916 3.1767 1.3118 +3.5622 3.2196 1.3062 +3.6901 3.2518 1.3019 +2.5586 2.9312 1.3228 +2.5659 2.9879 1.3786 +2.5839 3.0452 1.4353 +2.6112 3.1071 1.474 +2.6465 3.1776 1.4759 +2.7055 3.1824 1.467 +2.7606 3.162 1.4453 +2.8153 3.1319 1.4186 +2.8729 3.1076 1.3943 +2.9369 3.1046 1.3803 +3.0204 3.1171 1.3707 +3.1041 3.1271 1.3597 +3.1875 3.1406 1.3507 +3.3886 3.1851 1.3353 +3.5599 3.2259 1.3238 +3.6884 3.2565 1.3152 +2.5487 2.9042 1.3317 +2.5435 2.9649 1.3883 +2.549 3.0207 1.4599 +2.5682 3.0718 1.5285 +2.5982 3.1297 1.5814 +2.6363 3.2058 1.6061 +2.6983 3.2084 1.5902 +2.7539 3.181 1.5516 +2.8081 3.1438 1.5043 +2.8663 3.115 1.4619 +2.9345 3.111 1.437 +3.0184 3.1228 1.4213 +3.1022 3.1321 1.4037 +3.1859 3.1449 1.389 +3.3874 3.1883 1.3641 +3.559 3.2283 1.3454 +3.6877 3.2584 1.3314 +2.5342 2.9755 1.4086 +2.5382 3.0242 1.5019 +2.5592 3.0652 1.5964 +2.5943 3.1157 1.678 +2.6409 3.193 1.7329 +2.7067 3.1973 1.7104 +2.7589 3.1703 1.6564 +2.8073 3.1338 1.5904 +2.8627 3.1069 1.5307 +2.9365 3.1055 1.4944 +3.0203 3.1179 1.4725 +3.1035 3.1277 1.4481 +3.1873 3.1412 1.4278 +3.3884 3.1855 1.3931 +3.5598 3.2262 1.3672 +3.6883 3.2568 1.3477 +2.5542 2.8863 1.3496 +2.5438 2.94 1.4403 +2.5496 2.9781 1.548 +2.5715 3.0139 1.6594 +2.6093 3.0609 1.761 +2.663 3.1324 1.8396 +2.7287 3.1446 1.8138 +2.7743 3.1324 1.7508 +2.8148 3.1105 1.6721 +2.8649 3.0937 1.599 +2.9397 3.0968 1.553 +3.0232 3.1102 1.5251 +3.1058 3.121 1.4937 +3.1894 3.1353 1.4673 +3.39 3.1811 1.4228 +3.561 3.2229 1.3894 +3.6892 3.2543 1.3644 +2.5618 2.8709 1.3813 +2.5627 2.9071 1.4702 +2.5649 2.946 1.5724 +2.5881 2.9806 1.6725 +2.6264 3.0236 1.7663 +2.6807 3.0836 1.8476 +2.7446 3.0984 1.8298 +2.7894 3.0943 1.7862 +2.8285 3.0833 1.7309 +2.8756 3.0765 1.6776 +2.9444 3.0839 1.6392 +3.0278 3.0986 1.604 +3.1094 3.1109 1.5614 +3.1926 3.1266 1.5255 +3.3924 3.1746 1.4665 +3.5627 3.218 1.4221 +3.6905 3.2506 1.3889 +2.5786 2.9317 1.5585 +2.6077 2.9544 1.6447 +2.6491 2.9831 1.7263 +2.7012 3.0273 1.8005 +2.7619 3.0442 1.7962 +2.8074 3.0483 1.7845 +2.8476 3.0478 1.7677 +2.8927 3.0498 1.7467 +2.9528 3.0607 1.7222 +3.0361 3.0783 1.6794 +3.1156 3.0929 1.6266 +3.1983 3.1109 1.5815 +3.3966 3.1628 1.5085 +3.5659 3.2092 1.4536 +3.6929 3.244 1.4126 +2.569 2.8553 1.3734 +2.5765 2.8831 1.454 +2.5989 2.8992 1.5318 +2.6333 2.9119 1.6062 +2.6768 2.9288 1.6762 +2.7265 2.9579 1.7407 +2.7841 2.9766 1.7497 +2.8307 2.9881 1.7698 +2.8726 2.9967 1.7908 +2.9162 3.0061 1.8019 +2.9677 3.0199 1.7919 +3.0501 3.0423 1.7423 +3.1268 3.0613 1.6813 +3.2083 3.0834 1.6286 +3.4042 3.1422 1.5438 +3.5716 3.1938 1.4801 +3.6971 3.2324 1.4324 +2.5878 2.8057 1.3678 +2.6046 2.8122 1.4439 +2.6308 2.8225 1.517 +2.6656 2.8359 1.5862 +2.7084 2.8518 1.6509 +2.7586 2.8697 1.7104 +2.8149 2.8902 1.7274 +2.8621 2.9073 1.7664 +2.9044 2.9226 1.8098 +2.9461 2.9377 1.8396 +2.9916 2.9543 1.8382 +3.0719 2.9836 1.7839 +3.1453 3.0103 1.7175 +3.2244 3.0391 1.6598 +3.4162 3.109 1.5672 +3.5806 3.1688 1.4977 +3.7039 3.2137 1.4456 +2.6062 2.7531 1.3724 +2.63 2.7356 1.4525 +2.6574 2.7379 1.5303 +2.6916 2.7508 1.605 +2.736 2.7655 1.6754 +2.794 2.7724 1.7403 +2.85 2.7959 1.7492 +2.8923 2.8186 1.7691 +2.929 2.8409 1.7899 +2.9678 2.8633 1.8011 +3.0161 2.8868 1.7911 +3.0936 2.9228 1.7415 +3.1645 2.9579 1.6807 +3.241 2.9935 1.628 +3.4287 3.0748 1.5433 +3.59 3.1432 1.4798 +3.7109 3.1945 1.4322 +2.6105 2.7325 1.3764 +2.6338 2.6959 1.4712 +2.6636 2.6957 1.5573 +2.7002 2.6975 1.6443 +2.7507 2.7018 1.7268 +2.8209 2.6985 1.8026 +2.8782 2.7257 1.7978 +2.9145 2.7541 1.7852 +2.9434 2.783 1.7672 +2.9781 2.8128 1.7454 +3.0315 2.8447 1.7204 +3.1064 2.885 1.6778 +3.1766 2.9254 1.6252 +3.2514 2.9651 1.5803 +3.4364 3.0535 1.5075 +3.5958 3.1272 1.4529 +3.7153 3.1825 1.412 +2.6619 2.6756 1.5723 +2.7015 2.6643 1.6737 +2.759 2.6557 1.7689 +2.8415 2.6418 1.8514 +2.9003 2.6728 1.833 +2.9306 2.707 1.7878 +2.9515 2.7431 1.7305 +2.9818 2.7811 1.6754 +3.0399 2.8215 1.6361 +3.1131 2.8642 1.6012 +3.1833 2.9077 1.559 +3.2571 2.9495 1.5234 +3.4407 3.0418 1.4649 +3.599 3.1185 1.4209 +3.7177 3.1759 1.388 +2.6143 2.7204 1.3467 +2.6402 2.6723 1.4384 +2.6681 2.6476 1.5489 +2.7074 2.6346 1.663 +2.7676 2.6213 1.7655 +2.8581 2.5961 1.8409 +2.9169 2.6303 1.8146 +2.9426 2.671 1.7501 +2.9574 2.7162 1.6696 +2.9837 2.7635 1.595 +3.0437 2.8109 1.5483 +3.1162 2.8545 1.5209 +3.1865 2.8995 1.49 +3.2597 2.9424 1.4641 +3.4427 3.0364 1.4204 +3.6004 3.1144 1.3876 +3.7188 3.1729 1.363 +2.6208 2.7056 1.3294 +2.6545 2.6431 1.4055 +2.688 2.6099 1.4991 +2.7299 2.5928 1.594 +2.7896 2.5764 1.6747 +2.8768 2.5449 1.7259 +2.9304 2.5843 1.7038 +2.9524 2.6392 1.6504 +2.9652 2.699 1.5848 +2.9897 2.7559 1.5254 +3.0458 2.8051 1.4892 +3.1181 2.8493 1.4677 +3.1882 2.895 1.444 +3.2611 2.9384 1.4242 +3.4437 3.0335 1.3905 +3.6013 3.1122 1.3652 +3.7194 3.1713 1.3462 +2.6181 2.7179 1.3246 +2.6548 2.6596 1.3848 +2.6941 2.623 1.4554 +2.741 2.5983 1.523 +2.8005 2.5749 1.5742 +2.878 2.5417 1.5958 +2.927 2.5792 1.5803 +2.9525 2.6352 1.5428 +2.9707 2.6977 1.4969 +2.9972 2.7564 1.4555 +3.0468 2.8026 1.4314 +3.1188 2.8469 1.4163 +3.1892 2.8932 1.3993 +3.2617 2.9367 1.3852 +3.4442 3.0322 1.3612 +3.6016 3.1113 1.3432 +3.7197 3.1705 1.3298 +2.6094 2.7444 1.2847 +2.6437 2.6991 1.319 +2.6851 2.6637 1.3731 +2.7349 2.6343 1.4282 +2.7944 2.607 1.4652 +2.8648 2.5778 1.4652 +2.9127 2.6111 1.4567 +2.9429 2.6605 1.4363 +2.967 2.7168 1.411 +2.9966 2.7704 1.3882 +3.0433 2.8122 1.375 +3.1156 2.8555 1.366 +3.1866 2.9007 1.3557 +3.2594 2.9432 1.3472 +3.4424 3.037 1.3327 +3.6003 3.1149 1.3218 +3.7187 3.1733 1.3137 +2.6416 2.7035 1.2897 +2.6831 2.667 1.3173 +2.732 2.64 1.3479 +2.7879 2.6231 1.3704 +2.8506 2.6168 1.3734 +2.8974 2.6475 1.3693 +2.9305 2.6927 1.3593 +2.9588 2.744 1.3471 +2.9912 2.7928 1.3362 +3.0367 2.8304 1.33 +3.1096 2.8718 1.3256 +3.1815 2.9149 1.3208 +3.2549 2.9555 1.3168 +3.4391 3.0463 1.3099 +3.5978 3.1218 1.3047 +3.7168 3.1785 1.3009 +6.0092 1.496 0.5494 +6.0112 1.4948 0.5103 +6.0153 1.5184 0.5422 +5.9911 1.5418 0.5756 +5.9828 1.5112 0.5854 +5.7786 1.6291 0.8053 +5.7871 1.6655 0.7952 +5.6086 1.7744 1.0405 +5.5999 1.7322 1.0506 +5.5712 1.7488 1.0753 +5.5779 1.7821 1.0675 +5.5476 1.7892 1.095 +5.5429 1.7652 1.1003 +5.537 1.7686 1.1304 +5.5432 1.8007 1.1234 +5.542 1.813 1.1529 +5.5338 1.7704 1.162 +5.4697 1.8074 1.3217 +5.4805 1.8647 1.3095 +5.4033 1.9086 1.4626 +5.3927 1.8519 1.4745 +5.311 1.8991 1.624 +5.3206 1.9513 1.6133 +5.2915 1.9533 1.6321 +5.2843 1.9145 1.6401 +5.2577 1.9298 1.6564 +5.2625 1.9556 1.651 +5.2621 1.9702 1.6868 +5.2548 1.9315 1.695 +5.2519 1.9332 1.7336 +5.2617 1.9849 1.7225 +5.1325 2.0641 1.9569 +5.1214 2.0085 1.9696 +4.9826 2.0886 2.1992 +4.995 2.1479 2.1848 +4.9618 2.1506 2.2008 +4.9525 2.106 2.2116 +4.9222 2.1235 2.2239 +4.9284 2.1533 2.2166 +4.9298 2.1692 2.2473 +4.9191 2.1253 2.2599 +4.9144 2.128 2.293 +4.9298 2.1861 2.2748 +4.827 2.2481 2.3383 +4.805 2.1912 2.3611 +4.6729 2.2674 2.38 +4.7035 2.3231 2.354 +4.5721 2.4016 2.3288 +4.5325 2.3485 2.3549 +4.5182 2.3568 2.3258 +4.5483 2.3965 2.3063 +4.5247 2.3911 2.2827 +4.5042 2.3649 2.2955 +4.476 2.3812 2.299 +4.5033 2.4134 2.2837 +4.4867 2.4415 2.2936 +4.4476 2.3975 2.3137 +4.4227 2.4119 2.3125 +4.4688 2.4619 2.2905 +4.3572 2.5284 2.1709 +4.3101 2.4769 2.1921 +4.215 2.5318 2.0443 +4.2644 2.5852 2.0233 +4.1812 2.6371 1.859 +4.1286 2.5817 1.8803 +4.0424 2.6315 1.7115 +4.0984 2.6887 1.6894 +4.0068 2.7447 1.5259 +3.9477 2.6861 1.549 +3.8358 2.7508 1.4041 +3.8973 2.81 1.38 +3.8721 2.8125 1.3446 +3.819 2.7604 1.3664 +3.8103 2.7655 1.322 +3.848 2.8036 1.3053 +3.8203 2.8074 1.2729 +3.7912 2.7765 1.2868 +3.7761 2.7852 1.2927 +3.8111 2.8249 1.2742 +3.8069 2.8503 1.2878 +3.7611 2.7939 1.3149 +3.7453 2.803 1.3228 +3.7962 2.8687 1.2912 +3.6962 2.9265 1.2748 +3.6489 2.8587 1.305 +3.5366 2.9235 1.3325 +3.5808 2.9931 1.3013 +3.4592 3.0634 1.3428 +3.4178 2.9921 1.3758 +3.3017 3.0591 1.4055 +3.3404 3.132 1.3715 +3.293 3.0641 1.2905 +6.0077 1.5336 0.5247 +5.9805 1.5625 0.552 +5.7717 1.6915 0.7708 +5.5886 1.8055 1.0161 +5.5619 1.8067 1.0488 +5.5357 1.8072 1.082 +5.5272 1.8248 1.1064 +5.5206 1.8449 1.1307 +5.4516 1.9078 1.2803 +5.3744 1.9514 1.4342 +5.2938 1.9906 1.5876 +5.2716 1.9826 1.6128 +5.2494 1.975 1.638 +5.2426 1.9993 1.667 +5.2356 2.0237 1.6959 +5.1056 2.1053 1.9263 +4.9672 2.1915 2.1501 +4.941 2.1833 2.1746 +4.9146 2.1751 2.199 +4.9125 2.1999 2.2162 +4.909 2.2258 2.2309 +4.8208 2.2805 2.2825 +4.7147 2.3471 2.2909 +4.6018 2.4159 2.2658 +4.5714 2.4068 2.2591 +4.5412 2.3973 2.2516 +4.5286 2.4188 2.247 +4.5243 2.4475 2.2451 +4.5142 2.4676 2.237 +4.4036 2.5345 2.1197 +4.3136 2.5911 1.9723 +4.2345 2.6421 1.8069 +4.1563 2.6925 1.6354 +4.0694 2.7471 1.4697 +3.9639 2.8109 1.3218 +3.9289 2.814 1.2919 +3.8877 2.8056 1.2654 +3.8493 2.8103 1.2391 +3.8424 2.8318 1.2278 +3.8455 2.8624 1.2214 +3.837 2.8847 1.2145 +3.7286 2.9473 1.2011 +3.6059 3.0182 1.2254 +3.4773 3.0924 1.2631 +3.3512 3.1652 1.2893 +5.9907 1.5326 0.5073 +5.9573 1.5613 0.5283 +5.7416 1.6918 0.7465 +5.5517 1.8073 0.9917 +5.5326 1.8082 1.03 +5.5143 1.8085 1.0691 +5.4983 1.8266 1.0895 +5.4823 1.8475 1.1086 +5.3999 1.9113 1.251 +5.323 1.955 1.4057 +5.2463 1.9941 1.5619 +5.2363 1.9852 1.5936 +5.226 1.9767 1.625 +5.2076 2.0017 1.6472 +5.189 2.0269 1.6693 +5.0563 2.1081 1.8955 +4.9156 2.1938 2.1153 +4.9022 2.185 2.1484 +4.8888 2.1761 2.1814 +4.8773 2.1995 2.1852 +4.8643 2.2239 2.1872 +4.7897 2.2696 2.2272 +4.6997 2.3254 2.2283 +4.6043 2.383 2.2029 +4.574 2.3816 2.212 +4.5441 2.3799 2.2206 +4.5368 2.3941 2.2102 +4.5378 2.4119 2.1963 +4.532 2.4254 2.1834 +4.4213 2.4914 2.0688 +4.3327 2.5459 1.9221 +4.256 2.594 1.7558 +4.181 2.641 1.5825 +4.0977 2.6922 1.4144 +3.996 2.753 1.2642 +3.9559 2.7641 1.2395 +3.9057 2.7703 1.2255 +3.8612 2.7837 1.2053 +3.852 2.8013 1.1818 +3.854 2.823 1.1558 +3.8433 2.8415 1.1388 +3.7274 2.9084 1.1261 +3.5973 2.9836 1.1484 +3.4613 3.0622 1.1829 +3.3279 3.1392 1.2071 +5.9743 1.5161 0.5 +5.935 1.5388 0.5185 +5.7143 1.6662 0.7364 +5.5195 1.7787 0.9816 +5.5072 1.7858 1.0223 +5.4958 1.7924 1.0638 +5.4736 1.8052 1.0825 +5.4495 1.8191 1.0994 +5.3557 1.8732 1.2389 +5.2792 1.9174 1.3939 +5.206 1.9597 1.5513 +5.2063 1.9595 1.5856 +5.2061 1.9596 1.6196 +5.1777 1.976 1.639 +5.1491 1.9925 1.6582 +5.0137 2.0707 1.8828 +4.8704 2.1535 2.1009 +4.8683 2.1547 2.1375 +4.8662 2.1559 2.1741 +4.8446 2.1683 2.1727 +4.8218 2.1815 2.1691 +4.7515 2.2221 2.2046 +4.6668 2.271 2.2025 +4.5781 2.3222 2.1768 +4.5547 2.3357 2.1925 +4.5316 2.349 2.2077 +4.5227 2.3541 2.195 +4.5192 2.3562 2.176 +4.5118 2.3605 2.1613 +4.4 2.425 2.048 +4.3107 2.4765 1.9017 +4.2338 2.521 1.7351 +4.159 2.5642 1.5609 +4.0762 2.612 1.3918 +3.9752 2.6703 1.2404 +3.9372 2.6922 1.2178 +3.8915 2.7186 1.2089 +3.8491 2.7431 1.1913 +3.8351 2.7512 1.1634 +3.8279 2.7553 1.1291 +3.8118 2.7646 1.1076 +3.6929 2.8332 1.0954 +3.5597 2.9102 1.1166 +3.4205 2.9905 1.1497 +3.2841 3.0693 1.1731 +5.9682 1.4936 0.5073 +5.9267 1.5082 0.5283 +5.7058 1.6298 0.7465 +5.5109 1.7365 0.9917 +5.5005 1.7525 1.03 +5.4911 1.7683 1.0691 +5.4674 1.773 1.0895 +5.4413 1.7765 1.1086 +5.3448 1.8159 1.251 +5.2685 1.8607 1.4057 +5.1963 1.9075 1.5619 +5.1991 1.9207 1.5936 +5.2013 1.9338 1.625 +5.1704 1.9373 1.6472 +5.1393 1.9408 1.6693 +5.0027 2.0151 1.8955 +4.858 2.0941 2.1153 +4.859 2.1101 2.1484 +4.8599 2.1261 2.1814 +4.834 2.1244 2.1852 +4.8064 2.1235 2.1872 +4.7294 2.1653 2.2272 +4.6361 2.2153 2.2283 +4.5385 2.2691 2.2029 +4.5246 2.296 2.212 +4.5111 2.3228 2.2206 +4.4952 2.322 2.2102 +4.4802 2.3122 2.1963 +4.4657 2.3106 2.1834 +4.3531 2.3733 2.0688 +4.2617 2.4229 1.9221 +4.1817 2.4653 1.7558 +4.1035 2.5067 1.5825 +4.0175 2.5532 1.4144 +3.914 2.611 1.2642 +3.8843 2.6401 1.2395 +3.8538 2.6805 1.2255 +3.82 2.7123 1.2053 +3.8001 2.7115 1.1818 +3.7824 2.6989 1.1558 +3.761 2.6989 1.1388 +3.6451 2.7658 1.1261 +3.5149 2.8409 1.1484 +3.3789 2.9194 1.1829 +3.2454 2.9964 1.2071 +5.9759 1.4785 0.5247 +5.9372 1.4875 0.552 +5.7212 1.6038 0.7708 +5.5308 1.7054 1.0161 +5.5165 1.728 1.0488 +5.5029 1.7504 1.082 +5.4834 1.749 1.1064 +5.4627 1.7446 1.1307 +5.3737 1.7729 1.2803 +5.2974 1.818 1.4342 +5.2231 1.8682 1.5876 +5.2189 1.8914 1.6128 +5.2144 1.9144 1.638 +5.19 1.9082 1.667 +5.1653 1.902 1.6959 +5.0297 1.9738 1.9263 +4.8858 2.0506 2.1501 +4.8798 2.0774 2.1746 +4.8738 2.1044 2.199 +4.8512 2.0937 2.2162 +4.827 2.0838 2.2309 +4.7355 2.1329 2.2825 +4.6249 2.1914 2.2909 +4.5088 2.2548 2.2658 +4.5015 2.2857 2.2591 +4.4946 2.3165 2.2516 +4.4697 2.3168 2.247 +4.4427 2.3062 2.2451 +4.4202 2.3049 2.237 +4.3069 2.3672 2.1197 +4.213 2.4168 1.9723 +4.1292 2.4598 1.8069 +4.0465 2.5023 1.6354 +3.9557 2.5503 1.4697 +3.8478 2.6098 1.3218 +3.8276 2.6385 1.2919 +3.8143 2.6784 1.2654 +3.791 2.7093 1.2391 +3.7689 2.7046 1.2278 +3.744 2.6865 1.2214 +3.7204 2.6827 1.2145 +3.612 2.7453 1.2011 +3.4893 2.8162 1.2254 +3.3606 2.8904 1.2631 +3.2346 2.9632 1.2893 +5.9928 1.4794 0.5422 +5.9604 1.4887 0.5756 +5.7513 1.6035 0.7952 +5.5677 1.7036 1.0405 +5.5457 1.7264 1.0675 +5.5244 1.7491 1.095 +5.5123 1.7471 1.1234 +5.501 1.7421 1.1529 +5.4255 1.7694 1.3095 +5.3489 1.8143 1.4626 +5.2706 1.8647 1.6133 +5.2542 1.8888 1.6321 +5.2378 1.9128 1.651 +5.2249 1.9058 1.6868 +5.212 1.8988 1.7225 +5.0788 1.9711 1.9569 +4.9374 2.0483 2.1848 +4.9185 2.0757 2.2008 +4.8995 2.1033 2.2166 +4.8864 2.0941 2.2473 +4.8718 2.0857 2.2748 +4.7667 2.1437 2.3383 +4.64 2.2131 2.354 +4.5063 2.2877 2.3288 +4.4989 2.3108 2.3063 +4.4917 2.334 2.2827 +4.4617 2.3414 2.2837 +4.4291 2.3417 2.2936 +4.4025 2.347 2.2905 +4.289 2.4104 2.1709 +4.1934 2.4623 2.0233 +4.107 2.5084 1.859 +4.0209 2.5544 1.6894 +3.9265 2.6056 1.5259 +3.8152 2.6679 1.38 +3.8005 2.6885 1.3446 +3.7962 2.7137 1.3053 +3.779 2.7359 1.2729 +3.7592 2.735 1.2742 +3.7352 2.7261 1.2878 +3.7138 2.726 1.2912 +3.6138 2.7838 1.2748 +3.4984 2.8504 1.3013 +3.3768 2.9205 1.3428 +3.2579 2.9892 1.3715 +4.7043 0.6195 0.5494 +4.7054 0.6177 0.5103 +4.7211 0.6353 0.5422 +4.7134 0.6648 0.5757 +4.6906 0.6433 0.5854 +4.5845 0.8271 0.8053 +4.6105 0.8532 0.7953 +4.5208 1.0187 1.0407 +4.4917 0.9879 1.0506 +4.4767 1.0138 1.0753 +4.4996 1.038 1.0676 +4.4785 1.0568 1.0951 +4.462 1.0392 1.1003 +4.459 1.0445 1.1304 +4.4809 1.0681 1.1235 +4.4863 1.0787 1.153 +4.4573 1.0474 1.162 +4.424 1.1051 1.3217 +4.4629 1.1472 1.3097 +4.4224 1.2162 1.4628 +4.384 1.1743 1.4745 +4.3415 1.2479 1.624 +4.3767 1.2864 1.6135 +4.3538 1.3006 1.6322 +4.3276 1.272 1.6401 +4.3138 1.2959 1.6564 +4.3313 1.3149 1.6511 +4.3386 1.3269 1.6869 +4.3123 1.2985 1.695 +4.3108 1.3011 1.7336 +4.3459 1.3391 1.7227 +4.2812 1.4592 1.9571 +4.243 1.4185 1.9696 +4.1709 1.5434 2.1992 +4.2121 1.5866 2.185 +4.1862 1.603 2.2009 +4.1553 1.5706 2.2116 +4.1395 1.5979 2.2239 +4.1602 1.6195 2.2167 +4.1696 1.632 2.2475 +4.1379 1.6006 2.2599 +4.1354 1.6049 2.293 +4.1785 1.6459 2.275 +4.1265 1.7406 2.3385 +4.0786 1.7033 2.3611 +4.01 1.8222 2.38 +4.0643 1.8549 2.3541 +3.9974 1.9754 2.3289 +3.937 1.9485 2.3549 +3.9296 1.9615 2.3258 +3.9752 1.9813 2.3063 +3.9529 1.9869 2.2827 +3.9223 1.974 2.2955 +3.9076 1.9994 2.299 +3.947 2.0143 2.2838 +3.9479 2.0445 2.2937 +3.8929 2.025 2.3137 +3.8799 2.0474 2.3125 +3.9439 2.0689 2.2907 +3.887 2.1711 2.1711 +3.8214 2.1487 2.1921 +3.772 2.2343 2.0443 +3.8405 2.2572 2.0235 +3.7992 2.3352 1.8592 +3.7272 2.312 1.8803 +3.6824 2.3896 1.7115 +3.7581 2.4129 1.6896 +3.7122 2.498 1.5262 +3.6331 2.4749 1.549 +3.575 2.5756 1.4041 +3.6563 2.5982 1.3803 +3.6369 2.611 1.3448 +3.5663 2.5907 1.3664 +3.5617 2.5985 1.322 +3.6126 2.6139 1.3055 +3.5918 2.6288 1.2729 +3.5518 2.6158 1.2868 +3.544 2.6293 1.2927 +3.5935 2.6471 1.2743 +3.6034 2.6697 1.2879 +3.5362 2.6429 1.3149 +3.528 2.6571 1.3228 +3.6043 2.6894 1.2912 +3.5523 2.7795 1.2749 +3.4779 2.7438 1.305 +3.4195 2.8449 1.3325 +3.4924 2.8834 1.3014 +3.4293 2.9928 1.3429 +3.3578 2.9518 1.3758 +3.2975 3.0563 1.4055 +3.3676 3.0998 1.3715 +3.2929 3.0641 1.2905 +4.7228 0.6511 0.5247 +4.7157 0.6865 0.552 +4.6116 0.8813 0.7708 +4.5208 1.053 1.0161 +4.4995 1.0653 1.0488 +4.4782 1.0768 1.082 +4.4804 1.0949 1.1064 +4.4856 1.1143 1.1307 +4.4618 1.1954 1.2803 +4.4212 1.264 1.4342 +4.3755 1.3306 1.5876 +4.353 1.3334 1.6128 +4.3307 1.3366 1.638 +4.3378 1.3594 1.667 +4.345 1.3825 1.6959 +4.2808 1.5049 1.9263 +4.2122 1.6346 2.1501 +4.1864 1.639 2.1746 +4.1603 1.6435 2.199 +4.1716 1.6648 2.2162 +4.1823 1.6876 2.2309 +4.1385 1.7701 2.2825 +4.0862 1.8699 2.2909 +4.0294 1.9745 2.2658 +3.9996 1.98 2.2591 +3.9698 1.985 2.2516 +3.9707 2.008 2.247 +3.9822 2.0335 2.2451 +3.9844 2.0543 2.237 +3.9286 2.1564 2.1197 +3.8843 2.2412 1.9723 +3.8459 2.3168 1.8069 +3.8081 2.3914 1.6354 +3.7653 2.4733 1.4697 +3.712 2.5706 1.3218 +3.6848 2.588 1.2919 +3.6464 2.5986 1.2654 +3.6174 2.6189 1.2391 +3.6229 2.6394 1.2278 +3.6416 2.6633 1.2214 +3.6464 2.6853 1.2145 +3.59 2.7829 1.2011 +3.5262 2.8933 1.2254 +3.4594 3.0091 1.2631 +3.3939 3.1225 1.2893 +4.7082 0.6576 0.5072 +4.6958 0.6953 0.5282 +4.5868 0.8944 0.7464 +4.4911 1.0701 0.9916 +4.4759 1.079 1.0299 +4.461 1.087 1.069 +4.4574 1.1088 1.0894 +4.4551 1.1327 1.1084 +4.4207 1.2203 1.2508 +4.3804 1.2889 1.4055 +4.3378 1.3537 1.5618 +4.325 1.3506 1.5934 +4.3122 1.3479 1.6249 +4.3101 1.3763 1.6471 +4.3079 1.405 1.6691 +4.2414 1.5282 1.8954 +4.1706 1.6585 2.1151 +4.1551 1.6569 2.1482 +4.1395 1.6553 2.1813 +4.1422 1.6794 2.1851 +4.1443 1.705 2.187 +4.107 1.7743 2.227 +4.0623 1.8585 2.2282 +4.0142 1.9464 2.2028 +3.9885 1.9581 2.2119 +3.963 1.9694 2.2206 +3.9644 1.9842 2.2102 +3.9746 1.9984 2.1962 +3.9768 2.0119 2.1832 +3.9205 2.1132 2.0686 +3.8761 2.1956 1.9219 +3.8382 2.2678 1.7556 +3.8012 2.3383 1.5823 +3.7596 2.4158 1.4142 +3.7077 2.509 1.2639 +3.6806 2.5352 1.2393 +3.6426 2.5618 1.2254 +3.6131 2.5918 1.2052 +3.6148 2.6103 1.1817 +3.6278 2.6272 1.1557 +3.6287 2.647 1.1387 +3.5685 2.7513 1.1261 +3.501 2.8684 1.1483 +3.4304 2.9909 1.1829 +3.3611 3.111 1.2071 +4.6862 0.6509 0.5 +4.6658 0.6863 0.5185 +4.5511 0.8849 0.7364 +4.4499 1.0602 0.9816 +4.4435 1.0713 1.0223 +4.4375 1.0816 1.0638 +4.426 1.1016 1.0825 +4.4135 1.1233 1.0994 +4.3648 1.2077 1.2389 +4.325 1.2766 1.3939 +4.287 1.3424 1.5513 +4.2871 1.3422 1.5856 +4.287 1.3423 1.6196 +4.2723 1.3678 1.639 +4.2574 1.3937 1.6582 +4.1871 1.5155 1.8828 +4.1126 1.6445 2.1009 +4.1115 1.6464 2.1375 +4.1104 1.6483 2.1741 +4.0992 1.6676 2.1727 +4.0873 1.6882 2.1691 +4.0508 1.7514 2.2046 +4.0068 1.8277 2.2025 +3.9607 1.9076 2.1768 +3.9486 1.9286 2.1925 +3.9366 1.9494 2.2077 +3.9319 1.9573 2.195 +3.9301 1.9605 2.176 +3.9263 1.9672 2.1613 +3.8682 2.0678 2.048 +3.8218 2.1481 1.9017 +3.7818 2.2174 1.7351 +3.7429 2.2847 1.5609 +3.6999 2.3592 1.3918 +3.6474 2.4501 1.2404 +3.6277 2.4843 1.2178 +3.6039 2.5255 1.2089 +3.5819 2.5636 1.1913 +3.5746 2.5762 1.1634 +3.5709 2.5827 1.1291 +3.5625 2.5972 1.1076 +3.5008 2.7042 1.0954 +3.4315 2.8241 1.1166 +3.3592 2.9493 1.1497 +3.2883 3.0721 1.1731 +4.6694 0.6352 0.5072 +4.6429 0.6648 0.5282 +4.5251 0.8588 0.7464 +4.4207 1.0295 0.9916 +4.4206 1.0471 1.0299 +4.4211 1.064 1.069 +4.4041 1.078 1.0894 +4.3845 1.092 1.1084 +4.3259 1.1656 1.2508 +4.2866 1.2348 1.4055 +4.2518 1.304 1.5618 +4.2609 1.3136 1.5934 +4.2696 1.3233 1.6249 +4.2461 1.3394 1.6471 +4.2223 1.3556 1.6691 +4.1489 1.4748 1.8954 +4.0714 1.6013 2.1151 +4.0805 1.6139 2.1482 +4.0897 1.6266 2.1813 +4.0675 1.6362 2.1851 +4.0443 1.6473 2.187 +4.0029 1.7143 2.227 +3.9524 1.795 2.2282 +3.9003 1.8807 2.2028 +3.903 1.9087 2.2119 +3.9059 1.9365 2.2206 +3.8925 1.9427 2.2102 +3.8751 1.9409 2.1962 +3.8623 1.9457 2.1832 +3.8027 2.0452 2.0686 +3.7535 2.1248 1.9219 +3.71 2.1937 1.7556 +3.6674 2.261 1.5823 +3.6211 2.3358 1.4142 +3.5663 2.4273 1.2639 +3.5572 2.4639 1.2393 +3.5531 2.5101 1.2254 +3.5419 2.5506 1.2052 +3.5251 2.5585 1.1817 +3.5039 2.5557 1.1557 +3.4863 2.5648 1.1387 +3.4261 2.669 1.1261 +3.3584 2.7861 1.1483 +3.2876 2.9085 1.1829 +3.2182 3.0286 1.2071 +4.6677 0.6193 0.5247 +4.6406 0.6431 0.552 +4.524 0.8307 0.7708 +4.4207 0.9952 1.0161 +4.4207 1.0198 1.0488 +4.4214 1.044 1.082 +4.4046 1.0512 1.1064 +4.3852 1.0564 1.1307 +4.3269 1.1175 1.2803 +4.2877 1.187 1.4342 +4.253 1.2599 1.5876 +4.2618 1.2808 1.6128 +4.2701 1.3016 1.638 +4.2468 1.3069 1.667 +4.2232 1.3122 1.6959 +4.1493 1.429 1.9263 +4.0713 1.5533 2.1501 +4.0804 1.5779 2.1746 +4.0896 1.6026 2.199 +4.0655 1.6035 2.2162 +4.0404 1.6056 2.2309 +3.9908 1.6849 2.2825 +3.9305 1.78 2.2909 +3.8683 1.8815 2.2658 +3.8785 1.91 2.2591 +3.889 1.9384 2.2516 +3.8687 1.9492 2.247 +3.8409 1.9519 2.2451 +3.8217 1.9604 2.237 +3.7612 2.0598 2.1197 +3.71 2.1405 1.9723 +3.6637 2.2115 1.8069 +3.6179 2.2816 1.6354 +3.5684 2.3597 1.4697 +3.5108 2.4545 1.3218 +3.5094 2.4867 1.2919 +3.5193 2.5252 1.2654 +3.5163 2.5605 1.2391 +3.4957 2.566 1.2278 +3.4658 2.5618 1.2214 +3.4443 2.5686 1.2145 +3.388 2.6662 1.2011 +3.3242 2.7767 1.2254 +3.2574 2.8924 1.2631 +3.1919 3.0059 1.2893 +4.6823 0.6129 0.5422 +4.6605 0.6343 0.5757 +4.5488 0.8176 0.7953 +4.4504 0.978 1.0407 +4.4443 1.0061 1.0676 +4.4385 1.0338 1.0951 +4.4276 1.0373 1.1235 +4.4157 1.038 1.153 +4.3681 1.0925 1.3097 +4.3286 1.162 1.4628 +4.2906 1.2367 1.6135 +4.2898 1.2636 1.6322 +4.2887 1.2903 1.6511 +4.2746 1.29 1.6869 +4.2603 1.2897 1.7227 +4.1888 1.4058 1.9571 +4.1129 1.5294 2.185 +4.1117 1.56 2.2009 +4.1104 1.5908 2.2167 +4.0949 1.5888 2.2475 +4.0784 1.5881 2.275 +4.0223 1.6805 2.3385 +3.9545 1.7915 2.3541 +3.8836 1.9097 2.3289 +3.8896 1.9319 2.3063 +3.8958 1.9539 2.2827 +3.8751 1.9728 2.2838 +3.8485 1.9871 2.2937 +3.8294 2.0028 2.2907 +3.7693 2.1031 2.1711 +3.7179 2.1865 2.0235 +3.671 2.2612 1.8592 +3.6243 2.3356 1.6896 +3.5736 2.418 1.5262 +3.5147 2.5165 1.3803 +3.5134 2.5397 1.3448 +3.5231 2.5621 1.3055 +3.5206 2.5876 1.2729 +3.5038 2.5953 1.2743 +3.4793 2.5981 1.2879 +3.4617 2.6072 1.2912 +3.4098 2.6972 1.2749 +3.3497 2.801 1.3014 +3.2865 2.9104 1.3429 +3.2247 3.0174 1.3715 +3.0469 0.2521 0.5494 +3.0467 0.25 0.5103 +3.0696 0.2554 0.5422 +3.0803 0.284 0.5757 +3.0493 0.2795 0.5854 +3.0678 0.4908 0.8053 +3.1041 0.4973 0.7953 +3.1255 0.6843 1.0407 +3.0839 0.6758 1.0506 +3.0865 0.7056 1.0753 +3.1192 0.7123 1.0676 +3.1127 0.7398 1.0951 +3.0891 0.7348 1.1003 +3.0896 0.7409 1.1304 +3.1211 0.7477 1.1235 +3.1316 0.7533 1.153 +3.0899 0.7442 1.162 +3.0957 0.8106 1.3217 +3.1517 0.8228 1.3097 +3.1581 0.9025 1.4628 +3.1027 0.8903 1.4745 +3.1101 0.975 1.624 +3.161 0.9863 1.6135 +3.1504 1.011 1.6322 +3.1125 1.0026 1.6401 +3.1149 1.0301 1.6564 +3.1401 1.0357 1.6511 +3.153 1.0414 1.6869 +3.1152 1.0331 1.695 +3.1155 1.0361 1.7336 +3.166 1.0471 1.7227 +3.1818 1.1826 1.9571 +3.1273 1.1711 1.9696 +3.1399 1.3149 2.1992 +3.1983 1.3266 2.185 +3.1865 1.3549 2.2009 +3.1426 1.346 2.2116 +3.1453 1.3775 2.2239 +3.1747 1.3833 2.2167 +3.1896 1.3881 2.2475 +3.1456 1.3806 2.2599 +3.146 1.3855 2.293 +3.2048 1.3944 2.275 +3.2166 1.5019 2.3385 +3.1559 1.4988 2.3611 +3.1679 1.6355 2.38 +3.2312 1.6311 2.3541 +3.2455 1.7682 2.3289 +3.1806 1.7808 2.3549 +3.1819 1.7957 2.3258 +3.2307 1.7858 2.3063 +3.2157 1.8031 2.2827 +3.1832 1.8102 2.2955 +3.1857 1.8394 2.299 +3.2265 1.829 2.2838 +3.2446 1.8532 2.2937 +3.1883 1.8688 2.3137 +3.1906 1.8946 2.3125 +3.2553 1.8755 2.2907 +3.2673 1.9918 2.1711 +3.2008 2.0111 2.1921 +3.2094 2.1096 2.0443 +3.2786 2.0891 2.0235 +3.2895 2.1767 1.8592 +3.2172 2.199 1.8803 +3.225 2.2882 1.7115 +3.3004 2.2638 1.6896 +3.3116 2.3599 1.5262 +3.2336 2.3863 1.549 +3.2437 2.5022 1.4041 +3.3233 2.4741 1.3803 +3.3147 2.4956 1.3448 +3.2452 2.5195 1.3664 +3.246 2.5286 1.322 +3.2965 2.5119 1.3055 +3.288 2.5361 1.2729 +3.2478 2.5484 1.2868 +3.2491 2.564 1.2927 +3.2999 2.5501 1.2743 +3.3209 2.563 1.2879 +3.2505 2.5795 1.3149 +3.2519 2.5959 1.3228 +3.333 2.5786 1.2912 +3.3421 2.6822 1.2749 +3.2607 2.6957 1.305 +3.2708 2.8119 1.3325 +3.3526 2.8016 1.3014 +3.3637 2.9275 1.3429 +3.2816 2.9349 1.3758 +3.2921 3.0551 1.4055 +3.3745 3.0506 1.3715 +3.0801 0.2673 0.5247 +3.0946 0.3004 0.552 +3.1211 0.5197 0.7708 +3.1452 0.7124 1.0161 +3.1347 0.7347 1.0488 +3.1239 0.7564 1.082 +3.1361 0.7699 1.1064 +3.1515 0.7828 1.1307 +3.1785 0.8629 1.2803 +3.1846 0.9424 1.4342 +3.1853 1.0232 1.5876 +3.1685 1.0384 1.6128 +3.1521 1.0537 1.638 +3.1711 1.0684 1.667 +3.1902 1.0832 1.6959 +3.2078 1.2203 1.9263 +3.226 1.3659 2.1501 +3.2073 1.3843 2.1746 +3.1885 1.4029 2.199 +3.21 1.4138 2.2162 +3.2319 1.4264 2.2309 +3.2433 1.5192 2.2825 +3.2577 1.6309 2.2909 +3.2712 1.7491 2.2658 +3.2499 1.7707 2.2591 +3.2284 1.7919 2.2516 +3.2423 1.8103 2.247 +3.2663 1.8245 2.2451 +3.2801 1.8403 2.237 +3.2929 1.9559 2.1197 +3.3052 2.0508 1.9723 +3.3172 2.1347 1.8069 +3.3291 2.2176 1.6354 +3.3409 2.3092 1.4697 +3.3531 2.4195 1.3218 +3.3408 2.4493 1.2919 +3.3155 2.48 1.2654 +3.3032 2.5133 1.2391 +3.3196 2.5269 1.2278 +3.3486 2.5358 1.2214 +3.3651 2.5511 1.2145 +3.3749 2.6633 1.2011 +3.386 2.7904 1.2254 +3.3977 2.9235 1.2631 +3.4091 3.054 1.2893 +3.0719 0.281 0.5072 +3.0834 0.3191 0.5282 +3.1082 0.5447 0.7464 +3.1307 0.7435 0.9916 +3.1233 0.7595 1.0299 +3.1157 0.7746 1.069 +3.1252 0.7945 1.0894 +3.137 0.8154 1.1084 +3.1591 0.9069 1.2508 +3.1654 0.9862 1.4055 +3.1677 1.0637 1.5618 +3.1554 1.0685 1.5934 +3.1434 1.0736 1.6249 +3.158 1.0981 1.6471 +3.1727 1.1229 1.6691 +3.1888 1.2619 1.8954 +3.2056 1.4093 2.1151 +3.192 1.4169 2.1482 +3.1783 1.4246 2.1813 +3.1944 1.4427 2.1851 +3.2107 1.4625 2.187 +3.2199 1.5407 2.227 +3.2316 1.6352 2.2282 +3.2426 1.7349 2.2028 +3.2283 1.7592 2.2119 +3.2139 1.7831 2.2206 +3.2235 1.7944 2.2102 +3.24 1.8001 2.1962 +3.2495 1.8099 2.1832 +3.2615 1.9252 2.0686 +3.2725 2.0182 1.9219 +3.2828 2.099 1.7556 +3.2929 2.178 1.5823 +3.3033 2.2654 1.4142 +3.3143 2.3714 1.2639 +3.3071 2.4085 1.2393 +3.2912 2.4521 1.2254 +3.2843 2.4935 1.2052 +3.2962 2.5077 1.1817 +3.3166 2.5141 1.1557 +3.3287 2.5298 1.1387 +3.3392 2.6498 1.1261 +3.3511 2.7845 1.1483 +3.3635 2.9253 1.1829 +3.3756 3.0635 1.2071 +3.05 0.2882 0.5 +3.0536 0.3289 0.5185 +3.0736 0.5574 0.7364 +3.0912 0.759 0.9816 +3.0923 0.7718 1.0223 +3.0934 0.7836 1.0638 +3.0954 0.8066 1.0825 +3.0976 0.8316 1.0994 +3.1061 0.9286 1.2389 +3.113 1.0079 1.3939 +3.1196 1.0837 1.5513 +3.1196 1.0833 1.5856 +3.1196 1.0835 1.6196 +3.1222 1.1129 1.639 +3.1248 1.1426 1.6582 +3.137 1.2827 1.8828 +3.15 1.4311 2.1009 +3.1502 1.4333 2.1375 +3.1504 1.4354 2.1741 +3.1524 1.4577 2.1727 +3.1544 1.4814 2.1691 +3.1608 1.5541 2.2046 +3.1685 1.6418 2.2025 +3.1765 1.7337 2.1768 +3.1786 1.7579 2.1925 +3.1807 1.7818 2.2077 +3.1815 1.791 2.195 +3.1818 1.7946 2.176 +3.1825 1.8023 2.1613 +3.1926 1.918 2.048 +3.2007 2.0104 1.9017 +3.2077 2.0901 1.7351 +3.2145 2.1676 1.5609 +3.222 2.2533 1.3918 +3.2311 2.3578 1.2404 +3.2345 2.3971 1.2178 +3.2387 2.4445 1.2089 +3.2425 2.4884 1.1913 +3.2438 2.5029 1.1634 +3.2444 2.5103 1.1291 +3.2459 2.527 1.1076 +3.2567 2.6501 1.0954 +3.2687 2.788 1.1166 +3.2813 2.9321 1.1497 +3.2937 3.0733 1.1731 +3.0273 0.2849 0.5072 +3.0225 0.3244 0.5282 +3.0373 0.5509 0.7464 +3.0497 0.7506 0.9916 +3.0597 0.765 1.0299 +3.0698 0.7786 1.069 +3.0639 0.7998 1.0894 +3.0559 0.8225 1.1084 +3.0501 0.9164 1.2508 +3.0576 0.9957 1.4055 +3.0688 1.0723 1.5618 +3.0817 1.0749 1.5934 +3.0944 1.0779 1.6249 +3.0844 1.1046 1.6471 +3.0742 1.1315 1.6691 +3.0825 1.2712 1.8954 +3.0915 1.4193 2.1151 +3.1062 1.4244 2.1482 +3.1211 1.4296 2.1813 +3.1084 1.4502 2.1851 +3.0957 1.4725 2.187 +3.1002 1.5511 2.227 +3.1051 1.6462 2.2282 +3.1116 1.7463 2.2028 +3.1299 1.7678 2.2119 +3.1482 1.7888 2.2206 +3.1408 1.8016 2.2102 +3.1255 1.8101 2.1962 +3.1178 1.8214 2.1832 +3.126 1.9371 2.0686 +3.1314 2.0305 1.9219 +3.1353 2.1119 1.7556 +3.139 2.1915 1.5823 +3.144 2.2793 1.4142 +3.1516 2.3857 1.2639 +3.1651 2.4209 1.2393 +3.1882 2.4611 1.2254 +3.2023 2.5007 1.2052 +3.193 2.5168 1.1817 +3.174 2.5266 1.1557 +3.1649 2.5441 1.1387 +3.1753 2.6641 1.1261 +3.187 2.7988 1.1483 +3.1993 2.9397 1.1829 +3.2113 3.0778 1.2071 +3.0168 0.2729 0.5247 +3.0082 0.308 0.552 +3.0203 0.5285 0.7708 +3.03 0.7225 1.0161 +3.0442 0.7426 1.0488 +3.0586 0.7621 1.082 +3.0489 0.7776 1.1064 +3.036 0.7929 1.1307 +3.0233 0.8765 1.2803 +3.0311 0.9559 1.4342 +3.0444 1.0355 1.5876 +3.0636 1.0476 1.6128 +3.0824 1.0598 1.638 +3.0663 1.0776 1.667 +3.0501 1.0954 1.6959 +3.0565 1.2335 1.9263 +3.0639 1.38 2.1501 +3.0855 1.395 2.1746 +3.1072 1.41 2.199 +3.0879 1.4245 2.2162 +3.0686 1.4407 2.2309 +3.0734 1.534 2.2825 +3.0787 1.6465 2.2909 +3.0859 1.7654 2.2658 +3.1106 1.7829 2.2591 +3.1355 1.8 2.2516 +3.125 1.8206 2.247 +3.1038 1.8387 2.2451 +3.0929 1.8567 2.237 +3.1004 1.9728 2.1197 +3.1048 2.0683 1.9723 +3.1075 2.1531 1.8069 +3.1103 2.2367 1.6354 +3.1145 2.3291 1.4697 +3.1217 2.4398 1.3218 +3.139 2.467 1.2919 +3.1692 2.4928 1.2654 +3.187 2.5235 1.2391 +3.1733 2.5397 1.2278 +3.1463 2.5535 1.2214 +3.1327 2.5714 1.2145 +3.1425 2.6836 1.2011 +3.1536 2.8107 1.2254 +3.1653 2.9439 1.2631 +3.1767 3.0744 1.2893 +3.025 0.2593 0.5422 +3.0195 0.2893 0.5757 +3.0331 0.5035 0.7953 +3.0445 0.6914 1.0407 +3.0556 0.7179 1.0676 +3.0667 0.7439 1.0951 +3.0598 0.7531 1.1235 +3.0505 0.7604 1.153 +3.0427 0.8324 1.3097 +3.0503 0.912 1.4628 +3.062 0.995 1.6135 +3.0767 1.0174 1.6322 +3.0911 1.0399 1.6511 +3.0794 1.0478 1.6869 +3.0676 1.0557 1.7227 +3.0755 1.1919 1.9571 +3.0843 1.3366 2.185 +3.1008 1.3624 2.2009 +3.1175 1.3883 2.2167 +3.1036 1.3957 2.2475 +3.0897 1.4045 2.275 +3.0967 1.5123 2.3385 +3.1048 1.6422 2.3541 +3.1145 1.7797 2.3289 +3.1322 1.7944 2.3063 +3.15 1.8089 2.2827 +3.1438 1.8363 2.2838 +3.1302 1.8632 2.2937 +3.1235 1.887 2.2907 +3.1319 2.0037 2.1711 +3.1376 2.1014 2.0235 +3.1421 2.1896 1.8592 +3.1465 2.2773 1.6896 +3.1522 2.3738 1.5262 +3.1605 2.4883 1.3803 +3.1727 2.508 1.3448 +3.1935 2.5209 1.3055 +3.206 2.5432 1.2729 +3.1967 2.5591 1.2743 +3.1782 2.5755 1.2879 +3.1691 2.593 1.2912 +3.1781 2.6965 1.2749 +3.1885 2.816 1.3014 +3.1994 2.9419 1.3429 +3.2102 3.0649 1.3715 +1.4892 0.4883 0.8236 +1.486 0.4836 0.7849 +1.5107 0.4797 0.8159 +1.5377 0.5041 0.8464 +1.5085 0.5158 0.8569 +1.6542 0.7239 1.0553 +1.6892 0.7115 1.0443 +1.8251 0.8967 1.2705 +1.7843 0.9098 1.2818 +1.8045 0.9386 1.3034 +1.8366 0.9284 1.2948 +1.8477 0.9598 1.3195 +1.8244 0.967 1.3256 +1.8298 0.9747 1.3549 +1.861 0.9652 1.347 +1.8748 0.9675 1.3757 +1.8335 0.98 1.3861 +1.8838 1.0518 1.5387 +1.9393 1.0351 1.5249 +1.9972 1.1188 1.6697 +1.9422 1.1352 1.6832 +2.0036 1.223 1.8238 +2.0542 1.208 1.8117 +2.0597 1.2381 1.8281 +2.0221 1.2493 1.8372 +2.0404 1.2755 1.8508 +2.0654 1.268 1.8446 +2.0817 1.2697 1.8796 +2.0442 1.2809 1.8889 +2.0481 1.2864 1.9271 +2.0982 1.2713 1.9146 +2.1997 1.4094 2.1349 +2.146 1.4262 2.1491 +2.249 1.5734 2.3638 +2.3063 1.5548 2.3479 +2.3126 1.5887 2.3611 +2.2695 1.6027 2.3732 +2.2902 1.6321 2.3824 +2.3188 1.6228 2.3743 +2.3361 1.6222 2.4043 +2.294 1.6376 2.4179 +2.2988 1.6444 2.4504 +2.3543 1.6227 2.4309 +2.428 1.7238 2.4837 +2.3743 1.7524 2.5073 +2.4624 1.8781 2.5128 +2.5139 1.8409 2.4868 +2.602 1.9627 2.4483 +2.5538 2.0086 2.4737 +2.5618 2.0201 2.4432 +2.5978 1.9852 2.4243 +2.5932 2.0075 2.3992 +2.5695 2.0311 2.4116 +2.5883 2.0579 2.4122 +2.6173 2.0268 2.3977 +2.6471 2.0416 2.4051 +2.6078 2.0857 2.424 +2.6242 2.1091 2.4203 +2.6688 2.0573 2.3998 +2.7386 2.1538 2.2693 +2.6924 2.2066 2.2891 +2.7478 2.2857 2.1323 +2.7957 2.2303 2.1128 +2.8461 2.2966 1.9406 +2.7965 2.3553 1.9603 +2.845 2.4245 1.7834 +2.896 2.3622 1.7631 +2.9515 2.4366 1.5909 +2.8994 2.5022 1.6119 +2.966 2.5973 1.4563 +3.0185 2.5292 1.4344 +3.0213 2.5515 1.3971 +2.9751 2.6104 1.4171 +2.9787 2.6154 1.372 +3.0125 2.5734 1.3566 +3.017 2.5983 1.322 +2.9895 2.631 1.3351 +2.9998 2.6456 1.3394 +3.0354 2.6059 1.3218 +3.0616 2.6089 1.334 +3.0108 2.6613 1.36 +3.0216 2.6768 1.3662 +3.0811 2.6181 1.3357 +3.1422 2.7054 1.3097 +3.0804 2.7607 1.3391 +3.147 2.8558 1.3559 +3.211 2.8035 1.3252 +3.2846 2.9086 1.3549 +3.2188 2.9584 1.3877 +3.2929 3.0642 1.4059 +3.3605 3.0169 1.3718 +3.2929 3.0642 1.2905 +1.5256 0.4847 0.7973 +1.5581 0.511 0.8211 +1.7151 0.7227 1.0178 +1.8565 0.912 1.2434 +1.8615 0.9408 1.2738 +1.8659 0.9691 1.305 +1.8854 0.9778 1.3278 +1.9072 0.9843 1.3507 +1.9832 1.0579 1.4917 +2.0408 1.1417 1.6373 +2.0944 1.2293 1.7823 +2.0896 1.2539 1.8062 +2.0852 1.2784 1.8298 +2.1113 1.2851 1.8572 +2.1377 1.2919 1.8844 +2.2415 1.4303 2.1005 +2.3503 1.5761 2.3093 +2.3456 1.6046 2.332 +2.3408 1.6333 2.3547 +2.3666 1.6344 2.3707 +2.3934 1.6367 2.3839 +2.458 1.7231 2.4262 +2.5336 1.8232 2.4237 +2.6105 1.9274 2.3872 +2.6037 1.958 2.3787 +2.5965 1.9883 2.3693 +2.6186 1.9986 2.3628 +2.6475 2.0002 2.3593 +2.668 2.0079 2.3496 +2.7381 2.1035 2.2215 +2.7947 2.1773 2.0655 +2.844 2.2396 1.8925 +2.8922 2.3005 1.7135 +2.9457 2.3702 1.5395 +3.0107 2.4588 1.3815 +3.0153 2.4911 1.3488 +3.0091 2.531 1.3197 +3.0158 2.5668 1.2904 +3.0372 2.5709 1.2777 +3.067 2.5647 1.2702 +3.0897 2.5706 1.2617 +3.1566 2.6661 1.2377 +3.23 2.771 1.2504 +3.3079 2.8823 1.2756 +3.3884 2.9973 1.2893 +1.5252 0.5004 0.7787 +1.5576 0.5325 0.7959 +1.7168 0.7509 0.9913 +1.8601 0.9468 1.2162 +1.8646 0.9684 1.2529 +1.8684 0.9894 1.2904 +1.8889 1.0051 1.3087 +1.9119 1.0205 1.3256 +1.9896 1.1069 1.4585 +2.0474 1.1904 1.6049 +2.1006 1.2743 1.753 +2.0942 1.2873 1.7842 +2.0882 1.3005 1.815 +2.1157 1.3182 1.8347 +2.1435 1.336 1.8542 +2.2469 1.4768 2.0661 +2.3552 1.6247 2.2707 +2.3492 1.6411 2.3029 +2.3432 1.6576 2.3352 +2.3676 1.6672 2.3371 +2.3931 1.6781 2.337 +2.4469 1.751 2.3693 +2.5102 1.8356 2.3612 +2.5744 1.9234 2.3261 +2.5761 1.9543 2.333 +2.5773 1.9848 2.3394 +2.5916 1.9901 2.3279 +2.6085 1.9864 2.3133 +2.6218 1.9901 2.2994 +2.6912 2.086 2.174 +2.7456 2.1588 2.0188 +2.7917 2.2189 1.8453 +2.8362 2.2768 1.6649 +2.8859 2.343 1.489 +2.9475 2.428 1.329 +2.9607 2.4651 1.3009 +2.9705 2.5134 1.2829 +2.9866 2.5549 1.2588 +3.0038 2.5609 1.2339 +3.0239 2.5551 1.2072 +3.0423 2.5629 1.1886 +3.1142 2.6655 1.1647 +3.1924 2.7771 1.1744 +3.2751 2.8951 1.1958 +3.3605 3.0169 1.2068 +1.5098 0.5176 0.771 +1.5367 0.556 0.7854 +1.6931 0.7795 0.9803 +1.8339 0.9806 1.205 +1.8441 0.9951 1.2442 +1.8537 1.0088 1.2844 +1.8693 1.0311 1.3008 +1.886 1.055 1.3152 +1.9549 1.1533 1.4447 +2.0131 1.2365 1.5915 +2.0693 1.3167 1.7409 +2.0708 1.3189 1.7751 +2.0726 1.3214 1.8089 +2.0923 1.3496 1.8254 +2.1122 1.378 1.8417 +2.2127 1.5215 2.0518 +2.3182 1.6722 2.2547 +2.3214 1.6768 2.2909 +2.3246 1.6814 2.3271 +2.3387 1.7015 2.3235 +2.3536 1.7228 2.3176 +2.4018 1.7916 2.3459 +2.4576 1.8712 2.3353 +2.5148 1.953 2.3008 +2.531 1.9761 2.3141 +2.547 1.999 2.327 +2.5523 2.0064 2.3134 +2.5536 2.0084 2.2941 +2.5578 2.0143 2.2787 +2.6259 2.1116 2.1546 +2.6775 2.1853 1.9999 +2.7199 2.2459 1.8262 +2.7606 2.3039 1.6451 +2.8067 2.3699 1.4683 +2.8658 2.4542 1.3073 +2.8897 2.4884 1.281 +2.9195 2.5309 1.2675 +2.9465 2.5696 1.2457 +2.9544 2.5808 1.2165 +2.9574 2.585 1.1817 +2.967 2.5988 1.1586 +3.0408 2.7042 1.1347 +3.121 2.8187 1.1431 +3.2057 2.9397 1.1628 +3.2929 3.0642 1.1727 +1.4883 0.5262 0.7787 +1.5074 0.5677 0.7959 +1.6582 0.7919 0.9913 +1.7932 0.9936 1.2162 +1.812 1.0053 1.2529 +1.8304 1.016 1.2904 +1.8382 1.0406 1.3087 +1.8448 1.0675 1.3256 +1.8994 1.1701 1.4585 +1.9581 1.2529 1.6049 +2.0187 1.3317 1.753 +2.0332 1.33 1.7842 +2.0476 1.3289 1.815 +2.0548 1.3608 1.8347 +2.0621 1.3931 1.8542 +2.159 1.5383 2.0661 +2.2609 1.6907 2.2707 +2.2784 1.6907 2.3029 +2.2959 1.6907 2.3352 +2.2966 1.7169 2.3371 +2.2982 1.7446 2.337 +2.3483 1.8201 2.3693 +2.4061 1.9085 2.3612 +2.4667 1.9989 2.3261 +2.4951 2.011 2.333 +2.5233 2.0226 2.3394 +2.5234 2.0378 2.3279 +2.5142 2.0525 2.3133 +2.5132 2.0662 2.2994 +2.5795 2.1642 2.174 +2.6293 2.2402 2.0188 +2.67 2.3041 1.8453 +2.7092 2.3657 1.6649 +2.7544 2.4351 1.489 +2.8132 2.522 1.329 +2.8435 2.5471 1.3009 +2.8856 2.5729 1.2829 +2.9191 2.6022 1.2588 +2.9188 2.6204 1.2339 +2.9065 2.6372 1.2072 +2.9075 2.6572 1.1886 +2.9794 2.7599 1.1647 +3.0574 2.8716 1.1744 +3.14 2.9896 1.1958 +3.2253 3.1115 1.2068 +1.4734 0.5212 0.7973 +1.4871 0.5608 0.8211 +1.6322 0.7807 1.0178 +1.7618 0.9783 1.2434 +1.7871 0.9929 1.2738 +1.8122 1.0067 1.305 +1.8137 1.028 1.3278 +1.8123 1.0507 1.3507 +1.8556 1.1473 1.4917 +1.9146 1.2301 1.6373 +1.9786 1.3104 1.7823 +2.0033 1.3143 1.8062 +2.0278 1.3185 1.8298 +2.0252 1.3454 1.8572 +2.0225 1.3725 1.8844 +2.1171 1.5174 2.1005 +2.2169 1.6694 2.3093 +2.2453 1.6748 2.332 +2.2739 1.6802 2.3547 +2.2662 1.7047 2.3707 +2.2591 1.7307 2.3839 +2.3183 1.8209 2.4262 +2.3864 1.9262 2.4237 +2.4581 2.0342 2.3872 +2.4891 2.0382 2.3787 +2.5201 2.0418 2.3693 +2.5222 2.0662 2.3628 +2.5138 2.0938 2.3593 +2.514 2.1157 2.3496 +2.5798 2.2143 2.2215 +2.6299 2.2927 2.0655 +2.6716 2.3603 1.8925 +2.7123 2.4265 1.7135 +2.7595 2.5006 1.5395 +2.8205 2.592 1.3815 +2.8493 2.6073 1.3488 +2.8889 2.6152 1.3197 +2.9203 2.6337 1.2904 +2.9169 2.6552 1.2777 +2.9007 2.6811 1.2702 +2.8986 2.7044 1.2617 +2.9655 2.7999 1.2377 +3.0389 2.9048 1.2504 +3.1169 3.0161 1.2756 +3.1974 3.1311 1.2893 +1.4738 0.5055 0.8159 +1.4875 0.5393 0.8464 +1.6306 0.7525 1.0443 +1.7581 0.9436 1.2705 +1.784 0.9653 1.2948 +1.8097 0.9864 1.3195 +1.8102 1.0007 1.347 +1.8076 1.0145 1.3757 +1.8491 1.0982 1.5249 +1.908 1.1813 1.6697 +1.9723 1.2654 1.8117 +1.9987 1.2808 1.8281 +2.0249 1.2964 1.8446 +2.0208 1.3123 1.8796 +2.0167 1.3283 1.9146 +2.1118 1.4709 2.1349 +2.212 1.6209 2.3479 +2.2417 1.6383 2.3611 +2.2716 1.6559 2.3743 +2.2651 1.6719 2.4043 +2.2593 1.6892 2.4309 +2.3291 1.793 2.4837 +2.4098 1.9138 2.4868 +2.4942 2.0382 2.4483 +2.5167 2.042 2.4243 +2.5392 2.0453 2.3992 +2.5492 2.0745 2.3977 +2.5528 2.1076 2.4051 +2.5602 2.1334 2.3998 +2.6269 2.2319 2.2693 +2.6794 2.3117 2.1128 +2.7244 2.3818 1.9406 +2.769 2.4512 1.7631 +2.8199 2.5287 1.5909 +2.884 2.6233 1.4344 +2.904 2.6336 1.3971 +2.9276 2.6329 1.3566 +2.9495 2.6456 1.322 +2.9503 2.6654 1.3218 +2.9441 2.6911 1.334 +2.9461 2.7126 1.3357 +3.0073 2.7999 1.3097 +3.076 2.8981 1.3252 +3.1495 3.0032 1.3549 +3.2253 3.1115 1.3718 +0.2555 3.8781 0.8236 +0.25 3.8796 0.7849 +0.2547 3.855 0.8159 +0.2869 3.8379 0.8464 +0.2879 3.8694 0.8569 +0.5332 3.8037 1.0553 +0.5335 3.7665 1.0443 +0.7541 3.7022 1.2705 +0.7524 3.7449 1.2818 +0.7864 3.7358 1.3034 +0.7879 3.7022 1.2948 +0.8212 3.7025 1.3195 +0.8199 3.7268 1.3256 +0.829 3.7244 1.3549 +0.8307 3.6919 1.347 +0.8376 3.6797 1.3757 +0.8352 3.7227 1.3861 +0.9199 3.7 1.5387 +0.9232 3.6422 1.5249 +1.0217 3.6164 1.6697 +1.0183 3.6737 1.6832 +1.1217 3.646 1.8238 +1.125 3.5933 1.8117 +1.1552 3.5985 1.8281 +1.1528 3.6376 1.8372 +1.1837 3.6294 1.8508 +1.1852 3.6033 1.8446 +1.1923 3.5886 1.8796 +1.1901 3.6276 1.8889 +1.1966 3.6259 1.9271 +1.1995 3.5737 1.9146 +1.364 3.5255 2.1349 +1.3614 3.5817 2.1491 +1.535 3.5352 2.3638 +1.5371 3.4751 2.3479 +1.5711 3.4808 2.3611 +1.5695 3.526 2.3732 +1.6042 3.5167 2.3824 +1.6053 3.4865 2.3743 +1.6106 3.4701 2.4043 +1.6106 3.515 2.4179 +1.6187 3.5128 2.4504 +1.6173 3.4532 2.4309 +1.7375 3.4185 2.4837 +1.746 3.4787 2.5073 +1.8943 3.439 2.5128 +1.877 3.3778 2.4868 +2.0216 3.3367 2.4483 +2.0482 3.3977 2.4737 +2.0617 3.3941 2.4432 +2.0412 3.3484 2.4243 +2.0606 3.3602 2.3992 +2.0747 3.3906 2.4116 +2.1063 3.3821 2.4122 +2.087 3.3443 2.3977 +2.1111 3.3213 2.4051 +2.1391 3.3734 2.424 +2.1667 3.366 2.4203 +2.1333 3.3063 2.3998 +2.2478 3.2737 2.2693 +2.2817 3.3352 2.2891 +2.3749 3.3102 2.1323 +2.3393 3.2463 2.1128 +2.4188 3.2215 1.9406 +2.457 3.2882 1.9603 +2.5386 3.2663 1.7834 +2.4975 3.197 1.7631 +2.5863 3.1704 1.5909 +2.6302 3.2418 1.6119 +2.7423 3.2117 1.4563 +2.6963 3.1391 1.4344 +2.7182 3.1441 1.3971 +2.7578 3.2076 1.4171 +2.7637 3.206 1.372 +2.7358 3.1598 1.3566 +2.7608 3.1641 1.322 +2.782 3.2011 1.3351 +2.7993 3.1965 1.3394 +2.7742 3.1495 1.3218 +2.7859 3.1258 1.334 +2.8178 3.1915 1.36 +2.8361 3.1866 1.3662 +2.8012 3.1107 1.3357 +2.9042 3.0831 1.3097 +2.935 3.1601 1.3391 +3.0472 3.13 1.3559 +3.0199 3.052 1.3252 +3.1438 3.0188 1.3549 +3.1681 3.0976 1.3877 +3.2715 2.9845 1.3718 +0.2645 3.8427 0.7973 +0.3004 3.8212 0.8211 +0.553 3.746 1.0178 +0.7792 3.6779 1.2434 +0.808 3.683 1.2738 +0.8361 3.6885 1.305 +0.8509 3.6732 1.3278 +0.8645 3.6549 1.3507 +0.9597 3.6088 1.4917 +1.0581 3.5832 1.6373 +1.1587 3.5628 1.7823 +1.1802 3.5758 1.8062 +1.2017 3.5883 1.8298 +1.217 3.566 1.8572 +1.2323 3.5435 1.8844 +1.3979 3.4934 2.1005 +1.5721 3.441 2.3093 +1.5973 3.4552 2.332 +1.6227 3.4695 2.3547 +1.6325 3.4456 2.3707 +1.6438 3.4212 2.3839 +1.7472 3.3901 2.4262 +1.867 3.3532 2.4237 +1.9913 3.3166 2.3872 +2.0177 3.3335 2.3787 +2.0437 3.3506 2.3693 +2.061 3.3333 2.3628 +2.0723 3.3068 2.3593 +2.0866 3.2902 2.3496 +2.2004 3.2569 2.2215 +2.2891 3.229 2.0655 +2.3645 3.204 1.8925 +2.4382 3.1795 1.7135 +2.522 3.1531 1.5395 +2.6275 3.1223 1.3815 +2.6594 3.1291 1.3488 +2.6948 3.1485 1.3197 +2.7307 3.1545 1.2904 +2.7419 3.1358 1.2777 +2.7462 3.1056 1.2702 +2.7596 3.0864 1.2617 +2.8722 3.0562 1.2377 +2.9958 3.023 1.2504 +3.1271 2.9879 1.2756 +3.2627 2.9515 1.2893 +0.2791 3.8484 0.7787 +0.3204 3.8289 0.7959 +0.58 3.7541 0.9913 +0.8131 3.6863 1.2162 +0.835 3.6895 1.2529 +0.856 3.6931 1.2904 +0.8777 3.6793 1.3087 +0.9001 3.6629 1.3256 +1.0079 3.6195 1.4585 +1.1062 3.5937 1.6049 +1.2032 3.5724 1.753 +1.2132 3.5829 1.7842 +1.2235 3.5931 1.815 +1.2496 3.5732 1.8347 +1.2758 3.5532 1.8542 +1.4434 3.5042 2.0661 +1.6195 3.453 2.2707 +1.6329 3.4642 2.3029 +1.6463 3.4755 2.3352 +1.6637 3.4559 2.3371 +1.6827 3.4357 2.337 +1.7696 3.41 2.3693 +1.8707 3.3795 2.3612 +1.9752 3.3492 2.3261 +2.0047 3.3582 2.333 +2.0338 3.3674 2.3394 +2.0437 3.3559 2.3279 +2.0461 3.3387 2.3133 +2.0541 3.3275 2.2994 +2.1679 3.2951 2.174 +2.2549 3.2688 2.0188 +2.3271 3.2461 1.8453 +2.3967 3.224 1.6649 +2.476 3.2 1.489 +2.5769 3.1712 1.329 +2.6163 3.1714 1.3009 +2.665 3.1787 1.2829 +2.7096 3.1778 1.2588 +2.721 3.1637 1.2339 +2.7224 3.1429 1.2072 +2.7361 3.1282 1.1886 +2.8571 3.0957 1.1647 +2.9887 3.0604 1.1744 +3.1279 3.0231 1.1958 +3.2716 2.9845 1.2068 +0.29 3.8688 0.771 +0.3353 3.8567 0.7854 +0.5988 3.7861 0.9803 +0.8359 3.7225 1.205 +0.8531 3.718 1.2442 +0.8693 3.7136 1.2844 +0.8955 3.7066 1.3008 +0.9237 3.699 1.3152 +1.0396 3.668 1.4447 +1.1377 3.6417 1.5915 +1.2323 3.6163 1.7409 +1.2348 3.6157 1.7751 +1.2379 3.6148 1.8089 +1.271 3.606 1.8254 +1.3045 3.597 1.8417 +1.4738 3.5516 2.0518 +1.6515 3.504 2.2547 +1.6569 3.5026 2.2909 +1.6623 3.5011 2.3271 +1.6861 3.4948 2.3235 +1.7112 3.488 2.3176 +1.7922 3.4663 2.3459 +1.8862 3.4411 2.3353 +1.9826 3.4153 2.3008 +2.0099 3.408 2.3141 +2.0368 3.4008 2.327 +2.0456 3.3984 2.3134 +2.048 3.3978 2.2941 +2.0549 3.3959 2.2787 +2.1696 3.3652 2.1546 +2.2565 3.3419 1.9999 +2.328 3.3228 1.8262 +2.3964 3.3044 1.6451 +2.4742 3.2836 1.4683 +2.5736 3.2569 1.3073 +2.6139 3.2461 1.281 +2.664 3.2327 1.2675 +2.7096 3.2205 1.2457 +2.7229 3.2169 1.2165 +2.7279 3.2156 1.1817 +2.7441 3.2113 1.1586 +2.8684 3.178 1.1347 +3.0035 3.1418 1.1431 +3.1461 3.1035 1.1628 +0.2908 3.8919 0.7787 +0.3363 3.8882 0.7959 +0.5985 3.8232 0.9913 +0.8343 3.7653 1.2162 +0.8516 3.7516 1.2529 +0.868 3.738 1.2904 +0.8938 3.7391 1.3087 +0.9214 3.7421 1.3256 +1.0364 3.7258 1.4585 +1.1344 3.699 1.6049 +1.2291 3.669 1.753 +1.2325 3.6548 1.7842 +1.2363 3.6409 1.815 +1.2688 3.645 1.8347 +1.3016 3.6492 1.8542 +1.4712 3.6079 2.0661 +1.6493 3.5642 2.2707 +1.6553 3.5478 2.3029 +1.6613 3.5313 2.3352 +1.6861 3.5396 2.3371 +1.7126 3.5476 2.337 +1.8008 3.5264 2.3693 +1.9036 3.5023 2.3612 +2.0092 3.4762 2.3261 +2.0303 3.4537 2.333 +2.0509 3.4311 2.3394 +2.0652 3.4362 2.3279 +2.0759 3.4499 2.3133 +2.0884 3.4556 2.2994 +2.2032 3.4268 2.174 +2.2916 3.406 2.0188 +2.3656 3.3896 1.8453 +2.4369 3.3738 1.6649 +2.5175 3.3551 1.489 +2.6193 3.3296 1.329 +2.6533 3.3096 1.3009 +2.6919 3.2789 1.2829 +2.7309 3.2575 1.2588 +2.7479 3.2639 1.2339 +2.7595 3.2813 1.2072 +2.7787 3.2872 1.1886 +2.8997 3.2548 1.1647 +3.0313 3.2196 1.1744 +3.1706 3.1823 1.1958 +3.3143 3.1439 1.2068 +0.281 3.9042 0.7973 +0.3228 3.9049 0.8211 +0.5791 3.8437 1.0178 +0.8091 3.7896 1.2434 +0.8315 3.7708 1.2738 +0.8531 3.7519 1.305 +0.8736 3.7578 1.3278 +0.8945 3.7668 1.3507 +1 3.7592 1.4917 +1.098 3.7321 1.6373 +1.1953 3.6994 1.7823 +1.2074 3.6775 1.8062 +1.2198 3.6559 1.8298 +1.2442 3.6676 1.8572 +1.2687 3.6794 1.8844 +1.4372 3.64 2.1005 +1.6143 3.5982 2.3093 +1.629 3.5734 2.332 +1.6438 3.5483 2.3547 +1.6642 3.564 2.3707 +1.6862 3.5796 2.3839 +1.7913 3.5548 2.4262 +1.9135 3.5268 2.4237 +2.0395 3.4964 2.3872 +2.0539 3.4686 2.3787 +2.0678 3.4408 2.3693 +2.0915 3.4471 2.3628 +2.1146 3.4644 2.3593 +2.1352 3.4717 2.3496 +2.2504 3.4436 2.2215 +2.3412 3.4234 2.0655 +2.419 3.4073 1.8925 +2.4951 3.3917 1.7135 +2.5808 3.3727 1.5395 +2.6876 3.3466 1.3815 +2.7119 3.3248 1.3488 +2.7328 3.2903 1.3197 +2.7609 3.2671 1.2904 +2.7799 3.2777 1.2777 +2.7988 3.3017 1.2702 +2.8199 3.3117 1.2617 +2.9326 3.2815 1.2377 +3.0562 3.2484 1.2504 +3.1875 3.2132 1.2756 +3.3231 3.1769 1.2893 +0.2664 3.8984 0.8159 +0.3028 3.8971 0.8464 +0.5521 3.8356 1.0443 +0.7752 3.7811 1.2705 +0.8045 3.7642 1.2948 +0.8332 3.7473 1.3195 +0.8468 3.7517 1.347 +0.8588 3.7588 1.3757 +0.9517 3.7485 1.5249 +1.0499 3.7216 1.6697 +1.1509 3.6899 1.8117 +1.1744 3.6704 1.8281 +1.198 3.6511 1.8446 +1.2116 3.6604 1.8796 +1.2253 3.6697 1.9146 +1.3918 3.6292 2.1349 +1.5669 3.5862 2.3479 +1.5935 3.5643 2.3611 +1.6202 3.5423 2.3743 +1.633 3.5538 2.4043 +1.6473 3.5652 2.4309 +1.7687 3.535 2.4837 +1.9099 3.5006 2.4868 +2.0556 3.4638 2.4483 +2.0668 3.4439 2.4243 +2.0777 3.424 2.3992 +2.1085 3.4246 2.3977 +2.1409 3.4325 2.4051 +2.1676 3.4343 2.3998 +2.283 3.4053 2.2693 +2.376 3.3834 2.1128 +2.4573 3.365 1.9406 +2.5376 3.3468 1.7631 +2.6279 3.3255 1.5909 +2.7388 3.2976 1.4344 +2.7553 3.2824 1.3971 +2.7626 3.26 1.3566 +2.7821 3.2438 1.322 +2.801 3.2497 1.3218 +2.8231 3.2643 1.334 +2.8439 3.2698 1.3357 +2.9468 3.2422 1.3097 +3.0626 3.2112 1.3252 +3.1865 3.1781 1.3549 +3.3142 3.1439 1.3718 +1.2968 5.0603 0.5494 +1.2954 5.0617 0.5103 +1.2847 5.0407 0.5422 +1.2998 5.0141 0.5757 +1.3163 5.0408 0.5854 +1.4663 4.8908 0.8053 +1.4479 4.8588 0.7953 +1.5774 4.7222 1.0407 +1.5976 4.7595 1.0506 +1.6187 4.7384 1.0753 +1.6029 4.709 1.0676 +1.6282 4.6963 1.0951 +1.6395 4.7176 1.1003 +1.6438 4.7133 1.1304 +1.6288 4.6848 1.1235 +1.6263 4.6732 1.153 +1.6462 4.7109 1.162 +1.6933 4.6638 1.3217 +1.6667 4.613 1.3097 +1.7236 4.5569 1.4628 +1.7498 4.6073 1.4745 +1.8099 4.5472 1.624 +1.7859 4.5009 1.6135 +1.8116 4.4931 1.6322 +1.8296 4.5275 1.6401 +1.8491 4.508 1.6564 +1.8372 4.4852 1.6511 +1.8332 4.4716 1.6869 +1.8512 4.5059 1.695 +1.8533 4.5038 1.7336 +1.8293 4.4579 1.7227 +1.9229 4.3588 1.9571 +1.9492 4.4079 1.9696 +2.0512 4.3059 2.1992 +2.0226 4.2535 2.185 +2.0519 4.2444 2.2009 +2.0733 4.2838 2.2116 +2.0956 4.2615 2.2239 +2.0813 4.2352 2.2167 +2.0754 4.2207 2.2475 +2.0979 4.2592 2.2599 +2.1014 4.2557 2.293 +2.0704 4.205 2.275 +2.1451 4.1269 2.3385 +2.1818 4.1753 2.3611 +2.2788 4.0783 2.38 +2.2348 4.0326 2.3541 +2.3306 3.9335 2.3289 +2.382 3.9751 2.3549 +2.3925 3.9646 2.3258 +2.3536 3.9336 2.3063 +2.3765 3.934 2.2827 +2.4028 3.9543 2.2955 +2.4235 3.9336 2.299 +2.3894 3.909 2.2838 +2.3963 3.8796 2.2937 +2.4444 3.9127 2.3137 +2.4627 3.8944 2.3125 +2.4065 3.8571 2.2907 +2.4879 3.7731 2.1711 +2.5454 3.8117 2.1921 +2.6153 3.7418 2.0443 +2.5551 3.7019 2.0235 +2.6152 3.6373 1.8592 +2.6788 3.6783 1.8803 +2.7421 3.615 1.7115 +2.6749 3.5729 1.6896 +2.7413 3.5026 1.5262 +2.8117 3.5454 1.549 +2.894 3.4631 1.4041 +2.8213 3.4202 1.3803 +2.8433 3.413 1.3448 +2.9063 3.4508 1.3664 +2.9127 3.4444 1.322 +2.8675 3.4165 1.3055 +2.8915 3.4075 1.2729 +2.9268 3.4303 1.2868 +2.9378 3.4193 1.2927 +2.8945 3.3893 1.2743 +2.8909 3.3649 1.2879 +2.9489 3.4082 1.3149 +2.9605 3.3966 1.3228 +2.8951 3.3456 1.2912 +2.9686 3.2721 1.2749 +3.0313 3.3258 1.305 +3.1138 3.2433 1.3325 +3.0534 3.1872 1.3014 +3.1427 3.0978 1.3429 +3.2011 3.156 1.3758 +3.2864 3.0707 1.4055 +3.23 3.0105 1.3715 +3.2928 3.0643 1.2905 +1.2871 5.025 0.5247 +1.3032 4.9926 0.552 +1.4541 4.8314 0.7708 +1.5863 4.6891 1.0161 +1.6101 4.6827 1.0488 +1.6336 4.6771 1.082 +1.6362 4.659 1.1064 +1.6362 4.639 1.1307 +1.6801 4.5668 1.2803 +1.7371 4.511 1.4342 +1.7985 4.4586 1.5876 +1.821 4.4617 1.6128 +1.8433 4.4643 1.638 +1.8423 4.4404 1.667 +1.8414 4.4163 1.6959 +1.9351 4.3147 1.9263 +2.0349 4.2071 2.1501 +2.061 4.2096 2.1746 +2.0873 4.212 2.199 +2.0819 4.1885 2.2162 +2.0775 4.1637 2.2309 +2.1412 4.0953 2.2825 +2.2175 4.0125 2.2909 +2.2994 3.9261 2.2658 +2.3296 3.9286 2.2591 +2.3597 3.9314 2.2516 +2.3649 3.909 2.247 +2.3603 3.8814 2.2451 +2.3635 3.8607 2.237 +2.4439 3.7765 2.1197 +2.5087 3.7061 1.9723 +2.5653 3.643 1.8069 +2.6211 3.5807 1.6354 +2.6837 3.5127 1.4697 +2.7604 3.4325 1.3218 +2.7911 3.4227 1.2919 +2.8309 3.4224 1.2654 +2.8642 3.4104 1.2391 +2.8642 3.3891 1.2278 +2.8523 3.3612 1.2214 +2.8534 3.3387 1.2145 +2.9331 3.2591 1.2011 +3.0233 3.1689 1.2254 +3.1178 3.0744 1.2631 +3.2104 2.9817 1.2893 +1.3029 5.0225 0.5072 +1.3247 4.9892 0.5282 +1.4815 4.8252 0.7464 +1.6194 4.6802 0.9916 +1.6364 4.6756 1.0299 +1.6528 4.6716 1.069 +1.662 4.6516 1.0894 +1.6704 4.6291 1.1084 +1.7263 4.5534 1.2508 +1.783 4.4975 1.4055 +1.8409 4.446 1.5618 +1.8525 4.4523 1.5934 +1.8641 4.4582 1.6249 +1.8735 4.4313 1.6471 +1.8831 4.4041 1.6691 +1.9792 4.3024 1.8954 +2.0813 4.1948 2.1151 +2.0959 4.2004 2.1482 +2.1105 4.2059 2.1813 +2.1141 4.182 2.1851 +2.1187 4.1567 2.187 +2.1727 4.0994 2.227 +2.2376 4.0297 2.2282 +2.3069 3.9572 2.2028 +2.3347 3.9525 2.2119 +2.3623 3.9482 2.2206 +2.3648 3.9336 2.2102 +2.3586 3.9173 2.1962 +2.3599 3.9037 2.1832 +2.4406 3.8204 2.0686 +2.5048 3.7522 1.9219 +2.56 3.6923 1.7556 +2.614 3.6338 1.5823 +2.6743 3.5697 1.4142 +2.7485 3.4931 1.2639 +2.7815 3.4748 1.2393 +2.825 3.4589 1.2254 +2.8613 3.4376 1.2052 +2.8645 3.4194 1.1817 +2.8563 3.3996 1.1557 +2.8605 3.3803 1.1387 +2.9457 3.2951 1.1261 +3.0412 3.1994 1.1483 +3.1411 3.0994 1.1829 +3.2392 3.0013 1.2071 +1.3225 5.0346 0.5 +1.3514 5.0057 0.5185 +1.5135 4.8436 0.7364 +1.6567 4.7004 0.9816 +1.6657 4.6914 1.0223 +1.6741 4.683 1.0638 +1.6904 4.6667 1.0825 +1.7082 4.6489 1.0994 +1.7771 4.58 1.2389 +1.8333 4.5238 1.3939 +1.8871 4.47 1.5513 +1.8869 4.4702 1.5856 +1.887 4.4701 1.6196 +1.9078 4.4493 1.639 +1.9289 4.4282 1.6582 +2.0284 4.3287 1.8828 +2.1337 4.2234 2.1009 +2.1353 4.2218 2.1375 +2.1368 4.2203 2.1741 +2.1526 4.2045 2.1727 +2.1694 4.1877 2.1691 +2.221 4.1361 2.2046 +2.2833 4.0738 2.2025 +2.3485 4.0086 2.1768 +2.3656 3.9915 2.1925 +2.3826 3.9745 2.2077 +2.3892 3.9679 2.195 +2.3918 3.9653 2.176 +2.3972 3.9599 2.1613 +2.4793 3.8778 2.048 +2.5449 3.8122 1.9017 +2.6015 3.7556 1.7351 +2.6565 3.7006 1.5609 +2.7173 3.6398 1.3918 +2.7915 3.5656 1.2404 +2.8194 3.5377 1.2178 +2.853 3.5041 1.2089 +2.8842 3.4729 1.1913 +2.8945 3.4626 1.1634 +2.8997 3.4574 1.1291 +2.9116 3.4455 1.1076 +2.9989 3.3582 1.0954 +3.0969 3.2602 1.1166 +3.1991 3.158 1.1497 +3.2994 3.0577 1.1731 +1.3346 5.0542 0.5072 +1.3679 5.0324 0.5282 +1.5319 4.8756 0.7464 +1.6769 4.7377 0.9916 +1.6815 4.7207 1.0299 +1.6855 4.7043 1.069 +1.7055 4.6951 1.0894 +1.728 4.6867 1.1084 +1.8037 4.6308 1.2508 +1.8596 4.5741 1.4055 +1.9111 4.5162 1.5618 +1.9048 4.5046 1.5934 +1.8989 4.493 1.6249 +1.9258 4.4836 1.6471 +1.953 4.474 1.6691 +2.0547 4.3779 1.8954 +2.1623 4.2758 2.1151 +2.1567 4.2612 2.1482 +2.1512 4.2466 2.1813 +2.1751 4.243 2.1851 +2.2004 4.2384 2.187 +2.2577 4.1844 2.227 +2.3274 4.1195 2.2282 +2.3999 4.0502 2.2028 +2.4046 4.0224 2.2119 +2.4089 3.9948 2.2206 +2.4235 3.9923 2.2102 +2.4398 3.9985 2.1962 +2.4534 3.9972 2.1832 +2.5367 3.9165 2.0686 +2.6049 3.8523 1.9219 +2.6648 3.7971 1.7556 +2.7233 3.7431 1.5823 +2.7874 3.6828 1.4142 +2.864 3.6086 1.2639 +2.8823 3.5756 1.2393 +2.8982 3.5321 1.2254 +2.9195 3.4958 1.2052 +2.9377 3.4926 1.1817 +2.9575 3.5008 1.1557 +2.9768 3.4966 1.1387 +3.062 3.4114 1.1261 +3.1577 3.3159 1.1483 +3.2577 3.216 1.1829 +3.3558 3.1179 1.2071 +1.3321 5.07 0.5247 +1.3645 5.0539 0.552 +1.5257 4.903 0.7708 +1.668 4.7708 1.0161 +1.6744 4.747 1.0488 +1.68 4.7235 1.082 +1.6981 4.7209 1.1064 +1.7181 4.7209 1.1307 +1.7903 4.677 1.2803 +1.8461 4.62 1.4342 +1.8985 4.5586 1.5876 +1.8954 4.5361 1.6128 +1.8928 4.5138 1.638 +1.9167 4.5148 1.667 +1.9408 4.5157 1.6959 +2.0424 4.422 1.9263 +2.15 4.3222 2.1501 +2.1475 4.2961 2.1746 +2.1451 4.2698 2.199 +2.1686 4.2752 2.2162 +2.1934 4.2796 2.2309 +2.2618 4.2159 2.2825 +2.3446 4.1396 2.2909 +2.431 4.0577 2.2658 +2.4285 4.0275 2.2591 +2.4257 3.9974 2.2516 +2.4481 3.9922 2.247 +2.4757 3.9968 2.2451 +2.4964 3.9936 2.237 +2.5806 3.9132 2.1197 +2.651 3.8484 1.9723 +2.7141 3.7918 1.8069 +2.7764 3.736 1.6354 +2.8444 3.6734 1.4697 +2.9246 3.5967 1.3218 +2.9344 3.566 1.2919 +2.9347 3.5262 1.2654 +2.9467 3.4929 1.2391 +2.968 3.4929 1.2278 +2.9959 3.5048 1.2214 +3.0184 3.5037 1.2145 +3.098 3.424 1.2011 +3.1882 3.3338 1.2254 +3.2827 3.2393 1.2631 +3.3754 3.1467 1.2893 +1.3164 5.0724 0.5422 +1.343 5.0573 0.5757 +1.4983 4.9092 0.7953 +1.6349 4.7797 1.0407 +1.6481 4.7542 1.0676 +1.6608 4.7289 1.0951 +1.6723 4.7283 1.1235 +1.6839 4.7308 1.153 +1.7441 4.6904 1.3097 +1.8002 4.6335 1.4628 +1.8562 4.5712 1.6135 +1.864 4.5455 1.6322 +1.8719 4.5199 1.6511 +1.8855 4.5239 1.6869 +1.8992 4.5278 1.7227 +1.9983 4.4342 1.9571 +2.1036 4.3345 2.185 +2.1127 4.3052 2.2009 +2.1219 4.2758 2.2167 +2.1364 4.2817 2.2475 +2.1521 4.2867 2.275 +2.2302 4.212 2.3385 +2.3245 4.1223 2.3541 +2.4236 4.0265 2.3289 +2.4235 4.0035 2.3063 +2.4231 3.9806 2.2827 +2.4481 3.9677 2.2838 +2.4775 3.9608 2.2937 +2.5 3.9506 2.2907 +2.584 3.8692 2.1711 +2.6552 3.802 2.0235 +2.7198 3.7419 1.8592 +2.7842 3.6822 1.6896 +2.8545 3.6158 1.5262 +2.9369 3.5358 1.3803 +2.9441 3.5138 1.3448 +2.9406 3.4896 1.3055 +2.9496 3.4656 1.2729 +2.9678 3.4626 1.2743 +2.9922 3.4662 1.2879 +3.0115 3.462 1.2912 +3.085 3.3885 1.2749 +3.1699 3.3037 1.3014 +3.2593 3.2144 1.3429 +3.3466 3.1271 1.3715 +2.8027 5.8442 0.5494 +2.8024 5.8462 0.5103 +2.7816 5.8351 0.5422 +2.7786 5.8047 0.5757 +2.8075 5.8171 0.5854 +2.8443 5.6082 0.8053 +2.8109 5.5925 0.7953 +2.8386 5.4063 1.0407 +2.8766 5.4253 1.0506 +2.8818 5.3959 1.0753 +2.852 5.3809 1.0676 +2.8654 5.356 1.0951 +2.8869 5.367 1.1003 +2.8879 5.3609 1.1304 +2.8593 5.3462 1.1235 +2.8506 5.3381 1.153 +2.8885 5.3577 1.162 +2.9001 5.2921 1.3217 +2.8491 5.2657 1.3097 +2.8636 5.1871 1.4628 +2.914 5.2133 1.4745 +2.9287 5.1296 1.624 +2.8825 5.1055 1.6135 +2.8991 5.0843 1.6322 +2.9335 5.1022 1.6401 +2.9383 5.075 1.6564 +2.9155 5.0632 1.6511 +2.9045 5.0543 1.6869 +2.9389 5.0721 1.695 +2.9394 5.0691 1.7336 +2.8934 5.0454 1.7227 +2.9132 4.9104 1.9571 +2.9629 4.9356 1.9696 +2.988 4.7936 2.1992 +2.9345 4.767 2.185 +2.9532 4.7428 2.2009 +2.9934 4.7627 2.2116 +2.9989 4.7317 2.2239 +2.9721 4.7184 2.2167 +2.9589 4.7099 2.2475 +2.9994 4.7286 2.2599 +3.0003 4.7237 2.293 +2.9458 4.6999 2.275 +2.9622 4.5931 2.3385 +3.02 4.6117 2.3611 +3.0439 4.4766 2.38 +2.9816 4.4644 2.3541 +3.0032 4.3283 2.3289 +3.0692 4.3329 2.3549 +3.0718 4.3182 2.3258 +3.0221 4.3152 2.3063 +3.0411 4.3023 2.2827 +3.0743 4.3039 2.2955 +3.0794 4.275 2.299 +3.0373 4.2745 2.2838 +3.0261 4.2465 2.2937 +3.0845 4.246 2.3137 +3.089 4.2204 2.3125 +3.0216 4.2221 2.2907 +3.0401 4.1067 2.1711 +3.1093 4.1052 2.1921 +3.1265 4.0079 2.0443 +3.0543 4.0098 2.0235 +3.0664 3.9224 1.8592 +3.1421 3.9195 1.8803 +3.1576 3.8313 1.7115 +3.0785 3.8354 1.6896 +3.0926 3.7397 1.5262 +3.1747 3.7344 1.549 +3.1949 3.6198 1.4041 +3.1108 3.6264 1.3803 +3.1246 3.6078 1.3448 +3.198 3.6026 1.3664 +3.1995 3.5937 1.322 +3.1465 3.5967 1.3055 +3.161 3.5756 1.2729 +3.203 3.5741 1.2868 +3.2057 3.5587 1.2927 +3.1531 3.559 1.2743 +3.1361 3.5411 1.2879 +3.2084 3.5433 1.3149 +3.2113 3.5272 1.3228 +3.1285 3.5229 1.2912 +3.1465 3.4205 1.2749 +3.2287 3.4285 1.305 +3.2489 3.3136 1.3325 +3.1672 3.3024 1.3014 +3.1891 3.1779 1.3429 +3.2704 3.192 1.3758 +3.2913 3.0732 1.4055 +3.2106 3.0563 1.3715 +3.2929 3.0643 1.2905 +2.7745 5.8208 0.5247 +2.7691 5.7851 0.552 +2.8003 5.5665 0.7708 +2.8269 5.3741 1.0161 +2.8428 5.3552 1.0488 +2.8588 5.3371 1.082 +2.8505 5.3209 1.1064 +2.8391 5.3044 1.1307 +2.8337 5.2201 1.2803 +2.8483 5.1417 1.4342 +2.8686 5.0635 1.5876 +2.8887 5.0532 1.6128 +2.9085 5.0426 1.638 +2.894 5.0235 1.667 +2.8794 5.0043 1.6959 +2.8979 4.8673 1.9263 +2.918 4.722 2.1501 +2.9408 4.709 2.1746 +2.9637 4.6959 2.199 +2.9458 4.6798 2.2162 +2.9279 4.662 2.2309 +2.9409 4.5694 2.2825 +2.9559 4.4578 2.2909 +2.9735 4.3401 2.2658 +2.9996 4.3248 2.2591 +3.0259 4.3098 2.2516 +3.0173 4.2885 2.247 +2.9977 4.2685 2.2451 +2.9885 4.2497 2.237 +3.006 4.1347 2.1197 +3.0187 4.0399 1.9723 +3.0288 3.9557 1.8069 +3.0389 3.8726 1.6354 +3.0511 3.781 1.4697 +3.0679 3.6713 1.3218 +3.0875 3.6457 1.2919 +3.1199 3.6226 1.2654 +3.1403 3.5937 1.2391 +3.128 3.5762 1.2278 +3.1024 3.5602 1.2214 +3.0904 3.5412 1.2145 +3.1099 3.4302 1.2011 +3.1321 3.3046 1.2254 +3.1553 3.173 1.2631 +3.178 3.0439 1.2893 +2.786 5.8098 0.5072 +2.7848 5.77 0.5282 +2.8192 5.5457 0.7464 +2.849 5.3478 0.9916 +2.8602 5.3343 1.0299 +2.8714 5.3216 1.069 +2.8674 5.3 1.0894 +2.8614 5.2767 1.1084 +2.8638 5.1826 1.2508 +2.8782 5.1043 1.4055 +2.896 5.029 1.5618 +2.9091 5.0275 1.5934 +2.9221 5.0256 1.6249 +2.9144 4.9982 1.6471 +2.9066 4.9705 1.6691 +2.927 4.832 1.8954 +2.9489 4.6853 2.1151 +2.964 4.6815 2.1482 +2.9792 4.6776 2.1813 +2.9684 4.656 2.1851 +2.9577 4.6326 2.187 +2.9691 4.5547 2.227 +2.9823 4.4604 2.2282 +2.9974 4.3613 2.2028 +3.0175 4.3415 2.2119 +3.0376 4.3221 2.2206 +3.0313 4.3087 2.2102 +3.0168 4.2989 2.1962 +3.0101 4.287 2.1832 +3.0284 4.1725 2.0686 +3.0419 4.0799 1.9219 +3.0529 3.9991 1.7556 +3.0635 3.9202 1.5823 +3.0761 3.8331 1.4142 +3.093 3.7278 1.2639 +3.1095 3.6939 1.2393 +3.1361 3.6559 1.2254 +3.1535 3.6177 1.2052 +3.1457 3.6009 1.1817 +3.1276 3.5894 1.1557 +3.12 3.5711 1.1387 +3.1409 3.4525 1.1261 +3.1643 3.3193 1.1483 +3.1888 3.1801 1.1829 +3.2128 3.0435 1.2071 +2.809 5.8085 0.5 +2.8161 5.7682 0.5185 +2.8559 5.5424 0.7364 +2.8911 5.343 0.9816 +2.8933 5.3304 1.0223 +2.8954 5.3187 1.0638 +2.8994 5.296 1.0825 +2.9037 5.2713 1.0994 +2.9206 5.1754 1.2389 +2.9345 5.097 1.3939 +2.9477 5.0221 1.5513 +2.9476 5.0224 1.5856 +2.9476 5.0223 1.6196 +2.9528 4.9932 1.639 +2.9579 4.9639 1.6582 +2.9824 4.8253 1.8828 +3.0082 4.6786 2.1009 +3.0086 4.6765 2.1375 +3.009 4.6743 2.1741 +3.0129 4.6523 2.1727 +3.017 4.6289 2.1691 +3.0297 4.557 2.2046 +3.045 4.4703 2.2025 +3.061 4.3795 2.1768 +3.0652 4.3556 2.1925 +3.0694 4.332 2.2077 +3.071 4.3229 2.195 +3.0716 4.3192 2.176 +3.0729 4.3117 2.1613 +3.0931 4.1973 2.048 +3.1092 4.1059 1.9017 +3.1231 4.0271 1.7351 +3.1366 3.9506 1.5609 +3.1515 3.8658 1.3918 +3.1698 3.7625 1.2404 +3.1766 3.7237 1.2178 +3.1849 3.6768 1.2089 +3.1925 3.6334 1.1913 +3.1951 3.6191 1.1634 +3.1963 3.6118 1.1291 +3.1993 3.5952 1.1076 +3.2207 3.4736 1.0954 +3.2448 3.3372 1.1166 +3.2699 3.1948 1.1497 +3.2945 3.0552 1.1731 +2.8302 5.8176 0.5072 +2.8449 5.7806 0.5282 +2.8893 5.5581 0.7464 +2.929 5.362 0.9916 +2.9231 5.3454 1.0299 +2.9169 5.3297 1.069 +2.928 5.3107 1.0894 +2.9416 5.2908 1.1084 +2.9716 5.2016 1.2508 +2.9848 5.1231 1.4055 +2.9939 5.0462 1.5618 +2.982 5.0403 1.5934 +2.9705 5.0342 1.6249 +2.9871 5.011 1.6471 +3.0039 4.9876 1.6691 +3.0321 4.8505 1.8954 +3.0617 4.7052 2.1151 +3.0488 4.6964 2.1482 +3.0358 4.6876 2.1813 +3.0534 4.671 2.1851 +3.0714 4.6527 2.187 +3.0874 4.5756 2.227 +3.1073 4.4824 2.2282 +3.1269 4.3841 2.2028 +3.1148 4.3587 2.2119 +3.1025 4.3336 2.2206 +3.1131 4.3232 2.2102 +3.13 4.3189 2.1962 +3.1404 4.3099 2.1832 +3.1624 4.1961 2.0686 +3.1814 4.1044 1.9219 +3.1987 4.0248 1.7556 +3.2157 3.947 1.5823 +3.2336 3.8609 1.4142 +3.2538 3.7562 1.2639 +3.2499 3.7186 1.2393 +3.2379 3.6739 1.2254 +3.2346 3.6319 1.2052 +3.2477 3.6188 1.1817 +3.2686 3.6142 1.1557 +3.282 3.5997 1.1387 +3.3029 3.4811 1.1261 +3.3265 3.3479 1.1483 +3.3511 3.2087 1.1829 +3.3752 3.0721 1.2071 +2.8372 5.8319 0.5247 +2.8545 5.8002 0.552 +2.8999 5.584 0.7708 +2.9408 5.3942 1.0161 +2.9323 5.371 1.0488 +2.9234 5.3485 1.082 +2.9368 5.3361 1.1064 +2.9532 5.3245 1.1307 +2.9871 5.2472 1.2803 +3.0001 5.1685 1.4342 +3.0078 5.0881 1.5876 +2.9924 5.0715 1.6128 +2.9774 5.0547 1.638 +2.9976 5.0418 1.667 +3.0179 5.0287 1.6959 +3.0474 4.8937 1.9263 +3.0782 4.7502 2.1501 +3.0613 4.7302 2.1746 +3.0441 4.7101 2.199 +3.0665 4.7011 2.2162 +3.0894 4.6905 2.2309 +3.1088 4.599 2.2825 +3.1329 4.489 2.2909 +3.1567 4.3724 2.2658 +3.1374 4.349 2.2591 +3.1178 4.326 2.2516 +3.1332 4.3089 2.247 +3.1584 4.2969 2.2451 +3.1735 4.2823 2.237 +3.1964 4.1682 2.1197 +3.2169 4.0748 1.9723 +3.2361 3.9922 1.8069 +3.2551 3.9107 1.6354 +3.275 3.8205 1.4697 +3.2966 3.7117 1.3218 +3.287 3.6809 1.2919 +3.2645 3.6481 1.2654 +3.2552 3.6139 1.2391 +3.2727 3.6017 1.2278 +3.3023 3.5955 1.2214 +3.3201 3.5817 1.2145 +3.3397 3.4707 1.2011 +3.3618 3.3451 1.2254 +3.385 3.2135 1.2631 +3.4078 3.0845 1.2893 +2.8257 5.8429 0.5422 +2.8388 5.8153 0.5757 +2.8811 5.6049 0.7953 +2.9187 5.4205 1.0407 +2.9149 5.392 1.0676 +2.9108 5.364 1.0951 +2.9199 5.3569 1.1235 +2.9308 5.3523 1.153 +2.9569 5.2847 1.3097 +2.9702 5.2059 1.4628 +2.9804 5.1227 1.6135 +2.972 5.0972 1.6322 +2.9639 5.0717 1.6511 +2.9772 5.0672 1.6869 +2.9907 5.0625 1.7227 +3.0183 4.929 1.9571 +3.0473 4.7869 2.185 +3.038 4.7577 2.2009 +3.0286 4.7284 2.2167 +3.0439 4.7249 2.2475 +3.0596 4.7199 2.275 +3.0807 4.6139 2.3385 +3.1065 4.4865 2.3541 +3.1327 4.3511 2.3289 +3.1195 4.3323 2.3063 +3.106 4.3137 2.2827 +3.1191 4.2889 2.2838 +3.1392 4.2664 2.2937 +3.1518 4.2451 2.2907 +3.1739 4.1303 2.1711 +3.1937 4.0343 2.0235 +3.2122 3.9481 1.8592 +3.2306 3.8622 1.6896 +3.2501 3.7675 1.5262 +3.2718 3.6547 1.3803 +3.2651 3.6325 1.3448 +3.2483 3.6147 1.3055 +3.242 3.5899 1.2729 +3.2551 3.577 1.2743 +3.2772 3.566 1.2879 +3.2906 3.5514 1.2912 +3.3086 3.4491 1.2749 +3.3295 3.331 1.3014 +3.3515 3.2066 1.3429 +3.373 3.0849 1.3715 +4.3656 6.0115 0.5494 +4.3664 6.0137 0.5103 +4.3425 6.0137 0.5422 +4.3236 5.9858 0.5756 +4.3552 5.9829 0.5854 +4.2746 5.7613 0.8053 +4.2373 5.7634 0.7952 +4.1609 5.5687 1.0405 +4.204 5.5675 1.0506 +4.1927 5.5363 1.0753 +4.1588 5.5371 1.0675 +4.157 5.506 1.095 +4.1815 5.5056 1.1003 +4.1792 5.4992 1.1304 +4.1464 5.4997 1.1234 +4.1345 5.4964 1.1529 +4.1779 5.4957 1.162 +4.1526 5.4262 1.3217 +4.0943 5.4269 1.3095 +4.0644 5.3432 1.4626 +4.1222 5.3427 1.4745 +4.0899 5.2539 1.624 +4.0368 5.2543 1.6133 +4.0399 5.2253 1.6321 +4.0794 5.225 1.6401 +4.0689 5.1961 1.6564 +4.0426 5.1964 1.651 +4.0283 5.1935 1.6868 +4.0677 5.193 1.695 +4.0666 5.1899 1.7336 +4.0139 5.1905 1.7225 +3.9584 5.0495 1.9569 +4.0151 5.0483 1.9696 +3.9602 4.8977 2.1992 +3.8997 4.8995 2.1848 +3.9028 4.8664 2.2008 +3.9483 4.865 2.2116 +3.9364 4.8321 2.2239 +3.906 4.833 2.2166 +3.8901 4.8316 2.2473 +3.9352 4.8288 2.2599 +3.9333 4.8236 2.293 +3.8734 4.8287 2.2748 +3.8302 4.7167 2.3383 +3.8901 4.7049 2.3611 +3.8379 4.5616 2.38 +3.7778 4.5821 2.354 +3.7233 4.439 2.3288 +3.7825 4.4093 2.3549 +3.7768 4.3937 2.3258 +3.7325 4.4165 2.3063 +3.7419 4.3942 2.2827 +3.7713 4.3785 2.2955 +3.7601 4.3479 2.299 +3.7236 4.3692 2.2837 +3.6989 4.348 2.2936 +3.7489 4.3171 2.3137 +3.7391 4.2901 2.3125 +3.6819 4.3268 2.2905 +3.6357 4.2053 2.1709 +3.6946 4.1679 2.1921 +3.6571 4.0647 2.0443 +3.5959 4.1041 2.0233 +3.5593 4.0132 1.859 +3.623 3.971 1.8803 +3.5889 3.8775 1.7115 +3.5229 3.9227 1.6894 +3.4835 3.8228 1.5259 +3.5515 3.7747 1.549 +3.5073 3.6532 1.4041 +3.4383 3.7036 1.38 +3.4402 3.6783 1.3446 +3.5007 3.6351 1.3664 +3.4972 3.6256 1.322 +3.4531 3.6562 1.3053 +3.4543 3.6281 1.2729 +3.4897 3.6048 1.2868 +3.4837 3.5885 1.2927 +3.4385 3.6161 1.2742 +3.4143 3.6075 1.2878 +3.4778 3.5722 1.3149 +3.4716 3.555 1.3228 +3.398 3.5938 1.2912 +3.3585 3.4853 1.2748 +3.4335 3.4504 1.305 +3.3892 3.3287 1.3325 +3.3129 3.3601 1.3013 +3.2648 3.2282 1.3428 +3.3422 3.1997 1.3758 +3.2964 3.0738 1.4055 +3.2179 3.0992 1.3715 +4.3289 6.0035 0.5247 +4.305 5.9718 0.552 +4.2143 5.7438 0.7708 +4.1338 5.5436 1.0161 +4.1373 5.5171 1.0488 +4.1414 5.4912 1.082 +4.1255 5.4798 1.1064 +4.1068 5.4698 1.1307 +4.0569 5.3909 1.2803 +4.0273 5.3073 1.4342 +4.0027 5.2211 1.5876 +4.0145 5.2006 1.6128 +4.0258 5.1801 1.638 +4.0031 5.1692 1.667 +3.9802 5.1581 1.6959 +3.9225 5.0158 1.9263 +3.8616 4.8646 2.1501 +3.8742 4.8402 2.1746 +3.8869 4.8156 2.199 +3.8628 4.8093 2.2162 +3.8379 4.8013 2.2309 +3.7994 4.7049 2.2825 +3.7522 4.589 2.2909 +3.704 4.4658 2.2658 +3.7183 4.4375 2.2591 +3.7329 4.4094 2.2516 +3.714 4.3932 2.247 +3.6864 4.384 2.2451 +3.6684 4.3705 2.237 +3.6216 4.25 2.1197 +3.5816 4.1516 1.9723 +3.5451 4.0647 1.8069 +3.509 3.979 1.6354 +3.4703 3.884 1.4697 +3.4259 3.769 1.3218 +3.4289 3.734 1.2919 +3.4443 3.6948 1.2654 +3.4463 3.6562 1.2391 +3.4264 3.6457 1.2278 +3.3957 3.6435 1.2214 +3.3752 3.6312 1.2145 +3.3323 3.5136 1.2011 +3.2839 3.3804 1.2254 +3.2331 3.2409 1.2631 +3.1833 3.1041 1.2893 +4.3328 5.987 0.5073 +4.3103 5.9491 0.5283 +4.2193 5.714 0.7465 +4.1385 5.507 0.9917 +4.1409 5.488 1.03 +4.1438 5.4699 1.0691 +4.1287 5.451 1.0895 +4.111 5.4316 1.1086 +4.0624 5.3394 1.251 +4.0327 5.2561 1.4057 +4.0075 5.1738 1.5619 +4.0181 5.1654 1.5936 +4.0282 5.1568 1.625 +4.0068 5.1343 1.6472 +3.9852 5.1116 1.6693 +3.9283 4.9669 1.8955 +3.8683 4.8134 2.1153 +3.8793 4.8017 2.1484 +3.8903 4.7901 2.1814 +3.8694 4.7747 2.1852 +3.8476 4.7576 2.1872 +3.8155 4.6762 2.2272 +3.7762 4.5779 2.2283 +3.736 4.4739 2.2029 +3.7426 4.4444 2.212 +3.7495 4.4152 2.2206 +3.7368 4.4055 2.2102 +3.7191 4.4035 2.1963 +3.7069 4.3954 2.1834 +3.661 4.2749 2.0688 +3.6228 4.1782 1.9221 +3.5888 4.0943 1.7558 +3.5555 4.0123 1.5825 +3.5195 3.9214 1.4144 +3.4773 3.8106 1.2642 +3.4734 3.7692 1.2395 +3.4759 3.7187 1.2255 +3.4705 3.6726 1.2053 +3.4547 3.6604 1.1818 +3.433 3.6587 1.1558 +3.4167 3.6449 1.1388 +3.3709 3.5192 1.1261 +3.3194 3.378 1.1484 +3.2657 3.2304 1.1829 +3.2129 3.0857 1.2071 +4.3519 5.9737 0.5 +4.3363 5.931 0.5185 +4.2492 5.6916 0.7364 +4.1723 5.4802 0.9816 +4.1674 5.4668 1.0223 +4.1629 5.4544 1.0638 +4.1541 5.4304 1.0825 +4.1446 5.4042 1.0994 +4.1076 5.3025 1.2389 +4.0773 5.2194 1.3939 +4.0484 5.14 1.5513 +4.0485 5.1403 1.5856 +4.0485 5.1402 1.6196 +4.0373 5.1094 1.639 +4.026 5.0783 1.6582 +3.9725 4.9314 1.8828 +3.9159 4.7758 2.1009 +3.9151 4.7736 2.1375 +3.9142 4.7713 2.1741 +3.9057 4.7479 2.1727 +3.8967 4.7231 2.1691 +3.869 4.6469 2.2046 +3.8355 4.555 2.2025 +3.8004 4.4587 2.1768 +3.7912 4.4334 2.1925 +3.7821 4.4083 2.2077 +3.7786 4.3987 2.195 +3.7772 4.3948 2.176 +3.7743 4.3868 2.1613 +3.7301 4.2655 2.048 +3.6949 4.1686 1.9017 +3.6645 4.0851 1.7351 +3.6349 4.004 1.5609 +3.6022 3.9141 1.3918 +3.5624 3.8046 1.2404 +3.5474 3.7634 1.2178 +3.5293 3.7137 1.2089 +3.5126 3.6677 1.1913 +3.507 3.6525 1.1634 +3.5042 3.6448 1.1291 +3.4978 3.6272 1.1076 +3.4509 3.4982 1.0954 +3.3982 3.3536 1.1166 +3.3433 3.2027 1.1497 +3.2894 3.0546 1.1731 +4.375 5.9716 0.5073 +4.3679 5.9281 0.5283 +4.2865 5.6895 0.7465 +4.2153 5.479 0.9917 +4.2013 5.466 1.03 +4.1874 5.454 1.0691 +4.1869 5.4299 1.0895 +4.188 5.4036 1.1086 +4.1659 5.3017 1.251 +4.1351 5.2188 1.4057 +4.1015 5.1396 1.5619 +4.088 5.14 1.5936 +4.0747 5.1399 1.625 +4.0767 5.1089 1.6472 +4.0786 5.0776 1.6693 +4.0292 4.9302 1.8955 +3.9765 4.774 2.1153 +3.9606 4.7722 2.1484 +3.9446 4.7703 2.1814 +3.9508 4.7451 2.1852 +3.9565 4.718 2.1872 +3.9287 4.635 2.2272 +3.8957 4.5344 2.2283 +3.8596 4.429 2.2029 +3.8356 4.4106 2.212 +3.8115 4.3926 2.2206 +3.815 4.3771 2.2102 +3.8273 4.3641 2.1963 +3.8314 4.35 2.1834 +3.7892 4.2283 2.0688 +3.7563 4.1296 1.9221 +3.7284 4.0435 1.7558 +3.7012 3.9593 1.5825 +3.6703 3.8665 1.4144 +3.6314 3.7545 1.2642 +3.6078 3.7203 1.2395 +3.5734 3.6832 1.2255 +3.548 3.6444 1.2053 +3.5522 3.6249 1.1818 +3.5677 3.6097 1.1558 +3.5713 3.5886 1.1388 +3.5256 3.4628 1.1261 +3.4743 3.3217 1.1484 +3.4206 3.174 1.1829 +3.3679 3.0292 1.2071 +4.3887 5.9818 0.5247 +4.3865 5.9421 0.552 +4.3094 5.7092 0.7708 +4.2424 5.5041 1.0161 +4.2227 5.486 1.0488 +4.203 5.4688 1.082 +4.2078 5.4498 1.1064 +4.2157 5.4302 1.1307 +4.2032 5.3376 1.2803 +4.1721 5.2546 1.4342 +4.1356 5.1727 1.5876 +4.1134 5.1646 1.6128 +4.0916 5.1562 1.638 +4.1019 5.1332 1.667 +4.1123 5.11 1.6959 +4.0651 4.9639 1.9263 +4.0145 4.8089 2.1501 +3.9892 4.7984 2.1746 +3.9637 4.7877 2.199 +3.978 4.7674 2.2162 +3.992 4.7453 2.2309 +3.9596 4.6466 2.2825 +3.9211 4.5275 2.2909 +3.8789 4.4022 2.2658 +3.8497 4.3896 2.2591 +3.8205 4.3775 2.2516 +3.8246 4.3529 2.247 +3.8398 4.3282 2.2451 +3.845 4.3062 2.237 +3.8033 4.1839 2.1197 +3.7707 4.0827 1.9723 +3.7429 3.9928 1.8069 +3.7154 3.9039 1.6354 +3.6839 3.8062 1.4697 +3.6441 3.6896 1.3218 +3.6193 3.6647 1.2919 +3.5823 3.6446 1.2654 +3.5559 3.6163 1.2391 +3.5644 3.5955 1.2278 +3.5865 3.574 1.2214 +3.5944 3.5515 1.2145 +3.5516 3.4338 1.2011 +3.5031 3.3006 1.2254 +3.4523 3.1611 1.2631 +3.4025 3.0243 1.2893 +4.3848 5.9983 0.5422 +4.3813 5.9648 0.5756 +4.3045 5.7389 0.7952 +4.2378 5.5407 1.0405 +4.2192 5.5151 1.0675 +4.2006 5.4902 1.095 +4.2046 5.4785 1.1234 +4.2115 5.4683 1.1529 +4.1977 5.3892 1.3095 +4.1668 5.306 1.4626 +4.1308 5.2201 1.6133 +4.1098 5.1998 1.6321 +4.0891 5.1795 1.651 +4.0982 5.168 1.6868 +4.1073 5.1565 1.7225 +4.0593 5.0128 1.9569 +4.0078 4.8602 2.1848 +3.9841 4.8368 2.2008 +3.9602 4.8133 2.2166 +3.9715 4.802 2.2473 +3.9824 4.789 2.2748 +3.9435 4.6755 2.3383 +3.8972 4.5386 2.354 +3.8469 4.394 2.3288 +3.8254 4.3827 2.3063 +3.8039 4.3716 2.2827 +3.8018 4.3408 2.2837 +3.8071 4.3086 2.2936 +3.8065 4.2815 2.2905 +3.7638 4.1587 2.1709 +3.7293 4.0556 2.0233 +3.6988 3.9624 1.859 +3.6686 3.8697 1.6894 +3.6345 3.7678 1.5259 +3.5925 3.6474 1.38 +3.5748 3.6293 1.3446 +3.5506 3.6207 1.3053 +3.5318 3.5999 1.2729 +3.5361 3.5806 1.2742 +3.5491 3.5585 1.2878 +3.5528 3.5375 1.2912 +3.5133 3.4289 1.2748 +3.4678 3.3037 1.3013 +3.4198 3.1718 1.3428 +3.3729 3.0427 1.3715 +2.8804 2.8279 1.1689 +2.8359 2.8634 1.1804 +2.8778 2.8398 1.1654 +2.9354 2.811 1.166 +2.9399 2.7906 1.1755 +3.0074 2.7589 1.1913 +3.0006 2.7874 1.1755 +3.0662 2.7748 1.1864 +3.0761 2.74 1.2074 +3.1388 2.7415 1.2147 +3.1253 2.7788 1.1913 +3.247 2.8173 1.1908 +3.261 2.7787 1.2147 +3.3786 2.8287 1.2147 +3.365 2.8661 1.1913 +3.4926 2.9277 1.1846 +3.5048 2.8948 1.2064 +3.6211 2.9678 1.1897 +3.611 2.9946 1.171 +3.7073 3.0653 1.1626 +3.7147 3.0457 1.1773 +3.7732 3.1263 1.1818 +3.7686 3.1384 1.1712 +3.7838 3.2073 1.2159 +3.802 3.1685 1.1978 +3.7979 3.1785 1.1864 +3.823 3.1441 1.1706 +3.8297 3.1275 1.1913 +3.8649 3.0888 1.1921 +3.8551 3.1125 1.1594 +3.8922 3.0873 1.1512 +3.9055 3.0569 1.1963 +3.9495 3.0364 1.1998 +3.9324 3.0718 1.1446 +3.9739 3.0697 1.1381 +3.9948 3.0317 1.1985 +4.0651 3.0398 1.1907 +4.0426 3.08 1.1267 +4.111 3.0927 1.1155 +4.135 3.0507 1.1824 +4.2437 3.0712 1.1676 +4.2183 3.1157 1.0966 +4.3252 3.1408 1.0783 +4.3519 3.0941 1.1527 +4.4449 3.1247 1.141 +4.4184 3.1719 1.0659 +4.5087 3.2137 1.0571 +4.5341 3.1677 1.13 +4.6213 3.217 1.1195 +4.5975 3.2609 1.0503 +4.6861 3.308 1.044 +4.7083 3.2665 1.1096 +4.8116 3.3297 1.0918 +4.7899 3.366 1.0335 +4.8856 3.4306 1.0215 +4.9041 3.4013 1.0677 +4.9805 3.4781 1.0454 +4.9669 3.4996 1.0137 +5.0274 3.5703 1.0157 +5.0355 3.5568 1.0332 +5.0639 3.6344 1.0392 +2.8134 2.8896 1.2191 +2.8331 2.8737 1.1813 +2.8743 2.8539 1.1627 +2.9299 2.8344 1.1578 +2.9925 2.8194 1.161 +3.0551 2.8131 1.1666 +3.1104 2.8196 1.1691 +3.2316 2.8597 1.1681 +3.3502 2.9069 1.1691 +3.4792 2.9639 1.1643 +3.6 3.0243 1.1541 +3.6993 3.0872 1.1495 +3.7636 3.1518 1.1615 +3.7754 3.2274 1.1933 +3.7936 3.1893 1.1757 +3.8159 3.1622 1.151 +3.8446 3.1385 1.1282 +3.8779 3.1207 1.1083 +3.9143 3.111 1.0922 +3.9519 3.1117 1.0808 +4.019 3.1243 1.0659 +4.0859 3.1391 1.0519 +4.1917 3.1648 1.0293 +4.2973 3.1923 1.0077 +4.3906 3.2241 0.9946 +4.482 3.2645 0.9879 +4.5724 3.3092 0.9846 +4.6628 3.3538 0.9817 +4.7671 3.4061 0.978 +4.8663 3.4631 0.9776 +4.9527 3.5232 0.9836 +5.0188 3.585 0.9992 +5.0572 3.647 1.0275 +5.0604 3.7075 1.0717 +2.8288 2.8869 1.1815 +2.8709 2.8662 1.1575 +2.9245 2.8543 1.1488 +2.985 2.8463 1.1487 +3.0452 2.8451 1.1519 +3.098 2.8538 1.1535 +3.2188 2.8948 1.1524 +3.3377 2.9411 1.1535 +3.469 2.9987 1.1482 +3.5899 3.0598 1.1367 +3.6891 3.12 1.1322 +3.7556 3.1747 1.1475 +3.7881 3.2023 1.163 +3.8072 3.1824 1.1308 +3.833 3.1645 1.101 +3.8638 3.1511 1.0752 +3.8982 3.1445 1.0546 +3.9343 3.1471 1.0408 +4.0001 3.1618 1.0235 +4.0658 3.1782 1.0075 +4.1705 3.2063 0.9822 +4.2751 3.2357 0.9583 +4.3684 3.268 0.9447 +4.4607 3.3073 0.9395 +4.5524 3.3499 0.9387 +4.6441 3.3924 0.9382 +4.7498 3.4432 0.937 +4.8502 3.4986 0.9402 +4.9383 3.5556 0.9514 +5.0073 3.6113 0.9745 +5.0503 3.6629 1.0133 +2.8658 2.883 1.1589 +2.9169 2.88 1.1475 +2.975 2.8797 1.1438 +3.0328 2.884 1.1439 +3.083 2.8949 1.1441 +3.2033 2.9373 1.1431 +3.3227 2.9822 1.1441 +3.4569 3.0388 1.1381 +3.5786 3.0981 1.1255 +3.6785 3.1535 1.121 +3.7472 3.1988 1.1388 +3.7819 3.2183 1.1557 +3.7973 3.2072 1.119 +3.8201 3.1965 1.0849 +3.8485 3.1886 1.0553 +3.8809 3.1858 1.0319 +3.9156 3.1906 1.0166 +3.9802 3.2079 0.9978 +4.0448 3.2264 0.9806 +4.1482 3.2574 0.9537 +4.2517 3.2894 0.9285 +4.3449 3.3222 0.9146 +4.438 3.3599 0.9103 +4.531 3.3999 0.9109 +4.624 3.4397 0.9118 +4.7311 3.4887 0.9124 +4.8327 3.542 0.918 +4.9226 3.5951 0.9327 +4.9946 3.6434 0.9605 +5.0426 3.6824 1.0055 +2.8228 2.903 1.1805 +2.8576 2.9081 1.16 +2.9016 2.9265 1.1478 +2.9524 2.9473 1.1428 +3.0038 2.9679 1.142 +3.05 2.9855 1.142 +3.1699 3.0292 1.1413 +3.2898 3.0728 1.142 +3.4269 3.1216 1.1361 +3.5542 3.1657 1.1245 +3.6611 3.202 1.1209 +3.7369 3.2276 1.1391 +3.7709 3.2395 1.1926 +3.7738 3.241 1.1555 +3.7838 3.2462 1.118 +3.8001 3.2543 1.0825 +3.8221 3.2645 1.0513 +3.8488 3.2761 1.0267 +3.8795 3.2882 1.0111 +3.9418 3.3115 0.992 +4.0045 3.3349 0.9746 +4.1055 3.3723 0.9473 +4.2069 3.4098 0.9218 +4.2999 3.4438 0.9078 +4.3944 3.4778 0.9038 +4.4896 3.5118 0.9048 +4.5848 3.5458 0.9059 +4.695 3.5846 0.9071 +4.8026 3.6214 0.914 +4.9001 3.6541 0.9303 +4.9805 3.6807 0.9596 +5.0363 3.6992 1.0055 +2.8468 2.9334 1.1576 +2.8818 2.9737 1.1464 +2.924 3.0165 1.143 +2.9697 3.0546 1.1434 +3.0153 3.0808 1.1437 +3.1345 3.1264 1.1425 +3.2551 3.1681 1.1437 +3.3961 3.2081 1.1375 +3.5295 3.2354 1.1245 +3.6434 3.2512 1.1195 +3.7263 3.2564 1.1374 +3.7663 3.2522 1.1932 +3.7649 3.264 1.1544 +3.768 3.2857 1.1172 +3.7764 3.3132 1.0833 +3.791 3.3426 1.054 +3.8127 3.3699 1.0309 +3.8425 3.3913 1.0155 +3.9025 3.4209 0.9967 +3.9634 3.4495 0.9794 +4.062 3.4938 0.9524 +4.1613 3.5372 0.9271 +4.2537 3.5722 0.9132 +4.3496 3.6024 0.9089 +4.4471 3.6301 0.9096 +4.5445 3.6578 0.9106 +4.6602 3.6863 0.9111 +4.7746 3.7051 0.9164 +4.8798 3.7154 0.9307 +4.9678 3.7184 0.9584 +5.0306 3.7154 1.004 +2.817 2.9169 1.1797 +2.8392 2.9509 1.1555 +2.8701 2.9999 1.1469 +2.909 3.0503 1.1473 +2.9531 3.0943 1.151 +2.9995 3.1243 1.1527 +3.1181 3.1713 1.1515 +3.2393 3.2115 1.1527 +3.3782 3.2487 1.1473 +3.5119 3.2743 1.1354 +3.6286 3.2864 1.1304 +3.7163 3.2824 1.1459 +3.7629 3.2629 1.2011 +3.7587 3.282 1.1613 +3.7584 3.3134 1.1285 +3.7642 3.3483 1.0988 +3.7771 3.3834 1.0733 +3.798 3.4148 1.0529 +3.8278 3.4391 1.0388 +3.887 3.4717 1.0214 +3.9475 3.5027 1.0053 +4.045 3.5502 0.9798 +4.1435 3.5963 0.9559 +4.2356 3.6319 0.9422 +4.3319 3.6602 0.9371 +4.4302 3.685 0.9363 +4.5283 3.7097 0.936 +4.6439 3.7357 0.935 +4.7584 3.7527 0.9379 +4.8646 3.7595 0.949 +4.9552 3.755 0.9723 +5.0229 3.7381 1.0118 +2.8335 2.9631 1.1607 +2.8607 3.0192 1.156 +2.8966 3.0766 1.1598 +2.9393 3.1264 1.166 +2.9865 3.16 1.1686 +3.1047 3.2082 1.1676 +3.2263 3.2472 1.1686 +3.3625 3.2832 1.1639 +3.4954 3.3099 1.1534 +3.6139 3.3202 1.1485 +3.7068 3.3069 1.1607 +3.754 3.2969 1.1745 +3.7512 3.3362 1.1495 +3.7554 3.3774 1.127 +3.7673 3.4173 1.1074 +3.7879 3.4523 1.0915 +3.818 3.4792 1.0798 +3.8768 3.5143 1.0648 +3.9371 3.5474 1.0507 +4.034 3.5975 1.028 +4.132 3.646 1.0064 +4.2237 3.6819 0.9932 +4.3201 3.7087 0.9865 +4.4188 3.7309 0.9832 +4.5173 3.7531 0.9805 +4.6323 3.7771 0.977 +4.7467 3.7926 0.9767 +4.8535 3.7965 0.9828 +4.946 3.7856 0.9984 +5.0172 3.757 1.027 +2.8121 2.9277 1.1791 +2.8266 2.977 1.1636 +2.8495 3.0413 1.1648 +2.882 3.1065 1.1751 +2.923 3.1629 1.1868 +2.9717 3.2008 1.192 +3.0893 3.2505 1.1915 +3.2114 3.2881 1.192 +3.3496 3.3197 1.1853 +3.4848 3.3402 1.1716 +3.6059 3.3429 1.1631 +3.7018 3.3211 1.1715 +3.7598 3.2734 1.2165 +3.7503 3.3084 1.1862 +3.7449 3.3551 1.1707 +3.7466 3.4045 1.1601 +3.7567 3.4521 1.1527 +3.7768 3.4939 1.1466 +3.8082 3.5256 1.14 +3.8668 3.5636 1.1287 +3.9269 3.5992 1.1176 +4.0232 3.6524 1.0988 +4.1207 3.7035 1.0807 +4.2119 3.7399 1.0682 +4.3083 3.765 1.0593 +4.4072 3.7843 1.0524 +4.5061 3.8032 1.046 +4.6244 3.8226 1.0354 +4.741 3.8302 1.023 +4.8494 3.8243 1.0148 +4.943 3.8031 1.0163 +5.0141 3.7719 1.0403 +2.8209 2.9878 1.1675 +2.8397 3.0595 1.1749 +2.8688 3.1321 1.1919 +2.9084 3.1948 1.209 +2.9584 3.2372 1.2168 +3.0756 3.2882 1.2168 +3.1982 3.3244 1.2168 +3.3382 3.3521 1.2086 +3.4756 3.3669 1.192 +3.5991 3.3628 1.1796 +3.6975 3.3337 1.1837 +3.7469 3.3189 1.1987 +3.7393 3.3723 1.193 +3.739 3.4287 1.1951 +3.7477 3.4833 1.2005 +3.7676 3.5312 1.2049 +3.8005 3.5673 1.2039 +3.859 3.6079 1.1964 +3.9192 3.6458 1.1884 +4.015 3.7018 1.174 +4.1121 3.7553 1.1594 +4.2028 3.7921 1.1478 +4.299 3.8156 1.1365 +4.3981 3.8322 1.1258 +4.4971 3.8483 1.1155 +4.6185 3.8634 1.0972 +4.7369 3.864 1.0721 +4.8463 3.8494 1.0488 +4.9407 3.8189 1.0354 +2.8042 2.9453 1.1815 +2.8103 3.009 1.1759 +2.8238 3.0896 1.1937 +2.8492 3.1697 1.2215 +2.8876 3.2389 1.2475 +2.9404 3.2866 1.2598 +3.0569 3.3395 1.261 +3.1802 3.3738 1.2598 +3.3237 3.3963 1.2476 +3.4638 3.404 1.2251 +3.59 3.391 1.206 +3.6918 3.3515 1.2034 +3.758 3.2802 1.2303 +3.7408 3.3366 1.2191 +3.7289 3.3992 1.23 +3.7253 3.4637 1.2538 +3.7327 3.5256 1.2818 +3.7542 3.5808 1.3051 +3.7925 3.6247 1.3146 +3.8512 3.6689 1.3138 +3.9118 3.7102 1.3113 +4.0069 3.7701 1.3042 +4.1038 3.8269 1.2959 +4.1936 3.864 1.2858 +4.2895 3.8855 1.2708 +4.3885 3.8986 1.2535 +4.4875 3.9104 1.2359 +4.6179 3.9203 1.2016 +4.7392 3.913 1.1532 +4.8476 3.8883 1.1033 +4.9397 3.8459 1.0646 +5.0118 3.7857 1.0498 +2.8026 3.0225 1.1841 +2.8113 3.1104 1.2125 +2.833 3.1977 1.2518 +2.8703 3.2736 1.2875 +2.9258 3.3268 1.3047 +3.0418 3.3813 1.3072 +3.1656 3.4141 1.3047 +3.3124 3.4318 1.289 +3.4551 3.4333 1.2611 +3.5836 3.4131 1.2351 +3.6875 3.3658 1.225 +3.7567 3.2858 1.2446 +3.7354 3.3522 1.2404 +3.72 3.4223 1.2682 +3.7139 3.4929 1.3146 +3.7209 3.5604 1.366 +3.7446 3.6214 1.4091 +3.7887 3.6726 1.4304 +3.8478 3.7195 1.4363 +3.909 3.7639 1.4398 +4.0038 3.8269 1.4404 +4.1007 3.8865 1.4387 +4.1896 3.9238 1.4299 +4.2849 3.9436 1.4109 +4.3836 3.9537 1.3866 +4.4822 3.962 1.3619 +4.6212 3.9674 1.3104 +4.7444 3.9539 1.2373 +4.851 3.9213 1.1598 +4.9399 3.8695 1.095 +5.01 3.7982 1.0599 +2.7927 2.9752 1.2259 +2.7884 3.0582 1.2527 +2.7978 3.1439 1.2837 +2.8215 3.2263 1.3147 +2.8609 3.2976 1.3423 +2.9166 3.3521 1.3601 +3.0311 3.4093 1.3663 +3.1563 3.4394 1.3601 +3.3028 3.4574 1.3418 +3.4449 3.4609 1.3124 +3.5742 3.4391 1.2825 +3.6819 3.3831 1.2626 +3.7563 3.2895 1.2623 +3.7313 3.3679 1.2812 +3.7136 3.4443 1.3333 +3.7071 3.5174 1.4036 +3.7158 3.5862 1.477 +3.7433 3.6492 1.5385 +3.7935 3.7053 1.573 +3.8537 3.7543 1.5871 +3.9161 3.8009 1.5979 +4.0111 3.8661 1.6082 +4.1086 3.9276 1.6144 +4.1967 3.965 1.6076 +4.2912 3.9838 1.5845 +4.3888 3.9919 1.5519 +4.4861 3.9971 1.5169 +4.6275 3.9995 1.4457 +4.7495 3.9851 1.3508 +4.853 3.9512 1.2489 +4.9388 3.8953 1.1572 +5.0076 3.8149 1.0924 +2.7922 2.9767 1.2497 +2.788 3.0586 1.2869 +2.7984 3.1401 1.3255 +2.8235 3.218 1.3626 +2.8637 3.2873 1.3946 +2.9196 3.3438 1.4168 +3.0329 3.4021 1.4257 +3.1594 3.4311 1.4168 +3.3053 3.4499 1.3974 +3.447 3.4557 1.3683 +3.5762 3.4367 1.3351 +3.6836 3.3827 1.3037 +3.7575 3.2887 1.2805 +3.7285 3.3783 1.3224 +3.709 3.4551 1.3982 +3.7033 3.5224 1.4917 +3.7156 3.5836 1.5871 +3.7503 3.6423 1.6683 +3.8119 3.7018 1.7192 +3.8738 3.7506 1.7418 +3.9384 3.7978 1.7602 +4.0343 3.8625 1.7802 +4.1333 3.9241 1.7947 +4.2206 3.9612 1.7898 +4.314 3.9803 1.7623 +4.4098 3.9885 1.7212 +4.5047 3.9928 1.6759 +4.6492 3.9972 1.5825 +4.7677 3.99 1.4645 +4.8642 3.9642 1.3381 +4.9425 3.9131 1.2197 +5.0065 3.8298 1.1255 +2.8043 2.9444 1.2837 +2.8042 3.0152 1.3385 +2.8151 3.0946 1.3842 +2.8388 3.175 1.4214 +2.8773 3.2489 1.4506 +2.9324 3.3087 1.4726 +3.0454 3.3666 1.4831 +3.1722 3.3959 1.4726 +3.318 3.4153 1.4511 +3.4604 3.4225 1.4204 +3.5887 3.4088 1.383 +3.6921 3.3656 1.3415 +3.76 3.2843 1.2983 +3.7313 3.3749 1.3621 +3.7138 3.4465 1.4614 +3.7118 3.5055 1.5786 +3.7295 3.5581 1.6962 +3.771 3.6106 1.7967 +3.8405 3.6693 1.8628 +3.9049 3.7164 1.8934 +3.9721 3.7622 1.9195 +4.0697 3.8248 1.949 +4.1707 3.8846 1.9717 +4.2575 3.921 1.9684 +4.3491 3.9412 1.9362 +4.4425 3.9512 1.8868 +4.5345 3.9569 1.832 +4.6781 3.9661 1.7182 +4.7918 3.9673 1.5776 +4.8811 3.9513 1.4265 +4.9519 3.9088 1.281 +5.0098 3.8307 1.1573 +2.8091 2.9319 1.2966 +2.8132 2.9929 1.362 +2.8278 3.0633 1.4144 +2.8547 3.1354 1.4549 +2.8954 3.2021 1.4855 +2.9514 3.2565 1.5085 +3.0653 3.3122 1.5202 +3.1912 3.3437 1.5085 +3.3364 3.3656 1.4866 +3.4789 3.3753 1.4565 +3.6056 3.3681 1.4179 +3.7038 3.339 1.37 +3.7631 3.2775 1.3098 +3.7415 3.3548 1.3978 +3.7304 3.418 1.5082 +3.7335 3.4715 1.6292 +3.7547 3.5198 1.7488 +3.7981 3.5672 1.855 +3.8677 3.6182 1.936 +3.9352 3.6609 1.9833 +4.0067 3.7039 2.0224 +4.1063 3.7621 2.0611 +4.2092 3.8198 2.086 +4.2963 3.856 2.0816 +4.387 3.8775 2.0476 +4.478 3.8901 1.9945 +4.5663 3.8991 1.9328 +4.7042 3.9139 1.8071 +4.8143 3.9202 1.6595 +4.9007 3.9104 1.5011 +4.9678 3.8768 1.343 +5.0196 3.8117 1.1961 +2.8144 2.9191 1.2927 +2.8204 2.9768 1.3667 +2.8424 3.03 1.4254 +2.8766 3.0837 1.4725 +2.9227 3.1339 1.5084 +2.9803 3.1769 1.5335 +3.0958 3.2292 1.5458 +3.2201 3.2642 1.5335 +3.3625 3.2934 1.5124 +3.502 3.3129 1.4838 +3.6246 3.3188 1.4446 +3.7169 3.3065 1.3912 +3.7673 3.2671 1.3178 +3.7561 3.3243 1.4228 +3.7554 3.3728 1.5388 +3.7675 3.4153 1.659 +3.7946 3.4543 1.7767 +3.8391 3.4927 1.8851 +3.9036 3.5331 1.9777 +3.9725 3.5711 2.0419 +4.0497 3.6114 2.0938 +4.1508 3.6635 2.1398 +4.2569 3.717 2.1654 +4.346 3.7528 2.1595 +4.4358 3.7772 2.1245 +4.5237 3.7944 2.0693 +4.6069 3.8082 2.0028 +4.7361 3.8305 1.8692 +4.8411 3.8451 1.7182 +4.924 3.8462 1.5563 +4.9868 3.8276 1.3901 +5.0316 3.7834 1.2264 +2.8314 2.9506 1.3628 +2.862 2.9833 1.426 +2.9044 3.0161 1.4795 +2.9564 3.0484 1.521 +3.0159 3.0794 1.548 +3.1331 3.1273 1.5605 +3.2556 3.1666 1.548 +3.3942 3.2058 1.5279 +3.5287 3.2394 1.5008 +3.6455 3.2623 1.4614 +3.731 3.2695 1.404 +3.7723 3.2541 1.3224 +3.7728 3.2861 1.4377 +3.7837 3.3155 1.5557 +3.8055 3.3432 1.6736 +3.839 3.3705 1.7882 +3.885 3.3983 1.8968 +3.9441 3.4277 1.9962 +4.0141 3.4598 2.0734 +4.097 3.4961 2.1352 +4.1997 3.541 2.186 +4.3095 3.5889 2.2114 +4.4009 3.6238 2.2042 +4.4899 3.652 2.1687 +4.5744 3.6752 2.1126 +4.6524 3.6952 2.0434 +4.7729 3.7265 1.9059 +4.8727 3.7511 1.7539 +4.9516 3.7652 1.5911 +5.0093 3.7651 1.4208 +5.0456 3.7471 1.2465 +2.8241 2.8931 1.2898 +2.8498 2.9017 1.3594 +2.8881 2.9147 1.4243 +2.9366 2.9315 1.4806 +2.9929 2.9512 1.5246 +3.0545 2.9731 1.5524 +3.1736 3.0163 1.565 +3.2943 3.0604 1.5524 +3.429 3.1098 1.5329 +3.5583 3.1576 1.5066 +3.6687 3.1986 1.4672 +3.7463 3.2277 1.4083 +3.7775 3.24 1.3238 +3.7894 3.2438 1.4424 +3.81 3.2517 1.5607 +3.8396 3.2632 1.6771 +3.8784 3.278 1.7902 +3.9269 3.2958 1.8983 +3.9851 3.3161 1.9999 +4.0574 3.34 2.0823 +4.1449 3.3691 2.1479 +4.2497 3.4066 2.2004 +4.3627 3.4478 2.2255 +4.4554 3.4816 2.2177 +4.5433 3.5136 2.1822 +4.6249 3.5436 2.1259 +4.699 3.5709 2.0559 +4.8133 3.6131 1.9173 +4.9085 3.6483 1.7655 +4.9828 3.676 1.6028 +5.0342 3.6955 1.4314 +5.0607 3.7062 1.2536 +2.8344 2.8644 1.2927 +2.8684 2.8491 1.3626 +2.9133 2.8426 1.4255 +2.9671 2.844 1.4787 +3.0279 2.8522 1.52 +3.0935 2.866 1.547 +3.2143 2.9041 1.5595 +3.3333 2.9532 1.547 +3.4644 3.0129 1.5271 +3.5886 3.0747 1.5002 +3.6923 3.1336 1.4609 +3.7617 3.185 1.4035 +3.7826 3.2257 1.3221 +3.8041 3.2 1.4365 +3.8314 3.1843 1.554 +3.8657 3.1776 1.6715 +3.9086 3.1788 1.786 +3.9617 3.187 1.8944 +4.0263 3.201 1.9938 +4.1018 3.218 2.0709 +4.1899 3.2399 2.1323 +4.2978 3.2703 2.183 +4.4127 3.3042 2.2082 +4.5052 3.3362 2.201 +4.5913 3.3721 2.1656 +4.6709 3.4092 2.1096 +4.7433 3.4446 2.0406 +4.8557 3.4991 1.903 +4.9478 3.5451 1.7509 +5.0169 3.5858 1.588 +5.0605 3.6243 1.418 +5.0758 3.6638 1.2447 +2.8388 2.8505 1.2959 +2.8773 2.821 1.3665 +2.9288 2.7935 1.4244 +2.9896 2.7743 1.4707 +3.0571 2.7654 1.5062 +3.129 2.7685 1.5313 +3.2512 2.8019 1.5437 +3.3688 2.8558 1.5313 +3.4965 2.9254 1.5103 +3.6155 3.0007 1.4819 +3.7128 3.0761 1.4428 +3.7748 3.147 1.3895 +3.7871 3.2126 1.317 +3.8159 3.1596 1.42 +3.8468 3.1212 1.5346 +3.8834 3.0962 1.6541 +3.9292 3.0837 1.7715 +3.988 3.0826 1.8799 +4.0635 3.0919 1.9723 +4.1415 3.1048 2.0361 +4.2273 3.1211 2.0874 +4.3386 3.1452 2.1331 +4.4543 3.1722 2.1583 +4.5455 3.2021 2.1523 +4.6299 3.2414 2.1174 +4.7082 3.2853 2.0626 +4.7808 3.3288 1.9966 +4.8946 3.3959 1.8627 +4.9845 3.4527 1.7109 +5.0483 3.5059 1.5487 +5.0836 3.5617 1.3832 +5.0884 3.6268 1.2218 +2.882 2.8045 1.3605 +2.9388 2.7597 1.4118 +3.0058 2.7222 1.4515 +3.0796 2.6974 1.4818 +3.1573 2.6907 1.505 +3.2805 2.7203 1.5169 +3.3971 2.7779 1.505 +3.5224 2.8547 1.4831 +3.6376 2.9391 1.4527 +3.7297 3.0267 1.4139 +3.7855 3.114 1.3665 +3.7905 3.2021 1.3087 +3.8241 3.1273 1.3931 +3.8565 3.0707 1.5015 +3.8935 3.0311 1.6214 +3.9409 3.0073 1.7406 +4.0046 2.9984 1.8467 +4.0905 3.0032 1.9273 +4.17 3.0126 1.974 +4.2527 3.0245 2.0123 +4.3666 3.0433 2.0505 +4.4824 3.0649 2.0749 +4.5724 3.0932 2.0702 +4.6557 3.1353 2.0364 +4.7334 3.1846 1.9838 +4.807 3.2349 1.923 +4.9234 3.3135 1.7968 +5.012 3.38 1.6482 +5.0714 3.4436 1.4891 +5.1002 3.5133 1.3319 +5.097 3.5983 1.1887 +2.8431 2.838 1.2802 +2.8892 2.7827 1.3331 +2.9486 2.7296 1.3781 +3.0181 2.6845 1.4153 +3.0946 2.6535 1.4452 +3.1749 2.6423 1.4679 +3.2987 2.6699 1.4786 +3.4147 2.7296 1.4679 +3.539 2.8086 1.446 +3.6526 2.8945 1.4141 +3.7418 2.9876 1.376 +3.793 3.0878 1.3356 +3.7923 3.1954 1.2968 +3.8286 3.1067 1.3556 +3.8615 3.0399 1.4521 +3.898 2.9929 1.5681 +3.9454 2.9635 1.6853 +4.0108 2.9496 1.7856 +4.1012 2.9492 1.8508 +4.1808 2.9542 1.8807 +4.2616 2.962 1.9062 +4.3766 2.9767 1.9349 +4.4924 2.9955 1.957 +4.5822 3.0234 1.9534 +4.6653 3.0671 1.9214 +4.7433 3.1197 1.8727 +4.8178 3.1746 1.819 +4.9356 3.2608 1.705 +5.0239 3.3332 1.563 +5.0816 3.4028 1.4108 +5.1077 3.481 1.2663 +5.101 3.5788 1.1473 +2.8532 2.8095 1.2459 +2.9025 2.7454 1.2819 +2.9627 2.6912 1.3198 +3.0317 2.6489 1.3565 +3.1066 2.6224 1.3888 +3.1851 2.6144 1.4114 +3.3093 2.6421 1.4204 +3.4249 2.7016 1.4114 +3.5489 2.7806 1.3913 +3.6615 2.8665 1.3608 +3.7484 2.9632 1.3271 +3.7963 3.0726 1.2973 +3.7928 3.1914 1.2787 +3.8278 3.1048 1.3163 +3.8621 3.0342 1.3892 +3.9008 2.9797 1.481 +3.9493 2.9413 1.5752 +4.0129 2.9191 1.6554 +4.0971 2.9135 1.7052 +4.1758 2.9162 1.727 +4.2552 2.9217 1.7446 +4.3701 2.934 1.7637 +4.4853 2.9508 1.7774 +4.576 2.9786 1.7723 +4.6599 3.0239 1.7451 +4.7388 3.079 1.7048 +4.8148 3.1363 1.6606 +4.93 3.2257 1.568 +5.0168 3.3068 1.45 +5.0743 3.3876 1.324 +5.1014 3.4761 1.2073 +5.097 3.58 1.1175 +2.8517 2.8135 1.2244 +2.9013 2.7502 1.2512 +2.9633 2.6931 1.2811 +3.0341 2.6472 1.3105 +3.1093 2.6191 1.3371 +3.1855 2.6134 1.3545 +3.3098 2.6433 1.3607 +3.4252 2.7006 1.3545 +3.5495 2.7795 1.3357 +3.6612 2.8662 1.3051 +3.747 2.964 1.2749 +3.7943 3.0739 1.2567 +3.7921 3.191 1.2605 +3.8224 3.1174 1.2762 +3.8575 3.0497 1.3257 +3.8993 2.9914 1.3939 +3.9495 2.9459 1.4655 +4.01 2.9166 1.5254 +4.0824 2.9069 1.5585 +4.1596 2.9087 1.5719 +4.2369 2.9137 1.5819 +4.3512 2.9257 1.5912 +4.465 2.9419 1.5966 +4.5566 2.97 1.5896 +4.6412 3.0161 1.5668 +4.7216 3.072 1.5351 +4.8001 3.1296 1.5012 +4.9109 3.2171 1.4317 +4.9959 3.305 1.3382 +5.0542 3.3958 1.238 +5.085 3.4916 1.1485 +5.0873 3.5948 1.0873 +2.839 2.8526 1.1806 +2.8884 2.7898 1.1828 +2.9511 2.7316 1.21 +3.0232 2.6813 1.2483 +3.0993 2.6492 1.283 +3.1739 2.6452 1.2997 +3.2974 2.6789 1.3019 +3.4136 2.7325 1.2997 +3.5383 2.811 1.2839 +3.6495 2.8991 1.2557 +3.736 2.9941 1.2297 +3.7865 3.0935 1.2205 +3.7897 3.1949 1.243 +3.8148 3.1344 1.2368 +3.8474 3.0742 1.2624 +3.8875 3.0194 1.3066 +3.9354 2.9748 1.356 +3.9913 2.9454 1.3973 +4.0553 2.9359 1.4174 +4.1302 2.9391 1.4224 +4.205 2.9453 1.4253 +4.3176 2.9593 1.425 +4.4296 2.977 1.4226 +4.5217 3.0058 1.4136 +4.6078 3.0514 1.395 +4.6903 3.106 1.3714 +4.772 3.1617 1.3477 +4.8826 3.2441 1.2981 +4.9694 3.331 1.2273 +5.0316 3.4215 1.1523 +5.0681 3.515 1.0901 +5.078 3.6106 1.0575 +2.8856 2.8054 1.1756 +2.947 2.7568 1.1923 +3.017 2.7156 1.2191 +3.0893 2.6902 1.2443 +3.1579 2.6891 1.2562 +3.2808 2.7243 1.2573 +3.3977 2.7763 1.2562 +3.5229 2.8488 1.2439 +3.6365 2.9297 1.2211 +3.7262 3.017 1.2021 +3.7804 3.1083 1.2003 +3.787 3.2006 1.2291 +3.8088 3.1504 1.2169 +3.8391 3.099 1.2261 +3.8771 3.0513 1.2483 +3.9216 3.0121 1.2746 +3.9717 2.9864 1.2965 +4.0264 2.9791 1.3052 +4.0992 2.9844 1.3039 +4.1715 2.9928 1.3009 +4.2823 3.0097 1.2932 +4.3924 3.0297 1.2844 +4.4851 3.0593 1.2741 +4.5727 3.1038 1.2594 +4.6575 3.156 1.2426 +4.7417 3.209 1.2257 +4.8486 3.2822 1.1927 +4.9381 3.3623 1.1458 +5.007 3.4471 1.0977 +5.0524 3.5343 1.061 +5.0712 3.6219 1.0481 +2.9938 3.0285 1.5918 +2.952 3.0249 1.581 +2.9787 3.0582 1.5886 +2.9174 3.0554 1.7579 +2.9329 3.0232 1.7639 +2.8381 3.0149 1.9201 +2.8229 3.0497 1.9112 +2.702 3.0418 2.0466 +2.7163 3.0042 2.0584 +2.5796 2.9923 2.1681 +2.5687 3.0336 2.1522 +2.4188 3.0239 2.2219 +2.426 2.9788 2.2407 +2.2605 2.9644 2.2587 +2.2579 3.0107 2.2395 +2.2371 2.994 2.2227 +2.2386 2.9624 2.2357 +2.2168 2.9605 2.2117 +2.2163 2.977 2.2049 +2.0763 2.9683 2.1762 +2.0739 2.948 2.1834 +1.9406 2.9364 2.1339 +1.9456 2.9654 2.1247 +1.8371 2.9584 2.0395 +1.8305 2.9267 2.0483 +1.8283 2.9266 2.0264 +1.8329 2.9485 2.0203 +1.8286 2.9386 2.0011 +1.8261 2.9264 2.0045 +1.7139 2.9165 1.8924 +1.718 2.9344 1.8879 +1.6131 2.931 1.77 +1.6075 2.9072 1.7758 +1.6101 2.9075 1.7601 +1.6137 2.9228 1.7563 +1.6125 2.9077 1.7444 +1.5712 2.9041 1.7022 +1.5836 2.9226 1.692 +1.5281 2.9211 1.6526 +1.5228 2.8998 1.6575 +1.4917 2.8971 1.6154 +1.4969 2.9183 1.6105 +1.5025 2.898 1.5811 +2.9477 3.0684 1.5809 +2.8861 3.0665 1.743 +2.7929 3.0621 1.8894 +2.6745 3.0555 2.0183 +2.5494 3.0493 2.1141 +2.4095 3.042 2.1768 +2.2596 3.0301 2.1933 +2.2386 3.0072 2.1914 +2.2178 2.984 2.1886 +2.0849 2.9774 2.1585 +1.9625 2.9787 2.1024 +1.8584 2.9731 2.0183 +1.8477 2.9587 2.0056 +1.846 2.9401 1.9847 +1.7308 2.9427 1.8769 +1.6306 2.9422 1.7559 +1.625 2.93 1.7472 +1.625 2.9156 1.7343 +1.5441 2.9312 1.6406 +1.513 2.9283 1.5987 +2.919 3.053 1.5732 +2.8572 3.0501 1.728 +2.7654 3.0447 1.8675 +2.6497 3.0372 1.99 +2.5332 3.0303 2.076 +2.4034 3.0224 2.1319 +2.2646 3.0113 2.147 +2.2424 2.9944 2.16 +2.2205 2.9774 2.1723 +2.095 2.97 2.1408 +1.9815 2.9685 2.0801 +1.8819 2.9623 1.9971 +1.864 2.9512 1.9909 +1.7449 2.9367 1.8659 +1.6498 2.9342 1.7417 +1.6373 2.9248 1.7381 +1.5939 2.9183 1.6847 +1.5617 2.9241 1.6285 +1.5306 2.9212 1.5869 +2.9094 3.0211 1.57 +2.8476 3.0157 1.7221 +2.7566 3.0078 1.8587 +2.6422 2.9978 1.9782 +2.5296 2.9879 2.0602 +2.4042 2.9769 2.1132 +2.27 2.9652 2.1278 +2.2464 2.9631 2.147 +2.2229 2.9611 2.1656 +2.1009 2.9504 2.1336 +1.9914 2.9408 2.071 +1.8939 2.9323 1.9883 +1.8723 2.9304 1.9848 +1.8507 2.9285 1.9813 +1.752 2.9199 1.8614 +1.6594 2.9118 1.7359 +1.6435 2.9104 1.7343 +1.6262 2.902 1.7343 +1.5992 2.9065 1.6818 +1.5707 2.904 1.6236 +1.5394 2.9013 1.5821 +2.9244 2.9914 1.5732 +2.8631 2.9835 1.728 +2.7717 2.9729 1.8675 +2.6564 2.9602 1.99 +2.5405 2.9468 2.076 +2.4113 2.932 2.1319 +2.2727 2.9189 2.147 +2.2479 2.9316 2.16 +2.2234 2.9446 2.1723 +2.0985 2.9301 2.1408 +1.9864 2.9119 2.0801 +1.8873 2.9007 1.9971 +1.8677 2.9085 1.9909 +1.8481 2.9163 1.9847 +1.7479 2.902 1.8659 +1.6538 2.888 1.7417 +1.6399 2.8951 1.7381 +1.5866 2.888 1.692 +1.5654 2.8827 1.6285 +1.5342 2.8801 1.5869 +2.9554 2.9812 1.5809 +2.8943 2.9724 1.743 +2.8017 2.9606 1.8893 +2.684 2.9465 2.0183 +2.5598 2.9309 2.1141 +2.4207 2.9138 2.1768 +2.271 2.8994 2.1933 +2.2464 2.9184 2.1914 +2.2219 2.9376 2.1886 +2.0899 2.921 2.1585 +1.9695 2.8985 2.1024 +1.866 2.8859 2.0183 +1.8529 2.8983 2.0056 +1.8307 2.9147 2.0011 +1.7351 2.8937 1.8769 +1.6363 2.8768 1.7559 +1.6287 2.8878 1.7472 +1.5492 2.8726 1.6406 +1.5181 2.8701 1.5987 +2.9841 2.9966 1.5886 +2.9233 2.9888 1.7579 +2.8292 2.978 1.9112 +2.7088 2.9648 2.0466 +2.576 2.9497 2.1522 +2.4268 2.9332 2.2219 +2.266 2.9183 2.2395 +2.2426 2.9312 2.2227 +2.2191 2.9442 2.2049 +2.0798 2.9285 2.1762 +1.9506 2.9087 2.1247 +1.8425 2.8967 2.0395 +1.8366 2.9058 2.0203 +1.721 2.8997 1.8879 +1.6171 2.8848 1.77 +1.6163 2.893 1.7563 +1.5764 2.8922 1.6992 +1.5317 2.8798 1.6526 +1.5005 2.8772 1.6105 +3 0 1 2 +3 0 2 3 +3 4 0 3 +3 5 4 3 +3 5 3 6 +3 5 6 7 +3 8 5 7 +3 9 8 7 +3 9 7 10 +3 9 10 11 +3 12 9 11 +3 13 12 11 +3 13 11 14 +3 13 14 15 +3 16 15 17 +3 16 17 18 +3 19 16 18 +3 20 19 18 +3 20 18 21 +3 20 21 22 +3 23 20 22 +3 24 23 22 +3 24 22 25 +3 24 25 26 +3 27 24 26 +3 28 27 26 +3 28 26 29 +3 28 29 30 +3 31 28 30 +3 32 31 30 +3 32 30 33 +3 32 33 34 +3 35 32 34 +3 36 35 34 +3 36 34 37 +3 36 37 38 +3 39 36 38 +3 40 39 38 +3 40 38 41 +3 40 41 42 +3 2 1 43 +3 3 2 43 +3 3 43 44 +3 3 44 45 +3 6 3 45 +3 7 6 45 +3 10 7 46 +3 11 10 46 +3 11 46 47 +3 11 47 48 +3 14 11 48 +3 15 14 48 +3 15 48 49 +3 15 49 50 +3 17 15 50 +3 18 17 50 +3 18 50 51 +3 18 51 52 +3 21 18 52 +3 22 21 52 +3 22 52 53 +3 22 53 54 +3 25 22 54 +3 26 25 54 +3 26 54 55 +3 26 55 56 +3 29 26 56 +3 30 29 56 +3 30 56 57 +3 30 57 58 +3 33 30 58 +3 34 33 58 +3 34 58 59 +3 34 59 60 +3 37 34 60 +3 38 37 60 +3 38 60 61 +3 38 61 62 +3 41 38 62 +3 42 41 62 +3 43 1 63 +3 43 63 64 +3 44 43 64 +3 45 44 64 +3 7 45 65 +3 46 7 65 +3 46 65 66 +3 46 66 67 +3 47 46 67 +3 48 47 67 +3 48 67 68 +3 48 68 49 +3 50 49 69 +3 50 69 70 +3 51 50 70 +3 52 51 70 +3 52 70 71 +3 52 71 72 +3 53 52 72 +3 54 53 72 +3 54 72 73 +3 54 73 74 +3 55 54 74 +3 56 55 74 +3 56 74 75 +3 56 75 76 +3 57 56 76 +3 58 57 76 +3 58 76 77 +3 58 77 78 +3 59 58 78 +3 60 59 78 +3 60 78 79 +3 60 79 80 +3 61 60 80 +3 62 61 80 +3 62 80 81 +3 62 81 42 +3 63 1 82 +3 64 63 82 +3 64 82 83 +3 64 83 84 +3 45 64 84 +3 65 45 84 +3 66 65 85 +3 67 66 85 +3 67 85 86 +3 67 86 87 +3 68 67 87 +3 49 68 87 +3 49 87 88 +3 49 88 89 +3 69 49 89 +3 70 69 89 +3 70 89 90 +3 70 90 91 +3 71 70 91 +3 72 71 91 +3 72 91 92 +3 72 92 93 +3 73 72 93 +3 74 73 93 +3 74 93 94 +3 74 94 95 +3 75 74 95 +3 76 75 95 +3 76 95 96 +3 76 96 97 +3 77 76 97 +3 78 77 97 +3 78 97 98 +3 78 98 99 +3 79 78 99 +3 80 79 99 +3 80 99 100 +3 80 100 101 +3 81 80 101 +3 42 81 101 +3 82 1 102 +3 82 102 103 +3 83 82 103 +3 84 83 103 +3 84 103 104 +3 84 104 105 +3 65 84 105 +3 85 65 105 +3 85 105 106 +3 85 106 107 +3 86 85 107 +3 87 86 107 +3 87 107 108 +3 87 108 88 +3 89 88 109 +3 89 109 110 +3 90 89 110 +3 91 90 110 +3 91 110 111 +3 91 111 112 +3 92 91 112 +3 93 92 112 +3 93 112 113 +3 93 113 114 +3 94 93 114 +3 95 94 114 +3 95 114 115 +3 95 115 116 +3 96 95 116 +3 97 96 116 +3 97 116 117 +3 97 117 118 +3 98 97 118 +3 99 98 118 +3 99 118 119 +3 99 119 120 +3 100 99 120 +3 101 100 120 +3 101 120 121 +3 101 121 42 +3 102 1 122 +3 103 102 122 +3 103 122 123 +3 103 123 124 +3 104 103 124 +3 105 104 124 +3 106 105 125 +3 107 106 125 +3 107 125 126 +3 107 126 127 +3 108 107 127 +3 88 108 127 +3 88 127 128 +3 88 128 129 +3 109 88 129 +3 110 109 129 +3 110 129 130 +3 110 130 131 +3 111 110 131 +3 112 111 131 +3 112 131 132 +3 112 132 133 +3 113 112 133 +3 114 113 133 +3 114 133 134 +3 114 134 135 +3 115 114 135 +3 116 115 135 +3 116 135 136 +3 116 136 137 +3 117 116 137 +3 118 117 137 +3 118 137 138 +3 118 138 139 +3 119 118 139 +3 120 119 139 +3 120 139 140 +3 120 140 141 +3 121 120 141 +3 42 121 141 +3 122 1 142 +3 122 142 143 +3 123 122 143 +3 124 123 143 +3 105 124 8 +3 125 105 8 +3 125 8 144 +3 125 144 145 +3 126 125 145 +3 127 126 145 +3 127 145 146 +3 127 146 128 +3 129 128 147 +3 129 147 148 +3 130 129 148 +3 131 130 148 +3 131 148 149 +3 131 149 150 +3 132 131 150 +3 133 132 150 +3 133 150 151 +3 133 151 152 +3 134 133 152 +3 135 134 152 +3 135 152 153 +3 135 153 154 +3 136 135 154 +3 137 136 154 +3 137 154 155 +3 137 155 156 +3 138 137 156 +3 139 138 156 +3 139 156 157 +3 139 157 158 +3 140 139 158 +3 141 140 158 +3 141 158 159 +3 141 159 42 +3 142 1 0 +3 143 142 0 +3 143 0 4 +3 143 4 5 +3 124 143 5 +3 8 124 5 +3 144 8 9 +3 145 144 9 +3 145 9 12 +3 145 12 13 +3 146 145 13 +3 128 146 13 +3 128 13 15 +3 128 15 16 +3 147 128 16 +3 148 147 16 +3 148 16 19 +3 148 19 20 +3 149 148 20 +3 150 149 20 +3 150 20 23 +3 150 23 24 +3 151 150 24 +3 152 151 24 +3 152 24 27 +3 152 27 28 +3 153 152 28 +3 154 153 28 +3 154 28 31 +3 154 31 32 +3 155 154 32 +3 156 155 32 +3 156 32 35 +3 156 35 36 +3 157 156 36 +3 158 157 36 +3 158 36 39 +3 158 39 40 +3 159 158 40 +3 42 159 40 +3 160 161 162 +3 163 160 162 +3 162 161 164 +3 162 164 165 +3 163 162 165 +3 166 163 165 +3 166 165 167 +3 166 167 168 +3 169 166 168 +3 164 161 170 +3 165 164 170 +3 170 161 171 +3 165 170 171 +3 165 171 172 +3 165 172 173 +3 167 165 173 +3 168 167 173 +3 168 173 174 +3 171 161 175 +3 171 175 176 +3 172 171 176 +3 173 172 176 +3 175 161 177 +3 176 175 177 +3 176 177 178 +3 176 178 179 +3 173 176 179 +3 174 173 179 +3 177 161 180 +3 177 180 181 +3 178 177 181 +3 179 178 181 +3 179 181 182 +3 179 182 174 +3 180 161 183 +3 181 180 183 +3 181 183 184 +3 181 184 182 +3 183 161 185 +3 183 185 186 +3 184 183 186 +3 182 184 186 +3 182 186 187 +3 182 187 168 +3 174 182 168 +3 185 161 188 +3 186 185 188 +3 186 188 189 +3 186 189 190 +3 187 186 190 +3 168 187 190 +3 168 190 169 +3 188 161 191 +3 188 191 192 +3 189 188 192 +3 190 189 192 +3 191 161 193 +3 192 191 193 +3 192 193 194 +3 192 194 195 +3 190 192 195 +3 169 190 195 +3 193 161 160 +3 193 160 163 +3 194 193 163 +3 195 194 163 +3 195 163 166 +3 195 166 169 +3 196 197 198 +3 196 198 199 +3 200 201 202 +3 203 200 202 +3 197 203 202 +3 197 202 204 +3 197 204 205 +3 198 197 205 +3 199 198 205 +3 205 204 206 +3 205 206 199 +3 202 201 207 +3 202 207 208 +3 202 208 209 +3 204 202 209 +3 206 204 209 +3 206 209 210 +3 206 210 199 +3 209 208 211 +3 209 211 212 +3 210 209 212 +3 199 210 212 +3 208 207 213 +3 208 213 214 +3 211 208 214 +3 212 211 214 +3 212 214 215 +3 212 215 199 +3 213 207 216 +3 214 213 216 +3 214 216 217 +3 214 217 218 +3 215 214 218 +3 199 215 218 +3 218 217 219 +3 218 219 199 +3 207 201 220 +3 216 207 220 +3 217 216 220 +3 217 220 221 +3 217 221 222 +3 219 217 222 +3 199 219 222 +3 220 201 200 +3 220 200 223 +3 220 223 224 +3 221 220 224 +3 222 221 224 +3 222 224 225 +3 222 225 199 +3 224 223 226 +3 224 226 227 +3 225 224 227 +3 199 225 227 +3 223 200 228 +3 223 228 229 +3 226 223 229 +3 227 226 229 +3 227 229 230 +3 227 230 199 +3 228 200 203 +3 229 228 203 +3 229 203 197 +3 229 197 196 +3 230 229 196 +3 199 230 196 +3 231 232 233 +3 231 233 234 +3 235 231 234 +3 236 235 234 +3 236 234 237 +3 236 237 238 +3 233 232 239 +3 234 233 239 +3 234 239 240 +3 234 240 241 +3 237 234 241 +3 238 237 241 +3 239 232 242 +3 239 242 243 +3 240 239 243 +3 241 240 243 +3 241 243 244 +3 241 244 238 +3 242 232 245 +3 243 242 245 +3 243 245 246 +3 243 246 247 +3 244 243 247 +3 238 244 247 +3 245 232 248 +3 245 248 249 +3 246 245 249 +3 247 246 249 +3 247 249 250 +3 247 250 238 +3 248 232 251 +3 249 248 251 +3 249 251 252 +3 249 252 253 +3 250 249 253 +3 238 250 253 +3 251 232 254 +3 251 254 255 +3 252 251 255 +3 253 252 255 +3 253 255 256 +3 253 256 238 +3 254 232 257 +3 255 254 257 +3 255 257 258 +3 255 258 259 +3 256 255 259 +3 238 256 259 +3 257 232 260 +3 257 260 261 +3 258 257 261 +3 259 258 261 +3 259 261 262 +3 259 262 238 +3 260 232 263 +3 261 260 263 +3 261 263 264 +3 261 264 265 +3 262 261 265 +3 238 262 265 +3 263 232 266 +3 263 266 267 +3 264 263 267 +3 265 264 267 +3 265 267 268 +3 265 268 238 +3 266 232 231 +3 267 266 231 +3 267 231 235 +3 267 235 236 +3 268 267 236 +3 238 268 236 +3 269 270 271 +3 269 271 272 +3 273 269 272 +3 274 273 272 +3 274 272 275 +3 274 275 276 +3 271 270 277 +3 272 271 277 +3 272 277 278 +3 272 278 279 +3 275 272 279 +3 276 275 279 +3 277 270 280 +3 277 280 281 +3 278 277 281 +3 279 278 281 +3 279 281 282 +3 279 282 276 +3 280 270 283 +3 281 280 283 +3 281 283 284 +3 281 284 285 +3 282 281 285 +3 276 282 285 +3 283 270 286 +3 283 286 287 +3 284 283 287 +3 285 284 287 +3 285 287 288 +3 285 288 276 +3 286 270 289 +3 287 286 289 +3 287 289 290 +3 287 290 291 +3 288 287 291 +3 276 288 291 +3 289 270 292 +3 289 292 293 +3 290 289 293 +3 291 290 293 +3 291 293 294 +3 291 294 276 +3 292 270 295 +3 293 292 295 +3 293 295 296 +3 293 296 297 +3 294 293 297 +3 276 294 297 +3 295 270 298 +3 295 298 299 +3 296 295 299 +3 297 296 299 +3 297 299 300 +3 297 300 276 +3 298 270 301 +3 299 298 301 +3 299 301 302 +3 299 302 303 +3 300 299 303 +3 276 300 303 +3 301 270 304 +3 301 304 305 +3 302 301 305 +3 303 302 305 +3 303 305 306 +3 303 306 276 +3 304 270 269 +3 305 304 269 +3 305 269 273 +3 305 273 274 +3 306 305 274 +3 276 306 274 +3 307 308 309 +3 307 309 310 +3 311 307 310 +3 312 311 310 +3 312 310 313 +3 312 313 314 +3 315 312 314 +3 316 315 314 +3 316 314 317 +3 316 317 318 +3 319 316 318 +3 320 319 318 +3 320 318 321 +3 320 321 322 +3 323 320 322 +3 324 323 322 +3 324 322 325 +3 324 325 326 +3 327 324 326 +3 328 327 326 +3 328 326 329 +3 328 329 330 +3 331 328 330 +3 332 331 330 +3 332 330 333 +3 332 333 334 +3 335 332 334 +3 336 335 334 +3 336 334 337 +3 336 337 338 +3 339 336 338 +3 340 339 338 +3 340 338 341 +3 340 341 342 +3 309 308 343 +3 310 309 343 +3 310 343 344 +3 310 344 345 +3 313 310 345 +3 314 313 345 +3 314 345 346 +3 314 346 347 +3 317 314 347 +3 318 317 347 +3 318 347 348 +3 318 348 349 +3 321 318 349 +3 322 321 349 +3 322 349 350 +3 322 350 351 +3 325 322 351 +3 326 325 351 +3 326 351 352 +3 326 352 353 +3 329 326 353 +3 330 329 353 +3 330 353 354 +3 330 354 355 +3 333 330 355 +3 334 333 355 +3 334 355 356 +3 334 356 357 +3 337 334 357 +3 338 337 357 +3 338 357 358 +3 338 358 341 +3 343 308 359 +3 343 359 360 +3 344 343 360 +3 345 344 360 +3 345 360 361 +3 345 361 362 +3 346 345 362 +3 347 346 362 +3 347 362 363 +3 347 363 364 +3 348 347 364 +3 349 348 364 +3 349 364 365 +3 349 365 366 +3 350 349 366 +3 351 350 366 +3 351 366 367 +3 351 367 368 +3 352 351 368 +3 353 352 368 +3 353 368 369 +3 353 369 370 +3 354 353 370 +3 355 354 370 +3 355 370 371 +3 355 371 372 +3 356 355 372 +3 357 356 372 +3 359 308 373 +3 360 359 373 +3 360 373 374 +3 360 374 375 +3 361 360 375 +3 362 361 375 +3 362 375 376 +3 362 376 377 +3 363 362 377 +3 364 363 377 +3 364 377 378 +3 364 378 379 +3 365 364 379 +3 366 365 379 +3 366 379 380 +3 366 380 381 +3 367 366 381 +3 368 367 381 +3 368 381 382 +3 368 382 383 +3 369 368 383 +3 370 369 383 +3 370 383 384 +3 370 384 385 +3 371 370 385 +3 372 371 385 +3 372 385 386 +3 372 386 387 +3 357 372 387 +3 358 357 387 +3 358 387 388 +3 358 388 389 +3 341 358 389 +3 342 341 389 +3 373 308 390 +3 373 390 391 +3 374 373 391 +3 375 374 391 +3 375 391 392 +3 375 392 393 +3 376 375 393 +3 377 376 393 +3 377 393 394 +3 377 394 395 +3 378 377 395 +3 379 378 395 +3 379 395 396 +3 379 396 397 +3 380 379 397 +3 381 380 397 +3 381 397 398 +3 381 398 399 +3 382 381 399 +3 383 382 399 +3 383 399 400 +3 383 400 401 +3 384 383 401 +3 385 384 401 +3 385 401 402 +3 385 402 403 +3 386 385 403 +3 387 386 403 +3 387 403 404 +3 387 404 405 +3 388 387 405 +3 389 388 405 +3 389 405 406 +3 389 406 342 +3 390 308 407 +3 391 390 407 +3 391 407 408 +3 391 408 409 +3 392 391 409 +3 393 392 409 +3 393 409 410 +3 393 410 411 +3 394 393 411 +3 395 394 411 +3 395 411 412 +3 395 412 413 +3 396 395 413 +3 397 396 413 +3 397 413 414 +3 397 414 415 +3 398 397 415 +3 399 398 415 +3 399 415 416 +3 399 416 417 +3 400 399 417 +3 401 400 417 +3 401 417 418 +3 401 418 419 +3 402 401 419 +3 403 402 419 +3 403 419 420 +3 403 420 421 +3 404 403 421 +3 405 404 421 +3 405 421 422 +3 405 422 406 +3 407 308 423 +3 407 423 424 +3 408 407 424 +3 409 408 424 +3 409 424 425 +3 409 425 426 +3 410 409 426 +3 411 410 426 +3 411 426 427 +3 411 427 428 +3 412 411 428 +3 413 412 428 +3 413 428 429 +3 413 429 430 +3 414 413 430 +3 415 414 430 +3 415 430 431 +3 415 431 432 +3 416 415 432 +3 417 416 432 +3 417 432 433 +3 417 433 434 +3 418 417 434 +3 419 418 434 +3 419 434 435 +3 419 435 436 +3 420 419 436 +3 421 420 436 +3 423 308 437 +3 424 423 437 +3 424 437 438 +3 424 438 439 +3 425 424 439 +3 426 425 439 +3 426 439 440 +3 426 440 441 +3 427 426 441 +3 428 427 441 +3 428 441 442 +3 428 442 443 +3 429 428 443 +3 430 429 443 +3 430 443 444 +3 430 444 445 +3 431 430 445 +3 432 431 445 +3 432 445 446 +3 432 446 447 +3 433 432 447 +3 434 433 447 +3 434 447 448 +3 434 448 449 +3 435 434 449 +3 436 435 449 +3 436 449 450 +3 436 450 451 +3 421 436 451 +3 422 421 451 +3 422 451 452 +3 422 452 453 +3 406 422 453 +3 342 406 453 +3 437 308 454 +3 437 454 455 +3 438 437 455 +3 439 438 455 +3 439 455 456 +3 439 456 457 +3 440 439 457 +3 441 440 457 +3 441 457 458 +3 441 458 459 +3 442 441 459 +3 443 442 459 +3 443 459 460 +3 443 460 461 +3 444 443 461 +3 445 444 461 +3 445 461 462 +3 445 462 463 +3 446 445 463 +3 447 446 463 +3 447 463 464 +3 447 464 465 +3 448 447 465 +3 449 448 465 +3 449 465 466 +3 449 466 467 +3 450 449 467 +3 451 450 467 +3 451 467 468 +3 451 468 469 +3 452 451 469 +3 453 452 469 +3 453 469 470 +3 453 470 342 +3 455 454 471 +3 455 471 472 +3 456 455 472 +3 457 456 472 +3 457 472 473 +3 457 473 474 +3 458 457 474 +3 459 458 474 +3 459 474 475 +3 459 475 476 +3 460 459 476 +3 461 460 476 +3 461 476 477 +3 461 477 478 +3 462 461 478 +3 463 462 478 +3 463 478 479 +3 463 479 480 +3 464 463 480 +3 465 464 480 +3 465 480 481 +3 465 481 482 +3 466 465 482 +3 467 466 482 +3 467 482 483 +3 467 483 484 +3 468 467 484 +3 469 468 484 +3 469 484 485 +3 469 485 486 +3 470 469 486 +3 342 470 486 +3 454 308 487 +3 454 487 488 +3 471 454 488 +3 472 471 488 +3 472 488 489 +3 472 489 490 +3 473 472 490 +3 474 473 490 +3 474 490 491 +3 474 491 492 +3 475 474 492 +3 476 475 492 +3 476 492 493 +3 476 493 494 +3 477 476 494 +3 478 477 494 +3 478 494 495 +3 478 495 496 +3 479 478 496 +3 480 479 496 +3 480 496 497 +3 480 497 498 +3 481 480 498 +3 482 481 498 +3 482 498 499 +3 482 499 500 +3 483 482 500 +3 484 483 500 +3 484 500 501 +3 484 501 502 +3 485 484 502 +3 486 485 502 +3 486 502 503 +3 486 503 342 +3 488 487 504 +3 488 504 505 +3 489 488 505 +3 490 489 505 +3 490 505 506 +3 490 506 507 +3 491 490 507 +3 492 491 507 +3 492 507 508 +3 492 508 509 +3 493 492 509 +3 494 493 509 +3 494 509 510 +3 494 510 511 +3 495 494 511 +3 496 495 511 +3 496 511 512 +3 496 512 513 +3 497 496 513 +3 498 497 513 +3 498 513 514 +3 498 514 515 +3 499 498 515 +3 500 499 515 +3 500 515 516 +3 500 516 517 +3 501 500 517 +3 502 501 517 +3 502 517 518 +3 502 518 519 +3 503 502 519 +3 342 503 519 +3 487 308 520 +3 487 520 521 +3 504 487 521 +3 505 504 521 +3 505 521 522 +3 505 522 523 +3 506 505 523 +3 507 506 523 +3 507 523 524 +3 507 524 525 +3 508 507 525 +3 509 508 525 +3 509 525 526 +3 509 526 527 +3 510 509 527 +3 511 510 527 +3 511 527 528 +3 511 528 529 +3 512 511 529 +3 513 512 529 +3 513 529 530 +3 513 530 531 +3 514 513 531 +3 515 514 531 +3 515 531 532 +3 515 532 533 +3 516 515 533 +3 517 516 533 +3 517 533 534 +3 517 534 535 +3 518 517 535 +3 519 518 535 +3 519 535 536 +3 519 536 342 +3 520 308 537 +3 521 520 537 +3 521 537 538 +3 521 538 539 +3 522 521 539 +3 523 522 539 +3 523 539 540 +3 523 540 541 +3 524 523 541 +3 525 524 541 +3 525 541 542 +3 525 542 543 +3 526 525 543 +3 527 526 543 +3 527 543 544 +3 527 544 545 +3 528 527 545 +3 529 528 545 +3 529 545 546 +3 529 546 547 +3 530 529 547 +3 531 530 547 +3 531 547 548 +3 531 548 549 +3 532 531 549 +3 533 532 549 +3 533 549 550 +3 533 550 551 +3 534 533 551 +3 535 534 551 +3 535 551 552 +3 535 552 553 +3 536 535 553 +3 342 536 553 +3 539 538 554 +3 539 554 555 +3 540 539 555 +3 541 540 555 +3 541 555 556 +3 541 556 557 +3 542 541 557 +3 543 542 557 +3 543 557 558 +3 543 558 559 +3 544 543 559 +3 545 544 559 +3 545 559 560 +3 545 560 561 +3 546 545 561 +3 547 546 561 +3 547 561 562 +3 547 562 563 +3 548 547 563 +3 549 548 563 +3 549 563 564 +3 549 564 565 +3 550 549 565 +3 551 550 565 +3 551 565 566 +3 551 566 567 +3 552 551 567 +3 553 552 567 +3 553 567 568 +3 553 568 342 +3 537 308 569 +3 538 537 569 +3 538 569 570 +3 538 570 571 +3 554 538 571 +3 555 554 571 +3 555 571 572 +3 555 572 573 +3 556 555 573 +3 557 556 573 +3 557 573 574 +3 557 574 575 +3 558 557 575 +3 559 558 575 +3 559 575 576 +3 559 576 577 +3 560 559 577 +3 561 560 577 +3 561 577 578 +3 561 578 579 +3 562 561 579 +3 563 562 579 +3 563 579 580 +3 563 580 581 +3 564 563 581 +3 565 564 581 +3 565 581 582 +3 565 582 583 +3 566 565 583 +3 567 566 583 +3 567 583 584 +3 567 584 585 +3 568 567 585 +3 342 568 585 +3 569 308 586 +3 569 586 587 +3 570 569 587 +3 571 570 587 +3 571 587 588 +3 571 588 589 +3 572 571 589 +3 573 572 589 +3 573 589 590 +3 573 590 591 +3 574 573 591 +3 575 574 591 +3 575 591 592 +3 575 592 593 +3 576 575 593 +3 577 576 593 +3 577 593 594 +3 577 594 595 +3 578 577 595 +3 579 578 595 +3 579 595 596 +3 579 596 597 +3 580 579 597 +3 581 580 597 +3 581 597 598 +3 581 598 599 +3 582 581 599 +3 583 582 599 +3 583 599 600 +3 583 600 601 +3 584 583 601 +3 585 584 601 +3 585 601 602 +3 585 602 342 +3 586 308 603 +3 587 586 603 +3 587 603 604 +3 587 604 605 +3 588 587 605 +3 589 588 605 +3 589 605 606 +3 589 606 607 +3 590 589 607 +3 591 590 607 +3 591 607 608 +3 591 608 609 +3 592 591 609 +3 593 592 609 +3 593 609 610 +3 593 610 611 +3 594 593 611 +3 595 594 611 +3 595 611 612 +3 595 612 613 +3 596 595 613 +3 597 596 613 +3 597 613 614 +3 597 614 615 +3 598 597 615 +3 599 598 615 +3 599 615 616 +3 599 616 617 +3 600 599 617 +3 601 600 617 +3 601 617 618 +3 601 618 619 +3 602 601 619 +3 342 602 619 +3 603 308 620 +3 603 620 621 +3 604 603 621 +3 605 604 621 +3 605 621 622 +3 605 622 623 +3 606 605 623 +3 607 606 623 +3 607 623 624 +3 607 624 625 +3 608 607 625 +3 609 608 625 +3 609 625 626 +3 609 626 627 +3 610 609 627 +3 611 610 627 +3 611 627 628 +3 611 628 629 +3 612 611 629 +3 613 612 629 +3 613 629 630 +3 613 630 631 +3 614 613 631 +3 615 614 631 +3 615 631 632 +3 615 632 633 +3 616 615 633 +3 617 616 633 +3 617 633 634 +3 617 634 635 +3 618 617 635 +3 619 618 635 +3 619 635 636 +3 619 636 342 +3 622 621 637 +3 623 622 637 +3 623 637 638 +3 623 638 639 +3 624 623 639 +3 625 624 639 +3 625 639 640 +3 625 640 641 +3 626 625 641 +3 627 626 641 +3 627 641 642 +3 627 642 643 +3 628 627 643 +3 629 628 643 +3 629 643 644 +3 629 644 645 +3 630 629 645 +3 631 630 645 +3 631 645 646 +3 631 646 647 +3 632 631 647 +3 633 632 647 +3 633 647 648 +3 633 648 649 +3 634 633 649 +3 635 634 649 +3 635 649 650 +3 635 650 651 +3 636 635 651 +3 342 636 651 +3 620 308 652 +3 620 652 653 +3 621 620 653 +3 637 621 653 +3 637 653 654 +3 637 654 655 +3 638 637 655 +3 639 638 655 +3 639 655 656 +3 639 656 657 +3 640 639 657 +3 641 640 657 +3 641 657 658 +3 641 658 659 +3 642 641 659 +3 643 642 659 +3 643 659 660 +3 643 660 661 +3 644 643 661 +3 645 644 661 +3 645 661 662 +3 645 662 663 +3 646 645 663 +3 647 646 663 +3 647 663 664 +3 647 664 665 +3 648 647 665 +3 649 648 665 +3 649 665 666 +3 649 666 667 +3 650 649 667 +3 651 650 667 +3 651 667 668 +3 651 668 342 +3 652 308 669 +3 653 652 669 +3 653 669 670 +3 653 670 671 +3 654 653 671 +3 655 654 671 +3 655 671 672 +3 655 672 673 +3 656 655 673 +3 657 656 673 +3 657 673 674 +3 657 674 675 +3 658 657 675 +3 659 658 675 +3 659 675 676 +3 659 676 677 +3 660 659 677 +3 661 660 677 +3 661 677 678 +3 661 678 679 +3 662 661 679 +3 663 662 679 +3 663 679 680 +3 663 680 681 +3 664 663 681 +3 665 664 681 +3 665 681 682 +3 665 682 683 +3 666 665 683 +3 667 666 683 +3 667 683 684 +3 667 684 685 +3 668 667 685 +3 342 668 685 +3 669 308 686 +3 669 686 687 +3 670 669 687 +3 671 670 687 +3 671 687 688 +3 671 688 689 +3 672 671 689 +3 673 672 689 +3 673 689 690 +3 673 690 691 +3 674 673 691 +3 675 674 691 +3 675 691 692 +3 675 692 693 +3 676 675 693 +3 677 676 693 +3 677 693 694 +3 677 694 695 +3 678 677 695 +3 679 678 695 +3 679 695 696 +3 679 696 697 +3 680 679 697 +3 681 680 697 +3 681 697 698 +3 681 698 699 +3 682 681 699 +3 683 682 699 +3 683 699 700 +3 683 700 701 +3 684 683 701 +3 685 684 701 +3 685 701 702 +3 685 702 342 +3 686 308 703 +3 687 686 703 +3 687 703 704 +3 687 704 705 +3 688 687 705 +3 689 688 705 +3 689 705 706 +3 689 706 707 +3 690 689 707 +3 691 690 707 +3 691 707 708 +3 691 708 709 +3 692 691 709 +3 693 692 709 +3 693 709 710 +3 693 710 711 +3 694 693 711 +3 695 694 711 +3 695 711 712 +3 695 712 713 +3 696 695 713 +3 697 696 713 +3 697 713 714 +3 697 714 715 +3 698 697 715 +3 699 698 715 +3 699 715 716 +3 699 716 717 +3 700 699 717 +3 701 700 717 +3 701 717 718 +3 701 718 719 +3 702 701 719 +3 342 702 719 +3 703 308 307 +3 703 307 720 +3 704 703 720 +3 705 704 720 +3 705 720 721 +3 705 721 722 +3 706 705 722 +3 707 706 722 +3 707 722 723 +3 707 723 724 +3 708 707 724 +3 709 708 724 +3 709 724 725 +3 709 725 726 +3 710 709 726 +3 711 710 726 +3 711 726 727 +3 711 727 728 +3 712 711 728 +3 713 712 728 +3 713 728 729 +3 713 729 730 +3 714 713 730 +3 715 714 730 +3 715 730 731 +3 715 731 732 +3 716 715 732 +3 717 716 732 +3 717 732 733 +3 717 733 734 +3 718 717 734 +3 719 718 734 +3 719 734 735 +3 719 735 342 +3 720 307 311 +3 720 311 312 +3 721 720 312 +3 722 721 312 +3 722 312 315 +3 722 315 316 +3 723 722 316 +3 724 723 316 +3 724 316 319 +3 724 319 320 +3 725 724 320 +3 726 725 320 +3 726 320 323 +3 726 323 324 +3 727 726 324 +3 728 727 324 +3 728 324 327 +3 728 327 328 +3 729 728 328 +3 730 729 328 +3 730 328 331 +3 730 331 332 +3 731 730 332 +3 732 731 332 +3 732 332 335 +3 732 335 336 +3 733 732 336 +3 734 733 336 +3 734 336 339 +3 734 339 340 +3 735 734 340 +3 342 735 340 +3 736 737 738 +3 736 738 739 +3 740 736 739 +3 741 740 739 +3 741 739 742 +3 741 742 743 +3 744 741 743 +3 745 744 743 +3 745 743 746 +3 745 746 747 +3 748 745 747 +3 749 748 747 +3 749 747 750 +3 749 750 751 +3 752 749 751 +3 753 752 751 +3 753 751 754 +3 753 754 755 +3 756 753 755 +3 757 756 755 +3 757 755 758 +3 757 758 759 +3 760 757 759 +3 761 760 759 +3 761 759 762 +3 761 762 763 +3 764 761 763 +3 765 764 763 +3 765 763 766 +3 765 766 767 +3 768 765 767 +3 769 768 767 +3 769 767 770 +3 769 770 771 +3 772 769 771 +3 773 772 771 +3 773 771 774 +3 773 774 775 +3 776 773 775 +3 777 776 775 +3 777 775 778 +3 777 778 779 +3 780 777 779 +3 781 780 779 +3 781 779 782 +3 781 782 783 +3 784 781 783 +3 785 784 783 +3 785 783 786 +3 785 786 787 +3 788 785 787 +3 789 788 787 +3 789 787 790 +3 789 790 791 +3 792 789 791 +3 793 792 791 +3 793 791 794 +3 793 794 795 +3 796 793 795 +3 797 796 795 +3 797 795 798 +3 797 798 799 +3 800 797 799 +3 801 800 799 +3 801 799 802 +3 801 802 803 +3 804 801 803 +3 805 804 803 +3 805 803 806 +3 805 806 807 +3 808 805 807 +3 809 808 807 +3 809 807 810 +3 809 810 811 +3 812 809 811 +3 813 812 811 +3 813 811 814 +3 813 814 815 +3 816 813 815 +3 817 816 815 +3 817 815 818 +3 817 818 819 +3 820 817 819 +3 821 820 819 +3 821 819 822 +3 821 822 823 +3 824 821 823 +3 825 824 823 +3 825 823 826 +3 825 826 827 +3 738 737 828 +3 739 738 828 +3 739 828 829 +3 739 829 830 +3 742 739 830 +3 743 742 830 +3 743 830 831 +3 743 831 832 +3 746 743 832 +3 747 746 832 +3 747 832 833 +3 747 833 834 +3 750 747 834 +3 751 750 834 +3 751 834 835 +3 751 835 836 +3 754 751 836 +3 755 754 836 +3 755 836 837 +3 755 837 838 +3 758 755 838 +3 759 758 838 +3 759 838 839 +3 759 839 840 +3 762 759 840 +3 763 762 840 +3 763 840 841 +3 763 841 842 +3 766 763 842 +3 767 766 842 +3 767 842 843 +3 767 843 844 +3 770 767 844 +3 771 770 844 +3 771 844 845 +3 771 845 846 +3 774 771 846 +3 775 774 846 +3 775 846 847 +3 775 847 848 +3 778 775 848 +3 779 778 848 +3 779 848 849 +3 779 849 850 +3 782 779 850 +3 783 782 850 +3 783 850 851 +3 783 851 852 +3 786 783 852 +3 787 786 852 +3 787 852 853 +3 787 853 854 +3 790 787 854 +3 791 790 854 +3 791 854 855 +3 791 855 856 +3 794 791 856 +3 795 794 856 +3 795 856 857 +3 795 857 858 +3 798 795 858 +3 799 798 858 +3 799 858 859 +3 799 859 860 +3 802 799 860 +3 803 802 860 +3 803 860 861 +3 803 861 862 +3 806 803 862 +3 807 806 862 +3 807 862 863 +3 807 863 864 +3 810 807 864 +3 811 810 864 +3 811 864 865 +3 811 865 866 +3 814 811 866 +3 815 814 866 +3 815 866 867 +3 815 867 868 +3 818 815 868 +3 819 818 868 +3 819 868 869 +3 819 869 870 +3 822 819 870 +3 823 822 870 +3 823 870 871 +3 823 871 872 +3 826 823 872 +3 827 826 872 +3 828 737 873 +3 828 873 874 +3 829 828 874 +3 830 829 874 +3 830 874 875 +3 830 875 876 +3 831 830 876 +3 832 831 876 +3 832 876 877 +3 832 877 878 +3 833 832 878 +3 834 833 878 +3 834 878 879 +3 834 879 880 +3 835 834 880 +3 836 835 880 +3 836 880 881 +3 836 881 882 +3 837 836 882 +3 838 837 882 +3 838 882 883 +3 838 883 884 +3 839 838 884 +3 840 839 884 +3 840 884 885 +3 840 885 886 +3 841 840 886 +3 842 841 886 +3 842 886 887 +3 842 887 888 +3 843 842 888 +3 844 843 888 +3 844 888 889 +3 844 889 890 +3 845 844 890 +3 846 845 890 +3 846 890 891 +3 846 891 892 +3 847 846 892 +3 848 847 892 +3 848 892 893 +3 848 893 894 +3 849 848 894 +3 850 849 894 +3 850 894 895 +3 850 895 896 +3 851 850 896 +3 852 851 896 +3 852 896 897 +3 852 897 898 +3 853 852 898 +3 854 853 898 +3 854 898 899 +3 854 899 900 +3 855 854 900 +3 856 855 900 +3 856 900 901 +3 856 901 902 +3 857 856 902 +3 858 857 902 +3 858 902 903 +3 858 903 904 +3 859 858 904 +3 860 859 904 +3 860 904 905 +3 860 905 906 +3 861 860 906 +3 862 861 906 +3 862 906 907 +3 862 907 908 +3 863 862 908 +3 864 863 908 +3 864 908 909 +3 864 909 910 +3 865 864 910 +3 866 865 910 +3 866 910 911 +3 866 911 912 +3 867 866 912 +3 868 867 912 +3 868 912 913 +3 868 913 914 +3 869 868 914 +3 870 869 914 +3 870 914 915 +3 870 915 916 +3 871 870 916 +3 872 871 916 +3 872 916 917 +3 872 917 827 +3 873 737 918 +3 874 873 918 +3 874 918 919 +3 874 919 920 +3 875 874 920 +3 876 875 920 +3 876 920 921 +3 876 921 922 +3 877 876 922 +3 878 877 922 +3 878 922 923 +3 878 923 924 +3 879 878 924 +3 880 879 924 +3 880 924 925 +3 880 925 926 +3 881 880 926 +3 882 881 926 +3 882 926 927 +3 882 927 928 +3 883 882 928 +3 884 883 928 +3 884 928 929 +3 884 929 930 +3 885 884 930 +3 886 885 930 +3 886 930 931 +3 886 931 932 +3 887 886 932 +3 888 887 932 +3 888 932 933 +3 888 933 934 +3 889 888 934 +3 890 889 934 +3 890 934 935 +3 890 935 936 +3 891 890 936 +3 892 891 936 +3 892 936 937 +3 892 937 938 +3 893 892 938 +3 894 893 938 +3 894 938 939 +3 894 939 940 +3 895 894 940 +3 896 895 940 +3 896 940 941 +3 896 941 942 +3 897 896 942 +3 898 897 942 +3 898 942 943 +3 898 943 944 +3 899 898 944 +3 900 899 944 +3 900 944 945 +3 900 945 946 +3 901 900 946 +3 902 901 946 +3 902 946 947 +3 902 947 948 +3 903 902 948 +3 904 903 948 +3 904 948 949 +3 904 949 950 +3 905 904 950 +3 906 905 950 +3 906 950 951 +3 906 951 952 +3 907 906 952 +3 908 907 952 +3 908 952 953 +3 908 953 954 +3 909 908 954 +3 910 909 954 +3 910 954 955 +3 910 955 956 +3 911 910 956 +3 912 911 956 +3 912 956 957 +3 912 957 958 +3 913 912 958 +3 914 913 958 +3 914 958 959 +3 914 959 960 +3 915 914 960 +3 916 915 960 +3 916 960 961 +3 916 961 962 +3 917 916 962 +3 827 917 962 +3 918 737 963 +3 918 963 964 +3 919 918 964 +3 920 919 964 +3 920 964 965 +3 920 965 966 +3 921 920 966 +3 922 921 966 +3 922 966 967 +3 922 967 968 +3 923 922 968 +3 924 923 968 +3 924 968 969 +3 924 969 970 +3 925 924 970 +3 926 925 970 +3 926 970 971 +3 926 971 972 +3 927 926 972 +3 928 927 972 +3 928 972 973 +3 928 973 974 +3 929 928 974 +3 930 929 974 +3 930 974 975 +3 930 975 976 +3 931 930 976 +3 932 931 976 +3 932 976 977 +3 932 977 978 +3 933 932 978 +3 934 933 978 +3 934 978 979 +3 934 979 980 +3 935 934 980 +3 936 935 980 +3 936 980 981 +3 936 981 982 +3 937 936 982 +3 938 937 982 +3 938 982 983 +3 938 983 984 +3 939 938 984 +3 940 939 984 +3 940 984 985 +3 940 985 986 +3 941 940 986 +3 942 941 986 +3 942 986 987 +3 942 987 988 +3 943 942 988 +3 944 943 988 +3 944 988 989 +3 944 989 990 +3 945 944 990 +3 946 945 990 +3 946 990 991 +3 946 991 992 +3 947 946 992 +3 948 947 992 +3 948 992 993 +3 948 993 994 +3 949 948 994 +3 950 949 994 +3 950 994 995 +3 950 995 996 +3 951 950 996 +3 952 951 996 +3 952 996 997 +3 952 997 998 +3 953 952 998 +3 954 953 998 +3 954 998 999 +3 954 999 1000 +3 955 954 1000 +3 956 955 1000 +3 956 1000 1001 +3 956 1001 1002 +3 957 956 1002 +3 958 957 1002 +3 958 1002 1003 +3 958 1003 1004 +3 959 958 1004 +3 960 959 1004 +3 960 1004 1005 +3 960 1005 1006 +3 961 960 1006 +3 962 961 1006 +3 962 1006 1007 +3 962 1007 827 +3 963 737 1008 +3 964 963 1008 +3 964 1008 1009 +3 964 1009 1010 +3 965 964 1010 +3 966 965 1010 +3 966 1010 1011 +3 966 1011 1012 +3 967 966 1012 +3 968 967 1012 +3 968 1012 1013 +3 968 1013 1014 +3 969 968 1014 +3 970 969 1014 +3 970 1014 1015 +3 970 1015 1016 +3 971 970 1016 +3 972 971 1016 +3 972 1016 1017 +3 972 1017 1018 +3 973 972 1018 +3 974 973 1018 +3 974 1018 1019 +3 974 1019 1020 +3 975 974 1020 +3 976 975 1020 +3 976 1020 1021 +3 976 1021 1022 +3 977 976 1022 +3 978 977 1022 +3 978 1022 1023 +3 978 1023 1024 +3 979 978 1024 +3 980 979 1024 +3 980 1024 1025 +3 980 1025 1026 +3 981 980 1026 +3 982 981 1026 +3 982 1026 1027 +3 982 1027 1028 +3 983 982 1028 +3 984 983 1028 +3 984 1028 1029 +3 984 1029 1030 +3 985 984 1030 +3 986 985 1030 +3 986 1030 1031 +3 986 1031 1032 +3 987 986 1032 +3 988 987 1032 +3 988 1032 1033 +3 988 1033 1034 +3 989 988 1034 +3 990 989 1034 +3 990 1034 1035 +3 990 1035 1036 +3 991 990 1036 +3 992 991 1036 +3 992 1036 1037 +3 992 1037 1038 +3 993 992 1038 +3 994 993 1038 +3 994 1038 1039 +3 994 1039 1040 +3 995 994 1040 +3 996 995 1040 +3 996 1040 1041 +3 996 1041 1042 +3 997 996 1042 +3 998 997 1042 +3 998 1042 1043 +3 998 1043 1044 +3 999 998 1044 +3 1000 999 1044 +3 1000 1044 1045 +3 1000 1045 1046 +3 1001 1000 1046 +3 1002 1001 1046 +3 1002 1046 1047 +3 1002 1047 1048 +3 1003 1002 1048 +3 1004 1003 1048 +3 1004 1048 1049 +3 1004 1049 1050 +3 1005 1004 1050 +3 1006 1005 1050 +3 1006 1050 1051 +3 1006 1051 1052 +3 1007 1006 1052 +3 827 1007 1052 +3 1008 737 1053 +3 1008 1053 1054 +3 1009 1008 1054 +3 1010 1009 1054 +3 1010 1054 1055 +3 1010 1055 1056 +3 1011 1010 1056 +3 1012 1011 1056 +3 1012 1056 1057 +3 1012 1057 1058 +3 1013 1012 1058 +3 1014 1013 1058 +3 1014 1058 1059 +3 1014 1059 1060 +3 1015 1014 1060 +3 1016 1015 1060 +3 1016 1060 1061 +3 1016 1061 1062 +3 1017 1016 1062 +3 1018 1017 1062 +3 1018 1062 1063 +3 1018 1063 1064 +3 1019 1018 1064 +3 1020 1019 1064 +3 1020 1064 1065 +3 1020 1065 1066 +3 1021 1020 1066 +3 1022 1021 1066 +3 1022 1066 1067 +3 1022 1067 1068 +3 1023 1022 1068 +3 1024 1023 1068 +3 1024 1068 1069 +3 1024 1069 1070 +3 1025 1024 1070 +3 1026 1025 1070 +3 1026 1070 1071 +3 1026 1071 1072 +3 1027 1026 1072 +3 1028 1027 1072 +3 1028 1072 1073 +3 1028 1073 1074 +3 1029 1028 1074 +3 1030 1029 1074 +3 1030 1074 1075 +3 1030 1075 1076 +3 1031 1030 1076 +3 1032 1031 1076 +3 1032 1076 1077 +3 1032 1077 1078 +3 1033 1032 1078 +3 1034 1033 1078 +3 1034 1078 1079 +3 1034 1079 1080 +3 1035 1034 1080 +3 1036 1035 1080 +3 1036 1080 1081 +3 1036 1081 1082 +3 1037 1036 1082 +3 1038 1037 1082 +3 1038 1082 1083 +3 1038 1083 1084 +3 1039 1038 1084 +3 1040 1039 1084 +3 1040 1084 1085 +3 1040 1085 1086 +3 1041 1040 1086 +3 1042 1041 1086 +3 1042 1086 1087 +3 1042 1087 1088 +3 1043 1042 1088 +3 1044 1043 1088 +3 1044 1088 1089 +3 1044 1089 1090 +3 1045 1044 1090 +3 1046 1045 1090 +3 1046 1090 1091 +3 1046 1091 1092 +3 1047 1046 1092 +3 1048 1047 1092 +3 1048 1092 1093 +3 1048 1093 1094 +3 1049 1048 1094 +3 1050 1049 1094 +3 1050 1094 1095 +3 1050 1095 1096 +3 1051 1050 1096 +3 1052 1051 1096 +3 1052 1096 1097 +3 1052 1097 827 +3 1053 737 736 +3 1054 1053 736 +3 1054 736 740 +3 1054 740 741 +3 1055 1054 741 +3 1056 1055 741 +3 1056 741 744 +3 1056 744 745 +3 1057 1056 745 +3 1058 1057 745 +3 1058 745 748 +3 1058 748 749 +3 1059 1058 749 +3 1060 1059 749 +3 1060 749 752 +3 1060 752 753 +3 1061 1060 753 +3 1062 1061 753 +3 1062 753 756 +3 1062 756 757 +3 1063 1062 757 +3 1064 1063 757 +3 1064 757 760 +3 1064 760 761 +3 1065 1064 761 +3 1066 1065 761 +3 1066 761 764 +3 1066 764 765 +3 1067 1066 765 +3 1068 1067 765 +3 1068 765 768 +3 1068 768 769 +3 1069 1068 769 +3 1070 1069 769 +3 1070 769 772 +3 1070 772 773 +3 1071 1070 773 +3 1072 1071 773 +3 1072 773 776 +3 1072 776 777 +3 1073 1072 777 +3 1074 1073 777 +3 1074 777 780 +3 1074 780 781 +3 1075 1074 781 +3 1076 1075 781 +3 1076 781 784 +3 1076 784 785 +3 1077 1076 785 +3 1078 1077 785 +3 1078 785 788 +3 1078 788 789 +3 1079 1078 789 +3 1080 1079 789 +3 1080 789 792 +3 1080 792 793 +3 1081 1080 793 +3 1082 1081 793 +3 1082 793 796 +3 1082 796 797 +3 1083 1082 797 +3 1084 1083 797 +3 1084 797 800 +3 1084 800 801 +3 1085 1084 801 +3 1086 1085 801 +3 1086 801 804 +3 1086 804 805 +3 1087 1086 805 +3 1088 1087 805 +3 1088 805 808 +3 1088 808 809 +3 1089 1088 809 +3 1090 1089 809 +3 1090 809 812 +3 1090 812 813 +3 1091 1090 813 +3 1092 1091 813 +3 1092 813 816 +3 1092 816 817 +3 1093 1092 817 +3 1094 1093 817 +3 1094 817 820 +3 1094 820 821 +3 1095 1094 821 +3 1096 1095 821 +3 1096 821 824 +3 1096 824 825 +3 1097 1096 825 +3 827 1097 825 +3 1098 1099 1100 +3 1098 1100 1101 +3 1102 1098 1101 +3 1103 1102 1101 +3 1103 1101 1104 +3 1103 1104 1105 +3 1106 1103 1105 +3 1107 1106 1105 +3 1107 1105 1108 +3 1107 1108 1109 +3 1110 1107 1109 +3 1111 1110 1109 +3 1111 1109 1112 +3 1111 1112 1113 +3 1114 1111 1113 +3 1115 1114 1113 +3 1115 1113 1116 +3 1115 1116 1117 +3 1118 1115 1117 +3 1119 1118 1117 +3 1119 1117 1120 +3 1119 1120 1121 +3 1122 1119 1121 +3 1123 1122 1121 +3 1123 1121 1124 +3 1123 1124 1125 +3 1126 1123 1125 +3 1127 1126 1125 +3 1127 1125 1128 +3 1127 1128 1129 +3 1130 1127 1129 +3 1131 1130 1129 +3 1131 1129 1132 +3 1131 1132 1133 +3 1134 1131 1133 +3 1135 1134 1133 +3 1135 1133 1136 +3 1135 1136 1137 +3 1138 1135 1137 +3 1139 1138 1137 +3 1139 1137 1140 +3 1139 1140 1141 +3 1142 1139 1141 +3 1143 1142 1141 +3 1143 1141 1144 +3 1143 1144 1145 +3 1146 1143 1145 +3 1147 1146 1145 +3 1147 1145 1148 +3 1147 1148 1149 +3 1150 1147 1149 +3 1151 1150 1149 +3 1151 1149 1152 +3 1151 1152 1153 +3 1154 1151 1153 +3 1155 1154 1153 +3 1155 1153 1156 +3 1155 1156 1157 +3 1158 1155 1157 +3 1159 1158 1157 +3 1159 1157 1160 +3 1159 1160 1161 +3 1162 1159 1161 +3 1163 1162 1161 +3 1163 1161 1164 +3 1163 1164 1165 +3 1166 1163 1165 +3 1167 1166 1165 +3 1167 1165 1168 +3 1167 1168 1169 +3 1170 1167 1169 +3 1171 1170 1169 +3 1171 1169 1172 +3 1171 1172 1173 +3 1174 1171 1173 +3 1175 1174 1173 +3 1175 1173 1176 +3 1175 1176 1177 +3 1178 1175 1177 +3 1179 1178 1177 +3 1179 1177 1180 +3 1179 1180 1181 +3 1182 1179 1181 +3 1183 1182 1181 +3 1183 1181 1184 +3 1183 1184 1185 +3 1186 1183 1185 +3 1187 1186 1185 +3 1187 1185 1188 +3 1187 1188 1189 +3 1100 1099 1190 +3 1101 1100 1190 +3 1101 1190 1191 +3 1101 1191 1192 +3 1104 1101 1192 +3 1105 1104 1192 +3 1105 1192 1193 +3 1105 1193 1194 +3 1108 1105 1194 +3 1109 1108 1194 +3 1109 1194 1195 +3 1109 1195 1196 +3 1112 1109 1196 +3 1113 1112 1196 +3 1113 1196 1197 +3 1113 1197 1198 +3 1116 1113 1198 +3 1117 1116 1198 +3 1117 1198 1199 +3 1117 1199 1200 +3 1120 1117 1200 +3 1121 1120 1200 +3 1121 1200 1201 +3 1121 1201 1202 +3 1124 1121 1202 +3 1125 1124 1202 +3 1125 1202 1203 +3 1125 1203 1204 +3 1128 1125 1204 +3 1129 1128 1204 +3 1129 1204 1205 +3 1129 1205 1206 +3 1132 1129 1206 +3 1133 1132 1206 +3 1133 1206 1207 +3 1133 1207 1208 +3 1136 1133 1208 +3 1137 1136 1208 +3 1137 1208 1209 +3 1137 1209 1210 +3 1140 1137 1210 +3 1141 1140 1210 +3 1141 1210 1211 +3 1141 1211 1212 +3 1144 1141 1212 +3 1145 1144 1212 +3 1145 1212 1213 +3 1145 1213 1214 +3 1148 1145 1214 +3 1149 1148 1214 +3 1149 1214 1215 +3 1149 1215 1216 +3 1152 1149 1216 +3 1153 1152 1216 +3 1153 1216 1217 +3 1153 1217 1218 +3 1156 1153 1218 +3 1157 1156 1218 +3 1157 1218 1219 +3 1157 1219 1220 +3 1160 1157 1220 +3 1161 1160 1220 +3 1161 1220 1221 +3 1161 1221 1222 +3 1164 1161 1222 +3 1165 1164 1222 +3 1165 1222 1223 +3 1165 1223 1224 +3 1168 1165 1224 +3 1169 1168 1224 +3 1169 1224 1225 +3 1169 1225 1226 +3 1172 1169 1226 +3 1173 1172 1226 +3 1173 1226 1227 +3 1173 1227 1228 +3 1176 1173 1228 +3 1177 1176 1228 +3 1177 1228 1229 +3 1177 1229 1230 +3 1180 1177 1230 +3 1181 1180 1230 +3 1181 1230 1231 +3 1181 1231 1232 +3 1184 1181 1232 +3 1185 1184 1232 +3 1185 1232 1233 +3 1185 1233 1234 +3 1188 1185 1234 +3 1189 1188 1234 +3 1190 1099 1235 +3 1190 1235 1236 +3 1191 1190 1236 +3 1192 1191 1236 +3 1192 1236 1237 +3 1192 1237 1238 +3 1193 1192 1238 +3 1194 1193 1238 +3 1194 1238 1239 +3 1194 1239 1240 +3 1195 1194 1240 +3 1196 1195 1240 +3 1196 1240 1241 +3 1196 1241 1242 +3 1197 1196 1242 +3 1198 1197 1242 +3 1198 1242 1243 +3 1198 1243 1244 +3 1199 1198 1244 +3 1200 1199 1244 +3 1200 1244 1245 +3 1200 1245 1246 +3 1201 1200 1246 +3 1202 1201 1246 +3 1202 1246 1247 +3 1202 1247 1248 +3 1203 1202 1248 +3 1204 1203 1248 +3 1204 1248 1249 +3 1204 1249 1250 +3 1205 1204 1250 +3 1206 1205 1250 +3 1206 1250 1251 +3 1206 1251 1252 +3 1207 1206 1252 +3 1208 1207 1252 +3 1208 1252 1253 +3 1208 1253 1254 +3 1209 1208 1254 +3 1210 1209 1254 +3 1210 1254 1255 +3 1210 1255 1256 +3 1211 1210 1256 +3 1212 1211 1256 +3 1212 1256 1257 +3 1212 1257 1258 +3 1213 1212 1258 +3 1214 1213 1258 +3 1214 1258 1259 +3 1214 1259 1260 +3 1215 1214 1260 +3 1216 1215 1260 +3 1216 1260 1261 +3 1216 1261 1262 +3 1217 1216 1262 +3 1218 1217 1262 +3 1218 1262 1263 +3 1218 1263 1264 +3 1219 1218 1264 +3 1220 1219 1264 +3 1220 1264 1265 +3 1220 1265 1266 +3 1221 1220 1266 +3 1222 1221 1266 +3 1222 1266 1267 +3 1222 1267 1268 +3 1223 1222 1268 +3 1224 1223 1268 +3 1224 1268 1269 +3 1224 1269 1270 +3 1225 1224 1270 +3 1226 1225 1270 +3 1226 1270 1271 +3 1226 1271 1272 +3 1227 1226 1272 +3 1228 1227 1272 +3 1228 1272 1273 +3 1228 1273 1274 +3 1229 1228 1274 +3 1230 1229 1274 +3 1230 1274 1275 +3 1230 1275 1276 +3 1231 1230 1276 +3 1232 1231 1276 +3 1232 1276 1277 +3 1232 1277 1278 +3 1233 1232 1278 +3 1234 1233 1278 +3 1234 1278 1279 +3 1234 1279 1189 +3 1235 1099 1280 +3 1236 1235 1280 +3 1236 1280 1281 +3 1236 1281 1282 +3 1237 1236 1282 +3 1238 1237 1282 +3 1238 1282 1283 +3 1238 1283 1284 +3 1239 1238 1284 +3 1240 1239 1284 +3 1240 1284 1285 +3 1240 1285 1286 +3 1241 1240 1286 +3 1242 1241 1286 +3 1242 1286 1287 +3 1242 1287 1288 +3 1243 1242 1288 +3 1244 1243 1288 +3 1244 1288 1289 +3 1244 1289 1290 +3 1245 1244 1290 +3 1246 1245 1290 +3 1246 1290 1291 +3 1246 1291 1292 +3 1247 1246 1292 +3 1248 1247 1292 +3 1248 1292 1293 +3 1248 1293 1294 +3 1249 1248 1294 +3 1250 1249 1294 +3 1250 1294 1295 +3 1250 1295 1296 +3 1251 1250 1296 +3 1252 1251 1296 +3 1252 1296 1297 +3 1252 1297 1298 +3 1253 1252 1298 +3 1254 1253 1298 +3 1254 1298 1299 +3 1254 1299 1300 +3 1255 1254 1300 +3 1256 1255 1300 +3 1256 1300 1301 +3 1256 1301 1302 +3 1257 1256 1302 +3 1258 1257 1302 +3 1258 1302 1303 +3 1258 1303 1304 +3 1259 1258 1304 +3 1260 1259 1304 +3 1260 1304 1305 +3 1260 1305 1306 +3 1261 1260 1306 +3 1262 1261 1306 +3 1262 1306 1307 +3 1262 1307 1308 +3 1263 1262 1308 +3 1264 1263 1308 +3 1264 1308 1309 +3 1264 1309 1310 +3 1265 1264 1310 +3 1266 1265 1310 +3 1266 1310 1311 +3 1266 1311 1312 +3 1267 1266 1312 +3 1268 1267 1312 +3 1268 1312 1313 +3 1268 1313 1314 +3 1269 1268 1314 +3 1270 1269 1314 +3 1270 1314 1315 +3 1270 1315 1316 +3 1271 1270 1316 +3 1272 1271 1316 +3 1272 1316 1317 +3 1272 1317 1318 +3 1273 1272 1318 +3 1274 1273 1318 +3 1274 1318 1319 +3 1274 1319 1320 +3 1275 1274 1320 +3 1276 1275 1320 +3 1276 1320 1321 +3 1276 1321 1322 +3 1277 1276 1322 +3 1278 1277 1322 +3 1278 1322 1323 +3 1278 1323 1324 +3 1279 1278 1324 +3 1189 1279 1324 +3 1280 1099 1325 +3 1280 1325 1326 +3 1281 1280 1326 +3 1282 1281 1326 +3 1282 1326 1327 +3 1282 1327 1328 +3 1283 1282 1328 +3 1284 1283 1328 +3 1284 1328 1329 +3 1284 1329 1330 +3 1285 1284 1330 +3 1286 1285 1330 +3 1286 1330 1331 +3 1286 1331 1332 +3 1287 1286 1332 +3 1288 1287 1332 +3 1288 1332 1333 +3 1288 1333 1334 +3 1289 1288 1334 +3 1290 1289 1334 +3 1290 1334 1335 +3 1290 1335 1336 +3 1291 1290 1336 +3 1292 1291 1336 +3 1292 1336 1337 +3 1292 1337 1338 +3 1293 1292 1338 +3 1294 1293 1338 +3 1294 1338 1339 +3 1294 1339 1340 +3 1295 1294 1340 +3 1296 1295 1340 +3 1296 1340 1341 +3 1296 1341 1342 +3 1297 1296 1342 +3 1298 1297 1342 +3 1298 1342 1343 +3 1298 1343 1344 +3 1299 1298 1344 +3 1300 1299 1344 +3 1300 1344 1345 +3 1300 1345 1346 +3 1301 1300 1346 +3 1302 1301 1346 +3 1302 1346 1347 +3 1302 1347 1348 +3 1303 1302 1348 +3 1304 1303 1348 +3 1304 1348 1349 +3 1304 1349 1350 +3 1305 1304 1350 +3 1306 1305 1350 +3 1306 1350 1351 +3 1306 1351 1352 +3 1307 1306 1352 +3 1308 1307 1352 +3 1308 1352 1353 +3 1308 1353 1354 +3 1309 1308 1354 +3 1310 1309 1354 +3 1310 1354 1355 +3 1310 1355 1356 +3 1311 1310 1356 +3 1312 1311 1356 +3 1312 1356 1357 +3 1312 1357 1358 +3 1313 1312 1358 +3 1314 1313 1358 +3 1314 1358 1359 +3 1314 1359 1360 +3 1315 1314 1360 +3 1316 1315 1360 +3 1316 1360 1361 +3 1316 1361 1362 +3 1317 1316 1362 +3 1318 1317 1362 +3 1318 1362 1363 +3 1318 1363 1364 +3 1319 1318 1364 +3 1320 1319 1364 +3 1320 1364 1365 +3 1320 1365 1366 +3 1321 1320 1366 +3 1322 1321 1366 +3 1322 1366 1367 +3 1322 1367 1368 +3 1323 1322 1368 +3 1324 1323 1368 +3 1324 1368 1369 +3 1324 1369 1189 +3 1325 1099 1370 +3 1326 1325 1370 +3 1326 1370 1371 +3 1326 1371 1372 +3 1327 1326 1372 +3 1328 1327 1372 +3 1328 1372 1373 +3 1328 1373 1374 +3 1329 1328 1374 +3 1330 1329 1374 +3 1330 1374 1375 +3 1330 1375 1376 +3 1331 1330 1376 +3 1332 1331 1376 +3 1332 1376 1377 +3 1332 1377 1378 +3 1333 1332 1378 +3 1334 1333 1378 +3 1334 1378 1379 +3 1334 1379 1380 +3 1335 1334 1380 +3 1336 1335 1380 +3 1336 1380 1381 +3 1336 1381 1382 +3 1337 1336 1382 +3 1338 1337 1382 +3 1338 1382 1383 +3 1338 1383 1384 +3 1339 1338 1384 +3 1340 1339 1384 +3 1340 1384 1385 +3 1340 1385 1386 +3 1341 1340 1386 +3 1342 1341 1386 +3 1342 1386 1387 +3 1342 1387 1388 +3 1343 1342 1388 +3 1344 1343 1388 +3 1344 1388 1389 +3 1344 1389 1390 +3 1345 1344 1390 +3 1346 1345 1390 +3 1346 1390 1391 +3 1346 1391 1392 +3 1347 1346 1392 +3 1348 1347 1392 +3 1348 1392 1393 +3 1348 1393 1394 +3 1349 1348 1394 +3 1350 1349 1394 +3 1350 1394 1395 +3 1350 1395 1396 +3 1351 1350 1396 +3 1352 1351 1396 +3 1352 1396 1397 +3 1352 1397 1398 +3 1353 1352 1398 +3 1354 1353 1398 +3 1354 1398 1399 +3 1354 1399 1400 +3 1355 1354 1400 +3 1356 1355 1400 +3 1356 1400 1401 +3 1356 1401 1402 +3 1357 1356 1402 +3 1358 1357 1402 +3 1358 1402 1403 +3 1358 1403 1404 +3 1359 1358 1404 +3 1360 1359 1404 +3 1360 1404 1405 +3 1360 1405 1406 +3 1361 1360 1406 +3 1362 1361 1406 +3 1362 1406 1407 +3 1362 1407 1408 +3 1363 1362 1408 +3 1364 1363 1408 +3 1364 1408 1409 +3 1364 1409 1410 +3 1365 1364 1410 +3 1366 1365 1410 +3 1366 1410 1411 +3 1366 1411 1412 +3 1367 1366 1412 +3 1368 1367 1412 +3 1368 1412 1413 +3 1368 1413 1414 +3 1369 1368 1414 +3 1189 1369 1414 +3 1370 1099 1415 +3 1370 1415 1416 +3 1371 1370 1416 +3 1372 1371 1416 +3 1372 1416 1417 +3 1372 1417 1418 +3 1373 1372 1418 +3 1374 1373 1418 +3 1374 1418 1419 +3 1374 1419 1420 +3 1375 1374 1420 +3 1376 1375 1420 +3 1376 1420 1421 +3 1376 1421 1422 +3 1377 1376 1422 +3 1378 1377 1422 +3 1378 1422 1423 +3 1378 1423 1424 +3 1379 1378 1424 +3 1380 1379 1424 +3 1380 1424 1425 +3 1380 1425 1426 +3 1381 1380 1426 +3 1382 1381 1426 +3 1382 1426 1427 +3 1382 1427 1428 +3 1383 1382 1428 +3 1384 1383 1428 +3 1384 1428 1429 +3 1384 1429 1430 +3 1385 1384 1430 +3 1386 1385 1430 +3 1386 1430 1431 +3 1386 1431 1432 +3 1387 1386 1432 +3 1388 1387 1432 +3 1388 1432 1433 +3 1388 1433 1434 +3 1389 1388 1434 +3 1390 1389 1434 +3 1390 1434 1435 +3 1390 1435 1436 +3 1391 1390 1436 +3 1392 1391 1436 +3 1392 1436 1437 +3 1392 1437 1438 +3 1393 1392 1438 +3 1394 1393 1438 +3 1394 1438 1439 +3 1394 1439 1440 +3 1395 1394 1440 +3 1396 1395 1440 +3 1396 1440 1441 +3 1396 1441 1442 +3 1397 1396 1442 +3 1398 1397 1442 +3 1398 1442 1443 +3 1398 1443 1444 +3 1399 1398 1444 +3 1400 1399 1444 +3 1400 1444 1445 +3 1400 1445 1446 +3 1401 1400 1446 +3 1402 1401 1446 +3 1402 1446 1447 +3 1402 1447 1448 +3 1403 1402 1448 +3 1404 1403 1448 +3 1404 1448 1449 +3 1404 1449 1450 +3 1405 1404 1450 +3 1406 1405 1450 +3 1406 1450 1451 +3 1406 1451 1452 +3 1407 1406 1452 +3 1408 1407 1452 +3 1408 1452 1453 +3 1408 1453 1454 +3 1409 1408 1454 +3 1410 1409 1454 +3 1410 1454 1455 +3 1410 1455 1456 +3 1411 1410 1456 +3 1412 1411 1456 +3 1412 1456 1457 +3 1412 1457 1458 +3 1413 1412 1458 +3 1414 1413 1458 +3 1414 1458 1459 +3 1414 1459 1189 +3 1415 1099 1098 +3 1416 1415 1098 +3 1416 1098 1102 +3 1416 1102 1103 +3 1417 1416 1103 +3 1418 1417 1103 +3 1418 1103 1106 +3 1418 1106 1107 +3 1419 1418 1107 +3 1420 1419 1107 +3 1420 1107 1110 +3 1420 1110 1111 +3 1421 1420 1111 +3 1422 1421 1111 +3 1422 1111 1114 +3 1422 1114 1115 +3 1423 1422 1115 +3 1424 1423 1115 +3 1424 1115 1118 +3 1424 1118 1119 +3 1425 1424 1119 +3 1426 1425 1119 +3 1426 1119 1122 +3 1426 1122 1123 +3 1427 1426 1123 +3 1428 1427 1123 +3 1428 1123 1126 +3 1428 1126 1127 +3 1429 1428 1127 +3 1430 1429 1127 +3 1430 1127 1130 +3 1430 1130 1131 +3 1431 1430 1131 +3 1432 1431 1131 +3 1432 1131 1134 +3 1432 1134 1135 +3 1433 1432 1135 +3 1434 1433 1135 +3 1434 1135 1138 +3 1434 1138 1139 +3 1435 1434 1139 +3 1436 1435 1139 +3 1436 1139 1142 +3 1436 1142 1143 +3 1437 1436 1143 +3 1438 1437 1143 +3 1438 1143 1146 +3 1438 1146 1147 +3 1439 1438 1147 +3 1440 1439 1147 +3 1440 1147 1150 +3 1440 1150 1151 +3 1441 1440 1151 +3 1442 1441 1151 +3 1442 1151 1154 +3 1442 1154 1155 +3 1443 1442 1155 +3 1444 1443 1155 +3 1444 1155 1158 +3 1444 1158 1159 +3 1445 1444 1159 +3 1446 1445 1159 +3 1446 1159 1162 +3 1446 1162 1163 +3 1447 1446 1163 +3 1448 1447 1163 +3 1448 1163 1166 +3 1448 1166 1167 +3 1449 1448 1167 +3 1450 1449 1167 +3 1450 1167 1170 +3 1450 1170 1171 +3 1451 1450 1171 +3 1452 1451 1171 +3 1452 1171 1174 +3 1452 1174 1175 +3 1453 1452 1175 +3 1454 1453 1175 +3 1454 1175 1178 +3 1454 1178 1179 +3 1455 1454 1179 +3 1456 1455 1179 +3 1456 1179 1182 +3 1456 1182 1183 +3 1457 1456 1183 +3 1458 1457 1183 +3 1458 1183 1186 +3 1458 1186 1187 +3 1459 1458 1187 +3 1189 1459 1187 +3 1460 1461 1462 +3 1460 1462 1463 +3 1464 1460 1463 +3 1465 1464 1463 +3 1465 1463 1466 +3 1465 1466 1467 +3 1468 1465 1467 +3 1469 1468 1467 +3 1469 1467 1470 +3 1469 1470 1471 +3 1472 1469 1471 +3 1473 1472 1471 +3 1473 1471 1474 +3 1473 1474 1475 +3 1476 1473 1475 +3 1477 1476 1475 +3 1477 1475 1478 +3 1477 1478 1479 +3 1480 1477 1479 +3 1481 1480 1479 +3 1481 1479 1482 +3 1481 1482 1483 +3 1484 1481 1483 +3 1485 1484 1483 +3 1485 1483 1486 +3 1485 1486 1487 +3 1488 1485 1487 +3 1489 1488 1487 +3 1489 1487 1490 +3 1489 1490 1491 +3 1492 1489 1491 +3 1493 1492 1491 +3 1493 1491 1494 +3 1493 1494 1495 +3 1496 1493 1495 +3 1497 1496 1495 +3 1497 1495 1498 +3 1497 1498 1499 +3 1500 1497 1499 +3 1501 1500 1499 +3 1501 1499 1502 +3 1501 1502 1503 +3 1504 1501 1503 +3 1505 1504 1503 +3 1505 1503 1506 +3 1505 1506 1507 +3 1508 1505 1507 +3 1509 1508 1507 +3 1509 1507 1510 +3 1509 1510 1511 +3 1512 1509 1511 +3 1513 1512 1511 +3 1513 1511 1514 +3 1513 1514 1515 +3 1516 1513 1515 +3 1517 1516 1515 +3 1517 1515 1518 +3 1517 1518 1519 +3 1520 1517 1519 +3 1521 1520 1519 +3 1521 1519 1522 +3 1521 1522 1523 +3 1524 1521 1523 +3 1525 1524 1523 +3 1525 1523 1526 +3 1525 1526 1527 +3 1528 1525 1527 +3 1529 1528 1527 +3 1529 1527 1530 +3 1529 1530 1531 +3 1532 1529 1531 +3 1533 1532 1531 +3 1533 1531 1534 +3 1533 1534 1535 +3 1536 1533 1535 +3 1537 1536 1535 +3 1537 1535 1538 +3 1537 1538 1539 +3 1540 1537 1539 +3 1541 1540 1539 +3 1541 1539 1542 +3 1541 1542 1543 +3 1544 1541 1543 +3 1545 1544 1543 +3 1545 1543 1546 +3 1545 1546 1547 +3 1548 1545 1547 +3 1549 1548 1547 +3 1549 1547 1550 +3 1549 1550 1189 +3 1462 1461 1551 +3 1463 1462 1551 +3 1463 1551 1552 +3 1463 1552 1553 +3 1466 1463 1553 +3 1467 1466 1553 +3 1467 1553 1554 +3 1467 1554 1555 +3 1470 1467 1555 +3 1471 1470 1555 +3 1471 1555 1556 +3 1471 1556 1557 +3 1474 1471 1557 +3 1475 1474 1557 +3 1475 1557 1558 +3 1475 1558 1559 +3 1478 1475 1559 +3 1479 1478 1559 +3 1479 1559 1560 +3 1479 1560 1561 +3 1482 1479 1561 +3 1483 1482 1561 +3 1483 1561 1562 +3 1483 1562 1563 +3 1486 1483 1563 +3 1487 1486 1563 +3 1487 1563 1564 +3 1487 1564 1565 +3 1490 1487 1565 +3 1491 1490 1565 +3 1491 1565 1566 +3 1491 1566 1567 +3 1494 1491 1567 +3 1495 1494 1567 +3 1495 1567 1568 +3 1495 1568 1569 +3 1498 1495 1569 +3 1499 1498 1569 +3 1499 1569 1570 +3 1499 1570 1571 +3 1502 1499 1571 +3 1503 1502 1571 +3 1503 1571 1572 +3 1503 1572 1573 +3 1506 1503 1573 +3 1507 1506 1573 +3 1507 1573 1574 +3 1507 1574 1575 +3 1510 1507 1575 +3 1511 1510 1575 +3 1511 1575 1576 +3 1511 1576 1577 +3 1514 1511 1577 +3 1515 1514 1577 +3 1515 1577 1578 +3 1515 1578 1579 +3 1518 1515 1579 +3 1519 1518 1579 +3 1519 1579 1580 +3 1519 1580 1581 +3 1522 1519 1581 +3 1523 1522 1581 +3 1523 1581 1582 +3 1523 1582 1583 +3 1526 1523 1583 +3 1527 1526 1583 +3 1527 1583 1584 +3 1527 1584 1585 +3 1530 1527 1585 +3 1531 1530 1585 +3 1531 1585 1586 +3 1531 1586 1587 +3 1534 1531 1587 +3 1535 1534 1587 +3 1535 1587 1588 +3 1535 1588 1589 +3 1538 1535 1589 +3 1539 1538 1589 +3 1539 1589 1590 +3 1539 1590 1591 +3 1542 1539 1591 +3 1543 1542 1591 +3 1543 1591 1592 +3 1543 1592 1593 +3 1546 1543 1593 +3 1547 1546 1593 +3 1547 1593 1594 +3 1547 1594 1595 +3 1550 1547 1595 +3 1189 1550 1595 +3 1551 1461 1596 +3 1551 1596 1597 +3 1552 1551 1597 +3 1553 1552 1597 +3 1553 1597 1598 +3 1553 1598 1599 +3 1554 1553 1599 +3 1555 1554 1599 +3 1555 1599 1600 +3 1555 1600 1601 +3 1556 1555 1601 +3 1557 1556 1601 +3 1557 1601 1602 +3 1557 1602 1603 +3 1558 1557 1603 +3 1559 1558 1603 +3 1559 1603 1604 +3 1559 1604 1605 +3 1560 1559 1605 +3 1561 1560 1605 +3 1561 1605 1606 +3 1561 1606 1607 +3 1562 1561 1607 +3 1563 1562 1607 +3 1563 1607 1608 +3 1563 1608 1609 +3 1564 1563 1609 +3 1565 1564 1609 +3 1565 1609 1610 +3 1565 1610 1611 +3 1566 1565 1611 +3 1567 1566 1611 +3 1567 1611 1612 +3 1567 1612 1613 +3 1568 1567 1613 +3 1569 1568 1613 +3 1569 1613 1614 +3 1569 1614 1615 +3 1570 1569 1615 +3 1571 1570 1615 +3 1571 1615 1616 +3 1571 1616 1617 +3 1572 1571 1617 +3 1573 1572 1617 +3 1573 1617 1618 +3 1573 1618 1619 +3 1574 1573 1619 +3 1575 1574 1619 +3 1575 1619 1620 +3 1575 1620 1621 +3 1576 1575 1621 +3 1577 1576 1621 +3 1577 1621 1622 +3 1577 1622 1623 +3 1578 1577 1623 +3 1579 1578 1623 +3 1579 1623 1624 +3 1579 1624 1625 +3 1580 1579 1625 +3 1581 1580 1625 +3 1581 1625 1626 +3 1581 1626 1627 +3 1582 1581 1627 +3 1583 1582 1627 +3 1583 1627 1628 +3 1583 1628 1629 +3 1584 1583 1629 +3 1585 1584 1629 +3 1585 1629 1630 +3 1585 1630 1631 +3 1586 1585 1631 +3 1587 1586 1631 +3 1587 1631 1632 +3 1587 1632 1633 +3 1588 1587 1633 +3 1589 1588 1633 +3 1589 1633 1634 +3 1589 1634 1635 +3 1590 1589 1635 +3 1591 1590 1635 +3 1591 1635 1636 +3 1591 1636 1637 +3 1592 1591 1637 +3 1593 1592 1637 +3 1593 1637 1638 +3 1593 1638 1639 +3 1594 1593 1639 +3 1595 1594 1639 +3 1595 1639 1640 +3 1595 1640 1189 +3 1596 1461 1641 +3 1597 1596 1641 +3 1597 1641 1642 +3 1597 1642 1643 +3 1598 1597 1643 +3 1599 1598 1643 +3 1599 1643 1644 +3 1599 1644 1645 +3 1600 1599 1645 +3 1601 1600 1645 +3 1601 1645 1646 +3 1601 1646 1647 +3 1602 1601 1647 +3 1603 1602 1647 +3 1603 1647 1648 +3 1603 1648 1649 +3 1604 1603 1649 +3 1605 1604 1649 +3 1605 1649 1650 +3 1605 1650 1651 +3 1606 1605 1651 +3 1607 1606 1651 +3 1607 1651 1652 +3 1607 1652 1653 +3 1608 1607 1653 +3 1609 1608 1653 +3 1609 1653 1654 +3 1609 1654 1655 +3 1610 1609 1655 +3 1611 1610 1655 +3 1611 1655 1656 +3 1611 1656 1657 +3 1612 1611 1657 +3 1613 1612 1657 +3 1613 1657 1658 +3 1613 1658 1659 +3 1614 1613 1659 +3 1615 1614 1659 +3 1615 1659 1660 +3 1615 1660 1661 +3 1616 1615 1661 +3 1617 1616 1661 +3 1617 1661 1662 +3 1617 1662 1663 +3 1618 1617 1663 +3 1619 1618 1663 +3 1619 1663 1664 +3 1619 1664 1665 +3 1620 1619 1665 +3 1621 1620 1665 +3 1621 1665 1666 +3 1621 1666 1667 +3 1622 1621 1667 +3 1623 1622 1667 +3 1623 1667 1668 +3 1623 1668 1669 +3 1624 1623 1669 +3 1625 1624 1669 +3 1625 1669 1670 +3 1625 1670 1671 +3 1626 1625 1671 +3 1627 1626 1671 +3 1627 1671 1672 +3 1627 1672 1673 +3 1628 1627 1673 +3 1629 1628 1673 +3 1629 1673 1674 +3 1629 1674 1675 +3 1630 1629 1675 +3 1631 1630 1675 +3 1631 1675 1676 +3 1631 1676 1677 +3 1632 1631 1677 +3 1633 1632 1677 +3 1633 1677 1678 +3 1633 1678 1679 +3 1634 1633 1679 +3 1635 1634 1679 +3 1635 1679 1680 +3 1635 1680 1681 +3 1636 1635 1681 +3 1637 1636 1681 +3 1637 1681 1682 +3 1637 1682 1683 +3 1638 1637 1683 +3 1639 1638 1683 +3 1639 1683 1684 +3 1639 1684 1685 +3 1640 1639 1685 +3 1189 1640 1685 +3 1641 1461 1686 +3 1641 1686 1687 +3 1642 1641 1687 +3 1643 1642 1687 +3 1643 1687 1688 +3 1643 1688 1689 +3 1644 1643 1689 +3 1645 1644 1689 +3 1645 1689 1690 +3 1645 1690 1691 +3 1646 1645 1691 +3 1647 1646 1691 +3 1647 1691 1692 +3 1647 1692 1693 +3 1648 1647 1693 +3 1649 1648 1693 +3 1649 1693 1694 +3 1649 1694 1695 +3 1650 1649 1695 +3 1651 1650 1695 +3 1651 1695 1696 +3 1651 1696 1697 +3 1652 1651 1697 +3 1653 1652 1697 +3 1653 1697 1698 +3 1653 1698 1699 +3 1654 1653 1699 +3 1655 1654 1699 +3 1655 1699 1700 +3 1655 1700 1701 +3 1656 1655 1701 +3 1657 1656 1701 +3 1657 1701 1702 +3 1657 1702 1703 +3 1658 1657 1703 +3 1659 1658 1703 +3 1659 1703 1704 +3 1659 1704 1705 +3 1660 1659 1705 +3 1661 1660 1705 +3 1661 1705 1706 +3 1661 1706 1707 +3 1662 1661 1707 +3 1663 1662 1707 +3 1663 1707 1708 +3 1663 1708 1709 +3 1664 1663 1709 +3 1665 1664 1709 +3 1665 1709 1710 +3 1665 1710 1711 +3 1666 1665 1711 +3 1667 1666 1711 +3 1667 1711 1712 +3 1667 1712 1713 +3 1668 1667 1713 +3 1669 1668 1713 +3 1669 1713 1714 +3 1669 1714 1715 +3 1670 1669 1715 +3 1671 1670 1715 +3 1671 1715 1716 +3 1671 1716 1717 +3 1672 1671 1717 +3 1673 1672 1717 +3 1673 1717 1718 +3 1673 1718 1719 +3 1674 1673 1719 +3 1675 1674 1719 +3 1675 1719 1720 +3 1675 1720 1721 +3 1676 1675 1721 +3 1677 1676 1721 +3 1677 1721 1722 +3 1677 1722 1723 +3 1678 1677 1723 +3 1679 1678 1723 +3 1679 1723 1724 +3 1679 1724 1725 +3 1680 1679 1725 +3 1681 1680 1725 +3 1681 1725 1726 +3 1681 1726 1727 +3 1682 1681 1727 +3 1683 1682 1727 +3 1683 1727 1728 +3 1683 1728 1729 +3 1684 1683 1729 +3 1685 1684 1729 +3 1685 1729 1730 +3 1685 1730 1189 +3 1686 1461 1731 +3 1687 1686 1731 +3 1687 1731 1732 +3 1687 1732 1733 +3 1688 1687 1733 +3 1689 1688 1733 +3 1689 1733 1734 +3 1689 1734 1735 +3 1690 1689 1735 +3 1691 1690 1735 +3 1691 1735 1736 +3 1691 1736 1737 +3 1692 1691 1737 +3 1693 1692 1737 +3 1693 1737 1738 +3 1693 1738 1739 +3 1694 1693 1739 +3 1695 1694 1739 +3 1695 1739 1740 +3 1695 1740 1741 +3 1696 1695 1741 +3 1697 1696 1741 +3 1697 1741 1742 +3 1697 1742 1743 +3 1698 1697 1743 +3 1699 1698 1743 +3 1699 1743 1744 +3 1699 1744 1745 +3 1700 1699 1745 +3 1701 1700 1745 +3 1701 1745 1746 +3 1701 1746 1747 +3 1702 1701 1747 +3 1703 1702 1747 +3 1703 1747 1748 +3 1703 1748 1749 +3 1704 1703 1749 +3 1705 1704 1749 +3 1705 1749 1750 +3 1705 1750 1751 +3 1706 1705 1751 +3 1707 1706 1751 +3 1707 1751 1752 +3 1707 1752 1753 +3 1708 1707 1753 +3 1709 1708 1753 +3 1709 1753 1754 +3 1709 1754 1755 +3 1710 1709 1755 +3 1711 1710 1755 +3 1711 1755 1756 +3 1711 1756 1757 +3 1712 1711 1757 +3 1713 1712 1757 +3 1713 1757 1758 +3 1713 1758 1759 +3 1714 1713 1759 +3 1715 1714 1759 +3 1715 1759 1760 +3 1715 1760 1761 +3 1716 1715 1761 +3 1717 1716 1761 +3 1717 1761 1762 +3 1717 1762 1763 +3 1718 1717 1763 +3 1719 1718 1763 +3 1719 1763 1764 +3 1719 1764 1765 +3 1720 1719 1765 +3 1721 1720 1765 +3 1721 1765 1766 +3 1721 1766 1767 +3 1722 1721 1767 +3 1723 1722 1767 +3 1723 1767 1768 +3 1723 1768 1769 +3 1724 1723 1769 +3 1725 1724 1769 +3 1725 1769 1770 +3 1725 1770 1771 +3 1726 1725 1771 +3 1727 1726 1771 +3 1727 1771 1772 +3 1727 1772 1773 +3 1728 1727 1773 +3 1729 1728 1773 +3 1729 1773 1774 +3 1729 1774 1775 +3 1730 1729 1775 +3 1189 1730 1775 +3 1731 1461 1776 +3 1731 1776 1777 +3 1732 1731 1777 +3 1733 1732 1777 +3 1733 1777 1778 +3 1733 1778 1779 +3 1734 1733 1779 +3 1735 1734 1779 +3 1735 1779 1780 +3 1735 1780 1781 +3 1736 1735 1781 +3 1737 1736 1781 +3 1737 1781 1782 +3 1737 1782 1783 +3 1738 1737 1783 +3 1739 1738 1783 +3 1739 1783 1784 +3 1739 1784 1785 +3 1740 1739 1785 +3 1741 1740 1785 +3 1741 1785 1786 +3 1741 1786 1787 +3 1742 1741 1787 +3 1743 1742 1787 +3 1743 1787 1788 +3 1743 1788 1789 +3 1744 1743 1789 +3 1745 1744 1789 +3 1745 1789 1790 +3 1745 1790 1791 +3 1746 1745 1791 +3 1747 1746 1791 +3 1747 1791 1792 +3 1747 1792 1793 +3 1748 1747 1793 +3 1749 1748 1793 +3 1749 1793 1794 +3 1749 1794 1795 +3 1750 1749 1795 +3 1751 1750 1795 +3 1751 1795 1796 +3 1751 1796 1797 +3 1752 1751 1797 +3 1753 1752 1797 +3 1753 1797 1798 +3 1753 1798 1799 +3 1754 1753 1799 +3 1755 1754 1799 +3 1755 1799 1800 +3 1755 1800 1801 +3 1756 1755 1801 +3 1757 1756 1801 +3 1757 1801 1802 +3 1757 1802 1803 +3 1758 1757 1803 +3 1759 1758 1803 +3 1759 1803 1804 +3 1759 1804 1805 +3 1760 1759 1805 +3 1761 1760 1805 +3 1761 1805 1806 +3 1761 1806 1807 +3 1762 1761 1807 +3 1763 1762 1807 +3 1763 1807 1808 +3 1763 1808 1809 +3 1764 1763 1809 +3 1765 1764 1809 +3 1765 1809 1810 +3 1765 1810 1811 +3 1766 1765 1811 +3 1767 1766 1811 +3 1767 1811 1812 +3 1767 1812 1813 +3 1768 1767 1813 +3 1769 1768 1813 +3 1769 1813 1814 +3 1769 1814 1815 +3 1770 1769 1815 +3 1771 1770 1815 +3 1771 1815 1816 +3 1771 1816 1817 +3 1772 1771 1817 +3 1773 1772 1817 +3 1773 1817 1818 +3 1773 1818 1819 +3 1774 1773 1819 +3 1775 1774 1819 +3 1775 1819 1820 +3 1775 1820 1189 +3 1776 1461 1460 +3 1777 1776 1460 +3 1777 1460 1464 +3 1777 1464 1465 +3 1778 1777 1465 +3 1779 1778 1465 +3 1779 1465 1468 +3 1779 1468 1469 +3 1780 1779 1469 +3 1781 1780 1469 +3 1781 1469 1472 +3 1781 1472 1473 +3 1782 1781 1473 +3 1783 1782 1473 +3 1783 1473 1476 +3 1783 1476 1477 +3 1784 1783 1477 +3 1785 1784 1477 +3 1785 1477 1480 +3 1785 1480 1481 +3 1786 1785 1481 +3 1787 1786 1481 +3 1787 1481 1484 +3 1787 1484 1485 +3 1788 1787 1485 +3 1789 1788 1485 +3 1789 1485 1488 +3 1789 1488 1489 +3 1790 1789 1489 +3 1791 1790 1489 +3 1791 1489 1492 +3 1791 1492 1493 +3 1792 1791 1493 +3 1793 1792 1493 +3 1793 1493 1496 +3 1793 1496 1497 +3 1794 1793 1497 +3 1795 1794 1497 +3 1795 1497 1500 +3 1795 1500 1501 +3 1796 1795 1501 +3 1797 1796 1501 +3 1797 1501 1504 +3 1797 1504 1505 +3 1798 1797 1505 +3 1799 1798 1505 +3 1799 1505 1508 +3 1799 1508 1509 +3 1800 1799 1509 +3 1801 1800 1509 +3 1801 1509 1512 +3 1801 1512 1513 +3 1802 1801 1513 +3 1803 1802 1513 +3 1803 1513 1516 +3 1803 1516 1517 +3 1804 1803 1517 +3 1805 1804 1517 +3 1805 1517 1520 +3 1805 1520 1521 +3 1806 1805 1521 +3 1807 1806 1521 +3 1807 1521 1524 +3 1807 1524 1525 +3 1808 1807 1525 +3 1809 1808 1525 +3 1809 1525 1528 +3 1809 1528 1529 +3 1810 1809 1529 +3 1811 1810 1529 +3 1811 1529 1532 +3 1811 1532 1533 +3 1812 1811 1533 +3 1813 1812 1533 +3 1813 1533 1536 +3 1813 1536 1537 +3 1814 1813 1537 +3 1815 1814 1537 +3 1815 1537 1540 +3 1815 1540 1541 +3 1816 1815 1541 +3 1817 1816 1541 +3 1817 1541 1544 +3 1817 1544 1545 +3 1818 1817 1545 +3 1819 1818 1545 +3 1819 1545 1548 +3 1819 1548 1549 +3 1820 1819 1549 +3 1189 1820 1549 +3 1821 1822 1823 +3 1821 1823 1824 +3 1825 1821 1824 +3 1826 1825 1824 +3 1826 1824 1827 +3 1826 1827 1828 +3 1829 1826 1828 +3 1830 1829 1828 +3 1830 1828 1831 +3 1830 1831 1832 +3 1833 1830 1832 +3 1834 1833 1832 +3 1834 1832 1835 +3 1834 1835 1836 +3 1837 1834 1836 +3 1838 1837 1836 +3 1838 1836 1839 +3 1838 1839 1840 +3 1841 1838 1840 +3 1842 1841 1840 +3 1842 1840 1843 +3 1842 1843 1844 +3 1845 1842 1844 +3 1846 1845 1844 +3 1846 1844 1847 +3 1846 1847 1848 +3 1849 1846 1848 +3 1850 1849 1848 +3 1850 1848 1851 +3 1850 1851 1852 +3 1853 1850 1852 +3 1854 1853 1852 +3 1854 1852 1855 +3 1854 1855 1856 +3 1857 1854 1856 +3 1858 1857 1856 +3 1858 1856 1859 +3 1858 1859 1860 +3 1861 1858 1860 +3 1862 1861 1860 +3 1862 1860 1863 +3 1862 1863 1864 +3 1865 1862 1864 +3 1866 1865 1864 +3 1866 1864 1867 +3 1866 1867 1868 +3 1869 1866 1868 +3 1870 1869 1868 +3 1870 1868 1871 +3 1870 1871 1872 +3 1873 1870 1872 +3 1874 1873 1872 +3 1874 1872 1875 +3 1874 1875 1876 +3 1877 1874 1876 +3 1878 1877 1876 +3 1878 1876 1879 +3 1878 1879 1880 +3 1881 1878 1880 +3 1882 1881 1880 +3 1882 1880 1883 +3 1882 1883 1884 +3 1885 1882 1884 +3 1886 1885 1884 +3 1886 1884 1887 +3 1886 1887 1888 +3 1889 1886 1888 +3 1890 1889 1888 +3 1890 1888 1891 +3 1890 1891 1892 +3 1893 1890 1892 +3 1894 1893 1892 +3 1894 1892 1895 +3 1894 1895 1896 +3 1897 1894 1896 +3 1898 1897 1896 +3 1898 1896 1899 +3 1898 1899 1900 +3 1901 1898 1900 +3 1902 1901 1900 +3 1902 1900 1903 +3 1902 1903 1904 +3 1905 1902 1904 +3 1906 1905 1904 +3 1906 1904 1907 +3 1906 1907 1908 +3 1909 1906 1908 +3 1910 1909 1908 +3 1910 1908 1911 +3 1910 1911 1912 +3 1823 1822 1913 +3 1824 1823 1913 +3 1824 1913 1914 +3 1824 1914 1915 +3 1827 1824 1915 +3 1828 1827 1915 +3 1828 1915 1916 +3 1828 1916 1917 +3 1831 1828 1917 +3 1832 1831 1917 +3 1832 1917 1918 +3 1832 1918 1919 +3 1835 1832 1919 +3 1836 1835 1919 +3 1836 1919 1920 +3 1836 1920 1921 +3 1839 1836 1921 +3 1840 1839 1921 +3 1840 1921 1922 +3 1840 1922 1923 +3 1843 1840 1923 +3 1844 1843 1923 +3 1844 1923 1924 +3 1844 1924 1925 +3 1847 1844 1925 +3 1848 1847 1925 +3 1848 1925 1926 +3 1848 1926 1927 +3 1851 1848 1927 +3 1852 1851 1927 +3 1852 1927 1928 +3 1852 1928 1929 +3 1855 1852 1929 +3 1856 1855 1929 +3 1856 1929 1930 +3 1856 1930 1931 +3 1859 1856 1931 +3 1860 1859 1931 +3 1860 1931 1932 +3 1860 1932 1933 +3 1863 1860 1933 +3 1864 1863 1933 +3 1864 1933 1934 +3 1864 1934 1935 +3 1867 1864 1935 +3 1868 1867 1935 +3 1868 1935 1936 +3 1868 1936 1937 +3 1871 1868 1937 +3 1872 1871 1937 +3 1872 1937 1938 +3 1872 1938 1939 +3 1875 1872 1939 +3 1876 1875 1939 +3 1876 1939 1940 +3 1876 1940 1941 +3 1879 1876 1941 +3 1880 1879 1941 +3 1880 1941 1942 +3 1880 1942 1943 +3 1883 1880 1943 +3 1884 1883 1943 +3 1884 1943 1944 +3 1884 1944 1945 +3 1887 1884 1945 +3 1888 1887 1945 +3 1888 1945 1946 +3 1888 1946 1947 +3 1891 1888 1947 +3 1892 1891 1947 +3 1892 1947 1948 +3 1892 1948 1949 +3 1895 1892 1949 +3 1896 1895 1949 +3 1896 1949 1950 +3 1896 1950 1951 +3 1899 1896 1951 +3 1900 1899 1951 +3 1900 1951 1952 +3 1900 1952 1953 +3 1903 1900 1953 +3 1904 1903 1953 +3 1904 1953 1954 +3 1904 1954 1955 +3 1907 1904 1955 +3 1908 1907 1955 +3 1908 1955 1956 +3 1908 1956 1957 +3 1911 1908 1957 +3 1912 1911 1957 +3 1913 1822 1958 +3 1913 1958 1959 +3 1914 1913 1959 +3 1915 1914 1959 +3 1915 1959 1960 +3 1915 1960 1961 +3 1916 1915 1961 +3 1917 1916 1961 +3 1917 1961 1962 +3 1917 1962 1963 +3 1918 1917 1963 +3 1919 1918 1963 +3 1919 1963 1964 +3 1919 1964 1965 +3 1920 1919 1965 +3 1921 1920 1965 +3 1921 1965 1966 +3 1921 1966 1967 +3 1922 1921 1967 +3 1923 1922 1967 +3 1923 1967 1968 +3 1923 1968 1969 +3 1924 1923 1969 +3 1925 1924 1969 +3 1925 1969 1970 +3 1925 1970 1971 +3 1926 1925 1971 +3 1927 1926 1971 +3 1927 1971 1972 +3 1927 1972 1973 +3 1928 1927 1973 +3 1929 1928 1973 +3 1929 1973 1974 +3 1929 1974 1975 +3 1930 1929 1975 +3 1931 1930 1975 +3 1931 1975 1976 +3 1931 1976 1977 +3 1932 1931 1977 +3 1933 1932 1977 +3 1933 1977 1978 +3 1933 1978 1979 +3 1934 1933 1979 +3 1935 1934 1979 +3 1935 1979 1980 +3 1935 1980 1981 +3 1936 1935 1981 +3 1937 1936 1981 +3 1937 1981 1982 +3 1937 1982 1983 +3 1938 1937 1983 +3 1939 1938 1983 +3 1939 1983 1984 +3 1939 1984 1985 +3 1940 1939 1985 +3 1941 1940 1985 +3 1941 1985 1986 +3 1941 1986 1987 +3 1942 1941 1987 +3 1943 1942 1987 +3 1943 1987 1988 +3 1943 1988 1989 +3 1944 1943 1989 +3 1945 1944 1989 +3 1945 1989 1990 +3 1945 1990 1991 +3 1946 1945 1991 +3 1947 1946 1991 +3 1947 1991 1992 +3 1947 1992 1993 +3 1948 1947 1993 +3 1949 1948 1993 +3 1949 1993 1994 +3 1949 1994 1995 +3 1950 1949 1995 +3 1951 1950 1995 +3 1951 1995 1996 +3 1951 1996 1997 +3 1952 1951 1997 +3 1953 1952 1997 +3 1953 1997 1998 +3 1953 1998 1999 +3 1954 1953 1999 +3 1955 1954 1999 +3 1955 1999 2000 +3 1955 2000 2001 +3 1956 1955 2001 +3 1957 1956 2001 +3 1957 2001 2002 +3 1957 2002 1912 +3 1958 1822 2003 +3 1959 1958 2003 +3 1959 2003 2004 +3 1959 2004 2005 +3 1960 1959 2005 +3 1961 1960 2005 +3 1961 2005 2006 +3 1961 2006 2007 +3 1962 1961 2007 +3 1963 1962 2007 +3 1963 2007 2008 +3 1963 2008 2009 +3 1964 1963 2009 +3 1965 1964 2009 +3 1965 2009 2010 +3 1965 2010 2011 +3 1966 1965 2011 +3 1967 1966 2011 +3 1967 2011 2012 +3 1967 2012 2013 +3 1968 1967 2013 +3 1969 1968 2013 +3 1969 2013 2014 +3 1969 2014 2015 +3 1970 1969 2015 +3 1971 1970 2015 +3 1971 2015 2016 +3 1971 2016 2017 +3 1972 1971 2017 +3 1973 1972 2017 +3 1973 2017 2018 +3 1973 2018 2019 +3 1974 1973 2019 +3 1975 1974 2019 +3 1975 2019 2020 +3 1975 2020 2021 +3 1976 1975 2021 +3 1977 1976 2021 +3 1977 2021 2022 +3 1977 2022 2023 +3 1978 1977 2023 +3 1979 1978 2023 +3 1979 2023 2024 +3 1979 2024 2025 +3 1980 1979 2025 +3 1981 1980 2025 +3 1981 2025 2026 +3 1981 2026 2027 +3 1982 1981 2027 +3 1983 1982 2027 +3 1983 2027 2028 +3 1983 2028 2029 +3 1984 1983 2029 +3 1985 1984 2029 +3 1985 2029 2030 +3 1985 2030 2031 +3 1986 1985 2031 +3 1987 1986 2031 +3 1987 2031 2032 +3 1987 2032 2033 +3 1988 1987 2033 +3 1989 1988 2033 +3 1989 2033 2034 +3 1989 2034 2035 +3 1990 1989 2035 +3 1991 1990 2035 +3 1991 2035 2036 +3 1991 2036 2037 +3 1992 1991 2037 +3 1993 1992 2037 +3 1993 2037 2038 +3 1993 2038 2039 +3 1994 1993 2039 +3 1995 1994 2039 +3 1995 2039 2040 +3 1995 2040 2041 +3 1996 1995 2041 +3 1997 1996 2041 +3 1997 2041 2042 +3 1997 2042 2043 +3 1998 1997 2043 +3 1999 1998 2043 +3 1999 2043 2044 +3 1999 2044 2045 +3 2000 1999 2045 +3 2001 2000 2045 +3 2001 2045 2046 +3 2001 2046 2047 +3 2002 2001 2047 +3 1912 2002 2047 +3 2003 1822 2048 +3 2003 2048 2049 +3 2004 2003 2049 +3 2005 2004 2049 +3 2005 2049 2050 +3 2005 2050 2051 +3 2006 2005 2051 +3 2007 2006 2051 +3 2007 2051 2052 +3 2007 2052 2053 +3 2008 2007 2053 +3 2009 2008 2053 +3 2009 2053 2054 +3 2009 2054 2055 +3 2010 2009 2055 +3 2011 2010 2055 +3 2011 2055 2056 +3 2011 2056 2057 +3 2012 2011 2057 +3 2013 2012 2057 +3 2013 2057 2058 +3 2013 2058 2059 +3 2014 2013 2059 +3 2015 2014 2059 +3 2015 2059 2060 +3 2015 2060 2061 +3 2016 2015 2061 +3 2017 2016 2061 +3 2017 2061 2062 +3 2017 2062 2063 +3 2018 2017 2063 +3 2019 2018 2063 +3 2019 2063 2064 +3 2019 2064 2065 +3 2020 2019 2065 +3 2021 2020 2065 +3 2021 2065 2066 +3 2021 2066 2067 +3 2022 2021 2067 +3 2023 2022 2067 +3 2023 2067 2068 +3 2023 2068 2069 +3 2024 2023 2069 +3 2025 2024 2069 +3 2025 2069 2070 +3 2025 2070 2071 +3 2026 2025 2071 +3 2027 2026 2071 +3 2027 2071 2072 +3 2027 2072 2073 +3 2028 2027 2073 +3 2029 2028 2073 +3 2029 2073 2074 +3 2029 2074 2075 +3 2030 2029 2075 +3 2031 2030 2075 +3 2031 2075 2076 +3 2031 2076 2077 +3 2032 2031 2077 +3 2033 2032 2077 +3 2033 2077 2078 +3 2033 2078 2079 +3 2034 2033 2079 +3 2035 2034 2079 +3 2035 2079 2080 +3 2035 2080 2081 +3 2036 2035 2081 +3 2037 2036 2081 +3 2037 2081 2082 +3 2037 2082 2083 +3 2038 2037 2083 +3 2039 2038 2083 +3 2039 2083 2084 +3 2039 2084 2085 +3 2040 2039 2085 +3 2041 2040 2085 +3 2041 2085 2086 +3 2041 2086 2087 +3 2042 2041 2087 +3 2043 2042 2087 +3 2043 2087 2088 +3 2043 2088 2089 +3 2044 2043 2089 +3 2045 2044 2089 +3 2045 2089 2090 +3 2045 2090 2091 +3 2046 2045 2091 +3 2047 2046 2091 +3 2047 2091 2092 +3 2047 2092 1912 +3 2048 1822 2093 +3 2049 2048 2093 +3 2049 2093 2094 +3 2049 2094 2095 +3 2050 2049 2095 +3 2051 2050 2095 +3 2051 2095 2096 +3 2051 2096 2097 +3 2052 2051 2097 +3 2053 2052 2097 +3 2053 2097 2098 +3 2053 2098 2099 +3 2054 2053 2099 +3 2055 2054 2099 +3 2055 2099 2100 +3 2055 2100 2101 +3 2056 2055 2101 +3 2057 2056 2101 +3 2057 2101 2102 +3 2057 2102 2103 +3 2058 2057 2103 +3 2059 2058 2103 +3 2059 2103 2104 +3 2059 2104 2105 +3 2060 2059 2105 +3 2061 2060 2105 +3 2061 2105 2106 +3 2061 2106 2107 +3 2062 2061 2107 +3 2063 2062 2107 +3 2063 2107 2108 +3 2063 2108 2109 +3 2064 2063 2109 +3 2065 2064 2109 +3 2065 2109 2110 +3 2065 2110 2111 +3 2066 2065 2111 +3 2067 2066 2111 +3 2067 2111 2112 +3 2067 2112 2113 +3 2068 2067 2113 +3 2069 2068 2113 +3 2069 2113 2114 +3 2069 2114 2115 +3 2070 2069 2115 +3 2071 2070 2115 +3 2071 2115 2116 +3 2071 2116 2117 +3 2072 2071 2117 +3 2073 2072 2117 +3 2073 2117 2118 +3 2073 2118 2119 +3 2074 2073 2119 +3 2075 2074 2119 +3 2075 2119 2120 +3 2075 2120 2121 +3 2076 2075 2121 +3 2077 2076 2121 +3 2077 2121 2122 +3 2077 2122 2123 +3 2078 2077 2123 +3 2079 2078 2123 +3 2079 2123 2124 +3 2079 2124 2125 +3 2080 2079 2125 +3 2081 2080 2125 +3 2081 2125 2126 +3 2081 2126 2127 +3 2082 2081 2127 +3 2083 2082 2127 +3 2083 2127 2128 +3 2083 2128 2129 +3 2084 2083 2129 +3 2085 2084 2129 +3 2085 2129 2130 +3 2085 2130 2131 +3 2086 2085 2131 +3 2087 2086 2131 +3 2087 2131 2132 +3 2087 2132 2133 +3 2088 2087 2133 +3 2089 2088 2133 +3 2089 2133 2134 +3 2089 2134 2135 +3 2090 2089 2135 +3 2091 2090 2135 +3 2091 2135 2136 +3 2091 2136 2137 +3 2092 2091 2137 +3 1912 2092 2137 +3 2093 1822 2138 +3 2093 2138 2139 +3 2094 2093 2139 +3 2095 2094 2139 +3 2095 2139 2140 +3 2095 2140 2141 +3 2096 2095 2141 +3 2097 2096 2141 +3 2097 2141 2142 +3 2097 2142 2143 +3 2098 2097 2143 +3 2099 2098 2143 +3 2099 2143 2144 +3 2099 2144 2145 +3 2100 2099 2145 +3 2101 2100 2145 +3 2101 2145 2146 +3 2101 2146 2147 +3 2102 2101 2147 +3 2103 2102 2147 +3 2103 2147 2148 +3 2103 2148 2149 +3 2104 2103 2149 +3 2105 2104 2149 +3 2105 2149 2150 +3 2105 2150 2151 +3 2106 2105 2151 +3 2107 2106 2151 +3 2107 2151 2152 +3 2107 2152 2153 +3 2108 2107 2153 +3 2109 2108 2153 +3 2109 2153 2154 +3 2109 2154 2155 +3 2110 2109 2155 +3 2111 2110 2155 +3 2111 2155 2156 +3 2111 2156 2157 +3 2112 2111 2157 +3 2113 2112 2157 +3 2113 2157 2158 +3 2113 2158 2159 +3 2114 2113 2159 +3 2115 2114 2159 +3 2115 2159 2160 +3 2115 2160 2161 +3 2116 2115 2161 +3 2117 2116 2161 +3 2117 2161 2162 +3 2117 2162 2163 +3 2118 2117 2163 +3 2119 2118 2163 +3 2119 2163 2164 +3 2119 2164 2165 +3 2120 2119 2165 +3 2121 2120 2165 +3 2121 2165 2166 +3 2121 2166 2167 +3 2122 2121 2167 +3 2123 2122 2167 +3 2123 2167 2168 +3 2123 2168 2169 +3 2124 2123 2169 +3 2125 2124 2169 +3 2125 2169 2170 +3 2125 2170 2171 +3 2126 2125 2171 +3 2127 2126 2171 +3 2127 2171 2172 +3 2127 2172 2173 +3 2128 2127 2173 +3 2129 2128 2173 +3 2129 2173 2174 +3 2129 2174 2175 +3 2130 2129 2175 +3 2131 2130 2175 +3 2131 2175 2176 +3 2131 2176 2177 +3 2132 2131 2177 +3 2133 2132 2177 +3 2133 2177 2178 +3 2133 2178 2179 +3 2134 2133 2179 +3 2135 2134 2179 +3 2135 2179 2180 +3 2135 2180 2181 +3 2136 2135 2181 +3 2137 2136 2181 +3 2137 2181 2182 +3 2137 2182 1912 +3 2138 1822 1821 +3 2139 2138 1821 +3 2139 1821 1825 +3 2139 1825 1826 +3 2140 2139 1826 +3 2141 2140 1826 +3 2141 1826 1829 +3 2141 1829 1830 +3 2142 2141 1830 +3 2143 2142 1830 +3 2143 1830 1833 +3 2143 1833 1834 +3 2144 2143 1834 +3 2145 2144 1834 +3 2145 1834 1837 +3 2145 1837 1838 +3 2146 2145 1838 +3 2147 2146 1838 +3 2147 1838 1841 +3 2147 1841 1842 +3 2148 2147 1842 +3 2149 2148 1842 +3 2149 1842 1845 +3 2149 1845 1846 +3 2150 2149 1846 +3 2151 2150 1846 +3 2151 1846 1849 +3 2151 1849 1850 +3 2152 2151 1850 +3 2153 2152 1850 +3 2153 1850 1853 +3 2153 1853 1854 +3 2154 2153 1854 +3 2155 2154 1854 +3 2155 1854 1857 +3 2155 1857 1858 +3 2156 2155 1858 +3 2157 2156 1858 +3 2157 1858 1861 +3 2157 1861 1862 +3 2158 2157 1862 +3 2159 2158 1862 +3 2159 1862 1865 +3 2159 1865 1866 +3 2160 2159 1866 +3 2161 2160 1866 +3 2161 1866 1869 +3 2161 1869 1870 +3 2162 2161 1870 +3 2163 2162 1870 +3 2163 1870 1873 +3 2163 1873 1874 +3 2164 2163 1874 +3 2165 2164 1874 +3 2165 1874 1877 +3 2165 1877 1878 +3 2166 2165 1878 +3 2167 2166 1878 +3 2167 1878 1881 +3 2167 1881 1882 +3 2168 2167 1882 +3 2169 2168 1882 +3 2169 1882 1885 +3 2169 1885 1886 +3 2170 2169 1886 +3 2171 2170 1886 +3 2171 1886 1889 +3 2171 1889 1890 +3 2172 2171 1890 +3 2173 2172 1890 +3 2173 1890 1893 +3 2173 1893 1894 +3 2174 2173 1894 +3 2175 2174 1894 +3 2175 1894 1897 +3 2175 1897 1898 +3 2176 2175 1898 +3 2177 2176 1898 +3 2177 1898 1901 +3 2177 1901 1902 +3 2178 2177 1902 +3 2179 2178 1902 +3 2179 1902 1905 +3 2179 1905 1906 +3 2180 2179 1906 +3 2181 2180 1906 +3 2181 1906 1909 +3 2181 1909 1910 +3 2182 2181 1910 +3 1912 2182 1910 +3 2183 2184 2185 +3 2183 2185 2186 +3 2187 2183 2186 +3 2188 2187 2186 +3 2188 2186 2189 +3 2188 2189 2190 +3 2191 2188 2190 +3 2192 2191 2190 +3 2192 2190 2193 +3 2192 2193 2194 +3 2195 2192 2194 +3 2196 2195 2194 +3 2196 2194 2197 +3 2196 2197 2198 +3 2199 2196 2198 +3 2200 2199 2198 +3 2200 2198 2201 +3 2200 2201 2202 +3 2203 2200 2202 +3 2204 2203 2202 +3 2204 2202 2205 +3 2204 2205 2206 +3 2207 2204 2206 +3 2208 2207 2206 +3 2208 2206 2209 +3 2208 2209 2210 +3 2211 2208 2210 +3 2212 2211 2210 +3 2212 2210 2213 +3 2212 2213 2214 +3 2215 2212 2214 +3 2216 2215 2214 +3 2216 2214 2217 +3 2216 2217 2218 +3 2219 2216 2218 +3 2220 2219 2218 +3 2220 2218 2221 +3 2220 2221 2222 +3 2223 2220 2222 +3 2224 2223 2222 +3 2224 2222 2225 +3 2224 2225 2226 +3 2227 2224 2226 +3 2228 2227 2226 +3 2228 2226 2229 +3 2228 2229 2230 +3 2231 2228 2230 +3 2232 2231 2230 +3 2232 2230 2233 +3 2232 2233 2234 +3 2235 2232 2234 +3 2236 2235 2234 +3 2236 2234 2237 +3 2236 2237 2238 +3 2239 2236 2238 +3 2240 2239 2238 +3 2240 2238 2241 +3 2240 2241 2242 +3 2243 2240 2242 +3 2244 2243 2242 +3 2244 2242 2245 +3 2244 2245 2246 +3 2247 2244 2246 +3 2248 2247 2246 +3 2248 2246 2249 +3 2248 2249 2250 +3 2251 2248 2250 +3 2252 2251 2250 +3 2252 2250 2253 +3 2252 2253 2254 +3 2255 2252 2254 +3 2256 2255 2254 +3 2256 2254 2257 +3 2256 2257 2258 +3 2259 2256 2258 +3 2260 2259 2258 +3 2260 2258 2261 +3 2260 2261 2262 +3 2263 2260 2262 +3 2264 2263 2262 +3 2264 2262 2265 +3 2264 2265 2266 +3 2267 2264 2266 +3 2268 2267 2266 +3 2268 2266 2269 +3 2268 2269 2270 +3 2271 2268 2270 +3 1910 2271 2270 +3 1910 2270 2272 +3 1910 2272 1912 +3 2185 2184 2273 +3 2186 2185 2273 +3 2186 2273 2274 +3 2186 2274 2275 +3 2189 2186 2275 +3 2190 2189 2275 +3 2190 2275 2276 +3 2190 2276 2277 +3 2193 2190 2277 +3 2194 2193 2277 +3 2194 2277 2278 +3 2194 2278 2279 +3 2197 2194 2279 +3 2198 2197 2279 +3 2198 2279 2280 +3 2198 2280 2281 +3 2201 2198 2281 +3 2202 2201 2281 +3 2202 2281 2282 +3 2202 2282 2283 +3 2205 2202 2283 +3 2206 2205 2283 +3 2206 2283 2284 +3 2206 2284 2285 +3 2209 2206 2285 +3 2210 2209 2285 +3 2210 2285 2286 +3 2210 2286 2287 +3 2213 2210 2287 +3 2214 2213 2287 +3 2214 2287 2288 +3 2214 2288 2289 +3 2217 2214 2289 +3 2218 2217 2289 +3 2218 2289 2290 +3 2218 2290 2291 +3 2221 2218 2291 +3 2222 2221 2291 +3 2222 2291 2292 +3 2222 2292 2293 +3 2225 2222 2293 +3 2226 2225 2293 +3 2226 2293 2294 +3 2226 2294 2295 +3 2229 2226 2295 +3 2230 2229 2295 +3 2230 2295 2296 +3 2230 2296 2297 +3 2233 2230 2297 +3 2234 2233 2297 +3 2234 2297 2298 +3 2234 2298 2299 +3 2237 2234 2299 +3 2238 2237 2299 +3 2238 2299 2300 +3 2238 2300 2301 +3 2241 2238 2301 +3 2242 2241 2301 +3 2242 2301 2302 +3 2242 2302 2303 +3 2245 2242 2303 +3 2246 2245 2303 +3 2246 2303 2304 +3 2246 2304 2305 +3 2249 2246 2305 +3 2250 2249 2305 +3 2250 2305 2306 +3 2250 2306 2307 +3 2253 2250 2307 +3 2254 2253 2307 +3 2254 2307 2308 +3 2254 2308 2309 +3 2257 2254 2309 +3 2258 2257 2309 +3 2258 2309 2310 +3 2258 2310 2311 +3 2261 2258 2311 +3 2262 2261 2311 +3 2262 2311 2312 +3 2262 2312 2313 +3 2265 2262 2313 +3 2266 2265 2313 +3 2266 2313 2314 +3 2266 2314 2315 +3 2269 2266 2315 +3 2270 2269 2315 +3 2270 2315 2316 +3 2270 2316 2317 +3 2272 2270 2317 +3 1912 2272 2317 +3 2273 2184 2318 +3 2273 2318 2319 +3 2274 2273 2319 +3 2275 2274 2319 +3 2275 2319 2320 +3 2275 2320 2321 +3 2276 2275 2321 +3 2277 2276 2321 +3 2277 2321 2322 +3 2277 2322 2323 +3 2278 2277 2323 +3 2279 2278 2323 +3 2279 2323 2324 +3 2279 2324 2325 +3 2280 2279 2325 +3 2281 2280 2325 +3 2281 2325 2326 +3 2281 2326 2327 +3 2282 2281 2327 +3 2283 2282 2327 +3 2283 2327 2328 +3 2283 2328 2329 +3 2284 2283 2329 +3 2285 2284 2329 +3 2285 2329 2330 +3 2285 2330 2331 +3 2286 2285 2331 +3 2287 2286 2331 +3 2287 2331 2332 +3 2287 2332 2333 +3 2288 2287 2333 +3 2289 2288 2333 +3 2289 2333 2334 +3 2289 2334 2335 +3 2290 2289 2335 +3 2291 2290 2335 +3 2291 2335 2336 +3 2291 2336 2337 +3 2292 2291 2337 +3 2293 2292 2337 +3 2293 2337 2338 +3 2293 2338 2339 +3 2294 2293 2339 +3 2295 2294 2339 +3 2295 2339 2340 +3 2295 2340 2341 +3 2296 2295 2341 +3 2297 2296 2341 +3 2297 2341 2342 +3 2297 2342 2343 +3 2298 2297 2343 +3 2299 2298 2343 +3 2299 2343 2344 +3 2299 2344 2345 +3 2300 2299 2345 +3 2301 2300 2345 +3 2301 2345 2346 +3 2301 2346 2347 +3 2302 2301 2347 +3 2303 2302 2347 +3 2303 2347 2348 +3 2303 2348 2349 +3 2304 2303 2349 +3 2305 2304 2349 +3 2305 2349 2350 +3 2305 2350 2351 +3 2306 2305 2351 +3 2307 2306 2351 +3 2307 2351 2352 +3 2307 2352 2353 +3 2308 2307 2353 +3 2309 2308 2353 +3 2309 2353 2354 +3 2309 2354 2355 +3 2310 2309 2355 +3 2311 2310 2355 +3 2311 2355 2356 +3 2311 2356 2357 +3 2312 2311 2357 +3 2313 2312 2357 +3 2313 2357 2358 +3 2313 2358 2359 +3 2314 2313 2359 +3 2315 2314 2359 +3 2315 2359 2360 +3 2315 2360 2361 +3 2316 2315 2361 +3 2317 2316 2361 +3 2317 2361 2362 +3 2317 2362 1912 +3 2318 2184 2363 +3 2319 2318 2363 +3 2319 2363 2364 +3 2319 2364 2365 +3 2320 2319 2365 +3 2321 2320 2365 +3 2321 2365 2366 +3 2321 2366 2367 +3 2322 2321 2367 +3 2323 2322 2367 +3 2323 2367 2368 +3 2323 2368 2369 +3 2324 2323 2369 +3 2325 2324 2369 +3 2325 2369 2370 +3 2325 2370 2371 +3 2326 2325 2371 +3 2327 2326 2371 +3 2327 2371 2372 +3 2327 2372 2373 +3 2328 2327 2373 +3 2329 2328 2373 +3 2329 2373 2374 +3 2329 2374 2375 +3 2330 2329 2375 +3 2331 2330 2375 +3 2331 2375 2376 +3 2331 2376 2377 +3 2332 2331 2377 +3 2333 2332 2377 +3 2333 2377 2378 +3 2333 2378 2379 +3 2334 2333 2379 +3 2335 2334 2379 +3 2335 2379 2380 +3 2335 2380 2381 +3 2336 2335 2381 +3 2337 2336 2381 +3 2337 2381 2382 +3 2337 2382 2383 +3 2338 2337 2383 +3 2339 2338 2383 +3 2339 2383 2384 +3 2339 2384 2385 +3 2340 2339 2385 +3 2341 2340 2385 +3 2341 2385 2386 +3 2341 2386 2387 +3 2342 2341 2387 +3 2343 2342 2387 +3 2343 2387 2388 +3 2343 2388 2389 +3 2344 2343 2389 +3 2345 2344 2389 +3 2345 2389 2390 +3 2345 2390 2391 +3 2346 2345 2391 +3 2347 2346 2391 +3 2347 2391 2392 +3 2347 2392 2393 +3 2348 2347 2393 +3 2349 2348 2393 +3 2349 2393 2394 +3 2349 2394 2395 +3 2350 2349 2395 +3 2351 2350 2395 +3 2351 2395 2396 +3 2351 2396 2397 +3 2352 2351 2397 +3 2353 2352 2397 +3 2353 2397 2398 +3 2353 2398 2399 +3 2354 2353 2399 +3 2355 2354 2399 +3 2355 2399 2400 +3 2355 2400 2401 +3 2356 2355 2401 +3 2357 2356 2401 +3 2357 2401 2402 +3 2357 2402 2403 +3 2358 2357 2403 +3 2359 2358 2403 +3 2359 2403 2404 +3 2359 2404 2405 +3 2360 2359 2405 +3 2361 2360 2405 +3 2361 2405 2406 +3 2361 2406 2047 +3 2362 2361 2047 +3 1912 2362 2047 +3 2363 2184 2407 +3 2363 2407 2408 +3 2364 2363 2408 +3 2365 2364 2408 +3 2365 2408 2409 +3 2365 2409 2410 +3 2366 2365 2410 +3 2367 2366 2410 +3 2367 2410 2411 +3 2367 2411 2412 +3 2368 2367 2412 +3 2369 2368 2412 +3 2369 2412 2413 +3 2369 2413 2414 +3 2370 2369 2414 +3 2371 2370 2414 +3 2371 2414 2415 +3 2371 2415 2416 +3 2372 2371 2416 +3 2373 2372 2416 +3 2373 2416 2417 +3 2373 2417 2418 +3 2374 2373 2418 +3 2375 2374 2418 +3 2375 2418 2419 +3 2375 2419 2420 +3 2376 2375 2420 +3 2377 2376 2420 +3 2377 2420 2421 +3 2377 2421 2422 +3 2378 2377 2422 +3 2379 2378 2422 +3 2379 2422 2423 +3 2379 2423 2424 +3 2380 2379 2424 +3 2381 2380 2424 +3 2381 2424 2425 +3 2381 2425 2426 +3 2382 2381 2426 +3 2383 2382 2426 +3 2383 2426 2427 +3 2383 2427 2428 +3 2384 2383 2428 +3 2385 2384 2428 +3 2385 2428 2429 +3 2385 2429 2430 +3 2386 2385 2430 +3 2387 2386 2430 +3 2387 2430 2431 +3 2387 2431 2432 +3 2388 2387 2432 +3 2389 2388 2432 +3 2389 2432 2433 +3 2389 2433 2434 +3 2390 2389 2434 +3 2391 2390 2434 +3 2391 2434 2435 +3 2391 2435 2436 +3 2392 2391 2436 +3 2393 2392 2436 +3 2393 2436 2437 +3 2393 2437 2438 +3 2394 2393 2438 +3 2395 2394 2438 +3 2395 2438 2439 +3 2395 2439 2440 +3 2396 2395 2440 +3 2397 2396 2440 +3 2397 2440 2441 +3 2397 2441 2442 +3 2398 2397 2442 +3 2399 2398 2442 +3 2399 2442 2443 +3 2399 2443 2444 +3 2400 2399 2444 +3 2401 2400 2444 +3 2401 2444 2445 +3 2401 2445 2446 +3 2402 2401 2446 +3 2403 2402 2446 +3 2403 2446 2447 +3 2403 2447 2448 +3 2404 2403 2448 +3 2405 2404 2448 +3 2405 2448 2449 +3 2405 2449 2450 +3 2406 2405 2450 +3 2047 2406 2450 +3 2047 2450 2451 +3 2047 2451 1912 +3 2407 2184 2452 +3 2408 2407 2452 +3 2408 2452 2453 +3 2408 2453 2454 +3 2409 2408 2454 +3 2410 2409 2454 +3 2410 2454 2455 +3 2410 2455 2456 +3 2411 2410 2456 +3 2412 2411 2456 +3 2412 2456 2457 +3 2412 2457 2458 +3 2413 2412 2458 +3 2414 2413 2458 +3 2414 2458 2459 +3 2414 2459 2460 +3 2415 2414 2460 +3 2416 2415 2460 +3 2416 2460 2461 +3 2416 2461 2462 +3 2417 2416 2462 +3 2418 2417 2462 +3 2418 2462 2463 +3 2418 2463 2464 +3 2419 2418 2464 +3 2420 2419 2464 +3 2420 2464 2465 +3 2420 2465 2466 +3 2421 2420 2466 +3 2422 2421 2466 +3 2422 2466 2467 +3 2422 2467 2468 +3 2423 2422 2468 +3 2424 2423 2468 +3 2424 2468 2469 +3 2424 2469 2470 +3 2425 2424 2470 +3 2426 2425 2470 +3 2426 2470 2471 +3 2426 2471 2472 +3 2427 2426 2472 +3 2428 2427 2472 +3 2428 2472 2473 +3 2428 2473 2474 +3 2429 2428 2474 +3 2430 2429 2474 +3 2430 2474 2475 +3 2430 2475 2476 +3 2431 2430 2476 +3 2432 2431 2476 +3 2432 2476 2477 +3 2432 2477 2478 +3 2433 2432 2478 +3 2434 2433 2478 +3 2434 2478 2479 +3 2434 2479 2480 +3 2435 2434 2480 +3 2436 2435 2480 +3 2436 2480 2481 +3 2436 2481 2482 +3 2437 2436 2482 +3 2438 2437 2482 +3 2438 2482 2483 +3 2438 2483 2484 +3 2439 2438 2484 +3 2440 2439 2484 +3 2440 2484 2485 +3 2440 2485 2486 +3 2441 2440 2486 +3 2442 2441 2486 +3 2442 2486 2487 +3 2442 2487 2488 +3 2443 2442 2488 +3 2444 2443 2488 +3 2444 2488 2489 +3 2444 2489 2490 +3 2445 2444 2490 +3 2446 2445 2490 +3 2446 2490 2491 +3 2446 2491 2492 +3 2447 2446 2492 +3 2448 2447 2492 +3 2448 2492 2493 +3 2448 2493 2494 +3 2449 2448 2494 +3 2450 2449 2494 +3 2450 2494 2495 +3 2450 2495 2496 +3 2451 2450 2496 +3 1912 2451 2496 +3 2452 2184 2497 +3 2452 2497 2498 +3 2453 2452 2498 +3 2454 2453 2498 +3 2454 2498 2499 +3 2454 2499 2500 +3 2455 2454 2500 +3 2456 2455 2500 +3 2456 2500 2501 +3 2456 2501 2502 +3 2457 2456 2502 +3 2458 2457 2502 +3 2458 2502 2503 +3 2458 2503 2504 +3 2459 2458 2504 +3 2460 2459 2504 +3 2460 2504 2505 +3 2460 2505 2506 +3 2461 2460 2506 +3 2462 2461 2506 +3 2462 2506 2507 +3 2462 2507 2508 +3 2463 2462 2508 +3 2464 2463 2508 +3 2464 2508 2509 +3 2464 2509 2510 +3 2465 2464 2510 +3 2466 2465 2510 +3 2466 2510 2511 +3 2466 2511 2512 +3 2467 2466 2512 +3 2468 2467 2512 +3 2468 2512 2513 +3 2468 2513 2514 +3 2469 2468 2514 +3 2470 2469 2514 +3 2470 2514 2515 +3 2470 2515 2516 +3 2471 2470 2516 +3 2472 2471 2516 +3 2472 2516 2517 +3 2472 2517 2518 +3 2473 2472 2518 +3 2474 2473 2518 +3 2474 2518 2519 +3 2474 2519 2520 +3 2475 2474 2520 +3 2476 2475 2520 +3 2476 2520 2521 +3 2476 2521 2522 +3 2477 2476 2522 +3 2478 2477 2522 +3 2478 2522 2523 +3 2478 2523 2524 +3 2479 2478 2524 +3 2480 2479 2524 +3 2480 2524 2525 +3 2480 2525 2526 +3 2481 2480 2526 +3 2482 2481 2526 +3 2482 2526 2527 +3 2482 2527 2528 +3 2483 2482 2528 +3 2484 2483 2528 +3 2484 2528 2529 +3 2484 2529 2530 +3 2485 2484 2530 +3 2486 2485 2530 +3 2486 2530 2531 +3 2486 2531 2532 +3 2487 2486 2532 +3 2488 2487 2532 +3 2488 2532 2533 +3 2488 2533 2534 +3 2489 2488 2534 +3 2490 2489 2534 +3 2490 2534 2535 +3 2490 2535 2536 +3 2491 2490 2536 +3 2492 2491 2536 +3 2492 2536 2537 +3 2492 2537 2538 +3 2493 2492 2538 +3 2494 2493 2538 +3 2494 2538 2539 +3 2494 2539 2540 +3 2495 2494 2540 +3 2496 2495 2540 +3 2496 2540 2541 +3 2496 2541 1912 +3 2497 2184 2183 +3 2498 2497 2183 +3 2498 2183 2187 +3 2498 2187 2188 +3 2499 2498 2188 +3 2500 2499 2188 +3 2500 2188 2191 +3 2500 2191 2192 +3 2501 2500 2192 +3 2502 2501 2192 +3 2502 2192 2195 +3 2502 2195 2196 +3 2503 2502 2196 +3 2504 2503 2196 +3 2504 2196 2199 +3 2504 2199 2200 +3 2505 2504 2200 +3 2506 2505 2200 +3 2506 2200 2203 +3 2506 2203 2204 +3 2507 2506 2204 +3 2508 2507 2204 +3 2508 2204 2207 +3 2508 2207 2208 +3 2509 2508 2208 +3 2510 2509 2208 +3 2510 2208 2211 +3 2510 2211 2212 +3 2511 2510 2212 +3 2512 2511 2212 +3 2512 2212 2215 +3 2512 2215 2216 +3 2513 2512 2216 +3 2514 2513 2216 +3 2514 2216 2219 +3 2514 2219 2220 +3 2515 2514 2220 +3 2516 2515 2220 +3 2516 2220 2223 +3 2516 2223 2224 +3 2517 2516 2224 +3 2518 2517 2224 +3 2518 2224 2227 +3 2518 2227 2228 +3 2519 2518 2228 +3 2520 2519 2228 +3 2520 2228 2231 +3 2520 2231 2232 +3 2521 2520 2232 +3 2522 2521 2232 +3 2522 2232 2235 +3 2522 2235 2236 +3 2523 2522 2236 +3 2524 2523 2236 +3 2524 2236 2239 +3 2524 2239 2240 +3 2525 2524 2240 +3 2526 2525 2240 +3 2526 2240 2243 +3 2526 2243 2244 +3 2527 2526 2244 +3 2528 2527 2244 +3 2528 2244 2247 +3 2528 2247 2248 +3 2529 2528 2248 +3 2530 2529 2248 +3 2530 2248 2251 +3 2530 2251 2252 +3 2531 2530 2252 +3 2532 2531 2252 +3 2532 2252 2255 +3 2532 2255 2256 +3 2533 2532 2256 +3 2534 2533 2256 +3 2534 2256 2259 +3 2534 2259 2260 +3 2535 2534 2260 +3 2536 2535 2260 +3 2536 2260 2263 +3 2536 2263 2264 +3 2537 2536 2264 +3 2538 2537 2264 +3 2538 2264 2267 +3 2538 2267 2268 +3 2539 2538 2268 +3 2540 2539 2268 +3 2540 2268 2271 +3 2540 2271 1910 +3 2541 2540 1910 +3 1912 2541 1910 +3 2542 2543 2544 +3 2542 2544 2545 +3 2546 2542 2545 +3 2547 2546 2545 +3 2547 2545 2548 +3 2547 2548 2549 +3 2550 2547 2549 +3 2551 2550 2549 +3 2551 2549 2552 +3 2551 2552 2553 +3 2554 2551 2553 +3 2555 2554 2553 +3 2555 2553 2556 +3 2555 2556 2557 +3 2558 2555 2557 +3 2559 2558 2557 +3 2559 2557 2560 +3 2559 2560 2561 +3 2562 2559 2561 +3 2563 2562 2561 +3 2563 2561 2564 +3 2563 2564 2565 +3 2566 2563 2565 +3 2567 2566 2565 +3 2567 2565 2568 +3 2567 2568 2569 +3 2570 2567 2569 +3 2571 2570 2569 +3 2571 2569 2572 +3 2571 2572 2573 +3 2574 2571 2573 +3 2575 2574 2573 +3 2575 2573 2576 +3 2575 2576 2577 +3 2578 2575 2577 +3 2579 2578 2577 +3 2579 2577 2580 +3 2579 2580 2581 +3 2582 2579 2581 +3 2583 2582 2581 +3 2583 2581 2584 +3 2583 2584 2585 +3 2586 2583 2585 +3 2587 2586 2585 +3 2587 2585 2588 +3 2587 2588 2589 +3 2590 2587 2589 +3 2591 2590 2589 +3 2591 2589 2592 +3 2591 2592 2593 +3 2594 2591 2593 +3 2595 2594 2593 +3 2595 2593 2596 +3 2595 2596 2597 +3 2598 2595 2597 +3 2599 2598 2597 +3 2599 2597 2600 +3 2599 2600 2601 +3 2602 2599 2601 +3 2603 2602 2601 +3 2603 2601 2604 +3 2603 2604 2605 +3 2606 2603 2605 +3 2607 2606 2605 +3 2607 2605 2608 +3 2607 2608 2609 +3 2610 2607 2609 +3 2611 2610 2609 +3 2611 2609 2612 +3 2611 2612 2613 +3 2614 2611 2613 +3 2615 2614 2613 +3 2615 2613 2616 +3 2615 2616 2617 +3 2618 2615 2617 +3 2619 2618 2617 +3 2619 2617 2620 +3 2619 2620 2621 +3 2622 2619 2621 +3 2623 2622 2621 +3 2623 2621 2624 +3 2623 2624 2625 +3 2626 2623 2625 +3 2627 2626 2625 +3 2627 2625 2628 +3 2627 2628 2629 +3 2630 2627 2629 +3 2631 2630 2629 +3 2631 2629 2632 +3 2631 2632 2633 +3 2544 2543 2634 +3 2545 2544 2634 +3 2545 2634 2635 +3 2545 2635 2636 +3 2548 2545 2636 +3 2549 2548 2636 +3 2549 2636 2637 +3 2549 2637 2638 +3 2552 2549 2638 +3 2553 2552 2638 +3 2553 2638 2639 +3 2553 2639 2640 +3 2556 2553 2640 +3 2557 2556 2640 +3 2557 2640 2641 +3 2557 2641 2642 +3 2560 2557 2642 +3 2561 2560 2642 +3 2561 2642 2643 +3 2561 2643 2644 +3 2564 2561 2644 +3 2565 2564 2644 +3 2565 2644 2645 +3 2565 2645 2646 +3 2568 2565 2646 +3 2569 2568 2646 +3 2569 2646 2647 +3 2569 2647 2648 +3 2572 2569 2648 +3 2573 2572 2648 +3 2573 2648 2649 +3 2573 2649 2650 +3 2576 2573 2650 +3 2577 2576 2650 +3 2577 2650 2651 +3 2577 2651 2652 +3 2580 2577 2652 +3 2581 2580 2652 +3 2581 2652 2653 +3 2581 2653 2654 +3 2584 2581 2654 +3 2585 2584 2654 +3 2585 2654 2655 +3 2585 2655 2656 +3 2588 2585 2656 +3 2589 2588 2656 +3 2589 2656 2657 +3 2589 2657 2658 +3 2592 2589 2658 +3 2593 2592 2658 +3 2593 2658 2659 +3 2593 2659 2660 +3 2596 2593 2660 +3 2597 2596 2660 +3 2597 2660 2661 +3 2597 2661 2662 +3 2600 2597 2662 +3 2601 2600 2662 +3 2601 2662 2663 +3 2601 2663 2664 +3 2604 2601 2664 +3 2605 2604 2664 +3 2605 2664 2665 +3 2605 2665 2666 +3 2608 2605 2666 +3 2609 2608 2666 +3 2609 2666 2667 +3 2609 2667 2668 +3 2612 2609 2668 +3 2613 2612 2668 +3 2613 2668 2669 +3 2613 2669 2670 +3 2616 2613 2670 +3 2617 2616 2670 +3 2617 2670 2671 +3 2617 2671 2672 +3 2620 2617 2672 +3 2621 2620 2672 +3 2621 2672 2673 +3 2621 2673 2674 +3 2624 2621 2674 +3 2625 2624 2674 +3 2625 2674 2675 +3 2625 2675 2676 +3 2628 2625 2676 +3 2629 2628 2676 +3 2629 2676 2677 +3 2629 2677 2678 +3 2632 2629 2678 +3 2633 2632 2678 +3 2634 2543 2679 +3 2634 2679 2680 +3 2635 2634 2680 +3 2636 2635 2680 +3 2636 2680 2681 +3 2636 2681 2682 +3 2637 2636 2682 +3 2638 2637 2682 +3 2638 2682 2683 +3 2638 2683 2684 +3 2639 2638 2684 +3 2640 2639 2684 +3 2640 2684 2685 +3 2640 2685 2686 +3 2641 2640 2686 +3 2642 2641 2686 +3 2642 2686 2687 +3 2642 2687 2688 +3 2643 2642 2688 +3 2644 2643 2688 +3 2644 2688 2689 +3 2644 2689 2690 +3 2645 2644 2690 +3 2646 2645 2690 +3 2646 2690 2691 +3 2646 2691 2692 +3 2647 2646 2692 +3 2648 2647 2692 +3 2648 2692 2693 +3 2648 2693 2694 +3 2649 2648 2694 +3 2650 2649 2694 +3 2650 2694 2695 +3 2650 2695 2696 +3 2651 2650 2696 +3 2652 2651 2696 +3 2652 2696 2697 +3 2652 2697 2698 +3 2653 2652 2698 +3 2654 2653 2698 +3 2654 2698 2699 +3 2654 2699 2700 +3 2655 2654 2700 +3 2656 2655 2700 +3 2656 2700 2701 +3 2656 2701 2702 +3 2657 2656 2702 +3 2658 2657 2702 +3 2658 2702 2703 +3 2658 2703 2704 +3 2659 2658 2704 +3 2660 2659 2704 +3 2660 2704 2705 +3 2660 2705 2706 +3 2661 2660 2706 +3 2662 2661 2706 +3 2662 2706 2707 +3 2662 2707 2708 +3 2663 2662 2708 +3 2664 2663 2708 +3 2664 2708 2709 +3 2664 2709 2710 +3 2665 2664 2710 +3 2666 2665 2710 +3 2666 2710 2711 +3 2666 2711 2712 +3 2667 2666 2712 +3 2668 2667 2712 +3 2668 2712 2713 +3 2668 2713 2714 +3 2669 2668 2714 +3 2670 2669 2714 +3 2670 2714 2715 +3 2670 2715 2716 +3 2671 2670 2716 +3 2672 2671 2716 +3 2672 2716 2717 +3 2672 2717 2718 +3 2673 2672 2718 +3 2674 2673 2718 +3 2674 2718 2719 +3 2674 2719 2720 +3 2675 2674 2720 +3 2676 2675 2720 +3 2676 2720 2721 +3 2676 2721 2722 +3 2677 2676 2722 +3 2678 2677 2722 +3 2678 2722 2723 +3 2678 2723 2633 +3 2679 2543 2724 +3 2680 2679 2724 +3 2680 2724 2725 +3 2680 2725 2726 +3 2681 2680 2726 +3 2682 2681 2726 +3 2682 2726 2727 +3 2682 2727 2728 +3 2683 2682 2728 +3 2684 2683 2728 +3 2684 2728 2729 +3 2684 2729 2730 +3 2685 2684 2730 +3 2686 2685 2730 +3 2686 2730 2731 +3 2686 2731 2732 +3 2687 2686 2732 +3 2688 2687 2732 +3 2688 2732 2733 +3 2688 2733 2734 +3 2689 2688 2734 +3 2690 2689 2734 +3 2690 2734 2735 +3 2690 2735 2736 +3 2691 2690 2736 +3 2692 2691 2736 +3 2692 2736 2737 +3 2692 2737 2738 +3 2693 2692 2738 +3 2694 2693 2738 +3 2694 2738 2739 +3 2694 2739 2740 +3 2695 2694 2740 +3 2696 2695 2740 +3 2696 2740 2741 +3 2696 2741 2742 +3 2697 2696 2742 +3 2698 2697 2742 +3 2698 2742 2743 +3 2698 2743 2744 +3 2699 2698 2744 +3 2700 2699 2744 +3 2700 2744 2745 +3 2700 2745 2746 +3 2701 2700 2746 +3 2702 2701 2746 +3 2702 2746 2747 +3 2702 2747 2748 +3 2703 2702 2748 +3 2704 2703 2748 +3 2704 2748 2749 +3 2704 2749 2750 +3 2705 2704 2750 +3 2706 2705 2750 +3 2706 2750 2751 +3 2706 2751 2752 +3 2707 2706 2752 +3 2708 2707 2752 +3 2708 2752 2753 +3 2708 2753 2754 +3 2709 2708 2754 +3 2710 2709 2754 +3 2710 2754 2755 +3 2710 2755 2756 +3 2711 2710 2756 +3 2712 2711 2756 +3 2712 2756 2757 +3 2712 2757 2758 +3 2713 2712 2758 +3 2714 2713 2758 +3 2714 2758 2759 +3 2714 2759 2760 +3 2715 2714 2760 +3 2716 2715 2760 +3 2716 2760 2761 +3 2716 2761 2762 +3 2717 2716 2762 +3 2718 2717 2762 +3 2718 2762 2763 +3 2718 2763 2764 +3 2719 2718 2764 +3 2720 2719 2764 +3 2720 2764 2765 +3 2720 2765 2766 +3 2721 2720 2766 +3 2722 2721 2766 +3 2722 2766 2767 +3 2722 2767 2768 +3 2723 2722 2768 +3 2633 2723 2768 +3 2724 2543 2769 +3 2724 2769 2770 +3 2725 2724 2770 +3 2726 2725 2770 +3 2726 2770 2771 +3 2726 2771 2772 +3 2727 2726 2772 +3 2728 2727 2772 +3 2728 2772 2773 +3 2728 2773 2774 +3 2729 2728 2774 +3 2730 2729 2774 +3 2730 2774 2775 +3 2730 2775 2776 +3 2731 2730 2776 +3 2732 2731 2776 +3 2732 2776 2777 +3 2732 2777 2778 +3 2733 2732 2778 +3 2734 2733 2778 +3 2734 2778 2779 +3 2734 2779 2780 +3 2735 2734 2780 +3 2736 2735 2780 +3 2736 2780 2781 +3 2736 2781 2782 +3 2737 2736 2782 +3 2738 2737 2782 +3 2738 2782 2783 +3 2738 2783 2784 +3 2739 2738 2784 +3 2740 2739 2784 +3 2740 2784 2785 +3 2740 2785 2786 +3 2741 2740 2786 +3 2742 2741 2786 +3 2742 2786 2787 +3 2742 2787 2788 +3 2743 2742 2788 +3 2744 2743 2788 +3 2744 2788 2789 +3 2744 2789 2790 +3 2745 2744 2790 +3 2746 2745 2790 +3 2746 2790 2791 +3 2746 2791 2792 +3 2747 2746 2792 +3 2748 2747 2792 +3 2748 2792 2793 +3 2748 2793 2794 +3 2749 2748 2794 +3 2750 2749 2794 +3 2750 2794 2795 +3 2750 2795 2796 +3 2751 2750 2796 +3 2752 2751 2796 +3 2752 2796 2797 +3 2752 2797 2798 +3 2753 2752 2798 +3 2754 2753 2798 +3 2754 2798 2799 +3 2754 2799 2800 +3 2755 2754 2800 +3 2756 2755 2800 +3 2756 2800 2801 +3 2756 2801 2802 +3 2757 2756 2802 +3 2758 2757 2802 +3 2758 2802 2803 +3 2758 2803 2804 +3 2759 2758 2804 +3 2760 2759 2804 +3 2760 2804 2805 +3 2760 2805 2806 +3 2761 2760 2806 +3 2762 2761 2806 +3 2762 2806 2807 +3 2762 2807 2808 +3 2763 2762 2808 +3 2764 2763 2808 +3 2764 2808 2809 +3 2764 2809 2810 +3 2765 2764 2810 +3 2766 2765 2810 +3 2766 2810 2811 +3 2766 2811 2812 +3 2767 2766 2812 +3 2768 2767 2812 +3 2768 2812 2813 +3 2768 2813 2633 +3 2769 2543 2814 +3 2770 2769 2814 +3 2770 2814 2815 +3 2770 2815 2816 +3 2771 2770 2816 +3 2772 2771 2816 +3 2772 2816 2817 +3 2772 2817 2818 +3 2773 2772 2818 +3 2774 2773 2818 +3 2774 2818 2819 +3 2774 2819 2820 +3 2775 2774 2820 +3 2776 2775 2820 +3 2776 2820 2821 +3 2776 2821 2822 +3 2777 2776 2822 +3 2778 2777 2822 +3 2778 2822 2823 +3 2778 2823 2824 +3 2779 2778 2824 +3 2780 2779 2824 +3 2780 2824 2825 +3 2780 2825 2826 +3 2781 2780 2826 +3 2782 2781 2826 +3 2782 2826 2827 +3 2782 2827 2828 +3 2783 2782 2828 +3 2784 2783 2828 +3 2784 2828 2829 +3 2784 2829 2830 +3 2785 2784 2830 +3 2786 2785 2830 +3 2786 2830 2831 +3 2786 2831 2832 +3 2787 2786 2832 +3 2788 2787 2832 +3 2788 2832 2833 +3 2788 2833 2834 +3 2789 2788 2834 +3 2790 2789 2834 +3 2790 2834 2835 +3 2790 2835 2836 +3 2791 2790 2836 +3 2792 2791 2836 +3 2792 2836 2837 +3 2792 2837 2838 +3 2793 2792 2838 +3 2794 2793 2838 +3 2794 2838 2839 +3 2794 2839 2840 +3 2795 2794 2840 +3 2796 2795 2840 +3 2796 2840 2841 +3 2796 2841 2842 +3 2797 2796 2842 +3 2798 2797 2842 +3 2798 2842 2843 +3 2798 2843 2844 +3 2799 2798 2844 +3 2800 2799 2844 +3 2800 2844 2845 +3 2800 2845 2846 +3 2801 2800 2846 +3 2802 2801 2846 +3 2802 2846 2847 +3 2802 2847 2848 +3 2803 2802 2848 +3 2804 2803 2848 +3 2804 2848 2849 +3 2804 2849 2850 +3 2805 2804 2850 +3 2806 2805 2850 +3 2806 2850 2851 +3 2806 2851 2852 +3 2807 2806 2852 +3 2808 2807 2852 +3 2808 2852 2853 +3 2808 2853 2854 +3 2809 2808 2854 +3 2810 2809 2854 +3 2810 2854 2855 +3 2810 2855 2856 +3 2811 2810 2856 +3 2812 2811 2856 +3 2812 2856 2857 +3 2812 2857 2858 +3 2813 2812 2858 +3 2633 2813 2858 +3 2814 2543 2859 +3 2814 2859 2860 +3 2815 2814 2860 +3 2816 2815 2860 +3 2816 2860 2861 +3 2816 2861 2862 +3 2817 2816 2862 +3 2818 2817 2862 +3 2818 2862 2863 +3 2818 2863 2864 +3 2819 2818 2864 +3 2820 2819 2864 +3 2820 2864 2865 +3 2820 2865 2866 +3 2821 2820 2866 +3 2822 2821 2866 +3 2822 2866 2867 +3 2822 2867 2868 +3 2823 2822 2868 +3 2824 2823 2868 +3 2824 2868 2869 +3 2824 2869 2870 +3 2825 2824 2870 +3 2826 2825 2870 +3 2826 2870 2871 +3 2826 2871 2872 +3 2827 2826 2872 +3 2828 2827 2872 +3 2828 2872 2873 +3 2828 2873 2874 +3 2829 2828 2874 +3 2830 2829 2874 +3 2830 2874 2875 +3 2830 2875 2876 +3 2831 2830 2876 +3 2832 2831 2876 +3 2832 2876 2877 +3 2832 2877 2878 +3 2833 2832 2878 +3 2834 2833 2878 +3 2834 2878 2879 +3 2834 2879 2880 +3 2835 2834 2880 +3 2836 2835 2880 +3 2836 2880 2881 +3 2836 2881 2882 +3 2837 2836 2882 +3 2838 2837 2882 +3 2838 2882 2883 +3 2838 2883 2884 +3 2839 2838 2884 +3 2840 2839 2884 +3 2840 2884 2885 +3 2840 2885 2886 +3 2841 2840 2886 +3 2842 2841 2886 +3 2842 2886 2887 +3 2842 2887 2888 +3 2843 2842 2888 +3 2844 2843 2888 +3 2844 2888 2889 +3 2844 2889 2890 +3 2845 2844 2890 +3 2846 2845 2890 +3 2846 2890 2891 +3 2846 2891 2892 +3 2847 2846 2892 +3 2848 2847 2892 +3 2848 2892 2893 +3 2848 2893 2894 +3 2849 2848 2894 +3 2850 2849 2894 +3 2850 2894 2895 +3 2850 2895 2896 +3 2851 2850 2896 +3 2852 2851 2896 +3 2852 2896 2897 +3 2852 2897 2898 +3 2853 2852 2898 +3 2854 2853 2898 +3 2854 2898 2899 +3 2854 2899 2900 +3 2855 2854 2900 +3 2856 2855 2900 +3 2856 2900 2901 +3 2856 2901 2902 +3 2857 2856 2902 +3 2858 2857 2902 +3 2858 2902 2903 +3 2858 2903 2633 +3 2859 2543 2542 +3 2860 2859 2542 +3 2860 2542 2546 +3 2860 2546 2547 +3 2861 2860 2547 +3 2862 2861 2547 +3 2862 2547 2550 +3 2862 2550 2551 +3 2863 2862 2551 +3 2864 2863 2551 +3 2864 2551 2554 +3 2864 2554 2555 +3 2865 2864 2555 +3 2866 2865 2555 +3 2866 2555 2558 +3 2866 2558 2559 +3 2867 2866 2559 +3 2868 2867 2559 +3 2868 2559 2562 +3 2868 2562 2563 +3 2869 2868 2563 +3 2870 2869 2563 +3 2870 2563 2566 +3 2870 2566 2567 +3 2871 2870 2567 +3 2872 2871 2567 +3 2872 2567 2570 +3 2872 2570 2571 +3 2873 2872 2571 +3 2874 2873 2571 +3 2874 2571 2574 +3 2874 2574 2575 +3 2875 2874 2575 +3 2876 2875 2575 +3 2876 2575 2578 +3 2876 2578 2579 +3 2877 2876 2579 +3 2878 2877 2579 +3 2878 2579 2582 +3 2878 2582 2583 +3 2879 2878 2583 +3 2880 2879 2583 +3 2880 2583 2586 +3 2880 2586 2587 +3 2881 2880 2587 +3 2882 2881 2587 +3 2882 2587 2590 +3 2882 2590 2591 +3 2883 2882 2591 +3 2884 2883 2591 +3 2884 2591 2594 +3 2884 2594 2595 +3 2885 2884 2595 +3 2886 2885 2595 +3 2886 2595 2598 +3 2886 2598 2599 +3 2887 2886 2599 +3 2888 2887 2599 +3 2888 2599 2602 +3 2888 2602 2603 +3 2889 2888 2603 +3 2890 2889 2603 +3 2890 2603 2606 +3 2890 2606 2607 +3 2891 2890 2607 +3 2892 2891 2607 +3 2892 2607 2610 +3 2892 2610 2611 +3 2893 2892 2611 +3 2894 2893 2611 +3 2894 2611 2614 +3 2894 2614 2615 +3 2895 2894 2615 +3 2896 2895 2615 +3 2896 2615 2618 +3 2896 2618 2619 +3 2897 2896 2619 +3 2898 2897 2619 +3 2898 2619 2622 +3 2898 2622 2623 +3 2899 2898 2623 +3 2900 2899 2623 +3 2900 2623 2626 +3 2900 2626 2627 +3 2901 2900 2627 +3 2902 2901 2627 +3 2902 2627 2630 +3 2902 2630 2631 +3 2903 2902 2631 +3 2633 2903 2631 +3 2904 2905 2906 +3 2904 2906 2907 +3 2908 2904 2907 +3 2909 2908 2907 +3 2909 2907 2910 +3 2909 2910 2911 +3 2912 2909 2911 +3 2913 2912 2911 +3 2913 2911 2914 +3 2913 2914 2915 +3 2916 2913 2915 +3 2917 2916 2915 +3 2917 2915 2918 +3 2917 2918 2919 +3 2920 2917 2919 +3 2921 2920 2919 +3 2921 2919 2922 +3 2921 2922 2923 +3 2924 2921 2923 +3 2925 2924 2923 +3 2925 2923 2926 +3 2925 2926 2927 +3 2928 2925 2927 +3 2929 2928 2927 +3 2929 2927 2930 +3 2929 2930 2931 +3 2932 2929 2931 +3 2933 2932 2931 +3 2933 2931 2934 +3 2933 2934 2935 +3 2936 2933 2935 +3 2937 2936 2935 +3 2937 2935 2938 +3 2937 2938 2939 +3 2940 2937 2939 +3 2941 2940 2939 +3 2941 2939 2942 +3 2941 2942 2943 +3 2944 2941 2943 +3 2945 2944 2943 +3 2945 2943 2946 +3 2945 2946 2947 +3 2948 2945 2947 +3 2949 2948 2947 +3 2949 2947 2950 +3 2949 2950 2951 +3 2952 2949 2951 +3 2953 2952 2951 +3 2953 2951 2954 +3 2953 2954 2955 +3 2956 2953 2955 +3 2957 2956 2955 +3 2957 2955 2958 +3 2957 2958 2959 +3 2960 2957 2959 +3 2961 2960 2959 +3 2961 2959 2962 +3 2961 2962 2963 +3 2964 2961 2963 +3 2965 2964 2963 +3 2965 2963 2966 +3 2965 2966 2967 +3 2968 2965 2967 +3 2969 2968 2967 +3 2969 2967 2970 +3 2969 2970 2971 +3 2972 2969 2971 +3 2973 2972 2971 +3 2973 2971 2974 +3 2973 2974 2975 +3 2976 2973 2975 +3 2977 2976 2975 +3 2977 2975 2978 +3 2977 2978 2979 +3 2980 2977 2979 +3 2981 2980 2979 +3 2981 2979 2982 +3 2981 2982 2983 +3 2984 2981 2983 +3 2985 2984 2983 +3 2985 2983 2986 +3 2985 2986 2987 +3 2988 2985 2987 +3 2989 2988 2987 +3 2989 2987 2990 +3 2989 2990 2991 +3 2992 2989 2991 +3 2993 2992 2991 +3 2993 2991 2994 +3 2993 2994 2995 +3 2906 2905 2996 +3 2907 2906 2996 +3 2907 2996 2997 +3 2907 2997 2998 +3 2910 2907 2998 +3 2911 2910 2998 +3 2911 2998 2999 +3 2911 2999 3000 +3 2914 2911 3000 +3 2915 2914 3000 +3 2915 3000 3001 +3 2915 3001 3002 +3 2918 2915 3002 +3 2919 2918 3002 +3 2919 3002 3003 +3 2919 3003 3004 +3 2922 2919 3004 +3 2923 2922 3004 +3 2923 3004 3005 +3 2923 3005 3006 +3 2926 2923 3006 +3 2927 2926 3006 +3 2927 3006 3007 +3 2927 3007 3008 +3 2930 2927 3008 +3 2931 2930 3008 +3 2931 3008 3009 +3 2931 3009 3010 +3 2934 2931 3010 +3 2935 2934 3010 +3 2935 3010 3011 +3 2935 3011 3012 +3 2938 2935 3012 +3 2939 2938 3012 +3 2939 3012 3013 +3 2939 3013 3014 +3 2942 2939 3014 +3 2943 2942 3014 +3 2943 3014 3015 +3 2943 3015 3016 +3 2946 2943 3016 +3 2947 2946 3016 +3 2947 3016 3017 +3 2947 3017 3018 +3 2950 2947 3018 +3 2951 2950 3018 +3 2951 3018 3019 +3 2951 3019 3020 +3 2954 2951 3020 +3 2955 2954 3020 +3 2955 3020 3021 +3 2955 3021 3022 +3 2958 2955 3022 +3 2959 2958 3022 +3 2959 3022 3023 +3 2959 3023 3024 +3 2962 2959 3024 +3 2963 2962 3024 +3 2963 3024 3025 +3 2963 3025 3026 +3 2966 2963 3026 +3 2967 2966 3026 +3 2967 3026 3027 +3 2967 3027 3028 +3 2970 2967 3028 +3 2971 2970 3028 +3 2971 3028 3029 +3 2971 3029 3030 +3 2974 2971 3030 +3 2975 2974 3030 +3 2975 3030 3031 +3 2975 3031 3032 +3 2978 2975 3032 +3 2979 2978 3032 +3 2979 3032 3033 +3 2979 3033 3034 +3 2982 2979 3034 +3 2983 2982 3034 +3 2983 3034 3035 +3 2983 3035 3036 +3 2986 2983 3036 +3 2987 2986 3036 +3 2987 3036 3037 +3 2987 3037 3038 +3 2990 2987 3038 +3 2991 2990 3038 +3 2991 3038 3039 +3 2991 3039 3040 +3 2994 2991 3040 +3 2995 2994 3040 +3 2996 2905 3041 +3 2996 3041 3042 +3 2997 2996 3042 +3 2998 2997 3042 +3 2998 3042 3043 +3 2998 3043 3044 +3 2999 2998 3044 +3 3000 2999 3044 +3 3000 3044 3045 +3 3000 3045 3046 +3 3001 3000 3046 +3 3002 3001 3046 +3 3002 3046 3047 +3 3002 3047 3048 +3 3003 3002 3048 +3 3004 3003 3048 +3 3004 3048 3049 +3 3004 3049 3050 +3 3005 3004 3050 +3 3006 3005 3050 +3 3006 3050 3051 +3 3006 3051 3052 +3 3007 3006 3052 +3 3008 3007 3052 +3 3008 3052 3053 +3 3008 3053 3054 +3 3009 3008 3054 +3 3010 3009 3054 +3 3010 3054 3055 +3 3010 3055 3056 +3 3011 3010 3056 +3 3012 3011 3056 +3 3012 3056 3057 +3 3012 3057 3058 +3 3013 3012 3058 +3 3014 3013 3058 +3 3014 3058 3059 +3 3014 3059 3060 +3 3015 3014 3060 +3 3016 3015 3060 +3 3016 3060 3061 +3 3016 3061 3062 +3 3017 3016 3062 +3 3018 3017 3062 +3 3018 3062 3063 +3 3018 3063 3064 +3 3019 3018 3064 +3 3020 3019 3064 +3 3020 3064 3065 +3 3020 3065 3066 +3 3021 3020 3066 +3 3022 3021 3066 +3 3022 3066 3067 +3 3022 3067 3068 +3 3023 3022 3068 +3 3024 3023 3068 +3 3024 3068 3069 +3 3024 3069 3070 +3 3025 3024 3070 +3 3026 3025 3070 +3 3026 3070 3071 +3 3026 3071 3072 +3 3027 3026 3072 +3 3028 3027 3072 +3 3028 3072 3073 +3 3028 3073 3074 +3 3029 3028 3074 +3 3030 3029 3074 +3 3030 3074 3075 +3 3030 3075 3076 +3 3031 3030 3076 +3 3032 3031 3076 +3 3032 3076 3077 +3 3032 3077 3078 +3 3033 3032 3078 +3 3034 3033 3078 +3 3034 3078 3079 +3 3034 3079 3080 +3 3035 3034 3080 +3 3036 3035 3080 +3 3036 3080 3081 +3 3036 3081 3082 +3 3037 3036 3082 +3 3038 3037 3082 +3 3038 3082 3083 +3 3038 3083 3084 +3 3039 3038 3084 +3 3040 3039 3084 +3 3040 3084 3085 +3 3040 3085 2995 +3 3041 2905 3086 +3 3042 3041 3086 +3 3042 3086 3087 +3 3042 3087 3088 +3 3043 3042 3088 +3 3044 3043 3088 +3 3044 3088 3089 +3 3044 3089 3090 +3 3045 3044 3090 +3 3046 3045 3090 +3 3046 3090 3091 +3 3046 3091 3092 +3 3047 3046 3092 +3 3048 3047 3092 +3 3048 3092 3093 +3 3048 3093 3094 +3 3049 3048 3094 +3 3050 3049 3094 +3 3050 3094 3095 +3 3050 3095 3096 +3 3051 3050 3096 +3 3052 3051 3096 +3 3052 3096 3097 +3 3052 3097 3098 +3 3053 3052 3098 +3 3054 3053 3098 +3 3054 3098 3099 +3 3054 3099 3100 +3 3055 3054 3100 +3 3056 3055 3100 +3 3056 3100 3101 +3 3056 3101 3102 +3 3057 3056 3102 +3 3058 3057 3102 +3 3058 3102 3103 +3 3058 3103 3104 +3 3059 3058 3104 +3 3060 3059 3104 +3 3060 3104 3105 +3 3060 3105 3106 +3 3061 3060 3106 +3 3062 3061 3106 +3 3062 3106 3107 +3 3062 3107 3108 +3 3063 3062 3108 +3 3064 3063 3108 +3 3064 3108 3109 +3 3064 3109 3110 +3 3065 3064 3110 +3 3066 3065 3110 +3 3066 3110 3111 +3 3066 3111 3112 +3 3067 3066 3112 +3 3068 3067 3112 +3 3068 3112 3113 +3 3068 3113 3114 +3 3069 3068 3114 +3 3070 3069 3114 +3 3070 3114 3115 +3 3070 3115 3116 +3 3071 3070 3116 +3 3072 3071 3116 +3 3072 3116 3117 +3 3072 3117 3118 +3 3073 3072 3118 +3 3074 3073 3118 +3 3074 3118 3119 +3 3074 3119 3120 +3 3075 3074 3120 +3 3076 3075 3120 +3 3076 3120 3121 +3 3076 3121 3122 +3 3077 3076 3122 +3 3078 3077 3122 +3 3078 3122 3123 +3 3078 3123 3124 +3 3079 3078 3124 +3 3080 3079 3124 +3 3080 3124 3125 +3 3080 3125 3126 +3 3081 3080 3126 +3 3082 3081 3126 +3 3082 3126 3127 +3 3082 3127 3128 +3 3083 3082 3128 +3 3084 3083 3128 +3 3084 3128 3129 +3 3084 3129 3130 +3 3085 3084 3130 +3 2995 3085 3130 +3 3086 2905 3131 +3 3086 3131 3132 +3 3087 3086 3132 +3 3088 3087 3132 +3 3088 3132 3133 +3 3088 3133 3134 +3 3089 3088 3134 +3 3090 3089 3134 +3 3090 3134 3135 +3 3090 3135 3136 +3 3091 3090 3136 +3 3092 3091 3136 +3 3092 3136 3137 +3 3092 3137 3138 +3 3093 3092 3138 +3 3094 3093 3138 +3 3094 3138 3139 +3 3094 3139 3140 +3 3095 3094 3140 +3 3096 3095 3140 +3 3096 3140 3141 +3 3096 3141 3142 +3 3097 3096 3142 +3 3098 3097 3142 +3 3098 3142 3143 +3 3098 3143 3144 +3 3099 3098 3144 +3 3100 3099 3144 +3 3100 3144 3145 +3 3100 3145 3146 +3 3101 3100 3146 +3 3102 3101 3146 +3 3102 3146 3147 +3 3102 3147 3148 +3 3103 3102 3148 +3 3104 3103 3148 +3 3104 3148 3149 +3 3104 3149 3150 +3 3105 3104 3150 +3 3106 3105 3150 +3 3106 3150 3151 +3 3106 3151 3152 +3 3107 3106 3152 +3 3108 3107 3152 +3 3108 3152 3153 +3 3108 3153 3154 +3 3109 3108 3154 +3 3110 3109 3154 +3 3110 3154 3155 +3 3110 3155 3156 +3 3111 3110 3156 +3 3112 3111 3156 +3 3112 3156 3157 +3 3112 3157 3158 +3 3113 3112 3158 +3 3114 3113 3158 +3 3114 3158 3159 +3 3114 3159 3160 +3 3115 3114 3160 +3 3116 3115 3160 +3 3116 3160 3161 +3 3116 3161 3162 +3 3117 3116 3162 +3 3118 3117 3162 +3 3118 3162 3163 +3 3118 3163 3164 +3 3119 3118 3164 +3 3120 3119 3164 +3 3120 3164 3165 +3 3120 3165 3166 +3 3121 3120 3166 +3 3122 3121 3166 +3 3122 3166 3167 +3 3122 3167 3168 +3 3123 3122 3168 +3 3124 3123 3168 +3 3124 3168 3169 +3 3124 3169 3170 +3 3125 3124 3170 +3 3126 3125 3170 +3 3126 3170 3171 +3 3126 3171 3172 +3 3127 3126 3172 +3 3128 3127 3172 +3 3128 3172 3173 +3 3128 3173 3174 +3 3129 3128 3174 +3 3130 3129 3174 +3 3130 3174 3175 +3 3130 3175 2995 +3 3131 2905 3176 +3 3132 3131 3176 +3 3132 3176 3177 +3 3132 3177 3178 +3 3133 3132 3178 +3 3134 3133 3178 +3 3134 3178 3179 +3 3134 3179 3180 +3 3135 3134 3180 +3 3136 3135 3180 +3 3136 3180 3181 +3 3136 3181 3182 +3 3137 3136 3182 +3 3138 3137 3182 +3 3138 3182 3183 +3 3138 3183 3184 +3 3139 3138 3184 +3 3140 3139 3184 +3 3140 3184 3185 +3 3140 3185 3186 +3 3141 3140 3186 +3 3142 3141 3186 +3 3142 3186 3187 +3 3142 3187 3188 +3 3143 3142 3188 +3 3144 3143 3188 +3 3144 3188 3189 +3 3144 3189 3190 +3 3145 3144 3190 +3 3146 3145 3190 +3 3146 3190 3191 +3 3146 3191 3192 +3 3147 3146 3192 +3 3148 3147 3192 +3 3148 3192 3193 +3 3148 3193 3194 +3 3149 3148 3194 +3 3150 3149 3194 +3 3150 3194 3195 +3 3150 3195 3196 +3 3151 3150 3196 +3 3152 3151 3196 +3 3152 3196 3197 +3 3152 3197 3198 +3 3153 3152 3198 +3 3154 3153 3198 +3 3154 3198 3199 +3 3154 3199 3200 +3 3155 3154 3200 +3 3156 3155 3200 +3 3156 3200 3201 +3 3156 3201 3202 +3 3157 3156 3202 +3 3158 3157 3202 +3 3158 3202 3203 +3 3158 3203 3204 +3 3159 3158 3204 +3 3160 3159 3204 +3 3160 3204 3205 +3 3160 3205 3206 +3 3161 3160 3206 +3 3162 3161 3206 +3 3162 3206 3207 +3 3162 3207 3208 +3 3163 3162 3208 +3 3164 3163 3208 +3 3164 3208 3209 +3 3164 3209 3210 +3 3165 3164 3210 +3 3166 3165 3210 +3 3166 3210 3211 +3 3166 3211 3212 +3 3167 3166 3212 +3 3168 3167 3212 +3 3168 3212 3213 +3 3168 3213 3214 +3 3169 3168 3214 +3 3170 3169 3214 +3 3170 3214 3215 +3 3170 3215 3216 +3 3171 3170 3216 +3 3172 3171 3216 +3 3172 3216 3217 +3 3172 3217 3218 +3 3173 3172 3218 +3 3174 3173 3218 +3 3174 3218 3219 +3 3174 3219 3220 +3 3175 3174 3220 +3 2995 3175 3220 +3 3176 2905 3221 +3 3176 3221 3222 +3 3177 3176 3222 +3 3178 3177 3222 +3 3178 3222 3223 +3 3178 3223 3224 +3 3179 3178 3224 +3 3180 3179 3224 +3 3180 3224 3225 +3 3180 3225 3226 +3 3181 3180 3226 +3 3182 3181 3226 +3 3182 3226 3227 +3 3182 3227 3228 +3 3183 3182 3228 +3 3184 3183 3228 +3 3184 3228 3229 +3 3184 3229 3230 +3 3185 3184 3230 +3 3186 3185 3230 +3 3186 3230 3231 +3 3186 3231 3232 +3 3187 3186 3232 +3 3188 3187 3232 +3 3188 3232 3233 +3 3188 3233 3234 +3 3189 3188 3234 +3 3190 3189 3234 +3 3190 3234 3235 +3 3190 3235 3236 +3 3191 3190 3236 +3 3192 3191 3236 +3 3192 3236 3237 +3 3192 3237 3238 +3 3193 3192 3238 +3 3194 3193 3238 +3 3194 3238 3239 +3 3194 3239 3240 +3 3195 3194 3240 +3 3196 3195 3240 +3 3196 3240 3241 +3 3196 3241 3242 +3 3197 3196 3242 +3 3198 3197 3242 +3 3198 3242 3243 +3 3198 3243 3244 +3 3199 3198 3244 +3 3200 3199 3244 +3 3200 3244 3245 +3 3200 3245 3246 +3 3201 3200 3246 +3 3202 3201 3246 +3 3202 3246 3247 +3 3202 3247 3248 +3 3203 3202 3248 +3 3204 3203 3248 +3 3204 3248 3249 +3 3204 3249 3250 +3 3205 3204 3250 +3 3206 3205 3250 +3 3206 3250 3251 +3 3206 3251 3252 +3 3207 3206 3252 +3 3208 3207 3252 +3 3208 3252 3253 +3 3208 3253 3254 +3 3209 3208 3254 +3 3210 3209 3254 +3 3210 3254 3255 +3 3210 3255 3256 +3 3211 3210 3256 +3 3212 3211 3256 +3 3212 3256 3257 +3 3212 3257 3258 +3 3213 3212 3258 +3 3214 3213 3258 +3 3214 3258 3259 +3 3214 3259 3260 +3 3215 3214 3260 +3 3216 3215 3260 +3 3216 3260 3261 +3 3216 3261 3262 +3 3217 3216 3262 +3 3218 3217 3262 +3 3218 3262 3263 +3 3218 3263 3264 +3 3219 3218 3264 +3 3220 3219 3264 +3 3220 3264 3265 +3 3220 3265 2995 +3 3221 2905 2904 +3 3222 3221 2904 +3 3222 2904 2908 +3 3222 2908 2909 +3 3223 3222 2909 +3 3224 3223 2909 +3 3224 2909 2912 +3 3224 2912 2913 +3 3225 3224 2913 +3 3226 3225 2913 +3 3226 2913 2916 +3 3226 2916 2917 +3 3227 3226 2917 +3 3228 3227 2917 +3 3228 2917 2920 +3 3228 2920 2921 +3 3229 3228 2921 +3 3230 3229 2921 +3 3230 2921 2924 +3 3230 2924 2925 +3 3231 3230 2925 +3 3232 3231 2925 +3 3232 2925 2928 +3 3232 2928 2929 +3 3233 3232 2929 +3 3234 3233 2929 +3 3234 2929 2932 +3 3234 2932 2933 +3 3235 3234 2933 +3 3236 3235 2933 +3 3236 2933 2936 +3 3236 2936 2937 +3 3237 3236 2937 +3 3238 3237 2937 +3 3238 2937 2940 +3 3238 2940 2941 +3 3239 3238 2941 +3 3240 3239 2941 +3 3240 2941 2944 +3 3240 2944 2945 +3 3241 3240 2945 +3 3242 3241 2945 +3 3242 2945 2948 +3 3242 2948 2949 +3 3243 3242 2949 +3 3244 3243 2949 +3 3244 2949 2952 +3 3244 2952 2953 +3 3245 3244 2953 +3 3246 3245 2953 +3 3246 2953 2956 +3 3246 2956 2957 +3 3247 3246 2957 +3 3248 3247 2957 +3 3248 2957 2960 +3 3248 2960 2961 +3 3249 3248 2961 +3 3250 3249 2961 +3 3250 2961 2964 +3 3250 2964 2965 +3 3251 3250 2965 +3 3252 3251 2965 +3 3252 2965 2968 +3 3252 2968 2969 +3 3253 3252 2969 +3 3254 3253 2969 +3 3254 2969 2972 +3 3254 2972 2973 +3 3255 3254 2973 +3 3256 3255 2973 +3 3256 2973 2976 +3 3256 2976 2977 +3 3257 3256 2977 +3 3258 3257 2977 +3 3258 2977 2980 +3 3258 2980 2981 +3 3259 3258 2981 +3 3260 3259 2981 +3 3260 2981 2984 +3 3260 2984 2985 +3 3261 3260 2985 +3 3262 3261 2985 +3 3262 2985 2988 +3 3262 2988 2989 +3 3263 3262 2989 +3 3264 3263 2989 +3 3264 2989 2992 +3 3264 2992 2993 +3 3265 3264 2993 +3 2995 3265 2993 +3 3266 3267 3268 +3 3266 3268 3269 +3 3270 3266 3269 +3 3271 3270 3269 +3 3271 3269 3272 +3 3271 3272 3273 +3 3274 3271 3273 +3 3275 3274 3273 +3 3275 3273 3276 +3 3275 3276 3277 +3 3278 3275 3277 +3 3279 3278 3277 +3 3279 3277 3280 +3 3279 3280 3281 +3 3282 3279 3281 +3 3283 3282 3281 +3 3283 3281 3284 +3 3283 3284 3285 +3 3286 3283 3285 +3 3287 3286 3285 +3 3287 3285 3288 +3 3287 3288 3289 +3 3290 3287 3289 +3 3291 3290 3289 +3 3291 3289 3292 +3 3291 3292 3293 +3 3294 3291 3293 +3 3295 3294 3293 +3 3295 3293 3296 +3 3295 3296 3297 +3 3298 3295 3297 +3 3299 3298 3297 +3 3299 3297 3300 +3 3299 3300 3301 +3 3302 3299 3301 +3 3303 3302 3301 +3 3303 3301 3304 +3 3303 3304 3305 +3 3306 3303 3305 +3 3307 3306 3305 +3 3307 3305 3308 +3 3307 3308 3309 +3 3310 3307 3309 +3 3311 3310 3309 +3 3311 3309 3312 +3 3311 3312 3313 +3 3314 3311 3313 +3 3315 3314 3313 +3 3315 3313 3316 +3 3315 3316 3317 +3 3318 3315 3317 +3 3319 3318 3317 +3 3319 3317 3320 +3 3319 3320 3321 +3 3322 3319 3321 +3 3323 3322 3321 +3 3323 3321 3324 +3 3323 3324 3325 +3 3326 3323 3325 +3 3327 3326 3325 +3 3327 3325 3328 +3 3327 3328 3329 +3 3330 3327 3329 +3 3331 3330 3329 +3 3331 3329 3332 +3 3331 3332 3333 +3 3334 3331 3333 +3 3335 3334 3333 +3 3335 3333 3336 +3 3335 3336 3337 +3 3338 3335 3337 +3 3339 3338 3337 +3 3339 3337 3340 +3 3339 3340 3341 +3 3342 3339 3341 +3 3343 3342 3341 +3 3343 3341 3344 +3 3343 3344 3345 +3 3346 3343 3345 +3 3347 3346 3345 +3 3347 3345 3348 +3 3347 3348 3349 +3 3350 3347 3349 +3 3351 3350 3349 +3 3351 3349 3352 +3 3351 3352 3353 +3 3354 3351 3353 +3 3355 3354 3353 +3 3355 3353 3356 +3 3355 3356 2995 +3 3268 3267 3357 +3 3269 3268 3357 +3 3269 3357 3358 +3 3269 3358 3359 +3 3272 3269 3359 +3 3273 3272 3359 +3 3273 3359 3360 +3 3273 3360 3361 +3 3276 3273 3361 +3 3277 3276 3361 +3 3277 3361 3362 +3 3277 3362 3363 +3 3280 3277 3363 +3 3281 3280 3363 +3 3281 3363 3364 +3 3281 3364 3365 +3 3284 3281 3365 +3 3285 3284 3365 +3 3285 3365 3366 +3 3285 3366 3367 +3 3288 3285 3367 +3 3289 3288 3367 +3 3289 3367 3368 +3 3289 3368 3369 +3 3292 3289 3369 +3 3293 3292 3369 +3 3293 3369 3370 +3 3293 3370 3371 +3 3296 3293 3371 +3 3297 3296 3371 +3 3297 3371 3372 +3 3297 3372 3373 +3 3300 3297 3373 +3 3301 3300 3373 +3 3301 3373 3374 +3 3301 3374 3375 +3 3304 3301 3375 +3 3305 3304 3375 +3 3305 3375 3376 +3 3305 3376 3377 +3 3308 3305 3377 +3 3309 3308 3377 +3 3309 3377 3378 +3 3309 3378 3379 +3 3312 3309 3379 +3 3313 3312 3379 +3 3313 3379 3380 +3 3313 3380 3381 +3 3316 3313 3381 +3 3317 3316 3381 +3 3317 3381 3382 +3 3317 3382 3383 +3 3320 3317 3383 +3 3321 3320 3383 +3 3321 3383 3384 +3 3321 3384 3385 +3 3324 3321 3385 +3 3325 3324 3385 +3 3325 3385 3386 +3 3325 3386 3387 +3 3328 3325 3387 +3 3329 3328 3387 +3 3329 3387 3388 +3 3329 3388 3389 +3 3332 3329 3389 +3 3333 3332 3389 +3 3333 3389 3390 +3 3333 3390 3391 +3 3336 3333 3391 +3 3337 3336 3391 +3 3337 3391 3392 +3 3337 3392 3393 +3 3340 3337 3393 +3 3341 3340 3393 +3 3341 3393 3394 +3 3341 3394 3395 +3 3344 3341 3395 +3 3345 3344 3395 +3 3345 3395 3396 +3 3345 3396 3397 +3 3348 3345 3397 +3 3349 3348 3397 +3 3349 3397 3398 +3 3349 3398 3399 +3 3352 3349 3399 +3 3353 3352 3399 +3 3353 3399 3400 +3 3353 3400 3401 +3 3356 3353 3401 +3 2995 3356 3401 +3 3357 3267 3402 +3 3357 3402 3403 +3 3358 3357 3403 +3 3359 3358 3403 +3 3359 3403 3404 +3 3359 3404 3405 +3 3360 3359 3405 +3 3361 3360 3405 +3 3361 3405 3406 +3 3361 3406 3407 +3 3362 3361 3407 +3 3363 3362 3407 +3 3363 3407 3408 +3 3363 3408 3409 +3 3364 3363 3409 +3 3365 3364 3409 +3 3365 3409 3410 +3 3365 3410 3411 +3 3366 3365 3411 +3 3367 3366 3411 +3 3367 3411 3412 +3 3367 3412 3413 +3 3368 3367 3413 +3 3369 3368 3413 +3 3369 3413 3414 +3 3369 3414 3415 +3 3370 3369 3415 +3 3371 3370 3415 +3 3371 3415 3416 +3 3371 3416 3417 +3 3372 3371 3417 +3 3373 3372 3417 +3 3373 3417 3418 +3 3373 3418 3419 +3 3374 3373 3419 +3 3375 3374 3419 +3 3375 3419 3420 +3 3375 3420 3421 +3 3376 3375 3421 +3 3377 3376 3421 +3 3377 3421 3422 +3 3377 3422 3423 +3 3378 3377 3423 +3 3379 3378 3423 +3 3379 3423 3424 +3 3379 3424 3425 +3 3380 3379 3425 +3 3381 3380 3425 +3 3381 3425 3426 +3 3381 3426 3427 +3 3382 3381 3427 +3 3383 3382 3427 +3 3383 3427 3428 +3 3383 3428 3429 +3 3384 3383 3429 +3 3385 3384 3429 +3 3385 3429 3430 +3 3385 3430 3431 +3 3386 3385 3431 +3 3387 3386 3431 +3 3387 3431 3432 +3 3387 3432 3433 +3 3388 3387 3433 +3 3389 3388 3433 +3 3389 3433 3434 +3 3389 3434 3435 +3 3390 3389 3435 +3 3391 3390 3435 +3 3391 3435 3436 +3 3391 3436 3437 +3 3392 3391 3437 +3 3393 3392 3437 +3 3393 3437 3438 +3 3393 3438 3439 +3 3394 3393 3439 +3 3395 3394 3439 +3 3395 3439 3440 +3 3395 3440 3441 +3 3396 3395 3441 +3 3397 3396 3441 +3 3397 3441 3442 +3 3397 3442 3443 +3 3398 3397 3443 +3 3399 3398 3443 +3 3399 3443 3444 +3 3399 3444 3445 +3 3400 3399 3445 +3 3401 3400 3445 +3 3401 3445 3446 +3 3401 3446 2995 +3 3402 3267 3447 +3 3403 3402 3447 +3 3403 3447 3448 +3 3403 3448 3449 +3 3404 3403 3449 +3 3405 3404 3449 +3 3405 3449 3450 +3 3405 3450 3451 +3 3406 3405 3451 +3 3407 3406 3451 +3 3407 3451 3452 +3 3407 3452 3453 +3 3408 3407 3453 +3 3409 3408 3453 +3 3409 3453 3454 +3 3409 3454 3455 +3 3410 3409 3455 +3 3411 3410 3455 +3 3411 3455 3456 +3 3411 3456 3457 +3 3412 3411 3457 +3 3413 3412 3457 +3 3413 3457 3458 +3 3413 3458 3459 +3 3414 3413 3459 +3 3415 3414 3459 +3 3415 3459 3460 +3 3415 3460 3461 +3 3416 3415 3461 +3 3417 3416 3461 +3 3417 3461 3462 +3 3417 3462 3463 +3 3418 3417 3463 +3 3419 3418 3463 +3 3419 3463 3464 +3 3419 3464 3465 +3 3420 3419 3465 +3 3421 3420 3465 +3 3421 3465 3466 +3 3421 3466 3467 +3 3422 3421 3467 +3 3423 3422 3467 +3 3423 3467 3468 +3 3423 3468 3469 +3 3424 3423 3469 +3 3425 3424 3469 +3 3425 3469 3470 +3 3425 3470 3471 +3 3426 3425 3471 +3 3427 3426 3471 +3 3427 3471 3472 +3 3427 3472 3473 +3 3428 3427 3473 +3 3429 3428 3473 +3 3429 3473 3474 +3 3429 3474 3475 +3 3430 3429 3475 +3 3431 3430 3475 +3 3431 3475 3476 +3 3431 3476 3477 +3 3432 3431 3477 +3 3433 3432 3477 +3 3433 3477 3478 +3 3433 3478 3479 +3 3434 3433 3479 +3 3435 3434 3479 +3 3435 3479 3480 +3 3435 3480 3481 +3 3436 3435 3481 +3 3437 3436 3481 +3 3437 3481 3482 +3 3437 3482 3483 +3 3438 3437 3483 +3 3439 3438 3483 +3 3439 3483 3484 +3 3439 3484 3485 +3 3440 3439 3485 +3 3441 3440 3485 +3 3441 3485 3486 +3 3441 3486 3487 +3 3442 3441 3487 +3 3443 3442 3487 +3 3443 3487 3488 +3 3443 3488 3489 +3 3444 3443 3489 +3 3445 3444 3489 +3 3445 3489 3490 +3 3445 3490 3491 +3 3446 3445 3491 +3 2995 3446 3491 +3 3447 3267 3492 +3 3447 3492 3493 +3 3448 3447 3493 +3 3449 3448 3493 +3 3449 3493 3494 +3 3449 3494 3495 +3 3450 3449 3495 +3 3451 3450 3495 +3 3451 3495 3496 +3 3451 3496 3497 +3 3452 3451 3497 +3 3453 3452 3497 +3 3453 3497 3498 +3 3453 3498 3499 +3 3454 3453 3499 +3 3455 3454 3499 +3 3455 3499 3500 +3 3455 3500 3501 +3 3456 3455 3501 +3 3457 3456 3501 +3 3457 3501 3502 +3 3457 3502 3503 +3 3458 3457 3503 +3 3459 3458 3503 +3 3459 3503 3504 +3 3459 3504 3505 +3 3460 3459 3505 +3 3461 3460 3505 +3 3461 3505 3506 +3 3461 3506 3507 +3 3462 3461 3507 +3 3463 3462 3507 +3 3463 3507 3508 +3 3463 3508 3509 +3 3464 3463 3509 +3 3465 3464 3509 +3 3465 3509 3510 +3 3465 3510 3511 +3 3466 3465 3511 +3 3467 3466 3511 +3 3467 3511 3512 +3 3467 3512 3513 +3 3468 3467 3513 +3 3469 3468 3513 +3 3469 3513 3514 +3 3469 3514 3515 +3 3470 3469 3515 +3 3471 3470 3515 +3 3471 3515 3516 +3 3471 3516 3517 +3 3472 3471 3517 +3 3473 3472 3517 +3 3473 3517 3518 +3 3473 3518 3519 +3 3474 3473 3519 +3 3475 3474 3519 +3 3475 3519 3520 +3 3475 3520 3521 +3 3476 3475 3521 +3 3477 3476 3521 +3 3477 3521 3522 +3 3477 3522 3523 +3 3478 3477 3523 +3 3479 3478 3523 +3 3479 3523 3524 +3 3479 3524 3525 +3 3480 3479 3525 +3 3481 3480 3525 +3 3481 3525 3526 +3 3481 3526 3527 +3 3482 3481 3527 +3 3483 3482 3527 +3 3483 3527 3528 +3 3483 3528 3529 +3 3484 3483 3529 +3 3485 3484 3529 +3 3485 3529 3530 +3 3485 3530 3531 +3 3486 3485 3531 +3 3487 3486 3531 +3 3487 3531 3532 +3 3487 3532 3533 +3 3488 3487 3533 +3 3489 3488 3533 +3 3489 3533 3534 +3 3489 3534 3535 +3 3490 3489 3535 +3 3491 3490 3535 +3 3491 3535 3536 +3 3491 3536 2995 +3 3492 3267 3537 +3 3493 3492 3537 +3 3493 3537 3538 +3 3493 3538 3539 +3 3494 3493 3539 +3 3495 3494 3539 +3 3495 3539 3540 +3 3495 3540 3541 +3 3496 3495 3541 +3 3497 3496 3541 +3 3497 3541 3542 +3 3497 3542 3543 +3 3498 3497 3543 +3 3499 3498 3543 +3 3499 3543 3544 +3 3499 3544 3545 +3 3500 3499 3545 +3 3501 3500 3545 +3 3501 3545 3546 +3 3501 3546 3547 +3 3502 3501 3547 +3 3503 3502 3547 +3 3503 3547 3548 +3 3503 3548 3549 +3 3504 3503 3549 +3 3505 3504 3549 +3 3505 3549 3550 +3 3505 3550 3551 +3 3506 3505 3551 +3 3507 3506 3551 +3 3507 3551 3552 +3 3507 3552 3553 +3 3508 3507 3553 +3 3509 3508 3553 +3 3509 3553 3554 +3 3509 3554 3555 +3 3510 3509 3555 +3 3511 3510 3555 +3 3511 3555 3556 +3 3511 3556 3557 +3 3512 3511 3557 +3 3513 3512 3557 +3 3513 3557 3558 +3 3513 3558 3559 +3 3514 3513 3559 +3 3515 3514 3559 +3 3515 3559 3560 +3 3515 3560 3561 +3 3516 3515 3561 +3 3517 3516 3561 +3 3517 3561 3562 +3 3517 3562 3563 +3 3518 3517 3563 +3 3519 3518 3563 +3 3519 3563 3564 +3 3519 3564 3565 +3 3520 3519 3565 +3 3521 3520 3565 +3 3521 3565 3566 +3 3521 3566 3567 +3 3522 3521 3567 +3 3523 3522 3567 +3 3523 3567 3568 +3 3523 3568 3569 +3 3524 3523 3569 +3 3525 3524 3569 +3 3525 3569 3570 +3 3525 3570 3571 +3 3526 3525 3571 +3 3527 3526 3571 +3 3527 3571 3572 +3 3527 3572 3573 +3 3528 3527 3573 +3 3529 3528 3573 +3 3529 3573 3574 +3 3529 3574 3575 +3 3530 3529 3575 +3 3531 3530 3575 +3 3531 3575 3576 +3 3531 3576 3577 +3 3532 3531 3577 +3 3533 3532 3577 +3 3533 3577 3578 +3 3533 3578 3579 +3 3534 3533 3579 +3 3535 3534 3579 +3 3535 3579 3580 +3 3535 3580 3581 +3 3536 3535 3581 +3 2995 3536 3581 +3 3537 3267 3582 +3 3537 3582 3583 +3 3538 3537 3583 +3 3539 3538 3583 +3 3539 3583 3584 +3 3539 3584 3585 +3 3540 3539 3585 +3 3541 3540 3585 +3 3541 3585 3586 +3 3541 3586 3587 +3 3542 3541 3587 +3 3543 3542 3587 +3 3543 3587 3588 +3 3543 3588 3589 +3 3544 3543 3589 +3 3545 3544 3589 +3 3545 3589 3590 +3 3545 3590 3591 +3 3546 3545 3591 +3 3547 3546 3591 +3 3547 3591 3592 +3 3547 3592 3593 +3 3548 3547 3593 +3 3549 3548 3593 +3 3549 3593 3594 +3 3549 3594 3595 +3 3550 3549 3595 +3 3551 3550 3595 +3 3551 3595 3596 +3 3551 3596 3597 +3 3552 3551 3597 +3 3553 3552 3597 +3 3553 3597 3598 +3 3553 3598 3599 +3 3554 3553 3599 +3 3555 3554 3599 +3 3555 3599 3600 +3 3555 3600 3601 +3 3556 3555 3601 +3 3557 3556 3601 +3 3557 3601 3602 +3 3557 3602 3603 +3 3558 3557 3603 +3 3559 3558 3603 +3 3559 3603 3604 +3 3559 3604 3605 +3 3560 3559 3605 +3 3561 3560 3605 +3 3561 3605 3606 +3 3561 3606 3607 +3 3562 3561 3607 +3 3563 3562 3607 +3 3563 3607 3608 +3 3563 3608 3609 +3 3564 3563 3609 +3 3565 3564 3609 +3 3565 3609 3610 +3 3565 3610 3611 +3 3566 3565 3611 +3 3567 3566 3611 +3 3567 3611 3612 +3 3567 3612 3613 +3 3568 3567 3613 +3 3569 3568 3613 +3 3569 3613 3614 +3 3569 3614 3615 +3 3570 3569 3615 +3 3571 3570 3615 +3 3571 3615 3616 +3 3571 3616 3617 +3 3572 3571 3617 +3 3573 3572 3617 +3 3573 3617 3618 +3 3573 3618 3619 +3 3574 3573 3619 +3 3575 3574 3619 +3 3575 3619 3620 +3 3575 3620 3621 +3 3576 3575 3621 +3 3577 3576 3621 +3 3577 3621 3622 +3 3577 3622 3623 +3 3578 3577 3623 +3 3579 3578 3623 +3 3579 3623 3624 +3 3579 3624 3625 +3 3580 3579 3625 +3 3581 3580 3625 +3 3581 3625 3626 +3 3581 3626 2995 +3 3582 3267 3266 +3 3583 3582 3266 +3 3583 3266 3270 +3 3583 3270 3271 +3 3584 3583 3271 +3 3585 3584 3271 +3 3585 3271 3274 +3 3585 3274 3275 +3 3586 3585 3275 +3 3587 3586 3275 +3 3587 3275 3278 +3 3587 3278 3279 +3 3588 3587 3279 +3 3589 3588 3279 +3 3589 3279 3282 +3 3589 3282 3283 +3 3590 3589 3283 +3 3591 3590 3283 +3 3591 3283 3286 +3 3591 3286 3287 +3 3592 3591 3287 +3 3593 3592 3287 +3 3593 3287 3290 +3 3593 3290 3291 +3 3594 3593 3291 +3 3595 3594 3291 +3 3595 3291 3294 +3 3595 3294 3295 +3 3596 3595 3295 +3 3597 3596 3295 +3 3597 3295 3298 +3 3597 3298 3299 +3 3598 3597 3299 +3 3599 3598 3299 +3 3599 3299 3302 +3 3599 3302 3303 +3 3600 3599 3303 +3 3601 3600 3303 +3 3601 3303 3306 +3 3601 3306 3307 +3 3602 3601 3307 +3 3603 3602 3307 +3 3603 3307 3310 +3 3603 3310 3311 +3 3604 3603 3311 +3 3605 3604 3311 +3 3605 3311 3314 +3 3605 3314 3315 +3 3606 3605 3315 +3 3607 3606 3315 +3 3607 3315 3318 +3 3607 3318 3319 +3 3608 3607 3319 +3 3609 3608 3319 +3 3609 3319 3322 +3 3609 3322 3323 +3 3610 3609 3323 +3 3611 3610 3323 +3 3611 3323 3326 +3 3611 3326 3327 +3 3612 3611 3327 +3 3613 3612 3327 +3 3613 3327 3330 +3 3613 3330 3331 +3 3614 3613 3331 +3 3615 3614 3331 +3 3615 3331 3334 +3 3615 3334 3335 +3 3616 3615 3335 +3 3617 3616 3335 +3 3617 3335 3338 +3 3617 3338 3339 +3 3618 3617 3339 +3 3619 3618 3339 +3 3619 3339 3342 +3 3619 3342 3343 +3 3620 3619 3343 +3 3621 3620 3343 +3 3621 3343 3346 +3 3621 3346 3347 +3 3622 3621 3347 +3 3623 3622 3347 +3 3623 3347 3350 +3 3623 3350 3351 +3 3624 3623 3351 +3 3625 3624 3351 +3 3625 3351 3354 +3 3625 3354 3355 +3 3626 3625 3355 +3 2995 3626 3355 +3 3627 3628 3629 +3 3627 3629 3630 +3 3631 3627 3630 +3 3632 3631 3630 +3 3632 3630 3633 +3 3632 3633 3634 +3 3635 3632 3634 +3 3636 3635 3634 +3 3636 3634 3637 +3 3636 3637 3638 +3 3639 3636 3638 +3 3640 3639 3638 +3 3640 3638 3641 +3 3640 3641 3642 +3 3643 3640 3642 +3 3644 3643 3642 +3 3644 3642 3645 +3 3644 3645 3646 +3 3647 3644 3646 +3 3648 3647 3646 +3 3648 3646 3649 +3 3648 3649 3650 +3 3651 3650 3652 +3 3651 3652 3653 +3 3654 3651 3653 +3 3655 3654 3653 +3 3655 3653 3656 +3 3655 3656 3657 +3 3658 3655 3657 +3 3659 3658 3657 +3 3659 3657 3660 +3 3659 3660 3661 +3 3662 3659 3661 +3 3663 3662 3661 +3 3663 3661 3664 +3 3663 3664 3665 +3 3666 3663 3665 +3 3667 3666 3665 +3 3667 3665 3668 +3 3667 3668 3669 +3 3670 3667 3669 +3 3671 3670 3669 +3 3671 3669 3672 +3 3671 3672 3673 +3 3674 3671 3673 +3 3675 3674 3673 +3 3675 3673 3676 +3 3675 3676 3677 +3 3678 3675 3677 +3 3679 3678 3677 +3 3679 3677 3680 +3 3679 3680 3681 +3 3682 3679 3681 +3 3683 3682 3681 +3 3683 3681 3684 +3 3683 3684 3685 +3 3686 3683 3685 +3 3687 3686 3685 +3 3628 3688 3689 +3 3628 3689 3690 +3 3629 3628 3690 +3 3630 3629 3690 +3 3630 3690 3691 +3 3630 3691 3692 +3 3633 3630 3692 +3 3634 3633 3692 +3 3634 3692 3693 +3 3634 3693 3694 +3 3637 3634 3694 +3 3638 3637 3694 +3 3638 3694 3695 +3 3638 3695 3696 +3 3641 3638 3696 +3 3642 3641 3696 +3 3642 3696 3697 +3 3642 3697 3698 +3 3645 3642 3698 +3 3646 3645 3698 +3 3646 3698 3699 +3 3646 3699 3700 +3 3649 3646 3700 +3 3650 3649 3700 +3 3650 3700 3701 +3 3650 3701 3702 +3 3652 3650 3702 +3 3653 3652 3702 +3 3653 3702 3703 +3 3653 3703 3704 +3 3656 3653 3704 +3 3657 3656 3704 +3 3657 3704 3705 +3 3657 3705 3706 +3 3660 3657 3706 +3 3661 3660 3706 +3 3661 3706 3707 +3 3661 3707 3708 +3 3664 3661 3708 +3 3665 3664 3708 +3 3665 3708 3709 +3 3665 3709 3710 +3 3668 3665 3710 +3 3669 3668 3710 +3 3669 3710 3711 +3 3669 3711 3712 +3 3672 3669 3712 +3 3673 3672 3712 +3 3673 3712 3713 +3 3673 3713 3714 +3 3676 3673 3714 +3 3677 3676 3714 +3 3677 3714 3715 +3 3677 3715 3716 +3 3680 3677 3716 +3 3681 3680 3716 +3 3681 3716 3717 +3 3681 3717 3718 +3 3684 3681 3718 +3 3685 3684 3718 +3 3685 3718 3719 +3 3685 3719 3720 +3 3687 3685 3720 +3 3721 3687 3720 +3 3689 3688 3722 +3 3690 3689 3722 +3 3690 3722 3723 +3 3690 3723 3724 +3 3691 3690 3724 +3 3692 3691 3724 +3 3692 3724 3725 +3 3692 3725 3726 +3 3693 3692 3726 +3 3694 3693 3726 +3 3694 3726 3727 +3 3694 3727 3728 +3 3695 3694 3728 +3 3696 3695 3728 +3 3696 3728 3729 +3 3696 3729 3730 +3 3697 3696 3730 +3 3698 3697 3730 +3 3698 3730 3731 +3 3698 3731 3732 +3 3699 3698 3732 +3 3700 3699 3732 +3 3700 3732 3733 +3 3700 3733 3701 +3 3702 3701 3734 +3 3702 3734 3735 +3 3703 3702 3735 +3 3704 3703 3735 +3 3704 3735 3736 +3 3704 3736 3737 +3 3705 3704 3737 +3 3706 3705 3737 +3 3706 3737 3738 +3 3706 3738 3739 +3 3707 3706 3739 +3 3708 3707 3739 +3 3708 3739 3740 +3 3708 3740 3741 +3 3709 3708 3741 +3 3710 3709 3741 +3 3710 3741 3742 +3 3710 3742 3743 +3 3711 3710 3743 +3 3712 3711 3743 +3 3712 3743 3744 +3 3712 3744 3745 +3 3713 3712 3745 +3 3714 3713 3745 +3 3714 3745 3746 +3 3714 3746 3747 +3 3715 3714 3747 +3 3716 3715 3747 +3 3716 3747 3748 +3 3716 3748 3749 +3 3717 3716 3749 +3 3718 3717 3749 +3 3718 3749 3750 +3 3718 3750 3751 +3 3719 3718 3751 +3 3720 3719 3751 +3 3720 3751 3752 +3 3720 3752 3721 +3 3723 3722 3753 +3 3724 3723 3753 +3 3724 3753 3754 +3 3724 3754 3755 +3 3725 3724 3755 +3 3726 3725 3755 +3 3726 3755 3756 +3 3726 3756 3757 +3 3727 3726 3757 +3 3728 3727 3757 +3 3728 3757 3758 +3 3728 3758 3759 +3 3729 3728 3759 +3 3730 3729 3759 +3 3730 3759 3760 +3 3730 3760 3761 +3 3731 3730 3761 +3 3732 3731 3761 +3 3732 3761 3762 +3 3732 3762 3763 +3 3733 3732 3763 +3 3701 3733 3763 +3 3734 3701 3764 +3 3735 3734 3764 +3 3735 3764 3765 +3 3735 3765 3766 +3 3736 3735 3766 +3 3737 3736 3766 +3 3737 3766 3767 +3 3737 3767 3768 +3 3738 3737 3768 +3 3739 3738 3768 +3 3739 3768 3769 +3 3739 3769 3770 +3 3740 3739 3770 +3 3741 3740 3770 +3 3741 3770 3771 +3 3741 3771 3772 +3 3742 3741 3772 +3 3743 3742 3772 +3 3743 3772 3773 +3 3743 3773 3774 +3 3744 3743 3774 +3 3745 3744 3774 +3 3745 3774 3775 +3 3745 3775 3776 +3 3746 3745 3776 +3 3747 3746 3776 +3 3747 3776 3777 +3 3747 3777 3778 +3 3748 3747 3778 +3 3749 3748 3778 +3 3749 3778 3779 +3 3749 3779 3780 +3 3750 3749 3780 +3 3751 3750 3780 +3 3751 3780 3781 +3 3751 3781 3782 +3 3752 3751 3782 +3 3721 3752 3782 +3 3722 3688 3783 +3 3753 3722 3783 +3 3753 3783 3784 +3 3753 3784 3785 +3 3754 3753 3785 +3 3755 3754 3785 +3 3755 3785 3786 +3 3755 3786 3787 +3 3756 3755 3787 +3 3757 3756 3787 +3 3757 3787 3788 +3 3757 3788 3789 +3 3758 3757 3789 +3 3759 3758 3789 +3 3759 3789 3790 +3 3759 3790 3791 +3 3760 3759 3791 +3 3761 3760 3791 +3 3761 3791 3792 +3 3761 3792 3793 +3 3762 3761 3793 +3 3763 3762 3793 +3 3763 3793 3794 +3 3763 3794 3795 +3 3701 3763 3795 +3 3764 3701 3795 +3 3764 3795 3796 +3 3764 3796 3797 +3 3765 3764 3797 +3 3766 3765 3797 +3 3766 3797 3798 +3 3766 3798 3799 +3 3767 3766 3799 +3 3768 3767 3799 +3 3768 3799 3800 +3 3768 3800 3801 +3 3769 3768 3801 +3 3770 3769 3801 +3 3770 3801 3802 +3 3770 3802 3803 +3 3771 3770 3803 +3 3772 3771 3803 +3 3772 3803 3804 +3 3772 3804 3805 +3 3773 3772 3805 +3 3774 3773 3805 +3 3774 3805 3806 +3 3774 3806 3807 +3 3775 3774 3807 +3 3776 3775 3807 +3 3776 3807 3808 +3 3776 3808 3809 +3 3777 3776 3809 +3 3778 3777 3809 +3 3778 3809 3810 +3 3778 3810 3811 +3 3779 3778 3811 +3 3780 3779 3811 +3 3780 3811 3812 +3 3780 3812 3813 +3 3781 3780 3813 +3 3782 3781 3813 +3 3782 3813 3814 +3 3782 3814 3721 +3 3784 3783 3815 +3 3785 3784 3815 +3 3785 3815 3816 +3 3785 3816 3817 +3 3786 3785 3817 +3 3787 3786 3817 +3 3787 3817 3818 +3 3787 3818 3819 +3 3788 3787 3819 +3 3789 3788 3819 +3 3789 3819 3820 +3 3789 3820 3821 +3 3790 3789 3821 +3 3791 3790 3821 +3 3791 3821 3822 +3 3791 3822 3823 +3 3792 3791 3823 +3 3793 3792 3823 +3 3793 3823 3824 +3 3793 3824 3825 +3 3794 3793 3825 +3 3795 3794 3825 +3 3795 3825 3826 +3 3795 3826 3827 +3 3796 3795 3827 +3 3797 3796 3827 +3 3797 3827 3828 +3 3797 3828 3829 +3 3798 3797 3829 +3 3799 3798 3829 +3 3799 3829 3830 +3 3799 3830 3831 +3 3800 3799 3831 +3 3801 3800 3831 +3 3801 3831 3832 +3 3801 3832 3833 +3 3802 3801 3833 +3 3803 3802 3833 +3 3803 3833 3834 +3 3803 3834 3835 +3 3804 3803 3835 +3 3805 3804 3835 +3 3805 3835 3836 +3 3805 3836 3837 +3 3806 3805 3837 +3 3807 3806 3837 +3 3807 3837 3838 +3 3807 3838 3839 +3 3808 3807 3839 +3 3809 3808 3839 +3 3809 3839 3840 +3 3809 3840 3841 +3 3810 3809 3841 +3 3811 3810 3841 +3 3811 3841 3842 +3 3811 3842 3843 +3 3812 3811 3843 +3 3813 3812 3843 +3 3813 3843 3844 +3 3813 3844 3845 +3 3814 3813 3845 +3 3721 3814 3845 +3 3783 3688 3846 +3 3815 3783 3846 +3 3815 3846 3847 +3 3815 3847 3848 +3 3816 3815 3848 +3 3817 3816 3848 +3 3817 3848 3849 +3 3817 3849 3850 +3 3818 3817 3850 +3 3819 3818 3850 +3 3819 3850 3851 +3 3819 3851 3852 +3 3820 3819 3852 +3 3821 3820 3852 +3 3821 3852 3853 +3 3821 3853 3854 +3 3822 3821 3854 +3 3823 3822 3854 +3 3823 3854 3855 +3 3823 3855 3856 +3 3824 3823 3856 +3 3825 3824 3856 +3 3825 3856 3857 +3 3825 3857 3858 +3 3826 3825 3858 +3 3827 3826 3858 +3 3827 3858 3859 +3 3827 3859 3860 +3 3828 3827 3860 +3 3829 3828 3860 +3 3829 3860 3861 +3 3829 3861 3862 +3 3830 3829 3862 +3 3831 3830 3862 +3 3831 3862 3863 +3 3831 3863 3864 +3 3832 3831 3864 +3 3833 3832 3864 +3 3833 3864 3865 +3 3833 3865 3866 +3 3834 3833 3866 +3 3835 3834 3866 +3 3835 3866 3867 +3 3835 3867 3868 +3 3836 3835 3868 +3 3837 3836 3868 +3 3837 3868 3869 +3 3837 3869 3870 +3 3838 3837 3870 +3 3839 3838 3870 +3 3839 3870 3871 +3 3839 3871 3872 +3 3840 3839 3872 +3 3841 3840 3872 +3 3841 3872 3873 +3 3841 3873 3874 +3 3842 3841 3874 +3 3843 3842 3874 +3 3843 3874 3875 +3 3843 3875 3876 +3 3844 3843 3876 +3 3845 3844 3876 +3 3845 3876 3877 +3 3845 3877 3721 +3 3847 3846 3878 +3 3848 3847 3878 +3 3848 3878 3879 +3 3848 3879 3880 +3 3849 3848 3880 +3 3850 3849 3880 +3 3850 3880 3881 +3 3850 3881 3882 +3 3851 3850 3882 +3 3852 3851 3882 +3 3852 3882 3883 +3 3852 3883 3884 +3 3853 3852 3884 +3 3854 3853 3884 +3 3854 3884 3885 +3 3854 3885 3886 +3 3855 3854 3886 +3 3856 3855 3886 +3 3856 3886 3887 +3 3856 3887 3888 +3 3857 3856 3888 +3 3858 3857 3888 +3 3859 3858 3889 +3 3860 3859 3889 +3 3860 3889 3890 +3 3860 3890 3891 +3 3861 3860 3891 +3 3862 3861 3891 +3 3862 3891 3892 +3 3862 3892 3893 +3 3863 3862 3893 +3 3864 3863 3893 +3 3864 3893 3894 +3 3864 3894 3895 +3 3865 3864 3895 +3 3866 3865 3895 +3 3866 3895 3896 +3 3866 3896 3897 +3 3867 3866 3897 +3 3868 3867 3897 +3 3868 3897 3898 +3 3868 3898 3899 +3 3869 3868 3899 +3 3870 3869 3899 +3 3870 3899 3900 +3 3870 3900 3901 +3 3871 3870 3901 +3 3872 3871 3901 +3 3872 3901 3902 +3 3872 3902 3903 +3 3873 3872 3903 +3 3874 3873 3903 +3 3874 3903 3904 +3 3874 3904 3905 +3 3875 3874 3905 +3 3876 3875 3905 +3 3876 3905 3906 +3 3876 3906 3907 +3 3877 3876 3907 +3 3721 3877 3907 +3 3846 3688 3908 +3 3878 3846 3908 +3 3878 3908 3909 +3 3878 3909 3910 +3 3879 3878 3910 +3 3880 3879 3910 +3 3880 3910 3911 +3 3880 3911 3912 +3 3881 3880 3912 +3 3882 3881 3912 +3 3882 3912 3913 +3 3882 3913 3914 +3 3883 3882 3914 +3 3884 3883 3914 +3 3884 3914 3915 +3 3884 3915 3916 +3 3885 3884 3916 +3 3886 3885 3916 +3 3886 3916 3917 +3 3886 3917 3918 +3 3887 3886 3918 +3 3888 3887 3918 +3 3888 3918 3919 +3 3888 3919 3920 +3 3858 3888 3920 +3 3889 3858 3920 +3 3889 3920 3921 +3 3889 3921 3922 +3 3890 3889 3922 +3 3891 3890 3922 +3 3891 3922 3923 +3 3891 3923 3924 +3 3892 3891 3924 +3 3893 3892 3924 +3 3893 3924 3925 +3 3893 3925 3926 +3 3894 3893 3926 +3 3895 3894 3926 +3 3895 3926 3927 +3 3895 3927 3928 +3 3896 3895 3928 +3 3897 3896 3928 +3 3897 3928 3929 +3 3897 3929 3930 +3 3898 3897 3930 +3 3899 3898 3930 +3 3899 3930 3931 +3 3899 3931 3932 +3 3900 3899 3932 +3 3901 3900 3932 +3 3901 3932 3933 +3 3901 3933 3934 +3 3902 3901 3934 +3 3903 3902 3934 +3 3903 3934 3935 +3 3903 3935 3936 +3 3904 3903 3936 +3 3905 3904 3936 +3 3905 3936 3937 +3 3905 3937 3938 +3 3906 3905 3938 +3 3907 3906 3938 +3 3907 3938 3939 +3 3907 3939 3721 +3 3909 3908 3940 +3 3910 3909 3940 +3 3910 3940 3941 +3 3910 3941 3942 +3 3911 3910 3942 +3 3912 3911 3942 +3 3912 3942 3943 +3 3912 3943 3944 +3 3913 3912 3944 +3 3914 3913 3944 +3 3914 3944 3945 +3 3914 3945 3946 +3 3915 3914 3946 +3 3916 3915 3946 +3 3916 3946 3947 +3 3916 3947 3948 +3 3917 3916 3948 +3 3918 3917 3948 +3 3918 3948 3949 +3 3918 3949 3950 +3 3919 3918 3950 +3 3920 3919 3950 +3 3921 3920 3951 +3 3922 3921 3951 +3 3922 3951 3952 +3 3922 3952 3953 +3 3923 3922 3953 +3 3924 3923 3953 +3 3924 3953 3954 +3 3924 3954 3955 +3 3925 3924 3955 +3 3926 3925 3955 +3 3926 3955 3956 +3 3926 3956 3957 +3 3927 3926 3957 +3 3928 3927 3957 +3 3928 3957 3958 +3 3928 3958 3959 +3 3929 3928 3959 +3 3930 3929 3959 +3 3930 3959 3960 +3 3930 3960 3961 +3 3931 3930 3961 +3 3932 3931 3961 +3 3932 3961 3962 +3 3932 3962 3963 +3 3933 3932 3963 +3 3934 3933 3963 +3 3934 3963 3964 +3 3934 3964 3965 +3 3935 3934 3965 +3 3936 3935 3965 +3 3936 3965 3966 +3 3936 3966 3967 +3 3937 3936 3967 +3 3938 3937 3967 +3 3938 3967 3968 +3 3938 3968 3939 +3 3908 3688 3969 +3 3940 3908 3969 +3 3940 3969 3970 +3 3940 3970 3971 +3 3941 3940 3971 +3 3942 3941 3971 +3 3942 3971 3972 +3 3942 3972 3973 +3 3943 3942 3973 +3 3944 3943 3973 +3 3944 3973 3974 +3 3944 3974 3975 +3 3945 3944 3975 +3 3946 3945 3975 +3 3946 3975 3976 +3 3946 3976 3977 +3 3947 3946 3977 +3 3948 3947 3977 +3 3948 3977 3978 +3 3948 3978 3979 +3 3949 3948 3979 +3 3950 3949 3979 +3 3950 3979 3980 +3 3950 3980 3981 +3 3920 3950 3981 +3 3951 3920 3981 +3 3951 3981 3982 +3 3951 3982 3983 +3 3952 3951 3983 +3 3953 3952 3983 +3 3953 3983 3984 +3 3953 3984 3985 +3 3954 3953 3985 +3 3955 3954 3985 +3 3955 3985 3986 +3 3955 3986 3987 +3 3956 3955 3987 +3 3957 3956 3987 +3 3957 3987 3988 +3 3957 3988 3989 +3 3958 3957 3989 +3 3959 3958 3989 +3 3959 3989 3990 +3 3959 3990 3991 +3 3960 3959 3991 +3 3961 3960 3991 +3 3961 3991 3992 +3 3961 3992 3993 +3 3962 3961 3993 +3 3963 3962 3993 +3 3963 3993 3994 +3 3963 3994 3995 +3 3964 3963 3995 +3 3965 3964 3995 +3 3965 3995 3996 +3 3965 3996 3997 +3 3966 3965 3997 +3 3967 3966 3997 +3 3967 3997 3998 +3 3967 3998 3999 +3 3968 3967 3999 +3 3939 3968 3999 +3 3939 3999 4000 +3 3939 4000 3721 +3 3970 3969 4001 +3 3971 3970 4001 +3 3971 4001 4002 +3 3971 4002 4003 +3 3972 3971 4003 +3 3973 3972 4003 +3 3973 4003 4004 +3 3973 4004 4005 +3 3974 3973 4005 +3 3975 3974 4005 +3 3975 4005 4006 +3 3975 4006 4007 +3 3976 3975 4007 +3 3977 3976 4007 +3 3977 4007 4008 +3 3977 4008 4009 +3 3978 3977 4009 +3 3979 3978 4009 +3 3979 4009 4010 +3 3979 4010 4011 +3 3980 3979 4011 +3 3981 3980 4011 +3 3981 4011 4012 +3 3981 4012 4013 +3 3982 3981 4013 +3 3983 3982 4013 +3 3983 4013 4014 +3 3983 4014 4015 +3 3984 3983 4015 +3 3985 3984 4015 +3 3985 4015 4016 +3 3985 4016 4017 +3 3986 3985 4017 +3 3987 3986 4017 +3 3987 4017 4018 +3 3987 4018 4019 +3 3988 3987 4019 +3 3989 3988 4019 +3 3989 4019 4020 +3 3989 4020 4021 +3 3990 3989 4021 +3 3991 3990 4021 +3 3991 4021 4022 +3 3991 4022 4023 +3 3992 3991 4023 +3 3993 3992 4023 +3 3993 4023 4024 +3 3993 4024 4025 +3 3994 3993 4025 +3 3995 3994 4025 +3 3995 4025 4026 +3 3995 4026 4027 +3 3996 3995 4027 +3 3997 3996 4027 +3 3997 4027 4028 +3 3997 4028 4029 +3 3998 3997 4029 +3 3999 3998 4029 +3 3999 4029 4030 +3 3999 4030 4031 +3 4000 3999 4031 +3 3721 4000 4031 +3 3969 3688 4032 +3 4001 3969 4032 +3 4001 4032 4033 +3 4001 4033 4034 +3 4002 4001 4034 +3 4003 4002 4034 +3 4003 4034 4035 +3 4003 4035 4036 +3 4004 4003 4036 +3 4005 4004 4036 +3 4005 4036 4037 +3 4005 4037 4038 +3 4006 4005 4038 +3 4007 4006 4038 +3 4007 4038 4039 +3 4007 4039 4040 +3 4008 4007 4040 +3 4009 4008 4040 +3 4009 4040 4041 +3 4009 4041 4042 +3 4010 4009 4042 +3 4011 4010 4042 +3 4011 4042 4043 +3 4011 4043 4044 +3 4012 4011 4044 +3 4013 4012 4044 +3 4013 4044 4045 +3 4013 4045 4046 +3 4014 4013 4046 +3 4015 4014 4046 +3 4015 4046 4047 +3 4015 4047 4048 +3 4016 4015 4048 +3 4017 4016 4048 +3 4017 4048 4049 +3 4017 4049 4050 +3 4018 4017 4050 +3 4019 4018 4050 +3 4019 4050 4051 +3 4019 4051 4052 +3 4020 4019 4052 +3 4021 4020 4052 +3 4021 4052 4053 +3 4021 4053 4054 +3 4022 4021 4054 +3 4023 4022 4054 +3 4023 4054 4055 +3 4023 4055 4056 +3 4024 4023 4056 +3 4025 4024 4056 +3 4025 4056 4057 +3 4025 4057 4058 +3 4026 4025 4058 +3 4027 4026 4058 +3 4027 4058 4059 +3 4027 4059 4060 +3 4028 4027 4060 +3 4029 4028 4060 +3 4029 4060 4061 +3 4029 4061 4062 +3 4030 4029 4062 +3 4031 4030 4062 +3 4031 4062 4063 +3 4031 4063 3721 +3 4032 3688 4064 +3 4032 4064 4065 +3 4033 4032 4065 +3 4034 4033 4065 +3 4034 4065 4066 +3 4034 4066 4067 +3 4035 4034 4067 +3 4036 4035 4067 +3 4036 4067 4068 +3 4036 4068 4069 +3 4037 4036 4069 +3 4038 4037 4069 +3 4038 4069 4070 +3 4038 4070 4071 +3 4039 4038 4071 +3 4040 4039 4071 +3 4040 4071 4072 +3 4040 4072 4073 +3 4041 4040 4073 +3 4042 4041 4073 +3 4042 4073 4074 +3 4042 4074 4075 +3 4043 4042 4075 +3 4044 4043 4075 +3 4044 4075 4076 +3 4044 4076 4077 +3 4045 4044 4077 +3 4046 4045 4077 +3 4046 4077 4078 +3 4046 4078 4079 +3 4047 4046 4079 +3 4048 4047 4079 +3 4048 4079 4080 +3 4048 4080 4081 +3 4049 4048 4081 +3 4050 4049 4081 +3 4050 4081 4082 +3 4050 4082 4083 +3 4051 4050 4083 +3 4052 4051 4083 +3 4052 4083 4084 +3 4052 4084 4085 +3 4053 4052 4085 +3 4054 4053 4085 +3 4054 4085 4086 +3 4054 4086 4087 +3 4055 4054 4087 +3 4056 4055 4087 +3 4056 4087 4088 +3 4056 4088 4089 +3 4057 4056 4089 +3 4058 4057 4089 +3 4058 4089 4090 +3 4058 4090 4091 +3 4059 4058 4091 +3 4060 4059 4091 +3 4060 4091 4092 +3 4060 4092 4093 +3 4061 4060 4093 +3 4062 4061 4093 +3 4062 4093 4094 +3 4062 4094 4095 +3 4063 4062 4095 +3 3721 4063 4095 +3 4064 3688 4096 +3 4065 4064 4096 +3 4065 4096 4097 +3 4065 4097 4098 +3 4066 4065 4098 +3 4067 4066 4098 +3 4067 4098 4099 +3 4067 4099 4100 +3 4068 4067 4100 +3 4069 4068 4100 +3 4069 4100 4101 +3 4069 4101 4102 +3 4070 4069 4102 +3 4071 4070 4102 +3 4071 4102 4103 +3 4071 4103 4104 +3 4072 4071 4104 +3 4073 4072 4104 +3 4073 4104 4105 +3 4073 4105 4106 +3 4074 4073 4106 +3 4075 4074 4106 +3 4075 4106 4107 +3 4075 4107 4108 +3 4076 4075 4108 +3 4077 4076 4108 +3 4077 4108 4109 +3 4077 4109 4110 +3 4078 4077 4110 +3 4079 4078 4110 +3 4079 4110 4111 +3 4079 4111 4112 +3 4080 4079 4112 +3 4081 4080 4112 +3 4081 4112 4113 +3 4081 4113 4114 +3 4082 4081 4114 +3 4083 4082 4114 +3 4083 4114 4115 +3 4083 4115 4116 +3 4084 4083 4116 +3 4085 4084 4116 +3 4085 4116 4117 +3 4085 4117 4118 +3 4086 4085 4118 +3 4087 4086 4118 +3 4087 4118 4119 +3 4087 4119 4120 +3 4088 4087 4120 +3 4089 4088 4120 +3 4089 4120 4121 +3 4089 4121 4122 +3 4090 4089 4122 +3 4091 4090 4122 +3 4091 4122 4123 +3 4091 4123 4124 +3 4092 4091 4124 +3 4093 4092 4124 +3 4093 4124 4125 +3 4093 4125 4126 +3 4094 4093 4126 +3 4095 4094 4126 +3 4095 4126 4127 +3 4095 4127 3721 +3 4096 3688 4128 +3 4096 4128 4129 +3 4097 4096 4129 +3 4098 4097 4129 +3 4098 4129 4130 +3 4098 4130 4131 +3 4099 4098 4131 +3 4100 4099 4131 +3 4100 4131 4132 +3 4100 4132 4133 +3 4101 4100 4133 +3 4102 4101 4133 +3 4102 4133 4134 +3 4102 4134 4135 +3 4103 4102 4135 +3 4104 4103 4135 +3 4104 4135 4136 +3 4104 4136 4137 +3 4105 4104 4137 +3 4106 4105 4137 +3 4106 4137 4138 +3 4106 4138 4139 +3 4107 4106 4139 +3 4108 4107 4139 +3 4108 4139 4140 +3 4108 4140 4141 +3 4109 4108 4141 +3 4110 4109 4141 +3 4110 4141 4142 +3 4110 4142 4143 +3 4111 4110 4143 +3 4112 4111 4143 +3 4112 4143 4144 +3 4112 4144 4145 +3 4113 4112 4145 +3 4114 4113 4145 +3 4114 4145 4146 +3 4114 4146 4147 +3 4115 4114 4147 +3 4116 4115 4147 +3 4116 4147 4148 +3 4116 4148 4149 +3 4117 4116 4149 +3 4118 4117 4149 +3 4118 4149 4150 +3 4118 4150 4151 +3 4119 4118 4151 +3 4120 4119 4151 +3 4120 4151 4152 +3 4120 4152 4153 +3 4121 4120 4153 +3 4122 4121 4153 +3 4122 4153 4154 +3 4122 4154 4155 +3 4123 4122 4155 +3 4124 4123 4155 +3 4124 4155 4156 +3 4124 4156 4157 +3 4125 4124 4157 +3 4126 4125 4157 +3 4126 4157 4158 +3 4126 4158 4159 +3 4127 4126 4159 +3 3721 4127 4159 +3 4128 3688 4160 +3 4129 4128 4160 +3 4129 4160 4161 +3 4129 4161 4162 +3 4130 4129 4162 +3 4131 4130 4162 +3 4131 4162 4163 +3 4131 4163 4164 +3 4132 4131 4164 +3 4133 4132 4164 +3 4133 4164 4165 +3 4133 4165 4166 +3 4134 4133 4166 +3 4135 4134 4166 +3 4135 4166 4167 +3 4135 4167 4168 +3 4136 4135 4168 +3 4137 4136 4168 +3 4137 4168 4169 +3 4137 4169 4170 +3 4138 4137 4170 +3 4139 4138 4170 +3 4139 4170 4171 +3 4139 4171 4172 +3 4140 4139 4172 +3 4141 4140 4172 +3 4141 4172 4173 +3 4141 4173 4174 +3 4142 4141 4174 +3 4143 4142 4174 +3 4143 4174 4175 +3 4143 4175 4176 +3 4144 4143 4176 +3 4145 4144 4176 +3 4145 4176 4177 +3 4145 4177 4178 +3 4146 4145 4178 +3 4147 4146 4178 +3 4147 4178 4179 +3 4147 4179 4180 +3 4148 4147 4180 +3 4149 4148 4180 +3 4149 4180 4181 +3 4149 4181 4182 +3 4150 4149 4182 +3 4151 4150 4182 +3 4151 4182 4183 +3 4151 4183 4184 +3 4152 4151 4184 +3 4153 4152 4184 +3 4153 4184 4185 +3 4153 4185 4186 +3 4154 4153 4186 +3 4155 4154 4186 +3 4155 4186 4187 +3 4155 4187 4188 +3 4156 4155 4188 +3 4157 4156 4188 +3 4157 4188 4189 +3 4157 4189 4190 +3 4158 4157 4190 +3 4159 4158 4190 +3 4159 4190 4191 +3 4159 4191 3721 +3 4161 4160 4192 +3 4162 4161 4192 +3 4162 4192 4193 +3 4162 4193 4194 +3 4163 4162 4194 +3 4164 4163 4194 +3 4164 4194 4195 +3 4164 4195 4196 +3 4165 4164 4196 +3 4166 4165 4196 +3 4166 4196 4197 +3 4166 4197 4198 +3 4167 4166 4198 +3 4168 4167 4198 +3 4168 4198 4199 +3 4168 4199 4200 +3 4169 4168 4200 +3 4170 4169 4200 +3 4170 4200 4201 +3 4170 4201 4202 +3 4171 4170 4202 +3 4172 4171 4202 +3 4172 4202 4203 +3 4172 4203 4204 +3 4173 4172 4204 +3 4174 4173 4204 +3 4174 4204 4205 +3 4174 4205 4206 +3 4175 4174 4206 +3 4176 4175 4206 +3 4176 4206 4207 +3 4176 4207 4208 +3 4177 4176 4208 +3 4178 4177 4208 +3 4178 4208 4209 +3 4178 4209 4210 +3 4179 4178 4210 +3 4180 4179 4210 +3 4180 4210 4211 +3 4180 4211 4212 +3 4181 4180 4212 +3 4182 4181 4212 +3 4182 4212 4213 +3 4182 4213 4214 +3 4183 4182 4214 +3 4184 4183 4214 +3 4184 4214 4215 +3 4184 4215 4216 +3 4185 4184 4216 +3 4186 4185 4216 +3 4186 4216 4217 +3 4186 4217 4218 +3 4187 4186 4218 +3 4188 4187 4218 +3 4188 4218 4219 +3 4188 4219 4220 +3 4189 4188 4220 +3 4190 4189 4220 +3 4190 4220 4221 +3 4190 4221 4222 +3 4191 4190 4222 +3 3721 4191 4222 +3 4160 3688 4223 +3 4192 4160 4223 +3 4192 4223 4224 +3 4192 4224 4225 +3 4193 4192 4225 +3 4194 4193 4225 +3 4194 4225 4226 +3 4194 4226 4227 +3 4195 4194 4227 +3 4196 4195 4227 +3 4196 4227 4228 +3 4196 4228 4229 +3 4197 4196 4229 +3 4198 4197 4229 +3 4198 4229 4230 +3 4198 4230 4231 +3 4199 4198 4231 +3 4200 4199 4231 +3 4200 4231 4232 +3 4200 4232 4233 +3 4201 4200 4233 +3 4202 4201 4233 +3 4202 4233 4234 +3 4202 4234 4235 +3 4203 4202 4235 +3 4204 4203 4235 +3 4204 4235 4236 +3 4204 4236 4237 +3 4205 4204 4237 +3 4206 4205 4237 +3 4206 4237 4238 +3 4206 4238 4239 +3 4207 4206 4239 +3 4208 4207 4239 +3 4208 4239 4240 +3 4208 4240 4241 +3 4209 4208 4241 +3 4210 4209 4241 +3 4210 4241 4242 +3 4210 4242 4243 +3 4211 4210 4243 +3 4212 4211 4243 +3 4212 4243 4244 +3 4212 4244 4245 +3 4213 4212 4245 +3 4214 4213 4245 +3 4214 4245 4246 +3 4214 4246 4247 +3 4215 4214 4247 +3 4216 4215 4247 +3 4216 4247 4248 +3 4216 4248 4249 +3 4217 4216 4249 +3 4218 4217 4249 +3 4218 4249 4250 +3 4218 4250 4251 +3 4219 4218 4251 +3 4220 4219 4251 +3 4220 4251 4252 +3 4220 4252 4253 +3 4221 4220 4253 +3 4222 4221 4253 +3 4222 4253 4254 +3 4222 4254 3721 +3 4223 3688 4255 +3 4223 4255 4256 +3 4224 4223 4256 +3 4225 4224 4256 +3 4225 4256 4257 +3 4225 4257 4258 +3 4226 4225 4258 +3 4227 4226 4258 +3 4227 4258 4259 +3 4227 4259 4260 +3 4228 4227 4260 +3 4229 4228 4260 +3 4229 4260 4261 +3 4229 4261 4262 +3 4230 4229 4262 +3 4231 4230 4262 +3 4231 4262 4263 +3 4231 4263 4264 +3 4232 4231 4264 +3 4233 4232 4264 +3 4233 4264 4265 +3 4233 4265 4266 +3 4234 4233 4266 +3 4235 4234 4266 +3 4235 4266 4267 +3 4235 4267 4268 +3 4236 4235 4268 +3 4237 4236 4268 +3 4237 4268 4269 +3 4237 4269 4270 +3 4238 4237 4270 +3 4239 4238 4270 +3 4239 4270 4271 +3 4239 4271 4272 +3 4240 4239 4272 +3 4241 4240 4272 +3 4241 4272 4273 +3 4241 4273 4274 +3 4242 4241 4274 +3 4243 4242 4274 +3 4243 4274 4275 +3 4243 4275 4276 +3 4244 4243 4276 +3 4245 4244 4276 +3 4245 4276 4277 +3 4245 4277 4278 +3 4246 4245 4278 +3 4247 4246 4278 +3 4247 4278 4279 +3 4247 4279 4280 +3 4248 4247 4280 +3 4249 4248 4280 +3 4249 4280 4281 +3 4249 4281 4282 +3 4250 4249 4282 +3 4251 4250 4282 +3 4251 4282 4283 +3 4251 4283 4284 +3 4252 4251 4284 +3 4253 4252 4284 +3 4253 4284 4285 +3 4253 4285 4286 +3 4254 4253 4286 +3 3721 4254 4286 +3 4255 3688 4287 +3 4256 4255 4287 +3 4256 4287 4288 +3 4256 4288 4289 +3 4257 4256 4289 +3 4258 4257 4289 +3 4258 4289 4290 +3 4258 4290 4291 +3 4259 4258 4291 +3 4260 4259 4291 +3 4260 4291 4292 +3 4260 4292 4293 +3 4261 4260 4293 +3 4262 4261 4293 +3 4262 4293 4294 +3 4262 4294 4295 +3 4263 4262 4295 +3 4264 4263 4295 +3 4264 4295 4296 +3 4264 4296 4297 +3 4265 4264 4297 +3 4266 4265 4297 +3 4266 4297 4298 +3 4266 4298 4299 +3 4267 4266 4299 +3 4268 4267 4299 +3 4268 4299 4300 +3 4268 4300 4301 +3 4269 4268 4301 +3 4270 4269 4301 +3 4270 4301 4302 +3 4270 4302 4303 +3 4271 4270 4303 +3 4272 4271 4303 +3 4272 4303 4304 +3 4272 4304 4305 +3 4273 4272 4305 +3 4274 4273 4305 +3 4274 4305 4306 +3 4274 4306 4307 +3 4275 4274 4307 +3 4276 4275 4307 +3 4276 4307 4308 +3 4276 4308 4309 +3 4277 4276 4309 +3 4278 4277 4309 +3 4278 4309 4310 +3 4278 4310 4311 +3 4279 4278 4311 +3 4280 4279 4311 +3 4280 4311 4312 +3 4280 4312 4313 +3 4281 4280 4313 +3 4282 4281 4313 +3 4282 4313 4314 +3 4282 4314 4315 +3 4283 4282 4315 +3 4284 4283 4315 +3 4284 4315 4316 +3 4284 4316 4317 +3 4285 4284 4317 +3 4286 4285 4317 +3 4286 4317 4318 +3 4286 4318 3721 +3 4288 4287 4319 +3 4289 4288 4319 +3 4289 4319 4320 +3 4289 4320 4321 +3 4290 4289 4321 +3 4291 4290 4321 +3 4291 4321 4322 +3 4291 4322 4323 +3 4292 4291 4323 +3 4293 4292 4323 +3 4293 4323 4324 +3 4293 4324 4325 +3 4294 4293 4325 +3 4295 4294 4325 +3 4295 4325 4326 +3 4295 4326 4327 +3 4296 4295 4327 +3 4297 4296 4327 +3 4297 4327 4328 +3 4297 4328 4329 +3 4298 4297 4329 +3 4299 4298 4329 +3 4299 4329 4330 +3 4299 4330 4331 +3 4300 4299 4331 +3 4301 4300 4331 +3 4301 4331 4332 +3 4301 4332 4333 +3 4302 4301 4333 +3 4303 4302 4333 +3 4303 4333 4334 +3 4303 4334 4335 +3 4304 4303 4335 +3 4305 4304 4335 +3 4305 4335 4336 +3 4305 4336 4337 +3 4306 4305 4337 +3 4307 4306 4337 +3 4307 4337 4338 +3 4307 4338 4339 +3 4308 4307 4339 +3 4309 4308 4339 +3 4309 4339 4340 +3 4309 4340 4341 +3 4310 4309 4341 +3 4311 4310 4341 +3 4311 4341 4342 +3 4311 4342 4343 +3 4312 4311 4343 +3 4313 4312 4343 +3 4313 4343 4344 +3 4313 4344 4345 +3 4314 4313 4345 +3 4315 4314 4345 +3 4315 4345 4346 +3 4315 4346 4347 +3 4316 4315 4347 +3 4317 4316 4347 +3 4317 4347 4348 +3 4317 4348 4349 +3 4318 4317 4349 +3 3721 4318 4349 +3 4287 3688 4350 +3 4319 4287 4350 +3 4319 4350 4351 +3 4319 4351 4352 +3 4320 4319 4352 +3 4321 4320 4352 +3 4321 4352 4353 +3 4321 4353 4354 +3 4322 4321 4354 +3 4323 4322 4354 +3 4323 4354 4355 +3 4323 4355 4356 +3 4324 4323 4356 +3 4325 4324 4356 +3 4325 4356 4357 +3 4325 4357 4358 +3 4326 4325 4358 +3 4327 4326 4358 +3 4327 4358 4359 +3 4327 4359 4360 +3 4328 4327 4360 +3 4329 4328 4360 +3 4329 4360 4361 +3 4329 4361 4362 +3 4330 4329 4362 +3 4331 4330 4362 +3 4331 4362 4363 +3 4331 4363 4364 +3 4332 4331 4364 +3 4333 4332 4364 +3 4333 4364 4365 +3 4333 4365 4366 +3 4334 4333 4366 +3 4335 4334 4366 +3 4335 4366 4367 +3 4335 4367 4368 +3 4336 4335 4368 +3 4337 4336 4368 +3 4337 4368 4369 +3 4337 4369 4370 +3 4338 4337 4370 +3 4339 4338 4370 +3 4339 4370 4371 +3 4339 4371 4372 +3 4340 4339 4372 +3 4341 4340 4372 +3 4341 4372 4373 +3 4341 4373 4374 +3 4342 4341 4374 +3 4343 4342 4374 +3 4343 4374 4375 +3 4343 4375 4376 +3 4344 4343 4376 +3 4345 4344 4376 +3 4345 4376 4377 +3 4345 4377 4378 +3 4346 4345 4378 +3 4347 4346 4378 +3 4347 4378 4379 +3 4347 4379 4380 +3 4348 4347 4380 +3 4349 4348 4380 +3 4349 4380 4381 +3 4349 4381 3721 +3 4350 3688 4382 +3 4350 4382 4383 +3 4351 4350 4383 +3 4352 4351 4383 +3 4352 4383 4384 +3 4352 4384 4385 +3 4353 4352 4385 +3 4354 4353 4385 +3 4354 4385 4386 +3 4354 4386 4387 +3 4355 4354 4387 +3 4356 4355 4387 +3 4356 4387 4388 +3 4356 4388 4389 +3 4357 4356 4389 +3 4358 4357 4389 +3 4358 4389 4390 +3 4358 4390 4391 +3 4359 4358 4391 +3 4360 4359 4391 +3 4360 4391 4392 +3 4360 4392 4393 +3 4361 4360 4393 +3 4362 4361 4393 +3 4362 4393 4394 +3 4362 4394 4395 +3 4363 4362 4395 +3 4364 4363 4395 +3 4364 4395 4396 +3 4364 4396 4397 +3 4365 4364 4397 +3 4366 4365 4397 +3 4366 4397 4398 +3 4366 4398 4399 +3 4367 4366 4399 +3 4368 4367 4399 +3 4368 4399 4400 +3 4368 4400 4401 +3 4369 4368 4401 +3 4370 4369 4401 +3 4370 4401 4402 +3 4370 4402 4403 +3 4371 4370 4403 +3 4372 4371 4403 +3 4372 4403 4404 +3 4372 4404 4405 +3 4373 4372 4405 +3 4374 4373 4405 +3 4374 4405 4406 +3 4374 4406 4407 +3 4375 4374 4407 +3 4376 4375 4407 +3 4376 4407 4408 +3 4376 4408 4409 +3 4377 4376 4409 +3 4378 4377 4409 +3 4378 4409 4410 +3 4378 4410 4411 +3 4379 4378 4411 +3 4380 4379 4411 +3 4380 4411 4412 +3 4380 4412 4413 +3 4381 4380 4413 +3 3721 4381 4413 +3 4382 3688 4414 +3 4383 4382 4414 +3 4383 4414 4415 +3 4383 4415 4416 +3 4384 4383 4416 +3 4385 4384 4416 +3 4385 4416 4417 +3 4385 4417 4418 +3 4386 4385 4418 +3 4387 4386 4418 +3 4387 4418 4419 +3 4387 4419 4420 +3 4388 4387 4420 +3 4389 4388 4420 +3 4389 4420 4421 +3 4389 4421 4422 +3 4390 4389 4422 +3 4391 4390 4422 +3 4391 4422 4423 +3 4391 4423 4424 +3 4392 4391 4424 +3 4393 4392 4424 +3 4393 4424 4425 +3 4393 4425 4426 +3 4394 4393 4426 +3 4395 4394 4426 +3 4395 4426 4427 +3 4395 4427 4428 +3 4396 4395 4428 +3 4397 4396 4428 +3 4397 4428 4429 +3 4397 4429 4430 +3 4398 4397 4430 +3 4399 4398 4430 +3 4399 4430 4431 +3 4399 4431 4432 +3 4400 4399 4432 +3 4401 4400 4432 +3 4401 4432 4433 +3 4401 4433 4434 +3 4402 4401 4434 +3 4403 4402 4434 +3 4403 4434 4435 +3 4403 4435 4436 +3 4404 4403 4436 +3 4405 4404 4436 +3 4405 4436 4437 +3 4405 4437 4438 +3 4406 4405 4438 +3 4407 4406 4438 +3 4407 4438 4439 +3 4407 4439 4440 +3 4408 4407 4440 +3 4409 4408 4440 +3 4409 4440 4441 +3 4409 4441 4442 +3 4410 4409 4442 +3 4411 4410 4442 +3 4411 4442 4443 +3 4411 4443 4444 +3 4412 4411 4444 +3 4413 4412 4444 +3 4413 4444 4445 +3 4413 4445 3721 +3 4414 3688 4446 +3 4414 4446 4447 +3 4415 4414 4447 +3 4416 4415 4447 +3 4416 4447 4448 +3 4416 4448 4449 +3 4417 4416 4449 +3 4418 4417 4449 +3 4418 4449 4450 +3 4418 4450 4451 +3 4419 4418 4451 +3 4420 4419 4451 +3 4420 4451 4452 +3 4420 4452 4453 +3 4421 4420 4453 +3 4422 4421 4453 +3 4422 4453 4454 +3 4422 4454 4455 +3 4423 4422 4455 +3 4424 4423 4455 +3 4424 4455 4456 +3 4424 4456 4457 +3 4425 4424 4457 +3 4426 4425 4457 +3 4426 4457 4458 +3 4426 4458 4459 +3 4427 4426 4459 +3 4428 4427 4459 +3 4428 4459 4460 +3 4428 4460 4461 +3 4429 4428 4461 +3 4430 4429 4461 +3 4430 4461 4462 +3 4430 4462 4463 +3 4431 4430 4463 +3 4432 4431 4463 +3 4432 4463 4464 +3 4432 4464 4465 +3 4433 4432 4465 +3 4434 4433 4465 +3 4434 4465 4466 +3 4434 4466 4467 +3 4435 4434 4467 +3 4436 4435 4467 +3 4436 4467 4468 +3 4436 4468 4469 +3 4437 4436 4469 +3 4438 4437 4469 +3 4438 4469 4470 +3 4438 4470 4471 +3 4439 4438 4471 +3 4440 4439 4471 +3 4440 4471 4472 +3 4440 4472 4473 +3 4441 4440 4473 +3 4442 4441 4473 +3 4442 4473 4474 +3 4442 4474 4475 +3 4443 4442 4475 +3 4444 4443 4475 +3 4444 4475 4476 +3 4444 4476 4477 +3 4445 4444 4477 +3 3721 4445 4477 +3 4447 4446 4478 +3 4447 4478 4479 +3 4448 4447 4479 +3 4449 4448 4479 +3 4449 4479 4480 +3 4449 4480 4481 +3 4450 4449 4481 +3 4451 4450 4481 +3 4451 4481 4482 +3 4451 4482 4483 +3 4452 4451 4483 +3 4453 4452 4483 +3 4453 4483 4484 +3 4453 4484 4485 +3 4454 4453 4485 +3 4455 4454 4485 +3 4455 4485 4486 +3 4455 4486 4487 +3 4456 4455 4487 +3 4457 4456 4487 +3 4457 4487 4488 +3 4457 4488 4489 +3 4458 4457 4489 +3 4459 4458 4489 +3 4459 4489 4490 +3 4459 4490 4491 +3 4460 4459 4491 +3 4461 4460 4491 +3 4461 4491 4492 +3 4461 4492 4493 +3 4462 4461 4493 +3 4463 4462 4493 +3 4463 4493 4494 +3 4463 4494 4495 +3 4464 4463 4495 +3 4465 4464 4495 +3 4465 4495 4496 +3 4465 4496 4497 +3 4466 4465 4497 +3 4467 4466 4497 +3 4467 4497 4498 +3 4467 4498 4499 +3 4468 4467 4499 +3 4469 4468 4499 +3 4469 4499 4500 +3 4469 4500 4501 +3 4470 4469 4501 +3 4471 4470 4501 +3 4471 4501 4502 +3 4471 4502 4503 +3 4472 4471 4503 +3 4473 4472 4503 +3 4473 4503 4504 +3 4473 4504 4505 +3 4474 4473 4505 +3 4475 4474 4505 +3 4475 4505 4506 +3 4475 4506 4507 +3 4476 4475 4507 +3 4477 4476 4507 +3 4477 4507 4508 +3 4477 4508 3721 +3 4446 3688 3628 +3 4446 3628 3627 +3 4478 4446 3627 +3 4479 4478 3627 +3 4479 3627 3631 +3 4479 3631 3632 +3 4480 4479 3632 +3 4481 4480 3632 +3 4481 3632 3635 +3 4481 3635 3636 +3 4482 4481 3636 +3 4483 4482 3636 +3 4483 3636 3639 +3 4483 3639 3640 +3 4484 4483 3640 +3 4485 4484 3640 +3 4485 3640 3643 +3 4485 3643 3644 +3 4486 4485 3644 +3 4487 4486 3644 +3 4487 3644 3647 +3 4487 3647 3648 +3 4488 4487 3648 +3 4489 4488 3648 +3 4489 3648 3650 +3 4489 3650 3651 +3 4490 4489 3651 +3 4491 4490 3651 +3 4491 3651 3654 +3 4491 3654 3655 +3 4492 4491 3655 +3 4493 4492 3655 +3 4493 3655 3658 +3 4493 3658 3659 +3 4494 4493 3659 +3 4495 4494 3659 +3 4495 3659 3662 +3 4495 3662 3663 +3 4496 4495 3663 +3 4497 4496 3663 +3 4497 3663 3666 +3 4497 3666 3667 +3 4498 4497 3667 +3 4499 4498 3667 +3 4499 3667 3670 +3 4499 3670 3671 +3 4500 4499 3671 +3 4501 4500 3671 +3 4501 3671 3674 +3 4501 3674 3675 +3 4502 4501 3675 +3 4503 4502 3675 +3 4503 3675 3678 +3 4503 3678 3679 +3 4504 4503 3679 +3 4505 4504 3679 +3 4505 3679 3682 +3 4505 3682 3683 +3 4506 4505 3683 +3 4507 4506 3683 +3 4507 3683 3686 +3 4507 3686 3687 +3 4508 4507 3687 +3 3721 4508 3687 +3 4509 4510 4511 +3 4509 4511 4512 +3 4513 4509 4512 +3 4514 4513 4512 +3 4514 4512 4515 +3 4514 4515 4516 +3 4517 4514 4516 +3 4518 4517 4516 +3 4518 4516 4519 +3 4518 4519 4520 +3 4521 4518 4520 +3 4522 4521 4520 +3 4522 4520 4523 +3 4522 4523 4524 +3 4525 4522 4524 +3 4526 4525 4524 +3 4526 4524 4527 +3 4526 4527 4528 +3 4529 4526 4528 +3 4530 4529 4528 +3 4530 4528 4531 +3 4530 4531 4532 +3 4533 4530 4532 +3 4534 4533 4532 +3 4534 4532 4535 +3 4534 4535 4536 +3 4537 4534 4536 +3 4538 4537 4536 +3 4538 4536 4539 +3 4538 4539 4540 +3 4541 4538 4540 +3 4542 4541 4540 +3 4542 4540 4543 +3 4542 4543 4544 +3 4545 4544 4546 +3 4545 4546 4547 +3 4548 4545 4547 +3 4549 4548 4547 +3 4549 4547 4550 +3 4549 4550 4551 +3 4511 4510 4552 +3 4512 4511 4552 +3 4512 4552 4553 +3 4512 4553 4554 +3 4515 4512 4554 +3 4516 4515 4554 +3 4516 4554 4555 +3 4516 4555 4556 +3 4519 4516 4556 +3 4520 4519 4556 +3 4520 4556 4557 +3 4520 4557 4558 +3 4523 4520 4558 +3 4524 4523 4558 +3 4524 4558 4559 +3 4524 4559 4560 +3 4527 4524 4560 +3 4528 4527 4560 +3 4528 4560 4561 +3 4528 4561 4562 +3 4531 4528 4562 +3 4532 4531 4562 +3 4532 4562 4563 +3 4532 4563 4564 +3 4535 4532 4564 +3 4536 4535 4564 +3 4536 4564 4565 +3 4536 4565 4566 +3 4539 4536 4566 +3 4540 4539 4566 +3 4540 4566 4567 +3 4540 4567 4568 +3 4543 4540 4568 +3 4544 4543 4568 +3 4544 4568 4569 +3 4544 4569 4546 +3 4547 4546 4570 +3 4547 4570 4571 +3 4550 4547 4571 +3 4551 4550 4571 +3 4552 4510 4572 +3 4552 4572 4573 +3 4553 4552 4573 +3 4554 4553 4573 +3 4554 4573 4574 +3 4554 4574 4575 +3 4555 4554 4575 +3 4556 4555 4575 +3 4556 4575 4576 +3 4556 4576 4577 +3 4557 4556 4577 +3 4558 4557 4577 +3 4558 4577 4578 +3 4558 4578 4579 +3 4559 4558 4579 +3 4560 4559 4579 +3 4560 4579 4580 +3 4560 4580 4581 +3 4561 4560 4581 +3 4562 4561 4581 +3 4562 4581 4582 +3 4562 4582 4583 +3 4563 4562 4583 +3 4564 4563 4583 +3 4564 4583 4584 +3 4564 4584 4565 +3 4566 4565 4585 +3 4566 4585 4586 +3 4567 4566 4586 +3 4568 4567 4586 +3 4568 4586 4587 +3 4568 4587 4569 +3 4546 4569 4588 +3 4546 4588 4589 +3 4570 4546 4589 +3 4571 4570 4589 +3 4571 4589 4590 +3 4571 4590 4551 +3 4572 4510 4591 +3 4573 4572 4591 +3 4573 4591 4592 +3 4573 4592 4593 +3 4574 4573 4593 +3 4575 4574 4593 +3 4575 4593 4594 +3 4575 4594 4595 +3 4576 4575 4595 +3 4577 4576 4595 +3 4577 4595 4596 +3 4577 4596 4597 +3 4578 4577 4597 +3 4579 4578 4597 +3 4579 4597 4598 +3 4579 4598 4599 +3 4580 4579 4599 +3 4581 4580 4599 +3 4581 4599 4600 +3 4581 4600 4601 +3 4582 4581 4601 +3 4583 4582 4601 +3 4583 4601 4602 +3 4583 4602 4603 +3 4584 4583 4603 +3 4565 4584 4603 +3 4565 4603 4604 +3 4565 4604 4605 +3 4585 4565 4605 +3 4586 4585 4605 +3 4586 4605 4606 +3 4586 4606 4607 +3 4587 4586 4607 +3 4569 4587 4607 +3 4569 4607 4608 +3 4569 4608 4609 +3 4588 4569 4609 +3 4589 4588 4609 +3 4589 4609 4610 +3 4589 4610 4611 +3 4590 4589 4611 +3 4551 4590 4611 +3 4591 4510 4612 +3 4591 4612 4613 +3 4592 4591 4613 +3 4593 4592 4613 +3 4593 4613 4614 +3 4593 4614 4615 +3 4594 4593 4615 +3 4595 4594 4615 +3 4595 4615 4616 +3 4595 4616 4617 +3 4596 4595 4617 +3 4597 4596 4617 +3 4597 4617 4618 +3 4597 4618 4619 +3 4598 4597 4619 +3 4599 4598 4619 +3 4599 4619 4620 +3 4599 4620 4621 +3 4600 4599 4621 +3 4601 4600 4621 +3 4601 4621 4622 +3 4601 4622 4623 +3 4602 4601 4623 +3 4603 4602 4623 +3 4603 4623 4624 +3 4603 4624 4625 +3 4604 4603 4625 +3 4605 4604 4625 +3 4605 4625 4626 +3 4605 4626 4627 +3 4606 4605 4627 +3 4607 4606 4627 +3 4607 4627 4628 +3 4607 4628 4608 +3 4609 4608 4629 +3 4609 4629 4630 +3 4610 4609 4630 +3 4611 4610 4630 +3 4611 4630 4631 +3 4611 4631 4551 +3 4612 4510 4632 +3 4613 4612 4632 +3 4613 4632 4633 +3 4613 4633 4634 +3 4614 4613 4634 +3 4615 4614 4634 +3 4615 4634 4635 +3 4615 4635 4636 +3 4616 4615 4636 +3 4617 4616 4636 +3 4617 4636 4637 +3 4617 4637 4638 +3 4618 4617 4638 +3 4619 4618 4638 +3 4619 4638 4639 +3 4619 4639 4640 +3 4620 4619 4640 +3 4621 4620 4640 +3 4621 4640 4641 +3 4621 4641 4642 +3 4622 4621 4642 +3 4623 4622 4642 +3 4623 4642 4643 +3 4623 4643 4644 +3 4624 4623 4644 +3 4625 4624 4644 +3 4625 4644 4645 +3 4625 4645 4646 +3 4626 4625 4646 +3 4627 4626 4646 +3 4627 4646 4647 +3 4627 4647 4648 +3 4628 4627 4648 +3 4608 4628 4648 +3 4608 4648 4544 +3 4608 4544 4629 +3 4630 4629 4649 +3 4630 4649 4650 +3 4631 4630 4650 +3 4551 4631 4650 +3 4632 4510 4651 +3 4632 4651 4652 +3 4633 4632 4652 +3 4634 4633 4652 +3 4634 4652 4653 +3 4634 4653 4654 +3 4635 4634 4654 +3 4636 4635 4654 +3 4636 4654 4655 +3 4636 4655 4656 +3 4637 4636 4656 +3 4638 4637 4656 +3 4638 4656 4657 +3 4638 4657 4658 +3 4639 4638 4658 +3 4640 4639 4658 +3 4640 4658 4659 +3 4640 4659 4660 +3 4641 4640 4660 +3 4642 4641 4660 +3 4642 4660 4661 +3 4642 4661 4662 +3 4643 4642 4662 +3 4644 4643 4662 +3 4644 4662 4663 +3 4644 4663 4645 +3 4646 4645 4664 +3 4646 4664 4665 +3 4647 4646 4665 +3 4648 4647 4665 +3 4648 4665 4666 +3 4648 4666 4544 +3 4629 4544 4667 +3 4629 4667 4668 +3 4649 4629 4668 +3 4650 4649 4668 +3 4650 4668 4669 +3 4650 4669 4551 +3 4651 4510 4509 +3 4652 4651 4509 +3 4652 4509 4513 +3 4652 4513 4514 +3 4653 4652 4514 +3 4654 4653 4514 +3 4654 4514 4517 +3 4654 4517 4518 +3 4655 4654 4518 +3 4656 4655 4518 +3 4656 4518 4521 +3 4656 4521 4522 +3 4657 4656 4522 +3 4658 4657 4522 +3 4658 4522 4525 +3 4658 4525 4526 +3 4659 4658 4526 +3 4660 4659 4526 +3 4660 4526 4529 +3 4660 4529 4530 +3 4661 4660 4530 +3 4662 4661 4530 +3 4662 4530 4533 +3 4662 4533 4534 +3 4663 4662 4534 +3 4645 4663 4534 +3 4645 4534 4537 +3 4645 4537 4538 +3 4664 4645 4538 +3 4665 4664 4538 +3 4665 4538 4541 +3 4665 4541 4542 +3 4666 4665 4542 +3 4544 4666 4542 +3 4667 4544 4545 +3 4668 4667 4545 +3 4668 4545 4548 +3 4668 4548 4549 +3 4669 4668 4549 +3 4551 4669 4549 diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/stl/space_invader_magnet.stl b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/stl/space_invader_magnet.stl new file mode 100644 index 0000000..479dce2 --- /dev/null +++ b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/models/stl/space_invader_magnet.stl @@ -0,0 +1,2634 @@ +solid Default + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 5.456000e+00 + vertex -7.086578e+00 2.362057e+00 3.472000e+00 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -7.086578e+00 2.362057e+00 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 5.456000e+00 + vertex -7.086578e+00 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 7.086580e+00 2.362057e+00 3.472000e+00 + vertex 7.086580e+00 2.362057e+00 5.456000e+00 + vertex 7.086580e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 7.086580e+00 -2.362329e+00 3.472000e+00 + vertex 7.086580e+00 2.362057e+00 5.456000e+00 + vertex 7.086580e+00 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 2.362195e+00 -1.653549e+01 5.456000e+00 + vertex 2.362195e+00 -2.125987e+01 5.456000e+00 + vertex 1.181097e+01 -1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 -1.653549e+01 5.456000e+00 + vertex 2.362195e+00 -2.125987e+01 5.456000e+00 + vertex 1.653535e+01 -2.125987e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 -1.653549e+01 5.456000e+00 + vertex 1.653535e+01 -2.125987e+01 5.456000e+00 + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + vertex 1.653535e+01 -2.125987e+01 5.456000e+00 + vertex 1.653535e+01 -1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -7.086578e+00 -2.362329e+00 5.456000e+00 + vertex 7.086580e+00 -2.362329e+00 5.456000e+00 + vertex -7.086578e+00 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -7.086578e+00 2.362057e+00 5.456000e+00 + vertex 7.086580e+00 -2.362329e+00 5.456000e+00 + vertex 7.086580e+00 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 7.086580e+00 7.086444e+00 5.456000e+00 + vertex 1.181097e+01 7.086444e+00 5.456000e+00 + vertex 7.086580e+00 1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 7.086580e+00 1.653549e+01 5.456000e+00 + vertex 1.181097e+01 7.086444e+00 5.456000e+00 + vertex 1.181097e+01 1.181110e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 7.086580e+00 1.653549e+01 5.456000e+00 + vertex 1.181097e+01 1.181110e+01 5.456000e+00 + vertex 1.417316e+01 1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.417316e+01 1.653549e+01 5.456000e+00 + vertex 1.181097e+01 1.181110e+01 5.456000e+00 + vertex 1.653535e+01 1.181110e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.417316e+01 1.653549e+01 5.456000e+00 + vertex 1.653535e+01 1.181110e+01 5.456000e+00 + vertex 1.417316e+01 2.125987e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.417316e+01 2.125987e+01 5.456000e+00 + vertex 1.653535e+01 1.181110e+01 5.456000e+00 + vertex 1.653535e+01 1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.417316e+01 2.125987e+01 5.456000e+00 + vertex 1.653535e+01 1.653549e+01 5.456000e+00 + vertex 2.125974e+01 2.125987e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 2.125974e+01 2.125987e+01 5.456000e+00 + vertex 1.653535e+01 1.653549e+01 5.456000e+00 + vertex 2.125974e+01 1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 2.598412e+01 2.362057e+00 5.456000e+00 + vertex 2.125974e+01 2.362057e+00 5.456000e+00 + vertex 2.598412e+01 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 2.598412e+01 -2.362329e+00 5.456000e+00 + vertex 2.125974e+01 2.362057e+00 5.456000e+00 + vertex 2.125974e+01 -7.086715e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 2.598412e+01 -2.362329e+00 5.456000e+00 + vertex 2.125974e+01 -7.086715e+00 5.456000e+00 + vertex 3.070851e+01 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 3.070851e+01 -2.362329e+00 5.456000e+00 + vertex 2.125974e+01 -7.086715e+00 5.456000e+00 + vertex 2.598412e+01 -7.086715e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 3.070851e+01 -2.362329e+00 5.456000e+00 + vertex 2.598412e+01 -7.086715e+00 5.456000e+00 + vertex 3.070851e+01 -1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 3.070851e+01 -1.653549e+01 5.456000e+00 + vertex 2.598412e+01 -7.086715e+00 5.456000e+00 + vertex 2.598412e+01 -1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.653535e+01 -1.653549e+01 5.456000e+00 + vertex 2.125974e+01 -1.653549e+01 5.456000e+00 + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + vertex 2.125974e+01 -1.653549e+01 5.456000e+00 + vertex 2.125974e+01 -7.086715e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + vertex 2.125974e+01 -7.086715e+00 5.456000e+00 + vertex 1.181097e+01 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 -2.362329e+00 5.456000e+00 + vertex 2.125974e+01 -7.086715e+00 5.456000e+00 + vertex 2.125974e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 -2.362329e+00 5.456000e+00 + vertex 2.125974e+01 2.362057e+00 5.456000e+00 + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + vertex 2.125974e+01 2.362057e+00 5.456000e+00 + vertex 2.125974e+01 7.086444e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 2.125974e+01 7.086444e+00 5.456000e+00 + vertex 1.181097e+01 7.086444e+00 5.456000e+00 + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + vertex 1.181097e+01 7.086444e+00 5.456000e+00 + vertex 7.086580e+00 7.086444e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + vertex 7.086580e+00 7.086444e+00 5.456000e+00 + vertex 7.086580e+00 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 7.086580e+00 2.362057e+00 5.456000e+00 + vertex 7.086580e+00 7.086444e+00 5.456000e+00 + vertex -7.086578e+00 7.086444e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 7.086580e+00 2.362057e+00 5.456000e+00 + vertex -7.086578e+00 7.086444e+00 5.456000e+00 + vertex -7.086578e+00 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.653535e+01 1.653549e+01 5.456000e+00 + vertex -1.653535e+01 1.181110e+01 5.456000e+00 + vertex -1.181097e+01 1.181110e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -2.125974e+01 2.125987e+01 5.456000e+00 + vertex -2.125974e+01 1.653549e+01 5.456000e+00 + vertex -1.417316e+01 2.125987e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.417316e+01 2.125987e+01 5.456000e+00 + vertex -2.125974e+01 1.653549e+01 5.456000e+00 + vertex -1.653535e+01 1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.417316e+01 2.125987e+01 5.456000e+00 + vertex -1.653535e+01 1.653549e+01 5.456000e+00 + vertex -1.417316e+01 1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.417316e+01 1.653549e+01 5.456000e+00 + vertex -1.653535e+01 1.653549e+01 5.456000e+00 + vertex -1.181097e+01 1.181110e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.417316e+01 1.653549e+01 5.456000e+00 + vertex -1.181097e+01 1.181110e+01 5.456000e+00 + vertex -7.086578e+00 1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -7.086578e+00 1.653549e+01 5.456000e+00 + vertex -1.181097e+01 1.181110e+01 5.456000e+00 + vertex -1.181097e+01 7.086444e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -7.086578e+00 1.653549e+01 5.456000e+00 + vertex -1.181097e+01 7.086444e+00 5.456000e+00 + vertex -7.086578e+00 7.086444e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -7.086578e+00 7.086444e+00 5.456000e+00 + vertex -1.181097e+01 7.086444e+00 5.456000e+00 + vertex -1.181097e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -7.086578e+00 7.086444e+00 5.456000e+00 + vertex -1.181097e+01 2.362057e+00 5.456000e+00 + vertex -7.086578e+00 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.653535e+01 -1.653549e+01 5.456000e+00 + vertex -1.653535e+01 -2.125987e+01 5.456000e+00 + vertex -1.181097e+01 -1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.181097e+01 -1.653549e+01 5.456000e+00 + vertex -1.653535e+01 -2.125987e+01 5.456000e+00 + vertex -2.362193e+00 -2.125987e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.181097e+01 -1.653549e+01 5.456000e+00 + vertex -2.362193e+00 -2.125987e+01 5.456000e+00 + vertex -2.362193e+00 -1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -3.070851e+01 -1.653549e+01 5.456000e+00 + vertex -2.598412e+01 -1.653549e+01 5.456000e+00 + vertex -3.070851e+01 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -3.070851e+01 -2.362329e+00 5.456000e+00 + vertex -2.598412e+01 -1.653549e+01 5.456000e+00 + vertex -2.598412e+01 -7.086715e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -3.070851e+01 -2.362329e+00 5.456000e+00 + vertex -2.598412e+01 -7.086715e+00 5.456000e+00 + vertex -2.598412e+01 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -2.598412e+01 -2.362329e+00 5.456000e+00 + vertex -2.598412e+01 -7.086715e+00 5.456000e+00 + vertex -2.125974e+01 -7.086715e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -2.598412e+01 -2.362329e+00 5.456000e+00 + vertex -2.125974e+01 -7.086715e+00 5.456000e+00 + vertex -2.598412e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -2.598412e+01 2.362057e+00 5.456000e+00 + vertex -2.125974e+01 -7.086715e+00 5.456000e+00 + vertex -2.125974e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -2.125974e+01 -1.653549e+01 5.456000e+00 + vertex -1.653535e+01 -1.653549e+01 5.456000e+00 + vertex -2.125974e+01 -7.086715e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -2.125974e+01 -7.086715e+00 5.456000e+00 + vertex -1.653535e+01 -1.653549e+01 5.456000e+00 + vertex -1.181097e+01 -1.653549e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -2.125974e+01 -7.086715e+00 5.456000e+00 + vertex -1.181097e+01 -1.653549e+01 5.456000e+00 + vertex -2.125974e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -2.125974e+01 2.362057e+00 5.456000e+00 + vertex -1.181097e+01 -1.653549e+01 5.456000e+00 + vertex -1.181097e+01 -1.181110e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.181097e+01 7.086444e+00 5.456000e+00 + vertex -2.125974e+01 7.086444e+00 5.456000e+00 + vertex -1.181097e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.181097e+01 2.362057e+00 5.456000e+00 + vertex -2.125974e+01 7.086444e+00 5.456000e+00 + vertex -2.125974e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.181097e+01 2.362057e+00 5.456000e+00 + vertex -2.125974e+01 2.362057e+00 5.456000e+00 + vertex -1.181097e+01 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.181097e+01 -2.362329e+00 5.456000e+00 + vertex -2.125974e+01 2.362057e+00 5.456000e+00 + vertex -1.181097e+01 -1.181110e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -1.181097e+01 -2.362329e+00 5.456000e+00 + vertex -1.181097e+01 -1.181110e+01 5.456000e+00 + vertex -7.086578e+00 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -7.086578e+00 -2.362329e+00 5.456000e+00 + vertex -1.181097e+01 -1.181110e+01 5.456000e+00 + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex -7.086578e+00 -2.362329e+00 5.456000e+00 + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + vertex 7.086580e+00 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 6.123234e-17 1.000000e+00 + outer loop + vertex 7.086580e+00 -2.362329e+00 5.456000e+00 + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + vertex 1.181097e+01 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.866333e+00 2.362057e+00 1.157158e-15 + vertex 6.943716e+00 3.636320e+00 1.079131e-15 + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 6.943716e+00 3.636320e+00 1.079131e-15 + vertex 5.816999e+00 4.734257e+00 1.011902e-15 + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + vertex 5.816999e+00 4.734257e+00 1.011902e-15 + vertex 4.519291e+00 5.623595e+00 9.574459e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + vertex 4.519291e+00 5.623595e+00 9.574459e-16 + vertex 3.088746e+00 6.278193e+00 9.173633e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.653535e+01 1.653549e+01 2.892853e-16 + vertex 1.653535e+01 1.181110e+01 5.785704e-16 + vertex 1.181097e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 9.050850e+00 -3.872648e+00 1.538923e-15 + vertex 9.176000e+00 -2.362329e+00 1.446443e-15 + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.362193e+00 -1.653549e+01 2.314298e-15 + vertex -2.362193e+00 -2.125987e+01 2.603584e-15 + vertex -1.181097e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 -1.653549e+01 2.314298e-15 + vertex -2.362193e+00 -2.125987e+01 2.603584e-15 + vertex -1.653535e+01 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 -1.653549e+01 2.314298e-15 + vertex -1.653535e+01 -2.125987e+01 2.603584e-15 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 7.086444e+00 8.678722e-16 + vertex 2.125974e+01 7.086444e+00 8.678722e-16 + vertex 2.125974e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 2.125974e+01 2.125987e+01 0.000000e+00 + vertex 2.125974e+01 1.653549e+01 2.892853e-16 + vertex 1.417316e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.417316e+01 2.125987e+01 0.000000e+00 + vertex 2.125974e+01 1.653549e+01 2.892853e-16 + vertex 1.653535e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.417316e+01 2.125987e+01 0.000000e+00 + vertex 1.653535e+01 1.653549e+01 2.892853e-16 + vertex 1.417316e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.417316e+01 1.653549e+01 2.892853e-16 + vertex 1.653535e+01 1.653549e+01 2.892853e-16 + vertex 1.181097e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.417316e+01 1.653549e+01 2.892853e-16 + vertex 1.181097e+01 1.181110e+01 5.785704e-16 + vertex 7.086580e+00 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.086580e+00 1.653549e+01 2.892853e-16 + vertex 1.181097e+01 1.181110e+01 5.785704e-16 + vertex 1.181097e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.086580e+00 1.653549e+01 2.892853e-16 + vertex 1.181097e+01 7.086444e+00 8.678722e-16 + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + vertex 1.181097e+01 7.086444e+00 8.678722e-16 + vertex 1.181097e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + vertex 1.181097e+01 2.362057e+00 1.157158e-15 + vertex 7.866333e+00 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 7.086444e+00 8.678722e-16 + vertex 2.125974e+01 2.362057e+00 1.157158e-15 + vertex 1.181097e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 2.362057e+00 1.157158e-15 + vertex 2.125974e+01 2.362057e+00 1.157158e-15 + vertex 2.125974e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 2.362057e+00 1.157158e-15 + vertex 2.125974e+01 -7.086715e+00 1.735728e-15 + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + vertex 2.125974e+01 -7.086715e+00 1.735728e-15 + vertex 2.125974e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + vertex 2.125974e+01 -1.653549e+01 2.314298e-15 + vertex 1.653535e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 3.070851e+01 -1.653549e+01 2.314298e-15 + vertex 2.598412e+01 -1.653549e+01 2.314298e-15 + vertex 3.070851e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 3.070851e+01 -2.362329e+00 1.446443e-15 + vertex 2.598412e+01 -1.653549e+01 2.314298e-15 + vertex 2.598412e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 3.070851e+01 -2.362329e+00 1.446443e-15 + vertex 2.598412e+01 -7.086715e+00 1.735728e-15 + vertex 2.598412e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 2.598412e+01 -2.362329e+00 1.446443e-15 + vertex 2.598412e+01 -7.086715e+00 1.735728e-15 + vertex 2.125974e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 2.598412e+01 -2.362329e+00 1.446443e-15 + vertex 2.125974e+01 -7.086715e+00 1.735728e-15 + vertex 2.598412e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 2.598412e+01 2.362057e+00 1.157158e-15 + vertex 2.125974e+01 -7.086715e+00 1.735728e-15 + vertex 2.125974e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.653535e+01 -2.125987e+01 2.603584e-15 + vertex -1.653535e+01 -1.653549e+01 2.314298e-15 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + vertex -1.653535e+01 -1.653549e+01 2.314298e-15 + vertex -2.125974e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + vertex -2.125974e+01 -1.653549e+01 2.314298e-15 + vertex -2.125974e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 -2.362329e+00 1.446443e-15 + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + vertex -1.181097e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 2.362057e+00 1.157158e-15 + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + vertex -2.125974e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 2.362057e+00 1.157158e-15 + vertex -2.125974e+01 7.086444e+00 8.678722e-16 + vertex -7.866329e+00 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + vertex -1.181097e+01 7.086444e+00 8.678722e-16 + vertex -1.181097e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 3.088746e+00 6.278193e+00 9.173633e-16 + vertex 1.567411e+00 6.678811e+00 8.928326e-16 + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + vertex 1.567411e+00 6.678811e+00 8.928326e-16 + vertex 0.000000e+00 6.813671e+00 8.845748e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + vertex 0.000000e+00 6.813671e+00 8.845748e-16 + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + vertex 0.000000e+00 6.813671e+00 8.845748e-16 + vertex -1.567409e+00 6.678811e+00 8.928326e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + vertex 8.070051e+00 -6.729622e+00 1.713862e-15 + vertex 8.678819e+00 -5.341771e+00 1.628881e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.125974e+01 1.653549e+01 2.892853e-16 + vertex -2.125974e+01 2.125987e+01 0.000000e+00 + vertex -1.653535e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.653535e+01 1.653549e+01 2.892853e-16 + vertex -2.125974e+01 2.125987e+01 0.000000e+00 + vertex -1.417316e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.653535e+01 1.653549e+01 2.892853e-16 + vertex -1.417316e+01 2.125987e+01 0.000000e+00 + vertex -1.653535e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.653535e+01 1.181110e+01 5.785704e-16 + vertex -1.417316e+01 2.125987e+01 0.000000e+00 + vertex -1.417316e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.653535e+01 1.181110e+01 5.785704e-16 + vertex -1.417316e+01 1.653549e+01 2.892853e-16 + vertex -1.181097e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 1.181110e+01 5.785704e-16 + vertex -1.417316e+01 1.653549e+01 2.892853e-16 + vertex -7.086578e+00 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 1.181110e+01 5.785704e-16 + vertex -7.086578e+00 1.653549e+01 2.892853e-16 + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.598412e+01 -1.653549e+01 2.314298e-15 + vertex -3.070851e+01 -1.653549e+01 2.314298e-15 + vertex -2.598412e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.598412e+01 -7.086715e+00 1.735728e-15 + vertex -3.070851e+01 -1.653549e+01 2.314298e-15 + vertex -3.070851e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.598412e+01 -7.086715e+00 1.735728e-15 + vertex -3.070851e+01 -2.362329e+00 1.446443e-15 + vertex -2.125974e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.125974e+01 -7.086715e+00 1.735728e-15 + vertex -3.070851e+01 -2.362329e+00 1.446443e-15 + vertex -2.598412e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.125974e+01 -7.086715e+00 1.735728e-15 + vertex -2.598412e+01 -2.362329e+00 1.446443e-15 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -5.018795e+00 -1.004417e+01 1.916820e-15 + vertex -3.685958e+00 -1.076547e+01 1.960986e-15 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 2.362195e+00 -2.125987e+01 2.603584e-15 + vertex 2.362195e+00 -1.653549e+01 2.314298e-15 + vertex 1.653535e+01 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.653535e+01 -2.125987e+01 2.603584e-15 + vertex 2.362195e+00 -1.653549e+01 2.314298e-15 + vertex 1.181097e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.653535e+01 -2.125987e+01 2.603584e-15 + vertex 1.181097e+01 -1.653549e+01 2.314298e-15 + vertex 1.653535e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.653535e+01 -1.653549e+01 2.314298e-15 + vertex 1.181097e+01 -1.653549e+01 2.314298e-15 + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.653535e+01 -1.653549e+01 2.314298e-15 + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + vertex 8.678819e+00 -5.341771e+00 1.628881e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + vertex 8.678819e+00 -5.341771e+00 1.628881e-15 + vertex 9.050850e+00 -3.872648e+00 1.538923e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -9.176000e+00 -2.362329e+00 1.446443e-15 + vertex -9.050850e+00 -3.872648e+00 1.538923e-15 + vertex -1.181097e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 -2.362329e+00 1.446443e-15 + vertex -9.050850e+00 -3.872648e+00 1.538923e-15 + vertex -8.678817e+00 -5.341771e+00 1.628881e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -6.214736e+00 -9.113332e+00 1.859822e-15 + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + vertex -7.241153e+00 -7.998344e+00 1.791549e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.241153e+00 -7.998344e+00 1.791549e-15 + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + vertex -1.181097e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.241153e+00 -7.998344e+00 1.791549e-15 + vertex -1.181097e+01 -2.362329e+00 1.446443e-15 + vertex -8.070051e+00 -6.729622e+00 1.713862e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -8.070051e+00 -6.729622e+00 1.713862e-15 + vertex -1.181097e+01 -2.362329e+00 1.446443e-15 + vertex -8.678817e+00 -5.341771e+00 1.628881e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.125974e+01 7.086444e+00 8.678722e-16 + vertex -1.181097e+01 7.086444e+00 8.678722e-16 + vertex -7.866329e+00 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.866329e+00 2.362057e+00 1.157158e-15 + vertex -1.181097e+01 7.086444e+00 8.678722e-16 + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.866329e+00 2.362057e+00 1.157158e-15 + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + vertex -6.943716e+00 3.636320e+00 1.079131e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -6.943716e+00 3.636320e+00 1.079131e-15 + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + vertex -5.816997e+00 4.734257e+00 1.011902e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 2.252575e+00 -1.125754e+01 1.991118e-15 + vertex 3.685961e+00 -1.076547e+01 1.960986e-15 + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + vertex 3.685961e+00 -1.076547e+01 1.960986e-15 + vertex 5.018799e+00 -1.004417e+01 1.916820e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.567409e+00 6.678811e+00 8.928326e-16 + vertex -3.088746e+00 6.278193e+00 9.173633e-16 + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + vertex -3.088746e+00 6.278193e+00 9.173633e-16 + vertex -4.519291e+00 5.623595e+00 9.574459e-16 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + vertex -4.519291e+00 5.623595e+00 9.574459e-16 + vertex -5.816997e+00 4.734257e+00 1.011902e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -6.214736e+00 -9.113332e+00 1.859822e-15 + vertex -5.018795e+00 -1.004417e+01 1.916820e-15 + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + vertex -5.018795e+00 -1.004417e+01 1.916820e-15 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + vertex -2.598412e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.598412e+01 2.362057e+00 1.157158e-15 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + vertex -2.598412e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -3.685958e+00 -1.076547e+01 1.960986e-15 + vertex -2.252575e+00 -1.125754e+01 1.991118e-15 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + vertex -2.252575e+00 -1.125754e+01 1.991118e-15 + vertex -7.577479e-01 -1.150699e+01 2.006392e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + vertex -7.577479e-01 -1.150699e+01 2.006392e-15 + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + vertex -7.577479e-01 -1.150699e+01 2.006392e-15 + vertex 7.577479e-01 -1.150699e+01 2.006392e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + vertex 7.577479e-01 -1.150699e+01 2.006392e-15 + vertex 2.252575e+00 -1.125754e+01 1.991118e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 5.018799e+00 -1.004417e+01 1.916820e-15 + vertex 6.214739e+00 -9.113332e+00 1.859822e-15 + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + vertex 6.214739e+00 -9.113332e+00 1.859822e-15 + vertex 7.241153e+00 -7.998344e+00 1.791549e-15 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + vertex 7.241153e+00 -7.998344e+00 1.791549e-15 + vertex 8.070051e+00 -6.729622e+00 1.713862e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 2.598412e+01 -2.362329e+00 5.456000e+00 + vertex 3.070851e+01 -2.362329e+00 5.456000e+00 + vertex 2.598412e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 2.598412e+01 -2.362329e+00 1.446443e-15 + vertex 3.070851e+01 -2.362329e+00 5.456000e+00 + vertex 3.070851e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.598412e+01 2.362057e+00 5.456000e+00 + vertex 2.598412e+01 -2.362329e+00 5.456000e+00 + vertex 2.598412e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.598412e+01 2.362057e+00 1.157158e-15 + vertex 2.598412e+01 -2.362329e+00 5.456000e+00 + vertex 2.598412e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 2.125974e+01 2.362057e+00 5.456000e+00 + vertex 2.598412e+01 2.362057e+00 5.456000e+00 + vertex 2.125974e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 2.125974e+01 2.362057e+00 1.157158e-15 + vertex 2.598412e+01 2.362057e+00 5.456000e+00 + vertex 2.598412e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.125974e+01 7.086444e+00 5.456000e+00 + vertex 2.125974e+01 2.362057e+00 5.456000e+00 + vertex 2.125974e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.125974e+01 7.086444e+00 8.678722e-16 + vertex 2.125974e+01 2.362057e+00 5.456000e+00 + vertex 2.125974e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 1.181097e+01 7.086444e+00 5.456000e+00 + vertex 2.125974e+01 7.086444e+00 5.456000e+00 + vertex 1.181097e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 1.181097e+01 7.086444e+00 8.678722e-16 + vertex 2.125974e+01 7.086444e+00 5.456000e+00 + vertex 2.125974e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.181097e+01 1.181110e+01 5.456000e+00 + vertex 1.181097e+01 7.086444e+00 5.456000e+00 + vertex 1.181097e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.181097e+01 1.181110e+01 5.785704e-16 + vertex 1.181097e+01 7.086444e+00 5.456000e+00 + vertex 1.181097e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 1.653535e+01 1.181110e+01 5.456000e+00 + vertex 1.181097e+01 1.181110e+01 5.456000e+00 + vertex 1.653535e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 1.653535e+01 1.181110e+01 5.785704e-16 + vertex 1.181097e+01 1.181110e+01 5.456000e+00 + vertex 1.181097e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.653535e+01 1.653549e+01 5.456000e+00 + vertex 1.653535e+01 1.181110e+01 5.456000e+00 + vertex 1.653535e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.653535e+01 1.653549e+01 2.892853e-16 + vertex 1.653535e+01 1.181110e+01 5.456000e+00 + vertex 1.653535e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 2.125974e+01 1.653549e+01 5.456000e+00 + vertex 1.653535e+01 1.653549e+01 5.456000e+00 + vertex 2.125974e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 2.125974e+01 1.653549e+01 2.892853e-16 + vertex 1.653535e+01 1.653549e+01 5.456000e+00 + vertex 1.653535e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.125974e+01 2.125987e+01 5.456000e+00 + vertex 2.125974e+01 1.653549e+01 5.456000e+00 + vertex 2.125974e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.125974e+01 2.125987e+01 0.000000e+00 + vertex 2.125974e+01 1.653549e+01 5.456000e+00 + vertex 2.125974e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 1.417316e+01 2.125987e+01 5.456000e+00 + vertex 2.125974e+01 2.125987e+01 5.456000e+00 + vertex 1.417316e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 1.417316e+01 2.125987e+01 0.000000e+00 + vertex 2.125974e+01 2.125987e+01 5.456000e+00 + vertex 2.125974e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.417316e+01 1.653549e+01 5.456000e+00 + vertex 1.417316e+01 2.125987e+01 5.456000e+00 + vertex 1.417316e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.417316e+01 1.653549e+01 2.892853e-16 + vertex 1.417316e+01 2.125987e+01 5.456000e+00 + vertex 1.417316e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 7.086580e+00 1.653549e+01 5.456000e+00 + vertex 1.417316e+01 1.653549e+01 5.456000e+00 + vertex 7.086580e+00 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 7.086580e+00 1.653549e+01 2.892853e-16 + vertex 1.417316e+01 1.653549e+01 5.456000e+00 + vertex 1.417316e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 7.086580e+00 7.086444e+00 5.456000e+00 + vertex 7.086580e+00 1.653549e+01 5.456000e+00 + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + vertex 7.086580e+00 1.653549e+01 5.456000e+00 + vertex 7.086580e+00 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -7.086578e+00 7.086444e+00 5.456000e+00 + vertex 7.086580e+00 7.086444e+00 5.456000e+00 + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + vertex 7.086580e+00 7.086444e+00 5.456000e+00 + vertex 7.086580e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -7.086578e+00 1.653549e+01 5.456000e+00 + vertex -7.086578e+00 7.086444e+00 5.456000e+00 + vertex -7.086578e+00 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -7.086578e+00 1.653549e+01 2.892853e-16 + vertex -7.086578e+00 7.086444e+00 5.456000e+00 + vertex -7.086578e+00 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -1.417316e+01 1.653549e+01 5.456000e+00 + vertex -7.086578e+00 1.653549e+01 5.456000e+00 + vertex -1.417316e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -1.417316e+01 1.653549e+01 2.892853e-16 + vertex -7.086578e+00 1.653549e+01 5.456000e+00 + vertex -7.086578e+00 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.417316e+01 2.125987e+01 5.456000e+00 + vertex -1.417316e+01 1.653549e+01 5.456000e+00 + vertex -1.417316e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.417316e+01 2.125987e+01 0.000000e+00 + vertex -1.417316e+01 1.653549e+01 5.456000e+00 + vertex -1.417316e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -2.125974e+01 2.125987e+01 5.456000e+00 + vertex -1.417316e+01 2.125987e+01 5.456000e+00 + vertex -2.125974e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -2.125974e+01 2.125987e+01 0.000000e+00 + vertex -1.417316e+01 2.125987e+01 5.456000e+00 + vertex -1.417316e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.125974e+01 1.653549e+01 5.456000e+00 + vertex -2.125974e+01 2.125987e+01 5.456000e+00 + vertex -2.125974e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.125974e+01 1.653549e+01 2.892853e-16 + vertex -2.125974e+01 2.125987e+01 5.456000e+00 + vertex -2.125974e+01 2.125987e+01 0.000000e+00 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -1.653535e+01 1.653549e+01 5.456000e+00 + vertex -2.125974e+01 1.653549e+01 5.456000e+00 + vertex -1.653535e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -1.653535e+01 1.653549e+01 2.892853e-16 + vertex -2.125974e+01 1.653549e+01 5.456000e+00 + vertex -2.125974e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.653535e+01 1.181110e+01 5.456000e+00 + vertex -1.653535e+01 1.653549e+01 5.456000e+00 + vertex -1.653535e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.653535e+01 1.181110e+01 5.785704e-16 + vertex -1.653535e+01 1.653549e+01 5.456000e+00 + vertex -1.653535e+01 1.653549e+01 2.892853e-16 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -1.181097e+01 1.181110e+01 5.456000e+00 + vertex -1.653535e+01 1.181110e+01 5.456000e+00 + vertex -1.181097e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -1.181097e+01 1.181110e+01 5.785704e-16 + vertex -1.653535e+01 1.181110e+01 5.456000e+00 + vertex -1.653535e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.181097e+01 7.086444e+00 5.456000e+00 + vertex -1.181097e+01 1.181110e+01 5.456000e+00 + vertex -1.181097e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.181097e+01 7.086444e+00 8.678722e-16 + vertex -1.181097e+01 1.181110e+01 5.456000e+00 + vertex -1.181097e+01 1.181110e+01 5.785704e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -2.125974e+01 7.086444e+00 5.456000e+00 + vertex -1.181097e+01 7.086444e+00 5.456000e+00 + vertex -2.125974e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -2.125974e+01 7.086444e+00 8.678722e-16 + vertex -1.181097e+01 7.086444e+00 5.456000e+00 + vertex -1.181097e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.125974e+01 2.362057e+00 5.456000e+00 + vertex -2.125974e+01 7.086444e+00 5.456000e+00 + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + vertex -2.125974e+01 7.086444e+00 5.456000e+00 + vertex -2.125974e+01 7.086444e+00 8.678722e-16 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -2.598412e+01 2.362057e+00 5.456000e+00 + vertex -2.125974e+01 2.362057e+00 5.456000e+00 + vertex -2.598412e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -2.598412e+01 2.362057e+00 1.157158e-15 + vertex -2.125974e+01 2.362057e+00 5.456000e+00 + vertex -2.125974e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.598412e+01 -2.362329e+00 5.456000e+00 + vertex -2.598412e+01 2.362057e+00 5.456000e+00 + vertex -2.598412e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.598412e+01 -2.362329e+00 1.446443e-15 + vertex -2.598412e+01 2.362057e+00 5.456000e+00 + vertex -2.598412e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -3.070851e+01 -2.362329e+00 5.456000e+00 + vertex -2.598412e+01 -2.362329e+00 5.456000e+00 + vertex -3.070851e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -3.070851e+01 -2.362329e+00 1.446443e-15 + vertex -2.598412e+01 -2.362329e+00 5.456000e+00 + vertex -2.598412e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -3.070851e+01 -1.653549e+01 5.456000e+00 + vertex -3.070851e+01 -2.362329e+00 5.456000e+00 + vertex -3.070851e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -3.070851e+01 -1.653549e+01 2.314298e-15 + vertex -3.070851e+01 -2.362329e+00 5.456000e+00 + vertex -3.070851e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -2.598412e+01 -1.653549e+01 5.456000e+00 + vertex -3.070851e+01 -1.653549e+01 5.456000e+00 + vertex -2.598412e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -2.598412e+01 -1.653549e+01 2.314298e-15 + vertex -3.070851e+01 -1.653549e+01 5.456000e+00 + vertex -3.070851e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.598412e+01 -7.086715e+00 5.456000e+00 + vertex -2.598412e+01 -1.653549e+01 5.456000e+00 + vertex -2.598412e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.598412e+01 -7.086715e+00 1.735728e-15 + vertex -2.598412e+01 -1.653549e+01 5.456000e+00 + vertex -2.598412e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -2.125974e+01 -7.086715e+00 5.456000e+00 + vertex -2.598412e+01 -7.086715e+00 5.456000e+00 + vertex -2.125974e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -2.125974e+01 -7.086715e+00 1.735728e-15 + vertex -2.598412e+01 -7.086715e+00 5.456000e+00 + vertex -2.598412e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.125974e+01 -1.653549e+01 5.456000e+00 + vertex -2.125974e+01 -7.086715e+00 5.456000e+00 + vertex -2.125974e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.125974e+01 -1.653549e+01 2.314298e-15 + vertex -2.125974e+01 -7.086715e+00 5.456000e+00 + vertex -2.125974e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -1.653535e+01 -1.653549e+01 5.456000e+00 + vertex -2.125974e+01 -1.653549e+01 5.456000e+00 + vertex -1.653535e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -1.653535e+01 -1.653549e+01 2.314298e-15 + vertex -2.125974e+01 -1.653549e+01 5.456000e+00 + vertex -2.125974e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.653535e+01 -2.125987e+01 5.456000e+00 + vertex -1.653535e+01 -1.653549e+01 5.456000e+00 + vertex -1.653535e+01 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.653535e+01 -2.125987e+01 2.603584e-15 + vertex -1.653535e+01 -1.653549e+01 5.456000e+00 + vertex -1.653535e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -2.362193e+00 -2.125987e+01 5.456000e+00 + vertex -1.653535e+01 -2.125987e+01 5.456000e+00 + vertex -2.362193e+00 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -2.362193e+00 -2.125987e+01 2.603584e-15 + vertex -1.653535e+01 -2.125987e+01 5.456000e+00 + vertex -1.653535e+01 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.362193e+00 -1.653549e+01 5.456000e+00 + vertex -2.362193e+00 -2.125987e+01 5.456000e+00 + vertex -2.362193e+00 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -2.362193e+00 -1.653549e+01 2.314298e-15 + vertex -2.362193e+00 -2.125987e+01 5.456000e+00 + vertex -2.362193e+00 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -1.181097e+01 -1.653549e+01 5.456000e+00 + vertex -2.362193e+00 -1.653549e+01 5.456000e+00 + vertex -1.181097e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -1.181097e+01 -1.653549e+01 2.314298e-15 + vertex -2.362193e+00 -1.653549e+01 5.456000e+00 + vertex -2.362193e+00 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.181097e+01 -1.181110e+01 5.456000e+00 + vertex -1.181097e+01 -1.653549e+01 5.456000e+00 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + vertex -1.181097e+01 -1.653549e+01 5.456000e+00 + vertex -1.181097e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + vertex -1.181097e+01 -1.181110e+01 5.456000e+00 + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + vertex -1.181097e+01 -1.181110e+01 5.456000e+00 + vertex -1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.181097e+01 -1.653549e+01 5.456000e+00 + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + vertex 1.181097e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.181097e+01 -1.653549e+01 2.314298e-15 + vertex 1.181097e+01 -1.181110e+01 5.456000e+00 + vertex 1.181097e+01 -1.181110e+01 2.025013e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 2.362195e+00 -1.653549e+01 5.456000e+00 + vertex 1.181097e+01 -1.653549e+01 5.456000e+00 + vertex 2.362195e+00 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 2.362195e+00 -1.653549e+01 2.314298e-15 + vertex 1.181097e+01 -1.653549e+01 5.456000e+00 + vertex 1.181097e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.362195e+00 -2.125987e+01 5.456000e+00 + vertex 2.362195e+00 -1.653549e+01 5.456000e+00 + vertex 2.362195e+00 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.362195e+00 -2.125987e+01 2.603584e-15 + vertex 2.362195e+00 -1.653549e+01 5.456000e+00 + vertex 2.362195e+00 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 1.653535e+01 -2.125987e+01 5.456000e+00 + vertex 2.362195e+00 -2.125987e+01 5.456000e+00 + vertex 1.653535e+01 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 1.653535e+01 -2.125987e+01 2.603584e-15 + vertex 2.362195e+00 -2.125987e+01 5.456000e+00 + vertex 2.362195e+00 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.653535e+01 -1.653549e+01 5.456000e+00 + vertex 1.653535e+01 -2.125987e+01 5.456000e+00 + vertex 1.653535e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.653535e+01 -1.653549e+01 2.314298e-15 + vertex 1.653535e+01 -2.125987e+01 5.456000e+00 + vertex 1.653535e+01 -2.125987e+01 2.603584e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 2.125974e+01 -1.653549e+01 5.456000e+00 + vertex 1.653535e+01 -1.653549e+01 5.456000e+00 + vertex 2.125974e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 2.125974e+01 -1.653549e+01 2.314298e-15 + vertex 1.653535e+01 -1.653549e+01 5.456000e+00 + vertex 1.653535e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.125974e+01 -7.086715e+00 5.456000e+00 + vertex 2.125974e+01 -1.653549e+01 5.456000e+00 + vertex 2.125974e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.125974e+01 -7.086715e+00 1.735728e-15 + vertex 2.125974e+01 -1.653549e+01 5.456000e+00 + vertex 2.125974e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 2.598412e+01 -7.086715e+00 5.456000e+00 + vertex 2.125974e+01 -7.086715e+00 5.456000e+00 + vertex 2.598412e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 2.598412e+01 -7.086715e+00 1.735728e-15 + vertex 2.125974e+01 -7.086715e+00 5.456000e+00 + vertex 2.125974e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.598412e+01 -1.653549e+01 5.456000e+00 + vertex 2.598412e+01 -7.086715e+00 5.456000e+00 + vertex 2.598412e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 2.598412e+01 -1.653549e+01 2.314298e-15 + vertex 2.598412e+01 -7.086715e+00 5.456000e+00 + vertex 2.598412e+01 -7.086715e+00 1.735728e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 3.070851e+01 -1.653549e+01 5.456000e+00 + vertex 2.598412e+01 -1.653549e+01 5.456000e+00 + vertex 3.070851e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 3.070851e+01 -1.653549e+01 2.314298e-15 + vertex 2.598412e+01 -1.653549e+01 5.456000e+00 + vertex 2.598412e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 3.070851e+01 -2.362329e+00 5.456000e+00 + vertex 3.070851e+01 -1.653549e+01 5.456000e+00 + vertex 3.070851e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 3.070851e+01 -2.362329e+00 1.446443e-15 + vertex 3.070851e+01 -1.653549e+01 5.456000e+00 + vertex 3.070851e+01 -1.653549e+01 2.314298e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -7.086578e+00 2.362057e+00 3.472000e+00 + vertex -7.086578e+00 2.362057e+00 5.456000e+00 + vertex -7.866329e+00 2.362057e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -7.866329e+00 2.362057e+00 3.472000e+00 + vertex -7.086578e+00 2.362057e+00 5.456000e+00 + vertex -1.181097e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -7.866329e+00 2.362057e+00 3.472000e+00 + vertex -1.181097e+01 2.362057e+00 5.456000e+00 + vertex -7.866329e+00 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex -7.866329e+00 2.362057e+00 1.157158e-15 + vertex -1.181097e+01 2.362057e+00 5.456000e+00 + vertex -1.181097e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.181097e+01 2.362057e+00 5.456000e+00 + vertex -1.181097e+01 -2.362329e+00 5.456000e+00 + vertex -1.181097e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex -1.181097e+01 2.362057e+00 1.157158e-15 + vertex -1.181097e+01 -2.362329e+00 5.456000e+00 + vertex -1.181097e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -9.176000e+00 -2.362329e+00 1.446443e-15 + vertex -1.181097e+01 -2.362329e+00 1.446443e-15 + vertex -9.176000e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -9.176000e+00 -2.362329e+00 3.472000e+00 + vertex -1.181097e+01 -2.362329e+00 1.446443e-15 + vertex -1.181097e+01 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -9.176000e+00 -2.362329e+00 3.472000e+00 + vertex -1.181097e+01 -2.362329e+00 5.456000e+00 + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + vertex -1.181097e+01 -2.362329e+00 5.456000e+00 + vertex -7.086578e+00 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.181097e+01 -2.362329e+00 5.456000e+00 + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal -1.000000e+00 0.000000e+00 0.000000e+00 + outer loop + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + vertex 1.181097e+01 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 7.866333e+00 2.362057e+00 1.157158e-15 + vertex 1.181097e+01 2.362057e+00 1.157158e-15 + vertex 7.866333e+00 2.362057e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 7.866333e+00 2.362057e+00 3.472000e+00 + vertex 1.181097e+01 2.362057e+00 1.157158e-15 + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 7.866333e+00 2.362057e+00 3.472000e+00 + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + vertex 7.086580e+00 2.362057e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -1.000000e+00 6.123234e-17 + outer loop + vertex 7.086580e+00 2.362057e+00 3.472000e+00 + vertex 1.181097e+01 2.362057e+00 5.456000e+00 + vertex 7.086580e+00 2.362057e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 7.086580e+00 -2.362329e+00 3.472000e+00 + vertex 7.086580e+00 -2.362329e+00 5.456000e+00 + vertex 9.176000e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 9.176000e+00 -2.362329e+00 3.472000e+00 + vertex 7.086580e+00 -2.362329e+00 5.456000e+00 + vertex 1.181097e+01 -2.362329e+00 5.456000e+00 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 9.176000e+00 -2.362329e+00 3.472000e+00 + vertex 1.181097e+01 -2.362329e+00 5.456000e+00 + vertex 9.176000e+00 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 0.000000e+00 1.000000e+00 -6.123234e-17 + outer loop + vertex 9.176000e+00 -2.362329e+00 1.446443e-15 + vertex 1.181097e+01 -2.362329e+00 5.456000e+00 + vertex 1.181097e+01 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 8.264604e-01 -5.629948e-01 3.447349e-17 + outer loop + vertex -7.866329e+00 2.362057e+00 3.472000e+00 + vertex -7.866329e+00 2.362057e+00 1.157158e-15 + vertex -6.943716e+00 3.636320e+00 1.079131e-15 + endloop + endfacet + facet normal 7.928349e-01 -6.094364e-01 3.731721e-17 + outer loop + vertex -7.866329e+00 2.362057e+00 3.472000e+00 + vertex -6.943716e+00 3.636320e+00 1.079131e-15 + vertex -6.943716e+00 3.636320e+00 3.472000e+00 + endloop + endfacet + facet normal 7.181453e-01 -6.958932e-01 4.261117e-17 + outer loop + vertex -6.943716e+00 3.636320e+00 3.472000e+00 + vertex -6.943716e+00 3.636320e+00 1.079131e-15 + vertex -5.816997e+00 4.734257e+00 1.011902e-15 + endloop + endfacet + facet normal 6.770810e-01 -7.359086e-01 4.506141e-17 + outer loop + vertex -6.943716e+00 3.636320e+00 3.472000e+00 + vertex -5.816997e+00 4.734257e+00 1.011902e-15 + vertex -5.816997e+00 4.734257e+00 3.472000e+00 + endloop + endfacet + facet normal 5.887207e-01 -8.083366e-01 4.949634e-17 + outer loop + vertex -5.816997e+00 4.734257e+00 3.472000e+00 + vertex -5.816997e+00 4.734257e+00 1.011902e-15 + vertex -4.519291e+00 5.623595e+00 9.574459e-16 + endloop + endfacet + facet normal 5.414247e-01 -8.407493e-01 5.148104e-17 + outer loop + vertex -5.816997e+00 4.734257e+00 3.472000e+00 + vertex -4.519291e+00 5.623595e+00 9.574459e-16 + vertex -4.519291e+00 5.623595e+00 3.472000e+00 + endloop + endfacet + facet normal 4.419912e-01 -8.970194e-01 5.492660e-17 + outer loop + vertex -4.519291e+00 5.623595e+00 3.472000e+00 + vertex -4.519291e+00 5.623595e+00 9.574459e-16 + vertex -3.088746e+00 6.278193e+00 9.173633e-16 + endloop + endfacet + facet normal 3.898538e-01 -9.208769e-01 5.638744e-17 + outer loop + vertex -4.519291e+00 5.623595e+00 3.472000e+00 + vertex -3.088746e+00 6.278193e+00 9.173633e-16 + vertex -3.088746e+00 6.278193e+00 3.472000e+00 + endloop + endfacet + facet normal 2.822698e-01 -9.593350e-01 5.874233e-17 + outer loop + vertex -3.088746e+00 6.278193e+00 3.472000e+00 + vertex -3.088746e+00 6.278193e+00 9.173633e-16 + vertex -1.567409e+00 6.678811e+00 8.928326e-16 + endloop + endfacet + facet normal 2.268233e-01 -9.739359e-01 5.963637e-17 + outer loop + vertex -3.088746e+00 6.278193e+00 3.472000e+00 + vertex -1.567409e+00 6.678811e+00 8.928326e-16 + vertex -1.567409e+00 6.678811e+00 3.472000e+00 + endloop + endfacet + facet normal 1.142512e-01 -9.934519e-01 6.083139e-17 + outer loop + vertex -1.567409e+00 6.678811e+00 3.472000e+00 + vertex -1.567409e+00 6.678811e+00 8.928326e-16 + vertex 0.000000e+00 6.813671e+00 8.845748e-16 + endloop + endfacet + facet normal 5.712563e-02 -9.983670e-01 6.113235e-17 + outer loop + vertex -1.567409e+00 6.678811e+00 3.472000e+00 + vertex 0.000000e+00 6.813671e+00 8.845748e-16 + vertex 0.000000e+00 6.813671e+00 3.472000e+00 + endloop + endfacet + facet normal -5.712563e-02 -9.983670e-01 6.113235e-17 + outer loop + vertex 0.000000e+00 6.813671e+00 3.472000e+00 + vertex 0.000000e+00 6.813671e+00 8.845748e-16 + vertex 1.567411e+00 6.678811e+00 8.928326e-16 + endloop + endfacet + facet normal -1.142512e-01 -9.934519e-01 6.083139e-17 + outer loop + vertex 0.000000e+00 6.813671e+00 3.472000e+00 + vertex 1.567411e+00 6.678811e+00 8.928326e-16 + vertex 1.567411e+00 6.678811e+00 3.472000e+00 + endloop + endfacet + facet normal -2.268233e-01 -9.739359e-01 5.963637e-17 + outer loop + vertex 1.567411e+00 6.678811e+00 3.472000e+00 + vertex 1.567411e+00 6.678811e+00 8.928326e-16 + vertex 3.088746e+00 6.278193e+00 9.173633e-16 + endloop + endfacet + facet normal -2.822698e-01 -9.593350e-01 5.874233e-17 + outer loop + vertex 1.567411e+00 6.678811e+00 3.472000e+00 + vertex 3.088746e+00 6.278193e+00 9.173633e-16 + vertex 3.088746e+00 6.278193e+00 3.472000e+00 + endloop + endfacet + facet normal -3.898537e-01 -9.208769e-01 5.638744e-17 + outer loop + vertex 3.088746e+00 6.278193e+00 3.472000e+00 + vertex 3.088746e+00 6.278193e+00 9.173633e-16 + vertex 4.519291e+00 5.623595e+00 9.574459e-16 + endloop + endfacet + facet normal -4.419912e-01 -8.970194e-01 5.492660e-17 + outer loop + vertex 3.088746e+00 6.278193e+00 3.472000e+00 + vertex 4.519291e+00 5.623595e+00 9.574459e-16 + vertex 4.519291e+00 5.623595e+00 3.472000e+00 + endloop + endfacet + facet normal -5.414248e-01 -8.407493e-01 5.148104e-17 + outer loop + vertex 4.519291e+00 5.623595e+00 3.472000e+00 + vertex 4.519291e+00 5.623595e+00 9.574459e-16 + vertex 5.816999e+00 4.734257e+00 1.011902e-15 + endloop + endfacet + facet normal -5.887207e-01 -8.083366e-01 4.949634e-17 + outer loop + vertex 4.519291e+00 5.623595e+00 3.472000e+00 + vertex 5.816999e+00 4.734257e+00 1.011902e-15 + vertex 5.816999e+00 4.734257e+00 3.472000e+00 + endloop + endfacet + facet normal -6.770810e-01 -7.359086e-01 4.506141e-17 + outer loop + vertex 5.816999e+00 4.734257e+00 3.472000e+00 + vertex 5.816999e+00 4.734257e+00 1.011902e-15 + vertex 6.943716e+00 3.636320e+00 1.079131e-15 + endloop + endfacet + facet normal -7.181453e-01 -6.958932e-01 4.261117e-17 + outer loop + vertex 5.816999e+00 4.734257e+00 3.472000e+00 + vertex 6.943716e+00 3.636320e+00 1.079131e-15 + vertex 6.943716e+00 3.636320e+00 3.472000e+00 + endloop + endfacet + facet normal -7.928349e-01 -6.094364e-01 3.731721e-17 + outer loop + vertex 6.943716e+00 3.636320e+00 3.472000e+00 + vertex 6.943716e+00 3.636320e+00 1.079131e-15 + vertex 7.866333e+00 2.362057e+00 1.157158e-15 + endloop + endfacet + facet normal -8.264605e-01 -5.629948e-01 3.447349e-17 + outer loop + vertex 6.943716e+00 3.636320e+00 3.472000e+00 + vertex 7.866333e+00 2.362057e+00 1.157158e-15 + vertex 7.866333e+00 2.362057e+00 3.472000e+00 + endloop + endfacet + facet normal -9.984846e-01 5.503191e-02 -3.369733e-18 + outer loop + vertex 9.176000e+00 -2.362329e+00 3.472000e+00 + vertex 9.176000e+00 -2.362329e+00 1.446443e-15 + vertex 9.050850e+00 -3.872648e+00 1.538923e-15 + endloop + endfacet + facet normal -9.939246e-01 1.100638e-01 -6.739466e-18 + outer loop + vertex 9.176000e+00 -2.362329e+00 3.472000e+00 + vertex 9.050850e+00 -3.872648e+00 1.538923e-15 + vertex 9.050850e+00 -3.872648e+00 3.472000e+00 + endloop + endfacet + facet normal -9.758086e-01 2.186265e-01 -1.338701e-17 + outer loop + vertex 9.050850e+00 -3.872648e+00 3.472000e+00 + vertex 9.050850e+00 -3.872648e+00 1.538923e-15 + vertex 8.678819e+00 -5.341771e+00 1.628881e-15 + endloop + endfacet + facet normal -9.622528e-01 2.721573e-01 -1.666483e-17 + outer loop + vertex 9.050850e+00 -3.872648e+00 3.472000e+00 + vertex 8.678819e+00 -5.341771e+00 1.628881e-15 + vertex 8.678819e+00 -5.341771e+00 3.472000e+00 + endloop + endfacet + facet normal -9.265151e-01 3.762575e-01 -2.303913e-17 + outer loop + vertex 8.678819e+00 -5.341771e+00 3.472000e+00 + vertex 8.678819e+00 -5.341771e+00 1.628881e-15 + vertex 8.070051e+00 -6.729622e+00 1.713862e-15 + endloop + endfacet + facet normal -9.043332e-01 4.268270e-01 -2.613562e-17 + outer loop + vertex 8.678819e+00 -5.341771e+00 3.472000e+00 + vertex 8.070051e+00 -6.729622e+00 1.713862e-15 + vertex 8.070051e+00 -6.729622e+00 3.472000e+00 + endloop + endfacet + facet normal -8.519487e-01 5.236253e-01 -3.206280e-17 + outer loop + vertex 8.070051e+00 -6.729622e+00 3.472000e+00 + vertex 8.070051e+00 -6.729622e+00 1.713862e-15 + vertex 7.241153e+00 -7.998344e+00 1.791549e-15 + endloop + endfacet + facet normal -8.217459e-01 5.698540e-01 -3.489350e-17 + outer loop + vertex 8.070051e+00 -6.729622e+00 3.472000e+00 + vertex 7.241153e+00 -7.998344e+00 1.791549e-15 + vertex 7.241153e+00 -7.998344e+00 3.472000e+00 + endloop + endfacet + facet normal -7.541434e-01 6.567098e-01 -4.021188e-17 + outer loop + vertex 7.241153e+00 -7.998344e+00 3.472000e+00 + vertex 7.241153e+00 -7.998344e+00 1.791549e-15 + vertex 6.214739e+00 -9.113332e+00 1.859822e-15 + endloop + endfacet + facet normal -7.167435e-01 6.973369e-01 -4.269957e-17 + outer loop + vertex 7.241153e+00 -7.998344e+00 3.472000e+00 + vertex 6.214739e+00 -9.113332e+00 1.859822e-15 + vertex 6.214739e+00 -9.113332e+00 3.472000e+00 + endloop + endfacet + facet normal -6.357669e-01 7.718811e-01 -4.726408e-17 + outer loop + vertex 6.214739e+00 -9.113332e+00 3.472000e+00 + vertex 6.214739e+00 -9.113332e+00 1.859822e-15 + vertex 5.018799e+00 -1.004417e+01 1.916820e-15 + endloop + endfacet + facet normal -5.921901e-01 8.057982e-01 -4.934091e-17 + outer loop + vertex 6.214739e+00 -9.113332e+00 3.472000e+00 + vertex 5.018799e+00 -1.004417e+01 1.916820e-15 + vertex 5.018799e+00 -1.004417e+01 3.472000e+00 + endloop + endfacet + facet normal -5.000484e-01 8.659974e-01 -5.302705e-17 + outer loop + vertex 5.018799e+00 -1.004417e+01 3.472000e+00 + vertex 5.018799e+00 -1.004417e+01 1.916820e-15 + vertex 3.685961e+00 -1.076547e+01 1.960986e-15 + endloop + endfacet + facet normal -4.514834e-01 8.922795e-01 -5.463636e-17 + outer loop + vertex 5.018799e+00 -1.004417e+01 3.472000e+00 + vertex 3.685961e+00 -1.076547e+01 1.960986e-15 + vertex 3.685961e+00 -1.076547e+01 3.472000e+00 + endloop + endfacet + facet normal -3.506899e-01 9.364916e-01 -5.734357e-17 + outer loop + vertex 3.685961e+00 -1.076547e+01 3.472000e+00 + vertex 3.685961e+00 -1.076547e+01 1.960986e-15 + vertex 2.252575e+00 -1.125754e+01 1.991118e-15 + endloop + endfacet + facet normal -2.984614e-01 9.544217e-01 -5.844147e-17 + outer loop + vertex 3.685961e+00 -1.076547e+01 3.472000e+00 + vertex 2.252575e+00 -1.125754e+01 1.991118e-15 + vertex 2.252575e+00 -1.125754e+01 3.472000e+00 + endloop + endfacet + facet normal -1.917655e-01 9.814408e-01 -6.009592e-17 + outer loop + vertex 2.252575e+00 -1.125754e+01 3.472000e+00 + vertex 2.252575e+00 -1.125754e+01 1.991118e-15 + vertex 7.577479e-01 -1.150699e+01 2.006392e-15 + endloop + endfacet + facet normal -1.372982e-01 9.905298e-01 -6.065246e-17 + outer loop + vertex 2.252575e+00 -1.125754e+01 3.472000e+00 + vertex 7.577479e-01 -1.150699e+01 2.006392e-15 + vertex 7.577479e-01 -1.150699e+01 3.472000e+00 + endloop + endfacet + facet normal -2.761026e-02 9.996187e-01 -6.120900e-17 + outer loop + vertex 7.577479e-01 -1.150699e+01 3.472000e+00 + vertex 7.577479e-01 -1.150699e+01 2.006392e-15 + vertex -7.577479e-01 -1.150699e+01 2.006392e-15 + endloop + endfacet + facet normal 2.761026e-02 9.996187e-01 -6.120900e-17 + outer loop + vertex 7.577479e-01 -1.150699e+01 3.472000e+00 + vertex -7.577479e-01 -1.150699e+01 2.006392e-15 + vertex -7.577479e-01 -1.150699e+01 3.472000e+00 + endloop + endfacet + facet normal 1.372982e-01 9.905298e-01 -6.065246e-17 + outer loop + vertex -7.577479e-01 -1.150699e+01 3.472000e+00 + vertex -7.577479e-01 -1.150699e+01 2.006392e-15 + vertex -2.252575e+00 -1.125754e+01 1.991118e-15 + endloop + endfacet + facet normal 1.917655e-01 9.814408e-01 -6.009592e-17 + outer loop + vertex -7.577479e-01 -1.150699e+01 3.472000e+00 + vertex -2.252575e+00 -1.125754e+01 1.991118e-15 + vertex -2.252575e+00 -1.125754e+01 3.472000e+00 + endloop + endfacet + facet normal 2.984614e-01 9.544217e-01 -5.844147e-17 + outer loop + vertex -2.252575e+00 -1.125754e+01 3.472000e+00 + vertex -2.252575e+00 -1.125754e+01 1.991118e-15 + vertex -3.685958e+00 -1.076547e+01 1.960986e-15 + endloop + endfacet + facet normal 3.506899e-01 9.364916e-01 -5.734357e-17 + outer loop + vertex -2.252575e+00 -1.125754e+01 3.472000e+00 + vertex -3.685958e+00 -1.076547e+01 1.960986e-15 + vertex -3.685958e+00 -1.076547e+01 3.472000e+00 + endloop + endfacet + facet normal 4.514834e-01 8.922795e-01 -5.463636e-17 + outer loop + vertex -3.685958e+00 -1.076547e+01 3.472000e+00 + vertex -3.685958e+00 -1.076547e+01 1.960986e-15 + vertex -5.018795e+00 -1.004417e+01 1.916820e-15 + endloop + endfacet + facet normal 5.000484e-01 8.659974e-01 -5.302705e-17 + outer loop + vertex -3.685958e+00 -1.076547e+01 3.472000e+00 + vertex -5.018795e+00 -1.004417e+01 1.916820e-15 + vertex -5.018795e+00 -1.004417e+01 3.472000e+00 + endloop + endfacet + facet normal 5.921901e-01 8.057982e-01 -4.934091e-17 + outer loop + vertex -5.018795e+00 -1.004417e+01 3.472000e+00 + vertex -5.018795e+00 -1.004417e+01 1.916820e-15 + vertex -6.214736e+00 -9.113332e+00 1.859822e-15 + endloop + endfacet + facet normal 6.357669e-01 7.718811e-01 -4.726408e-17 + outer loop + vertex -5.018795e+00 -1.004417e+01 3.472000e+00 + vertex -6.214736e+00 -9.113332e+00 1.859822e-15 + vertex -6.214736e+00 -9.113332e+00 3.472000e+00 + endloop + endfacet + facet normal 7.167435e-01 6.973369e-01 -4.269957e-17 + outer loop + vertex -6.214736e+00 -9.113332e+00 3.472000e+00 + vertex -6.214736e+00 -9.113332e+00 1.859822e-15 + vertex -7.241153e+00 -7.998344e+00 1.791549e-15 + endloop + endfacet + facet normal 7.541434e-01 6.567098e-01 -4.021188e-17 + outer loop + vertex -6.214736e+00 -9.113332e+00 3.472000e+00 + vertex -7.241153e+00 -7.998344e+00 1.791549e-15 + vertex -7.241153e+00 -7.998344e+00 3.472000e+00 + endloop + endfacet + facet normal 8.217460e-01 5.698540e-01 -3.489349e-17 + outer loop + vertex -7.241153e+00 -7.998344e+00 3.472000e+00 + vertex -7.241153e+00 -7.998344e+00 1.791549e-15 + vertex -8.070051e+00 -6.729622e+00 1.713862e-15 + endloop + endfacet + facet normal 8.519487e-01 5.236253e-01 -3.206280e-17 + outer loop + vertex -7.241153e+00 -7.998344e+00 3.472000e+00 + vertex -8.070051e+00 -6.729622e+00 1.713862e-15 + vertex -8.070051e+00 -6.729622e+00 3.472000e+00 + endloop + endfacet + facet normal 9.043332e-01 4.268270e-01 -2.613562e-17 + outer loop + vertex -8.070051e+00 -6.729622e+00 3.472000e+00 + vertex -8.070051e+00 -6.729622e+00 1.713862e-15 + vertex -8.678817e+00 -5.341771e+00 1.628881e-15 + endloop + endfacet + facet normal 9.265151e-01 3.762575e-01 -2.303913e-17 + outer loop + vertex -8.070051e+00 -6.729622e+00 3.472000e+00 + vertex -8.678817e+00 -5.341771e+00 1.628881e-15 + vertex -8.678817e+00 -5.341771e+00 3.472000e+00 + endloop + endfacet + facet normal 9.622528e-01 2.721573e-01 -1.666483e-17 + outer loop + vertex -8.678817e+00 -5.341771e+00 3.472000e+00 + vertex -8.678817e+00 -5.341771e+00 1.628881e-15 + vertex -9.050850e+00 -3.872648e+00 1.538923e-15 + endloop + endfacet + facet normal 9.758086e-01 2.186265e-01 -1.338701e-17 + outer loop + vertex -8.678817e+00 -5.341771e+00 3.472000e+00 + vertex -9.050850e+00 -3.872648e+00 1.538923e-15 + vertex -9.050850e+00 -3.872648e+00 3.472000e+00 + endloop + endfacet + facet normal 9.939246e-01 1.100638e-01 -6.739466e-18 + outer loop + vertex -9.050850e+00 -3.872648e+00 3.472000e+00 + vertex -9.050850e+00 -3.872648e+00 1.538923e-15 + vertex -9.176000e+00 -2.362329e+00 1.446443e-15 + endloop + endfacet + facet normal 9.984846e-01 5.503191e-02 -3.369733e-18 + outer loop + vertex -9.050850e+00 -3.872648e+00 3.472000e+00 + vertex -9.176000e+00 -2.362329e+00 1.446443e-15 + vertex -9.176000e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 6.943716e+00 3.636320e+00 3.472000e+00 + vertex 7.866333e+00 2.362057e+00 3.472000e+00 + vertex 7.086580e+00 2.362057e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -9.050850e+00 -3.872648e+00 3.472000e+00 + vertex -9.176000e+00 -2.362329e+00 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 5.816999e+00 4.734257e+00 3.472000e+00 + vertex 6.943716e+00 3.636320e+00 3.472000e+00 + vertex 4.519291e+00 5.623595e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 4.519291e+00 5.623595e+00 3.472000e+00 + vertex 6.943716e+00 3.636320e+00 3.472000e+00 + vertex 7.086580e+00 2.362057e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 4.519291e+00 5.623595e+00 3.472000e+00 + vertex 7.086580e+00 2.362057e+00 3.472000e+00 + vertex 3.088746e+00 6.278193e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 3.088746e+00 6.278193e+00 3.472000e+00 + vertex 7.086580e+00 2.362057e+00 3.472000e+00 + vertex 7.086580e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 9.176000e+00 -2.362329e+00 3.472000e+00 + vertex 9.050850e+00 -3.872648e+00 3.472000e+00 + vertex 7.086580e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.086580e+00 -2.362329e+00 3.472000e+00 + vertex 9.050850e+00 -3.872648e+00 3.472000e+00 + vertex 8.678819e+00 -5.341771e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.252575e+00 -1.125754e+01 3.472000e+00 + vertex -3.685958e+00 -1.076547e+01 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + vertex -3.685958e+00 -1.076547e+01 3.472000e+00 + vertex -5.018795e+00 -1.004417e+01 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + vertex -5.018795e+00 -1.004417e+01 3.472000e+00 + vertex -6.214736e+00 -9.113332e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.866329e+00 2.362057e+00 3.472000e+00 + vertex -6.943716e+00 3.636320e+00 3.472000e+00 + vertex -7.086578e+00 2.362057e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.086578e+00 2.362057e+00 3.472000e+00 + vertex -6.943716e+00 3.636320e+00 3.472000e+00 + vertex -5.816997e+00 4.734257e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -8.678817e+00 -5.341771e+00 3.472000e+00 + vertex -9.050850e+00 -3.872648e+00 3.472000e+00 + vertex -8.070051e+00 -6.729622e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -8.070051e+00 -6.729622e+00 3.472000e+00 + vertex -9.050850e+00 -3.872648e+00 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -8.070051e+00 -6.729622e+00 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + vertex -7.241153e+00 -7.998344e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.241153e+00 -7.998344e+00 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + vertex -6.214736e+00 -9.113332e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.567411e+00 6.678811e+00 3.472000e+00 + vertex 3.088746e+00 6.278193e+00 3.472000e+00 + vertex -2.252575e+00 -1.125754e+01 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.252575e+00 -1.125754e+01 3.472000e+00 + vertex 3.088746e+00 6.278193e+00 3.472000e+00 + vertex 7.086580e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -2.252575e+00 -1.125754e+01 3.472000e+00 + vertex 7.086580e+00 -2.362329e+00 3.472000e+00 + vertex -7.577479e-01 -1.150699e+01 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.577479e-01 -1.150699e+01 3.472000e+00 + vertex 7.086580e+00 -2.362329e+00 3.472000e+00 + vertex 8.678819e+00 -5.341771e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -7.577479e-01 -1.150699e+01 3.472000e+00 + vertex 8.678819e+00 -5.341771e+00 3.472000e+00 + vertex 7.577479e-01 -1.150699e+01 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.577479e-01 -1.150699e+01 3.472000e+00 + vertex 8.678819e+00 -5.341771e+00 3.472000e+00 + vertex 8.070051e+00 -6.729622e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 7.577479e-01 -1.150699e+01 3.472000e+00 + vertex 8.070051e+00 -6.729622e+00 3.472000e+00 + vertex 2.252575e+00 -1.125754e+01 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 2.252575e+00 -1.125754e+01 3.472000e+00 + vertex 8.070051e+00 -6.729622e+00 3.472000e+00 + vertex 7.241153e+00 -7.998344e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 2.252575e+00 -1.125754e+01 3.472000e+00 + vertex 7.241153e+00 -7.998344e+00 3.472000e+00 + vertex 3.685961e+00 -1.076547e+01 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 3.685961e+00 -1.076547e+01 3.472000e+00 + vertex 7.241153e+00 -7.998344e+00 3.472000e+00 + vertex 6.214739e+00 -9.113332e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 3.685961e+00 -1.076547e+01 3.472000e+00 + vertex 6.214739e+00 -9.113332e+00 3.472000e+00 + vertex 5.018799e+00 -1.004417e+01 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 1.567411e+00 6.678811e+00 3.472000e+00 + vertex -2.252575e+00 -1.125754e+01 3.472000e+00 + vertex 0.000000e+00 6.813671e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 0.000000e+00 6.813671e+00 3.472000e+00 + vertex -2.252575e+00 -1.125754e+01 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex 0.000000e+00 6.813671e+00 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + vertex -1.567409e+00 6.678811e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.567409e+00 6.678811e+00 3.472000e+00 + vertex -7.086578e+00 -2.362329e+00 3.472000e+00 + vertex -7.086578e+00 2.362057e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -1.567409e+00 6.678811e+00 3.472000e+00 + vertex -7.086578e+00 2.362057e+00 3.472000e+00 + vertex -3.088746e+00 6.278193e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -3.088746e+00 6.278193e+00 3.472000e+00 + vertex -7.086578e+00 2.362057e+00 3.472000e+00 + vertex -5.816997e+00 4.734257e+00 3.472000e+00 + endloop + endfacet + facet normal 0.000000e+00 -6.123234e-17 -1.000000e+00 + outer loop + vertex -3.088746e+00 6.278193e+00 3.472000e+00 + vertex -5.816997e+00 4.734257e+00 3.472000e+00 + vertex -4.519291e+00 5.623595e+00 3.472000e+00 + endloop + endfacet +endsolid Default diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/basic_LwjglBasicExample.jpg b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/basic_LwjglBasicExample.jpg Binary files differdeleted file mode 100644 index 6964a8d..0000000 --- a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/basic_LwjglBasicExample.jpg +++ /dev/null diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/basic_LwjglHeadlessExample.jpg b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/basic_LwjglHeadlessExample.jpg Binary files differdeleted file mode 100644 index 88d2a31..0000000 --- a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/basic_LwjglHeadlessExample.jpg +++ /dev/null diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/canvas_LwjglAwtExample.jpg b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/canvas_LwjglAwtExample.jpg Binary files differdeleted file mode 100644 index ae5cc0d..0000000 --- a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/canvas_LwjglAwtExample.jpg +++ /dev/null diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/canvas_LwjglSwtExample.jpg b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/canvas_LwjglSwtExample.jpg Binary files differdeleted file mode 100644 index ae5cc0d..0000000 --- a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/canvas_LwjglSwtExample.jpg +++ /dev/null diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/pipeline_SimplePlyExample.jpg b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/pipeline_SimplePlyExample.jpg Binary files differnew file mode 100644 index 0000000..2084f5c --- /dev/null +++ b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/pipeline_SimplePlyExample.jpg diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/pipeline_SimpleStlExample.jpg b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/pipeline_SimpleStlExample.jpg Binary files differnew file mode 100644 index 0000000..ca02848 --- /dev/null +++ b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/pipeline_SimpleStlExample.jpg diff --git a/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/terrain_MountainShadowTerrainExample.jpg b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/terrain_MountainShadowTerrainExample.jpg Binary files differnew file mode 100644 index 0000000..57bcc7c --- /dev/null +++ b/ardor3d-examples/src/main/resources/com/ardor3d/example/media/thumbnails/terrain_MountainShadowTerrainExample.jpg diff --git a/ardor3d-extras/.settings/org.eclipse.jdt.core.prefs b/ardor3d-extras/.settings/org.eclipse.jdt.core.prefs index 70ba911..f545444 100644 --- a/ardor3d-extras/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-extras/.settings/org.eclipse.jdt.core.prefs @@ -81,12 +81,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-extras/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-extras/.settings/org.eclipse.jdt.ui.prefs index 741ef0d..889505c 100644 --- a/ardor3d-extras/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-extras/.settings/org.eclipse.jdt.ui.prefs @@ -55,7 +55,7 @@ editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_ArdorLabs formatter_settings_version=11 org.eclipse.jdt.ui.javadoc=false -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2012 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-JSDoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-JSDoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -78,7 +78,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=true diff --git a/ardor3d-extras/build.gradle b/ardor3d-extras/build.gradle new file mode 100644 index 0000000..bcf8fd3 --- /dev/null +++ b/ardor3d-extras/build.gradle @@ -0,0 +1,5 @@ + +description = 'Ardor 3D Extras Package' +dependencies { + compile project(':ardor3d-core') +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasNode.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasNode.java index f047859..62efc17 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasNode.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasNode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasPacker.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasPacker.java index cf11c06..230ad79 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasPacker.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasPacker.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasTextureParameter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasTextureParameter.java index c45b4d6..55869c4 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasTextureParameter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/AtlasTextureParameter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TexturePacker.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TexturePacker.java index 0e6771c..36d2025 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TexturePacker.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TexturePacker.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,6 +12,8 @@ package com.ardor3d.extension.atlas; import java.nio.ByteBuffer; import java.nio.FloatBuffer; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.logging.Logger; @@ -31,8 +33,6 @@ import com.ardor3d.renderer.state.TextureState; import com.ardor3d.scenegraph.Mesh; import com.ardor3d.util.TextureManager; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; /** * A tool that uses the AtlasNode/AtlasPacker algorithm to pack textures into texture atlases. It modifies the uv @@ -69,15 +69,15 @@ public class TexturePacker { private final List<AtlasPacker> packers; private final List<ByteBuffer> dataBuffers; - private final List<Texture> textures = Lists.newArrayList(); + private final List<Texture> textures = new ArrayList<>(); public TexturePacker(final int atlasWidth, final int atlasHeight) { this.atlasWidth = atlasWidth; this.atlasHeight = atlasHeight; - cachedAtlases = Maps.newHashMap(); - packers = Lists.newArrayList(); - dataBuffers = Lists.newArrayList(); + cachedAtlases = new HashMap<>(); + packers = new ArrayList<>(); + dataBuffers = new ArrayList<>(); addPacker(); } @@ -168,7 +168,7 @@ public class TexturePacker { return; } - list = Lists.newArrayList(); + list = new ArrayList<>(); cachedAtlases.put(parameterObject, list); list.add(parameterObject); diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TextureParameter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TextureParameter.java index 5679195..9cf8e5d 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TextureParameter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TextureParameter.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -11,6 +11,7 @@ package com.ardor3d.extension.atlas; import java.nio.FloatBuffer; +import java.util.Objects; import com.ardor3d.image.Texture; import com.ardor3d.renderer.state.RenderState; @@ -88,10 +89,7 @@ public class TextureParameter { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (textureKey == null ? 0 : textureKey.hashCode()); - return result; + return Objects.hashCode(textureKey); } @Override @@ -106,14 +104,7 @@ public class TextureParameter { return false; } final TextureParameter other = (TextureParameter) obj; - if (textureKey == null) { - if (other.textureKey != null) { - return false; - } - } else if (!textureKey.equals(other.textureKey)) { - return false; - } - return true; + return Objects.equals(textureKey, other.textureKey); } public int getTargetTextureIndex() { diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java index 447a226..e924ede 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.interact; +import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -28,14 +29,13 @@ import com.ardor3d.renderer.Renderer; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.util.ReadOnlyTimer; import com.google.common.base.Predicate; -import com.google.common.collect.Lists; public class InteractManager { /** * List of widgets currently managed by this manager. */ - protected final List<AbstractInteractWidget> _widgets = Lists.newArrayList(); + protected final List<AbstractInteractWidget> _widgets = new ArrayList<>(); /** * The logical layer used by this manager to receive input events prior to forwarding them to the scene. @@ -66,7 +66,7 @@ public class InteractManager { /** * List of filters to modify state prior to applying to a Spatial target. */ - protected List<UpdateFilter> _filters = Lists.newArrayList(); + protected List<UpdateFilter> _filters = new ArrayList<>(); public InteractManager() { _state = new SpatialState(); @@ -129,11 +129,13 @@ public class InteractManager { */ private void setupLogicalLayer() { _logicalLayer.registerTrigger(new InputTrigger(new Predicate<TwoInputStates>() { + @Override public boolean apply(final TwoInputStates arg0) { // always trigger this. return true; } }, new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { if (_spatialTarget != null) { _state.copyState(_spatialTarget); diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/data/SpatialState.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/data/SpatialState.java index e3918d1..aa822a4 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/data/SpatialState.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/data/SpatialState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/AllowScaleFilter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/AllowScaleFilter.java index a1eae88..2105eaa 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/AllowScaleFilter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/AllowScaleFilter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/MinMaxScaleFilter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/MinMaxScaleFilter.java index e823403..dab5583 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/MinMaxScaleFilter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/MinMaxScaleFilter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/PlaneBoundaryFilter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/PlaneBoundaryFilter.java index 7be40f4..100b51e 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/PlaneBoundaryFilter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/PlaneBoundaryFilter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/UpdateFilter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/UpdateFilter.java index 20d1644..0e4646a 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/UpdateFilter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/filter/UpdateFilter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java index 87ffd1b..39c6372 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -57,7 +57,7 @@ public abstract class AbstractInteractWidget { /** * Use the given inputstates to determine if and how to activate this widget. If the widget uses the given input, * inputConsumed should be set to "true" and applyFilters should be called by this method. - * + * * @param source * the canvas that is our input source. * @param inputStates @@ -149,7 +149,8 @@ public abstract class AbstractInteractWidget { } protected Vector3 getLastPick() { - if (_results.getNumber() > 0 && _results.getPickData(0).getIntersectionRecord().getNumberOfIntersections() > 0) { + if (_results.getNumber() > 0 + && _results.getPickData(0).getIntersectionRecord().getNumberOfIntersections() > 0) { return _results.getPickData(0).getIntersectionRecord().getIntersectionPoint(0); } return null; diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/BasicFilterList.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/BasicFilterList.java index 3b13b9d..75f3364 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/BasicFilterList.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/BasicFilterList.java @@ -10,15 +10,15 @@ package com.ardor3d.extension.interact.widget; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import com.ardor3d.extension.interact.InteractManager; import com.ardor3d.extension.interact.filter.UpdateFilter; -import com.google.common.collect.Lists; public class BasicFilterList implements IFilterList { - final List<UpdateFilter> _filters = Lists.newArrayList(); + final List<UpdateFilter> _filters = new ArrayList<>(); public Iterator<UpdateFilter> iterator() { return _filters.iterator(); diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/CompoundInteractWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/CompoundInteractWidget.java index 62a9684..bd45d6e 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/CompoundInteractWidget.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/CompoundInteractWidget.java @@ -1,15 +1,16 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.interact.widget; +import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; @@ -28,7 +29,6 @@ import com.ardor3d.renderer.Renderer; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.util.ReadOnlyTimer; -import com.google.common.collect.Maps; public class CompoundInteractWidget extends AbstractInteractWidget { @@ -39,12 +39,10 @@ public class CompoundInteractWidget extends AbstractInteractWidget { public static double MIN_SCALE = 0.000001; - protected Map<String, AbstractInteractWidget> _widgets = Maps.newHashMap(); + protected Map<String, AbstractInteractWidget> _widgets = new HashMap<>(); protected AbstractInteractWidget _lastInputWidget = null; - protected InteractMatrix _interactMatrix; - public CompoundInteractWidget() { super(new BasicFilterList()); _handle = new Node("handleRoot"); @@ -52,7 +50,7 @@ public class CompoundInteractWidget extends AbstractInteractWidget { @Override public void addFilter(final UpdateFilter filter) { - for(final AbstractInteractWidget widget : _widgets.values()) { + for (final AbstractInteractWidget widget : _widgets.values()) { widget.addFilter(filter); } super.addFilter(filter); @@ -60,7 +58,7 @@ public class CompoundInteractWidget extends AbstractInteractWidget { @Override public void removeFilter(final UpdateFilter filter) { - for(final AbstractInteractWidget widget : _widgets.values()) { + for (final AbstractInteractWidget widget : _widgets.values()) { widget.removeFilter(filter); } super.removeFilter(filter); @@ -68,7 +66,7 @@ public class CompoundInteractWidget extends AbstractInteractWidget { @Override public void clearFilters() { - for(final AbstractInteractWidget widget : _widgets.values()) { + for (final AbstractInteractWidget widget : _widgets.values()) { widget.clearFilters(); } super.clearFilters(); diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractArrow.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractArrow.java index 0fb6fa6..31d14a9 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractArrow.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractArrow.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -29,7 +29,7 @@ public class InteractArrow extends Arrow { protected double _lengthGap = 0; protected double _tipGap = 0; - protected static final Quaternion rotator = new Quaternion().applyRotationX(MathUtils.HALF_PI); + protected static final Quaternion ROTATOR = new Quaternion().applyRotationX(MathUtils.HALF_PI); public InteractArrow() {} @@ -66,8 +66,8 @@ public class InteractArrow extends Arrow { final double tipLength = _length / 2.0; final Pyramid tip = new Pyramid("tip", 2 * _width, tipLength); tip.getMeshData().translatePoints(0, _tipGap + _length + 0.5 * tipLength, 0); - tip.getMeshData().rotatePoints(InteractArrow.rotator); - tip.getMeshData().rotateNormals(InteractArrow.rotator); + tip.getMeshData().rotatePoints(InteractArrow.ROTATOR); + tip.getMeshData().rotateNormals(InteractArrow.ROTATOR); attachChild(tip); tip.updateModelBound(); diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractMatrix.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractMatrix.java index 944bd9d..6b9e235 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractMatrix.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractMatrix.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractRing.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractRing.java index 983017a..1c3b42b 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractRing.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractRing.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveMultiPlanarWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveMultiPlanarWidget.java index f47be1b..c598e34 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveMultiPlanarWidget.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveMultiPlanarWidget.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MovePlanarWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MovePlanarWidget.java index 9787ea7..16b650f 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MovePlanarWidget.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MovePlanarWidget.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveWidget.java index e03e1bd..c06569d 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveWidget.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveWidget.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -278,16 +278,6 @@ public class MoveWidget extends AbstractInteractWidget { return _calcVec3D.subtractLocal(_calcVec3C); } - @Override - public void setInteractMatrix(final InteractMatrix matrix) { - _interactMatrix = matrix; - } - - @Override - public InteractMatrix getInteractMatrix() { - return _interactMatrix; - } - public InteractArrow getXArrow() { return _xArrow; } diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java index a684ef7..03287de 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/SimpleScaleWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/SimpleScaleWidget.java index ffcc8bb..9f5fc3d 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/SimpleScaleWidget.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/SimpleScaleWidget.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2DataStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2DataStore.java index a2c12b1..1830aa6 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2DataStore.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2DataStore.java @@ -1,33 +1,35 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.model.md2; +import java.util.ArrayList; import java.util.List; import com.ardor3d.extension.model.util.KeyframeController; import com.ardor3d.scenegraph.Mesh; -import com.google.common.collect.Lists; public class Md2DataStore { private final Mesh _mainMesh; private final KeyframeController<Mesh> _controller; - private final List<String> _frameNames = Lists.newArrayList(); + private final List<String> _frameNames; - private final List<String> _skinNames = Lists.newArrayList(); + private final List<String> _skinNames; public Md2DataStore(final Mesh mainMesh, final KeyframeController<Mesh> controller) { _mainMesh = mainMesh; _controller = controller; + _frameNames = new ArrayList<>(); + _skinNames = new ArrayList<>(); } public Mesh getScene() { diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Frame.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Frame.java index 8c6b8c1..d01871f 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Frame.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Frame.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Header.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Header.java index 2dc7bf7..d520378 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Header.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Header.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Importer.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Importer.java index 6270b66..b9adc18 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Importer.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Importer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,13 +11,14 @@ package com.ardor3d.extension.model.md2; import java.io.InputStream; +import java.util.ArrayList; import java.util.List; import com.ardor3d.bounding.BoundingBox; import com.ardor3d.extension.model.util.KeyframeController; import com.ardor3d.image.Texture; -import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.image.Texture.MinificationFilter; +import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.math.Vector3; import com.ardor3d.renderer.IndexMode; import com.ardor3d.renderer.state.TextureState; @@ -30,7 +31,6 @@ import com.ardor3d.util.TextureManager; import com.ardor3d.util.resource.ResourceLocator; import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.ResourceSource; -import com.google.common.collect.Lists; public class Md2Importer { @@ -112,10 +112,10 @@ public class Md2Importer { final LittleEndianRandomAccessDataInput bis = new LittleEndianRandomAccessDataInput(md2Stream); // parse the header - final Md2Header header = new Md2Header(bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis - .readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis - .readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis - .readInt()); + final Md2Header header = new Md2Header(bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), + bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), + bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), + bis.readInt()); // Check magic word and version if (header.magic != ('2' << 24) + ('P' << 16) + ('D' << 8) + 'I') { @@ -159,8 +159,8 @@ public class Md2Importer { bis.seek(header.offsetGlCommands); int length, absLength; Md2GlCommand cmd; - final List<Integer> fanIndices = Lists.newArrayList(); - final List<Integer> stripIndices = Lists.newArrayList(); + final List<Integer> fanIndices = new ArrayList<>(); + final List<Integer> stripIndices = new ArrayList<>(); for (int i = 0; i < header.numGlCommands; i++) { length = bis.readInt(); if (length == 0) { @@ -299,7 +299,7 @@ public class Md2Importer { mesh.setName(resource.getName()); // Add controller - final KeyframeController<Mesh> controller = new KeyframeController<Mesh>(); + final KeyframeController<Mesh> controller = new KeyframeController<>(); mesh.addController(controller); controller.setMorphingMesh(mesh); controller.setInterpTex(false); @@ -351,18 +351,19 @@ public class Md2Importer { } private Texture loadTexture(final String name) { - Texture tex = null; + final ResourceSource source; if (_textureLocator == null) { - tex = TextureManager.load(name, getMinificationFilter(), + source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, name); + } else { + source = _textureLocator.locateResource(name); + } + final Texture tex; + if (source == null) { + tex = null; + } else { + tex = TextureManager.load(source, getMinificationFilter(), isUseCompression() ? TextureStoreFormat.GuessCompressedFormat : TextureStoreFormat.GuessNoCompressedFormat, isFlipTextureVertically()); - } else { - final ResourceSource source = _textureLocator.locateResource(name); - if (source != null) { - tex = TextureManager.load(source, getMinificationFilter(), - isUseCompression() ? TextureStoreFormat.GuessCompressedFormat - : TextureStoreFormat.GuessNoCompressedFormat, isFlipTextureVertically()); - } } return tex; } @@ -378,8 +379,7 @@ public class Md2Importer { private void addVert(final Md2GlCommand cmd, final Md2Frame frame, final int vertIndex, final FloatBufferData verts) { final int index = cmd.vertIndices[vertIndex]; final byte[] vertData = frame.vertData; - calcVert.set((vertData[index * 4 + 0] & 0xFF), (vertData[index * 4 + 1] & 0xFF), - (vertData[index * 4 + 2] & 0xFF)); + calcVert.set(vertData[index * 4 + 0] & 0xFF, vertData[index * 4 + 1] & 0xFF, vertData[index * 4 + 2] & 0xFF); calcVert.multiplyLocal(frame.scale).addLocal(frame.translate); verts.getBuffer().put(calcVert.getXf()).put(calcVert.getYf()).put(calcVert.getZf()); } diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Normals.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Normals.java index fcb0f86..da2266c 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Normals.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Normals.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3DataStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3DataStore.java new file mode 100644 index 0000000..5e5a954 --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3DataStore.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.md3; + +import java.util.ArrayList; +import java.util.List; + +import com.ardor3d.scenegraph.Node; + +public class Md3DataStore { + + private final Node _mainNode; + + private final List<String> _frameNames; + + private final List<String> _skinNames; + + public Md3DataStore(final Node mainNode) { + super(); + _mainNode = mainNode; + _frameNames = new ArrayList<>(); + _skinNames = new ArrayList<>(); + } + + public Node getScene() { + return _mainNode; + } + + public List<String> getFrameNames() { + return _frameNames; + } + + public int getFrameIndex(final String frameName) { + return _frameNames.indexOf(frameName); + } + + public List<String> getSkinNames() { + return _skinNames; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Frame.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Frame.java new file mode 100644 index 0000000..e24d903 --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Frame.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.md3; + +import com.ardor3d.math.Vector3; +import com.ardor3d.math.type.ReadOnlyVector3; + +/** + * frame of MD3: http://en.wikipedia.org/wiki/MD3_%28file_format%29#Frame + */ +final class Md3Frame { + + /** First corner of the bounding box. */ + final Vector3 _minBounds; + /** Second corner of the bounding box. */ + final Vector3 _maxBounds; + /** Local origin, usually (0, 0, 0). */ + final Vector3 _localOrigin; + /** Radius of the bounding sphere. */ + final float _radius; + /** name */ + final String _name; + + Md3Frame(final ReadOnlyVector3 minBounds, final ReadOnlyVector3 maxBounds, final ReadOnlyVector3 localOrigin, + final float radius, final String name) { + super(); + _minBounds = new Vector3(); + _maxBounds = new Vector3(); + _localOrigin = new Vector3(); + _minBounds.set(minBounds); + _maxBounds.set(maxBounds); + _localOrigin.set(localOrigin); + _radius = radius; + _name = name; + } + +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Header.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Header.java new file mode 100644 index 0000000..b4d4cf6 --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Header.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.md3; + +/** + * header of MD3: http://en.wikipedia.org/wiki/MD3_%28file_format%29#MD3_header + */ +final class Md3Header { + /** identifier of the file: magic number: "IDP3" */ + final int _magic; + /** version number of the file */ + final int _version; + /** name, usually its pathname in the PK3. ASCII character string, NULL-terminated (C-style) */ + final String _name; + /** flags, unused yet */ + final int _flags; + /** Number of Frame objects, with a maximum of MD3_MAX_FRAMES. Current value of MD3_MAX_FRAMES is 1024. */ + final int _numFrames; + /** + * Number of Tag objects, with a maximum of MD3_MAX_TAGS. Current value of MD3_MAX_TAGS is 16. There is one set of + * tags per frame so the total number of tags to read is (NUM_TAGS * NUM_FRAMES). + */ + final int _numTags; + /** Number of Surface objects, with a maximum of MD3_MAX_SURFACES. Current value of MD3_MAX_SURFACES is 32. */ + final int _numSurfaces; + /** Number of Skin objects, unused */ + final int _numSkins; + /** + * Relative offset from start of MD3 object where Frame objects start. The Frame objects are written sequentially, + * that is, when you read one Frame object, you do not need to seek() for the next object. + */ + final int _offsetFrame; + /** Relative offset from start of MD3 where Tag objects start. Similarly written sequentially. */ + final int _offsetTag; + /** Relative offset from start of MD3 where Surface objects start. Again, written sequentially. */ + final int _offsetSurface; + /** Relative offset from start of MD3 to the end of the MD3 object */ + final int _offsetEnd; + + Md3Header(final int magic, final int version, final String name, final int flags, final int numFrames, + final int numTags, final int numSurfaces, final int numSkins, final int offsetFrame, final int offsetTag, + final int offsetSurface, final int offsetEnd) { + super(); + _magic = magic; + _version = version; + _name = name; + _flags = flags; + _numFrames = numFrames; + _numTags = numTags; + _numSurfaces = numSurfaces; + _numSkins = numSkins; + _offsetFrame = offsetFrame; + _offsetTag = offsetTag; + _offsetSurface = offsetSurface; + _offsetEnd = offsetEnd; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Importer.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Importer.java new file mode 100644 index 0000000..fb2ceea --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Importer.java @@ -0,0 +1,211 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.md3; + +import java.io.InputStream; + +import com.ardor3d.extension.model.util.KeyframeController; +import com.ardor3d.math.Matrix3; +import com.ardor3d.math.Vector2; +import com.ardor3d.math.Vector3; +import com.ardor3d.scenegraph.Mesh; +import com.ardor3d.scenegraph.Node; +import com.ardor3d.util.Ardor3dException; +import com.ardor3d.util.LittleEndianRandomAccessDataInput; +import com.ardor3d.util.geom.BufferUtils; +import com.ardor3d.util.resource.ResourceLocator; +import com.ardor3d.util.resource.ResourceLocatorTool; +import com.ardor3d.util.resource.ResourceSource; + +/** + * http://education.mit.edu/starlogo-tng/shapes-tutorial/shapetutorial.html + */ +public class Md3Importer { + + private static final float XYZ_SCALE = 1.0f / 64; + + private ResourceLocator _modelLocator; + + public void setModelLocator(final ResourceLocator locator) { + _modelLocator = locator; + } + + /** + * Reads a MD3 file from the given resource + * + * @param resource + * the name of the resource to find. + * @return an ObjGeometryStore data object containing the scene and other useful elements. + */ + public Md3DataStore load(final String resource) { + final ResourceSource source; + if (_modelLocator == null) { + source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, resource); + } else { + source = _modelLocator.locateResource(resource); + } + + if (source == null) { + throw new Error("Unable to locate '" + resource + "'"); + } + + return load(source); + } + + /** + * Reads an MD3 file from the given resource + * + * @param resource + * a resource pointing to the model we wish to load. + * @return an Md3DataStore data object containing the scene and other useful elements. + */ + public Md3DataStore load(final ResourceSource resource) { + if (resource == null) { + throw new NullPointerException("Unable to load null resource"); + } + + try { + final InputStream md3Stream = resource.openStream(); + if (md3Stream == null) { + throw new NullPointerException("Unable to load null streams"); + } + final LittleEndianRandomAccessDataInput bis = new LittleEndianRandomAccessDataInput(md3Stream); + + // parse the header + final Md3Header header = new Md3Header(bis.readInt(), bis.readInt(), bis.readString(64), bis.readInt(), + bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), + bis.readInt(), bis.readInt()); + + // Check magic word and version + if (header._magic != ('3' << 24) + ('P' << 16) + ('D' << 8) + 'I') { + throw new Ardor3dException("Not an MD3 file."); + } + if (header._version != 15) { + throw new Ardor3dException("Invalid file version (Version not 15)!"); + } + + // Parse out frames + final Md3Frame[] frames = new Md3Frame[header._numFrames]; + bis.seek(header._offsetFrame); + final Vector3 minBounds = new Vector3(); + final Vector3 maxBounds = new Vector3(); + final Vector3 localOrigin = new Vector3(); + for (int i = 0; i < header._numFrames; i++) { + minBounds.set(bis.readFloat(), bis.readFloat(), bis.readFloat()); + maxBounds.set(bis.readFloat(), bis.readFloat(), bis.readFloat()); + localOrigin.set(bis.readFloat(), bis.readFloat(), bis.readFloat()); + frames[i] = new Md3Frame(minBounds, maxBounds, localOrigin, bis.readFloat(), bis.readString(16)); + } + + // Parse out tags + final Md3Tag[][] tags = new Md3Tag[header._numFrames][header._numTags]; + bis.seek(header._offsetTag); + final Vector3 origin = new Vector3(); + final Matrix3 axis = new Matrix3(); + for (int i = 0; i < header._numFrames; i++) { + for (int j = 0; j < header._numTags; j++) { + final String name = bis.readString(64).trim(); + origin.set(bis.readFloat(), bis.readFloat(), bis.readFloat()); + axis.set(bis.readFloat(), bis.readFloat(), bis.readFloat(), bis.readFloat(), bis.readFloat(), + bis.readFloat(), bis.readFloat(), bis.readFloat(), bis.readFloat()); + tags[i][j] = new Md3Tag(name, origin, axis); + } + } + + // Parse out surfaces + final Md3Surface[] surfaces = new Md3Surface[header._numSurfaces]; + bis.seek(header._offsetSurface); + for (int i = 0; i < header._numSurfaces; i++) { + final int surfaceStart = bis.position(); + final int magic = bis.readInt(); + if (magic != ('3' << 24) + ('P' << 16) + ('D' << 8) + 'I') { + throw new Ardor3dException("Not an MD3 surface."); + } + surfaces[i] = new Md3Surface(magic, bis.readString(64), bis.readInt(), bis.readInt(), bis.readInt(), + bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), bis.readInt(), + bis.readInt()); + // Parse out shaders + bis.seek(surfaceStart + surfaces[i]._offsetShaders); + for (int j = 0; j < surfaces[i]._numShaders; j++) { + // final String name = bis.readString(64); + // final int index = bis.readInt(); + // unused yet + } + // Parse out triangles + bis.seek(surfaceStart + surfaces[i]._offsetTriangles); + for (int j = 0; j < surfaces[i]._triIndexes.length; j++) { + surfaces[i]._triIndexes[j] = bis.readInt(); + } + // Parse out texture coordinates + bis.seek(surfaceStart + surfaces[i]._offsetTexCoords); + for (int j = 0; j < surfaces[i]._texCoords.length; j++) { + surfaces[i]._texCoords[j] = new Vector2(bis.readFloat(), bis.readFloat()); + } + // Parse out vertices + bis.seek(surfaceStart + surfaces[i]._offsetXyzNormals); + for (int j = 0; j < surfaces[i]._numFrames; j++) { + for (int k = 0; k < surfaces[i]._numVerts; k++) { + surfaces[i]._verts[j][k] = new Vector3(bis.readShort(), bis.readShort(), bis.readShort()) + .multiplyLocal(Md3Importer.XYZ_SCALE); + final int zenith = bis.readByte(); + final int azimuth = bis.readByte(); + final float lat = (float) (zenith * 2 * Math.PI / 255); + final float lng = (float) (azimuth * 2 * Math.PI / 255); + surfaces[i]._norms[j][k] = new Vector3(Math.cos(lat) * Math.sin(lng), Math.sin(lat) + * Math.sin(lng), Math.cos(lng)); + } + } + } + + final Node node = new Node(header._name); + for (int i = 0; i < header._numSurfaces; i++) { + final Md3Surface surface = surfaces[i]; + final KeyframeController<Mesh> controller = new KeyframeController<>(); + final Mesh morphingMesh = new Mesh(surface._name); + morphingMesh.getMeshData().setIndexBuffer(BufferUtils.createIntBuffer(surface._triIndexes)); + morphingMesh.getMeshData().setVertexBuffer(BufferUtils.createFloatBuffer(surface._verts[0])); + morphingMesh.getMeshData().setNormalBuffer(BufferUtils.createFloatBuffer(surface._norms[0])); + morphingMesh.getMeshData().setTextureBuffer(BufferUtils.createFloatBuffer(surface._texCoords), 0); + node.attachChild(morphingMesh); + controller.setMorphingMesh(morphingMesh); + for (int j = 0; j < surface._numFrames; j++) { + final Md3Frame frame = frames[j]; + final Mesh mesh = new Mesh(frame._name); + mesh.getMeshData().setVertexBuffer(BufferUtils.createFloatBuffer(surface._verts[j])); + mesh.getMeshData().setNormalBuffer(BufferUtils.createFloatBuffer(surface._norms[j])); + controller.setKeyframe(j, mesh); + } + morphingMesh.addController(controller); + // TODO should I add a controller into the node? + } + + // Make a store object to return + final Md3DataStore store = new Md3DataStore(node); + + // store names + for (final Md3Frame frame : frames) { + store.getFrameNames().add(frame._name); + } + + // TODO load the animation configuration file (animation.cfg): [sex f/m][first frame, num frames, looping + // frames, frames per second] + + /** + * TODO there is one .skin file per MD3 file, it contains at most one line per surface (?) with the name and + * the texture filename (.jpg or .tga) and a tag per attachment to another MD3 file + */ + + return store; + } catch (final Exception e) { + throw new Error("Unable to load md3 resource from URL: " + resource, e); + } + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Surface.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Surface.java new file mode 100644 index 0000000..b27dae9 --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Surface.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.md3; + +import com.ardor3d.math.Vector2; +import com.ardor3d.math.Vector3; + +/** + * Surface of MD3: http://en.wikipedia.org/wiki/MD3_%28file_format%29#Surface + */ +final class Md3Surface { + + final int _magic; + /** name */ + final String _name; + /** flags */ + final int _flags; + /** Number of animation frames. This should match NUM_FRAMES in the MD3 header. */ + final int _numFrames; + /** + * Number of Shader objects defined in this Surface, with a limit of MD3_MAX_SHADERS. Current value of + * MD3_MAX_SHADERS is 256. + */ + final int _numShaders; + /** Number of Vertex objects defined in this Surface, up to MD3_MAX_VERTS. Current value of MD3_MAX_VERTS is 4096. */ + final int _numVerts; + /** + * Number of Triangle objects defined in this Surface, maximum of MD3_MAX_TRIANGLES. Current value of + * MD3_MAX_TRIANGLES is 8192. + */ + final int _numTriangles; + /** Relative offset from SURFACE_START where the list of Triangle objects starts. */ + final int _offsetTriangles; + /** Relative offset from SURFACE_START where the list of Shader objects starts. */ + final int _offsetShaders; + /** Relative offset from SURFACE_START where the list of ST objects (s-t texture coordinates) starts. */ + final int _offsetTexCoords; + /** Relative offset from SURFACE_START where the list of Vertex objects (X-Y-Z-N vertices) starts. */ + final int _offsetXyzNormals; + /** Relative offset from SURFACE_START to where the Surface object ends. */ + final int _offsetEnd; + /** Indices of triangles' vertices */ + final int[] _triIndexes; + /** Texture coordinates of triangles' vertices */ + final Vector2[] _texCoords; + /** Triangles' vertices */ + final Vector3[][] _verts; + /** Triangles' normals */ + final Vector3[][] _norms; + + Md3Surface(final int magic, final String name, final int flags, final int numFrames, final int numShaders, + final int numVerts, final int numTriangles, final int offsetTriangles, final int offsetShaders, + final int offsetTexCoords, final int offsetXyzNormals, final int offsetEnd) { + super(); + _magic = magic; + _name = name; + _flags = flags; + _numFrames = numFrames; + _numShaders = numShaders; + _numVerts = numVerts; + _numTriangles = numTriangles; + _offsetTriangles = offsetTriangles; + _offsetShaders = offsetShaders; + _offsetTexCoords = offsetTexCoords; + _offsetXyzNormals = offsetXyzNormals; + _offsetEnd = offsetEnd; + _triIndexes = new int[_numTriangles * 3]; + _texCoords = new Vector2[_numVerts]; + _verts = new Vector3[_numFrames][_numVerts]; + _norms = new Vector3[_numFrames][_numVerts]; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Tag.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Tag.java new file mode 100644 index 0000000..b4c25c8 --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Tag.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.md3; + +import com.ardor3d.math.Matrix3; +import com.ardor3d.math.Vector3; +import com.ardor3d.math.type.ReadOnlyMatrix3; +import com.ardor3d.math.type.ReadOnlyVector3; + +/** + * Tag of MD3: http://en.wikipedia.org/wiki/MD3_%28file_format%29#Tag + */ +final class Md3Tag { + + /** name */ + final String _name; + /** coordinates */ + final Vector3 _origin; + /** 3x3 rotation matrix */ + final Matrix3 _axis; + + Md3Tag(final String name, final ReadOnlyVector3 origin, final ReadOnlyMatrix3 axis) { + super(); + _origin = new Vector3(); + _axis = new Matrix3(); + _name = name; + _origin.set(origin); + _axis.set(axis); + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjDataStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjDataStore.java index 0c9fa91..cc52553 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjDataStore.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjDataStore.java @@ -1,25 +1,33 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.model.obj; +import java.util.ArrayList; import java.util.List; import com.ardor3d.math.Vector3; -import com.google.common.collect.Lists; public class ObjDataStore { - private final List<Vector3> _vertices = Lists.newArrayList(); - private final List<Vector3> _normals = Lists.newArrayList(); - private final List<Vector3> _generatedNormals = Lists.newArrayList(); - private final List<Vector3> _uvs = Lists.newArrayList(); + private final List<Vector3> _vertices; + private final List<Vector3> _normals; + private final List<Vector3> _generatedNormals; + private final List<Vector3> _uvs; + + public ObjDataStore() { + super(); + _vertices = new ArrayList<>(); + _normals = new ArrayList<>(); + _generatedNormals = new ArrayList<>(); + _uvs = new ArrayList<>(); + } public List<Vector3> getVertices() { return _vertices; diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java index 033727f..2683123 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -16,8 +16,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; +import java.util.Objects; import java.util.logging.Logger; import com.ardor3d.extension.model.util.KeyframeController; @@ -36,7 +36,7 @@ import com.ardor3d.util.TextureKey; * WaveFront OBJ exporter. It supports only the meshes. Several meshes can be exported into the same OBJ file. Only a * few kinds of primitives are supported. N.B: If the texture is flipped in Ardor3D, you will have to flip it manually * when loading the resulting OBJ file. - * + * * @author Julien Gouesse */ public class ObjExporter { @@ -49,7 +49,7 @@ public class ObjExporter { /** * Save a mesh to a single WaveFront OBJ file and a MTL file - * + * * @param mesh * mesh to export * @param objFile @@ -63,7 +63,7 @@ public class ObjExporter { save(mesh, objFile, mtlFile, false, 0, true, null, null); } else { final KeyframeController<?> controller = (KeyframeController<?>) mesh.getController(0); - final ArrayList<Mesh> meshList = new ArrayList<Mesh>(); + final ArrayList<Mesh> meshList = new ArrayList<>(); for (final KeyframeController.PointInTime pit : controller._keyframes) { if (pit != null && pit._newShape != null) { meshList.add(pit._newShape); @@ -75,7 +75,7 @@ public class ObjExporter { /** * Save several meshes to a single WaveFront OBJ file and a MTL file - * + * * @param meshList * meshes to export * @param objFile @@ -91,7 +91,7 @@ public class ObjExporter { if (!meshList.isEmpty()) { int firstVertexIndex = 0; boolean firstFiles = true; - final List<ObjMaterial> materialList = new ArrayList<ObjMaterial>(); + final List<ObjMaterial> materialList = new ArrayList<>(); for (final Mesh mesh : meshList) { if (mesh != null) { if (mesh.getControllerCount() == 0 || !(mesh.getController(0) instanceof KeyframeController)) { @@ -101,7 +101,7 @@ public class ObjExporter { firstVertexIndex += mesh.getMeshData().getVertexCount(); } else { final KeyframeController<?> controller = (KeyframeController<?>) mesh.getController(0); - final ArrayList<Mesh> subMeshList = new ArrayList<Mesh>(); + final ArrayList<Mesh> subMeshList = new ArrayList<>(); for (final KeyframeController.PointInTime pit : controller._keyframes) { if (pit != null && pit._newShape != null) { subMeshList.add(pit._newShape); @@ -122,7 +122,7 @@ public class ObjExporter { /** * Save a mesh to the given files. - * + * * @param mesh * mesh to export * @param objFile @@ -155,199 +155,209 @@ public class ObjExporter { parentDirectory.mkdirs(); } } - PrintWriter objPw = null, mtlPw = null; try { // fills the MTL file final String mtlName; if (mtlFile != null) { - final FileOutputStream mtlOs = new FileOutputStream(mtlFile, append); - mtlPw = new PrintWriter(new BufferedOutputStream(mtlOs)); - // writes some comments - if (firstFiles) { - mtlPw.println("# Ardor3D 1.0 MTL file"); - } - final ObjMaterial currentMtl = new ObjMaterial(null); - final MaterialState mtlState = (MaterialState) mesh.getLocalRenderState(StateType.Material); - if (mtlState != null) { - final ReadOnlyColorRGBA ambientColor = mtlState.getAmbient(); - if (ambientColor != null) { - currentMtl.d = ambientColor.getAlpha(); - currentMtl.Ka = new float[] { ambientColor.getRed(), ambientColor.getGreen(), - ambientColor.getBlue(), ambientColor.getAlpha() }; + try (final FileOutputStream mtlOs = new FileOutputStream(mtlFile, append); + final PrintWriter mtlPw = new PrintWriter(new BufferedOutputStream(mtlOs))) { + // writes some comments + if (firstFiles) { + mtlPw.println("# Ardor3D 1.0 MTL file"); } - final ReadOnlyColorRGBA diffuseColor = mtlState.getDiffuse(); - if (diffuseColor != null) { - currentMtl.Kd = new float[] { diffuseColor.getRed(), diffuseColor.getGreen(), - diffuseColor.getBlue(), diffuseColor.getAlpha() }; - } - final ReadOnlyColorRGBA specularColor = mtlState.getSpecular(); - if (specularColor != null) { - currentMtl.Ks = new float[] { specularColor.getRed(), specularColor.getGreen(), - specularColor.getBlue(), specularColor.getAlpha() }; - } - currentMtl.Ns = mtlState.getShininess(); - } - if (customTextureName == null) { - currentMtl.textureName = getLocalMeshTextureName(mesh); - } else { - currentMtl.textureName = customTextureName; - } - if (mesh.getSceneHints().getLightCombineMode() == LightCombineMode.Off) { - // Color on and Ambient off - currentMtl.illumType = 0; - } else { - // Color on and Ambient on - currentMtl.illumType = 1; - } - ObjMaterial sameObjMtl = null; - if (materialList != null && !materialList.isEmpty()) { - for (final ObjMaterial mtl : materialList) { - if (mtl.illumType == currentMtl.illumType && mtl.Ns == currentMtl.Ns - && mtl.forceBlend == currentMtl.forceBlend && mtl.d == currentMtl.d - && Arrays.equals(mtl.Ka, currentMtl.Ka) && Arrays.equals(mtl.Kd, currentMtl.Kd) - && Arrays.equals(mtl.Ks, currentMtl.Ks) - //&& Objects.equals(mtl.textureName, currentMtl.textureName)) { - && mtl.textureName.equals(currentMtl.textureName)) { - sameObjMtl = mtl; - break; + final ObjMaterial currentMtl = new ObjMaterial(null); + final MaterialState mtlState = (MaterialState) mesh.getLocalRenderState(StateType.Material); + if (mtlState != null) { + final ReadOnlyColorRGBA ambientColor = mtlState.getAmbient(); + if (ambientColor != null) { + currentMtl.setAmbientRed(ambientColor.getRed()); + currentMtl.setAmbientGreen(ambientColor.getGreen()); + currentMtl.setAmbientBlue(ambientColor.getBlue()); + currentMtl.setAmbientAlpha(ambientColor.getAlpha()); + } + final ReadOnlyColorRGBA diffuseColor = mtlState.getDiffuse(); + if (diffuseColor != null) { + currentMtl.setDiffuseRed(diffuseColor.getRed()); + currentMtl.setDiffuseGreen(diffuseColor.getGreen()); + currentMtl.setDiffuseBlue(diffuseColor.getBlue()); + currentMtl.setDiffuseAlpha(diffuseColor.getAlpha()); + } + final ReadOnlyColorRGBA specularColor = mtlState.getSpecular(); + if (specularColor != null) { + currentMtl.setSpecularRed(specularColor.getRed()); + currentMtl.setSpecularGreen(specularColor.getGreen()); + currentMtl.setSpecularBlue(specularColor.getBlue()); + currentMtl.setSpecularAlpha(specularColor.getAlpha()); } + currentMtl.setShininess(mtlState.getShininess()); } - } - if (sameObjMtl == null) { - // writes the new material library - mtlName = mtlFile.getName().trim().replaceAll(" ", "") + "_" - + (materialList == null ? 1 : materialList.size() + 1); - if (materialList != null) { - final ObjMaterial mtl = new ObjMaterial(mtlName); - mtl.illumType = currentMtl.illumType; - mtl.textureName = currentMtl.textureName; - materialList.add(mtl); + if (customTextureName == null) { + currentMtl.setTextureName(getLocalMeshTextureName(mesh)); + } else { + currentMtl.setTextureName(customTextureName); } - mtlPw.println("newmtl " + mtlName); - if (currentMtl.Ns != -1) { - mtlPw.println("Ns " + currentMtl.Ns); + if (mesh.getSceneHints().getLightCombineMode() == LightCombineMode.Off) { + // Color on and Ambient off + currentMtl.setIllumType(0); + } else { + // Color on and Ambient on + currentMtl.setIllumType(1); } - if (currentMtl.Ka != null) { - mtlPw.print("Ka"); - for (final float KaCoef : currentMtl.Ka) { - mtlPw.print(" " + KaCoef); + ObjMaterial sameObjMtl = null; + if (materialList != null && !materialList.isEmpty()) { + for (final ObjMaterial mtl : materialList) { + if (mtl.getIllumType() == currentMtl.getIllumType() + && mtl.getShininess() == currentMtl.getShininess() + && mtl.isForceBlend() == currentMtl.isForceBlend() + && mtl.getAmbientRed() == currentMtl.getAmbientRed() + && mtl.getAmbientGreen() == currentMtl.getAmbientGreen() + && mtl.getAmbientBlue() == currentMtl.getAmbientBlue() + && mtl.getAmbientAlpha() == currentMtl.getAmbientAlpha() + && mtl.getDiffuseRed() == currentMtl.getDiffuseRed() + && mtl.getDiffuseGreen() == currentMtl.getDiffuseGreen() + && mtl.getDiffuseBlue() == currentMtl.getDiffuseBlue() + && mtl.getDiffuseAlpha() == currentMtl.getDiffuseAlpha() + && mtl.getSpecularRed() == currentMtl.getSpecularRed() + && mtl.getSpecularGreen() == currentMtl.getSpecularGreen() + && mtl.getSpecularBlue() == currentMtl.getSpecularBlue() + && mtl.getSpecularAlpha() == currentMtl.getSpecularAlpha() + && mtl.getEmissiveRed() == currentMtl.getEmissiveRed() + && mtl.getEmissiveGreen() == currentMtl.getEmissiveGreen() + && mtl.getEmissiveBlue() == currentMtl.getEmissiveBlue() + && mtl.getEmissiveAlpha() == currentMtl.getEmissiveAlpha() + && Objects.equals(mtl.getTextureName(), currentMtl.getTextureName())) { + sameObjMtl = mtl; + break; + } } - mtlPw.println(); } - if (currentMtl.Kd != null) { - mtlPw.print("Kd"); - for (final float KdCoef : currentMtl.Kd) { - mtlPw.print(" " + KdCoef); + if (sameObjMtl == null) { + // writes the new material library + mtlName = mtlFile.getName().trim().replaceAll(" ", "") + "_" + + (materialList == null ? 1 : materialList.size() + 1); + if (materialList != null) { + final ObjMaterial mtl = new ObjMaterial(mtlName); + mtl.setIllumType(currentMtl.getIllumType()); + mtl.setTextureName(currentMtl.getTextureName()); + materialList.add(mtl); } - mtlPw.println(); - } - if (currentMtl.Ks != null) { - mtlPw.print("Ks"); - for (final float KsCoef : currentMtl.Ks) { - mtlPw.print(" " + KsCoef); + mtlPw.println("newmtl " + mtlName); + if (currentMtl.getShininess() != -1) { + mtlPw.println("Ns " + currentMtl.getShininess()); } - mtlPw.println(); - } - if (currentMtl.d != -1) { - mtlPw.println("d " + currentMtl.d); - } - mtlPw.println("illum " + currentMtl.illumType); - if (currentMtl.textureName != null) { - mtlPw.println("map_Kd " + currentMtl.textureName); + if (currentMtl.getAmbientRed() != -1 && currentMtl.getAmbientGreen() != -1 + && currentMtl.getAmbientBlue() != -1) { + mtlPw.println("Ka " + currentMtl.getAmbientRed() + " " + currentMtl.getAmbientGreen() + " " + + currentMtl.getAmbientBlue()); + } + if (currentMtl.getDiffuseRed() != -1 && currentMtl.getDiffuseGreen() != -1 + && currentMtl.getDiffuseBlue() != -1) { + mtlPw.println("Kd " + currentMtl.getDiffuseRed() + " " + currentMtl.getDiffuseGreen() + " " + + currentMtl.getDiffuseBlue()); + } + if (currentMtl.getSpecularRed() != -1 && currentMtl.getSpecularGreen() != -1 + && currentMtl.getSpecularBlue() != -1) { + mtlPw.println("Ks " + currentMtl.getSpecularRed() + " " + currentMtl.getSpecularGreen() + + " " + currentMtl.getSpecularBlue()); + } + // exports only a consistent dissolve value when all alpha components are equal + if (currentMtl.getAmbientAlpha() != -1 + && currentMtl.getAmbientAlpha() == currentMtl.getDiffuseAlpha() + && currentMtl.getDiffuseAlpha() == currentMtl.getSpecularAlpha() + && currentMtl.getSpecularAlpha() == currentMtl.getEmissiveAlpha()) { + mtlPw.println("d " + currentMtl.getAmbientAlpha()); + } + mtlPw.println("illum " + currentMtl.getIllumType()); + if (currentMtl.getTextureName() != null) { + mtlPw.println("map_Kd " + currentMtl.getTextureName()); + } + } else { + mtlName = sameObjMtl.getName(); } - } else { - mtlName = sameObjMtl.getName(); } } else { mtlName = null; } - final FileOutputStream objOs = new FileOutputStream(objFile, append); - objPw = new PrintWriter(new BufferedOutputStream(objOs)); - // writes some comments - if (firstFiles) { - objPw.println("# Ardor3D 1.0 OBJ file"); - objPw.println("# www.ardor3d.com"); - // writes the material file name if any + try (final FileOutputStream objOs = new FileOutputStream(objFile, append); + final PrintWriter objPw = new PrintWriter(new BufferedOutputStream(objOs))) { + // writes some comments + if (firstFiles) { + objPw.println("# Ardor3D 1.0 OBJ file"); + objPw.println("# www.ardor3d.com"); + // writes the material file name if any + if (mtlFile != null) { + final String mtlLibFilename = mtlFile.getName(); + objPw.println("mtllib " + mtlLibFilename); + } + } + // writes the object name + final String objName; + String meshName = mesh.getName(); + // removes all spaces from the mesh name + if (meshName != null && !meshName.isEmpty()) { + meshName = meshName.trim().replaceAll(" ", ""); + } + if (meshName != null && !meshName.isEmpty()) { + objName = meshName; + } else { + objName = "obj_mesh" + mesh.hashCode(); + } + objPw.println("o " + objName); + final MeshData meshData = mesh.getMeshData(); + // writes the coordinates + final FloatBufferData verticesData = meshData.getVertexCoords(); + if (verticesData == null) { + throw new IllegalArgumentException("cannot export a mesh with no vertices"); + } + final int expectedTupleCount = verticesData.getTupleCount(); + saveFloatBufferData(verticesData, objPw, "v", expectedTupleCount); + final FloatBufferData texCoordsData = meshData.getTextureCoords(0); + saveFloatBufferData(texCoordsData, objPw, "vt", expectedTupleCount); + final FloatBufferData normalsData = meshData.getNormalCoords(); + saveFloatBufferData(normalsData, objPw, "vn", expectedTupleCount); + // writes the used material library if (mtlFile != null) { - final String mtlLibFilename = mtlFile.getName(); - objPw.println("mtllib " + mtlLibFilename); + objPw.println("usemtl " + mtlName); } - } - // writes the object name - final String objName; - String meshName = mesh.getName(); - // removes all spaces from the mesh name - if (meshName != null && !meshName.isEmpty()) { - meshName = meshName.trim().replaceAll(" ", ""); - } - if (meshName != null && !meshName.isEmpty()) { - objName = meshName; - } else { - objName = "obj_mesh" + mesh.hashCode(); - } - objPw.println("o " + objName); - final MeshData meshData = mesh.getMeshData(); - // writes the coordinates - final FloatBufferData verticesData = meshData.getVertexCoords(); - if (verticesData == null) { - throw new IllegalArgumentException("cannot export a mesh with no vertices"); - } - final int expectedTupleCount = verticesData.getTupleCount(); - saveFloatBufferData(verticesData, objPw, "v", expectedTupleCount); - final FloatBufferData texCoordsData = meshData.getTextureCoords(0); - saveFloatBufferData(texCoordsData, objPw, "vt", expectedTupleCount); - final FloatBufferData normalsData = meshData.getNormalCoords(); - saveFloatBufferData(normalsData, objPw, "vn", expectedTupleCount); - // writes the used material library - if (mtlFile != null) { - objPw.println("usemtl " + mtlName); - } - // writes the faces - for (int sectionIndex = 0; sectionIndex < meshData.getSectionCount(); sectionIndex++) { - final IndexMode indexMode = meshData.getIndexMode(sectionIndex); - final int[] indices = new int[indexMode.getVertexCount()]; - switch (indexMode) { - case TriangleFan: - case Triangles: - case TriangleStrip: - case Quads: - for (int primIndex = 0, primCount = meshData.getPrimitiveCount(sectionIndex); primIndex < primCount; primIndex++) { - meshData.getPrimitiveIndices(primIndex, sectionIndex, indices); - objPw.print("f"); - for (int vertexIndex = 0; vertexIndex < indices.length; vertexIndex++) { - // indices start at 1 in the WaveFront OBJ format whereas indices start at 0 in - // Ardor3D - final int shiftedIndex = indices[vertexIndex] + 1 + firstVertexIndex; - // vertex index - objPw.print(" " + shiftedIndex); - // texture coordinate index - if (texCoordsData != null) { - objPw.print("/" + shiftedIndex); - } - // normal coordinate index - if (normalsData != null) { - objPw.print("/" + shiftedIndex); + // writes the faces + for (int sectionIndex = 0; sectionIndex < meshData.getSectionCount(); sectionIndex++) { + final IndexMode indexMode = meshData.getIndexMode(sectionIndex); + final int[] indices = new int[indexMode.getVertexCount()]; + switch (indexMode) { + case TriangleFan: + case Triangles: + case TriangleStrip: + case Quads: + for (int primIndex = 0, primCount = meshData + .getPrimitiveCount(sectionIndex); primIndex < primCount; primIndex++) { + meshData.getPrimitiveIndices(primIndex, sectionIndex, indices); + objPw.print("f"); + for (int vertexIndex = 0; vertexIndex < indices.length; vertexIndex++) { + // indices start at 1 in the WaveFront OBJ format whereas indices start at 0 in + // Ardor3D + final int shiftedIndex = indices[vertexIndex] + 1 + firstVertexIndex; + // vertex index + objPw.print(" " + shiftedIndex); + // texture coordinate index + if (texCoordsData != null) { + objPw.print("/" + shiftedIndex); + } + // normal coordinate index + if (normalsData != null) { + objPw.print("/" + shiftedIndex); + } } + objPw.println(); } - objPw.println(); - } - break; - default: - throw new IllegalArgumentException("index mode " + indexMode + " not supported"); + break; + default: + throw new IllegalArgumentException("index mode " + indexMode + " not supported"); + } } } } catch (final Throwable t) { throw new Error("Unable to save the mesh into an obj", t); - } finally { - if (objPw != null) { - objPw.flush(); - objPw.close(); - } - if (mtlPw != null) { - mtlPw.flush(); - mtlPw.close(); - } } } @@ -357,25 +367,30 @@ public class ObjExporter { final TextureState textureState = (TextureState) mesh.getLocalRenderState(StateType.Texture); if (textureState.isEnabled() && textureState.getTexture() != null) { final TextureKey tKey = textureState.getTexture().getTextureKey(); - final String tmpTextureName = tKey.getSource().getName(); - final int lastIndexOfUnixPathSeparator = tmpTextureName.lastIndexOf('/'); - final int lastIndexOfWindowsPathSeparator = tmpTextureName.lastIndexOf('\\'); - if (lastIndexOfUnixPathSeparator != -1) { - textureName = tmpTextureName.substring(lastIndexOfUnixPathSeparator + 1); - } else { - if (lastIndexOfWindowsPathSeparator != -1) { - textureName = tmpTextureName.substring(lastIndexOfWindowsPathSeparator + 1); + if (tKey != null && tKey.getSource() != null) { + final String tmpTextureName = tKey.getSource().getName(); + final int lastIndexOfUnixPathSeparator = tmpTextureName.lastIndexOf('/'); + final int lastIndexOfWindowsPathSeparator = tmpTextureName.lastIndexOf('\\'); + if (lastIndexOfUnixPathSeparator != -1) { + textureName = tmpTextureName.substring(lastIndexOfUnixPathSeparator + 1); } else { - textureName = tmpTextureName; + if (lastIndexOfWindowsPathSeparator != -1) { + textureName = tmpTextureName.substring(lastIndexOfWindowsPathSeparator + 1); + } else { + textureName = tmpTextureName; + } + } + if (tKey.isFlipped()) { + ObjExporter.logger.warning("The texture " + tmpTextureName + + " will have to be flipped manually when loading this OBJ file"); + } else { + ObjExporter.logger.warning("The texture " + tmpTextureName + + " might need to be flipped manually when loading this OBJ file"); } - } - if (tKey.isFlipped()) { - ObjExporter.logger.warning("The texture " + tmpTextureName - + " will have to be flipped manually when loading this OBJ file"); } else { - ObjExporter.logger.warning("The texture " + tmpTextureName - + " might need to be flipped manually when loading this OBJ file"); + textureName = null; } + } else { textureName = null; } @@ -394,9 +409,9 @@ public class ObjExporter { final int tupleSize = data.getValuesPerTuple(); final int tupleCount = data.getTupleCount(); if (tupleCount < expectedTupleCount) { - throw new IllegalArgumentException("[" + keyword - + "] not enough data to match with the vertex count: " + tupleCount + " < " - + expectedTupleCount); + throw new IllegalArgumentException( + "[" + keyword + "] not enough data to match with the vertex count: " + tupleCount + " < " + + expectedTupleCount); } else { if (tupleCount > expectedTupleCount) { ObjExporter.logger.warning("[" + keyword + "] too much data to match with the vertex count: " diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjGeometryStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjGeometryStore.java index bd96824..aced00f 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjGeometryStore.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjGeometryStore.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,7 +12,9 @@ package com.ardor3d.extension.model.obj; import java.nio.Buffer; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.EnumSet; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -33,8 +35,6 @@ import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.geom.GeometryTool; import com.ardor3d.util.geom.GeometryTool.MatchCondition; import com.ardor3d.util.geom.VertGroupData; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; public class ObjGeometryStore { private static final String DEFAULT_GROUP = "_default_"; @@ -45,7 +45,7 @@ public class ObjGeometryStore { private int _totalLines = 0; private int _totalMeshes = 0; private final Node _root = new Node(); - private final Map<String, Spatial> _groupMap = Maps.newHashMap(); + private final Map<String, Spatial> _groupMap = new HashMap<>(); private ObjMaterial _currentMaterial = new ObjMaterial("default"); private String _currentObjectName; @@ -55,11 +55,18 @@ public class ObjGeometryStore { private ObjSetManager _lineManager; private ObjSetManager _pointManager; - private final Map<String, ObjMaterial> materialLibrary = Maps.newHashMap(); - private final Map<Spatial, String> _materialMap = Maps.newHashMap(); + private final Map<String, ObjMaterial> materialLibrary = new HashMap<>(); + private final Map<Spatial, String> _materialMap = new HashMap<>(); + + private final GeometryTool _geometryTool; public ObjGeometryStore() { + this(new GeometryTool()); + } + + public ObjGeometryStore(final GeometryTool geometryTool) { super(); + _geometryTool = geometryTool; } public Map<String, ObjMaterial> getMaterialLibrary() { @@ -185,14 +192,14 @@ public class ObjGeometryStore { } final Point points = new Point(name, vertices, null, null, null); - final IndexBufferData<? extends Buffer> indexBuffer = BufferUtils.createIndexBufferData(_pointManager - .getIndices().size(), vertices.length - 1); + final IndexBufferData<? extends Buffer> indexBuffer = BufferUtils + .createIndexBufferData(_pointManager.getIndices().size(), vertices.length - 1); for (final int index : _pointManager.getIndices()) { indexBuffer.put(index); } points.getMeshData().setIndices(indexBuffer); - GeometryTool.minimizeVerts(points, EnumSet.noneOf(MatchCondition.class)); + _geometryTool.minimizeVerts(points, EnumSet.noneOf(MatchCondition.class)); applyCurrentMaterial(points); mapToGroups(points); @@ -226,8 +233,8 @@ public class ObjGeometryStore { } final Line line = new Line(name, vertices, null, null, hasUVs ? uvs : null); - final IndexBufferData<? extends Buffer> indexBuffer = BufferUtils.createIndexBufferData(_lineManager - .getIndices().size(), vertices.length - 1); + final IndexBufferData<? extends Buffer> indexBuffer = BufferUtils + .createIndexBufferData(_lineManager.getIndices().size(), vertices.length - 1); for (final int index : _lineManager.getIndices()) { indexBuffer.put(index); } @@ -240,7 +247,7 @@ public class ObjGeometryStore { } line.getMeshData().setIndexLengths(lengths); } - GeometryTool.minimizeVerts(line, EnumSet.of(MatchCondition.UVs)); + _geometryTool.minimizeVerts(line, EnumSet.of(MatchCondition.UVs)); applyCurrentMaterial(line); mapToGroups(line); @@ -267,7 +274,7 @@ public class ObjGeometryStore { int j = 0; final long[] vertGroups = new long[_meshManager.getStore().size()]; - final List<Long> groups = Lists.newArrayList(); + final List<Long> groups = new ArrayList<>(); Vector3 vector; for (final ObjIndexSet set : _meshManager.getStore().keySet()) { vertGroups[j] = set.getSmoothGroup(); @@ -302,8 +309,8 @@ public class ObjGeometryStore { mesh.getMeshData().setTextureBuffer(uvs, 0); } - final IndexBufferData<? extends Buffer> indexBuffer = BufferUtils.createIndexBufferData(_meshManager - .getIndices().size(), _meshManager.getStore().size() - 1); + final IndexBufferData<? extends Buffer> indexBuffer = BufferUtils + .createIndexBufferData(_meshManager.getIndices().size(), _meshManager.getStore().size() - 1); for (final int index : _meshManager.getIndices()) { indexBuffer.put(index); } @@ -319,7 +326,7 @@ public class ObjGeometryStore { groupData.setVertGroups(vertGroups); groupData.setGroupConditions(VertGroupData.DEFAULT_GROUP, EnumSet.of(MatchCondition.Normal, MatchCondition.UVs)); - GeometryTool.minimizeVerts(mesh, groupData); + _geometryTool.minimizeVerts(mesh, groupData); applyCurrentMaterial(mesh); mapToGroups(mesh); @@ -349,7 +356,7 @@ public class ObjGeometryStore { target.getSceneHints().setRenderBucketType(RenderBucketType.Transparent); } - if (_currentMaterial.illumType == 0) { + if (_currentMaterial.getIllumType() == 0) { target.getSceneHints().setLightCombineMode(LightCombineMode.Off); } diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java index 4328e19..620ae55 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,6 +12,7 @@ package com.ardor3d.extension.model.obj; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.logging.Logger; @@ -21,10 +22,10 @@ import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.math.MathUtils; import com.ardor3d.math.Vector3; import com.ardor3d.util.TextureManager; +import com.ardor3d.util.geom.GeometryTool; import com.ardor3d.util.resource.ResourceLocator; import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.ResourceSource; -import com.google.common.collect.Lists; /** * Wavefront OBJ importer. See <a href="http://local.wasp.uwa.edu.au/~pbourke/dataformats/obj/">the format spec</a> @@ -48,24 +49,20 @@ public class ObjImporter { return _loadTextures; } - public ObjImporter setLoadTextures(final boolean loadTextures) { + public void setLoadTextures(final boolean loadTextures) { _loadTextures = loadTextures; - return this; } - public ObjImporter setTextureLocator(final ResourceLocator locator) { + public void setTextureLocator(final ResourceLocator locator) { _textureLocator = locator; - return this; } - public ObjImporter setModelLocator(final ResourceLocator locator) { + public void setModelLocator(final ResourceLocator locator) { _modelLocator = locator; - return this; } - public ObjImporter setMaterialLocator(final ResourceLocator locator) { + public void setMaterialLocator(final ResourceLocator locator) { _materialLocator = locator; - return this; } public void setFlipTextureVertically(final boolean flipTextureVertically) { @@ -108,6 +105,19 @@ public class ObjImporter { * @return an ObjGeometryStore data object containing the scene and other useful elements. */ public ObjGeometryStore load(final String resource) { + return load(resource, new GeometryTool()); + } + + /** + * Reads a Wavefront OBJ file from the given resource + * + * @param resource + * the name of the resource to find. + * @param geometryTool + * the geometry tool used to minimize the vertex count. + * @return an ObjGeometryStore data object containing the scene and other useful elements. + */ + public ObjGeometryStore load(final String resource, final GeometryTool geometryTool) { final ResourceSource source; if (_modelLocator == null) { source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, resource); @@ -119,7 +129,7 @@ public class ObjImporter { throw new Error("Unable to locate '" + resource + "'"); } - return load(source); + return load(source, geometryTool); } /** @@ -130,11 +140,22 @@ public class ObjImporter { * @return an ObjGeometryStore data object containing the scene and other useful elements. */ public ObjGeometryStore load(final ResourceSource resource) { - try { - final ObjGeometryStore store = new ObjGeometryStore(); - long currentSmoothGroup = -1; + return load(resource, new GeometryTool()); + } - final BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream())); + /** + * Reads a Wavefront OBJ file from the given resource + * + * @param resource + * the name of the resource to find. + * @param geometryTool + * the geometry tool used to minimize the vertex count. + * @return an ObjGeometryStore data object containing the scene and other useful elements. + */ + public ObjGeometryStore load(final ResourceSource resource, final GeometryTool geometryTool) { + try (final BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream()))) { + final ObjGeometryStore store = new ObjGeometryStore(geometryTool); + long currentSmoothGroup = -1; String line; int lineNo = 0; while ((line = reader.readLine()) != null) { @@ -204,7 +225,7 @@ public class ObjImporter { else if ("cstype".equals(keyword)) { // TODO: Add support for cstype ObjImporter.logger - .warning("ObjModelImporter: cstype not supported. (line " + lineNo + ") " + line); + .warning("ObjModelImporter: cstype not supported. (line " + lineNo + ") " + line); } // if degree @@ -232,7 +253,7 @@ public class ObjImporter { if (tokens.length < 2) { store.setCurrentGroupNames(null); continue; - // throw new Error("wrong number of args. g must have at least 1 argument. (line " + lineNo + // throw new Error("wrong number of args. g must have at least 1 argument. (line " + lineNo // + ") " + line); } @@ -245,7 +266,8 @@ public class ObjImporter { // if smoothing group else if ("s".equals(keyword)) { if (tokens.length != 2) { - throw new Error("wrong number of args. s must have 1 argument. (line " + lineNo + ") " + line); + throw new Error( + "wrong number of args. s must have 1 argument. (line " + lineNo + ") " + line); } if ("off".equalsIgnoreCase(tokens[1])) { @@ -264,7 +286,8 @@ public class ObjImporter { // if object name else if ("o".equals(keyword)) { if (tokens.length < 2) { - throw new Error("wrong number of args. o must have 1 argument. (line " + lineNo + ") " + line); + throw new Error( + "wrong number of args. o must have 1 argument. (line " + lineNo + ") " + line); } store.setCurrentObjectName(tokens[1]); } @@ -287,8 +310,8 @@ public class ObjImporter { // if use material command else if ("usemtl".equals(keyword)) { if (tokens.length != 2) { - throw new Error("wrong number of args. usemtl must have 1 argument. (line " + lineNo + ") " - + line); + throw new Error( + "wrong number of args. usemtl must have 1 argument. (line " + lineNo + ") " + line); } // set new material @@ -300,12 +323,12 @@ public class ObjImporter { // if point else if ("p".equals(keyword) && tokens.length > 1) { if (tokens.length < 2) { - throw new Error("wrong number of args. p must have at least 1 vertex. (line " + lineNo + ") " - + line); + throw new Error( + "wrong number of args. p must have at least 1 vertex. (line " + lineNo + ") " + line); } // Each token corresponds to 1 vertex entry - final List<ObjIndexSet> indices = Lists.newArrayList(); + final List<ObjIndexSet> indices = new ArrayList<>(); for (int i = 1; i < tokens.length; i++) { indices.add(new ObjIndexSet(tokens[i], store.getDataStore(), currentSmoothGroup)); } @@ -320,7 +343,7 @@ public class ObjImporter { } // Each token corresponds to 1 vertex entry and possibly one texture entry - final List<ObjIndexSet> indices = Lists.newArrayList(); + final List<ObjIndexSet> indices = new ArrayList<>(); for (int i = 1; i < tokens.length; i++) { indices.add(new ObjIndexSet(tokens[i], store.getDataStore(), currentSmoothGroup)); } @@ -335,7 +358,7 @@ public class ObjImporter { } // Each token corresponds to 1 vertex entry and possibly one texture entry and normal entry. - final List<ObjIndexSet> indices = Lists.newArrayList(); + final List<ObjIndexSet> indices = new ArrayList<>(); for (int i = 1; i < tokens.length; i++) { indices.add(new ObjIndexSet(tokens[i], store.getDataStore(), currentSmoothGroup)); } @@ -364,8 +387,8 @@ public class ObjImporter { store.commitObjects(); store.cleanup(); return store; - } catch (final Exception e) { - throw new Error("Unable to load obj resource from URL: " + resource, e); + } catch (final Throwable t) { + throw new Error("Unable to load obj resource from URL: " + resource, t); } } @@ -396,7 +419,7 @@ public class ObjImporter { } /** - * Load a .mtl resource + * Load a .mtl resource, see <a href="http://paulbourke.net/dataformats/mtl/">the format specification</a> * * @param resource * the mtl file to load, as a ResourceSource @@ -453,58 +476,98 @@ public class ObjImporter { // if ambient value if ("Ka".equals(keyword)) { - currentMaterial.Ka = new float[] { Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]), - Float.parseFloat(tokens[3]) }; + currentMaterial.setAmbientRed(Float.parseFloat(tokens[1])); + currentMaterial.setAmbientGreen(Float.parseFloat(tokens[2])); + currentMaterial.setAmbientBlue(Float.parseFloat(tokens[3])); } // if diffuse value else if ("Kd".equals(keyword)) { - currentMaterial.Kd = new float[] { Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]), - Float.parseFloat(tokens[3]) }; + currentMaterial.setDiffuseRed(Float.parseFloat(tokens[1])); + currentMaterial.setDiffuseGreen(Float.parseFloat(tokens[2])); + currentMaterial.setDiffuseBlue(Float.parseFloat(tokens[3])); } // if specular value else if ("Ks".equals(keyword)) { - currentMaterial.Ks = new float[] { Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]), - Float.parseFloat(tokens[3]) }; + currentMaterial.setSpecularRed(Float.parseFloat(tokens[1])); + currentMaterial.setSpecularGreen(Float.parseFloat(tokens[2])); + currentMaterial.setSpecularBlue(Float.parseFloat(tokens[3])); + } + // if transmission filter + else if ("Tf".equals(keyword)) { + // TODO: Add support for Tf + } + // if sharpness value + else if ("sharpness".equals(keyword)) { + // TODO: Add support for sharpness + } + // if optical density + else if ("Ni".equals(keyword)) { + // TODO: Add support for Ni + } + // if disp + else if ("disp".equals(keyword)) { + // TODO: Add support for disp + } + // if decal value + else if ("decal".equals(keyword)) { + // TODO: Add support for decal + } + // if bump + else if ("bump".equals(keyword)) { + // TODO: Add support for bump } - // if illumination style else if ("illum".equals(keyword)) { - currentMaterial.illumType = Integer.parseInt(tokens[1]); + currentMaterial.setIllumType(Integer.parseInt(tokens[1])); } // if "dissolve" (alpha) value else if ("d".equals(keyword)) { - currentMaterial.d = Float.parseFloat(tokens[1]); + final float d; + if ("-halo".equalsIgnoreCase(tokens[1])) { + // TODO: Add support for halo + d = Float.parseFloat(tokens[2]); + } else { + d = Float.parseFloat(tokens[1]); + } + currentMaterial.setAmbientAlpha(d); + currentMaterial.setDiffuseAlpha(d); + currentMaterial.setSpecularAlpha(d); + currentMaterial.setEmissiveAlpha(d); } // if ambient value else if ("Ns".equals(keyword)) { final float Ns = Float.parseFloat(tokens[1]); - currentMaterial.Ns = 128 * MathUtils.clamp(Ns, 0, _specularMax) / _specularMax; + currentMaterial.setShininess(128 * MathUtils.clamp(Ns, 0, _specularMax) / _specularMax); } // if we mapped a texture to alpha else if ("map_d".equals(keyword)) { // force blending... probably also used texture in map_Kd, etc. - currentMaterial.forceBlend = true; + currentMaterial.setForceBlend(true); } // if texture else if (isLoadTextures() && "map_Kd".equals(keyword)) { // TODO: it's possible for map_Kd to have arguments, then filename. final String textureName = line.substring("map_Kd".length()).trim(); - currentMaterial.textureName = textureName; + currentMaterial.setTextureName(textureName); if (_textureLocator == null) { - currentMaterial.map_Kd = TextureManager.load(textureName, getMinificationFilter(), - isUseCompression() ? TextureStoreFormat.GuessCompressedFormat - : TextureStoreFormat.GuessNoCompressedFormat, isFlipTextureVertically()); + currentMaterial + .setMap_Kd(TextureManager.load(textureName, getMinificationFilter(), + isUseCompression() ? TextureStoreFormat.GuessCompressedFormat + : TextureStoreFormat.GuessNoCompressedFormat, + isFlipTextureVertically())); } else { final ResourceSource source = _textureLocator.locateResource(textureName); - currentMaterial.map_Kd = TextureManager.load(source, getMinificationFilter(), - isUseCompression() ? TextureStoreFormat.GuessCompressedFormat - : TextureStoreFormat.GuessNoCompressedFormat, isFlipTextureVertically()); + currentMaterial + .setMap_Kd(TextureManager.load(source, getMinificationFilter(), + isUseCompression() ? TextureStoreFormat.GuessCompressedFormat + : TextureStoreFormat.GuessNoCompressedFormat, + isFlipTextureVertically())); } } } diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjIndexSet.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjIndexSet.java index 0e2bec1..ffd7576 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjIndexSet.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjIndexSet.java @@ -1,15 +1,17 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.model.obj; +import java.util.Objects; + public class ObjIndexSet { private final int _vIndex, _vtIndex; private final long _sGroup; @@ -64,12 +66,8 @@ public class ObjIndexSet { @Override public int hashCode() { - int result = 17; - result += 31 * result + _vIndex; - result += 31 * result + _vtIndex; - result += 31 * result + _vnIndex; - result += 31 * result + _sGroup; - return result; + return Objects.hash(Integer.valueOf(getVIndex()), Integer.valueOf(getVtIndex()), Integer.valueOf(getVnIndex()), + Long.valueOf(getSmoothGroup())); } @Override diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjMaterial.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjMaterial.java index f060cec..ccb8a46 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjMaterial.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjMaterial.java @@ -1,54 +1,37 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.model.obj; +import com.ardor3d.extension.model.util.AbstractMaterial; import com.ardor3d.image.Texture; -import com.ardor3d.math.ColorRGBA; -import com.ardor3d.math.MathUtils; -import com.ardor3d.renderer.state.BlendState; -import com.ardor3d.renderer.state.MaterialState; import com.ardor3d.renderer.state.TextureState; -public class ObjMaterial { +/** + * WaveFront OBJ material (MTL). <code>Ns</code> matches with the shininess, <code>d</code> matches with the alpha + * component(s), <code>Ka</code> matches with the ambient RGB components, <code>Kd</code> matches with the diffuse RGB + * components, <code>Ks</code> matches with the specular RGB components. + */ +public class ObjMaterial extends AbstractMaterial { private final String name; - float[] Ka = null; - float[] Kd = null; - float[] Ks = null; - float Ns = -1; - - String textureName; - Texture map_Kd = null; + private String textureName; - int illumType = 2; + private Texture map_Kd; - boolean forceBlend = false; - float d = -1; + private int illumType; public ObjMaterial(final String name) { + super(); this.name = name; - } - - public BlendState getBlendState() { - if (forceBlend || d != -1 && d < 1.0f) { - final BlendState blend = new BlendState(); - blend.setBlendEnabled(true); - blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha); - blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); - blend.setTestEnabled(true); - blend.setTestFunction(BlendState.TestFunction.GreaterThan); - blend.setReference(0); - return blend; - } - return null; + illumType = 2; } public TextureState getTextureState() { @@ -60,29 +43,6 @@ public class ObjMaterial { return null; } - public MaterialState getMaterialState() { - if (Ka != null || Kd != null || Ks != null || d != -1 || Ns != -1) { - final MaterialState material = new MaterialState(); - final float alpha = d != -1 ? MathUtils.clamp(d, 0, 1) : 1; - if (Ka != null) { - material.setAmbient(new ColorRGBA(Ka[0], Ka[1], Ka[2], alpha)); - } - if (Kd != null) { - material.setDiffuse(new ColorRGBA(Kd[0], Kd[1], Kd[2], alpha)); - } - if (Ks != null) { - material.setSpecular(new ColorRGBA(Ks[0], Ks[1], Ks[2], alpha)); - } - - if (Ns != -1) { - material.setShininess(Ns); - } - - return material; - } - return null; - } - public String getName() { return name; } @@ -91,7 +51,23 @@ public class ObjMaterial { return textureName; } + public void setTextureName(final String textureName) { + this.textureName = textureName; + } + public Texture getMap_Kd() { return map_Kd; } + + public void setMap_Kd(final Texture map_Kd) { + this.map_Kd = map_Kd; + } + + public int getIllumType() { + return illumType; + } + + public void setIllumType(final int illumType) { + this.illumType = illumType; + } } diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjSetManager.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjSetManager.java index 116371d..e5abb85 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjSetManager.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjSetManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,16 +10,15 @@ package com.ardor3d.extension.model.obj; +import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - public class ObjSetManager { - private final Map<ObjIndexSet, Integer> _store = Maps.newLinkedHashMap(); - private final List<Integer> _indices = Lists.newArrayList(); - private final List<Integer> _lengths = Lists.newArrayList(); + private final Map<ObjIndexSet, Integer> _store = new LinkedHashMap<>(); + private final List<Integer> _indices = new ArrayList<>(); + private final List<Integer> _lengths = new ArrayList<>(); public int findSet(final ObjIndexSet set) { if (_store.containsKey(set)) { diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyDataStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyDataStore.java new file mode 100644 index 0000000..14cd03b --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyDataStore.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.ply; + +import java.util.ArrayList; +import java.util.List; + +import com.ardor3d.math.ColorRGBA; +import com.ardor3d.math.Vector2; +import com.ardor3d.math.Vector3; + +public class PlyDataStore { + + private final List<Vector3> _vertices; + private final List<Vector3> _normals; + private final List<ColorRGBA> _colors; + private final List<Vector2> _textureCoordinates; + + public PlyDataStore() { + super(); + _vertices = new ArrayList<>(); + _normals = new ArrayList<>(); + _colors = new ArrayList<>(); + _textureCoordinates = new ArrayList<>(); + } + + public List<Vector3> getVertices() { + return _vertices; + } + + public List<Vector3> getNormals() { + return _normals; + } + + public List<ColorRGBA> getColors() { + return _colors; + } + + public List<Vector2> getTextureCoordinates() { + return _textureCoordinates; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyEdgeInfo.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyEdgeInfo.java new file mode 100644 index 0000000..e4f84f6 --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyEdgeInfo.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.ply; + +import com.ardor3d.math.ColorRGBA; + +public class PlyEdgeInfo { + + private Integer index1; + + private Integer index2; + + private ColorRGBA color; + + public PlyEdgeInfo() { + super(); + } + + public Integer getIndex1() { + return index1; + } + + public void setIndex1(final Integer index1) { + this.index1 = index1; + } + + public Integer getIndex2() { + return index2; + } + + public void setIndex2(final Integer index2) { + this.index2 = index2; + } + + public ColorRGBA getColor() { + return color; + } + + public void setColor(final ColorRGBA color) { + this.color = color; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyFaceInfo.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyFaceInfo.java new file mode 100644 index 0000000..75fc25d --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyFaceInfo.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.ply; + +import java.util.ArrayList; +import java.util.List; + +public class PlyFaceInfo { + + private List<Integer> _vertexIndices; + + private List<Integer> _materialIndices; + + private List<Float> _textureCoordinates; + + public PlyFaceInfo() { + super(); + } + + public void addVertexIndex(final int vertexIndex) { + if (_vertexIndices == null) { + _vertexIndices = new ArrayList<>(); + } + _vertexIndices.add(Integer.valueOf(vertexIndex)); + } + + public List<Integer> getVertexIndices() { + return _vertexIndices; + } + + public void addMaterialIndex(final int materialIndex) { + if (_materialIndices == null) { + _materialIndices = new ArrayList<>(); + } + _materialIndices.add(Integer.valueOf(materialIndex)); + } + + public List<Integer> getMaterialIndices() { + return _materialIndices; + } + + public void addTextureCoordinate(final float textureCoordinate) { + if (_textureCoordinates == null) { + _textureCoordinates = new ArrayList<>(); + } + _textureCoordinates.add(Float.valueOf(textureCoordinate)); + } + + public List<Float> getTextureCoordinates() { + return _textureCoordinates; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyGeometryStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyGeometryStore.java new file mode 100644 index 0000000..624665d --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyGeometryStore.java @@ -0,0 +1,313 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.ply; + +import java.nio.Buffer; +import java.nio.FloatBuffer; +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ardor3d.image.Texture; +import com.ardor3d.math.ColorRGBA; +import com.ardor3d.math.Vector2; +import com.ardor3d.math.Vector3; +import com.ardor3d.math.type.ReadOnlyColorRGBA; +import com.ardor3d.renderer.IndexMode; +import com.ardor3d.renderer.state.TextureState; +import com.ardor3d.scenegraph.IndexBufferData; +import com.ardor3d.scenegraph.Line; +import com.ardor3d.scenegraph.Mesh; +import com.ardor3d.scenegraph.Node; +import com.ardor3d.util.geom.BufferUtils; +import com.ardor3d.util.geom.GeometryTool; +import com.ardor3d.util.geom.GeometryTool.MatchCondition; + +public class PlyGeometryStore { + + private static final Logger LOGGER = Logger.getLogger(PlyGeometryStore.class.getName()); + + private int _totalMeshes = 0; + + private int _totalLines = 0; + + private final PlyDataStore _dataStore; + + private final Node _root; + + private final List<PlyMaterial> _materialLibrary; + + private List<PlyFaceInfo> _plyFaceInfoList; + + private List<PlyEdgeInfo> _plyEdgeInfoList; + + private Texture _texture; + + private String _textureName; + + private final GeometryTool _geometryTool; + + public PlyGeometryStore() { + this(new GeometryTool()); + } + + public PlyGeometryStore(final GeometryTool geometryTool) { + super(); + _dataStore = new PlyDataStore(); + _root = new Node(); + _materialLibrary = new ArrayList<>(); + _geometryTool = geometryTool; + } + + public PlyDataStore getDataStore() { + return _dataStore; + } + + public Node getScene() { + return _root; + } + + public List<PlyMaterial> getMaterialLibrary() { + return _materialLibrary; + } + + public String getTextureName() { + return _textureName; + } + + public void setTextureName(final String textureName) { + _textureName = textureName; + } + + public Texture getTexture() { + return _texture; + } + + public void setTexture(final Texture texture) { + _texture = texture; + } + + public TextureState getTextureState() { + if (_texture != null) { + final TextureState tState = new TextureState(); + tState.setTexture(_texture, 0); + return tState; + } + return null; + } + + void addLine(final PlyEdgeInfo edgeInfo) { + if (_plyEdgeInfoList == null) { + _plyEdgeInfoList = new ArrayList<>(); + } + _plyEdgeInfoList.add(edgeInfo); + } + + void addFace(final PlyFaceInfo faceInfo) { + if (_plyFaceInfoList == null) { + _plyFaceInfoList = new ArrayList<>(); + } + _plyFaceInfoList.add(faceInfo); + } + + @SuppressWarnings("null") + void commitObjects() { + if (_plyEdgeInfoList != null) { + final String name = "ply_line" + _totalLines; + boolean hasColors = false; + final boolean hasNormals = _dataStore.getNormals() != null && !_dataStore.getNormals().isEmpty(); + final int vertexCount = _plyEdgeInfoList.size() * 2; + final Vector3[] vertices = new Vector3[vertexCount]; + final Vector3[] normals = hasNormals ? null : new Vector3[vertexCount]; + ReadOnlyColorRGBA[] colors = null; + final IndexBufferData<? extends Buffer> indices = BufferUtils.createIndexBufferData(vertexCount, + vertexCount - 1); + int edgeVertexIndex = 0; + for (final PlyEdgeInfo plyEdgeInfo : _plyEdgeInfoList) { + indices.put(edgeVertexIndex).put(edgeVertexIndex + 1); + vertices[edgeVertexIndex] = _dataStore.getVertices().get(plyEdgeInfo.getIndex1()); + vertices[edgeVertexIndex + 1] = _dataStore.getVertices().get(plyEdgeInfo.getIndex2()); + if (hasNormals) { + normals[edgeVertexIndex] = _dataStore.getNormals().get(plyEdgeInfo.getIndex1()); + normals[edgeVertexIndex + 1] = _dataStore.getNormals().get(plyEdgeInfo.getIndex2()); + } + if (plyEdgeInfo.getColor() != null) { + if (colors == null) { + colors = new ReadOnlyColorRGBA[vertexCount]; + } + colors[edgeVertexIndex] = plyEdgeInfo.getColor(); + colors[edgeVertexIndex + 1] = plyEdgeInfo.getColor(); + hasColors = true; + } + edgeVertexIndex += 2; + } + final Line line = new Line(name, vertices, normals, colors, null); + indices.rewind(); + line.getMeshData().setIndices(indices); + final EnumSet<MatchCondition> matchConditions = EnumSet.noneOf(MatchCondition.class); + if (hasNormals) { + matchConditions.add(MatchCondition.Normal); + } + if (hasColors) { + matchConditions.add(MatchCondition.Color); + } + _geometryTool.minimizeVerts(line, matchConditions); + + final TextureState tState = getTextureState(); + if (tState != null) { + line.setRenderState(tState); + } + + line.updateModelBound(); + _totalLines++; + _plyEdgeInfoList = null; + } + if (_plyFaceInfoList != null) { + final String name = "ply_mesh" + _totalMeshes; + final Mesh mesh = new Mesh(name); + boolean hasTexCoordsInFaces = false; + final boolean hasTexCoordsInVertices = _dataStore.getTextureCoordinates() != null + && !_dataStore.getTextureCoordinates().isEmpty(); + final boolean hasNormals = _dataStore.getNormals() != null && !_dataStore.getNormals().isEmpty(); + final boolean hasColors = _dataStore.getColors() != null && !_dataStore.getColors().isEmpty(); + int vertexCount = 0; + for (final PlyFaceInfo plyFaceInfo : _plyFaceInfoList) { + vertexCount += plyFaceInfo.getVertexIndices().size(); + if (plyFaceInfo.getTextureCoordinates() != null && !plyFaceInfo.getTextureCoordinates().isEmpty()) { + hasTexCoordsInFaces = true; + } + } + final FloatBuffer vertices = BufferUtils.createVector3Buffer(vertexCount); + final IndexBufferData<? extends Buffer> indices = BufferUtils.createIndexBufferData(vertexCount, + vertexCount - 1); + + final FloatBuffer normals = hasNormals ? BufferUtils.createFloatBuffer(vertices.capacity()) : null; + final FloatBuffer colors = hasColors ? BufferUtils.createFloatBuffer(vertexCount * 4) : null; + final FloatBuffer uvs = hasTexCoordsInFaces || hasTexCoordsInVertices + ? BufferUtils.createFloatBuffer(vertexCount * 2) : null; + + int dummyVertexIndex = 0; + final List<IndexMode> indexModeList = new ArrayList<>(); + final List<Integer> indexLengthList = new ArrayList<>(); + for (final PlyFaceInfo plyFaceInfo : _plyFaceInfoList) { + final IndexMode previousIndexMode = indexModeList.isEmpty() ? null + : indexModeList.get(indexModeList.size() - 1); + final IndexMode currentIndexMode; + switch (plyFaceInfo.getVertexIndices().size()) { + case 3: { + currentIndexMode = IndexMode.Triangles; + break; + } + case 4: { + currentIndexMode = IndexMode.Quads; + break; + } + default: { + currentIndexMode = null; + break; + } + } + if (currentIndexMode == null) { + PlyGeometryStore.LOGGER.log(Level.SEVERE, + "The index mode cannot be determined for a face containing " + + plyFaceInfo.getVertexIndices().size() + " vertices"); + } else { + if (previousIndexMode == null || currentIndexMode != previousIndexMode) { + indexModeList.add(currentIndexMode); + indexLengthList.add(currentIndexMode.getVertexCount()); + } else { + final int previousIndexLength = indexLengthList.get(indexLengthList.size() - 1).intValue(); + final int currentIndexLength = previousIndexLength + currentIndexMode.getVertexCount(); + indexLengthList.set(indexLengthList.size() - 1, Integer.valueOf(currentIndexLength)); + } + for (final Integer vertexIndex : plyFaceInfo.getVertexIndices()) { + indices.put(dummyVertexIndex); + final Vector3 vertex = _dataStore.getVertices().get(vertexIndex.intValue()); + vertices.put(vertex.getXf()).put(vertex.getYf()).put(vertex.getZf()); + if (hasNormals) { + final Vector3 normal = _dataStore.getNormals().get(vertexIndex.intValue()); + normals.put(normal.getXf()).put(normal.getYf()).put(normal.getZf()); + } + if (hasColors) { + final ColorRGBA color = _dataStore.getColors().get(vertexIndex.intValue()); + colors.put(color.getRed()).put(color.getGreen()).put(color.getBlue()).put(color.getAlpha()); + } + if (hasTexCoordsInVertices) { + final Vector2 texCoords = _dataStore.getTextureCoordinates().get(vertexIndex.intValue()); + uvs.put(texCoords.getXf()).put(texCoords.getYf()); + } + dummyVertexIndex++; + } + if (hasTexCoordsInFaces) { + for (final Float texCoord : plyFaceInfo.getTextureCoordinates()) { + uvs.put(texCoord); + } + } + } + } + + vertices.rewind(); + mesh.getMeshData().setVertexBuffer(vertices); + indices.rewind(); + mesh.getMeshData().setIndices(indices); + if (indexModeList.size() == 1) { + mesh.getMeshData().setIndexMode(indexModeList.get(0)); + mesh.getMeshData().setIndexLengths(null); + } else { + mesh.getMeshData().setIndexModes(indexModeList.toArray(new IndexMode[indexModeList.size()])); + final int[] indexLengths = new int[indexLengthList.size()]; + for (int indexLengthIndex = 0; indexLengthIndex < indexLengths.length; indexLengthIndex++) { + indexLengths[indexLengthIndex] = indexLengthList.get(indexLengthIndex).intValue(); + } + mesh.getMeshData().setIndexLengths(indexLengths); + } + final EnumSet<MatchCondition> matchConditions = EnumSet.noneOf(MatchCondition.class); + if (hasNormals) { + normals.rewind(); + mesh.getMeshData().setNormalBuffer(normals); + matchConditions.add(MatchCondition.Normal); + } + if (hasColors) { + colors.rewind(); + mesh.getMeshData().setColorBuffer(colors); + matchConditions.add(MatchCondition.Color); + } + if (hasTexCoordsInFaces || hasTexCoordsInVertices) { + uvs.rewind(); + mesh.getMeshData().setTextureBuffer(uvs, 0); + matchConditions.add(MatchCondition.UVs); + } + + if (indexModeList.size() == 1) { + _geometryTool.minimizeVerts(mesh, matchConditions); + } else { + // FIXME unsure about minimizeVerts preserving the index modes + } + + final TextureState tState = getTextureState(); + if (tState != null) { + mesh.setRenderState(tState); + } + + mesh.updateModelBound(); + _root.attachChild(mesh); + _totalMeshes++; + _plyFaceInfoList = null; + } + } + + void cleanup() { + _plyFaceInfoList = null; + _plyEdgeInfoList = null; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyImporter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyImporter.java new file mode 100644 index 0000000..c4901b7 --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyImporter.java @@ -0,0 +1,1643 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.ply; + +import java.io.BufferedReader; +import java.io.Closeable; +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StreamTokenizer; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.nio.charset.StandardCharsets; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ardor3d.image.Texture; +import com.ardor3d.image.Texture.MinificationFilter; +import com.ardor3d.image.TextureStoreFormat; +import com.ardor3d.math.ColorRGBA; +import com.ardor3d.math.Vector2; +import com.ardor3d.math.Vector3; +import com.ardor3d.util.TextureManager; +import com.ardor3d.util.geom.GeometryTool; +import com.ardor3d.util.resource.ResourceLocator; +import com.ardor3d.util.resource.ResourceLocatorTool; +import com.ardor3d.util.resource.ResourceSource; + +/** + * PLY importer. See <a href="http://paulbourke.net/dataformats/ply/">the format spec</a> + * + * Note that the material indices are stored but not used to build the meshes as it's currently impossible to apply a + * material per vertex + */ +public class PlyImporter { + + public static enum Format { + ASCII, BINARY_LITTLE_ENDIAN, BINARY_BIG_ENDIAN; + }; + + public static class FormatWithVersionNumber { + + private final Format format; + + private final double versionNumber; + + public FormatWithVersionNumber(final Format format, final double versionNumber) { + super(); + this.format = format; + this.versionNumber = versionNumber; + } + + public Format getFormat() { + return format; + } + + public double getVersionNumber() { + return versionNumber; + } + } + + public static enum ListProperty { + /** indices of the vertices */ + VERTEX_INDICES(Element.FACE, Element.CUSTOM), + /** indices of materials (not sure that it's really in the specification) */ + MATERIAL_INDICES(Element.FACE, Element.CUSTOM), + /** texture coordinates (probably only supported by MeshLab) */ + TEXCOORD(Element.FACE, Element.CUSTOM), + /** custom, i.e user-defined, not build-in, up to the developer to support it */ + CUSTOM(Element.CUSTOM); + private final Element[] elements; + + private ListProperty(final Element... elements) { + this.elements = elements; + } + + public Element[] getElements() { + return elements; + } + + public static ListProperty get(final String name) { + final String uppercaseName = name.toUpperCase(); + ListProperty result = null; + try { + result = ListProperty.valueOf(uppercaseName); + } catch (final IllegalArgumentException iae) { + if ("VERTEX_INDEX".equals(uppercaseName) || "VERTEX_INDEXES".equals(uppercaseName)) { + result = VERTEX_INDICES; + } else if ("MATERIAL_INDEX".equals(uppercaseName) || "MATERIAL_INDEXES".equals(uppercaseName)) { + result = MATERIAL_INDICES; + } else { + result = CUSTOM; + } + } + return result; + } + } + + public static enum ScalarProperty { + /** abscissa */ + X(Element.VERTEX, Element.CUSTOM), + /** ordinate */ + Y(Element.VERTEX, Element.CUSTOM), + /** applicate */ + Z(Element.VERTEX, Element.CUSTOM), + /** normal x vector coordinate */ + NX(Element.VERTEX, Element.CUSTOM), + /** normal y vector coordinate */ + NY(Element.VERTEX, Element.CUSTOM), + /** normal z vector coordinate */ + NZ(Element.VERTEX, Element.CUSTOM), + /** u texture coordinate */ + S(Element.VERTEX, Element.CUSTOM), + /** v texture coordinate */ + T(Element.VERTEX, Element.CUSTOM), + /** first vertex */ + VERTEX1(Element.EDGE, Element.CUSTOM), + /** second vertex */ + VERTEX2(Element.EDGE, Element.CUSTOM), + /** red color component */ + RED(Element.VERTEX, Element.EDGE, Element.CUSTOM), + /** green color component */ + GREEN(Element.VERTEX, Element.EDGE, Element.CUSTOM), + /** blue color component */ + BLUE(Element.VERTEX, Element.EDGE, Element.CUSTOM), + /** material (ambient light) components */ + AMBIENT_RED(Element.MATERIAL, Element.CUSTOM), AMBIENT_GREEN(Element.MATERIAL, Element.CUSTOM), AMBIENT_BLUE(Element.MATERIAL, Element.CUSTOM), AMBIENT_COEFF(Element.MATERIAL, Element.CUSTOM), + /** material (diffuse light) components */ + DIFFUSE_RED(Element.MATERIAL, Element.CUSTOM), DIFFUSE_GREEN(Element.MATERIAL, Element.CUSTOM), DIFFUSE_BLUE(Element.MATERIAL, Element.CUSTOM), DIFFUSE_COEFF(Element.MATERIAL, Element.CUSTOM), + /** material (emissive light) components */ + EMISSIVE_RED(Element.MATERIAL, Element.CUSTOM), EMISSIVE_GREEN(Element.MATERIAL, Element.CUSTOM), EMISSIVE_BLUE(Element.MATERIAL, Element.CUSTOM), EMISSIVE_COEFF(Element.MATERIAL, Element.CUSTOM), + /** material (specular light) components */ + SPECULAR_RED(Element.MATERIAL, Element.CUSTOM), SPECULAR_GREEN(Element.MATERIAL, Element.CUSTOM), SPECULAR_BLUE(Element.MATERIAL, Element.CUSTOM), SPECULAR_COEFF(Element.MATERIAL, Element.CUSTOM), SPECULAR_POWER(Element.MATERIAL, Element.CUSTOM), + /** custom, i.e user-defined, not build-in, up to the developer to support it */ + CUSTOM(Element.CUSTOM); + private final Element[] elements; + + private ScalarProperty(final Element... elements) { + this.elements = elements; + } + + public Element[] getElements() { + return elements; + } + + public static ScalarProperty get(final String name) { + final String uppercaseName = name.toUpperCase(); + ScalarProperty result = null; + try { + result = ScalarProperty.valueOf(uppercaseName); + } catch (final IllegalArgumentException iae) { + result = CUSTOM; + } + return result; + } + } + + protected static class EnumWithKeyword<T extends Enum<?>> { + + private final T enumKey; + + private final String keyword; + + protected EnumWithKeyword(final T enumKey, final String keyword) { + super(); + this.enumKey = enumKey; + this.keyword = keyword; + } + + @Override + public int hashCode() { + return Objects.hash(enumKey, keyword); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final EnumWithKeyword<?> other = (EnumWithKeyword<?>) obj; + return enumKey == other.enumKey && Objects.equals(keyword, other.keyword); + } + + public T getEnumKey() { + return enumKey; + } + + public String getKeyword() { + return keyword; + } + + @Override + public String toString() { + return "'" + Objects.toString(enumKey) + "[" + Objects.toString(keyword) + "]'"; + } + } + + public static abstract class AbstractPropertyWithKeyword<T extends Enum<?>> extends EnumWithKeyword<T> { + + private final Data data; + + protected AbstractPropertyWithKeyword(final T enumKey, final String keyword, final Data data) { + super(enumKey, keyword); + this.data = data; + } + + public Data getData() { + return data; + } + + public abstract Element[] getElements(); + + @Override + public String toString() { + return "property " + super.toString() + " data type " + Objects.toString(getData()); + } + } + + public static class ScalarPropertyWithKeyword extends AbstractPropertyWithKeyword<ScalarProperty> { + + public ScalarPropertyWithKeyword(final ScalarProperty scalarProperty, final String keyword, final Data data) { + super(scalarProperty, keyword, data); + } + + @Override + public Element[] getElements() { + return getEnumKey() == null ? null : getEnumKey().getElements(); + } + + @Override + public String toString() { + return "scalar " + super.toString(); + } + } + + public static class ListPropertyWithKeyword extends AbstractPropertyWithKeyword<ListProperty> { + + private final Data countData; + + public ListPropertyWithKeyword(final ListProperty listProperty, final String keyword, final Data countData, + final Data data) { + super(listProperty, keyword, data); + this.countData = countData; + } + + @Override + public Element[] getElements() { + return getEnumKey() == null ? null : getEnumKey().getElements(); + } + + public Data getCountData() { + return countData; + } + + @Override + public String toString() { + return "list " + super.toString() + " index data type " + Objects.toString(countData); + } + } + + public static enum Element { + VERTEX, FACE, EDGE, MATERIAL, + /** custom, i.e user-defined, not build-in, up to the developer to support it */ + CUSTOM; + + public static Element get(final String name) { + final String uppercaseName = name.toUpperCase(); + Element result = null; + try { + result = Element.valueOf(uppercaseName); + } catch (final IllegalArgumentException iae) { + result = CUSTOM; + } + return result; + } + }; + + public static class ElementWithKeyword extends EnumWithKeyword<Element> { + + public ElementWithKeyword(final Element element, final String keyword) { + super(element, keyword); + } + + @Override + public String toString() { + return "element " + super.toString(); + } + } + + public static enum Data { + + /** one byte signed integer */ + CHAR, + /** one byte unsigned integer */ + UCHAR, + /** two byte signed integer */ + SHORT, + /** two byte unsigned integer */ + USHORT, + /** four byte signed integer */ + INT, + /** four byte unsigned integer */ + UINT, + /** four byte floating point number */ + FLOAT, + /** eight byte floating point number */ + DOUBLE; + + public static Data get(final String name) throws IllegalArgumentException { + final String uppercaseName = name.toUpperCase(); + Data result = null; + try { + result = Data.valueOf(uppercaseName); + } catch (final IllegalArgumentException iae) { + switch (uppercaseName) { + case "INT8": { + result = CHAR; + break; + } + case "UINT8": { + result = UCHAR; + break; + } + case "INT16": { + result = SHORT; + break; + } + case "UINT16": { + result = USHORT; + break; + } + case "INT32": { + result = INT; + break; + } + case "UINT32": { + result = UINT; + break; + } + case "FLOAT32": { + result = FLOAT; + break; + } + case "FLOAT64": { + result = DOUBLE; + break; + } + default: { + throw new IllegalArgumentException( + "'" + name + "' does not match with any data type supported by the PLY format"); + } + } + } + return result; + } + } + + public static interface PlyReader extends Closeable { + public double read(final Data data) throws IOException; + } + + /** + * largely inspired of jPly's BinaryPlyInputStream, @see + * https://github.com/smurn/jPLY/blob/master/jply/src/main/java/org/smurn/jply/BinaryPlyInputStream.java + */ + public static class BinaryPlyReader implements PlyReader { + + private final ReadableByteChannel channel; + + private final ByteBuffer buffer; + + private static final int BUFFER_SIZE = 1024; + + public BinaryPlyReader(final InputStream inputStream, final ByteOrder byteOrder) { + super(); + channel = Channels.newChannel(inputStream); + buffer = ByteBuffer.allocate(BinaryPlyReader.BUFFER_SIZE); + buffer.order(byteOrder); + buffer.clear(); + buffer.position(buffer.capacity()); + } + + @Override + public double read(final Data data) throws IOException { + switch (data) { + case CHAR: + ensureAvailable(1); + return buffer.get(); + case UCHAR: + ensureAvailable(1); + return buffer.get() & 0x000000FF; + case SHORT: + ensureAvailable(2); + return buffer.getShort(); + case USHORT: + ensureAvailable(2); + return buffer.getShort() & 0x0000FFFF; + case INT: + ensureAvailable(4); + return buffer.getInt(); + case UINT: + ensureAvailable(4); + return ((long) buffer.getShort()) & 0x00000000FFFFFFFF; + case FLOAT: + ensureAvailable(4); + return buffer.getFloat(); + case DOUBLE: + ensureAvailable(8); + return buffer.getDouble(); + default: + throw new IllegalArgumentException("Unsupported type: " + data); + } + } + + /** + * Ensures that a certain amount of bytes are in the buffer, ready to be read. + * + * @param bytes + * Minimal number of unread bytes required in the buffer. + * @see ByteBuffer#remaining() + * @throws IOException + * if reading sufficient more data into the buffer fails. + */ + protected void ensureAvailable(final int bytes) throws IOException { + while (buffer.remaining() < bytes) { + buffer.compact(); + if (channel.read(buffer) < 0) { + throw new EOFException(); + } + buffer.flip(); + } + } + + @Override + public void close() throws IOException { + channel.close(); + } + } + + public static class AsciiPlyReader implements PlyReader { + + private final PlyFileParser parser; + private final BufferedReader reader; + + public AsciiPlyReader(final InputStream stream) { + super(); + reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.US_ASCII)); + parser = new PlyFileParser(reader); + } + + @Override + public double read(final Data data) throws IOException { + do { + parser.nextToken(); + } while (parser.ttype != StreamTokenizer.TT_WORD && parser.ttype != StreamTokenizer.TT_EOF); + if (parser.ttype == StreamTokenizer.TT_WORD) { + try { + parser.nval = Double.valueOf(parser.sval).doubleValue(); + return parser.nval; + } catch (final NumberFormatException nbe) { + throw new IOException("Unparsable string " + parser.sval, nbe); + } + } else { + throw new IOException("No number to read, end of file reached"); + } + } + + @Override + public void close() throws IOException { + reader.close(); + } + } + + private static final Logger LOGGER = Logger.getLogger(PlyImporter.class.getName()); + + public static class PlyFileParser extends StreamTokenizer implements Closeable { + + private final Reader reader; + + /** + * Constructor. + * + * @param reader + * The Reader. + */ + public PlyFileParser(final Reader reader) { + super(reader); + this.reader = reader; + resetSyntax(); + eolIsSignificant(true); + lowerCaseMode(true); + + // all printable ascii characters + wordChars('!', '~'); + + whitespaceChars(' ', ' '); + whitespaceChars('\n', '\n'); + whitespaceChars('\r', '\r'); + whitespaceChars('\t', '\t'); + } + + /** + * Gets a number from the stream. Need to extract numbers since they may be in scientific notation. The number + * is returned in nval. + * + * @return Logical-true if successful, else logical-false. + */ + protected boolean getNumber() { + try { + nextToken(); + if (ttype != StreamTokenizer.TT_WORD) { + return false; + } + nval = Double.valueOf(sval).doubleValue(); + } catch (final IOException e) { + System.err.println(e.getMessage()); + return false; + } catch (final NumberFormatException e) { + System.err.println(e.getMessage()); + return false; + } + return true; + } + + @Override + public void close() throws IOException { + reader.close(); + } + } + + private ResourceLocator _modelLocator; + + private ResourceLocator _textureLocator; + + private boolean _flipTextureVertically; + + private boolean _useCompression; + + private MinificationFilter _minificationFilter; + + /** + * Constructor. + */ + public PlyImporter() { + super(); + _flipTextureVertically = true; + _useCompression = true; + _minificationFilter = MinificationFilter.Trilinear; + } + + /** + * Reads a PLY file from the given resource + * + * @param resource + * the name of the resource to find. + * + * @return a PlyGeometryStore data object containing the scene and other useful elements. + */ + public PlyGeometryStore load(final String resource) { + return load(resource, new GeometryTool()); + } + + /** + * Reads a PLY file from the given resource + * + * @param resource + * the name of the resource to find. + * @param geometryTool + * the geometry tool to optimize the meshes + * + * @return a PlyGeometryStore data object containing the scene and other useful elements. + */ + public PlyGeometryStore load(final String resource, final GeometryTool geometryTool) { + final ResourceSource source; + if (_modelLocator == null) { + source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, resource); + } else { + source = _modelLocator.locateResource(resource); + } + + if (source == null) { + throw new Error("Unable to locate '" + resource + "'"); + } + + return load(source, geometryTool); + } + + /** + * Reads a PLY file from the given resource + * + * @param resource + * the resource to find. + * + * @return a PlyGeometryStore data object containing the scene and other useful elements. + */ + public PlyGeometryStore load(final ResourceSource resource) { + return load(resource, new GeometryTool()); + } + + /** + * Reads a PLY file from the given resource + * + * @param resource + * the resource to find. + * @param geometryTool + * the geometry tool to optimize the meshes + * + * @return a PlyGeometryStore data object containing the scene and other useful elements. + */ + @SuppressWarnings("resource") + public PlyGeometryStore load(final ResourceSource resource, final GeometryTool geometryTool) { + final PlyGeometryStore store = createGeometryStore(geometryTool); + try { + FormatWithVersionNumber formatWithVersionNumber = null; + final int firstLineOfBody; + final Map<ElementWithKeyword, Map.Entry<Integer, Set<AbstractPropertyWithKeyword<?>>>> elementMap = new LinkedHashMap<>(); + try (final PlyFileParser parser = new PlyFileParser( + new BufferedReader(new InputStreamReader(resource.openStream(), StandardCharsets.US_ASCII)))) { + try { + // starts reading the header + parser.nextToken(); + // reads "ply" + if ("ply".equals(parser.sval)) { + PlyImporter.LOGGER.log(Level.INFO, "ply keyword on line " + parser.lineno()); + } else { + PlyImporter.LOGGER.log(Level.SEVERE, "No ply keyword on line " + parser.lineno()); + } + // reads the EOL for verifying that the file has a correct format + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + PlyImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + parser.lineno()); + } + parser.nextToken(); + // reads the rest of the header + while (parser.ttype != StreamTokenizer.TT_EOF && !"end_header".equals(parser.sval)) { + if (parser.ttype == StreamTokenizer.TT_WORD) { + final int currentLineNumber = parser.lineno(); + switch (parser.sval) { + case "comment": { + parser.nextToken(); + if (parser.ttype == StreamTokenizer.TT_WORD) { + if ("TextureFile".equals(parser.sval)) { + parser.nextToken(); + if (parser.ttype == StreamTokenizer.TT_WORD) { + final String textureName = parser.sval; + store.setTextureName(textureName); + final Texture texture; + if (_textureLocator == null) { + texture = TextureManager.load(textureName, getMinificationFilter(), + isUseCompression() + ? TextureStoreFormat.GuessCompressedFormat + : TextureStoreFormat.GuessNoCompressedFormat, + isFlipTextureVertically()); + } else { + final ResourceSource source = _textureLocator + .locateResource(textureName); + texture = TextureManager.load(source, getMinificationFilter(), + isUseCompression() + ? TextureStoreFormat.GuessCompressedFormat + : TextureStoreFormat.GuessNoCompressedFormat, + isFlipTextureVertically()); + } + store.setTexture(texture); + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "'TextureFile' comment with no texture file on line " + + currentLineNumber); + } + } + } + break; + } + case "format": { + parser.nextToken(); + if (parser.ttype == StreamTokenizer.TT_WORD) { + if (formatWithVersionNumber == null) { + Format format = null; + try { + format = Format.valueOf(parser.sval.toUpperCase()); + } catch (final IllegalArgumentException iae) { + PlyImporter.LOGGER.log(Level.SEVERE, "Unknown format '" + parser.sval + + "' on line " + currentLineNumber + ": " + iae.getMessage()); + } + final double versionNumber; + if (parser.getNumber()) { + versionNumber = parser.nval; + if (Double.compare(versionNumber, 1.0d) != 0) { + PlyImporter.LOGGER.log(Level.WARNING, + "Unsupported format version number '" + parser.nval + + "' on line " + currentLineNumber + + ". This importer supports only PLY 1.0"); + } + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + PlyImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + + currentLineNumber); + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "Format version number missing on line " + currentLineNumber + + "\n"); + versionNumber = Double.NaN; + } + formatWithVersionNumber = new FormatWithVersionNumber(format, + versionNumber); + PlyImporter.LOGGER.log(Level.INFO, + "Format '" + (format == null ? "null" : format.name()) + + "' version number '" + versionNumber + + "' detected on line " + currentLineNumber); + } else { + PlyImporter.LOGGER.log(Level.WARNING, + "Format already defined, format declaration ignored on line " + + currentLineNumber); + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "Format type (ascii, binary_big_endian or binary_little_endian) missing on line " + + currentLineNumber); + } + break; + } + case "element": { + parser.nextToken(); + if (parser.ttype == StreamTokenizer.TT_WORD) { + final String elementName = parser.sval; + final Element element = Element.get(elementName); + final ElementWithKeyword elementWithKeyword = new ElementWithKeyword(element, + elementName); + if (elementMap.containsKey(element)) { + PlyImporter.LOGGER.log(Level.WARNING, + elementWithKeyword + + " already defined, element declaration ignored on line " + + currentLineNumber); + } else { + final int elementCount; + if (parser.getNumber()) { + elementCount = (int) parser.nval; + if (elementCount < 0) { + PlyImporter.LOGGER.log(Level.SEVERE, + elementWithKeyword + " count = " + elementCount + + " whereas it should be >= 0 on line " + + currentLineNumber); + } + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + PlyImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + + currentLineNumber); + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, elementWithKeyword + + " count missing on line " + currentLineNumber); + elementCount = 0; + } + elementMap.put(elementWithKeyword, + new AbstractMap.SimpleEntry<Integer, Set<AbstractPropertyWithKeyword<?>>>( + Integer.valueOf(elementCount), null)); + PlyImporter.LOGGER.log(Level.INFO, + elementWithKeyword + " detected on line " + currentLineNumber); + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "Element type (vertex, face or edge) missing on line " + + currentLineNumber); + } + break; + } + case "property": { + ElementWithKeyword latestInsertedElementWithKeyword = null; + for (final ElementWithKeyword elementWithKeyword : elementMap.keySet()) { + latestInsertedElementWithKeyword = elementWithKeyword; + } + if (latestInsertedElementWithKeyword == null) { + PlyImporter.LOGGER.log(Level.SEVERE, + "Property definition not preceded by an element definition on line " + + currentLineNumber); + } else { + parser.nextToken(); + if (parser.ttype == StreamTokenizer.TT_WORD) { + if ("list".equals(parser.sval)) { + // list property, for face elements (vertex indices, texture + // coordinates, ...) + parser.nextToken(); + if (parser.ttype == StreamTokenizer.TT_WORD) { + Data countData = null; + try { + countData = Data.get(parser.sval); + } catch (final IllegalArgumentException iae) { + PlyImporter.LOGGER.log(Level.SEVERE, + "Count data type '" + parser.sval + "' unknown on line " + + currentLineNumber); + } + if (countData != null) { + parser.nextToken(); + if (parser.ttype == StreamTokenizer.TT_WORD) { + Data data = null; + try { + data = Data.get(parser.sval); + } catch (final IllegalArgumentException iae) { + PlyImporter.LOGGER.log(Level.SEVERE, + "Data type '" + parser.sval + + "' unknown on line " + + currentLineNumber); + } + if (data != null) { + parser.nextToken(); + if (parser.ttype == StreamTokenizer.TT_WORD) { + final String listPropertyName = parser.sval; + final ListProperty listProperty = ListProperty + .get(listPropertyName); + final ListPropertyWithKeyword listPropertyWithKeyword = new ListPropertyWithKeyword( + listProperty, listPropertyName, countData, + data); + if (Arrays.asList(listProperty.getElements()) + .contains(latestInsertedElementWithKeyword + .getEnumKey())) { + final Entry<Integer, Set<AbstractPropertyWithKeyword<?>>> elementMapEntry = elementMap + .get(latestInsertedElementWithKeyword); + Set<AbstractPropertyWithKeyword<?>> propertySet = elementMapEntry + .getValue(); + if (propertySet == null) { + propertySet = new LinkedHashSet<>(); + elementMapEntry.setValue(propertySet); + } + propertySet.add(listPropertyWithKeyword); + PlyImporter.LOGGER.log(Level.INFO, + listPropertyWithKeyword + + " detected on line " + + currentLineNumber); + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "Unexpected " + listPropertyWithKeyword + + " on line " + + currentLineNumber); + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "List property keyword (vertex_indices, texcoord, ...) missing on line " + + currentLineNumber); + } + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "Second data type (float32, int8, ...) missing on line " + + currentLineNumber); + } + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "First data type (float32, int8, ...) missing on line " + + currentLineNumber); + } + } else { + // scalar property (vertex coordinates, normal coordinates, ...) + Data data = null; + try { + data = Data.get(parser.sval); + } catch (final IllegalArgumentException iae) { + PlyImporter.LOGGER.log(Level.SEVERE, "Data type '" + parser.sval + + "' unknown on line " + currentLineNumber); + } + if (data != null) { + parser.nextToken(); + if (parser.ttype == StreamTokenizer.TT_WORD) { + final String scalarPropertyName = parser.sval; + final ScalarProperty scalarProperty = ScalarProperty + .get(scalarPropertyName); + final ScalarPropertyWithKeyword scalarPropertyWithKeyword = new ScalarPropertyWithKeyword( + scalarProperty, scalarPropertyName, data); + if (Arrays.asList(scalarProperty.getElements()).contains( + latestInsertedElementWithKeyword.getEnumKey())) { + final Entry<Integer, Set<AbstractPropertyWithKeyword<?>>> elementMapValue = elementMap + .get(latestInsertedElementWithKeyword); + Set<AbstractPropertyWithKeyword<?>> propertySet = elementMapValue + .getValue(); + if (propertySet == null) { + propertySet = new LinkedHashSet<>(); + elementMapValue.setValue(propertySet); + } + propertySet.add(scalarPropertyWithKeyword); + PlyImporter.LOGGER.log(Level.INFO, scalarPropertyWithKeyword + + " detected on line " + currentLineNumber); + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "Unexpected " + scalarPropertyWithKeyword + " in a " + + latestInsertedElementWithKeyword + + " on line " + currentLineNumber); + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "Scalar property keyword (x, nx, vertex1, red, ...) missing on line " + + currentLineNumber); + } + } + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "Property type (list) or scalar data type (float32, int8, ...) missing on line " + + currentLineNumber); + } + } + break; + } + default: { + PlyImporter.LOGGER.log(Level.SEVERE, + "Unknown command '" + parser.sval + "' on line " + currentLineNumber); + break; + } + } + } else { + PlyImporter.LOGGER.log(Level.SEVERE, + "No word at the beginning of the line " + parser.lineno()); + } + // reads the whole line, doesn't look at the content + while (parser.ttype != StreamTokenizer.TT_EOL) { + parser.nextToken(); + } + // if there is still something to read, reads the next token + if (parser.ttype != StreamTokenizer.TT_EOF) { + parser.nextToken(); + } + } + if ("end_header".equals(parser.sval)) { + PlyImporter.LOGGER.log(Level.INFO, "End of header on line " + parser.lineno()); + do { + parser.nextToken(); + } while (parser.ttype != StreamTokenizer.TT_EOL); + firstLineOfBody = parser.lineno(); + } else { + throw new Exception("End of header not detected"); + } + } catch (final IOException ioe) { + throw new Exception("IO Error on line " + parser.lineno(), ioe); + } + } + if (formatWithVersionNumber == null || formatWithVersionNumber.getFormat() == null) { + throw new Exception("Missing or malformed format in the header, cannot read the body of the PLY file"); + } else { + // stores the number of the first line of the body, after the header + int currentLineNumber = firstLineOfBody; + // restarts the reading of the file from the beginning + try (final InputStream stream = resource.openStream()) { + // skips the lines of the header + for (int lineIndex = 1; lineIndex < currentLineNumber; lineIndex++) { + while (stream.read() != '\n') { + ; + } + } + // reads the lines after the header, the body + final PlyReader plyReader; + switch (formatWithVersionNumber.getFormat()) { + case ASCII: { + plyReader = new AsciiPlyReader(stream); + break; + } + case BINARY_BIG_ENDIAN: { + plyReader = new BinaryPlyReader(stream, ByteOrder.BIG_ENDIAN); + break; + } + case BINARY_LITTLE_ENDIAN: { + plyReader = new BinaryPlyReader(stream, ByteOrder.LITTLE_ENDIAN); + break; + } + default: { + throw new UnsupportedOperationException( + "Unsupported format " + formatWithVersionNumber.getFormat()); + } + } + try { + for (final Entry<ElementWithKeyword, Entry<Integer, Set<AbstractPropertyWithKeyword<?>>>> elementMapEntry : elementMap + .entrySet()) { + final ElementWithKeyword elementWithKeyword = elementMapEntry.getKey(); + final Set<AbstractPropertyWithKeyword<?>> propertiesWithKeywords = elementMapEntry + .getValue().getValue(); + final int elementCount = elementMapEntry.getValue().getKey().intValue(); + PlyImporter.LOGGER.log(Level.INFO, "Reading of " + elementCount + " elements (" + + elementWithKeyword + ") started on line " + currentLineNumber); + if (propertiesWithKeywords == null || propertiesWithKeywords.isEmpty()) { + PlyImporter.LOGGER.log(Level.SEVERE, elementWithKeyword + + " data with no property skipped on line " + currentLineNumber); + } else { + for (int elementIndex = 0; elementIndex < elementCount; elementIndex++) { + // reads one line + final List<Double> valueList = new ArrayList<>(); + for (final AbstractPropertyWithKeyword<?> propertyWithKeyWord : propertiesWithKeywords) { + final Data scalarValueDataType = propertyWithKeyWord.getData(); + if (propertyWithKeyWord instanceof ScalarPropertyWithKeyword) { + final double scalarValue = plyReader.read(scalarValueDataType); + valueList.add(Double.valueOf(scalarValue)); + } else if (propertyWithKeyWord instanceof ListPropertyWithKeyword) { + final Data valueCountDataType = ((ListPropertyWithKeyword) propertyWithKeyWord) + .getCountData(); + final double rawValueCount = plyReader.read(valueCountDataType); + valueList.add(Double.valueOf(rawValueCount)); + final long valueCount = (long) rawValueCount; + for (int valueIndex = 0; valueIndex < valueCount; valueIndex++) { + final double scalarValue = plyReader.read(scalarValueDataType); + valueList.add(Double.valueOf(scalarValue)); + } + } + } + if (!valueList.isEmpty()) { + // stores the values into an array + final double[] values = new double[valueList.size()]; + for (int valueIndex = 0; valueIndex < values.length; valueIndex++) { + values[valueIndex] = valueList.get(valueIndex).doubleValue(); + } + if (elementWithKeyword.getEnumKey() == Element.CUSTOM) { + processElementCustomData(formatWithVersionNumber, elementWithKeyword, + propertiesWithKeywords, values, currentLineNumber, store); + } else { + boolean hasBuildInProperties = false; + boolean hasCustomProperties = false; + for (final AbstractPropertyWithKeyword<?> currentProperty : propertiesWithKeywords) { + final boolean isCustom = currentProperty + .getEnumKey() == ScalarProperty.CUSTOM + || currentProperty.getEnumKey() == ListProperty.CUSTOM; + if (!hasCustomProperties && isCustom) { + hasCustomProperties = true; + } + if (!hasBuildInProperties && !isCustom) { + hasBuildInProperties = true; + } + if (hasBuildInProperties && hasCustomProperties) { + break; + } + } + if (hasBuildInProperties) { + processElementBuildInData(formatWithVersionNumber, elementWithKeyword, + propertiesWithKeywords, values, currentLineNumber, store); + } + if (hasCustomProperties) { + processElementCustomData(formatWithVersionNumber, elementWithKeyword, + propertiesWithKeywords, values, currentLineNumber, store); + } + } + } + currentLineNumber++; + } + } + } + } finally { + plyReader.close(); + } + } catch (final IOException ioe) { + throw new Exception("IO Error on line " + currentLineNumber, ioe); + } + } + } catch (final Throwable t) { + throw new Error("Unable to load ply resource from URL: " + resource, t); + } + store.commitObjects(); + store.cleanup(); + return store; + } + + protected PlyGeometryStore createGeometryStore(final GeometryTool geometryTool) { + return new PlyGeometryStore(geometryTool); + } + + /** + * Processes the data within a build-in element, handles only the build-in properties whose behaviour is defined in + * the specification + * + * @param formatWithVersionNumber + * format with version number + * @param elementWithKeyword + * element and keyword + * @param elementProperties + * properties of the element + * @param values + * parsed values contained in a single line of file + * @param lineNumber + * number of the line in the PLY file being parsed + * @param store + * geometry store to fill during the process + */ + protected void processElementBuildInData(final FormatWithVersionNumber formatWithVersionNumber, + final ElementWithKeyword elementWithKeyword, final Set<AbstractPropertyWithKeyword<?>> elementProperties, + final double[] values, final int lineNumber, final PlyGeometryStore store) { + Vector3 vertex = null; + Vector3 normal = null; + ColorRGBA color = null; + Vector2 texCoords = null; + PlyMaterial material = null; + PlyEdgeInfo edgeInfo = null; + PlyFaceInfo faceInfo = null; + final Iterator<AbstractPropertyWithKeyword<?>> elementPropertiesIterator = elementProperties.iterator(); + final AbstractPropertyWithKeyword<?>[] valueProperties = new AbstractPropertyWithKeyword<?>[values.length]; + int valueIndex = 0; + // loops on the properties + while (valueIndex < values.length && elementPropertiesIterator.hasNext()) { + final AbstractPropertyWithKeyword<?> elementProperty = elementPropertiesIterator.next(); + if (elementProperty instanceof ScalarPropertyWithKeyword) { + valueProperties[valueIndex] = elementProperty; + valueIndex++; + } else if (elementProperty instanceof ListPropertyWithKeyword) { + // sets it to null so that it's skipped later as the value at this index is only used to know how much + // coordinates are in the list + valueProperties[valueIndex] = null; + // uses the list property in all concerned indices + final int listSize = (int) values[valueIndex]; + for (int listIndex = 1; listIndex <= listSize; listIndex++) { + valueProperties[valueIndex + listIndex] = elementProperty; + } + valueIndex += 1 + listSize; + } + } + valueIndex = 0; + // loops on the real values + for (final double value : values) { + final AbstractPropertyWithKeyword<?> propertyWithKeyWord = valueProperties[valueIndex]; + // it can be null when a value indicates the number of values in a list + if (propertyWithKeyWord != null) { + final Element[] propertyElements = propertyWithKeyWord.getElements(); + if (propertyElements != null && propertyElements.length > 0 + && Arrays.asList(propertyElements).contains(elementWithKeyword.getEnumKey())) { + switch (elementWithKeyword.getEnumKey()) { + case CUSTOM: { + throw new IllegalArgumentException("Custom data of the " + elementWithKeyword + + " passed to the method responsible for treating build-in data"); + } + case MATERIAL: { + if (propertyWithKeyWord instanceof ScalarPropertyWithKeyword) { + final ScalarProperty scalarProperty = ((ScalarPropertyWithKeyword) propertyWithKeyWord) + .getEnumKey(); + switch (scalarProperty) { + case CUSTOM: { + PlyImporter.LOGGER.log(Level.FINE, "Custom data of the " + propertyWithKeyWord + + " skipped in the method responsible for treating build-in data"); + break; + } + case AMBIENT_RED: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setAmbientRed((float) (value / 255.0d)); + break; + } + case AMBIENT_GREEN: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setAmbientGreen((float) (value / 255.0d)); + break; + } + case AMBIENT_BLUE: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setAmbientBlue((float) (value / 255.0d)); + break; + } + case AMBIENT_COEFF: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setAmbientAlpha((float) value); + break; + } + case DIFFUSE_RED: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setDiffuseRed((float) (value / 255.0d)); + break; + } + case DIFFUSE_GREEN: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setDiffuseGreen((float) (value / 255.0d)); + break; + } + case DIFFUSE_BLUE: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setDiffuseBlue((float) (value / 255.0d)); + break; + } + case DIFFUSE_COEFF: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setDiffuseAlpha((float) value); + break; + } + case SPECULAR_RED: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setSpecularRed((float) (value / 255.0d)); + break; + } + case SPECULAR_GREEN: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setSpecularGreen((float) (value / 255.0d)); + break; + } + case SPECULAR_BLUE: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setSpecularBlue((float) (value / 255.0d)); + break; + } + case SPECULAR_COEFF: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + material.setSpecularAlpha((float) value); + break; + } + case SPECULAR_POWER: { + if (material == null) { + material = new PlyMaterial(); + store.getMaterialLibrary().add(material); + } + // not sure how to treat the specular power, 200 is the maximum specular value + // material.setShininess((float) (128 * MathUtils.clamp(value, 0, 200) / 200)); + material.setShininess((float) value); + break; + } + default: + throw new UnsupportedOperationException( + "Missing implementation: the " + propertyWithKeyWord + + " is not supported by the " + elementWithKeyword + " yet"); + } + } else if (propertyWithKeyWord instanceof ListPropertyWithKeyword) { + final ListProperty listProperty = ((ListPropertyWithKeyword) propertyWithKeyWord) + .getEnumKey(); + switch (listProperty) { + case CUSTOM: { + PlyImporter.LOGGER.log(Level.FINE, "Custom data of the " + propertyWithKeyWord + + " skipped in the method responsible for treating build-in data"); + break; + } + default: + throw new UnsupportedOperationException( + "Missing implementation: the " + propertyWithKeyWord + + " is not supported by the " + elementWithKeyword + " yet"); + } + } + break; + } + case EDGE: { + if (propertyWithKeyWord instanceof ScalarPropertyWithKeyword) { + final ScalarProperty scalarProperty = ((ScalarPropertyWithKeyword) propertyWithKeyWord) + .getEnumKey(); + switch (scalarProperty) { + case CUSTOM: { + PlyImporter.LOGGER.log(Level.FINE, "Custom data of the " + propertyWithKeyWord + + " skipped in the method responsible for treating build-in data"); + break; + } + case VERTEX1: { + if (edgeInfo == null) { + edgeInfo = new PlyEdgeInfo(); + store.addLine(edgeInfo); + } + final Integer edgeIndex1 = Integer.valueOf((int) value); + edgeInfo.setIndex1(edgeIndex1); + break; + } + case VERTEX2: { + if (edgeInfo == null) { + edgeInfo = new PlyEdgeInfo(); + store.addLine(edgeInfo); + } + final Integer edgeIndex2 = Integer.valueOf((int) value); + edgeInfo.setIndex2(edgeIndex2); + break; + } + case RED: { + final ColorRGBA edgeColor; + if (edgeInfo == null) { + edgeColor = new ColorRGBA(); + edgeInfo = new PlyEdgeInfo(); + edgeInfo.setColor(edgeColor); + store.addLine(edgeInfo); + } else { + if (edgeInfo.getColor() == null) { + edgeColor = new ColorRGBA(); + edgeInfo.setColor(edgeColor); + } else { + edgeColor = edgeInfo.getColor(); + } + } + edgeColor.setRed((float) (value / 255.0d)); + break; + } + case GREEN: { + final ColorRGBA edgeColor; + if (edgeInfo == null) { + edgeColor = new ColorRGBA(); + edgeInfo = new PlyEdgeInfo(); + edgeInfo.setColor(edgeColor); + store.addLine(edgeInfo); + } else { + if (edgeInfo.getColor() == null) { + edgeColor = new ColorRGBA(); + edgeInfo.setColor(edgeColor); + } else { + edgeColor = edgeInfo.getColor(); + } + } + edgeColor.setGreen((float) (value / 255.0d)); + break; + } + case BLUE: { + final ColorRGBA edgeColor; + if (edgeInfo == null) { + edgeColor = new ColorRGBA(); + edgeInfo = new PlyEdgeInfo(); + edgeInfo.setColor(edgeColor); + store.addLine(edgeInfo); + } else { + if (edgeInfo.getColor() == null) { + edgeColor = new ColorRGBA(); + edgeInfo.setColor(edgeColor); + } else { + edgeColor = edgeInfo.getColor(); + } + } + edgeColor.setBlue((float) (value / 255.0d)); + break; + } + default: + throw new UnsupportedOperationException( + "Missing implementation: the " + propertyWithKeyWord + + " is not supported by the " + elementWithKeyword + " yet"); + } + } else if (propertyWithKeyWord instanceof ListPropertyWithKeyword) { + final ListProperty listProperty = ((ListPropertyWithKeyword) propertyWithKeyWord) + .getEnumKey(); + switch (listProperty) { + case CUSTOM: { + PlyImporter.LOGGER.log(Level.FINE, "Custom data of the " + propertyWithKeyWord + + " skipped in the method responsible for treating build-in data"); + break; + } + default: + throw new UnsupportedOperationException( + "Missing implementation: the " + propertyWithKeyWord + + " is not supported by the " + elementWithKeyword + " yet"); + } + } + break; + } + case FACE: { + if (propertyWithKeyWord instanceof ScalarPropertyWithKeyword) { + final ScalarProperty scalarProperty = ((ScalarPropertyWithKeyword) propertyWithKeyWord) + .getEnumKey(); + switch (scalarProperty) { + case CUSTOM: { + PlyImporter.LOGGER.log(Level.FINE, "Custom data of the " + propertyWithKeyWord + + " skipped in the method responsible for treating build-in data"); + break; + } + default: + throw new UnsupportedOperationException( + "Missing implementation: the " + propertyWithKeyWord + + " is not supported by the " + elementWithKeyword + " yet"); + } + } else if (propertyWithKeyWord instanceof ListPropertyWithKeyword) { + final ListProperty listProperty = ((ListPropertyWithKeyword) propertyWithKeyWord) + .getEnumKey(); + switch (listProperty) { + case CUSTOM: { + PlyImporter.LOGGER.log(Level.FINE, "Custom data of the " + propertyWithKeyWord + + " skipped in the method responsible for treating build-in data"); + break; + } + case VERTEX_INDICES: { + if (faceInfo == null) { + faceInfo = new PlyFaceInfo(); + store.addFace(faceInfo); + } + faceInfo.addVertexIndex((int) value); + break; + } + case TEXCOORD: { + if (faceInfo == null) { + faceInfo = new PlyFaceInfo(); + store.addFace(faceInfo); + } + faceInfo.addTextureCoordinate((float) value); + break; + } + case MATERIAL_INDICES: { + if (faceInfo == null) { + faceInfo = new PlyFaceInfo(); + store.addFace(faceInfo); + } + faceInfo.addMaterialIndex((int) value); + break; + } + default: + throw new UnsupportedOperationException( + "Missing implementation: the " + propertyWithKeyWord + + " is not supported by the " + elementWithKeyword + " yet"); + } + } + break; + } + case VERTEX: { + if (propertyWithKeyWord instanceof ScalarPropertyWithKeyword) { + final ScalarProperty scalarProperty = ((ScalarPropertyWithKeyword) propertyWithKeyWord) + .getEnumKey(); + switch (scalarProperty) { + case CUSTOM: { + PlyImporter.LOGGER.log(Level.FINE, "Custom data of the " + propertyWithKeyWord + + " skipped in the method responsible for treating build-in data"); + break; + } + case X: { + if (vertex == null) { + vertex = new Vector3(); + store.getDataStore().getVertices().add(vertex); + } + vertex.setX(value); + break; + } + case Y: { + if (vertex == null) { + vertex = new Vector3(); + store.getDataStore().getVertices().add(vertex); + } + vertex.setY(value); + break; + } + case Z: { + if (vertex == null) { + vertex = new Vector3(); + store.getDataStore().getVertices().add(vertex); + } + vertex.setZ(value); + break; + } + case NX: { + if (normal == null) { + normal = new Vector3(); + store.getDataStore().getNormals().add(normal); + } + normal.setX(value); + break; + } + case NY: { + if (normal == null) { + normal = new Vector3(); + store.getDataStore().getNormals().add(normal); + } + normal.setY(value); + break; + } + case NZ: { + if (normal == null) { + normal = new Vector3(); + store.getDataStore().getNormals().add(normal); + } + normal.setZ(value); + break; + } + case S: { + if (texCoords == null) { + texCoords = new Vector2(); + store.getDataStore().getTextureCoordinates().add(texCoords); + } + texCoords.setX(value); + break; + } + case T: { + if (texCoords == null) { + texCoords = new Vector2(); + store.getDataStore().getTextureCoordinates().add(texCoords); + } + texCoords.setY(value); + break; + } + case RED: { + if (color == null) { + color = new ColorRGBA(); + store.getDataStore().getColors().add(color); + } + color.setRed((float) (value / 255.0d)); + break; + } + case GREEN: { + if (color == null) { + color = new ColorRGBA(); + store.getDataStore().getColors().add(color); + } + color.setGreen((float) (value / 255.0d)); + break; + } + case BLUE: { + if (color == null) { + color = new ColorRGBA(); + store.getDataStore().getColors().add(color); + } + color.setBlue((float) (value / 255.0d)); + break; + } + default: + throw new UnsupportedOperationException( + "Missing implementation: the " + propertyWithKeyWord + + " is not supported by the " + elementWithKeyword + " yet"); + } + } else if (propertyWithKeyWord instanceof ListPropertyWithKeyword) { + final ListProperty listProperty = ((ListPropertyWithKeyword) propertyWithKeyWord) + .getEnumKey(); + switch (listProperty) { + case CUSTOM: { + PlyImporter.LOGGER.log(Level.FINE, "Custom data of the " + propertyWithKeyWord + + " skipped in the method responsible for treating build-in data"); + break; + } + default: + throw new UnsupportedOperationException( + "Missing implementation: the " + propertyWithKeyWord + + " is not supported by the " + elementWithKeyword + " yet"); + } + } + break; + } + default: + PlyImporter.LOGGER.log(Level.SEVERE, "Element '" + elementWithKeyword.getEnumKey() + "[" + + elementWithKeyword.getKeyword() + "]' unsupported on line " + lineNumber); + } + } else { + throw new IllegalArgumentException( + "The " + propertyWithKeyWord + " is not supported by the " + elementWithKeyword); + } + } + valueIndex++; + } + } + + /** + * Processes the data within a custom element or within a build-in element with custom properties. The default + * implementation just displays a warning message as it's up to the developer to manage the user-defined custom data + * whose behaviour isn't defined in the specification + * + * @param formatWithVersionNumber + * format with version number + * @param elementWithKeyword + * element and keyword + * @param elementProperties + * properties of the element + * @param values + * parsed values contained in a single line of file + * @param lineNumber + * number of the line in the PLY file being parsed + * @param store + * geometry store to fill during the process + */ + protected void processElementCustomData(final FormatWithVersionNumber formatWithVersionNumber, + final ElementWithKeyword elementWithKeyword, final Set<AbstractPropertyWithKeyword<?>> elementProperties, + final double[] values, final int lineNumber, final PlyGeometryStore store) { + PlyImporter.LOGGER.log(Level.WARNING, + "'" + elementWithKeyword.getEnumKey().name() + "[" + elementWithKeyword.getKeyword() + + "]' ignored on line " + lineNumber + ". Override " + getClass().getCanonicalName() + + ".processElementCustomData() to remove this warning"); + } + + public void setModelLocator(final ResourceLocator locator) { + _modelLocator = locator; + } + + public void setTextureLocator(final ResourceLocator locator) { + _textureLocator = locator; + } + + public void setFlipTextureVertically(final boolean flipTextureVertically) { + _flipTextureVertically = flipTextureVertically; + } + + public boolean isFlipTextureVertically() { + return _flipTextureVertically; + } + + public void setUseCompression(final boolean useCompression) { + _useCompression = useCompression; + } + + public boolean isUseCompression() { + return _useCompression; + } + + public void setMinificationFilter(final MinificationFilter minificationFilter) { + _minificationFilter = minificationFilter; + } + + public MinificationFilter getMinificationFilter() { + return _minificationFilter; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyMaterial.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyMaterial.java new file mode 100644 index 0000000..ffa4f6c --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/ply/PlyMaterial.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.ply; + +import com.ardor3d.extension.model.util.AbstractMaterial; + +public class PlyMaterial extends AbstractMaterial { + + public PlyMaterial() { + super(); + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/stl/StlDataStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/stl/StlDataStore.java new file mode 100644 index 0000000..52d6d0d --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/stl/StlDataStore.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.stl; + +import java.util.ArrayList; +import java.util.List; + +import com.ardor3d.math.Vector3; + +public class StlDataStore { + private final List<Vector3> _vertices; + private final List<Vector3> _normals; + + public StlDataStore() { + super(); + _vertices = new ArrayList<>(); + _normals = new ArrayList<>(); + } + + public List<Vector3> getVertices() { + return _vertices; + } + + public List<Vector3> getNormals() { + return _normals; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/stl/StlGeometryStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/stl/StlGeometryStore.java new file mode 100644 index 0000000..3e7fe7a --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/stl/StlGeometryStore.java @@ -0,0 +1,120 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.stl; + +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +import com.ardor3d.math.ColorRGBA; +import com.ardor3d.math.Vector3; +import com.ardor3d.math.type.ReadOnlyColorRGBA; +import com.ardor3d.scenegraph.Mesh; +import com.ardor3d.scenegraph.MeshData; +import com.ardor3d.scenegraph.Node; +import com.ardor3d.util.geom.BufferUtils; + +public class StlGeometryStore { + + private final StlDataStore _dataStore; + + private final Node _root; + + private String _currentObjectName; + + public StlGeometryStore() { + super(); + _dataStore = new StlDataStore(); + _root = new Node(); + } + + public StlDataStore getDataStore() { + return _dataStore; + } + + public Node getScene() { + return _root; + } + + void setCurrentObjectName(final String name) { + commitObjects(); + _currentObjectName = name; + } + + void commitObjects() { + if (!_dataStore.getNormals().isEmpty()) { + final String name; + if (_currentObjectName == null) { + name = "stl_mesh"; + } else { + name = _currentObjectName; + } + + // mesh object to return + final Mesh mesh = new Mesh(name); + final MeshData meshData = mesh.getMeshData(); + + // allocate buffers + final int numberTriangles = _dataStore.getNormals().size(); + final int vertexBufferSize = 3 * numberTriangles; + final FloatBuffer vertexBuffer = BufferUtils.createVector3Buffer(vertexBufferSize); + final FloatBuffer normalBuffer = BufferUtils.createVector3Buffer(vertexBufferSize); + final FloatBuffer colourBuffer = BufferUtils.createColorBuffer(vertexBufferSize); + + // fill buffers + int vertexCount = 0; + int normalCount = 0; + int colourCount = 0; + Vector3 v0; + Vector3 v1; + Vector3 v2; + Vector3 n; + final ReadOnlyColorRGBA defaultColour = ColorRGBA.WHITE; + for (int i = 0; i < numberTriangles; i++) { + // triangle properties + v0 = _dataStore.getVertices().get(3 * i + 0); + v1 = _dataStore.getVertices().get(3 * i + 1); + v2 = _dataStore.getVertices().get(3 * i + 2); + n = _dataStore.getNormals().get(i); + // vertices + BufferUtils.setInBuffer(v0, vertexBuffer, vertexCount++); + BufferUtils.setInBuffer(v1, vertexBuffer, vertexCount++); + BufferUtils.setInBuffer(v2, vertexBuffer, vertexCount++); + // normals - 1 foreach vertex + BufferUtils.setInBuffer(n, normalBuffer, normalCount++); + BufferUtils.setInBuffer(n, normalBuffer, normalCount++); + BufferUtils.setInBuffer(n, normalBuffer, normalCount++); + // colours - 1 foreach vertex + BufferUtils.setInBuffer(defaultColour, colourBuffer, colourCount++); + BufferUtils.setInBuffer(defaultColour, colourBuffer, colourCount++); + BufferUtils.setInBuffer(defaultColour, colourBuffer, colourCount++); + } + + meshData.setVertexBuffer(vertexBuffer); + meshData.setNormalBuffer(normalBuffer); + meshData.setColorBuffer(colourBuffer); + + // indices buffer + final int[] indices = new int[vertexBufferSize]; + for (int i = 0; i < vertexBufferSize; i++) { + indices[i] = i; + } + final IntBuffer iBuffer = BufferUtils.createIntBuffer(indices.length); + iBuffer.put(indices); + meshData.setIndexBuffer(iBuffer); + + _root.attachChild(mesh); + } + } + + void cleanup() { + _currentObjectName = null; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/stl/StlImporter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/stl/StlImporter.java new file mode 100644 index 0000000..a5aeed9 --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/stl/StlImporter.java @@ -0,0 +1,545 @@ +/** + * Copyright (c) 2008-2016 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.stl; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StreamTokenizer; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.ardor3d.extension.model.util.FileHelper; +import com.ardor3d.math.Vector3; +import com.ardor3d.util.resource.ResourceLocator; +import com.ardor3d.util.resource.ResourceLocatorTool; +import com.ardor3d.util.resource.ResourceSource; + +/** + * Reads an STL (STereoLithography) file and builds an Ardor3D Mesh. The STL format consists entirely of triangles and + * as a result is a simple format to handle. Also, it is widely supported by the CAD/CAM community. + * + * This class supports both ASCII and Binary formats and files residing either locally or on a network. + * + * Refer to <a href="http://en.wikipedia.org/wiki/STL_(file_format)" target="_blank>Wikipedia</a>. Several STL models + * can be downloaded freely from <a href="http://grabcad.com" target="_blank">GrabCAD</a>. + * + * @author gmseed + * @see StlFileParser + */ +public class StlImporter { + + /** + * Extends StreamTokenizer for parsing STL files. The STL format for Ascii files is as follows: + * + * <pre> + * solid name + * ... + * facet normal ni nj nk + * outer loop + * vertex v1x v1y v1z + * vertex v2x v2y v2z + * vertex v3x v3y v3z + * endloop + * endfacet + * ... + * endsolid name + * </pre> + * + * @author gmseed + */ + public static class StlFileParser extends StreamTokenizer { + + /** + * Constructor. + * + * @param reader + * The Reader. + */ + public StlFileParser(final Reader reader) { + super(reader); + resetSyntax(); + eolIsSignificant(true); + lowerCaseMode(true); + + // all printable ascii characters + wordChars('!', '~'); + + whitespaceChars(' ', ' '); + whitespaceChars('\n', '\n'); + whitespaceChars('\r', '\r'); + whitespaceChars('\t', '\t'); + } + + /** + * Gets a number from the stream. Need to extract numbers since they may be in scientific notation. The number + * is returned in nval. + * + * @return Logical-true if successful, else logical-false. + */ + protected boolean getNumber() { + try { + nextToken(); + if (ttype != StreamTokenizer.TT_WORD) { + return false; + } + nval = Double.valueOf(sval).doubleValue(); + } catch (final IOException e) { + System.err.println(e.getMessage()); + return false; + } catch (final NumberFormatException e) { + System.err.println(e.getMessage()); + return false; + } + return true; + } + + } + + // logger + private static final Logger LOGGER = Logger.getLogger(StlImporter.class.getName()); + + private static final String SOLID_KEYWORD = "solid"; + private static final String[] END_SOLID_KEYWORD_PARTS = new String[] { "end", "solid" }; + private static final String ENDSOLID_KEYWORD = "endsolid"; + private static final String FACET_KEYWORD = "facet"; + private static final String NORMAL_KEYWORD = "normal"; + private static final String[] OUTER_LOOP_KEYWORD_PARTS = new String[] { "outer", "loop" }; + private static final String VERTEX_KEYWORD = "vertex"; + private static final String ENDLOOP_KEYWORD = "endloop"; + private static final String ENDFACET_KEYWORD = "endfacet"; + + private ResourceLocator _modelLocator; + + /** + * Constructor. + */ + public StlImporter() { + super(); + } + + /** + * Reads a STL file from the given resource + * + * @param resource + * the name of the resource to find. + * @return a StlGeometryStore data object containing the scene and other useful elements. + */ + public StlGeometryStore load(final String resource) { + return load(resource, new FileHelper()); + } + + /** + * Reads a STL file from the given resource + * + * @param resource + * the name of the resource to find. + * @param fileHelper + * the file helper used to determine whether the resource is an Ascii file or a binary file + * + * @return a StlGeometryStore data object containing the scene and other useful elements. + */ + public StlGeometryStore load(final String resource, final FileHelper fileHelper) { + final ResourceSource source; + if (_modelLocator == null) { + source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, resource); + } else { + source = _modelLocator.locateResource(resource); + } + + if (source == null) { + throw new Error("Unable to locate '" + resource + "'"); + } + + return load(source, fileHelper); + } + + /** + * Reads a STL file from the given resource + * + * @param resource + * the resource to find. + * @return a StlGeometryStore data object containing the scene and other useful elements. + */ + public StlGeometryStore load(final ResourceSource resource) { + return load(resource, new FileHelper()); + } + + /** + * Reads a STL file from the given resource + * + * @param resource + * the resource to find. + * @param fileHelper + * the file helper used to determine whether the resource is an Ascii file or a binary file + * + * @return a StlGeometryStore data object containing the scene and other useful elements. + */ + public StlGeometryStore load(final ResourceSource resource, final FileHelper fileHelper) { + final boolean isAscii = fileHelper.isFilePureAscii(resource); + final StlGeometryStore store = new StlGeometryStore(); + if (isAscii) { // Ascii file + try (final BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream()))) { + final StlFileParser parser = new StlFileParser(reader); + try { + parser.nextToken(); + // read "solid" + if (parser.sval != null && StlImporter.SOLID_KEYWORD.equals(parser.sval)) { + StlImporter.LOGGER.log(Level.INFO, "solid keyword on line " + parser.lineno()); + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Ascii file but no solid keyword on line " + parser.lineno()); + } + parser.nextToken(); + // read object name if any + if (parser.ttype != StreamTokenizer.TT_WORD) { + StlImporter.LOGGER.log(Level.WARNING, + "Format Warning: expecting the (optional) object name on line " + parser.lineno()); + } else { + final String objectName = parser.sval; + store.setCurrentObjectName(objectName); + // Reads the EOL for verifying that the file has a correct format + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + parser.lineno()); + } + } + // read the rest of the file + parser.nextToken(); + boolean endSolidFound = false; + // read all the facets + while (parser.ttype != StreamTokenizer.TT_EOF && !endSolidFound) { + endSolidFound = false; + // reads "endsolid" + if (StlImporter.ENDSOLID_KEYWORD.equals(parser.sval)) { + StlImporter.LOGGER.log(Level.INFO, "endsolid keyword on line " + parser.lineno()); + endSolidFound = true; + } else { + // reads "end solid" + if (StlImporter.END_SOLID_KEYWORD_PARTS[0].equals(parser.sval)) { + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_WORD + || !StlImporter.END_SOLID_KEYWORD_PARTS[1].equals(parser.sval)) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error:expecting 'end solid' on line " + parser.lineno()); + } else { + StlImporter.LOGGER.log(Level.INFO, "end solid keyword on line " + parser.lineno()); + endSolidFound = true; + } + } else { + // Reads "facet" + if (parser.ttype != StreamTokenizer.TT_WORD + || (!StlImporter.FACET_KEYWORD.equals(parser.sval) + && !StlImporter.END_SOLID_KEYWORD_PARTS[0].equals(parser.sval))) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error:expecting 'facet' on line " + parser.lineno()); + } else { + parser.nextToken(); + // Reads a normal + if (parser.ttype != StreamTokenizer.TT_WORD + || !StlImporter.NORMAL_KEYWORD.equals(parser.sval)) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error:expecting 'normal' on line " + parser.lineno()); + } else { + if (parser.getNumber()) { + final Vector3 normal = new Vector3(); + normal.setX(parser.nval); + + if (parser.getNumber()) { + normal.setY(parser.nval); + + if (parser.getNumber()) { + normal.setZ(parser.nval); + + store.getDataStore().getNormals().add(normal); + // Reads the EOL for verifying that the file has a correct format + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting normal z-component on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting normal y-component on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting normal x-component on line " + + parser.lineno()); + } + } + + parser.nextToken(); + // Reads "outer loop" then EOL + if (parser.ttype != StreamTokenizer.TT_WORD + || !StlImporter.OUTER_LOOP_KEYWORD_PARTS[0].equals(parser.sval)) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting 'outer' on line " + parser.lineno()); + } else { + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_WORD + || !StlImporter.OUTER_LOOP_KEYWORD_PARTS[1].equals(parser.sval)) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error:expecting 'loop' on line " + parser.lineno()); + } else { + // Reads the EOL for verifying that the file has a correct format + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + + parser.lineno()); + } + } + } + + parser.nextToken(); + // Reads the first vertex + if (parser.ttype != StreamTokenizer.TT_WORD + || !StlImporter.VERTEX_KEYWORD.equals(parser.sval)) { + System.err + .println("Format Error:expecting 'vertex' on line " + parser.lineno()); + } else { + if (parser.getNumber()) { + final Vector3 vertex = new Vector3(); + vertex.setX(parser.nval); + + if (parser.getNumber()) { + vertex.setY(parser.nval); + + if (parser.getNumber()) { + vertex.setZ(parser.nval); + + store.getDataStore().getVertices().add(vertex); + // Reads the EOL for verifying that the file has a correct format + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting vertex z-component on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting vertex y-component on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting vertex x-component on line " + + parser.lineno()); + } + } + + parser.nextToken(); + // Reads the second vertex + if (parser.ttype != StreamTokenizer.TT_WORD + || !StlImporter.VERTEX_KEYWORD.equals(parser.sval)) { + System.err + .println("Format Error:expecting 'vertex' on line " + parser.lineno()); + } else { + if (parser.getNumber()) { + final Vector3 vertex = new Vector3(); + vertex.setX(parser.nval); + + if (parser.getNumber()) { + vertex.setY(parser.nval); + + if (parser.getNumber()) { + vertex.setZ(parser.nval); + + store.getDataStore().getVertices().add(vertex); + // Reads the EOL for verifying that the file has a correct format + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting vertex z-component on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting vertex y-component on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting vertex x-component on line " + + parser.lineno()); + } + } + + parser.nextToken(); + // Reads the third vertex + if (parser.ttype != StreamTokenizer.TT_WORD + || !StlImporter.VERTEX_KEYWORD.equals(parser.sval)) { + System.err + .println("Format Error:expecting 'vertex' on line " + parser.lineno()); + } else { + if (parser.getNumber()) { + final Vector3 vertex = new Vector3(); + vertex.setX(parser.nval); + + if (parser.getNumber()) { + vertex.setY(parser.nval); + + if (parser.getNumber()) { + vertex.setZ(parser.nval); + + store.getDataStore().getVertices().add(vertex); + // Reads the EOL for verifying that the file has a correct format + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting vertex z-component on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting vertex y-component on line " + + parser.lineno()); + } + } else { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting vertex x-component on line " + + parser.lineno()); + } + } + + parser.nextToken(); + // Reads "endloop" then EOL + if (parser.ttype != StreamTokenizer.TT_WORD + || !StlImporter.ENDLOOP_KEYWORD.equals(parser.sval)) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting 'endloop' on line " + parser.lineno()); + } else { + // Reads the EOL for verifying that the file has a correct format + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + parser.lineno()); + } + } + + parser.nextToken(); + // Reads "endfacet" then EOL + if (parser.ttype != StreamTokenizer.TT_WORD + || !StlImporter.ENDFACET_KEYWORD.equals(parser.sval)) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error:expecting 'endfacet' on line " + parser.lineno()); + } else { + // Reads the EOL for verifying that the file has a correct format + parser.nextToken(); + if (parser.ttype != StreamTokenizer.TT_EOL) { + StlImporter.LOGGER.log(Level.SEVERE, + "Format Error: expecting End Of Line on line " + parser.lineno()); + } + } + } + } + } + parser.nextToken(); + } + } catch (final IOException e) { + StlImporter.LOGGER.log(Level.SEVERE, "IO Error on line " + parser.lineno() + ": " + e.getMessage()); + } + } catch (final Throwable t) { + throw new Error("Unable to load stl resource from URL: " + resource, t); + } + } else { // Binary file + try (final InputStream data = resource.openStream()) { + ByteBuffer dataBuffer; // To read in the correct endianness + final byte[] info = new byte[80]; // Header data + final byte[] numberFaces = new byte[4]; // the number of faces + byte[] faceData; // face data + int numberTriangles; // First info (after the header) on the file + + // the first 80 bytes aren't important (except if you want to support non standard colors) + if (80 != data.read(info)) { + throw new IOException("Format Error: 80 bytes expected"); + } else { + // read number of faces, setting the correct order + data.read(numberFaces); + dataBuffer = ByteBuffer.wrap(numberFaces); + dataBuffer.order(ByteOrder.nativeOrder()); + + // allocate buffer for face data, with each face requiring 50 bytes + numberTriangles = dataBuffer.getInt(); + faceData = new byte[50 * numberTriangles]; + + // read face data + data.read(faceData); + dataBuffer = ByteBuffer.wrap(faceData); + dataBuffer.order(ByteOrder.nativeOrder()); + + // read each facet noting that after each fact there are 2 bytes without information + // no need to skip for last iteration + for (int index = 0; index < numberTriangles; index++) { + try { + // Reads a facet from a binary file. + // normal + store.getDataStore().getNormals().add( + new Vector3(dataBuffer.getFloat(), dataBuffer.getFloat(), dataBuffer.getFloat())); + // 3 vertices + store.getDataStore().getVertices().add( + new Vector3(dataBuffer.getFloat(), dataBuffer.getFloat(), dataBuffer.getFloat())); + store.getDataStore().getVertices().add( + new Vector3(dataBuffer.getFloat(), dataBuffer.getFloat(), dataBuffer.getFloat())); + store.getDataStore().getVertices().add( + new Vector3(dataBuffer.getFloat(), dataBuffer.getFloat(), dataBuffer.getFloat())); + if (index != numberTriangles - 1) { + dataBuffer.get(); + dataBuffer.get(); + } + } catch (final Throwable t) { + throw new Exception("Format Error: iteration number " + index, t); + } + } + } + } catch (final Throwable t) { + throw new Error("Unable to load stl resource from URL: " + resource, t); + } + } + + store.commitObjects(); + store.cleanup(); + return store; + + } + + public void setModelLocator(final ResourceLocator locator) { + _modelLocator = locator; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/AbstractMaterial.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/AbstractMaterial.java new file mode 100644 index 0000000..c008479 --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/AbstractMaterial.java @@ -0,0 +1,244 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.util; + +import com.ardor3d.math.ColorRGBA; +import com.ardor3d.math.MathUtils; +import com.ardor3d.renderer.state.BlendState; +import com.ardor3d.renderer.state.MaterialState; + +/** + * common material parameters + */ +public abstract class AbstractMaterial { + + private float ambientRed, ambientGreen, ambientBlue, ambientAlpha; + + private float diffuseRed, diffuseGreen, diffuseBlue, diffuseAlpha; + + private float emissiveRed, emissiveGreen, emissiveBlue, emissiveAlpha; + + private float specularRed, specularGreen, specularBlue, specularAlpha; + + private float shininess; + + private boolean forceBlend; + + protected AbstractMaterial() { + super(); + ambientRed = -1; + ambientGreen = -1; + ambientBlue = -1; + ambientAlpha = -1; + diffuseRed = -1; + diffuseGreen = -1; + diffuseBlue = -1; + diffuseAlpha = -1; + emissiveRed = -1; + emissiveGreen = -1; + emissiveBlue = -1; + emissiveAlpha = -1; + specularRed = -1; + specularGreen = -1; + specularBlue = -1; + specularAlpha = -1; + shininess = -1; + } + + public BlendState getBlendState() { + if (forceBlend || (ambientAlpha != -1 && ambientAlpha < 1.0f) || (diffuseAlpha != -1 && diffuseAlpha < 1.0f) + || (emissiveAlpha != -1 && emissiveAlpha < 1.0f) || (specularAlpha != -1 && specularAlpha < 1.0f)) { + final BlendState blend = new BlendState(); + blend.setBlendEnabled(true); + blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha); + blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); + blend.setTestEnabled(true); + blend.setTestFunction(BlendState.TestFunction.GreaterThan); + blend.setReference(0); + return blend; + } + return null; + } + + public MaterialState getMaterialState() { + if ((ambientRed != -1 && ambientGreen != -1 && ambientBlue != -1) + || (diffuseRed != -1 && diffuseGreen != -1 && diffuseBlue != -1) + || (emissiveRed != -1 && emissiveGreen != -1 && emissiveBlue != -1) + || (specularRed != -1 && specularGreen != -1 && specularBlue != -1) || shininess != -1) { + final MaterialState material = new MaterialState(); + if (ambientRed != -1 && ambientGreen != -1 && ambientBlue != -1) { + final float alpha = ambientAlpha == -1 ? 1 : MathUtils.clamp(ambientAlpha, 0, 1); + material.setAmbient(new ColorRGBA(ambientRed, ambientGreen, ambientBlue, alpha)); + } + if (diffuseRed != -1 && diffuseGreen != -1 && diffuseBlue != -1) { + final float alpha = diffuseAlpha == -1 ? 1 : MathUtils.clamp(diffuseAlpha, 0, 1); + material.setDiffuse(new ColorRGBA(diffuseRed, diffuseGreen, diffuseBlue, alpha)); + } + if (emissiveRed != -1 && emissiveGreen != -1 && emissiveBlue != -1) { + final float alpha = emissiveAlpha == -1 ? 1 : MathUtils.clamp(emissiveAlpha, 0, 1); + material.setEmissive(new ColorRGBA(emissiveRed, emissiveGreen, emissiveBlue, alpha)); + } + if (specularRed != -1 && specularGreen != -1 && specularBlue != -1) { + final float alpha = specularAlpha == -1 ? 1 : MathUtils.clamp(specularAlpha, 0, 1); + material.setSpecular(new ColorRGBA(specularRed, specularGreen, specularBlue, alpha)); + } + if (shininess != -1) { + material.setShininess(shininess); + } + return material; + } + return null; + } + + public float getAmbientRed() { + return ambientRed; + } + + public void setAmbientRed(final float ambientRed) { + this.ambientRed = ambientRed; + } + + public float getAmbientGreen() { + return ambientGreen; + } + + public void setAmbientGreen(final float ambientGreen) { + this.ambientGreen = ambientGreen; + } + + public float getAmbientBlue() { + return ambientBlue; + } + + public void setAmbientBlue(final float ambientBlue) { + this.ambientBlue = ambientBlue; + } + + public float getDiffuseRed() { + return diffuseRed; + } + + public void setDiffuseRed(final float diffuseRed) { + this.diffuseRed = diffuseRed; + } + + public float getDiffuseGreen() { + return diffuseGreen; + } + + public void setDiffuseGreen(final float diffuseGreen) { + this.diffuseGreen = diffuseGreen; + } + + public float getDiffuseBlue() { + return diffuseBlue; + } + + public void setDiffuseBlue(final float diffuseBlue) { + this.diffuseBlue = diffuseBlue; + } + + public float getEmissiveRed() { + return emissiveRed; + } + + public void setEmissiveRed(final float emissiveRed) { + this.emissiveRed = emissiveRed; + } + + public float getEmissiveGreen() { + return emissiveGreen; + } + + public void setEmissiveGreen(final float emissiveGreen) { + this.emissiveGreen = emissiveGreen; + } + + public float getEmissiveBlue() { + return emissiveBlue; + } + + public void setEmissiveBlue(final float emissiveBlue) { + this.emissiveBlue = emissiveBlue; + } + + public float getSpecularRed() { + return specularRed; + } + + public void setSpecularRed(final float specularRed) { + this.specularRed = specularRed; + } + + public float getSpecularGreen() { + return specularGreen; + } + + public void setSpecularGreen(final float specularGreen) { + this.specularGreen = specularGreen; + } + + public float getSpecularBlue() { + return specularBlue; + } + + public void setSpecularBlue(final float specularBlue) { + this.specularBlue = specularBlue; + } + + public float getAmbientAlpha() { + return ambientAlpha; + } + + public void setAmbientAlpha(final float ambientAlpha) { + this.ambientAlpha = ambientAlpha; + } + + public float getDiffuseAlpha() { + return diffuseAlpha; + } + + public void setDiffuseAlpha(final float diffuseAlpha) { + this.diffuseAlpha = diffuseAlpha; + } + + public float getEmissiveAlpha() { + return emissiveAlpha; + } + + public void setEmissiveAlpha(final float emissiveAlpha) { + this.emissiveAlpha = emissiveAlpha; + } + + public float getSpecularAlpha() { + return specularAlpha; + } + + public void setSpecularAlpha(final float specularAlpha) { + this.specularAlpha = specularAlpha; + } + + public float getShininess() { + return shininess; + } + + public void setShininess(final float shininess) { + this.shininess = shininess; + } + + public boolean isForceBlend() { + return forceBlend; + } + + public void setForceBlend(final boolean forceBlend) { + this.forceBlend = forceBlend; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/FileHelper.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/FileHelper.java new file mode 100644 index 0000000..8a9c5cf --- /dev/null +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/FileHelper.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2008-2016 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.extension.model.util; + +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.CharacterCodingException; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.StandardCharsets; + +import com.ardor3d.util.resource.ResourceSource; + +public class FileHelper { + + /** + * Tests whether or not the specified string is pure ASCII. Uses the method discussed at: + * + * <pre> + * http://www.rgagnon.com/javadetails/java-0536.html + * http://stackoverflow.com/questions/3585053/in-java-is-it-possible-to-check-if-a-string-is-only-ascii + * </pre> + * + * @param string + * String to test. + * @return Logical-true if pure ASCII, else logical-false. + */ + public boolean isStringPureAscii(final String string) { + final byte bytearray[] = string.getBytes(); + final CharsetDecoder d = StandardCharsets.US_ASCII.newDecoder(); + try { + final CharBuffer r = d.decode(ByteBuffer.wrap(bytearray)); + r.toString(); + } catch (final CharacterCodingException e) { + return false; + } + return true; + } + + /** + * Tests whether or not the file with the specified filename is pure ASCII. The method used is to read the file a + * line at a time and test if each line is ASCII. + * + * @param filename + * File name. + * @return Logical-true if pure ASCII, else logical-false. + */ + public boolean isFilePureAscii(final String filename) { + try (final FileInputStream fstream = new FileInputStream(filename); + final DataInputStream in = new DataInputStream(fstream); + final BufferedReader br = new BufferedReader(new InputStreamReader(in))) { + String strLine; + // read file a line at a time + while ((strLine = br.readLine()) != null) { + final boolean isAscii = isStringPureAscii(strLine); + if (!isAscii) { + return false; + } + } + } catch (final Exception e) { + return false; + } + return true; + } + + /** + * Tests whether or not the file with the specified filename is pure ASCII. The method used is to read the file a + * line at a time and test if each line is ASCII. + * + * @param resource + * the name of the resource to find. + * @return Logical-true if pure ASCII, else logical-false. + */ + public boolean isFilePureAscii(final ResourceSource resource) { + try (final InputStream inputStream = resource.openStream(); + final DataInputStream in = new DataInputStream(inputStream); + final BufferedReader br = new BufferedReader(new InputStreamReader(in))) { + String strLine; + // read file a line at a time + while ((strLine = br.readLine()) != null) { + final boolean isAscii = isStringPureAscii(strLine); + if (!isAscii) { + return false; + } + } + } catch (final Exception e) { + return false; + } + return true; + } +} diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java index 15c810a..e84db4f 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -127,7 +127,7 @@ public class KeyframeController<T extends Spatial> extends ComplexSpatialControl */ public KeyframeController() { setSpeed(1); - _keyframes = new ArrayList<PointInTime>(); + _keyframes = new ArrayList<>(); _curFrame = 0; setRepeatType(ComplexSpatialController.RepeatType.WRAP); setMinTime(0); @@ -245,7 +245,7 @@ public class KeyframeController<T extends Spatial> extends ComplexSpatialControl } Mesh begin = null, end = null; if (_prevKeyframes == null) { - _prevKeyframes = new ArrayList<PointInTime>(); + _prevKeyframes = new ArrayList<>(); begin = new Mesh(); end = new Mesh(); } else { diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvEdgeInfo.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvEdgeInfo.java index ee49d56..9190145 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvEdgeInfo.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvEdgeInfo.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvFaceInfo.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvFaceInfo.java index 688c73d..3f847ca 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvFaceInfo.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvFaceInfo.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripInfo.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripInfo.java index 2cf0e18..575cd87 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripInfo.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripInfo.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,13 +10,12 @@ package com.ardor3d.extension.model.util.nvtristrip; +import java.util.ArrayList; import java.util.List; -import com.google.common.collect.Lists; - final class NvStripInfo { NvStripStartInfo _startInfo; - List<NvFaceInfo> _faces = Lists.newArrayList(); + List<NvFaceInfo> _faces = new ArrayList<>(); int _stripId; int _experimentId; @@ -177,11 +176,11 @@ final class NvStripInfo { */ void build(final List<NvEdgeInfo> edgeInfos, final List<NvFaceInfo> faceInfos) { // used in building the strips forward and backward - final List<Integer> scratchIndices = Lists.newArrayList(); + final List<Integer> scratchIndices = new ArrayList<>(); // build forward... start with the initial face - final List<NvFaceInfo> forwardFaces = Lists.newArrayList(); - final List<NvFaceInfo> backwardFaces = Lists.newArrayList(); + final List<NvFaceInfo> forwardFaces = new ArrayList<>(); + final List<NvFaceInfo> backwardFaces = new ArrayList<>(); forwardFaces.add(_startInfo._startFace); markTriangle(_startInfo._startFace); @@ -251,7 +250,7 @@ final class NvStripInfo { // tempAllFaces is going to be forwardFaces + backwardFaces // it's used for Unique() - final List<NvFaceInfo> tempAllFaces = Lists.newArrayList(); + final List<NvFaceInfo> tempAllFaces = new ArrayList<>(); for (int i = 0; i < forwardFaces.size(); i++) { tempAllFaces.add(forwardFaces.get(i)); } diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripStartInfo.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripStartInfo.java index cecb0d3..7629d6d 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripStartInfo.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripStartInfo.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripifier.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripifier.java index 8779e5e..fbdf921 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripifier.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripifier.java @@ -1,22 +1,21 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.model.util.nvtristrip; +import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.logging.Logger; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - /** * Ported from <a href="http://developer.nvidia.com/object/nvtristrip_library.html">NVIDIA's NvTriStrip Library</a> */ @@ -25,14 +24,14 @@ final class NvStripifier { public static int CACHE_INEFFICIENCY = 6; - protected List<Integer> _indices = Lists.newArrayList(); + protected List<Integer> _indices = new ArrayList<>(); protected int _cacheSize; protected int _minStripLength; protected float _meshJump; protected boolean _firstTimeResetPoint; /** - * + * * @param in_indices * the input indices of the mesh to stripify * @param in_cacheSize @@ -59,12 +58,12 @@ final class NvStripifier { _indices = in_indices; // build the stripification info - final List<NvFaceInfo> allFaceInfos = Lists.newArrayList(); - final List<NvEdgeInfo> allEdgeInfos = Lists.newArrayList(); + final List<NvFaceInfo> allFaceInfos = new ArrayList<>(); + final List<NvEdgeInfo> allEdgeInfos = new ArrayList<>(); buildStripifyInfo(allFaceInfos, allEdgeInfos, maxIndex); - final List<NvStripInfo> allStrips = Lists.newArrayList(); + final List<NvStripInfo> allStrips = new ArrayList<>(); // stripify findAllStrips(allStrips, allFaceInfos, allEdgeInfos, numSamples); @@ -75,7 +74,7 @@ final class NvStripifier { /** * Generates actual strips from the list-in-strip-order. - * + * * @param allStrips * @param stripIndices * @param bStitchStrips @@ -150,8 +149,8 @@ final class NvStripifier { stripIndices.add(tFirstFace._v0); // Check CW/CCW ordering - if (NvStripifier.nextIsCW(stripIndices.size() - accountForNegatives) != NvStripifier.isCW( - strip._faces.get(0), tFirstFace._v0, tFirstFace._v1)) { + if (NvStripifier.nextIsCW(stripIndices.size() - accountForNegatives) != NvStripifier + .isCW(strip._faces.get(0), tFirstFace._v0, tFirstFace._v1)) { stripIndices.add(tFirstFace._v0); } } @@ -325,7 +324,7 @@ final class NvStripifier { } /** - * + * * @param numIndices * @return true if the next face should be ordered in CW fashion */ @@ -385,7 +384,7 @@ final class NvStripifier { /** * find the edge info for these two indices - * + * * @param edgeInfos * @param v0 * @param v1 @@ -416,13 +415,14 @@ final class NvStripifier { /** * find the other face sharing these vertices - * + * * @param edgeInfos * @param v0 * @param v1 * @param faceInfo * @return */ + @SuppressWarnings("null") static NvFaceInfo findOtherFace(final List<NvEdgeInfo> edgeInfos, final int v0, final int v1, final NvFaceInfo faceInfo) { final NvEdgeInfo edgeInfo = NvStripifier.findEdgeInfo(edgeInfos, v0, v1); @@ -439,7 +439,7 @@ final class NvStripifier { /** * A good reset point is one near other committed areas so that we know that when we've made the longest strips its * because we're stripifying in the same general orientation. - * + * * @param faceInfos * @param edgeInfos * @return @@ -494,11 +494,11 @@ final class NvStripifier { /** * Does the stripification, puts output strips into vector allStrips - * + * * Works by setting running a number of experiments in different areas of the mesh, and accepting the one which * results in the longest strips. It then accepts this, and moves on to a different area of the mesh. We try to jump * around the mesh some, to ensure that large open spans of strips get generated. - * + * * @param allStrips * @param allFaceInfos * @param allEdgeInfos @@ -519,11 +519,11 @@ final class NvStripifier { // final List<NvStripInfo>[] experiments = new List[numSamples * 6]; for (int i = 0; i < experiments.length; i++) { - experiments[i] = Lists.newArrayList(); + experiments[i] = new ArrayList<>(); } int experimentIndex = 0; - final Set<NvFaceInfo> resetPoints = Sets.newHashSet(); + final Set<NvFaceInfo> resetPoints = new HashSet<>(); for (int i = 0; i < numSamples; i++) { // Try to find another good reset point. @@ -641,7 +641,7 @@ final class NvStripifier { /** * Splits the input vector of strips (allBigStrips) into smaller, cache friendly pieces, then reorders these pieces * to maximize cache hits. The final strips are stored in outStrips - * + * * @param allStrips * @param outStrips * @param edgeInfos @@ -650,7 +650,7 @@ final class NvStripifier { void splitUpStripsAndOptimize(final List<NvStripInfo> allStrips, final List<NvStripInfo> outStrips, final List<NvEdgeInfo> edgeInfos, final List<NvFaceInfo> outFaceList) { final int threshold = _cacheSize; - final List<NvStripInfo> tempStrips = Lists.newArrayList(); + final List<NvStripInfo> tempStrips = new ArrayList<>(); // split up strips into threshold-sized pieces for (int i = 0; i < allStrips.size(); i++) { @@ -681,9 +681,8 @@ final class NvStripifier { degenerateCount++; // last time or first time through, no need for a degenerate - if ((faceCtr + 1 != threshold + j * threshold + degenerateCount || j == numTimes - 1 - && numLeftover < 4 && numLeftover > 0) - && !bFirstTime) { + if ((faceCtr + 1 != threshold + j * threshold + degenerateCount + || j == numTimes - 1 && numLeftover < 4 && numLeftover > 0) && !bFirstTime) { currentStrip._faces.add(allStripI._faces.get(faceCtr++)); } else { ++faceCtr; @@ -747,7 +746,7 @@ final class NvStripifier { } // add small strips to face list - final List<NvStripInfo> tempStrips2 = Lists.newArrayList(); + final List<NvStripInfo> tempStrips2 = new ArrayList<>(); removeSmallStrips(tempStrips, tempStrips2, outFaceList); outStrips.clear(); @@ -868,7 +867,7 @@ final class NvStripifier { final List<NvFaceInfo> faceList) { faceList.clear(); allBigStrips.clear(); // make sure these are empty - final List<NvFaceInfo> tempFaceList = Lists.newArrayList(); + final List<NvFaceInfo> tempFaceList = new ArrayList<>(); for (int i = 0; i < allStrips.size(); i++) { final NvStripInfo allStripI = allStrips.get(i); @@ -918,7 +917,7 @@ final class NvStripifier { /** * Finds the next face to start the next strip on. - * + * * @param faceInfos * @param edgeInfos * @param strip @@ -962,7 +961,7 @@ final class NvStripifier { /** * "Commits" the input strips by setting their m_experimentId to -1 and adding to the allStrips vector - * + * * @param allStrips * @param strips */ @@ -985,7 +984,7 @@ final class NvStripifier { } /** - * + * * @param strips * @return the average strip size of the input vector of strips */ @@ -1000,7 +999,7 @@ final class NvStripifier { /** * Finds a good starting point, namely one which has only one neighbor - * + * * @param faceInfos * @param edgeInfos * @return @@ -1038,7 +1037,7 @@ final class NvStripifier { /** * Updates the input vertex cache with this strip's vertices - * + * * @param vcache * @param strip */ @@ -1050,7 +1049,7 @@ final class NvStripifier { /** * Updates the input vertex cache with this face's vertices - * + * * @param vcache * @param face */ @@ -1120,7 +1119,7 @@ final class NvStripifier { } /** - * + * * @param face * @param edgeInfoVec * @return the number of neighbors that this face has @@ -1145,7 +1144,7 @@ final class NvStripifier { /** * Builds the list of all face and edge infos - * + * * @param faceInfos * @param edgeInfos * @param maxIndex diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvTriangleStripper.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvTriangleStripper.java index c12d86d..71f8870 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvTriangleStripper.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvTriangleStripper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.model.util.nvtristrip; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -22,7 +23,6 @@ import com.ardor3d.scenegraph.MeshData; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.scenegraph.visitor.Visitor; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; /** * Ported from <a href="http://developer.nvidia.com/object/nvtristrip_library.html">NVIDIA's NvTriStrip Library</a> @@ -241,7 +241,7 @@ public class NvTriangleStripper implements Visitor { PrimitiveGroup[] primGroups; // put data in format that the stripifier likes - final List<Integer> tempIndices = Lists.newArrayList(); + final List<Integer> tempIndices = new ArrayList<>(); int maxIndex = 0; for (int i = 0; i < in_indices.length; i++) { tempIndices.add(in_indices[i]); @@ -249,8 +249,8 @@ public class NvTriangleStripper implements Visitor { maxIndex = in_indices[i]; } } - final List<NvStripInfo> tempStrips = Lists.newArrayList(); - final List<NvFaceInfo> tempFaces = Lists.newArrayList(); + final List<NvStripInfo> tempStrips = new ArrayList<>(); + final List<NvFaceInfo> tempFaces = new ArrayList<>(); final NvStripifier stripifier = new NvStripifier(); @@ -258,7 +258,7 @@ public class NvTriangleStripper implements Visitor { stripifier.stripify(tempIndices, _cacheSize, _minStripSize, maxIndex, tempStrips, tempFaces); // stitch strips together - final List<Integer> stripIndices = Lists.newArrayList(); + final List<Integer> stripIndices = new ArrayList<>(); int numSeparateStrips = 0; if (_listsOnly) { @@ -374,7 +374,7 @@ public class NvTriangleStripper implements Visitor { final List<NvFaceInfo> in_bins[] = new List[NUMBINS]; for (int i = 0; i < NUMBINS; i++) { - in_bins[i] = Lists.newArrayList(); + in_bins[i] = new ArrayList<>(); } // hash input indices on first index @@ -525,7 +525,7 @@ public class NvTriangleStripper implements Visitor { PrimitiveGroup[] strips = generateStrips(indices, false); if (_reorderVertices) { - final AtomicReference<int[]> newOrder = new AtomicReference<int[]>(); + final AtomicReference<int[]> newOrder = new AtomicReference<>(); strips = remapIndices(strips, newOrder, md.getVertexCount()); // ask mesh to apply new vertex order diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/PrimitiveGroup.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/PrimitiveGroup.java index 4ba92c2..1886f11 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/PrimitiveGroup.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/PrimitiveGroup.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/VertexCache.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/VertexCache.java index ba93840..ae3a7ef 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/VertexCache.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/VertexCache.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/useful/TrailMesh.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/useful/TrailMesh.java index 558d9fb..da73655 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/useful/TrailMesh.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/useful/TrailMesh.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -90,7 +90,7 @@ public class TrailMesh extends Mesh { this.nrTrailSections = nrTrailSections; trailVertices = nrTrailSections * 2; - trailVectors = new LinkedList<TrailData>(); + trailVectors = new LinkedList<>(); for (int i = 0; i < nrTrailSections; i++) { trailVectors.add(new TrailData()); } diff --git a/ardor3d-lwjgl/.settings/org.eclipse.jdt.core.prefs b/ardor3d-jinput/.settings/org.eclipse.jdt.core.prefs index 16496e9..941c850 100644 --- a/ardor3d-lwjgl/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-jinput/.settings/org.eclipse.jdt.core.prefs @@ -89,12 +89,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-lwjgl/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-jinput/.settings/org.eclipse.jdt.ui.prefs index 2cb0f4c..9cac248 100644 --- a/ardor3d-lwjgl/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-jinput/.settings/org.eclipse.jdt.ui.prefs @@ -59,7 +59,7 @@ org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -82,7 +82,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false diff --git a/ardor3d-jinput/build.gradle b/ardor3d-jinput/build.gradle new file mode 100644 index 0000000..b7bff7b --- /dev/null +++ b/ardor3d-jinput/build.gradle @@ -0,0 +1,6 @@ + +description = 'Ardor 3D JINPUT' +dependencies { + compile project(':ardor3d-core') + compile group: 'net.java.jinput', name: 'jinput', version:'2.0.6' +} diff --git a/ardor3d-lwjgl/pom.xml b/ardor3d-jinput/pom.xml index b8414d2..48f7910 100644 --- a/ardor3d-lwjgl/pom.xml +++ b/ardor3d-jinput/pom.xml @@ -7,9 +7,9 @@ <version>1.0-SNAPSHOT</version> </parent> - <artifactId>ardor3d-lwjgl</artifactId> + <artifactId>ardor3d-jinput</artifactId> <packaging>bundle</packaging> - <name>Ardor 3D LWJGL</name> + <name>Ardor 3D JINPUT</name> <dependencies> <dependency> @@ -18,13 +18,9 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.lwjgl.lwjgl</groupId> - <artifactId>lwjgl</artifactId> - </dependency> - <dependency> - <groupId>org.lwjgl.lwjgl</groupId> - <artifactId>lwjgl_util</artifactId> + <groupId>net.java.jinput</groupId> + <artifactId>jinput</artifactId> </dependency> </dependencies> - + </project> diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java b/ardor3d-jinput/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java index 114a869..0169090 100644 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java +++ b/ardor3d-jinput/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -26,7 +26,6 @@ import com.ardor3d.input.ControllerInfo; import com.ardor3d.input.ControllerState; import com.ardor3d.input.ControllerWrapper; import com.google.common.collect.AbstractIterator; -import com.google.common.collect.Lists; import com.google.common.collect.PeekingIterator; public class JInputControllerWrapper implements ControllerWrapper { @@ -34,9 +33,10 @@ public class JInputControllerWrapper implements ControllerWrapper { protected final Event _event = new Event(); protected final List<ControllerEvent> _events = Collections.synchronizedList(new ArrayList<ControllerEvent>()); protected JInputControllerEventIterator _eventsIt = new JInputControllerEventIterator(); - protected final List<ControllerInfo> _controllers = Lists.newArrayList(); + protected final List<ControllerInfo> _controllers = new ArrayList<>(); protected static boolean _inited = false; + @Override public PeekingIterator<ControllerEvent> getEvents() { init(); if (!_eventsIt.hasNext()) { @@ -66,6 +66,7 @@ public class JInputControllerWrapper implements ControllerWrapper { return _controllers.get(controllerIndex); } + @Override public synchronized void init() { if (_inited) { return; @@ -90,8 +91,8 @@ public class JInputControllerWrapper implements ControllerWrapper { } protected ControllerInfo getControllerInfo(final Controller controller) { - final List<String> axisNames = Lists.newArrayList(); - final List<String> buttonNames = Lists.newArrayList(); + final List<String> axisNames = new ArrayList<>(); + final List<String> buttonNames = new ArrayList<>(); for (final Component comp : controller.getComponents()) { if (comp.getIdentifier() instanceof Identifier.Axis) { diff --git a/ardor3d-jogl-awt/.settings/org.eclipse.jdt.core.prefs b/ardor3d-jogl-awt/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..52f1f2e --- /dev/null +++ b/ardor3d-jogl-awt/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,15 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/ardor3d-jogl-awt/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-jogl-awt/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..9cac248 --- /dev/null +++ b/ardor3d-jogl-awt/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,113 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=true +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_serial_version_id=true +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=true +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=true +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=true +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=false +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=true +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=true +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup_profile=_ArdorLabs +cleanup_settings_version=2 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_ArdorLabs +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=ex +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=true +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=true +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=false +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/ardor3d-jogl-awt/build.gradle b/ardor3d-jogl-awt/build.gradle new file mode 100644 index 0000000..c443fa6 --- /dev/null +++ b/ardor3d-jogl-awt/build.gradle @@ -0,0 +1,7 @@ + +description = 'Ardor 3D JOGL AWT' +dependencies { + compile project(':ardor3d-core') + compile project(':ardor3d-awt') + compile project(':ardor3d-jogl') +} diff --git a/ardor3d-jogl-awt/pom.xml b/ardor3d-jogl-awt/pom.xml new file mode 100644 index 0000000..d76a750 --- /dev/null +++ b/ardor3d-jogl-awt/pom.xml @@ -0,0 +1,32 @@ +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.ardor3d</groupId> + <artifactId>ardor3d</artifactId> + <relativePath>../pom.xml</relativePath> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>ardor3d-jogl-awt</artifactId> + <packaging>bundle</packaging> + <name>Ardor 3D JOGL AWT</name> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ardor3d-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ardor3d-awt</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ardor3d-jogl</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + +</project> diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglAwtCanvas.java index cc233c8..c92b275 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java +++ b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglAwtCanvas.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -8,27 +8,29 @@ * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ -package com.ardor3d.framework.jogl; +package com.ardor3d.framework.jogl.awt; import java.lang.reflect.InvocationTargetException; import java.util.concurrent.CountDownLatch; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.awt.GLCanvas; + import javax.swing.SwingUtilities; import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.DisplaySettings; +import com.ardor3d.framework.jogl.CapsUtil; +import com.ardor3d.framework.jogl.JoglCanvasRenderer; +import com.ardor3d.framework.jogl.JoglDrawerRunnable; /** * Ardor3D JOGL AWT heavyweight canvas, AWT component for the OpenGL rendering of Ardor3D with JOGL that supports the * AWT input system directly and its abstraction in Ardor3D (com.ardor3d.input.awt) * - * FIXME there is still a deadlock when using several instances of this class in the same container, see JOGL bug 572 - * Rather use JoglNewtAwtCanvas in this case. - * */ public class JoglAwtCanvas extends GLCanvas implements Canvas { @@ -60,6 +62,9 @@ public class JoglAwtCanvas extends GLCanvas implements Canvas { setSize(_settings.getWidth(), _settings.getHeight()); setIgnoreRepaint(true); setAutoSwapBufferMode(false); + // disables HiDPI, see https://github.com/gouessej/Ardor3D/issues/14 + setSurfaceScale(new float[] { ScalableSurface.IDENTITY_PIXELSCALE, + ScalableSurface.IDENTITY_PIXELSCALE }); } @Override diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtInitializerRunnable.java b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglAwtInitializerRunnable.java index 3a7153d..98c1949 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtInitializerRunnable.java +++ b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglAwtInitializerRunnable.java @@ -8,7 +8,7 @@ * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ -package com.ardor3d.framework.jogl; +package com.ardor3d.framework.jogl.awt; import com.ardor3d.framework.DisplaySettings; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvas.java b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglAwtWindow.java index 9ca4c89..8e8ca09 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvas.java +++ b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglAwtWindow.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -8,7 +8,7 @@ * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ -package com.ardor3d.framework.jogl; +package com.ardor3d.framework.jogl.awt; import java.awt.Dimension; import java.awt.DisplayMode; @@ -27,24 +27,24 @@ import java.util.concurrent.CountDownLatch; import java.util.logging.Level; import java.util.logging.Logger; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; - +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.NativeCanvas; +import com.ardor3d.framework.jogl.JoglCanvasRenderer; import com.ardor3d.image.Image; import com.ardor3d.renderer.jogl.JoglPbufferTextureRenderer; /** - * A canvas implementation for use with native JOGL windows. + * A canvas implementation for use with AWT JOGL windows. */ -public class JoglCanvas extends Frame implements NativeCanvas { +public class JoglAwtWindow extends Frame implements NativeCanvas { private static final long serialVersionUID = 1L; - private static final Logger logger = Logger.getLogger(JoglCanvas.class.getName()); + private static final Logger logger = Logger.getLogger(JoglAwtWindow.class.getName()); private final DisplaySettings _settings; private boolean _inited = false; @@ -52,7 +52,7 @@ public class JoglCanvas extends Frame implements NativeCanvas { private JoglAwtCanvas _glCanvas; - public JoglCanvas(final JoglCanvasRenderer canvasRenderer, final DisplaySettings settings) { + public JoglAwtWindow(final JoglCanvasRenderer canvasRenderer, final DisplaySettings settings) { _settings = settings; // Create the OpenGL canvas @@ -214,7 +214,7 @@ public class JoglCanvas extends Frame implements NativeCanvas { gd.setDisplayMode(previousDisplayMode); } // If required, get back to the windowed mode - if (gd.getFullScreenWindow() == JoglCanvas.this) { + if (gd.getFullScreenWindow() == JoglAwtWindow.this) { gd.setFullScreenWindow(null); } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglNewtAwtCanvas.java index b56e6c1..e72f045 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java +++ b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglNewtAwtCanvas.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -8,16 +8,20 @@ * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ -package com.ardor3d.framework.jogl; +package com.ardor3d.framework.jogl.awt; import java.util.concurrent.CountDownLatch; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLRunnable; - +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLRunnable; import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.DisplaySettings; +import com.ardor3d.framework.jogl.CapsUtil; +import com.ardor3d.framework.jogl.JoglCanvasRenderer; +import com.ardor3d.framework.jogl.JoglDrawerRunnable; +import com.ardor3d.framework.jogl.NewtWindowContainer; +import com.jogamp.nativewindow.ScalableSurface; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; @@ -38,7 +42,12 @@ public class JoglNewtAwtCanvas extends NewtCanvasAWT implements Canvas, NewtWind public JoglNewtAwtCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer, final CapsUtil capsUtil) { - super(GLWindow.create(capsUtil.getCapsForSettings(settings))); + this(createNewtChildWindow(settings, capsUtil), settings, canvasRenderer, capsUtil); + } + + public JoglNewtAwtCanvas(final GLWindow newtChildWindow, final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer, + final CapsUtil capsUtil) { + super(newtChildWindow); _drawerGLRunnable = new JoglDrawerRunnable(canvasRenderer); getNewtWindow().setUndecorated(true); _settings = settings; @@ -49,6 +58,14 @@ public class JoglNewtAwtCanvas extends NewtCanvasAWT implements Canvas, NewtWind setIgnoreRepaint(true); getNewtWindow().setAutoSwapBufferMode(false); } + + private static GLWindow createNewtChildWindow(final DisplaySettings settings, final CapsUtil capsUtil) { + final GLWindow newtChildWindow = GLWindow.create(capsUtil.getCapsForSettings(settings)); + // disables HiDPI, see https://github.com/gouessej/Ardor3D/issues/14 + newtChildWindow.setSurfaceScale(new float[] { ScalableSurface.IDENTITY_PIXELSCALE, + ScalableSurface.IDENTITY_PIXELSCALE }); + return newtChildWindow; + } @Override @MainThread diff --git a/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglSwingCanvas.java b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglSwingCanvas.java new file mode 100644 index 0000000..c9ef568 --- /dev/null +++ b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglSwingCanvas.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.framework.jogl.awt; + +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.CountDownLatch; + +import javax.swing.SwingUtilities; + +import com.ardor3d.annotation.MainThread; +import com.ardor3d.framework.Canvas; +import com.ardor3d.framework.DisplaySettings; +import com.ardor3d.framework.jogl.CapsUtil; +import com.ardor3d.framework.jogl.JoglCanvasRenderer; +import com.ardor3d.framework.jogl.JoglDrawerRunnable; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.awt.GLJPanel; + +/** + * Ardor3D JOGL Swing lightweight canvas, Swing component for the OpenGL rendering of Ardor3D with JOGL that supports + * the AWT input system directly and its abstraction in Ardor3D (com.ardor3d.input.awt). As this canvas is generally + * slower and heavier (in term of memory footprint) than JoglAwtCanvas, use it if and only if you have some problems + * when mixing heavyweight and lightweight components. + */ +public class JoglSwingCanvas extends GLJPanel implements Canvas { + + private static final long serialVersionUID = 1L; + + private final JoglCanvasRenderer _canvasRenderer; + private boolean _inited = false; + + private final DisplaySettings _settings; + + private final JoglDrawerRunnable _drawerGLRunnable; + + private final JoglSwingInitializerRunnable _initializerRunnable; + + public JoglSwingCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer) { + this(settings, canvasRenderer, new CapsUtil()); + } + + public JoglSwingCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer, + final CapsUtil capsUtil) { + super(capsUtil.getCapsForSettings(settings)); + _drawerGLRunnable = new JoglDrawerRunnable(canvasRenderer); + _initializerRunnable = new JoglSwingInitializerRunnable(this, settings); + _settings = settings; + _canvasRenderer = canvasRenderer; + + setFocusable(true); + requestFocus(); + setSize(_settings.getWidth(), _settings.getHeight()); + setIgnoreRepaint(true); + setAutoSwapBufferMode(false); + // disables HiDPI, see https://github.com/gouessej/Ardor3D/issues/14 + setSurfaceScale(new float[] { ScalableSurface.IDENTITY_PIXELSCALE, + ScalableSurface.IDENTITY_PIXELSCALE }); + } + + @Override + @MainThread + public void init() { + if (_inited) { + return; + } + + // Calling setVisible(true) on the GLCanvas not from the AWT-EDT can freeze the Intel GPU under Windows + if (!SwingUtilities.isEventDispatchThread()) { + try { + SwingUtilities.invokeAndWait(_initializerRunnable); + } catch (final InterruptedException ex) { + ex.printStackTrace(); + } catch (final InvocationTargetException ex) { + ex.printStackTrace(); + } + } else { + _initializerRunnable.run(); + } + + _inited = isRealized(); + } + + @Override + public void draw(final CountDownLatch latch) { + if (!_inited) { + init(); + } + + if (isShowing()) { + invoke(true, _drawerGLRunnable); + } + if (latch != null) { + latch.countDown(); + } + } + + @Override + public JoglCanvasRenderer getCanvasRenderer() { + return _canvasRenderer; + } + + public void setVSyncEnabled(final boolean enabled) { + invoke(true, new GLRunnable() { + @Override + public boolean run(final GLAutoDrawable glAutoDrawable) { + glAutoDrawable.getGL().setSwapInterval(enabled ? 1 : 0); + return false; + } + }); + } +} diff --git a/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglSwingInitializerRunnable.java b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglSwingInitializerRunnable.java new file mode 100644 index 0000000..fc73179 --- /dev/null +++ b/ardor3d-jogl-awt/src/main/java/com/ardor3d/framework/jogl/awt/JoglSwingInitializerRunnable.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.framework.jogl.awt; + +import com.ardor3d.framework.DisplaySettings; + +public class JoglSwingInitializerRunnable implements Runnable { + + private final JoglSwingCanvas _joglSwingCanvas; + + private final DisplaySettings _settings; + + public JoglSwingInitializerRunnable(final JoglSwingCanvas joglSwingCanvas, final DisplaySettings settings) { + _joglSwingCanvas = joglSwingCanvas; + _settings = settings; + } + + @Override + public void run() { + // Make the window visible to realize the OpenGL surface. + _joglSwingCanvas.setVisible(true); + // Force the initialization of the backend used inside the GLJPanel + if (_joglSwingCanvas.getDelegatedDrawable() == null) { + // Do it on the current thread, return only when it's done + _joglSwingCanvas.initializeBackend(false); + } + // Check whether the backend has been successfully initialized + if (_joglSwingCanvas.getDelegatedDrawable() != null) { + // Force the realization + _joglSwingCanvas.display(); + if (_joglSwingCanvas.getDelegatedDrawable().isRealized()) { + // Request the focus here as it cannot work when the window is + // not visible + _joglSwingCanvas.requestFocus(); + // The OpenGL context has been created after the realization of + // the surface + _joglSwingCanvas.getCanvasRenderer().setContext(_joglSwingCanvas.getContext()); + // As the canvas renderer knows the OpenGL context, it can be + // initialized + _joglSwingCanvas.getCanvasRenderer().init(_settings, true); + } + } + } +}
\ No newline at end of file diff --git a/ardor3d-jogl-swt/.settings/org.eclipse.jdt.core.prefs b/ardor3d-jogl-swt/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..52f1f2e --- /dev/null +++ b/ardor3d-jogl-swt/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,15 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/ardor3d-jogl-swt/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-jogl-swt/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..9cac248 --- /dev/null +++ b/ardor3d-jogl-swt/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,113 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=true +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_serial_version_id=true +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=true +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=true +cleanup.format_source_code=true +cleanup.format_source_code_changes_only=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=true +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=false +cleanup.organize_imports=true +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=true +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=true +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup_profile=_ArdorLabs +cleanup_settings_version=2 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_ArdorLabs +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=ex +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=true +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=true +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=false +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/ardor3d-jogl-swt/build.gradle b/ardor3d-jogl-swt/build.gradle new file mode 100644 index 0000000..6917b34 --- /dev/null +++ b/ardor3d-jogl-swt/build.gradle @@ -0,0 +1,7 @@ + +description = 'Ardor 3D JOGL SWT' +dependencies { + compile project(':ardor3d-core') + compile project(':ardor3d-swt') + compile project(':ardor3d-jogl') +} diff --git a/ardor3d-jogl-swt/pom.xml b/ardor3d-jogl-swt/pom.xml new file mode 100644 index 0000000..3419bc3 --- /dev/null +++ b/ardor3d-jogl-swt/pom.xml @@ -0,0 +1,32 @@ +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.ardor3d</groupId> + <artifactId>ardor3d</artifactId> + <relativePath>../pom.xml</relativePath> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>ardor3d-jogl-swt</artifactId> + <packaging>bundle</packaging> + <name>Ardor 3D JOGL SWT</name> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ardor3d-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ardor3d-swt</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ardor3d-jogl</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + +</project> diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtSwtCanvas.java b/ardor3d-jogl-swt/src/main/java/com/ardor3d/framework/jogl/swt/JoglNewtSwtCanvas.java index 66436d3..e8813be 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtSwtCanvas.java +++ b/ardor3d-jogl-swt/src/main/java/com/ardor3d/framework/jogl/swt/JoglNewtSwtCanvas.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -8,18 +8,22 @@ * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ -package com.ardor3d.framework.jogl; +package com.ardor3d.framework.jogl.swt; import java.util.concurrent.CountDownLatch; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLRunnable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLRunnable; import org.eclipse.swt.widgets.Composite; import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.DisplaySettings; +import com.ardor3d.framework.jogl.CapsUtil; +import com.ardor3d.framework.jogl.JoglCanvasRenderer; +import com.ardor3d.framework.jogl.JoglDrawerRunnable; +import com.ardor3d.framework.jogl.NewtWindowContainer; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.newt.swt.NewtCanvasSWT; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtCanvas.java b/ardor3d-jogl-swt/src/main/java/com/ardor3d/framework/jogl/swt/JoglSwtCanvas.java index a659d49..666169f 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtCanvas.java +++ b/ardor3d-jogl-swt/src/main/java/com/ardor3d/framework/jogl/swt/JoglSwtCanvas.java @@ -8,12 +8,12 @@ * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ -package com.ardor3d.framework.jogl; +package com.ardor3d.framework.jogl.swt; import java.util.concurrent.CountDownLatch; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLRunnable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLRunnable; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -21,6 +21,9 @@ import org.eclipse.swt.widgets.Display; import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.DisplaySettings; +import com.ardor3d.framework.jogl.CapsUtil; +import com.ardor3d.framework.jogl.JoglCanvasRenderer; +import com.ardor3d.framework.jogl.JoglDrawerRunnable; import com.jogamp.opengl.swt.GLCanvas; /** diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtInitializerRunnable.java b/ardor3d-jogl-swt/src/main/java/com/ardor3d/framework/jogl/swt/JoglSwtInitializerRunnable.java index f580221..267cb13 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtInitializerRunnable.java +++ b/ardor3d-jogl-swt/src/main/java/com/ardor3d/framework/jogl/swt/JoglSwtInitializerRunnable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -8,7 +8,7 @@ * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ -package com.ardor3d.framework.jogl; +package com.ardor3d.framework.jogl.swt; import com.ardor3d.framework.DisplaySettings; diff --git a/ardor3d-jogl/.settings/org.eclipse.jdt.core.prefs b/ardor3d-jogl/.settings/org.eclipse.jdt.core.prefs index 16496e9..941c850 100644 --- a/ardor3d-jogl/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-jogl/.settings/org.eclipse.jdt.core.prefs @@ -89,12 +89,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-jogl/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-jogl/.settings/org.eclipse.jdt.ui.prefs index 2cb0f4c..9cac248 100644 --- a/ardor3d-jogl/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-jogl/.settings/org.eclipse.jdt.ui.prefs @@ -59,7 +59,7 @@ org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -82,7 +82,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false diff --git a/ardor3d-jogl/build.gradle b/ardor3d-jogl/build.gradle new file mode 100644 index 0000000..03feb22 --- /dev/null +++ b/ardor3d-jogl/build.gradle @@ -0,0 +1,7 @@ + +description = 'Ardor 3D JOGL' +dependencies { + compile project(':ardor3d-core') + compile group: 'org.jogamp.gluegen', name: 'gluegen-rt-main', version:'2.3.2' + compile group: 'org.jogamp.jogl', name: 'jogl-all-main', version:'2.3.2' +} diff --git a/ardor3d-jogl/pom.xml b/ardor3d-jogl/pom.xml index f0d90cc..93bbe7b 100644 --- a/ardor3d-jogl/pom.xml +++ b/ardor3d-jogl/pom.xml @@ -17,11 +17,6 @@ <id>jogamp</id> <url>http://jogamp.org/deployment/maven</url> </repository> - <!-- The current version of swt isn't on central yet. --> - <repository> - <id>swt-repo</id> - <url>https://swt-repo.googlecode.com/svn/repo/</url> - </repository> </repositories> <dependencies> @@ -46,117 +41,6 @@ <groupId>org.jogamp.jocl</groupId> <artifactId>jocl-main</artifactId> </dependency--> - <dependency> - <groupId>org.eclipse.swt</groupId> - <artifactId>${swt.artifactId}</artifactId> - <version>${swt.version}</version> - </dependency> </dependencies> - - <profiles> - <profile> - <id>linux-x86</id> - <activation> - <os> - <arch>i386</arch> - <name>linux</name> - </os> - </activation> - <properties> - <swt.artifactId>org.eclipse.swt.gtk.linux.x86</swt.artifactId> - </properties> - </profile> - - <profile> - <id>linux-x86_64</id> - <activation> - <os> - <arch>amd64</arch> - <name>Linux</name> - </os> - </activation> - <properties> - <swt.artifactId>org.eclipse.swt.gtk.linux.x86_64</swt.artifactId> - </properties> - </profile> - - <profile> - <id>solaris-sparc</id> - <activation> - <os> - <arch>sparc</arch> - <name>SunOS</name> - </os> - </activation> - <properties> - <swt.artifactId>org.eclipse.swt.gtk.solaris.sparc</swt.artifactId> - </properties> - </profile> - - <profile> - <id>solaris-x86</id> - <activation> - <os> - <arch>x86</arch> - <name>SunOS</name> - </os> - </activation> - <properties> - <swt.artifactId>org.eclipse.swt.gtk.solaris.x86</swt.artifactId> - </properties> - </profile> - - <profile> - <id>macosx-cocoa-64</id> - <activation> - <os> - <arch>x86_64</arch> - <family>mac</family> - </os> - </activation> - <properties> - <swt.artifactId>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId> - </properties> - </profile> - - <profile> - <id>macosx-cocoa</id> - <activation> - <os> - <arch>x86</arch> - <family>mac</family> - </os> - </activation> - <properties> - <swt.artifactId>org.eclipse.swt.cocoa.macosx</swt.artifactId> - </properties> - </profile> - - <profile> - <id>win32</id> - <activation> - <os> - <arch>x86</arch> - <family>windows</family> - </os> - </activation> - <properties> - <swt.artifactId>org.eclipse.swt.win32.win32.x86</swt.artifactId> - </properties> - </profile> - - <profile> - <id>win64</id> - <activation> - <os> - <arch>amd64</arch> - <family>windows</family> - </os> - </activation> - <properties> - <swt.artifactId>org.eclipse.swt.win32.win32.x86_64</swt.artifactId> - </properties> - </profile> - </profiles> </project> diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/CapsUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/CapsUtil.java index 5a5fb95..93bd55c 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/CapsUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/CapsUtil.java @@ -1,23 +1,31 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.framework.jogl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; - +import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.util.Ardor3dException; +import com.jogamp.newt.MonitorMode; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; public class CapsUtil { + static { + // The GLSL mode of GLJPanel used in JoglSwingCanvas seems to cause a lot of troubles when using our own GLSL + // shaders and with the wireframe state. Therefore, it is disabled as early as possible + System.setProperty("jogl.gljpanel.noglsl", "true"); + } + public GLProfile getProfile() { // tries to get the most capable profile, programmable or fixed, desktop or embedded, forward or backward // compatible @@ -27,6 +35,13 @@ public class CapsUtil { if (isForwardCompatible) { // Ardor3D doesn't support forward compatible yet profile = GLProfile.getMaxFixedFunc(true); + } else { + final boolean isES2orES3 = profile.isGLES2() || profile.isGLES3(); + // Ardor3D doesn't fully support ES 2.0 and later yet, favors ES 1 if possible + // FIXME remove this kludge when Ardor3D gets some VAO support + if (isES2orES3 && GLProfile.isAvailable(GLProfile.GLES1)) { + profile = GLProfile.get(GLProfile.GLES1); + } } return profile; } @@ -35,6 +50,29 @@ public class CapsUtil { return getCapsForSettings(settings, true, false, false, false); } + /** + * for internal use only, tolerates artificial display settings containing hints + * + * @param settings + * @param onscreen + * @param bitmapRequested + * @param pbufferRequested + * @param fboRequested + * @return + */ + GLCapabilities getCapsForSettingsWithHints(final DisplaySettings settings, final boolean onscreen, + final boolean bitmapRequested, final boolean pbufferRequested, final boolean fboRequested) { + final DisplaySettings realSettings; + if (settings.isFullScreen() && (settings.getWidth() == 0 || settings.getHeight() == 0)) { + realSettings = new DisplaySettings(1, 1, settings.getColorDepth(), settings.getFrequency(), + settings.getAlphaBits(), settings.getDepthBits(), settings.getStencilBits(), settings.getSamples(), + true, settings.isStereo(), settings.getShareContext(), settings.getRotation()); + } else { + realSettings = settings; + } + return getCapsForSettings(realSettings, onscreen, bitmapRequested, pbufferRequested, fboRequested); + } + public GLCapabilities getCapsForSettings(final DisplaySettings settings, final boolean onscreen, final boolean bitmapRequested, final boolean pbufferRequested, final boolean fboRequested) { @@ -45,10 +83,16 @@ public class CapsUtil { // Validate bit depth. if ((settings.getColorDepth() != 32) && (settings.getColorDepth() != 16) && (settings.getColorDepth() != 24) - && (settings.getColorDepth() != -1)) { + && (settings.getColorDepth() != 0) && (settings.getColorDepth() != -1)) { throw new Ardor3dException("Invalid pixel depth: " + settings.getColorDepth()); } + // Validate rotation + if (settings.getRotation() != MonitorMode.ROTATE_0 && settings.getRotation() != MonitorMode.ROTATE_90 + && settings.getRotation() != MonitorMode.ROTATE_180 && settings.getRotation() != MonitorMode.ROTATE_270) { + throw new Ardor3dException("Invalid rotation: " + settings.getRotation()); + } + final GLCapabilities caps = new GLCapabilities(getProfile()); caps.setHardwareAccelerated(true); caps.setDoubleBuffered(true); @@ -80,4 +124,12 @@ public class CapsUtil { return caps; } + public DisplaySettings getSettingsForCaps(final GLCapabilitiesImmutable glCaps, final int width, final int height, + final int frequency, final boolean fullscreen, final CanvasRenderer shareContext, final int rotation) { + final int colorDepth = glCaps.getRedBits() + glCaps.getGreenBits() + glCaps.getBlueBits(); + final DisplaySettings settings = new DisplaySettings(width, height, colorDepth, frequency, + glCaps.getAlphaBits(), glCaps.getDepthBits(), glCaps.getStencilBits(), glCaps.getNumSamples(), + fullscreen, glCaps.getStereo(), shareContext, rotation); + return settings; + } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java index a86e3bc..ca92de2 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,18 +12,6 @@ package com.ardor3d.framework.jogl; import java.util.logging.Logger; -import javax.media.opengl.DebugGL2; -import javax.media.opengl.DebugGL3; -import javax.media.opengl.DebugGL3bc; -import javax.media.opengl.DebugGL4; -import javax.media.opengl.DebugGL4bc; -import javax.media.opengl.DebugGLES1; -import javax.media.opengl.DebugGLES2; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; - import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.framework.DisplaySettings; @@ -41,6 +29,11 @@ import com.ardor3d.renderer.jogl.JoglRenderContext; import com.ardor3d.renderer.jogl.JoglRenderer; import com.ardor3d.util.Ardor3dException; import com.ardor3d.util.geom.jogl.DirectNioBuffersSet; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLPipelineFactory; public class JoglCanvasRenderer implements CanvasRenderer { @@ -65,42 +58,75 @@ public class JoglCanvasRenderer implements CanvasRenderer { */ private boolean _debugEnabled = false; + /** + * <code>true</code> if we try to drop and reclaim the context on each frame. + */ + private final boolean _contextDropAndReclaimOnDrawEnabled; + protected CapsUtil _capsUtil; protected DirectNioBuffersSet _directNioBuffersSet; + /** + * Default constructor, with debug disabled, using the default utility for the capabilities and with context drop + * and reclaim on draw disabled + * + * @param scene + * data related to the scene (cannot be null) + */ public JoglCanvasRenderer(final Scene scene) { - this(scene, false, new CapsUtil()); + this(scene, false, new CapsUtil(), false); } - public JoglCanvasRenderer(final Scene scene, final boolean useDebug, final CapsUtil capsUtil) { + /** + * Main constructor + * + * @param scene + * data related to the scene + * @param useDebug + * <code>true</code> if debugging is currently enabled for this GLContext + * @param capsUtil + * utility to manage the capabilities (cannot be null) + * @param contextDropAndReclaimOnDrawEnabled + * <code>true</code> if we try to drop and reclaim the context on each frame. It should be set to + * <code>false</code> for better performance in the general case. It should be set to <code>true</code> + * if and only if the OpenGL context is made current on a thread which is not the default rendering + * thread of the canvas. + */ + public JoglCanvasRenderer(final Scene scene, final boolean useDebug, final CapsUtil capsUtil, + final boolean contextDropAndReclaimOnDrawEnabled) { _scene = scene; _useDebug = useDebug; _capsUtil = capsUtil; + _contextDropAndReclaimOnDrawEnabled = contextDropAndReclaimOnDrawEnabled; } @Override public void makeCurrentContext() throws Ardor3dException { int value = GLContext.CONTEXT_NOT_CURRENT; - int attempt = 0; - do { + for (int attempt = 0;;) { try { value = _context.makeCurrent(); } catch (final GLException gle) { gle.printStackTrace(); } finally { attempt++; + } + if (value == GLContext.CONTEXT_NOT_CURRENT) { if (attempt == MAX_CONTEXT_GRAB_ATTEMPTS) { // failed, throw exception throw new Ardor3dException("Failed to claim OpenGL context."); + } else { + try { + Thread.sleep(5); + } catch (final InterruptedException e1) { + e1.printStackTrace(); + } } + } else { + break; } - try { - Thread.sleep(5); - } catch (final InterruptedException e1) { - e1.printStackTrace(); - } - } while (value == GLContext.CONTEXT_NOT_CURRENT); + } if (ContextManager.getCurrentContext() != null) { if (value == GLContext.CONTEXT_CURRENT_NEW) { ContextManager.getCurrentContext().contextLost(); @@ -177,9 +203,9 @@ public class JoglCanvasRenderer implements CanvasRenderer { if (_camera == null) { /** Set up how our camera sees. */ - _camera = new Camera(settings.getWidth(), settings.getHeight()); - _camera.setFrustumPerspective(45.0f, (float) settings.getWidth() / (float) settings.getHeight(), 1, - 1000); + _camera = new Camera(settings.getRotatedWidth(), settings.getRotatedHeight()); + _camera.setFrustumPerspective(45.0f, + (float) settings.getRotatedWidth() / (float) settings.getRotatedHeight(), 1, 1000); _camera.setProjectionMode(ProjectionMode.Perspective); final Vector3 loc = new Vector3(0.0f, 0.0f, 10.0f); @@ -191,8 +217,8 @@ public class JoglCanvasRenderer implements CanvasRenderer { } else { // use new width and height to set ratio. _camera.setFrustumPerspective(_camera.getFovY(), - (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), - _camera.getFrustumFar()); + (float) settings.getRotatedWidth() / (float) settings.getRotatedHeight(), + _camera.getFrustumNear(), _camera.getFrustumFar()); } } finally { releaseCurrentContext(); @@ -214,41 +240,13 @@ public class JoglCanvasRenderer implements CanvasRenderer { public boolean draw() { // set up context for rendering this canvas - makeCurrentContext(); + if (_contextDropAndReclaimOnDrawEnabled) { + makeCurrentContext(); + } // Enable Debugging if requested. if (_useDebug != _debugEnabled) { - if (_context.getGL().isGLES()) { - if (_context.getGL().isGLES1()) { - _context.setGL(new DebugGLES1(_context.getGL().getGLES1())); - } else { - if (_context.getGL().isGLES2()) { - _context.setGL(new DebugGLES2(_context.getGL().getGLES2())); - } else { - // TODO ES3 - } - } - } else { - if (_context.getGL().isGL4bc()) { - _context.setGL(new DebugGL4bc(_context.getGL().getGL4bc())); - } else { - if (_context.getGL().isGL4()) { - _context.setGL(new DebugGL4(_context.getGL().getGL4())); - } else { - if (_context.getGL().isGL3bc()) { - _context.setGL(new DebugGL3bc(_context.getGL().getGL3bc())); - } else { - if (_context.getGL().isGL3()) { - _context.setGL(new DebugGL3(_context.getGL().getGL3())); - } else { - if (_context.getGL().isGL2()) { - _context.setGL(new DebugGL2(_context.getGL().getGL2())); - } - } - } - } - } - } + _context.setGL(GLPipelineFactory.create("javax.media.opengl.Debug", null, _context.getGL(), null)); _debugEnabled = true; LOGGER.info("DebugGL Enabled"); @@ -268,7 +266,9 @@ public class JoglCanvasRenderer implements CanvasRenderer { // release the context if we're done (swapped and all) if (_doSwap) { - releaseCurrentContext(); + if (_contextDropAndReclaimOnDrawEnabled) { + releaseCurrentContext(); + } } return drew; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglDrawerRunnable.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglDrawerRunnable.java index a3c00e8..d6a5544 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglDrawerRunnable.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglDrawerRunnable.java @@ -1,7 +1,7 @@ package com.ardor3d.framework.jogl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLRunnable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLRunnable; public class JoglDrawerRunnable implements GLRunnable { diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java index 938a53e..e72f593 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,18 +10,18 @@ package com.ardor3d.framework.jogl; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.concurrent.CountDownLatch; -import javax.media.nativewindow.util.Dimension; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLRunnable; - import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.NativeCanvas; import com.ardor3d.image.Image; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.MonitorMode; import com.jogamp.newt.event.KeyListener; @@ -31,6 +31,10 @@ import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.event.WindowListener; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.newt.util.MonitorModeUtil; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLRunnable; /** * Ardor3D NEWT lightweight window, NEWT "top level" component for the OpenGL rendering of Ardor3D with JOGL that @@ -42,13 +46,18 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer { private final JoglCanvasRenderer _canvasRenderer; private boolean _inited = false; private boolean _isClosing = false; - - private final DisplaySettings _settings; + /** chosen display settings. Note that they may differ from the requested display settings */ + private DisplaySettings _settings; private final JoglDrawerRunnable _drawerGLRunnable; private final GLWindow _newtWindow; + /** list of monitor devices used in fullscreen mode, ignored in windowed mode */ + private List<MonitorDevice> _monitorDevices; + + private final CapsUtil _capsUtil; + public JoglNewtWindow(final JoglCanvasRenderer canvasRenderer, final DisplaySettings settings) { this(canvasRenderer, settings, true, false, false, false); } @@ -62,38 +71,114 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer { public JoglNewtWindow(final JoglCanvasRenderer canvasRenderer, final DisplaySettings settings, final boolean onscreen, final boolean bitmapRequested, final boolean pbufferRequested, final boolean fboRequested, final CapsUtil capsUtil) { - _newtWindow = GLWindow.create(capsUtil.getCapsForSettings(settings, onscreen, bitmapRequested, + _capsUtil = capsUtil; + // FIXME rather pass the monitor(s) to the constructor, create a screen to get the primary monitor + _newtWindow = GLWindow.create(capsUtil.getCapsForSettingsWithHints(settings, onscreen, bitmapRequested, pbufferRequested, fboRequested)); + _monitorDevices = new ArrayList<>(); + // uses the primary monitor by default + _newtWindow.getScreen().createNative(); + final MonitorDevice primaryMonitor = _newtWindow.getScreen().getPrimaryMonitor(); + _monitorDevices.add(primaryMonitor); + // disables HiDPI, see https://github.com/gouessej/Ardor3D/issues/14 + _newtWindow.setSurfaceScale(new float[] { ScalableSurface.IDENTITY_PIXELSCALE, + ScalableSurface.IDENTITY_PIXELSCALE }); _drawerGLRunnable = new JoglDrawerRunnable(canvasRenderer); - _settings = settings; + final int width, height; + if (settings.isFullScreen() && settings.getWidth() == 0 || settings.getHeight() == 0) { + // FIXME use all available monitor devices to compute the size + final DimensionImmutable currentResolution = primaryMonitor.queryCurrentMode().getSurfaceSize() + .getResolution(); + width = currentResolution.getWidth(); + height = currentResolution.getHeight(); + } else { + width = settings.getWidth(); + height = settings.getHeight(); + } + _settings = new DisplaySettings(width, height, settings.getColorDepth(), settings.getFrequency(), + settings.getAlphaBits(), settings.getDepthBits(), settings.getStencilBits(), settings.getSamples(), + settings.isFullScreen(), settings.isStereo(), settings.getShareContext(), settings.getRotation()); _canvasRenderer = canvasRenderer; - setAutoSwapBufferMode(false); + _canvasRenderer._doSwap = true;// true - do swap in renderer. + setAutoSwapBufferMode(false);// false - doesn't swap automatically in JOGL itself } /** * Applies all settings not related to OpenGL (screen resolution, screen size, etc...) * */ - private void applySettings() { + protected void applySettings() { _newtWindow.setUndecorated(_settings.isFullScreen()); - _newtWindow.setFullscreen(_settings.isFullScreen()); - // FIXME Ardor3D does not allow to change the resolution - /** - * uses the filtering relying on resolution with the size to fetch only the screen mode matching with the - * current resolution - */ if (_settings.isFullScreen()) { - final MonitorDevice monitor = _newtWindow.getMainMonitor(); - List<MonitorMode> monitorModes = monitor.getSupportedModes(); - // the resolution is provided by the user - final Dimension dimension = new Dimension(_settings.getWidth(), _settings.getHeight()); - monitorModes = MonitorModeUtil.filterByResolution(monitorModes, dimension); - monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes); - if (_settings.getFrequency() > 0) { - monitorModes = MonitorModeUtil.filterByRate(monitorModes, _settings.getFrequency()); - } else { - monitorModes = MonitorModeUtil.getHighestAvailableRate(monitorModes); + _newtWindow.setFullscreen(_monitorDevices); + for (final MonitorDevice monitorDevice : _monitorDevices) { + List<MonitorMode> monitorModes = monitorDevice.getSupportedModes(); + final MonitorMode currentMode = monitorDevice.getCurrentMode(); + if (monitorDevice == _monitorDevices.get(0)) { + final Dimension dimension; + // the resolution is taken into account only if it is valid + if (_settings.getWidth() > 0 && _settings.getHeight() > 0) { + dimension = new Dimension(_settings.getWidth(), _settings.getHeight()); + } else { + final DimensionImmutable currentResolution = currentMode.getSurfaceSize().getResolution(); + dimension = new Dimension(currentResolution.getWidth(), currentResolution.getHeight()); + } + monitorModes = MonitorModeUtil.filterByResolution(monitorModes, dimension); + } else { + // FIXME the display settings should store the size of the other monitors + } + // if the frequency may be valid (greater than zero), it tries to use it + final List<MonitorMode> byRateMonitorModes; + if (_settings.getFrequency() > 0) { + byRateMonitorModes = MonitorModeUtil.filterByRate(monitorModes, _settings.getFrequency()); + } else { + // if the frequency is set to zero, it tries to preserve the refresh rate + if (_settings.getFrequency() == 0) { + byRateMonitorModes = MonitorModeUtil.filterByRate(monitorModes, currentMode.getRefreshRate()); + } else { + // otherwise it picks the highest available rate + byRateMonitorModes = MonitorModeUtil.getHighestAvailableRate(monitorModes); + } + } + if (!byRateMonitorModes.isEmpty()) { + monitorModes = byRateMonitorModes; + } + final List<MonitorMode> byBppMonitorModes; + switch (_settings.getColorDepth()) { + case 16: + case 24: + case 32: { + byBppMonitorModes = MonitorModeUtil.filterByBpp(monitorModes, _settings.getColorDepth()); + break; + } + case 0: { + byBppMonitorModes = MonitorModeUtil.filterByBpp(monitorModes, currentMode.getSurfaceSize() + .getBitsPerPixel()); + break; + } + case -1: { + byBppMonitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes); + break; + } + default: { + byBppMonitorModes = monitorModes; + } + } + if (!byBppMonitorModes.isEmpty()) { + monitorModes = byBppMonitorModes; + } + if (_settings.getRotation() == MonitorMode.ROTATE_0 || _settings.getRotation() == MonitorMode.ROTATE_90 + || _settings.getRotation() == MonitorMode.ROTATE_180 + || _settings.getRotation() == MonitorMode.ROTATE_270) { + final List<MonitorMode> rotatedMonitorModes = MonitorModeUtil.filterByRotation(monitorModes, + _settings.getRotation()); + if (!rotatedMonitorModes.isEmpty()) { + monitorModes = rotatedMonitorModes; + } + } + monitorDevice.setCurrentMode(monitorModes.get(0)); } - monitor.setCurrentMode(monitorModes.get(0)); + } else { + _newtWindow.setFullscreen(false); } } @@ -113,14 +198,79 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer { return _newtWindow.getContext(); } + /** + * Returns the width of the client area including insets (window decorations) in window units. + * + * @return width of the client area including insets (window decorations) in window units + */ public int getWidth() { + return _newtWindow.getWidth() + (_newtWindow.getInsets() == null ? 0 : _newtWindow.getInsets().getTotalWidth()); + } + + /** + * Returns the width of the client area including insets (window decorations) in pixel units. + * + * @return width of the client area including insets (window decorations) in pixel units + */ + public int getWidthInPixelUnits() { + return _newtWindow.convertToPixelUnits(new int[] { getWidth(), 0 })[0]; + } + + /** + * Returns the width of the client area excluding insets (window decorations) in window units. + * + * @return width of the client area excluding insets (window decorations) in window units + */ + public int getSurfaceWidthInWindowUnits() { return _newtWindow.getWidth(); } + /** + * Returns the width of the client area excluding insets (window decorations) in pixel units. + * + * @return width of the client area excluding insets (window decorations) in pixel units + */ + public int getSurfaceWidth() { + return _newtWindow.getSurfaceWidth(); + } + + /** + * Returns the height of the client area including insets (window decorations) in window units. + * + * @return height of the client area including insets (window decorations) in window units + */ public int getHeight() { + return _newtWindow.getHeight() + + (_newtWindow.getInsets() == null ? 0 : _newtWindow.getInsets().getTotalHeight()); + } + + /** + * Returns the height of the client area including insets (window decorations) in pixel units. + * + * @return height of the client area including insets (window decorations) in pixel units + */ + public int getHeightInPixelUnits() { + return _newtWindow.convertToPixelUnits(new int[] { 0, getHeight() })[1]; + } + + /** + * Returns the height of the client area excluding insets (window decorations) in window units. + * + * @return height of the client area excluding insets (window decorations) in window units + */ + public int getSurfaceHeightInWindowUnits() { return _newtWindow.getHeight(); } + /** + * Returns the height of the client area excluding insets (window decorations) in pixel units. + * + * @return height of the client area excluding insets (window decorations) in pixel units + */ + public int getSurfaceHeight() { + return _newtWindow.getSurfaceHeight(); + } + public int getX() { return _newtWindow.getX(); } @@ -141,6 +291,11 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer { _newtWindow.setVisible(visible); } + /** + * Enables or disables automatic buffer swapping for this JoglNewtWindow. By default this property is set to false + * + * @param autoSwapBufferModeEnabled + */ public void setAutoSwapBufferMode(final boolean autoSwapBufferModeEnabled) { _newtWindow.setAutoSwapBufferMode(autoSwapBufferModeEnabled); } @@ -157,6 +312,10 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer { // Make the window visible to realize the OpenGL surface. setVisible(true); if (_newtWindow.isRealized()) { + final GLCapabilitiesImmutable glCaps = _newtWindow.getChosenGLCapabilities(); + _settings = _capsUtil.getSettingsForCaps(glCaps, _settings.getWidth(), _settings.getHeight(), + _settings.getFrequency(), _settings.isFullScreen(), _settings.getShareContext(), + _settings.getRotation()); _newtWindow.addWindowListener(new WindowAdapter() { @Override public void windowDestroyNotify(final WindowEvent e) { @@ -188,7 +347,7 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer { _newtWindow.invoke(true, new GLRunnable() { @Override public boolean run(final GLAutoDrawable glAutoDrawable) { - _canvasRenderer.init(_settings, true);// true - do swap in renderer. + _canvasRenderer.init(_settings, _canvasRenderer._doSwap); return true; } }); @@ -254,9 +413,69 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer { @Override public void moveWindowTo(final int locX, final int locY) { - _newtWindow.setPosition(locX, locY); + _newtWindow.setTopLevelPosition(locX, locY); + } + + public boolean isResizable() { + return _newtWindow.isResizable(); + } + + public void setResizable(final boolean resizable) { + _newtWindow.setResizable(resizable); + } + + public boolean isDecorated() { + return !_newtWindow.isUndecorated(); + } + + public void setDecorated(final boolean decorated) { + _newtWindow.setUndecorated(!decorated); + } + + public boolean isSticky() { + return _newtWindow.isSticky(); + } + + public void setSticky(final boolean sticky) { + _newtWindow.setSticky(sticky); + } + + public boolean isAlwaysOnTop() { + return _newtWindow.isAlwaysOnTop(); + } + + public void setAlwaysOnTop(final boolean alwaysOnTop) { + _newtWindow.setAlwaysOnTop(alwaysOnTop); + } + + public boolean isAlwaysOnBottom() { + return _newtWindow.isAlwaysOnBottom(); + } + + public void setAlwaysOnBottom(final boolean alwaysOnBottom) { + _newtWindow.setAlwaysOnBottom(alwaysOnBottom); } + /** + * Returns a list of monitor devices used in fullscreen mode, ignored in windowed mode + * + * @return list of monitor devices used in fullscreen mode, ignored in windowed mode + */ + public List<MonitorDevice> getMonitorDevices() { + return Collections.unmodifiableList(_monitorDevices); + } + + public void setMonitorDevices(final List<MonitorDevice> monitorDevices) { + if (_monitorDevices == null || _monitorDevices.isEmpty()) { + throw new IllegalArgumentException("The list of monitor devices cannot be null or empty"); + } + + _monitorDevices = monitorDevices; + // FIXME recompute the width and the height of the settings, apply the settings anew + } + + // TODO return all available monitor modes + @Override public GLWindow getNewtWindow() { return _newtWindow; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/NewtWindowContainer.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/NewtWindowContainer.java index 5470a36..09e2058 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/NewtWindowContainer.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/NewtWindowContainer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageLoader.java b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageLoader.java index 15164a9..42af78a 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageLoader.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageLoader.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -20,6 +20,8 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.LongBuffer; import java.nio.ShortBuffer; +import java.util.ArrayList; +import java.util.List; import com.ardor3d.framework.jogl.CapsUtil; import com.ardor3d.image.Image; @@ -29,6 +31,7 @@ import com.ardor3d.image.util.ImageLoaderUtil; import com.ardor3d.scene.state.jogl.util.JoglTextureUtil; import com.ardor3d.util.geom.BufferUtils; import com.jogamp.common.nio.Buffers; +import com.jogamp.common.os.Platform; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; @@ -38,6 +41,11 @@ public class JoglImageLoader implements ImageLoader { protected final CapsUtil _capsUtil; + /** + * Flag indicating whether the mipmaps are produced by JOGL (retrieved from the file or generated) + */ + private boolean _mipmapsProductionEnabled; + private enum TYPE { BYTE(ByteBuffer.class), SHORT(ShortBuffer.class), CHAR(CharBuffer.class), INT(IntBuffer.class), FLOAT( FloatBuffer.class), LONG(LongBuffer.class), DOUBLE(DoubleBuffer.class); @@ -49,10 +57,20 @@ public class JoglImageLoader implements ImageLoader { } }; - private static final String[] _supportedFormats = new String[] { "." + TextureIO.DDS.toUpperCase(), - "." + TextureIO.GIF.toUpperCase(), "." + TextureIO.JPG.toUpperCase(), "." + TextureIO.PAM.toUpperCase(), - "." + TextureIO.PNG.toUpperCase(), "." + TextureIO.PPM.toUpperCase(), "." + TextureIO.SGI.toUpperCase(), - "." + TextureIO.TGA.toUpperCase(), "." + TextureIO.TIFF.toUpperCase() }; + private static final String[] _supportedFormats = computeSupportedFormats(); + + private static final String[] computeSupportedFormats() { + final List<String> supportedFormatsList = new ArrayList<>(); + if (Platform.AWT_AVAILABLE) { + supportedFormatsList.add("." + TextureIO.GIF.toUpperCase()); + } + supportedFormatsList.add("." + TextureIO.DDS.toUpperCase()); + supportedFormatsList.add("." + TextureIO.JPG.toUpperCase()); + supportedFormatsList.add("." + TextureIO.PNG.toUpperCase()); + supportedFormatsList.add("." + TextureIO.SGI.toUpperCase()); + supportedFormatsList.add("." + TextureIO.SGI_RGB.toUpperCase()); + return supportedFormatsList.toArray(new String[supportedFormatsList.size()]); + } public static String[] getSupportedFormats() { return _supportedFormats; @@ -60,6 +78,7 @@ public class JoglImageLoader implements ImageLoader { public static void registerLoader() { registerLoader(new JoglImageLoader(), _supportedFormats); + registerLoader(new JoglTgaImageLoader(), JoglTgaImageLoader.getSupportedFormats()); } public static void registerLoader(final JoglImageLoader joglImageLoader, final String[] supportedFormats) { @@ -74,17 +93,17 @@ public class JoglImageLoader implements ImageLoader { _capsUtil = capsUtil; } - public Image makeArdor3dImage(final TextureData textureData, final boolean flipped) { + public Image makeArdor3dImage(final TextureData textureData, final boolean verticalFlipNeeded) { final Buffer textureDataBuffer = textureData.getBuffer(); final Image ardorImage = new Image(); - final TYPE bufferDataType = getBufferDataType(textureDataBuffer); + TYPE bufferDataType = getBufferDataType(textureDataBuffer); if (bufferDataType == null) { throw new UnsupportedOperationException("Unknown buffer type " + textureDataBuffer.getClass().getName()); } else { - final int dataSizeInBytes = textureDataBuffer.capacity() * Buffers.sizeOfBufferElem(textureDataBuffer); - final ByteBuffer scratch = createOnHeap ? BufferUtils.createByteBufferOnHeap(dataSizeInBytes) : Buffers + int dataSizeInBytes = textureDataBuffer.capacity() * Buffers.sizeOfBufferElem(textureDataBuffer); + ByteBuffer scratch = createOnHeap ? BufferUtils.createByteBufferOnHeap(dataSizeInBytes) : Buffers .newDirectByteBuffer(dataSizeInBytes); - if (flipped) { + if (verticalFlipNeeded) { flipImageData(textureDataBuffer, scratch, dataSizeInBytes, bufferDataType, textureData.getWidth(), textureData.getHeight()); } else { @@ -94,19 +113,45 @@ public class JoglImageLoader implements ImageLoader { ardorImage.setHeight(textureData.getHeight()); ardorImage.setData(scratch); ardorImage.setDataFormat(JoglTextureUtil.getImageDataFormat(textureData.getPixelFormat())); - // ardorImage.setDataType(JoglTextureUtil.getPixelDataType(textureData.getPixelType())); + /** + * A ByteBuffer is always used to store the image data, otherwise we should call + * JoglTextureUtil.getPixelDataType(textureData.getPixelType()) + */ ardorImage.setDataType(PixelDataType.UnsignedByte); + if (textureData.getMipmapData() != null) { + for (final Buffer mipmapData : textureData.getMipmapData()) { + dataSizeInBytes = mipmapData.capacity() * Buffers.sizeOfBufferElem(mipmapData); + scratch = createOnHeap ? BufferUtils.createByteBufferOnHeap(dataSizeInBytes) : Buffers + .newDirectByteBuffer(dataSizeInBytes); + bufferDataType = getBufferDataType(mipmapData); + if (verticalFlipNeeded) { + flipImageData(mipmapData, scratch, dataSizeInBytes, bufferDataType, textureData.getWidth(), + textureData.getHeight()); + } else { + copyImageData(mipmapData, scratch, bufferDataType); + } + ardorImage.addData(scratch); + } + final int[] mipMapSizes = new int[ardorImage.getDataSize()]; + int imageDataIndex = 0; + for (final Buffer imageData : ardorImage.getData()) { + mipMapSizes[imageDataIndex] = imageData.capacity(); + imageDataIndex++; + } + ardorImage.setMipMapByteSizes(mipMapSizes); + } return ardorImage; } } @Override - public Image load(final InputStream is, final boolean flipped) throws IOException { - final TextureData textureData = TextureIO.newTextureData(_capsUtil.getProfile(), is, true, null); + public Image load(final InputStream is, final boolean verticalFlipNeeded) throws IOException { + final TextureData textureData = TextureIO.newTextureData(_capsUtil.getProfile(), is, _mipmapsProductionEnabled, + null /* JOGL >= 2.3.2 is able to guess the file suffix */); if (textureData == null) { return null; } - return makeArdor3dImage(textureData, flipped); + return makeArdor3dImage(textureData, textureData.getMustFlipVertically() == verticalFlipNeeded); } private TYPE getBufferDataType(final Buffer buffer) { @@ -196,7 +241,7 @@ public class JoglImageLoader implements ImageLoader { final int srcFirstPixelIndex = dest.position() / bytesPerPixel; final int srcFirstPixelComponentOffset = dest.position() - (srcFirstPixelIndex * bytesPerPixel); final int srcFirstColumnIndex = srcFirstPixelIndex % width; - final int scrFirstRowIndex = (srcFirstPixelIndex - srcFirstColumnIndex) / height; + final int scrFirstRowIndex = (srcFirstPixelIndex - srcFirstColumnIndex) / width; final int dstFirstColumnIndex = srcFirstColumnIndex; final int dstFirstRowIndex = (height - 1) - scrFirstRowIndex; final int dstFirstPixelIndex = dstFirstRowIndex * width + dstFirstColumnIndex; @@ -251,4 +296,12 @@ public class JoglImageLoader implements ImageLoader { src.position(srcPos); dest.position(destPos); } + + public boolean isMipmapsProductionEnabled() { + return _mipmapsProductionEnabled; + } + + public void setMipmapsProductionEnabled(final boolean mipmapsProductionEnabled) { + _mipmapsProductionEnabled = mipmapsProductionEnabled; + } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageUtil.java index 0e9a2de..f964d59 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageUtil.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -11,15 +11,14 @@ package com.ardor3d.image.util.jogl; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.util.PixelFormat; - import com.ardor3d.framework.jogl.CapsUtil; import com.ardor3d.image.Image; import com.ardor3d.scene.state.jogl.util.JoglTextureUtil; -import com.google.common.collect.Lists; import com.jogamp.common.nio.Buffers; +import com.jogamp.nativewindow.util.PixelFormat; import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; import com.jogamp.opengl.util.texture.TextureData; @@ -31,7 +30,7 @@ public class JoglImageUtil { /** * Convert the given Ardor3D Image to a List of TextureData instances. It is a List because Ardor3D Images may * contain multiple layers (for example, in the case of cube maps or 3D textures). - * + * * @param input * the Ardor3D Image to convert * @return the TextureData instance(s) created in the conversion @@ -43,7 +42,7 @@ public class JoglImageUtil { /** * Convert the given Ardor3D Image to a List of TextureData instances. It is a List because Ardor3D Images may * contain multiple layers (for example, in the case of cube maps or 3D textures). - * + * * @param capsUtil * @param input * the Ardor3D Image to convert @@ -57,7 +56,7 @@ public class JoglImageUtil { final int width = input.getWidth(), height = input.getHeight(); // create our return list - final List<TextureData> rVal = Lists.newArrayList(); + final List<TextureData> rVal = new ArrayList<>(); // go through each layer for (int i = 0; i < size; i++) { @@ -88,7 +87,7 @@ public class JoglImageUtil { default: pixelFormat = null; } - final GLPixelAttributes pixelAtt = GLPixelAttributes.convert(pixelFormat, capsUtil.getProfile()); + final GLPixelAttributes pixelAtt = GLPixelAttributes.convert(capsUtil.getProfile(), pixelFormat, false); // pixel data type = internal format? final TextureData image = new TextureData(capsUtil.getProfile(), pixDataType, width, height, border, pixelAtt, false, false, false, dest, null); diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglTgaImageLoader.java b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglTgaImageLoader.java new file mode 100644 index 0000000..84ae044 --- /dev/null +++ b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglTgaImageLoader.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2008-2014 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.image.util.jogl; + +import java.io.IOException; +import java.io.InputStream; + +import com.ardor3d.image.Image; +import com.ardor3d.image.util.ImageLoaderUtil; +import com.jogamp.opengl.util.texture.TextureData; +import com.jogamp.opengl.util.texture.TextureIO; + +/** + * Ardor3D loader using the build-in JOGL TGA loader. As this format has no magic number, it cannot use the detection + * mechanism implemented in JoglImageLoader + */ +public class JoglTgaImageLoader extends JoglImageLoader { + + private static final String[] _supportedFormats = new String[] { "." + TextureIO.TGA.toUpperCase() }; + + @Override + public Image load(final InputStream is, final boolean verticalFlipNeeded) throws IOException { + final TextureData textureData = TextureIO.newTextureData(_capsUtil.getProfile(), is, + isMipmapsProductionEnabled(), TextureIO.TGA); + if (textureData == null) { + return null; + } + return makeArdor3dImage(textureData, textureData.getMustFlipVertically() == verticalFlipNeeded); + } + + public static String[] getSupportedFormats() { + return _supportedFormats; + } + + public static void registerLoader() { + registerLoader(new JoglTgaImageLoader(), _supportedFormats); + } + + public static void registerLoader(final JoglTgaImageLoader joglTgaImageLoader, final String[] supportedFormats) { + ImageLoaderUtil.registerHandler(joglTgaImageLoader, supportedFormats); + } +} diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtFocusWrapper.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtFocusWrapper.java index 5068e6c..b7845e7 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtFocusWrapper.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtFocusWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java index 45babf1..73a65dc 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java index bce6810..119820d 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -31,7 +31,7 @@ import com.jogamp.newt.opengl.GLWindow; public class JoglNewtKeyboardWrapper extends KeyAdapter implements KeyboardWrapper { @GuardedBy("this") - protected final LinkedList<KeyEvent> _upcomingEvents = new LinkedList<KeyEvent>(); + protected final LinkedList<KeyEvent> _upcomingEvents = new LinkedList<>(); @GuardedBy("this") protected JoglNewtKeyboardIterator _currentIterator = null; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java index 10ca249..72c31d5 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -12,16 +12,15 @@ package com.ardor3d.input.jogl; import java.nio.ByteBuffer; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.nativewindow.util.PixelRectangle; - import com.ardor3d.framework.jogl.NewtWindowContainer; import com.ardor3d.image.Image; import com.ardor3d.input.GrabbedState; import com.ardor3d.input.MouseCursor; import com.ardor3d.input.MouseManager; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PixelRectangle; import com.jogamp.newt.Display.PointerIcon; import com.jogamp.newt.opengl.GLWindow; @@ -51,8 +50,8 @@ public class JoglNewtMouseManager implements MouseManager { PixelFormat pixFormat = null; for (final PixelFormat pf : PixelFormat.values()) { - if (pf.componentCount == image.getDataFormat().getComponents() - && pf.bytesPerPixel() == image.getDataType().getBytesPerPixel(pf.componentCount)) { + if (pf.comp.componentCount() == image.getDataFormat().getComponents() + && pf.comp.bytesPerPixel() == image.getDataType().getBytesPerPixel(pf.comp.componentCount())) { pixFormat = pf; break; } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java index a82bb1a..426d9b4 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -26,8 +26,6 @@ import com.ardor3d.input.MouseState; import com.ardor3d.input.MouseWrapper; import com.google.common.collect.AbstractIterator; import com.google.common.collect.EnumMultiset; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.collect.Multiset; import com.google.common.collect.PeekingIterator; import com.jogamp.newt.event.MouseEvent; @@ -38,7 +36,7 @@ import com.jogamp.newt.opengl.GLWindow; public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { @GuardedBy("this") - protected final LinkedList<MouseState> _upcomingEvents = Lists.newLinkedList(); + protected final LinkedList<MouseState> _upcomingEvents = new LinkedList<>(); @GuardedBy("this") protected JoglNewtMouseIterator _currentIterator = null; @@ -55,7 +53,7 @@ public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { protected boolean _skipAutoRepeatEvents = false; protected final Multiset<MouseButton> _clicks = EnumMultiset.create(MouseButton.class); - protected final EnumMap<MouseButton, Long> _lastClickTime = Maps.newEnumMap(MouseButton.class); + protected final EnumMap<MouseButton, Long> _lastClickTime = new EnumMap<>(MouseButton.class); protected final EnumSet<MouseButton> _clickArmed = EnumSet.noneOf(MouseButton.class); protected int _ignoreX = Integer.MAX_VALUE; @@ -226,8 +224,9 @@ public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { private void addNewState(final MouseEvent mouseEvent, final EnumMap<MouseButton, ButtonState> enumMap, final Multiset<MouseButton> clicks) { final MouseState newState = new MouseState(mouseEvent.getX(), getArdor3DY(mouseEvent), getDX(mouseEvent), - getDY(mouseEvent), (int) (mouseEvent.isShiftDown() ? mouseEvent.getRotation()[0] - : mouseEvent.getRotation()[1]), enumMap, clicks); + getDY(mouseEvent), + (int) (mouseEvent.isShiftDown() ? mouseEvent.getRotation()[0] : mouseEvent.getRotation()[1]), enumMap, + clicks); synchronized (JoglNewtMouseWrapper.this) { _upcomingEvents.add(newState); @@ -244,7 +243,7 @@ public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { } /** - * @param e + * @param me * our mouseEvent * @return the Y coordinate of the event, flipped relative to the component since we expect an origin in the lower * left corner. diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java index 5ee1cb8..2459c9b 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -13,15 +13,14 @@ package com.ardor3d.renderer.jogl; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GLAutoDrawable; - import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.util.geom.jogl.DirectNioBuffersSet; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GLAutoDrawable; public class JoglContextCapabilities extends ContextCapabilities { @@ -67,8 +66,10 @@ public class JoglContextCapabilities extends ContextCapabilities { _maxTextureLodBias = 0f; } - gl.glGetIntegerv(GL2ES1.GL_MAX_CLIP_PLANES, buf); - _maxUserClipPlanes = buf.get(0); + if (gl.isGL2ES1()) { + gl.glGetIntegerv(GL2ES1.GL_MAX_CLIP_PLANES, buf); + _maxUserClipPlanes = buf.get(0); + } _glslSupported = gl.isExtensionAvailable("GL_ARB_shader_objects") && gl.isExtensionAvailable("GL_ARB_fragment_shader") && gl.isExtensionAvailable("GL_ARB_vertex_shader") @@ -81,9 +82,15 @@ public class JoglContextCapabilities extends ContextCapabilities { _tessellationShadersSupported = gl.isExtensionAvailable("GL_ARB_tessellation_shader") && _glslSupported; + _computeShaderSupported = gl.isExtensionAvailable("GL_ARB_compute_shader") && _glslSupported; + if (_glslSupported) { - gl.glGetIntegerv(GL2.GL_MAX_VERTEX_ATTRIBS_ARB, buf); - _maxGLSLVertexAttribs = buf.get(0); + if (gl.isGL2()) { + gl.glGetIntegerv(GL2.GL_MAX_VERTEX_ATTRIBS_ARB, buf); + _maxGLSLVertexAttribs = buf.get(0); + } else { + // FIXME use a reasonable value + } } // Pbuffer @@ -96,7 +103,7 @@ public class JoglContextCapabilities extends ContextCapabilities { _supportsFBOMultisample = gl.isExtensionAvailable("GL_EXT_framebuffer_multisample"); _supportsFBOBlit = gl.isExtensionAvailable("GL_EXT_framebuffer_blit"); - if (gl.isExtensionAvailable("GL_ARB_draw_buffers")) { + if (gl.isExtensionAvailable("GL_ARB_draw_buffers") && gl.isGL2ES2()) { gl.glGetIntegerv(GL2ES2.GL_MAX_COLOR_ATTACHMENTS, buf); _maxFBOColorAttachments = buf.get(0); } else { @@ -105,8 +112,8 @@ public class JoglContextCapabilities extends ContextCapabilities { // Max multisample samples. if (gl.isExtensionAvailable("GL_EXT_framebuffer_multisample") - && gl.isExtensionAvailable("GL_EXT_framebuffer_blit")) { - gl.glGetIntegerv(GL2ES3.GL_MAX_SAMPLES, buf); + && gl.isExtensionAvailable("GL_EXT_framebuffer_blit") && gl.isGL2ES3()) { + gl.glGetIntegerv(GL.GL_MAX_SAMPLES, buf); _maxFBOSamples = buf.get(0); } else { _maxFBOSamples = 0; @@ -119,8 +126,10 @@ public class JoglContextCapabilities extends ContextCapabilities { _stencilWrapSupport = gl.isExtensionAvailable("GL_EXT_stencil_wrap"); // number of available auxiliary draw buffers - gl.glGetIntegerv(GL2.GL_AUX_BUFFERS, buf); - _numAuxDrawBuffers = buf.get(0); + if (gl.isGL2()) { + gl.glGetIntegerv(GL2.GL_AUX_BUFFERS, buf); + _numAuxDrawBuffers = buf.get(0); + } // max texture size. gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, buf); @@ -148,9 +157,10 @@ public class JoglContextCapabilities extends ContextCapabilities { // If we do support multitexturing, find out how many textures we // can handle. - if (_supportsMultiTexture) { + if (_supportsMultiTexture && gl.isGL2ES1()) { gl.glGetIntegerv(GL2ES1.GL_MAX_TEXTURE_UNITS, buf); _numFixedTexUnits = buf.get(0); + // FIXME use a reasonable value when ES2 & 3 are detected } else { _numFixedTexUnits = 1; } @@ -241,14 +251,18 @@ public class JoglContextCapabilities extends ContextCapabilities { _displayVersion = "Unable to retrieve API version."; } - if (_glslSupported) { - try { - _shadingLanguageVersion = gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION); - } catch (final Exception e) { - _shadingLanguageVersion = "Unable to retrieve shading language version."; - } - } else { + if (gl.isGLES1()) { _shadingLanguageVersion = "Not supported."; + } else { + if (_glslSupported) { + try { + _shadingLanguageVersion = gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION); + } catch (final Exception e) { + _shadingLanguageVersion = "Unable to retrieve shading language version."; + } + } else { + _shadingLanguageVersion = "Not supported."; + } } } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java index 1a74c24..0bd3f1b 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -15,12 +15,12 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.framework.Scene; @@ -299,6 +299,8 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer { caps.setOnscreen(false); caps.setPBuffer(true); _offscreenDrawable = fac.createOffscreenAutoDrawable(null, caps, null, _width, _height); + // FIXME is this hack still useful? + _offscreenDrawable.setSharedContext(_parentContext); _context = _offscreenDrawable.getContext(); _context.makeCurrent(); @@ -331,8 +333,8 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer { try { activate(); - _width = _offscreenDrawable.getWidth(); - _height = _offscreenDrawable.getHeight(); + _width = _offscreenDrawable.getSurfaceWidth(); + _height = _offscreenDrawable.getSurfaceHeight(); deactivate(); } catch (final Exception e) { diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderContext.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderContext.java index 6dbd1d6..b361021 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderContext.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderContext.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java index 1e15e65..70dfe2d 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -19,19 +19,6 @@ import java.util.Collection; import java.util.List; import java.util.logging.Logger; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.fixedfunc.GLPointerFunc; -import javax.media.opengl.glu.GLU; - import com.ardor3d.image.ImageDataFormat; import com.ardor3d.image.PixelDataType; import com.ardor3d.image.Texture; @@ -105,11 +92,23 @@ import com.ardor3d.util.Constants; import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.stat.StatCollector; import com.ardor3d.util.stat.StatType; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.glu.GLU; import com.jogamp.opengl.util.GLBuffers; /** * <code>JoglRenderer</code> provides an implementation of the <code>Renderer</code> interface using the JOGL API. - * + * * @see com.ardor3d.renderer.Renderer */ public class JoglRenderer extends AbstractRenderer { @@ -117,11 +116,13 @@ public class JoglRenderer extends AbstractRenderer { private FloatBuffer _transformBuffer; private final Matrix4 _transformMatrix = new Matrix4(); + private final GLU _glu = new GLU();// only used to get error strings /** * Constructor instantiates a new <code>JoglRenderer</code> object. */ public JoglRenderer() { + super(); logger.fine("JoglRenderer created."); } @@ -223,11 +224,8 @@ public class JoglRenderer extends AbstractRenderer { @Override public void flushFrame(final boolean doSwap) { - final GL gl = GLContext.getCurrentGL(); - renderBuckets(); - gl.glFlush(); if (doSwap) { doApplyState(defaultStateList.get(RenderState.StateType.ColorMask)); @@ -241,6 +239,11 @@ public class JoglRenderer extends AbstractRenderer { if (Constants.stats) { StatCollector.endStat(StatType.STAT_DISPLAYSWAP_TIMER); } + } else { + // this call is not necessary just before swapBuffers(), see: + // http://www.opengl.org/wiki/Common_Mistakes#glFinish_and_glFlush + final GL gl = GLContext.getCurrentGL(); + gl.glFlush(); } if (Constants.stats) { @@ -454,7 +457,7 @@ public class JoglRenderer extends AbstractRenderer { if (!vboIdsBuffer.hasRemaining()) { vboIdsBuffer.flip(); if (vboIdsBuffer.remaining() > 0) { - gl.glDeleteTextures(vboIdsBuffer.remaining(), vboIdsBuffer); + gl.glDeleteBuffers(vboIdsBuffer.remaining(), vboIdsBuffer); } vboIdsBuffer.clear(); } @@ -464,7 +467,7 @@ public class JoglRenderer extends AbstractRenderer { } vboIdsBuffer.flip(); if (vboIdsBuffer.remaining() > 0) { - gl.glDeleteTextures(vboIdsBuffer.remaining(), vboIdsBuffer); + gl.glDeleteBuffers(vboIdsBuffer.remaining(), vboIdsBuffer); } vboIdsBuffer.clear(); } @@ -626,12 +629,16 @@ public class JoglRenderer extends AbstractRenderer { GL.GL_UNSIGNED_BYTE, source); break; case OneDimensional: - gl.getGL2GL3().glTexSubImage1D(GL2GL3.GL_TEXTURE_1D, 0, dstOffsetX, dstWidth, pixelFormat, - GL.GL_UNSIGNED_BYTE, source); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glTexSubImage1D(GL2GL3.GL_TEXTURE_1D, 0, dstOffsetX, dstWidth, pixelFormat, + GL.GL_UNSIGNED_BYTE, source); + } break; case ThreeDimensional: - gl.getGL2ES2().glTexSubImage3D(GL2ES2.GL_TEXTURE_3D, 0, dstOffsetX, dstOffsetY, dstOffsetZ, - dstWidth, dstHeight, dstDepth, pixelFormat, GL.GL_UNSIGNED_BYTE, source); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glTexSubImage3D(GL2ES2.GL_TEXTURE_3D, 0, dstOffsetX, dstOffsetY, dstOffsetZ, + dstWidth, dstHeight, dstDepth, pixelFormat, GL.GL_UNSIGNED_BYTE, source); + } break; case CubeMap: gl.glTexSubImage2D(JoglTextureStateUtil.getGLCubeMapFace(dstFace), 0, dstOffsetX, dstOffsetY, @@ -672,12 +679,11 @@ public class JoglRenderer extends AbstractRenderer { @Override public void checkCardError() throws Ardor3dException { final GL gl = GLContext.getCurrentGL(); - final GLU glu = new GLU(); try { final int errorCode = gl.glGetError(); if (errorCode != GL.GL_NO_ERROR) { - throw new GLException(glu.gluErrorString(errorCode)); + throw new GLException(_glu.gluErrorString(errorCode)); } } catch (final GLException exception) { throw new Ardor3dException("Error in opengl: " + exception.getMessage(), exception); @@ -741,8 +747,10 @@ public class JoglRenderer extends AbstractRenderer { gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); } vertexBuffer.rewind(); - if (gl.isGL2ES1() && vertexBufferData != null) { - gl.getGL2ES1().glVertexPointer(vertexBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, vertexBuffer); + if (vertexBufferData != null) { + if (gl.isGL2ES1()) { + gl.getGL2ES1().glVertexPointer(vertexBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, vertexBuffer); + } } } } @@ -783,8 +791,10 @@ public class JoglRenderer extends AbstractRenderer { gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY); } colorBuffer.rewind(); - if (gl.isGL2ES1() && colorBufferData != null) { - gl.getGL2ES1().glColorPointer(colorBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, colorBuffer); + if (colorBufferData != null) { + if (gl.isGL2ES1()) { + gl.getGL2ES1().glColorPointer(colorBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, colorBuffer); + } } } } @@ -1084,6 +1094,10 @@ public class JoglRenderer extends AbstractRenderer { JoglRendererUtil.setBoundVBO(rendRecord, vboID); if (gl.isGL2ES1()) { gl.getGL2ES1().glColorPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0); + } else { + if (gl.isGL2ES2()) { + // TODO use VAO + } } } else { if (gl.isGL2GL3()) { @@ -1738,18 +1752,24 @@ public class JoglRenderer extends AbstractRenderer { if (stipplePattern != (short) 0xFFFF) { if (!lineRecord.isValid() || !lineRecord.stippled) { - gl.glEnable(GL2.GL_LINE_STIPPLE); + if (gl.isGL2()) { + gl.glEnable(GL2.GL_LINE_STIPPLE); + } lineRecord.stippled = true; } if (!lineRecord.isValid() || stippleFactor != lineRecord.stippleFactor || stipplePattern != lineRecord.stipplePattern) { - gl.getGL2().glLineStipple(stippleFactor, stipplePattern); + if (gl.isGL2()) { + gl.getGL2().glLineStipple(stippleFactor, stipplePattern); + } lineRecord.stippleFactor = stippleFactor; lineRecord.stipplePattern = stipplePattern; } } else if (!lineRecord.isValid() || lineRecord.stippled) { - gl.glDisable(GL2.GL_LINE_STIPPLE); + if (gl.isGL2()) { + gl.glDisable(GL2.GL_LINE_STIPPLE); + } lineRecord.stippled = false; } @@ -1879,7 +1899,7 @@ public class JoglRenderer extends AbstractRenderer { /** * Start a new display list. All further renderer commands that can be stored in a display list are part of this new * list until {@link #endDisplayList()} is called. - * + * * @return id of new display list */ @Override diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java index 4b24580..6a18ddb 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -15,11 +15,11 @@ import java.util.LinkedList; import java.util.List; import java.util.logging.Logger; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; import com.ardor3d.framework.Scene; import com.ardor3d.image.Texture; @@ -106,7 +106,10 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { // Initialize mipmapping for this texture, if requested if (tex.getMinificationFilter().usesMipMapLevels()) { - gl.glGenerateMipmap(JoglTextureStateUtil.getGLType(tex.getType())); + final int glType = JoglTextureStateUtil.getGLType(tex.getType()); + if (glType != GL.GL_INVALID_ENUM) { + gl.glGenerateMipmap(glType); + } } // Setup filtering and wrap @@ -176,8 +179,8 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { // Otherwise, we can streamline this by rendering to multiple textures at once. // first determine how many groups we need - final LinkedList<Texture> depths = new LinkedList<Texture>(); - final LinkedList<Texture> colors = new LinkedList<Texture>(); + final LinkedList<Texture> depths = new LinkedList<>(); + final LinkedList<Texture> colors = new LinkedList<>(); for (int i = 0; i < texs.size(); i++) { final Texture tex = texs.get(i); if (tex.getTextureStoreFormat().isDepthFormat()) { @@ -252,7 +255,10 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { final Texture tex = texs.get(x); if (tex.getMinificationFilter().usesMipMapLevels()) { JoglTextureStateUtil.doTextureBind(tex, 0, true); - gl.glGenerateMipmap(JoglTextureStateUtil.getGLType(tex.getType())); + final int glType = JoglTextureStateUtil.getGLType(tex.getType()); + if (glType != GL.GL_INVALID_ENUM) { + gl.glGenerateMipmap(glType); + } } } } finally { @@ -351,7 +357,10 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { // automatically generate mipmaps for our texture. if (tex.getMinificationFilter().usesMipMapLevels()) { JoglTextureStateUtil.doTextureBind(tex, 0, true); - gl.glGenerateMipmap(JoglTextureStateUtil.getGLType(tex.getType())); + final int glType = JoglTextureStateUtil.getGLType(tex.getType()); + if (glType != GL.GL_INVALID_ENUM) { + gl.glGenerateMipmap(JoglTextureStateUtil.getGLType(tex.getType())); + } } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRendererProvider.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRendererProvider.java index 57117f8..858b1ae 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRendererProvider.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRendererProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglMatrixBackend.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglMatrixBackend.java index e70bd71..fe76591 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglMatrixBackend.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglMatrixBackend.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglRealMatrixBackend.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglRealMatrixBackend.java index 386f7fc..49e99ce 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglRealMatrixBackend.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglRealMatrixBackend.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,8 +12,8 @@ package com.ardor3d.renderer.jogl.state.record; import java.nio.FloatBuffer; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLContext; public class JoglRealMatrixBackend implements JoglMatrixBackend { diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglRendererRecord.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglRendererRecord.java index 56a151c..4d5d61f 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglRendererRecord.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglRendererRecord.java @@ -1,19 +1,20 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.renderer.jogl.state.record; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; - import com.ardor3d.renderer.state.record.RendererRecord; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.util.glsl.fixedfunc.FixedFuncUtil; +import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode; public class JoglRendererRecord extends RendererRecord { @@ -25,6 +26,8 @@ public class JoglRendererRecord extends RendererRecord { _matrixBackend = new JoglRealMatrixBackend(); } else { _matrixBackend = new JoglSimulatedMatrixBackend(); + FixedFuncUtil.wrapFixedFuncEmul(gl, ShaderSelectionMode.AUTO, + ((JoglSimulatedMatrixBackend) _matrixBackend)._matrix); } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglSimulatedMatrixBackend.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglSimulatedMatrixBackend.java index 441f786..3617ae5 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglSimulatedMatrixBackend.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/state/record/JoglSimulatedMatrixBackend.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -16,7 +16,7 @@ import com.jogamp.opengl.util.PMVMatrix; public class JoglSimulatedMatrixBackend implements JoglMatrixBackend { - private final PMVMatrix _matrix; + final PMVMatrix _matrix; public JoglSimulatedMatrixBackend() { super(); diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java index 4d7f834..097ffd5 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,11 +10,11 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; import com.ardor3d.math.type.ReadOnlyColorRGBA; import com.ardor3d.renderer.ContextCapabilities; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java index dfd3c9c..56a5d34 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -13,9 +13,9 @@ package com.ardor3d.scene.state.jogl; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLContext; import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.renderer.ContextManager; @@ -73,7 +73,9 @@ public abstract class JoglClipStateUtil { } else { ((DoubleBuffer) record.buf).put(state.getPlaneEquations(planeIndex)); record.buf.flip(); - gl.getGL2().glClipPlane(GL2ES1.GL_CLIP_PLANE0 + planeIndex, (DoubleBuffer) record.buf); + if (gl.isGL2()) { + gl.getGL2().glClipPlane(GL2ES1.GL_CLIP_PLANE0 + planeIndex, (DoubleBuffer) record.buf); + } } } else { // TODO use this suggestion but take into account the good reference frame: diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java index ca685a8..1d87696 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,8 +10,8 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java index a2f3fd8..d2aa7cf 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,8 +10,8 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java index a36649a..e19ffa0 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,10 +10,10 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLContext; import com.ardor3d.math.type.ReadOnlyColorRGBA; import com.ardor3d.renderer.ContextCapabilities; @@ -43,23 +43,35 @@ public abstract class JoglFogStateUtil { if (record.isValid()) { if (record.fogStart != state.getStart()) { - gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_START, state.getStart()); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_START, state.getStart()); + } record.fogStart = state.getStart(); } if (record.fogEnd != state.getEnd()) { - gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_END, state.getEnd()); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_END, state.getEnd()); + } record.fogEnd = state.getEnd(); } if (record.density != state.getDensity()) { - gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_DENSITY, state.getDensity()); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_DENSITY, state.getDensity()); + } record.density = state.getDensity(); } } else { - gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_START, state.getStart()); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_START, state.getStart()); + } record.fogStart = state.getStart(); - gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_END, state.getEnd()); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_END, state.getEnd()); + } record.fogEnd = state.getEnd(); - gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_DENSITY, state.getDensity()); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_DENSITY, state.getDensity()); + } record.density = state.getDensity(); } @@ -82,17 +94,25 @@ public abstract class JoglFogStateUtil { if (record.isValid()) { if (enable && !record.enabled) { - gl.glEnable(GL2ES1.GL_FOG); + if (gl.isGL2ES1()) { + gl.glEnable(GL2ES1.GL_FOG); + } record.enabled = true; } else if (!enable && record.enabled) { - gl.glDisable(GL2ES1.GL_FOG); + if (gl.isGL2ES1()) { + gl.glDisable(GL2ES1.GL_FOG); + } record.enabled = false; } } else { if (enable) { - gl.glEnable(GL2ES1.GL_FOG); + if (gl.isGL2ES1()) { + gl.glEnable(GL2ES1.GL_FOG); + } } else { - gl.glDisable(GL2ES1.GL_FOG); + if (gl.isGL2ES1()) { + gl.glDisable(GL2ES1.GL_FOG); + } } record.enabled = enable; } @@ -107,7 +127,9 @@ public abstract class JoglFogStateUtil { record.colorBuff.put(record.fogColor.getRed()).put(record.fogColor.getGreen()) .put(record.fogColor.getBlue()).put(record.fogColor.getAlpha()); record.colorBuff.flip(); - gl.getGL2ES1().glFogfv(GL2ES1.GL_FOG_COLOR, record.colorBuff); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glFogfv(GL2ES1.GL_FOG_COLOR, record.colorBuff); + } } } @@ -118,9 +140,13 @@ public abstract class JoglFogStateUtil { if (caps.isFogCoordinatesSupported()) { if (!record.isValid() || !source.equals(record.source)) { if (source == CoordinateSource.Depth) { - gl.getGL2().glFogi(GL2.GL_FOG_COORDINATE_SOURCE, GL2.GL_FRAGMENT_DEPTH); + if (gl.isGL2()) { + gl.getGL2().glFogi(GL2.GL_FOG_COORDINATE_SOURCE, GL2.GL_FRAGMENT_DEPTH); + } } else { - gl.getGL2().glFogi(GL2.GL_FOG_COORDINATE_SOURCE, GL2.GL_FOG_COORDINATE); + if (gl.isGL2()) { + gl.getGL2().glFogi(GL2.GL_FOG_COORDINATE_SOURCE, GL2.GL_FOG_COORDINATE); + } } } } @@ -143,7 +169,9 @@ public abstract class JoglFogStateUtil { } if (!record.isValid() || record.fogMode != glMode) { - gl.getGL2().glFogi(GL2ES1.GL_FOG_MODE, glMode); + if (gl.isGL2()) { + gl.getGL2().glFogi(GL2ES1.GL_FOG_MODE, glMode); + } record.fogMode = glMode; } } @@ -162,7 +190,9 @@ public abstract class JoglFogStateUtil { } if (!record.isValid() || record.fogHint != glHint) { - gl.glHint(GL2ES1.GL_FOG_HINT, glHint); + if (gl.isGL2ES1()) { + gl.glHint(GL2ES1.GL_FOG_HINT, glHint); + } record.fogHint = glHint; } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java index b227ae4..6d4210c 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -14,9 +14,9 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.logging.Logger; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLContext; import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.renderer.ContextManager; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java index 489fdd4..5c0bfb6 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,11 +10,11 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLContext; -import javax.media.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; import com.ardor3d.light.DirectionalLight; import com.ardor3d.light.Light; @@ -167,9 +167,13 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || lr.isEnabled() != enable) { if (enable) { - gl.glEnable(GLLightingFunc.GL_LIGHT0 + index); + if (gl.isGL2ES1()) { + gl.glEnable(GLLightingFunc.GL_LIGHT0 + index); + } } else { - gl.glDisable(GLLightingFunc.GL_LIGHT0 + index); + if (gl.isGL2ES1()) { + gl.glDisable(GLLightingFunc.GL_LIGHT0 + index); + } } lr.setEnabled(enable); @@ -181,9 +185,13 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || record.isEnabled() != enable) { if (enable) { - gl.glEnable(GLLightingFunc.GL_LIGHTING); + if (gl.isGL2ES1()) { + gl.glEnable(GLLightingFunc.GL_LIGHTING); + } } else { - gl.glDisable(GLLightingFunc.GL_LIGHTING); + if (gl.isGL2ES1()) { + gl.glDisable(GLLightingFunc.GL_LIGHTING); + } } record.setEnabled(enable); } @@ -194,9 +202,21 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || record.isTwoSidedOn() != twoSided) { if (twoSided) { - gl.getGL2().glLightModeli(GL2ES1.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_TRUE); + if (gl.isGL2()) { + gl.getGL2().glLightModeli(GL2ES1.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_TRUE); + } else { + if (gl.isGLES1()) { + gl.getGLES1().glLightModelx(GL2ES1.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_TRUE); + } + } } else { - gl.getGL2().glLightModeli(GL2ES1.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_FALSE); + if (gl.isGL2()) { + gl.getGL2().glLightModeli(GL2ES1.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_FALSE); + } else { + if (gl.isGLES1()) { + gl.getGLES1().glLightModelx(GL2ES1.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_FALSE); + } + } } record.setTwoSidedOn(twoSided); } @@ -207,9 +227,21 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || record.isLocalViewer() != localViewer) { if (localViewer) { - gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_TRUE); + if (gl.isGL2()) { + gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_TRUE); + } else { + if (gl.isGLES1()) { + gl.getGLES1().glLightModelx(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_TRUE); + } + } } else { - gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_FALSE); + if (gl.isGL2()) { + gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_FALSE); + } else { + if (gl.isGLES1()) { + gl.getGLES1().glLightModelx(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_FALSE); + } + } } record.setLocalViewer(localViewer); } @@ -220,9 +252,21 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || record.isSeparateSpecular() != separateSpecularOn) { if (separateSpecularOn) { - gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SEPARATE_SPECULAR_COLOR); + if (gl.isGL2()) { + gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SEPARATE_SPECULAR_COLOR); + } else { + if (gl.isGLES1()) { + gl.getGLES1().glLightModelx(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SEPARATE_SPECULAR_COLOR); + } + } } else { - gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SINGLE_COLOR); + if (gl.isGL2()) { + gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SINGLE_COLOR); + } else { + if (gl.isGLES1()) { + gl.getGLES1().glLightModelx(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SINGLE_COLOR); + } + } } record.setSeparateSpecular(separateSpecularOn); } @@ -238,7 +282,10 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(globalAmbient.getBlue()); record.lightBuffer.put(globalAmbient.getAlpha()); record.lightBuffer.flip(); - gl.getGL2().glLightModelfv(GL2ES1.GL_LIGHT_MODEL_AMBIENT, record.lightBuffer); // TODO Check for float + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightModelfv(GL2ES1.GL_LIGHT_MODEL_AMBIENT, record.lightBuffer); // TODO Check for + // float + } record.globalAmbient.set(globalAmbient); } } @@ -254,10 +301,10 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(ambient.getBlue()); record.lightBuffer.put(ambient.getAlpha()); record.lightBuffer.flip(); - gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_AMBIENT, record.lightBuffer); // TODO - // Check - // for - // float + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_AMBIENT, + record.lightBuffer); // TODO Check for float + } lr.ambient.set(ambient); } } @@ -273,10 +320,13 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(diffuse.getBlue()); record.lightBuffer.put(diffuse.getAlpha()); record.lightBuffer.flip(); - gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_DIFFUSE, record.lightBuffer); // TODO - // Check - // for - // float + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_DIFFUSE, + record.lightBuffer); // TODO + } + // Check + // for + // float lr.diffuse.set(diffuse); } } @@ -292,10 +342,13 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(specular.getBlue()); record.lightBuffer.put(specular.getAlpha()); record.lightBuffer.flip(); - gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPECULAR, record.lightBuffer); // TODO - // Check - // for - // float + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPECULAR, + record.lightBuffer); // TODO + } + // Check + // for + // float lr.specular.set(specular); } } @@ -327,7 +380,10 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(positionZ); record.lightBuffer.put(positionW); record.lightBuffer.flip(); - gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_POSITION, record.lightBuffer); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_POSITION, + record.lightBuffer); + } lr.position.set(positionX, positionY, positionZ, positionW); if (!Camera.getCurrentCamera().isFrameDirty()) { @@ -355,17 +411,23 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(directionZ); record.lightBuffer.put(value); record.lightBuffer.flip(); - gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_DIRECTION, record.lightBuffer); // TODO - // Check - // for - // float + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_DIRECTION, + record.lightBuffer); // TODO + // Check + // for + // float + } } private static void setConstant(final int index, final float constant, final LightRecord lr, final boolean force) { final GL gl = GLContext.getCurrentGL(); if (force || constant != lr.getConstant()) { - gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_CONSTANT_ATTENUATION, constant); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_CONSTANT_ATTENUATION, + constant); + } lr.setConstant(constant); } } @@ -374,7 +436,9 @@ public abstract class JoglLightStateUtil { final GL gl = GLContext.getCurrentGL(); if (force || linear != lr.getLinear()) { - gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_LINEAR_ATTENUATION, linear); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_LINEAR_ATTENUATION, linear); + } lr.setLinear(linear); } } @@ -383,7 +447,10 @@ public abstract class JoglLightStateUtil { final GL gl = GLContext.getCurrentGL(); if (force || quad != lr.getQuadratic()) { - gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_QUADRATIC_ATTENUATION, quad); + if (gl.isGL2ES1()) { + gl.getGL2ES1() + .glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_QUADRATIC_ATTENUATION, quad); + } lr.setQuadratic(quad); } } @@ -407,7 +474,9 @@ public abstract class JoglLightStateUtil { final GL gl = GLContext.getCurrentGL(); if (!record.isValid() || lr.getSpotExponent() != exponent) { - gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_EXPONENT, exponent); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_EXPONENT, exponent); + } lr.setSpotExponent(exponent); } } @@ -417,7 +486,9 @@ public abstract class JoglLightStateUtil { final GL gl = GLContext.getCurrentGL(); if (!record.isValid() || lr.getSpotCutoff() != cutoff) { - gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_CUTOFF, cutoff); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_CUTOFF, cutoff); + } lr.setSpotCutoff(cutoff); } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java index 9fc3490..58e659f 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,9 +10,9 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; -import javax.media.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; import com.ardor3d.math.type.ReadOnlyColorRGBA; import com.ardor3d.renderer.ContextManager; @@ -74,7 +74,10 @@ public abstract class JoglMaterialStateUtil { record.tempColorBuff.put(frontColor.getRed()).put(frontColor.getGreen()).put(frontColor.getBlue()) .put(frontColor.getAlpha()); record.tempColorBuff.flip(); - gl.getGL2().glMaterialfv(getGLMaterialFace(MaterialFace.FrontAndBack), glMat, record.tempColorBuff); + if (gl.isGL2()) { + gl.getGL2().glMaterialfv(getGLMaterialFace(MaterialFace.FrontAndBack), glMat, + record.tempColorBuff); + } record.setColor(MaterialFace.FrontAndBack, glMatColor, frontColor); } } @@ -85,7 +88,9 @@ public abstract class JoglMaterialStateUtil { record.tempColorBuff.put(frontColor.getRed()).put(frontColor.getGreen()).put(frontColor.getBlue()) .put(frontColor.getAlpha()); record.tempColorBuff.flip(); - gl.getGL2().glMaterialfv(getGLMaterialFace(MaterialFace.Front), glMat, record.tempColorBuff); + if (gl.isGL2()) { + gl.getGL2().glMaterialfv(getGLMaterialFace(MaterialFace.Front), glMat, record.tempColorBuff); + } record.setColor(MaterialFace.Front, glMatColor, frontColor); } } @@ -96,7 +101,9 @@ public abstract class JoglMaterialStateUtil { record.tempColorBuff.put(backColor.getRed()).put(backColor.getGreen()).put(backColor.getBlue()) .put(backColor.getAlpha()); record.tempColorBuff.flip(); - gl.getGL2().glMaterialfv(getGLMaterialFace(MaterialFace.Back), glMat, record.tempColorBuff); + if (gl.isGL2()) { + gl.getGL2().glMaterialfv(getGLMaterialFace(MaterialFace.Back), glMat, record.tempColorBuff); + } record.setColor(MaterialFace.Back, glMatColor, backColor); } } @@ -135,13 +142,18 @@ public abstract class JoglMaterialStateUtil { final GL gl = GLContext.getCurrentGL(); if (colorMaterial == ColorMaterial.None) { - gl.glDisable(GLLightingFunc.GL_COLOR_MATERIAL); + if (gl.isGL2()) { + gl.glDisable(GLLightingFunc.GL_COLOR_MATERIAL); + } } else { final int glMat = getGLColorMaterial(colorMaterial); final int glFace = getGLMaterialFace(face); - - gl.getGL2().glColorMaterial(glFace, glMat); - gl.glEnable(GLLightingFunc.GL_COLOR_MATERIAL); + if (gl.isGL2()) { + gl.getGL2().glColorMaterial(glFace, glMat); + } + if (gl.isGL2()) { + gl.glEnable(GLLightingFunc.GL_COLOR_MATERIAL); + } record.resetColorsForCM(face, colorMaterial); } record.colorMaterial = colorMaterial; @@ -156,20 +168,26 @@ public abstract class JoglMaterialStateUtil { if (frontShininess == backShininess) { // consolidate to one call if (!record.isValid() || frontShininess != record.frontShininess || record.backShininess != backShininess) { - gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.FrontAndBack), GLLightingFunc.GL_SHININESS, - frontShininess); + if (gl.isGL2()) { + gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.FrontAndBack), GLLightingFunc.GL_SHININESS, + frontShininess); + } record.backShininess = record.frontShininess = frontShininess; } } else { if (!record.isValid() || frontShininess != record.frontShininess) { - gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Front), GLLightingFunc.GL_SHININESS, - frontShininess); + if (gl.isGL2()) { + gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Front), GLLightingFunc.GL_SHININESS, + frontShininess); + } record.frontShininess = frontShininess; } if (!record.isValid() || backShininess != record.backShininess) { - gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Back), GLLightingFunc.GL_SHININESS, - backShininess); + if (gl.isGL2()) { + gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Back), GLLightingFunc.GL_SHININESS, + backShininess); + } record.backShininess = backShininess; } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java index ec48484..6fe1c12 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,9 +10,9 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; @@ -59,10 +59,12 @@ public abstract class JoglOffsetStateUtil { final int glType = getGLType(type); if (!record.isValid() || typeEnabled != record.enabledOffsets.contains(type)) { - if (typeEnabled) { - gl.glEnable(glType); - } else { - gl.glDisable(glType); + if (!gl.isGLES()) { + if (typeEnabled) { + gl.glEnable(glType); + } else { + gl.glDisable(glType); + } } } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java index ebb53a8..3788548 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -15,13 +15,6 @@ import java.nio.IntBuffer; import java.util.List; import java.util.logging.Logger; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL3; -import javax.media.opengl.GL4; -import javax.media.opengl.GLContext; - import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; @@ -34,6 +27,12 @@ import com.ardor3d.scene.state.jogl.shader.JoglShaderUtil; import com.ardor3d.util.Ardor3dException; import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.shader.ShaderVariable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL3; +import com.jogamp.opengl.GL3ES3; +import com.jogamp.opengl.GLContext; public abstract class JoglShaderObjectsStateUtil { private static final Logger logger = Logger.getLogger(JoglShaderObjectsStateUtil.class.getName()); @@ -49,7 +48,7 @@ public abstract class JoglShaderObjectsStateUtil { if (state._programID == -1) { if (gl.isGL2()) { - state._programID = gl.getGL2().glCreateProgramObjectARB(); + state._programID = (int) gl.getGL2().glCreateProgramObjectARB(); } else { if (gl.isGL2ES2()) { state._programID = gl.getGL2ES2().glCreateProgram(); @@ -62,7 +61,7 @@ public abstract class JoglShaderObjectsStateUtil { removeVertShader(state); } if (gl.isGL2()) { - state._vertexShaderID = gl.getGL2().glCreateShaderObjectARB(GL2ES2.GL_VERTEX_SHADER); + state._vertexShaderID = (int) gl.getGL2().glCreateShaderObjectARB(GL2ES2.GL_VERTEX_SHADER); } else { if (gl.isGL2ES2()) { state._vertexShaderID = gl.getGL2ES2().glCreateShader(GL2ES2.GL_VERTEX_SHADER); @@ -97,7 +96,7 @@ public abstract class JoglShaderObjectsStateUtil { gl.getGL2ES2().glGetShaderiv(state._vertexShaderID, GL2ES2.GL_COMPILE_STATUS, compiled); } } - checkProgramError(compiled.get(0), state._vertexShaderID, state._vertexShaderName); + checkShaderError(compiled.get(0), state._vertexShaderID, state._vertexShaderName); // Attach the program if (gl.isGL2()) { @@ -118,7 +117,7 @@ public abstract class JoglShaderObjectsStateUtil { } if (gl.isGL2()) { - state._fragmentShaderID = gl.getGL2().glCreateShaderObjectARB(GL2ES2.GL_FRAGMENT_SHADER); + state._fragmentShaderID = (int) gl.getGL2().glCreateShaderObjectARB(GL2ES2.GL_FRAGMENT_SHADER); } else { if (gl.isGL2ES2()) { state._fragmentShaderID = gl.getGL2ES2().glCreateShader(GL2ES2.GL_FRAGMENT_SHADER); @@ -153,7 +152,7 @@ public abstract class JoglShaderObjectsStateUtil { gl.getGL2ES2().glGetShaderiv(state._fragmentShaderID, GL2ES2.GL_COMPILE_STATUS, compiled); } } - checkProgramError(compiled.get(0), state._fragmentShaderID, state._vertexShaderName); + checkShaderError(compiled.get(0), state._fragmentShaderID, state._vertexShaderName); // Attach the program if (gl.isGL2()) { @@ -175,7 +174,7 @@ public abstract class JoglShaderObjectsStateUtil { } if (gl.isGL2()) { - state._geometryShaderID = gl.getGL2().glCreateShaderObjectARB(GL3.GL_GEOMETRY_SHADER); + state._geometryShaderID = (int) gl.getGL2().glCreateShaderObjectARB(GL3.GL_GEOMETRY_SHADER); } else { if (gl.isGL2ES2()) { state._geometryShaderID = gl.getGL2ES2().glCreateShader(GL3.GL_GEOMETRY_SHADER); @@ -210,7 +209,7 @@ public abstract class JoglShaderObjectsStateUtil { gl.getGL2ES2().glGetShaderiv(state._geometryShaderID, GL2ES2.GL_COMPILE_STATUS, compiled); } } - checkProgramError(compiled.get(0), state._geometryShaderID, state._geometryShaderName); + checkShaderError(compiled.get(0), state._geometryShaderID, state._geometryShaderName); // Attach the program if (gl.isGL2()) { @@ -233,11 +232,11 @@ public abstract class JoglShaderObjectsStateUtil { } if (gl.isGL2()) { - state._tessellationControlShaderID = gl.getGL2() - .glCreateShaderObjectARB(GL4.GL_TESS_CONTROL_SHADER); + state._tessellationControlShaderID = (int) gl.getGL2().glCreateShaderObjectARB( + GL3.GL_TESS_CONTROL_SHADER); } else { if (gl.isGL2ES2()) { - state._tessellationControlShaderID = gl.getGL2ES2().glCreateShader(GL4.GL_TESS_CONTROL_SHADER); + state._tessellationControlShaderID = gl.getGL2ES2().glCreateShader(GL3.GL_TESS_CONTROL_SHADER); } } @@ -270,7 +269,7 @@ public abstract class JoglShaderObjectsStateUtil { compiled); } } - checkProgramError(compiled.get(0), state._tessellationControlShaderID, + checkShaderError(compiled.get(0), state._tessellationControlShaderID, state._tessellationControlShaderName); // Attach the program @@ -291,12 +290,12 @@ public abstract class JoglShaderObjectsStateUtil { } if (gl.isGL2()) { - state._tessellationEvaluationShaderID = gl.getGL2().glCreateShaderObjectARB( - GL4.GL_TESS_CONTROL_SHADER); + state._tessellationEvaluationShaderID = (int) gl.getGL2().glCreateShaderObjectARB( + GL3.GL_TESS_CONTROL_SHADER); } else { if (gl.isGL2ES2()) { state._tessellationEvaluationShaderID = gl.getGL2ES2().glCreateShader( - GL4.GL_TESS_CONTROL_SHADER); + GL3.GL_TESS_CONTROL_SHADER); } } @@ -314,7 +313,7 @@ public abstract class JoglShaderObjectsStateUtil { } } - // Compile the tessellation control shader + // Compile the tessellation evaluation shader final JoglRenderContext context = (JoglRenderContext) ContextManager.getCurrentContext(); final IntBuffer compiled = context.getDirectNioBuffersSet().getSingleIntBuffer(); compiled.clear(); @@ -329,7 +328,7 @@ public abstract class JoglShaderObjectsStateUtil { compiled); } } - checkProgramError(compiled.get(0), state._tessellationEvaluationShaderID, + checkShaderError(compiled.get(0), state._tessellationEvaluationShaderID, state._tessellationEvaluationShaderName); // Attach the program @@ -346,6 +345,64 @@ public abstract class JoglShaderObjectsStateUtil { } } + if (caps.isComputeShaderSupported()) { + if (state.getComputeShader() != null) { + if (state._computeShaderID != -1) { + removeCompShader(state); + } + if (gl.isGL2()) { + state._computeShaderID = (int) gl.getGL2().glCreateShaderObjectARB(GL3ES3.GL_COMPUTE_SHADER); + } else { + if (gl.isGL2ES2()) { + state._computeShaderID = gl.getGL2ES2().glCreateShader(GL3ES3.GL_COMPUTE_SHADER); + } + } + + // Create the sources + final byte array[] = new byte[state.getComputeShader().limit()]; + state.getComputeShader().rewind(); + state.getComputeShader().get(array); + if (gl.isGL2()) { + gl.getGL2().glShaderSourceARB(state._computeShaderID, 1, new String[] { new String(array) }, + new int[] { array.length }, 0); + } else { + if (gl.isGL2ES2()) { + gl.getGL2ES2().glShaderSource(state._computeShaderID, 1, new String[] { new String(array) }, + new int[] { array.length }, 0); + } + } + + // Compile the compute shader + final JoglRenderContext context = (JoglRenderContext) ContextManager.getCurrentContext(); + final IntBuffer compiled = context.getDirectNioBuffersSet().getSingleIntBuffer(); + compiled.clear(); + if (gl.isGL2()) { + gl.getGL2().glCompileShaderARB(state._computeShaderID); + gl.getGL2().glGetObjectParameterivARB(state._computeShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB, + compiled); + } else { + if (gl.isGL2ES2()) { + gl.getGL2ES2().glCompileShader(state._computeShaderID); + gl.getGL2ES2().glGetShaderiv(state._computeShaderID, GL2ES2.GL_COMPILE_STATUS, compiled); + } + } + checkShaderError(compiled.get(0), state._computeShaderID, state._computeShaderName); + + // Attach the program + if (gl.isGL2()) { + gl.getGL2().glAttachObjectARB(state._programID, state._computeShaderID); + } else { + if (gl.isGL2ES2()) { + gl.getGL2ES2().glAttachShader(state._programID, state._computeShaderID); + } + } + + } else if (state._computeShaderID != -1) { + removeCompShader(state); + state._computeShaderID = -1; + } + } + if (gl.isGL2()) { gl.getGL2().glLinkProgramARB(state._programID); } else { @@ -494,15 +551,32 @@ public abstract class JoglShaderObjectsStateUtil { } } + /** Removes the compute shader */ + private static void removeCompShader(final GLSLShaderObjectsState state) { + final GL gl = GLContext.getCurrentGL(); + + if (state._computeShaderID != -1) { + if (gl.isGL2()) { + gl.getGL2().glDetachObjectARB(state._programID, state._computeShaderID); + gl.getGL2().glDeleteObjectARB(state._computeShaderID); + } else { + if (gl.isGL2ES2()) { + gl.getGL2ES2().glDetachShader(state._programID, state._computeShaderID); + gl.getGL2ES2().glDeleteShader(state._computeShaderID); + } + } + } + } + /** - * Check for program errors. If an error is detected, program exits. - * + * Check for shader errors. If an error is detected, program exits. + * * @param compilerState * the compiler state for a given shader - * @param id + * @param shaderId * shader's id */ - private static void checkProgramError(final int compilerState, final int id, final String shaderName) { + private static void checkShaderError(final int compilerState, final int shaderId, final String shaderName) { final GL gl = GLContext.getCurrentGL(); if (compilerState == GL.GL_FALSE) { @@ -510,10 +584,10 @@ public abstract class JoglShaderObjectsStateUtil { final IntBuffer iVal = context.getDirectNioBuffersSet().getSingleIntBuffer(); iVal.clear(); if (gl.isGL2()) { - gl.getGL2().glGetObjectParameterivARB(id, GL2.GL_OBJECT_INFO_LOG_LENGTH_ARB, iVal); + gl.getGL2().glGetObjectParameterivARB(shaderId, GL2.GL_OBJECT_INFO_LOG_LENGTH_ARB, iVal); } else { if (gl.isGL2ES2()) { - gl.getGL2ES2().glGetProgramiv(id, GL2ES2.GL_INFO_LOG_LENGTH, iVal); + gl.getGL2ES2().glGetShaderiv(shaderId, GL2ES2.GL_INFO_LOG_LENGTH, iVal); } } final int length = iVal.get(0); @@ -529,10 +603,10 @@ public abstract class JoglShaderObjectsStateUtil { infoLog = BufferUtils.createByteBuffer(length); } if (gl.isGL2()) { - gl.getGL2().glGetInfoLogARB(id, infoLog.limit(), iVal, infoLog); + gl.getGL2().glGetInfoLogARB(shaderId, infoLog.limit(), iVal, infoLog); } else { if (gl.isGL2ES2()) { - gl.getGL2ES2().glGetProgramInfoLog(id, infoLog.limit(), iVal, infoLog); + gl.getGL2ES2().glGetShaderInfoLog(shaderId, infoLog.limit(), iVal, infoLog); } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java index 426befb..69dbe4a 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,9 +10,9 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; -import javax.media.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; @@ -36,7 +36,9 @@ public abstract class JoglShadingStateUtil { final int toApply = state.isEnabled() ? getGLShade(state.getShadingMode()) : GLLightingFunc.GL_SMOOTH; // only apply if we're different. Update record to reflect any changes. if (!record.isValid() || toApply != record.lastShade) { - gl.getGL2().glShadeModel(toApply); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glShadeModel(toApply); + } record.lastShade = toApply; } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java index d624b60..9af1096 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,9 +10,9 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLContext; import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.renderer.ContextManager; @@ -38,7 +38,9 @@ public abstract class JoglStencilStateUtil { setEnabled(state.isEnabled(), caps.isTwoSidedStencilSupported() ? state.isUseTwoSided() : false, record, caps); if (state.isEnabled()) { if (state.isUseTwoSided() && caps.isTwoSidedStencilSupported()) { - gl.getGL2().glActiveStencilFaceEXT(GL.GL_BACK); + if (gl.isGL2()) { + gl.getGL2().glActiveStencilFaceEXT(GL.GL_BACK); + } applyMask(state.getStencilWriteMaskBack(), record, 2); applyFunc(getGLStencilFunction(state.getStencilFunctionBack()), state.getStencilReferenceBack(), state.getStencilFuncMaskBack(), record, 2); @@ -46,7 +48,9 @@ public abstract class JoglStencilStateUtil { getGLStencilOp(state.getStencilOpZFailBack(), caps), getGLStencilOp(state.getStencilOpZPassBack(), caps), record, 2); - gl.getGL2().glActiveStencilFaceEXT(GL.GL_FRONT); + if (gl.isGL2()) { + gl.getGL2().glActiveStencilFaceEXT(GL.GL_FRONT); + } applyMask(state.getStencilWriteMaskFront(), record, 1); applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(), state.getStencilFuncMaskFront(), record, 1); diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java index 63031ab..4aa1ad6 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -15,18 +15,6 @@ import java.nio.IntBuffer; import java.util.Collection; import java.util.logging.Logger; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.GLU; - import com.ardor3d.image.Image; import com.ardor3d.image.Texture; import com.ardor3d.image.Texture.ApplyMode; @@ -64,10 +52,23 @@ import com.ardor3d.util.TextureManager; import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.stat.StatCollector; import com.ardor3d.util.stat.StatType; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.GLU; public class JoglTextureStateUtil { private static final Logger logger = Logger.getLogger(JoglTextureStateUtil.class.getName()); + private static GLU _glu; + public final static void load(final Texture texture, final int unit) { if (texture == null) { return; @@ -130,7 +131,9 @@ public class JoglTextureStateUtil { final Texture.Type type = texture.getType(); final GL gl = GLContext.getCurrentGL(); - final GLU glu = GLU.createGLU(gl); + if (_glu == null) { + _glu = GLU.createGLU(gl); + } // bind our texture id to this unit. doTextureBind(texture, unit, false); @@ -184,25 +187,30 @@ public class JoglTextureStateUtil { } logger.warning("Rescaling image to " + w + " x " + h + " !!!"); - // must rescale image to get "top" mipmap texture image - final int pixFormat = JoglTextureUtil.getGLPixelFormat(image.getDataFormat()); - final int pixDataType = JoglTextureUtil.getGLPixelDataType(image.getDataType()); - final int bpp = ImageUtils.getPixelByteSize(image.getDataFormat(), image.getDataType()); - final ByteBuffer scaledImage = BufferUtils.createByteBuffer((w + 4) * h * bpp); - // ensure the buffer is ready for reading - image.getData(0).rewind(); - final int error = glu.gluScaleImage(pixFormat, actualWidth, actualHeight, pixDataType, - image.getData(0), w, h, pixDataType, scaledImage); - if (error != 0) { - final int errorCode = gl.glGetError(); - if (errorCode != GL.GL_NO_ERROR) { - throw new GLException(glu.gluErrorString(errorCode)); + // FIXME workaround for the bug 1045: https://jogamp.org/bugzilla/show_bug.cgi?id=1045 + if (gl.isGL2() || gl.isGL2ES1()) { + // must rescale image to get "top" mipmap texture image + final int pixFormat = JoglTextureUtil.getGLPixelFormat(image.getDataFormat()); + final int pixDataType = JoglTextureUtil.getGLPixelDataType(image.getDataType()); + final int bpp = ImageUtils.getPixelByteSize(image.getDataFormat(), image.getDataType()); + final ByteBuffer scaledImage = BufferUtils.createByteBuffer((w + 4) * h * bpp); + // ensure the buffer is ready for reading + image.getData(0).rewind(); + final int error = _glu.gluScaleImage(pixFormat, actualWidth, actualHeight, pixDataType, + image.getData(0), w, h, pixDataType, scaledImage); + if (error != 0) { + final int errorCode = gl.glGetError(); + if (errorCode != GL.GL_NO_ERROR) { + throw new GLException(_glu.gluErrorString(errorCode)); + } } - } - image.setWidth(w); - image.setHeight(h); - image.setData(scaledImage); + image.setWidth(w); + image.setHeight(h); + image.setData(scaledImage); + } else { + logger.warning("GLU cannot rescale the image"); + } } if (!texture.getMinificationFilter().usesMipMapLevels() && !texture.getTextureStoreFormat().isCompressed()) { @@ -218,17 +226,20 @@ public class JoglTextureStateUtil { gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), image.getHeight(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); break; case OneDimensional: // ensure the buffer is ready for reading image.getData(0).rewind(); // send top level to card - gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), - hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0, + JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), + image.getWidth(), hasBorder ? 1 : 0, + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + } break; case ThreeDimensional: if (caps.isTexture3DSupported()) { @@ -258,8 +269,8 @@ public class JoglTextureStateUtil { gl.getGL2GL3().glTexImage3D(GL2ES2.GL_TEXTURE_3D, 0, JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), image.getHeight(), image.getDepth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); } else { logger.warning("This card does not support Texture3D."); } @@ -275,9 +286,9 @@ public class JoglTextureStateUtil { gl.glTexImage2D(getGLCubeMapFace(face), 0, JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), image.getWidth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), - image.getData(face.ordinal())); + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), + image.getData(face.ordinal())); } } else { logger.warning("This card does not support Cubemaps."); @@ -298,7 +309,12 @@ public class JoglTextureStateUtil { if (caps.isAutomaticMipmapsSupported()) { // Flag the card to generate mipmaps - gl.glTexParameteri(getGLType(type), GL2ES1.GL_GENERATE_MIPMAP, GL.GL_TRUE); + if (gl.isGL2ES1()) { + final int glType = getGLType(texture.getType()); + if (glType != GL.GL_INVALID_ENUM) { + gl.glTexParameteri(glType, GL2ES1.GL_GENERATE_MIPMAP, GL.GL_TRUE); + } + } } switch (type) { @@ -310,15 +326,18 @@ public class JoglTextureStateUtil { gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), image.getHeight(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); } else { - // send to card - glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + // FIXME workaround for the bug 1045: https://jogamp.org/bugzilla/show_bug.cgi?id=1045 + if (gl.isGL2() /* || gl.isGL2ES1() */) { + // send to card + _glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, + JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), + image.getWidth(), image.getHeight(), + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + } } break; case OneDimensional: @@ -326,11 +345,13 @@ public class JoglTextureStateUtil { image.getData(0).rewind(); if (caps.isAutomaticMipmapsSupported()) { // send top level to card - gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0, + JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), + image.getWidth(), hasBorder ? 1 : 0, + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + } } else { // Note: JOGL's GLU class does not support // gluBuild1DMipmaps. @@ -368,8 +389,8 @@ public class JoglTextureStateUtil { gl.getGL2GL3().glTexImage3D(GL2ES2.GL_TEXTURE_3D, 0, JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), image.getHeight(), image.getDepth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); } else { // Note: JOGL's GLU class does not support // gluBuild3DMipmaps. @@ -393,21 +414,24 @@ public class JoglTextureStateUtil { gl.glTexImage2D(getGLCubeMapFace(face), 0, JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), image.getWidth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), - image.getData(face.ordinal())); + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), + image.getData(face.ordinal())); } } else { - for (final TextureCubeMap.Face face : TextureCubeMap.Face.values()) { - // ensure the buffer is ready for reading - image.getData(face.ordinal()).rewind(); - // send to card - glu.gluBuild2DMipmaps(getGLCubeMapFace(face), - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getWidth(), - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), - image.getData(face.ordinal())); + // FIXME workaround for the bug 1045: https://jogamp.org/bugzilla/show_bug.cgi?id=1045 + if (gl.isGL2() /* || gl.isGL2ES1() */) { + for (final TextureCubeMap.Face face : TextureCubeMap.Face.values()) { + // ensure the buffer is ready for reading + image.getData(face.ordinal()).rewind(); + // send to card + _glu.gluBuild2DMipmaps(getGLCubeMapFace(face), + JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), + image.getWidth(), image.getWidth(), + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), + image.getData(face.ordinal())); + } } } } else { @@ -463,8 +487,8 @@ public class JoglTextureStateUtil { gl.glTexImage2D(getGLCubeMapFace(face), m, JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), width, height, hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); } pos += mipSizes[m]; } @@ -490,10 +514,14 @@ public class JoglTextureStateUtil { gl.glTexParameteri(GL.GL_TEXTURE_2D, GL2ES3.GL_TEXTURE_MAX_LEVEL, max - 1); break; case ThreeDimensional: - gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL2ES3.GL_TEXTURE_MAX_LEVEL, max - 1); + if (gl.isGL2ES2()) { + gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL2ES3.GL_TEXTURE_MAX_LEVEL, max - 1); + } break; case OneDimensional: - gl.glTexParameteri(GL2GL3.GL_TEXTURE_1D, GL2ES3.GL_TEXTURE_MAX_LEVEL, max - 1); + if (gl.isGL2GL3()) { + gl.glTexParameteri(GL2GL3.GL_TEXTURE_1D, GL2ES3.GL_TEXTURE_MAX_LEVEL, max - 1); + } break; case CubeMap: break; @@ -549,36 +577,44 @@ public class JoglTextureStateUtil { gl.glTexImage2D(GL.GL_TEXTURE_2D, m, JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), width, height, hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); } break; case OneDimensional: if (texture.getTextureStoreFormat().isCompressed()) { - gl.getGL2GL3().glCompressedTexImage1D(GL2GL3.GL_TEXTURE_1D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, hasBorder ? 1 : 0, mipSizes[m], data); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glCompressedTexImage1D(GL2GL3.GL_TEXTURE_1D, m, + JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), + width, hasBorder ? 1 : 0, mipSizes[m], data); + } } else { - gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, m, + JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), + width, hasBorder ? 1 : 0, + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + } } break; case ThreeDimensional: final int depth = Math.max(1, image.getDepth() >> m); // already checked for support above... if (texture.getTextureStoreFormat().isCompressed()) { - gl.getGL2ES2().glCompressedTexImage3D(GL2ES2.GL_TEXTURE_3D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, depth, hasBorder ? 1 : 0, mipSizes[m], data); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glCompressedTexImage3D(GL2ES2.GL_TEXTURE_3D, m, + JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), + width, height, depth, hasBorder ? 1 : 0, mipSizes[m], data); + } } else { - gl.getGL2ES2().glTexImage3D(GL2ES2.GL_TEXTURE_3D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, depth, hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glTexImage3D(GL2ES2.GL_TEXTURE_3D, m, + JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), + width, height, depth, hasBorder ? 1 : 0, + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + } } break; case CubeMap: @@ -618,7 +654,9 @@ public class JoglTextureStateUtil { final int glHint = JoglTextureUtil.getPerspHint(state.getCorrectionType()); if (!record.isValid() || record.hint != glHint) { // set up correction mode - gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, glHint); + if (gl.isGL2ES1()) { + gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, glHint); + } record.hint = glHint; } @@ -685,7 +723,10 @@ public class JoglTextureStateUtil { // texture already exists in OpenGL, just bind it if needed if (!unitRecord.isValid() || unitRecord.boundTexture != textureId || fbo) { checkAndSetUnit(i, record, caps); - gl.glBindTexture(getGLType(type), textureId); + final int glType = getGLType(type); + if (glType != GL.GL_INVALID_ENUM) { + gl.glBindTexture(glType, textureId); + } if (Constants.stats) { StatCollector.addStat(StatType.STAT_TEXTURE_BINDS, 1); } @@ -712,7 +753,12 @@ public class JoglTextureStateUtil { // Enable 2D texturing on this unit if not enabled. if (!unitRecord.isValid() || !unitRecord.enabled[type.ordinal()]) { checkAndSetUnit(i, record, caps); - gl.glEnable(getGLType(type)); + final int glType = getGLType(type); + if (glType != GL.GL_INVALID_ENUM) { + if (!gl.isGLES2()) { + gl.glEnable(glType); + } + } unitRecord.enabled[type.ordinal()] = true; } @@ -805,7 +851,9 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || unitRecord.enabled[Type.OneDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); - gl.glDisable(GL2GL3.GL_TEXTURE_1D); + if (gl.isGL2GL3()) { + gl.glDisable(GL2GL3.GL_TEXTURE_1D); + } unitRecord.enabled[Type.OneDimensional.ordinal()] = false; } } @@ -844,7 +892,9 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || unitRecord.enabled[Type.OneDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); - gl.glDisable(GL2GL3.GL_TEXTURE_1D); + if (gl.isGL2GL3()) { + gl.glDisable(GL2GL3.GL_TEXTURE_1D); + } unitRecord.enabled[Type.OneDimensional.ordinal()] = false; } @@ -898,8 +948,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_RGB_SCALE, - texture.getCombineScaleRGB().floatValue()); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_RGB_SCALE, + texture.getCombineScaleRGB().floatValue()); + } unitRecord.envRGBScale = texture.getCombineScaleRGB(); } // Then Alpha Combine scale if (!unitRecord.isValid() || unitRecord.envAlphaScale != texture.getCombineScaleAlpha()) { @@ -907,8 +959,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_ALPHA_SCALE, - texture.getCombineScaleAlpha().floatValue()); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_ALPHA_SCALE, + texture.getCombineScaleAlpha().floatValue()); + } unitRecord.envAlphaScale = texture.getCombineScaleAlpha(); } @@ -919,8 +973,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_RGB, - JoglTextureUtil.getGLCombineFuncRGB(rgbCombineFunc)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_RGB, + JoglTextureUtil.getGLCombineFuncRGB(rgbCombineFunc)); + } unitRecord.rgbCombineFunc = rgbCombineFunc; } @@ -930,8 +986,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_RGB, - JoglTextureUtil.getGLCombineSrc(combSrcRGB)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_RGB, + JoglTextureUtil.getGLCombineSrc(combSrcRGB)); + } unitRecord.combSrcRGB0 = combSrcRGB; } @@ -941,8 +999,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_RGB, - JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_RGB, + JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); + } unitRecord.combOpRGB0 = combOpRGB; } @@ -955,8 +1015,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_RGB, - JoglTextureUtil.getGLCombineSrc(combSrcRGB)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_RGB, + JoglTextureUtil.getGLCombineSrc(combSrcRGB)); + } unitRecord.combSrcRGB1 = combSrcRGB; } @@ -966,8 +1028,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_RGB, - JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_RGB, + JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); + } unitRecord.combOpRGB1 = combOpRGB; } @@ -980,8 +1044,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_RGB, - JoglTextureUtil.getGLCombineSrc(combSrcRGB)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_RGB, + JoglTextureUtil.getGLCombineSrc(combSrcRGB)); + } unitRecord.combSrcRGB2 = combSrcRGB; } @@ -991,8 +1057,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_RGB, - JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_RGB, + JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); + } unitRecord.combOpRGB2 = combOpRGB; } @@ -1006,8 +1074,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_ALPHA, - JoglTextureUtil.getGLCombineFuncAlpha(alphaCombineFunc)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_ALPHA, + JoglTextureUtil.getGLCombineFuncAlpha(alphaCombineFunc)); + } unitRecord.alphaCombineFunc = alphaCombineFunc; } @@ -1017,8 +1087,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_ALPHA, - JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_ALPHA, + JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); + } unitRecord.combSrcAlpha0 = combSrcAlpha; } @@ -1028,8 +1100,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_ALPHA, - JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_ALPHA, + JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); + } unitRecord.combOpAlpha0 = combOpAlpha; } @@ -1042,8 +1116,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_ALPHA, - JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_ALPHA, + JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); + } unitRecord.combSrcAlpha1 = combSrcAlpha; } @@ -1053,8 +1129,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_ALPHA, - JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_ALPHA, + JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); + } unitRecord.combOpAlpha1 = combOpAlpha; } @@ -1067,8 +1145,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_ALPHA, - JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_ALPHA, + JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); + } unitRecord.combSrcAlpha2 = combSrcAlpha; } @@ -1078,8 +1158,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_ALPHA, - JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_ALPHA, + JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); + } unitRecord.combOpAlpha2 = combOpAlpha; } } @@ -1092,8 +1174,10 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || unitRecord.envMode != mode) { checkAndSetUnit(unit, record, caps); - gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, - JoglTextureUtil.getGLEnvMode(mode)); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, + JoglTextureUtil.getGLEnvMode(mode)); + } unitRecord.envMode = mode; } } @@ -1107,9 +1191,12 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); TextureRecord.colorBuffer.clear(); TextureRecord.colorBuffer.put(texBlend.getRed()).put(texBlend.getGreen()).put(texBlend.getBlue()) - .put(texBlend.getAlpha()); + .put(texBlend.getAlpha()); TextureRecord.colorBuffer.rewind(); - gl.getGL2ES1().glTexEnvfv(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_COLOR, TextureRecord.colorBuffer); + if (gl.isGL2ES1()) { + gl.getGL2ES1() + .glTexEnvfv(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_COLOR, TextureRecord.colorBuffer); + } unitRecord.blendColor.set(texBlend); } } @@ -1123,7 +1210,9 @@ public class JoglTextureStateUtil { .getMaxLodBias(); if (!unitRecord.isValid() || unitRecord.lodBias != bias) { checkAndSetUnit(unit, record, caps); - gl.getGL2ES1().glTexEnvf(GL2.GL_TEXTURE_FILTER_CONTROL, GL2GL3.GL_TEXTURE_LOD_BIAS, bias); + if (gl.isGL2ES1()) { + gl.getGL2ES1().glTexEnvf(GL2.GL_TEXTURE_FILTER_CONTROL, GL2GL3.GL_TEXTURE_LOD_BIAS, bias); + } unitRecord.lodBias = bias; } } @@ -1137,9 +1226,14 @@ public class JoglTextureStateUtil { if (!texRecord.isValid() || !texRecord.borderColor.equals(texBorder)) { TextureRecord.colorBuffer.clear(); TextureRecord.colorBuffer.put(texBorder.getRed()).put(texBorder.getGreen()).put(texBorder.getBlue()) - .put(texBorder.getAlpha()); + .put(texBorder.getAlpha()); TextureRecord.colorBuffer.rewind(); - gl.glTexParameterfv(getGLType(texture.getType()), GL2GL3.GL_TEXTURE_BORDER_COLOR, TextureRecord.colorBuffer); + if (gl.isGL2GL3()) { + final int glType = getGLType(texture.getType()); + if (glType != GL.GL_INVALID_ENUM) { + gl.glTexParameterfv(glType, GL2ES2.GL_TEXTURE_BORDER_COLOR, TextureRecord.colorBuffer); + } + } texRecord.borderColor.set(texBorder); } } @@ -1163,13 +1257,17 @@ public class JoglTextureStateUtil { record.tmp_matrixBuffer.rewind(); texture.getTextureMatrix().toDoubleBuffer(record.tmp_matrixBuffer, true); record.tmp_matrixBuffer.rewind(); - gl.getGL2().glLoadMatrixd(record.tmp_matrixBuffer); - + if (gl.isGL2()) { + gl.getGL2().glLoadMatrixd(record.tmp_matrixBuffer); + } + // FIXME use JoglRendererRecord.getMaxtrixBackend() with float buffers, stop using doubles record.units[unit].identityMatrix = false; } else if (needsReset) { checkAndSetUnit(unit, record, caps); JoglRendererUtil.switchMode(matRecord, GL.GL_TEXTURE); - gl.getGL2().glLoadIdentity(); + if (gl.isGL2()) { + gl.getGL2().glLoadIdentity(); + } record.units[unit].identityMatrix = true; } // Switch back to the modelview matrix for further operations @@ -1190,10 +1288,14 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2.GL_SPHERE_MAP) { checkAndSetUnit(unit, record, caps); - gl.getGL2().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_S, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP); + } unitRecord.textureGenSMode = GL2.GL_SPHERE_MAP; - gl.getGL2().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP); + } unitRecord.textureGenTMode = GL2.GL_SPHERE_MAP; } @@ -1201,33 +1303,45 @@ public class JoglTextureStateUtil { break; case NormalMap: // generate normals based texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2ES1.GL_NORMAL_MAP) { + if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2.GL_NORMAL_MAP) { checkAndSetUnit(unit, record, caps); - gl.getGL2().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP); - unitRecord.textureGenSMode = GL2ES1.GL_NORMAL_MAP; + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_S, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_NORMAL_MAP); + } + unitRecord.textureGenSMode = GL2.GL_NORMAL_MAP; - gl.getGL2().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP); - unitRecord.textureGenTMode = GL2ES1.GL_NORMAL_MAP; + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_NORMAL_MAP); + } + unitRecord.textureGenTMode = GL2.GL_NORMAL_MAP; - gl.getGL2().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP); - unitRecord.textureGenRMode = GL2ES1.GL_NORMAL_MAP; + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_R, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_NORMAL_MAP); + } + unitRecord.textureGenRMode = GL2.GL_NORMAL_MAP; } setTextureGen(unitRecord, unit, record, caps, true, true, true, false); break; case ReflectionMap: // generate reflection texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2ES1.GL_REFLECTION_MAP) { + if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2.GL_REFLECTION_MAP) { checkAndSetUnit(unit, record, caps); - gl.getGL2ES1().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_REFLECTION_MAP); - unitRecord.textureGenSMode = GL2ES1.GL_REFLECTION_MAP; + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_S, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_REFLECTION_MAP); + } + unitRecord.textureGenSMode = GL2.GL_REFLECTION_MAP; - gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_REFLECTION_MAP); - unitRecord.textureGenTMode = GL2ES1.GL_REFLECTION_MAP; + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_REFLECTION_MAP); + } + unitRecord.textureGenTMode = GL2.GL_REFLECTION_MAP; - gl.getGL2ES1().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_REFLECTION_MAP); - unitRecord.textureGenRMode = GL2ES1.GL_REFLECTION_MAP; + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_R, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_REFLECTION_MAP); + } + unitRecord.textureGenRMode = GL2.GL_REFLECTION_MAP; } setTextureGen(unitRecord, unit, record, caps, true, true, true, false); @@ -1238,27 +1352,43 @@ public class JoglTextureStateUtil { // generate eye linear texture coordinates if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2.GL_EYE_LINEAR) { - gl.getGL2ES1().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_S, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + } unitRecord.textureGenSMode = GL2.GL_EYE_LINEAR; - gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + } unitRecord.textureGenTMode = GL2.GL_EYE_LINEAR; - gl.getGL2ES1().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_R, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + } unitRecord.textureGenRMode = GL2.GL_EYE_LINEAR; - gl.getGL2ES1().glTexGeni(GL2.GL_Q, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_Q, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + } unitRecord.textureGenQMode = GL2.GL_EYE_LINEAR; } record.prepPlane(texture.getEnvPlaneS(), TextureStateRecord.DEFAULT_S_PLANE); - gl.getGL2ES1().glTexGenfv(GL2.GL_S, GL2.GL_EYE_PLANE, record.plane); + if (gl.isGL2()) { + gl.getGL2().glTexGenfv(GL2.GL_S, GL2.GL_EYE_PLANE, record.plane); + } record.prepPlane(texture.getEnvPlaneT(), TextureStateRecord.DEFAULT_T_PLANE); - gl.getGL2ES1().glTexGenfv(GL2.GL_T, GL2.GL_EYE_PLANE, record.plane); + if (gl.isGL2()) { + gl.getGL2().glTexGenfv(GL2.GL_T, GL2.GL_EYE_PLANE, record.plane); + } record.prepPlane(texture.getEnvPlaneR(), TextureStateRecord.DEFAULT_R_PLANE); - gl.getGL2ES1().glTexGenfv(GL2.GL_R, GL2.GL_EYE_PLANE, record.plane); + if (gl.isGL2()) { + gl.getGL2().glTexGenfv(GL2.GL_R, GL2.GL_EYE_PLANE, record.plane); + } record.prepPlane(texture.getEnvPlaneQ(), TextureStateRecord.DEFAULT_Q_PLANE); - gl.getGL2ES1().glTexGenfv(GL2.GL_Q, GL2.GL_EYE_PLANE, record.plane); + if (gl.isGL2()) { + gl.getGL2().glTexGenfv(GL2.GL_Q, GL2.GL_EYE_PLANE, record.plane); + } setTextureGen(unitRecord, unit, record, caps, true, true, true, true); break; @@ -1268,27 +1398,43 @@ public class JoglTextureStateUtil { // generate object linear texture coordinates if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2.GL_OBJECT_LINEAR) { - gl.getGL2ES1().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_S, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + } unitRecord.textureGenSMode = GL2.GL_OBJECT_LINEAR; - gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + } unitRecord.textureGenTMode = GL2.GL_OBJECT_LINEAR; - gl.getGL2ES1().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_R, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + } unitRecord.textureGenRMode = GL2.GL_OBJECT_LINEAR; - gl.getGL2ES1().glTexGeni(GL2.GL_Q, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + if (gl.isGL2()) { + gl.getGL2().glTexGeni(GL2.GL_Q, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + } unitRecord.textureGenQMode = GL2.GL_OBJECT_LINEAR; } record.prepPlane(texture.getEnvPlaneS(), TextureStateRecord.DEFAULT_S_PLANE); - gl.getGL2ES1().glTexGenfv(GL2.GL_S, GL2.GL_OBJECT_PLANE, record.plane); + if (gl.isGL2()) { + gl.getGL2().glTexGenfv(GL2.GL_S, GL2.GL_OBJECT_PLANE, record.plane); + } record.prepPlane(texture.getEnvPlaneT(), TextureStateRecord.DEFAULT_T_PLANE); - gl.getGL2ES1().glTexGenfv(GL2.GL_T, GL2.GL_OBJECT_PLANE, record.plane); + if (gl.isGL2()) { + gl.getGL2().glTexGenfv(GL2.GL_T, GL2.GL_OBJECT_PLANE, record.plane); + } record.prepPlane(texture.getEnvPlaneR(), TextureStateRecord.DEFAULT_R_PLANE); - gl.getGL2ES1().glTexGenfv(GL2.GL_R, GL2.GL_OBJECT_PLANE, record.plane); + if (gl.isGL2()) { + gl.getGL2().glTexGenfv(GL2.GL_R, GL2.GL_OBJECT_PLANE, record.plane); + } record.prepPlane(texture.getEnvPlaneQ(), TextureStateRecord.DEFAULT_Q_PLANE); - gl.getGL2ES1().glTexGenfv(GL2.GL_Q, GL2.GL_OBJECT_PLANE, record.plane); + if (gl.isGL2()) { + gl.getGL2().glTexGenfv(GL2.GL_Q, GL2.GL_OBJECT_PLANE, record.plane); + } setTextureGen(unitRecord, unit, record, caps, true, true, true, true); break; @@ -1302,58 +1448,89 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid()) { checkAndSetUnit(unit, record, caps); - if (genS) { - gl.glEnable(GL2.GL_TEXTURE_GEN_S); + if (gl.isGL2()) { + gl.glEnable(GL2.GL_TEXTURE_GEN_S); + } } else { - gl.glDisable(GL2.GL_TEXTURE_GEN_S); + if (gl.isGL2()) { + gl.glDisable(GL2.GL_TEXTURE_GEN_S); + } } if (genT) { - gl.glEnable(GL2.GL_TEXTURE_GEN_T); + if (gl.isGL2()) { + gl.glEnable(GL2.GL_TEXTURE_GEN_T); + } } else { - gl.glDisable(GL2.GL_TEXTURE_GEN_T); + if (gl.isGL2()) { + gl.glDisable(GL2.GL_TEXTURE_GEN_T); + } } if (genR) { - gl.glEnable(GL2.GL_TEXTURE_GEN_R); + if (gl.isGL2()) { + gl.glEnable(GL2.GL_TEXTURE_GEN_R); + } } else { - gl.glDisable(GL2.GL_TEXTURE_GEN_R); + if (gl.isGL2()) { + gl.glDisable(GL2.GL_TEXTURE_GEN_R); + } } if (genQ) { - gl.glEnable(GL2.GL_TEXTURE_GEN_Q); + if (gl.isGL2()) { + gl.glEnable(GL2.GL_TEXTURE_GEN_Q); + } } else { - gl.glDisable(GL2.GL_TEXTURE_GEN_Q); + if (gl.isGL2()) { + gl.glDisable(GL2.GL_TEXTURE_GEN_Q); + } } } else { if (genS != unitRecord.textureGenS) { checkAndSetUnit(unit, record, caps); if (genS) { - gl.glEnable(GL2.GL_TEXTURE_GEN_S); + if (gl.isGL2()) { + gl.glEnable(GL2.GL_TEXTURE_GEN_S); + } } else { - gl.glDisable(GL2.GL_TEXTURE_GEN_S); + if (gl.isGL2()) { + gl.glDisable(GL2.GL_TEXTURE_GEN_S); + } } } if (genT != unitRecord.textureGenT) { checkAndSetUnit(unit, record, caps); if (genT) { - gl.glEnable(GL2.GL_TEXTURE_GEN_T); + if (gl.isGL2()) { + gl.glEnable(GL2.GL_TEXTURE_GEN_T); + } } else { - gl.glDisable(GL2.GL_TEXTURE_GEN_T); + if (gl.isGL2()) { + gl.glDisable(GL2.GL_TEXTURE_GEN_T); + } } } if (genR != unitRecord.textureGenR) { checkAndSetUnit(unit, record, caps); if (genR) { - gl.glEnable(GL2.GL_TEXTURE_GEN_R); + if (gl.isGL2()) { + gl.glEnable(GL2.GL_TEXTURE_GEN_R); + } } else { - gl.glDisable(GL2.GL_TEXTURE_GEN_R); + if (gl.isGL2()) { + gl.glDisable(GL2.GL_TEXTURE_GEN_R); + } } } if (genQ != unitRecord.textureGenQ) { checkAndSetUnit(unit, record, caps); if (genQ) { - gl.glEnable(GL2.GL_TEXTURE_GEN_Q); + if (gl.isGL2()) { + gl.glEnable(GL2.GL_TEXTURE_GEN_Q); + } } else { - gl.glDisable(GL2.GL_TEXTURE_GEN_Q); + if (gl.isGL2()) { + gl.glDisable(GL2.GL_TEXTURE_GEN_Q); + } } } } @@ -1382,7 +1559,7 @@ public class JoglTextureStateUtil { /** * Check if the filter settings of this particular texture have been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1400,7 +1577,12 @@ public class JoglTextureStateUtil { // set up magnification filter if (!texRecord.isValid() || texRecord.depthTextureMode != depthMode) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(getGLType(type), GL2.GL_DEPTH_TEXTURE_MODE, depthMode); + if (gl.isGL2()) { + final int glType = getGLType(texture.getType()); + if (glType != GL.GL_INVALID_ENUM) { + gl.glTexParameteri(glType, GL2.GL_DEPTH_TEXTURE_MODE, depthMode); + } + } texRecord.depthTextureMode = depthMode; } } @@ -1426,7 +1608,7 @@ public class JoglTextureStateUtil { /** * Check if the filter settings of this particular texture have been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1443,7 +1625,10 @@ public class JoglTextureStateUtil { // set up magnification filter if (!texRecord.isValid() || texRecord.magFilter != magFilter) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(getGLType(type), GL.GL_TEXTURE_MAG_FILTER, magFilter); + final int glType = getGLType(texture.getType()); + if (glType != GL.GL_INVALID_ENUM) { + gl.glTexParameteri(glType, GL.GL_TEXTURE_MAG_FILTER, magFilter); + } texRecord.magFilter = magFilter; } @@ -1469,7 +1654,7 @@ public class JoglTextureStateUtil { /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1490,17 +1675,23 @@ public class JoglTextureStateUtil { if (!texRecord.isValid() || texRecord.wrapS != wrapS) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_S, wrapS); + if (gl.isGL2ES2()) { + gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_S, wrapS); + } texRecord.wrapS = wrapS; } if (!texRecord.isValid() || texRecord.wrapT != wrapT) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_T, wrapT); + if (gl.isGL2ES2()) { + gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_T, wrapT); + } texRecord.wrapT = wrapT; } if (!texRecord.isValid() || texRecord.wrapR != wrapR) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL2ES2.GL_TEXTURE_WRAP_R, wrapR); + if (gl.isGL2ES2()) { + gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL2ES2.GL_TEXTURE_WRAP_R, wrapR); + } texRecord.wrapR = wrapR; } @@ -1508,7 +1699,7 @@ public class JoglTextureStateUtil { /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1523,14 +1714,16 @@ public class JoglTextureStateUtil { if (!texRecord.isValid() || texRecord.wrapS != wrapS) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(GL2GL3.GL_TEXTURE_1D, GL.GL_TEXTURE_WRAP_S, wrapS); + if (gl.isGL2GL3()) { + gl.glTexParameteri(GL2GL3.GL_TEXTURE_1D, GL.GL_TEXTURE_WRAP_S, wrapS); + } texRecord.wrapS = wrapS; } } /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1552,7 +1745,7 @@ public class JoglTextureStateUtil { /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1581,7 +1774,7 @@ public class JoglTextureStateUtil { /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param cubeMap * our texture object * @param texRecord @@ -1685,7 +1878,10 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); final int id = texture.getTextureIdForContext(context.getGlContextRep()); - gl.glBindTexture(getGLType(texture.getType()), id); + final int glType = getGLType(texture.getType()); + if (glType != GL.GL_INVALID_ENUM) { + gl.glBindTexture(glType, id); + } if (Constants.stats) { StatCollector.addStat(StatType.STAT_TEXTURE_BINDS, 1); } @@ -1695,13 +1891,22 @@ public class JoglTextureStateUtil { } public static int getGLType(final Type type) { + final GL gl = GLContext.getCurrentGL(); switch (type) { case TwoDimensional: return GL.GL_TEXTURE_2D; case OneDimensional: - return GL2GL3.GL_TEXTURE_1D; + if (gl.isGL2GL3()) { + return GL2GL3.GL_TEXTURE_1D; + } else { + return GL.GL_INVALID_ENUM; + } case ThreeDimensional: - return GL2ES2.GL_TEXTURE_3D; + if (gl.isGL2ES2()) { + return GL2ES2.GL_TEXTURE_3D; + } else { + return GL.GL_INVALID_ENUM; + } case CubeMap: return GL.GL_TEXTURE_CUBE_MAP; case Rectangle: @@ -1754,7 +1959,7 @@ public class JoglTextureStateUtil { // FALLS THROUGH case BorderClamp: if (caps.isTextureBorderClampSupported()) { - return GL2GL3.GL_CLAMP_TO_BORDER; + return GL2ES2.GL_CLAMP_TO_BORDER; } else { return GL2.GL_CLAMP; } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java index 727d7ec..e18e68f 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -14,9 +14,9 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.logging.Logger; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLContext; import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.renderer.ContextManager; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java index 7172fc0..d30a47f 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,9 +10,9 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; @@ -58,26 +58,36 @@ public abstract class JoglWireframeStateUtil { if (record.isValid()) { if (frontMode == backMode && (record.frontMode != frontMode || record.backMode != backMode)) { - gl.getGL2GL3().glPolygonMode(GL.GL_FRONT_AND_BACK, frontMode); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glPolygonMode(GL.GL_FRONT_AND_BACK, frontMode); + } record.frontMode = frontMode; record.backMode = backMode; } else if (frontMode != backMode) { if (record.frontMode != frontMode) { - gl.getGL2GL3().glPolygonMode(GL.GL_FRONT, frontMode); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glPolygonMode(GL.GL_FRONT, frontMode); + } record.frontMode = frontMode; } if (record.backMode != backMode) { - gl.getGL2GL3().glPolygonMode(GL.GL_BACK, backMode); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glPolygonMode(GL.GL_BACK, backMode); + } record.backMode = backMode; } } } else { if (frontMode == backMode) { - gl.getGL2GL3().glPolygonMode(GL.GL_FRONT_AND_BACK, frontMode); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glPolygonMode(GL.GL_FRONT_AND_BACK, frontMode); + } } else if (frontMode != backMode) { - gl.getGL2GL3().glPolygonMode(GL.GL_FRONT, frontMode); - gl.getGL2GL3().glPolygonMode(GL.GL_BACK, backMode); + if (gl.isGL2GL3()) { + gl.getGL2GL3().glPolygonMode(GL.GL_FRONT, frontMode); + gl.getGL2GL3().glPolygonMode(GL.GL_BACK, backMode); + } } record.frontMode = frontMode; record.backMode = backMode; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java index 4763ced..c752fda 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,9 +10,9 @@ package com.ardor3d.scene.state.jogl; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.glu.GLU; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java index 3931796..90f3649 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,9 +12,9 @@ package com.ardor3d.scene.state.jogl.shader; import java.util.logging.Logger; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLContext; import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.renderer.ContextManager; @@ -106,8 +106,10 @@ public abstract class JoglShaderUtil { final GL gl = GLContext.getCurrentGL(); if (variable.variableID == -1) { - variable.variableID = gl.getGL2ES2().glGetUniformLocation(programID, variable.name); // TODO Check - // variable.name + if (gl.isGL2ES2()) { + variable.variableID = gl.getGL2ES2().glGetUniformLocation(programID, variable.name); // TODO Check + // variable.name + } if (variable.variableID == -1 && !variable.errorLogged) { logger.severe("Shader uniform [" + variable.name + "] could not be located in shader"); @@ -119,27 +121,35 @@ public abstract class JoglShaderUtil { private static void updateShaderUniform(final ShaderVariableInt shaderUniform) { final GL gl = GLContext.getCurrentGL(); - gl.getGL2ES2().glUniform1i(shaderUniform.variableID, shaderUniform.value1); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform1i(shaderUniform.variableID, shaderUniform.value1); + } } private static void updateShaderUniform(final ShaderVariableInt2 shaderUniform) { final GL gl = GLContext.getCurrentGL(); - gl.getGL2ES2().glUniform2i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform2i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); + } } private static void updateShaderUniform(final ShaderVariableInt3 shaderUniform) { final GL gl = GLContext.getCurrentGL(); - gl.getGL2ES2().glUniform3i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, - shaderUniform.value3); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform3i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, + shaderUniform.value3); + } } private static void updateShaderUniform(final ShaderVariableInt4 shaderUniform) { final GL gl = GLContext.getCurrentGL(); - gl.getGL2ES2().glUniform4i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, - shaderUniform.value3, shaderUniform.value4); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform4i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, + shaderUniform.value3, shaderUniform.value4); + } } private static void updateShaderUniform(final ShaderVariableIntArray shaderUniform) { @@ -147,20 +157,28 @@ public abstract class JoglShaderUtil { switch (shaderUniform.size) { case 1: - gl.getGL2ES2().glUniform1iv(shaderUniform.variableID, shaderUniform.value.remaining(), - shaderUniform.value); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform1iv(shaderUniform.variableID, shaderUniform.value.remaining(), + shaderUniform.value); + } break; case 2: - gl.getGL2ES2().glUniform2iv(shaderUniform.variableID, shaderUniform.value.remaining(), - shaderUniform.value); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform2iv(shaderUniform.variableID, shaderUniform.value.remaining(), + shaderUniform.value); + } break; case 3: - gl.getGL2ES2().glUniform3iv(shaderUniform.variableID, shaderUniform.value.remaining(), - shaderUniform.value); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform3iv(shaderUniform.variableID, shaderUniform.value.remaining(), + shaderUniform.value); + } break; case 4: - gl.getGL2ES2().glUniform4iv(shaderUniform.variableID, shaderUniform.value.remaining(), - shaderUniform.value); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform4iv(shaderUniform.variableID, shaderUniform.value.remaining(), + shaderUniform.value); + } break; default: throw new IllegalArgumentException("Wrong size: " + shaderUniform.size); @@ -170,27 +188,35 @@ public abstract class JoglShaderUtil { private static void updateShaderUniform(final ShaderVariableFloat shaderUniform) { final GL gl = GLContext.getCurrentGL(); - gl.getGL2ES2().glUniform1f(shaderUniform.variableID, shaderUniform.value1); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform1f(shaderUniform.variableID, shaderUniform.value1); + } } private static void updateShaderUniform(final ShaderVariableFloat2 shaderUniform) { final GL gl = GLContext.getCurrentGL(); - gl.getGL2ES2().glUniform2f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform2f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); + } } private static void updateShaderUniform(final ShaderVariableFloat3 shaderUniform) { final GL gl = GLContext.getCurrentGL(); - gl.getGL2ES2().glUniform3f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, - shaderUniform.value3); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform3f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, + shaderUniform.value3); + } } private static void updateShaderUniform(final ShaderVariableFloat4 shaderUniform) { final GL gl = GLContext.getCurrentGL(); - gl.getGL2ES2().glUniform4f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, - shaderUniform.value3, shaderUniform.value4); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform4f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, + shaderUniform.value3, shaderUniform.value4); + } } private static void updateShaderUniform(final ShaderVariableFloatArray shaderUniform) { @@ -198,20 +224,28 @@ public abstract class JoglShaderUtil { switch (shaderUniform.size) { case 1: - gl.getGL2ES2().glUniform1fv(shaderUniform.variableID, shaderUniform.value.remaining(), - shaderUniform.value); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform1fv(shaderUniform.variableID, shaderUniform.value.remaining(), + shaderUniform.value); + } break; case 2: - gl.getGL2ES2().glUniform2fv(shaderUniform.variableID, shaderUniform.value.remaining(), - shaderUniform.value); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform2fv(shaderUniform.variableID, shaderUniform.value.remaining(), + shaderUniform.value); + } break; case 3: - gl.getGL2ES2().glUniform3fv(shaderUniform.variableID, shaderUniform.value.remaining(), - shaderUniform.value); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform3fv(shaderUniform.variableID, shaderUniform.value.remaining(), + shaderUniform.value); + } break; case 4: - gl.getGL2ES2().glUniform4fv(shaderUniform.variableID, shaderUniform.value.remaining(), - shaderUniform.value); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniform4fv(shaderUniform.variableID, shaderUniform.value.remaining(), + shaderUniform.value); + } break; default: throw new IllegalArgumentException("Wrong size: " + shaderUniform.size); @@ -222,24 +256,30 @@ public abstract class JoglShaderUtil { final GL gl = GLContext.getCurrentGL(); shaderUniform.matrixBuffer.rewind(); - gl.getGL2ES2().glUniformMatrix2fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, - shaderUniform.matrixBuffer); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniformMatrix2fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, + shaderUniform.matrixBuffer); + } } private static void updateShaderUniform(final ShaderVariableMatrix3 shaderUniform) { final GL gl = GLContext.getCurrentGL(); shaderUniform.matrixBuffer.rewind(); - gl.getGL2ES2().glUniformMatrix3fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, - shaderUniform.matrixBuffer); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniformMatrix3fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, + shaderUniform.matrixBuffer); + } } private static void updateShaderUniform(final ShaderVariableMatrix4 shaderUniform) { final GL gl = GLContext.getCurrentGL(); shaderUniform.matrixBuffer.rewind(); - gl.getGL2ES2().glUniformMatrix4fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, - shaderUniform.matrixBuffer); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniformMatrix4fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, + shaderUniform.matrixBuffer); + } } private static void updateShaderUniform(final ShaderVariableMatrix4Array shaderUniform) { @@ -247,8 +287,10 @@ public abstract class JoglShaderUtil { shaderUniform.matrixBuffer.rewind(); // count == number of matrices we are sending, or iotw, limit / 16 - gl.getGL2ES2().glUniformMatrix4fv(shaderUniform.variableID, shaderUniform.matrixBuffer.limit() >> 4, - shaderUniform.rowMajor, shaderUniform.matrixBuffer); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glUniformMatrix4fv(shaderUniform.variableID, shaderUniform.matrixBuffer.limit() >> 4, + shaderUniform.rowMajor, shaderUniform.matrixBuffer); + } } /** @@ -263,8 +305,10 @@ public abstract class JoglShaderUtil { final GL gl = GLContext.getCurrentGL(); if (variable.variableID == -1) { - variable.variableID = gl.getGL2ES2().glGetAttribLocation(programID, variable.name); // TODO Check - // variable.name + if (gl.isGL2ES2()) { + variable.variableID = gl.getGL2ES2().glGetAttribLocation(programID, variable.name); // TODO Check + // variable.name + } if (variable.variableID == -1 && !variable.errorLogged) { logger.severe("Shader attribute [" + variable.name + "] could not be located in shader"); @@ -335,12 +379,16 @@ public abstract class JoglShaderUtil { private static void enableVertexAttribute(final ShaderVariable var, final ShaderObjectsStateRecord record) { if (!record.enabledAttributes.contains(var)) { + final GL gl = GLContext.getCurrentGL(); if (var.getSize() == 1) { - GLContext.getCurrentGL().getGL2ES2().glEnableVertexAttribArray(var.variableID); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glEnableVertexAttribArray(var.variableID); + } } else { - final GL gl = GLContext.getCurrentGL(); - for (int i = 0, max = var.getSize(); i < max; i++) { - gl.getGL2ES2().glEnableVertexAttribArray(var.variableID + i); + if (gl.isGL2ES2()) { + for (int i = 0, max = var.getSize(); i < max; i++) { + gl.getGL2ES2().glEnableVertexAttribArray(var.variableID + i); + } } } record.enabledAttributes.add(var); @@ -350,22 +398,21 @@ public abstract class JoglShaderUtil { private static void updateShaderAttribute(final ShaderVariablePointerFloat variable, final ShaderObjectsStateRecord record, final boolean useVBO) { enableVertexAttribute(variable, record); + final GL gl = GLContext.getCurrentGL(); if (useVBO) { final RenderContext context = ContextManager.getCurrentContext(); final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - GLContext - .getCurrentGL() - .getGL2ES2() - .glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized, - variable.stride, 0); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, + variable.normalized, variable.stride, 0); + } } else { variable.data.getBuffer().rewind(); - GLContext - .getCurrentGL() - .getGL2() - .glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized, - variable.stride, variable.data.getBuffer()); + if (gl.isGL2()) { + gl.getGL2().glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized, + variable.stride, variable.data.getBuffer()); + } } } @@ -382,13 +429,17 @@ public abstract class JoglShaderUtil { if (useVBO) { final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - gl.getGL2ES2().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized, - 0, pos); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, + variable.normalized, 0, pos); + } } else { variable.data.getBuffer().limit(pos + length - 1); variable.data.getBuffer().position(pos); - gl.getGL2().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized, 0, - variable.data.getBuffer()); + if (gl.isGL2()) { + gl.getGL2().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized, + 0, variable.data.getBuffer()); + } } } } @@ -396,72 +447,70 @@ public abstract class JoglShaderUtil { private static void updateShaderAttribute(final ShaderVariablePointerByte variable, final ShaderObjectsStateRecord record, final boolean useVBO) { enableVertexAttribute(variable, record); + final GL gl = GLContext.getCurrentGL(); if (useVBO) { final RenderContext context = ContextManager.getCurrentContext(); final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - GLContext - .getCurrentGL() - .getGL2ES2() - .glVertexAttribPointer(variable.variableID, variable.size, - variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride, - 0); + if (gl.isGL2ES2()) { + gl.getGL2ES2().glVertexAttribPointer(variable.variableID, variable.size, + variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride, 0); + } } else { variable.data.getBuffer().rewind(); - GLContext - .getCurrentGL() - .getGL2() - .glVertexAttribPointer(variable.variableID, variable.size, - variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride, - variable.data.getBuffer()); + if (gl.isGL2()) { + gl.getGL2().glVertexAttribPointer(variable.variableID, variable.size, + variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride, + variable.data.getBuffer()); + } } } private static void updateShaderAttribute(final ShaderVariablePointerInt variable, final ShaderObjectsStateRecord record, final boolean useVBO) { enableVertexAttribute(variable, record); + final GL gl = GLContext.getCurrentGL(); if (useVBO) { final RenderContext context = ContextManager.getCurrentContext(); final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - GLContext - .getCurrentGL() - .getGL2ES2() - .glVertexAttribPointer(variable.variableID, variable.size, - variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, - variable.stride, 0); + if (gl.isGL2ES2()) { + gl.getGL2ES2() + .glVertexAttribPointer(variable.variableID, variable.size, + variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, + variable.stride, 0); + } } else { variable.data.getBuffer().rewind(); - GLContext - .getCurrentGL() - .getGL2() - .glVertexAttribPointer(variable.variableID, variable.size, - variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, - variable.stride, variable.data.getBuffer()); + if (gl.isGL2()) { + gl.getGL2().glVertexAttribPointer(variable.variableID, variable.size, + variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, variable.stride, + variable.data.getBuffer()); + } } } private static void updateShaderAttribute(final ShaderVariablePointerShort variable, final ShaderObjectsStateRecord record, final boolean useVBO) { enableVertexAttribute(variable, record); + final GL gl = GLContext.getCurrentGL(); if (useVBO) { final RenderContext context = ContextManager.getCurrentContext(); final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - GLContext - .getCurrentGL() - .getGL2ES2() - .glVertexAttribPointer(variable.variableID, variable.size, - variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, - variable.stride, 0); + if (gl.isGL2ES2()) { + gl.getGL2ES2() + .glVertexAttribPointer(variable.variableID, variable.size, + variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, + variable.stride, 0); + } } else { variable.data.getBuffer().rewind(); - GLContext - .getCurrentGL() - .getGL2() - .glVertexAttribPointer(variable.variableID, variable.size, - variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, - variable.stride, variable.data.getBuffer()); + if (gl.isGL2()) { + gl.getGL2().glVertexAttribPointer(variable.variableID, variable.size, + variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, variable.stride, + variable.data.getBuffer()); + } } } } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java index 92b416a..dd4d06f 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,8 +12,8 @@ package com.ardor3d.scene.state.jogl.util; import java.util.Stack; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; import com.ardor3d.math.Rectangle2; import com.ardor3d.math.type.ReadOnlyRectangle2; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java index e82b96d..ef8e666 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,11 +10,11 @@ package com.ardor3d.scene.state.jogl.util; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; import com.ardor3d.image.ImageDataFormat; import com.ardor3d.image.PixelDataType; diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/util/geom/jogl/DirectNioBuffersSet.java b/ardor3d-jogl/src/main/java/com/ardor3d/util/geom/jogl/DirectNioBuffersSet.java index c4a7264..dd61350 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/util/geom/jogl/DirectNioBuffersSet.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/util/geom/jogl/DirectNioBuffersSet.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2010 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-lwjgl/nb-configuration.xml b/ardor3d-lwjgl/nb-configuration.xml deleted file mode 100644 index 94f6e40..0000000 --- a/ardor3d-lwjgl/nb-configuration.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project-shared-configuration> - <!-- -This file contains additional configuration written by modules in the NetBeans IDE. -The configuration is intended to be shared among all the users of project and -therefore it is assumed to be part of version control checkout. -Without this configuration present, some functionality in the IDE may be limited or fail altogether. ---> - <config-data xmlns="http://www.netbeans.org/ns/maven-config-data/1"> - <configurations/> - </config-data> -</project-shared-configuration> diff --git a/ardor3d-lwjgl/nbactions-linux-x86.xml b/ardor3d-lwjgl/nbactions-linux-x86.xml deleted file mode 100644 index 7e45b8a..0000000 --- a/ardor3d-lwjgl/nbactions-linux-x86.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>run</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-classpath %classpath ${packageClassName}</exec.args> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>debug</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName}</exec.args> - <jpda.listen>true</jpda.listen> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>profile</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.args>${profiler.args}-classpath %classpath ${packageClassName}</exec.args> - <profiler.action>profile</profiler.action> - <exec.executable>${profiler.java}</exec.executable> - </properties> - </action> - </actions> diff --git a/ardor3d-lwjgl/nbactions-linux-x86_64.xml b/ardor3d-lwjgl/nbactions-linux-x86_64.xml deleted file mode 100644 index 7e45b8a..0000000 --- a/ardor3d-lwjgl/nbactions-linux-x86_64.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>run</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-classpath %classpath ${packageClassName}</exec.args> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>debug</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName}</exec.args> - <jpda.listen>true</jpda.listen> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>profile</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.args>${profiler.args}-classpath %classpath ${packageClassName}</exec.args> - <profiler.action>profile</profiler.action> - <exec.executable>${profiler.java}</exec.executable> - </properties> - </action> - </actions> diff --git a/ardor3d-lwjgl/nbactions-macosx.xml b/ardor3d-lwjgl/nbactions-macosx.xml deleted file mode 100644 index 0cbaa2a..0000000 --- a/ardor3d-lwjgl/nbactions-macosx.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>run</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-classpath %classpath ${packageClassName}</exec.args> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>debug</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName}</exec.args> - <jpda.listen>true</jpda.listen> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>profile</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.args>${profiler.args} -classpath %classpath ${packageClassName}</exec.args> - <profiler.action>profile</profiler.action> - <exec.executable>${profiler.java}</exec.executable> - </properties> - </action> - </actions> diff --git a/ardor3d-lwjgl/nbactions-solaris-sparc.xml b/ardor3d-lwjgl/nbactions-solaris-sparc.xml deleted file mode 100644 index 7e45b8a..0000000 --- a/ardor3d-lwjgl/nbactions-solaris-sparc.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>run</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-classpath %classpath ${packageClassName}</exec.args> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>debug</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName}</exec.args> - <jpda.listen>true</jpda.listen> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>profile</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.args>${profiler.args}-classpath %classpath ${packageClassName}</exec.args> - <profiler.action>profile</profiler.action> - <exec.executable>${profiler.java}</exec.executable> - </properties> - </action> - </actions> diff --git a/ardor3d-lwjgl/nbactions-solaris-x86.xml b/ardor3d-lwjgl/nbactions-solaris-x86.xml deleted file mode 100644 index 7e45b8a..0000000 --- a/ardor3d-lwjgl/nbactions-solaris-x86.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>run</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-classpath %classpath ${packageClassName}</exec.args> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>debug</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName}</exec.args> - <jpda.listen>true</jpda.listen> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>profile</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.args>${profiler.args}-classpath %classpath ${packageClassName}</exec.args> - <profiler.action>profile</profiler.action> - <exec.executable>${profiler.java}</exec.executable> - </properties> - </action> - </actions> diff --git a/ardor3d-lwjgl/nbactions-win32.xml b/ardor3d-lwjgl/nbactions-win32.xml deleted file mode 100644 index cf5aba7..0000000 --- a/ardor3d-lwjgl/nbactions-win32.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>run</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-classpath %classpath ${packageClassName}</exec.args> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>debug</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName}</exec.args> - <jpda.listen>true</jpda.listen> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>profile</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.args>${profiler.args}-classpath %classpath ${packageClassName}</exec.args> - <profiler.action>profile</profiler.action> - <exec.executable>${profiler.java}</exec.executable> - </properties> - </action> - <action> - <actionName>build</actionName> - <goals> - <goal>install</goal> - </goals> - <properties> - </properties> - </action> - - </actions> diff --git a/ardor3d-lwjgl/nbactions-win64.xml b/ardor3d-lwjgl/nbactions-win64.xml deleted file mode 100644 index 9d3cac4..0000000 --- a/ardor3d-lwjgl/nbactions-win64.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>run</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-classpath %classpath ${packageClassName}</exec.args> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>debug</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.classpathScope>runtime</exec.classpathScope> - <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} %classpath ${packageClassName}</exec.args> - <jpda.listen>true</jpda.listen> - <exec.executable>java</exec.executable> - </properties> - </action> - <action> - <actionName>profile</actionName> - <goals> - <goal>process-classes</goal> - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> - </goals> - <properties> - <exec.args>${profiler.args}-classpath %classpath ${packageClassName}</exec.args> - <profiler.action>profile</profiler.action> - <exec.executable>${profiler.java}</exec.executable> - </properties> - </action> - </actions> diff --git a/ardor3d-lwjgl/nbactions.xml b/ardor3d-lwjgl/nbactions.xml deleted file mode 100644 index 79c20a8..0000000 --- a/ardor3d-lwjgl/nbactions.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>build</actionName> - <goals> - <goal>install</goal> - </goals> - </action> - </actions> diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglAwtCanvas.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglAwtCanvas.java deleted file mode 100644 index e3387f2..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglAwtCanvas.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.framework.lwjgl; - -import java.util.concurrent.CountDownLatch; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.AWTGLCanvas; -import org.lwjgl.opengl.PixelFormat; - -import com.ardor3d.annotation.MainThread; -import com.ardor3d.framework.Canvas; -import com.ardor3d.framework.DisplaySettings; - -public class LwjglAwtCanvas extends AWTGLCanvas implements Canvas { - - private static final long serialVersionUID = 1L; - - private final LwjglCanvasRenderer _canvasRenderer; - private boolean _inited = false; - private final DisplaySettings _settings; - - private volatile boolean _updated = false; - // _latch would have to be volatile if we are not careful with the order of reads and writes between this one and - // '_updated' - private CountDownLatch _latch = null; - - public LwjglAwtCanvas(final DisplaySettings settings, final LwjglCanvasRenderer canvasRenderer) - throws LWJGLException { - super(new PixelFormat(settings.getColorDepth(), settings.getAlphaBits(), settings.getDepthBits(), settings - .getStencilBits(), settings.getSamples()).withStereo(settings.isStereo())); - _settings = settings; - _canvasRenderer = canvasRenderer; - _canvasRenderer.setCanvasCallback(new LwjglCanvasCallback() { - @Override - public void makeCurrent() throws LWJGLException { - LwjglAwtCanvas.this.makeCurrent(); - } - - @Override - public void releaseContext() throws LWJGLException { - LwjglAwtCanvas.this.releaseContext(); - } - }); - } - - public void draw(final CountDownLatch latch) { - if (!shouldDraw(latch)) { - latch.countDown(); - return; - } - - // need to set _latch before _updated, for memory consistency reasons - _latch = latch; - _updated = true; - repaint(); - } - - private boolean shouldDraw(final CountDownLatch latch) { - final boolean showing = isShowing(); - final boolean lastUpdateComplete = latch == null || !_updated; - return showing && lastUpdateComplete; - } - - @Override - @MainThread - protected void paintGL() { - if (!_inited) { - _canvasRenderer.init(_settings, false); // false - do not do back buffer swap, awt will do that. - _canvasRenderer.getCamera().resize(getWidth(), getHeight()); - _inited = true; - } - - if (_latch != null && !_updated) { - return; - } - - try { - if (_canvasRenderer.draw()) { - swapBuffers(); - } - } catch (final LWJGLException e) { - throw new RuntimeException(e); - } finally { - // release our context - because swap is external, we release here instead. - _canvasRenderer.releaseCurrentContext(); - } - - if (_latch != null) { - _updated = false; - _latch.countDown(); - } - } - - public void init() { - ; // ignore - can only be inited inside our paintGL - } - - public LwjglCanvasRenderer getCanvasRenderer() { - return _canvasRenderer; - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvas.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvas.java deleted file mode 100644 index 7fe8b9f..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvas.java +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.framework.lwjgl; - -import java.nio.ByteBuffer; -import java.util.concurrent.CountDownLatch; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.DisplayMode; -import org.lwjgl.opengl.PixelFormat; - -import com.ardor3d.annotation.MainThread; -import com.ardor3d.framework.CanvasRenderer; -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.framework.NativeCanvas; -import com.ardor3d.image.Image; -import com.ardor3d.image.ImageDataFormat; -import com.ardor3d.image.PixelDataType; -import com.ardor3d.input.FocusWrapper; -import com.ardor3d.util.Ardor3dException; -import com.ardor3d.util.geom.BufferUtils; - -/** - * A canvas implementation for use with native LWJGL windows. - */ -public class LwjglCanvas implements NativeCanvas, FocusWrapper { - private static final Logger logger = Logger.getLogger(LwjglCanvas.class.getName()); - - private final LwjglCanvasRenderer _canvasRenderer; - - private final DisplaySettings _settings; - private boolean _inited = false; - - private volatile boolean _focusLost = false; - - /** - * If true, we will not try to drop and reclaim the context on each frame. - */ - public static boolean SINGLE_THREADED_MODE = true; - - public LwjglCanvas(final DisplaySettings settings, final LwjglCanvasRenderer canvasRenderer) { - _canvasRenderer = canvasRenderer; - _canvasRenderer.setCanvasCallback(new LwjglCanvasCallback() { - @Override - public void makeCurrent() throws LWJGLException { - if (!SINGLE_THREADED_MODE) { - Display.makeCurrent(); - } - } - - @Override - public void releaseContext() throws LWJGLException { - if (!SINGLE_THREADED_MODE) { - Display.releaseContext(); - } - } - }); - _settings = settings; - } - - public boolean getAndClearFocusLost() { - final boolean result = _focusLost; - - _focusLost = false; - - return result; - } - - @MainThread - // hm, seem to have to control the order of initialization: display first, then keyboard/etc, in native windows - public void init() { - if (_inited) { - return; - } - - // create the Display. - DisplayMode mode; - if (_settings.isFullScreen()) { - mode = getValidDisplayMode(_settings); - if (null == mode) { - throw new Ardor3dException("Bad display mode (w/h/bpp/freq): " + _settings.getWidth() + " / " - + _settings.getHeight() + " / " + _settings.getColorDepth() + " / " + _settings.getFrequency()); - } - } else { - mode = new DisplayMode(_settings.getWidth(), _settings.getHeight()); - } - - final PixelFormat format = new PixelFormat(_settings.getAlphaBits(), _settings.getDepthBits(), - _settings.getStencilBits()).withSamples(_settings.getSamples()).withStereo(_settings.isStereo()); - - try { - Display.setDisplayMode(mode); - Display.setFullscreen(_settings.isFullScreen()); - Display.create(format); - } catch (final Exception e) { - logger.severe("Cannot create window"); - logger.logp(Level.SEVERE, this.getClass().toString(), "initDisplay()", "Exception", e); - throw new Ardor3dException("Cannot create window: " + e.getMessage()); - } - - _canvasRenderer.init(_settings, true); // true - do swap in renderer. - _inited = true; - } - - @MainThread - public void draw(final CountDownLatch latch) { - if (!_inited) { - init(); - } - - checkFocus(); - - _canvasRenderer.draw(); - - if (latch != null) { - latch.countDown(); - } - } - - private void checkFocus() { - // focusLost should be true if it is already true (hasn't been read/cleared yet), or - // the display is presently not in focus - _focusLost = _focusLost || !(Display.isActive() && Display.isVisible()); - - // - // final boolean newFocus = - // - // if (!focusLost && newFocus) { - // // didn't use to have focus, but now we do - // // do nothing for now, just keep track of the fact that we have focus - // focusLost = newFocus; - // } else if (focusLost && !newFocus) { - // // had focus, but don't anymore - notify the physical input layer - // physicalLayer.lostFocus(); - // focusLost = newFocus; - // } - } - - public CanvasRenderer getCanvasRenderer() { - return _canvasRenderer; - } - - /** - * @return a <code>DisplayMode</code> object that has the requested settings. If there is no mode that supports a - * requested resolution, null is returned. - */ - private DisplayMode getValidDisplayMode(final DisplaySettings settings) { - // get all the modes, and find one that matches our settings. - DisplayMode[] modes; - try { - modes = Display.getAvailableDisplayModes(); - } catch (final LWJGLException e) { - logger.logp(Level.SEVERE, this.getClass().toString(), "getValidDisplayMode(width, height, bpp, freq)", - "Exception", e); - return null; - } - - // Try to find a best match. - int best_match = -1; // looking for request size/bpp followed by exact or highest freq - int match_freq = -1; - for (int i = 0; i < modes.length; i++) { - if (modes[i].getWidth() != settings.getWidth()) { - logger.fine("DisplayMode " + modes[i] + ": Width != " + settings.getWidth()); - continue; - } - if (modes[i].getHeight() != settings.getHeight()) { - logger.fine("DisplayMode " + modes[i] + ": Height != " + settings.getHeight()); - continue; - } - if (settings.getColorDepth() != 0 && modes[i].getBitsPerPixel() != settings.getColorDepth()) { - // should pick based on best match here too - logger.fine("DisplayMode " + modes[i] + ": Bits per pixel != " + settings.getColorDepth()); - continue; - } - if (best_match == -1) { - logger.fine("DisplayMode " + modes[i] + ": Match! "); - best_match = i; - match_freq = modes[i].getFrequency(); - } else { - final int cur_freq = modes[i].getFrequency(); - if (match_freq != settings.getFrequency() && // Previous is not a perfect match - (cur_freq == settings.getFrequency() || // Current is perfect match - match_freq < cur_freq)) // or is higher freq - { - logger.fine("DisplayMode " + modes[i] + ": Better match!"); - best_match = i; - match_freq = cur_freq; - } - } - } - - if (best_match == -1) { - return null; // none found; - } else { - logger.info("Selected DisplayMode: " + modes[best_match]); - return modes[best_match]; - } - } - - public void close() { - if (Display.isCreated()) { - Display.destroy(); - } - } - - public boolean isActive() { - return Display.isCreated() && Display.isActive(); - } - - @MainThread - public boolean isClosing() { - return Display.isCreated() && Display.isCloseRequested(); - } - - public void moveWindowTo(final int locX, final int locY) { - if (Display.isCreated()) { - Display.setLocation(locX, locY); - } - } - - public void setIcon(final Image[] iconImages) { - final ByteBuffer[] iconData = new ByteBuffer[iconImages.length]; - for (int i = 0; i < iconData.length; i++) { - // Image.Format.RGBA8 is the format that LWJGL requires, so try to convert if it's not. - if (iconImages[i].getDataType() != PixelDataType.UnsignedByte) { - throw new Ardor3dException( - "Your icon is in a format that could not be converted to UnsignedByte - RGBA"); - } - - if (iconImages[i].getDataFormat() != ImageDataFormat.RGBA) { - if (iconImages[i].getDataFormat() != ImageDataFormat.RGB) { - throw new Ardor3dException( - "Your icon is in a format that could not be converted to UnsignedByte - RGBA"); - } - iconImages[i] = _RGB888_to_RGBA8888(iconImages[i]); - } - - iconData[i] = iconImages[i].getData(0); - iconData[i].rewind(); - } - Display.setIcon(iconData); - } - - private static Image _RGB888_to_RGBA8888(final Image rgb888) { - final int size = rgb888.getWidth() * rgb888.getHeight() * 4; - - final ByteBuffer rgb = rgb888.getData(0); - - final ByteBuffer rgba8888 = BufferUtils.createByteBuffer(size); - rgb.rewind(); - for (int j = 0; j < size; j++) { - if ((j + 1) % 4 == 0) { - rgba8888.put((byte) 0xFF); - } else { - rgba8888.put(rgb.get()); - } - } - return new Image(ImageDataFormat.RGBA, PixelDataType.UnsignedByte, rgb888.getWidth(), rgb888.getHeight(), - rgba8888, null); - } - - public void setTitle(final String title) { - Display.setTitle(title); - } - - public void setVSyncEnabled(final boolean enabled) { - Display.setVSyncEnabled(enabled); - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasCallback.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasCallback.java deleted file mode 100644 index a65c7e2..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasCallback.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.framework.lwjgl; - -import org.lwjgl.LWJGLException; - -public interface LwjglCanvasCallback { - - /** - * Request this canvas as the current opengl owner. - * - * @throws LWJGLException - */ - void makeCurrent() throws LWJGLException; - - /** - * Release this canvas as the current opengl owner. - * - * @throws LWJGLException - */ - void releaseContext() throws LWJGLException; - -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasRenderer.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasRenderer.java deleted file mode 100644 index 9bcc2ee..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasRenderer.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.framework.lwjgl; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.ARBMultisample; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GLContext; - -import com.ardor3d.annotation.MainThread; -import com.ardor3d.framework.CanvasRenderer; -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.framework.Scene; -import com.ardor3d.math.ColorRGBA; -import com.ardor3d.math.Vector3; -import com.ardor3d.renderer.Camera; -import com.ardor3d.renderer.Camera.ProjectionMode; -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.lwjgl.LwjglContextCapabilities; -import com.ardor3d.renderer.lwjgl.LwjglRenderer; -import com.ardor3d.util.Ardor3dException; - -public class LwjglCanvasRenderer implements CanvasRenderer { - protected Scene _scene; - protected Camera _camera; - protected boolean _doSwap; - protected LwjglRenderer _renderer; - protected Object _context = new Object(); - protected int _frameClear = Renderer.BUFFER_COLOR_AND_DEPTH; - - private RenderContext _currentContext; - private LwjglCanvasCallback _canvasCallback; - - // NOTE: This code commented out by Petter 090224, since it isn't really ready to be used, - // and since it is at the moment more work than it is worth to get it ready. Later on, when - // we have solved some more fundamental problems, it is probably time to revisit this. - - // ensure availability of LWJGL natives - // { - // final String[] libraryPaths = LwjglLibraryPaths.getLibraryPaths(System.getProperty("os.name"), System - // .getProperty("os.arch")); - // - // try { - // NativeLoader.makeLibrariesAvailable(libraryPaths); - // } catch (final Exception e) { - // ; // ignore - // } - // } - - public LwjglCanvasRenderer(final Scene scene) { - _scene = scene; - } - - @MainThread - protected ContextCapabilities createContextCapabilities() { - return new LwjglContextCapabilities(GLContext.getCapabilities()); - } - - @Override - public LwjglRenderer createRenderer() { - return new LwjglRenderer(); - } - - @MainThread - public void init(final DisplaySettings settings, final boolean doSwap) { - _doSwap = doSwap; - - // Look up a shared context, if a shared LwjglCanvasRenderer is given. - // XXX: Shared contexts will probably not work... lwjgl does not seem to have a way to make a new glcontext that - // shares lists, textures, etc. - RenderContext sharedContext = null; - if (settings.getShareContext() != null) { - sharedContext = ContextManager.getContextForKey(settings.getShareContext().getRenderContext() - .getContextKey()); - } - - try { - _canvasCallback.makeCurrent(); - GLContext.useContext(_context); - } catch (final LWJGLException e) { - throw new Ardor3dException("Unable to init CanvasRenderer.", e); - } - - final ContextCapabilities caps = createContextCapabilities(); - _currentContext = new RenderContext(this, caps, sharedContext); - - ContextManager.addContext(this, _currentContext); - ContextManager.switchContext(this); - - _renderer = createRenderer(); - - if (settings.getSamples() != 0 && caps.isMultisampleSupported()) { - GL11.glEnable(ARBMultisample.GL_MULTISAMPLE_ARB); - } - - _renderer.setBackgroundColor(ColorRGBA.BLACK); - - if (_camera == null) { - /** Set up how our camera sees. */ - _camera = new Camera(settings.getWidth(), settings.getHeight()); - _camera.setFrustumPerspective(45.0f, (float) settings.getWidth() / (float) settings.getHeight(), 1, 1000); - _camera.setProjectionMode(ProjectionMode.Perspective); - - final Vector3 loc = new Vector3(0.0f, 0.0f, 10.0f); - final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f); - final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); - final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); - /** Move our camera to a correct place and orientation. */ - _camera.setFrame(loc, left, up, dir); - } else { - // use new width and height to set ratio. - _camera.setFrustumPerspective(_camera.getFovY(), - (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), - _camera.getFrustumFar()); - } - } - - @MainThread - public boolean draw() { - - // set up context for rendering this canvas - makeCurrentContext(); - - // render stuff, first apply our camera if we have one - if (_camera != null) { - if (Camera.getCurrentCamera() != _camera) { - _camera.update(); - } - _camera.apply(_renderer); - } - _renderer.clearBuffers(_frameClear); - - final boolean drew = _scene.renderUnto(_renderer); - _renderer.flushFrame(drew && _doSwap); - - // release the context if we're done (swapped and all) - if (_doSwap) { - releaseCurrentContext(); - } - - return drew; - } - - public Camera getCamera() { - return _camera; - } - - public Scene getScene() { - return _scene; - } - - public void setScene(final Scene scene) { - _scene = scene; - } - - public LwjglCanvasCallback getCanvasCallback() { - return _canvasCallback; - } - - public void setCanvasCallback(final LwjglCanvasCallback canvasCallback) { - _canvasCallback = canvasCallback; - } - - public Renderer getRenderer() { - return _renderer; - } - - public void makeCurrentContext() throws Ardor3dException { - try { - _canvasCallback.makeCurrent(); - GLContext.useContext(_context); - ContextManager.switchContext(this); - } catch (final LWJGLException e) { - throw new Ardor3dException("Failed to claim OpenGL context.", e); - } - } - - public void releaseCurrentContext() { - try { - GLContext.useContext(null); - _canvasCallback.releaseContext(); - } catch (final LWJGLException e) { - throw new RuntimeException(e); - } - } - - public void setCamera(final Camera camera) { - _camera = camera; - } - - public RenderContext getRenderContext() { - return _currentContext; - } - - public int getFrameClear() { - return _frameClear; - } - - public void setFrameClear(final int buffers) { - _frameClear = buffers; - } -}
\ No newline at end of file diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglDisplayCanvas.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglDisplayCanvas.java deleted file mode 100644 index efacc46..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglDisplayCanvas.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.framework.lwjgl; - -import java.util.concurrent.CountDownLatch; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.PixelFormat; - -import com.ardor3d.framework.Canvas; -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.input.FocusWrapper; -import com.ardor3d.util.Ardor3dException; - -/** - * A Canvas implementation intended for use with an existing awt canvas. - * <p> - * XXX: Could/should this be merged with LwjglCanvas? - * </p> - */ -public class LwjglDisplayCanvas implements Canvas, FocusWrapper { - private static final Logger logger = Logger.getLogger(LwjglDisplayCanvas.class.getName()); - - private final LwjglCanvasRenderer _canvasRenderer; - private boolean _inited = false; - private final DisplaySettings _settings; - - private volatile boolean _focusLost = false; - - private final java.awt.Canvas _canvas; - - public LwjglDisplayCanvas(final java.awt.Canvas canvas, final DisplaySettings settings, - final LwjglCanvasRenderer canvasRenderer) throws LWJGLException { - _settings = settings; - _canvasRenderer = canvasRenderer; - _canvas = canvas; - _canvasRenderer.setCanvasCallback(new LwjglCanvasCallback() { - @Override - public void makeCurrent() throws LWJGLException { - if (!LwjglCanvas.SINGLE_THREADED_MODE) { - Display.makeCurrent(); - } - } - - @Override - public void releaseContext() throws LWJGLException { - if (!LwjglCanvas.SINGLE_THREADED_MODE) { - Display.releaseContext(); - } - } - }); - } - - public void draw(final CountDownLatch latch) { - if (!_inited) { - init(); - } - - checkFocus(); - - _canvasRenderer.draw(); - - if (latch != null) { - latch.countDown(); - } - } - - private void checkFocus() { - // focusLost should be true if it is already true (hasn't been read/cleared yet), or - // the display is presently not in focus - _focusLost = _focusLost || !(Display.isActive() && Display.isVisible()); - } - - public boolean getAndClearFocusLost() { - final boolean result = _focusLost; - - _focusLost = false; - - return result; - } - - public void init() { - if (_inited) { - return; - } - - // create the Display. - final PixelFormat format = new PixelFormat(_settings.getAlphaBits(), _settings.getDepthBits(), - _settings.getStencilBits()).withSamples(_settings.getSamples()).withStereo(_settings.isStereo()); - - try { - Display.setParent(_canvas); - // NOTE: Workaround for possible lwjgl "pixel not accelerated" bug, as suggested by user "faust" - try { - Display.create(format); - } catch (final LWJGLException e) { - // failed to create Display, apply workaround (sleep for 1 second) and try again - Thread.sleep(1000); - Display.create(format); - } - } catch (final Exception e) { - logger.severe("Cannot create window"); - logger.logp(Level.SEVERE, this.getClass().toString(), "initDisplay()", "Exception", e); - throw new Ardor3dException("Cannot create window: " + e.getMessage()); - } - - _canvasRenderer.init(_settings, true); // true - do swap in renderer. - _inited = true; - } - - public LwjglCanvasRenderer getCanvasRenderer() { - return _canvasRenderer; - } - - public void setVSyncEnabled(final boolean enabled) { - Display.setVSyncEnabled(enabled); - } - - public void setFullScreen(final boolean fullScreen) throws LWJGLException { - Display.setFullscreen(fullScreen); - } - - public boolean isFullScreen() { - return Display.isFullscreen(); - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglHeadlessCanvas.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglHeadlessCanvas.java deleted file mode 100644 index 895bc63..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglHeadlessCanvas.java +++ /dev/null @@ -1,301 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.framework.lwjgl; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.IntBuffer; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.ARBMultisample; -import org.lwjgl.opengl.EXTFramebufferBlit; -import org.lwjgl.opengl.EXTFramebufferMultisample; -import org.lwjgl.opengl.EXTFramebufferObject; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; -import org.lwjgl.opengl.GLContext; -import org.lwjgl.opengl.Pbuffer; -import org.lwjgl.opengl.PixelFormat; - -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.framework.Scene; -import com.ardor3d.math.ColorRGBA; -import com.ardor3d.math.Vector3; -import com.ardor3d.renderer.Camera; -import com.ardor3d.renderer.Camera.ProjectionMode; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.lwjgl.LwjglContextCapabilities; -import com.ardor3d.renderer.lwjgl.LwjglRenderer; -import com.ardor3d.renderer.lwjgl.LwjglTextureRenderer; -import com.ardor3d.util.Ardor3dException; -import com.ardor3d.util.geom.BufferUtils; - -/** - * <p> - * A "canvas" class for use in drawing Scene data to an off-screen target. The data is read back after each call to draw - * into a local IntBuffer for use. - * </p> - * - * <p> - * Note: this class is not currently setup for use with other render contexts. - * </p> - */ -public class LwjglHeadlessCanvas { - - protected Scene _scene; - protected Renderer _renderer = new LwjglRenderer(); - protected final DisplaySettings _settings; - protected Camera _camera; - - protected int _fboID, _depthRBID, _colorRBID; - protected int _msfboID, _msdepthRBID, _mscolorRBID; - protected boolean _useMSAA = false; - protected IntBuffer _data; - protected Pbuffer _buff; - - /** - * Construct a new LwjglHeadlessCanvas. Only width, height, alpha, depth and stencil are used. Samples will be - * applied as well but may cause issues on some platforms. - * - * @param settings - * the settings to use. - * @param scene - * the scene we will render. - */ - public LwjglHeadlessCanvas(final DisplaySettings settings, final Scene scene) { - _scene = scene; - _settings = settings; - init(); - } - - protected void init() { - final int width = _settings.getWidth(); - final int height = _settings.getHeight(); - - try { - // Create a Pbuffer so we can have a valid gl context to work with - final PixelFormat format = new PixelFormat(_settings.getAlphaBits(), _settings.getDepthBits(), - _settings.getStencilBits()); - _buff = new Pbuffer(1, 1, format, null); - _buff.makeCurrent(); - } catch (final LWJGLException ex) { - ex.printStackTrace(); - } - - // Set up our Ardor3D context and capabilities objects - final LwjglContextCapabilities caps = new LwjglContextCapabilities(GLContext.getCapabilities()); - final RenderContext currentContext = new RenderContext(this, caps, null); - - if (!caps.isFBOSupported()) { - throw new Ardor3dException("Headless requires FBO support."); - } - - if (caps.isFBOMultisampleSupported() && caps.isFBOBlitSupported() && _settings.getSamples() > 0) { - _useMSAA = true; - } - - // Init our FBO. - final IntBuffer buffer = BufferUtils.createIntBuffer(1); - EXTFramebufferObject.glGenFramebuffersEXT(buffer); // generate id - - // Bind the FBO - _fboID = buffer.get(0); - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _fboID); - - // initialize our color renderbuffer - EXTFramebufferObject.glGenRenderbuffersEXT(buffer); // generate id - _colorRBID = buffer.get(0); - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, _colorRBID); - EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, GL11.GL_RGBA, width, - height); - - // Attach color renderbuffer to framebuffer - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, _colorRBID); - - // initialize our depth renderbuffer - EXTFramebufferObject.glGenRenderbuffersEXT(buffer); // generate id - _depthRBID = buffer.get(0); - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, _depthRBID); - EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, - GL11.GL_DEPTH_COMPONENT, width, height); - - // Attach depth renderbuffer to framebuffer - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, _depthRBID); - - // Check FBO complete - LwjglTextureRenderer.checkFBOComplete(_fboID); - - // Now do it all again for multisample, if requested and supported - if (_useMSAA) { - - // Init our ms FBO. - EXTFramebufferObject.glGenFramebuffersEXT(buffer); // generate id - - // Bind the ms FBO - _msfboID = buffer.get(0); - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _msfboID); - - // initialize our ms color renderbuffer - EXTFramebufferObject.glGenRenderbuffersEXT(buffer); // generate id - _mscolorRBID = buffer.get(0); - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, _mscolorRBID); - EXTFramebufferMultisample.glRenderbufferStorageMultisampleEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, - _settings.getSamples(), GL11.GL_RGBA, width, height); - - // Attach ms color renderbuffer to ms framebuffer - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, - _mscolorRBID); - - // initialize our ms depth renderbuffer - EXTFramebufferObject.glGenRenderbuffersEXT(buffer); // generate id - _msdepthRBID = buffer.get(0); - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, _msdepthRBID); - EXTFramebufferMultisample.glRenderbufferStorageMultisampleEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, - _settings.getSamples(), GL11.GL_DEPTH_COMPONENT, width, height); - - // Attach ms depth renderbuffer to ms framebuffer - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, - _msdepthRBID); - - // Check MS FBO complete - LwjglTextureRenderer.checkFBOComplete(_msfboID); - - // enable multisample - GL11.glEnable(ARBMultisample.GL_MULTISAMPLE_ARB); - } - - // Setup our data buffer for storing rendered image data. - _data = ByteBuffer.allocateDirect(width * height * 4).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer(); - - // Add context to manager and set as active. - ContextManager.addContext(this, currentContext); - ContextManager.switchContext(this); - - // Setup a default bg color. - _renderer.setBackgroundColor(ColorRGBA.BLACK); - - // Setup a default camera - _camera = new Camera(width, _settings.getHeight()); - _camera.setFrustumPerspective(45.0f, (float) width / (float) _settings.getHeight(), 1, 1000); - _camera.setProjectionMode(ProjectionMode.Perspective); - - // setup camera orientation and position. - final Vector3 loc = new Vector3(0.0f, 0.0f, 0.0f); - final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f); - final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); - final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); - _camera.setFrame(loc, left, up, dir); - - // release our FBO(s) until used. - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0); - } - - public void draw() { - // bind correct fbo - EXTFramebufferObject - .glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _useMSAA ? _msfboID : _fboID); - - // Make sure this OpenGL context is current. - ContextManager.switchContext(this); - try { - _buff.makeCurrent(); - } catch (final LWJGLException ex) { - ex.printStackTrace(); - } - - // make sure camera is set - if (Camera.getCurrentCamera() != _camera) { - _camera.update(); - } - _camera.apply(_renderer); - - // clear buffers - GL11.glDisable(GL11.GL_SCISSOR_TEST); - _renderer.clearBuffers(Renderer.BUFFER_COLOR | Renderer.BUFFER_DEPTH); - - // draw our scene - _scene.renderUnto(_renderer); - _renderer.flushFrame(false); - - // if we're multisampled, we need to blit to a non-multisampled fbo first - if (_useMSAA) { - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferBlit.GL_DRAW_FRAMEBUFFER_EXT, _fboID); - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferBlit.GL_READ_FRAMEBUFFER_EXT, _msfboID); - EXTFramebufferBlit.glBlitFramebufferEXT(0, 0, _settings.getWidth(), _settings.getHeight(), 0, 0, - _settings.getWidth(), _settings.getHeight(), GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT - | GL11.GL_STENCIL_BUFFER_BIT, GL11.GL_NEAREST); - - // get ready to read non-msaa fbo - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _fboID); - } - - // read data from our color buffer - _data.rewind(); - GL11.glReadBuffer(EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT); - GL11.glReadPixels(0, 0, _settings.getWidth(), _settings.getHeight(), GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, _data); - - // release our FBO. - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0); - } - - public void releaseContext() throws LWJGLException { - _buff.releaseContext(); - } - - public void cleanup() { - if (_fboID != 0) { - final IntBuffer id = BufferUtils.createIntBuffer(1); - id.put(_fboID); - id.rewind(); - EXTFramebufferObject.glDeleteFramebuffersEXT(id); - _fboID = 0; - } - - if (_depthRBID != 0) { - final IntBuffer id = BufferUtils.createIntBuffer(1); - id.put(_depthRBID); - id.rewind(); - EXTFramebufferObject.glDeleteRenderbuffersEXT(id); - _depthRBID = 0; - } - - if (_colorRBID != 0) { - final IntBuffer id = BufferUtils.createIntBuffer(1); - id.put(_colorRBID); - id.rewind(); - EXTFramebufferObject.glDeleteRenderbuffersEXT(id); - _colorRBID = 0; - } - ContextManager.removeContext(this); - } - - public IntBuffer getDataBuffer() { - return _data; - } - - public Renderer getRenderer() { - return _renderer; - } - - public Camera getCamera() { - return _camera; - } - - public void setCamera(final Camera camera) { - _camera = camera; - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglLibraryPaths.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglLibraryPaths.java deleted file mode 100644 index b6e38df..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglLibraryPaths.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - - -package com.ardor3d.framework.lwjgl; - -/** - * TODO: document this class! - * - */ -public enum LwjglLibraryPaths { - MACOSX("Mac OS X", null, new String[] { - "/macosx/libjinput-osx.jnilib", - "/macosx/liblwjgl.jnilib", - "/macosx/openal.dylib", - }), - LINUX_AMD64("Linux", "amd64", new String[] { - "/linux/libjinput-linux64.so", - "/linux/liblwjgl64.so", - "/linux/libopenal64.so", - }), - LINUX_I386("Linux", "i386", new String[] { - "/linux/libjinput-linux.so", - "/linux/liblwjgl.so", - "/linux/libopenal.so", - }), - // NOTE: the order of the elements in this array is significant, so the catchall has to come last, - // or it will shadow more specific alternatives - LINUX_CATCHALL("Linux", null, new String[] { - "/linux/libjinput-linux.so", - "/linux/liblwjgl.so", - "/linux/libopenal.so", - }), - SOLARIS("TODO", null, new String[] { - "/solaris/liblwjgl.so", - "/solaris/libopenal.so", - }), - WINDOWS_XP("Windows XP", null, new String[] { - "/windows/jinput-dx8.dll", - "/windows/jinput-raw.dll", - "/windows/lwjgl.dll", - "/windows/OpenAL32.dll", - }); - - private final String _operatingSystem; - private final String _architecture; - private final String[] _libraryPaths; - - - LwjglLibraryPaths(String operatingSystem, String architecture, String[] libraryPaths) { - _operatingSystem = operatingSystem; - _architecture = architecture; - _libraryPaths = libraryPaths; - } - - public static String[] getLibraryPaths(String operatingSystem, String architecture) { - for (LwjglLibraryPaths libraryPath : values()) { - if (operatingSystem.equals(libraryPath._operatingSystem) && - (libraryPath._architecture == null || architecture.equals(libraryPath._architecture))) { - return libraryPath._libraryPaths; - } - } - - throw new IllegalStateException("No matching set of library paths found for " + operatingSystem + ", " + architecture); - } - - public static void main(String[] args) { - System.out.println(System.getProperty("os.name")); - System.out.println(System.getProperty("os.arch")); - - System.getProperties(); - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglControllerWrapper.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglControllerWrapper.java deleted file mode 100644 index fc4a2b4..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglControllerWrapper.java +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.input.lwjgl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.lwjgl.input.Controller; -import org.lwjgl.input.Controllers; - -import com.ardor3d.input.ControllerEvent; -import com.ardor3d.input.ControllerInfo; -import com.ardor3d.input.ControllerState; -import com.ardor3d.input.ControllerWrapper; -import com.google.common.collect.AbstractIterator; -import com.google.common.collect.Lists; -import com.google.common.collect.PeekingIterator; - -public class LwjglControllerWrapper implements ControllerWrapper { - - protected static boolean _inited = false; - protected final List<ControllerEvent> _events = Collections.synchronizedList(new ArrayList<ControllerEvent>()); - protected LwjglControllerEventIterator _eventsIt = new LwjglControllerEventIterator(); - protected final List<ControllerInfo> _controllers = Lists.newArrayList(); - - private class LwjglControllerEventIterator extends AbstractIterator<ControllerEvent> implements - PeekingIterator<ControllerEvent> { - - @Override - protected ControllerEvent computeNext() { - if (_events.size() > 0) { - return _events.remove(0); - } else { - return endOfData(); - } - } - } - - public PeekingIterator<ControllerEvent> getEvents() { - init(); - if (!_eventsIt.hasNext()) { - _eventsIt = new LwjglControllerEventIterator(); - } - - while (Controllers.next()) { - final Controller source = Controllers.getEventSource(); - if (Controllers.isEventButton()) { - _events.add(new ControllerEvent(Controllers.getEventNanoseconds(), source.getName(), source - .getButtonName(Controllers.getEventControlIndex()), source.isButtonPressed(Controllers - .getEventControlIndex()) ? 1f : 0f)); - } else if (Controllers.isEventAxis()) { - _events.add(new ControllerEvent(Controllers.getEventNanoseconds(), source.getName(), source - .getAxisName(Controllers.getEventControlIndex()), source.getAxisValue(Controllers - .getEventControlIndex()))); - } else if (Controllers.isEventPovX()) { - _events.add(new ControllerEvent(Controllers.getEventNanoseconds(), source.getName(), "Pov X", source - .getPovX())); - } else if (Controllers.isEventPovY()) { - _events.add(new ControllerEvent(Controllers.getEventNanoseconds(), source.getName(), "Pov Y", source - .getPovY())); - } - } - - return _eventsIt; - } - - public synchronized void init() { - if (_inited) { - return; - } - try { - Controllers.create(); - for (int i = 0, max = Controllers.getControllerCount(); i < max; i++) { - final Controller controller = Controllers.getController(i); - _controllers.add(getControllerInfo(controller)); - for (int j = 0; j < controller.getAxisCount(); j++) { - ControllerState.NOTHING.set(controller.getName(), controller.getAxisName(j), 0); - } - for (int j = 0; j < controller.getButtonCount(); j++) { - ControllerState.NOTHING.set(controller.getName(), controller.getButtonName(j), 0); - } - } - } catch (final Exception e) { - e.printStackTrace(); - } finally { - _inited = true; - } - } - - protected ControllerInfo getControllerInfo(final Controller controller) { - final List<String> axisNames = Lists.newArrayList(); - final List<String> buttonNames = Lists.newArrayList(); - - for (int i = 0; i < controller.getAxisCount(); i++) { - axisNames.add(controller.getAxisName(i)); - } - for (int i = 0; i < controller.getButtonCount(); i++) { - buttonNames.add(controller.getButtonName(i)); - } - - return new ControllerInfo(controller.getName(), axisNames, buttonNames); - } - - @Override - public int getControllerCount() { - init(); - return Controllers.getControllerCount(); - } - - @Override - public ControllerInfo getControllerInfo(final int controllerIndex) { - init(); - return _controllers.get(controllerIndex); - } -}
\ No newline at end of file diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglKey.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglKey.java deleted file mode 100644 index 8b4a03b..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglKey.java +++ /dev/null @@ -1,173 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.input.lwjgl; - -import org.lwjgl.input.Keyboard; - -import com.ardor3d.input.Key; - -public enum LwjglKey { - - ZERO(Keyboard.KEY_0, Key.ZERO), // - ONE(Keyboard.KEY_1, Key.ONE), // - TWO(Keyboard.KEY_2, Key.TWO), // - THREE(Keyboard.KEY_3, Key.THREE), // - FOUR(Keyboard.KEY_4, Key.FOUR), // - FIVE(Keyboard.KEY_5, Key.FIVE), // - SIX(Keyboard.KEY_6, Key.SIX), // - SEVEN(Keyboard.KEY_7, Key.SEVEN), // - EIGHT(Keyboard.KEY_8, Key.EIGHT), // - NINE(Keyboard.KEY_9, Key.NINE), // - A(Keyboard.KEY_A, Key.A), // - ADD(Keyboard.KEY_ADD, Key.NUMPADADD), // - APOSTROPHE(Keyboard.KEY_APOSTROPHE, Key.APOSTROPHE), // - APPS(Keyboard.KEY_APPS, Key.APPS), // - AT(Keyboard.KEY_AT, Key.AT), // - AX(Keyboard.KEY_AX, Key.AX), // - B(Keyboard.KEY_B, Key.B), // - BACK(Keyboard.KEY_BACK, Key.BACK), // - BACKSLASH(Keyboard.KEY_BACKSLASH, Key.BACKSLASH), // - C(Keyboard.KEY_C, Key.C), // - CAPITAL(Keyboard.KEY_CAPITAL, Key.CAPITAL), // - CIRCUMFLEX(Keyboard.KEY_CIRCUMFLEX, Key.CIRCUMFLEX), // - COLON(Keyboard.KEY_COLON, Key.COLON), // - COMMA(Keyboard.KEY_COMMA, Key.COMMA), // - CONVERT(Keyboard.KEY_CONVERT, Key.CONVERT), // - D(Keyboard.KEY_D, Key.D), // - DECIMAL(Keyboard.KEY_DECIMAL, Key.DECIMAL), // - DELETE(Keyboard.KEY_DELETE, Key.DELETE), // - DIVIDE(Keyboard.KEY_DIVIDE, Key.DIVIDE), // - DOWN(Keyboard.KEY_DOWN, Key.DOWN), // - E(Keyboard.KEY_E, Key.E), // - END(Keyboard.KEY_END, Key.END), // - EQUALS(Keyboard.KEY_EQUALS, Key.EQUALS), // - ESCAPE(Keyboard.KEY_ESCAPE, Key.ESCAPE), // - F(Keyboard.KEY_F, Key.F), // - F1(Keyboard.KEY_F1, Key.F1), // - F2(Keyboard.KEY_F2, Key.F2), // - F3(Keyboard.KEY_F3, Key.F3), // - F4(Keyboard.KEY_F4, Key.F4), // - F5(Keyboard.KEY_F5, Key.F5), // - F6(Keyboard.KEY_F6, Key.F6), // - F7(Keyboard.KEY_F7, Key.F7), // - F8(Keyboard.KEY_F8, Key.F8), // - F9(Keyboard.KEY_F9, Key.F9), // - F10(Keyboard.KEY_F10, Key.F10), // - F11(Keyboard.KEY_F11, Key.F11), // - F12(Keyboard.KEY_F12, Key.F12), // - F13(Keyboard.KEY_F13, Key.F13), // - F14(Keyboard.KEY_F14, Key.F14), // - F15(Keyboard.KEY_F15, Key.F15), // - G(Keyboard.KEY_G, Key.G), // - GRAVE(Keyboard.KEY_GRAVE, Key.GRAVE), // - H(Keyboard.KEY_H, Key.H), // - HOME(Keyboard.KEY_HOME, Key.HOME), // - I(Keyboard.KEY_I, Key.I), // - INSERT(Keyboard.KEY_INSERT, Key.INSERT), // - J(Keyboard.KEY_J, Key.J), // - K(Keyboard.KEY_K, Key.K), // - KANA(Keyboard.KEY_KANA, Key.KANA), // - KANJI(Keyboard.KEY_KANJI, Key.KANJI), // - L(Keyboard.KEY_L, Key.L), // - LBRACKET(Keyboard.KEY_LBRACKET, Key.LBRACKET), // - LCONTROL(Keyboard.KEY_LCONTROL, Key.LCONTROL), // - LEFT(Keyboard.KEY_LEFT, Key.LEFT), // - LMENU(Keyboard.KEY_LMENU, Key.LMENU), // - LMETA(Keyboard.KEY_LMETA, Key.LMETA), // - LSHIFT(Keyboard.KEY_LSHIFT, Key.LSHIFT), // - M(Keyboard.KEY_M, Key.M), // - MINUS(Keyboard.KEY_MINUS, Key.MINUS), // - MULTIPLY(Keyboard.KEY_MULTIPLY, Key.MULTIPLY), // - N(Keyboard.KEY_N, Key.N), // - NEXT(Keyboard.KEY_NEXT, Key.PAGEDOWN_NEXT), // - NOCONVERT(Keyboard.KEY_NOCONVERT, Key.NOCONVERT), // - NUMLOCK(Keyboard.KEY_NUMLOCK, Key.NUMLOCK), // - NUMPAD0(Keyboard.KEY_NUMPAD0, Key.NUMPAD0), // - NUMPAD1(Keyboard.KEY_NUMPAD1, Key.NUMPAD1), // - NUMPAD2(Keyboard.KEY_NUMPAD2, Key.NUMPAD2), // - NUMPAD3(Keyboard.KEY_NUMPAD3, Key.NUMPAD3), // - NUMPAD4(Keyboard.KEY_NUMPAD4, Key.NUMPAD4), // - NUMPAD5(Keyboard.KEY_NUMPAD5, Key.NUMPAD5), // - NUMPAD6(Keyboard.KEY_NUMPAD6, Key.NUMPAD6), // - NUMPAD7(Keyboard.KEY_NUMPAD7, Key.NUMPAD7), // - NUMPAD8(Keyboard.KEY_NUMPAD8, Key.NUMPAD8), // - NUMPAD9(Keyboard.KEY_NUMPAD9, Key.NUMPAD9), // - NUMPADCOMMA(Keyboard.KEY_NUMPADCOMMA, Key.NUMPADCOMMA), // - NUMPADENTER(Keyboard.KEY_NUMPADENTER, Key.NUMPADENTER), // - NUMPADEQUALS(Keyboard.KEY_NUMPADEQUALS, Key.NUMPADEQUALS), // - O(Keyboard.KEY_O, Key.O), // - P(Keyboard.KEY_P, Key.P), // - PAUSE(Keyboard.KEY_PAUSE, Key.PAUSE), // - POWER(Keyboard.KEY_POWER, Key.POWER), // - PERIOD(Keyboard.KEY_PERIOD, Key.PERIOD), // - PRIOR(Keyboard.KEY_PRIOR, Key.PAGEUP_PRIOR), // - Q(Keyboard.KEY_Q, Key.Q), // - R(Keyboard.KEY_R, Key.R), // - RBRACKET(Keyboard.KEY_RBRACKET, Key.RBRACKET), // - RCONTROL(Keyboard.KEY_RCONTROL, Key.RCONTROL), // - RETURN(Keyboard.KEY_RETURN, Key.RETURN), // - RIGHT(Keyboard.KEY_RIGHT, Key.RIGHT), // - RMENU(Keyboard.KEY_RMENU, Key.RMENU), // - RMETA(Keyboard.KEY_RMETA, Key.RMETA), // - RSHIFT(Keyboard.KEY_RSHIFT, Key.RSHIFT), // - S(Keyboard.KEY_S, Key.S), // - SCROLL(Keyboard.KEY_SCROLL, Key.SCROLL), // - SEMICOLON(Keyboard.KEY_SEMICOLON, Key.SEMICOLON), // - SLASH(Keyboard.KEY_SLASH, Key.SLASH), // - SLEEP(Keyboard.KEY_SLEEP, Key.SLEEP), // - SPACE(Keyboard.KEY_SPACE, Key.SPACE), // - STOP(Keyboard.KEY_STOP, Key.STOP), // - NUMPADSUBTRACT(Keyboard.KEY_SUBTRACT, Key.NUMPADSUBTRACT), // XXX: Not sure if this is correct? - SYSRQ(Keyboard.KEY_SYSRQ, Key.SYSRQ), // - T(Keyboard.KEY_T, Key.T), // - TAB(Keyboard.KEY_TAB, Key.TAB), // - U(Keyboard.KEY_U, Key.U), // - UNDERLINE(Keyboard.KEY_UNDERLINE, Key.UNDERLINE), // - UNLABELED(Keyboard.KEY_UNLABELED, Key.UNLABELED), // - UP(Keyboard.KEY_UP, Key.UP), // - V(Keyboard.KEY_V, Key.V), // - W(Keyboard.KEY_W, Key.W), // - X(Keyboard.KEY_X, Key.X), // - Y(Keyboard.KEY_Y, Key.Y), // - YEN(Keyboard.KEY_YEN, Key.YEN), // - Z(Keyboard.KEY_Z, Key.Z), // - NONE(Keyboard.KEY_NONE, Key.UNKNOWN); - - private final int _lwjglCode; - private final Key _key; - - private LwjglKey(final int lwjglCode, final Key key) { - _lwjglCode = lwjglCode; - _key = key; - } - - /** - * Locate a key, given a specific lwjgl key code. - * - * @param lwjglCode - * the lwjgl key code. - * @return the Ardor3D Key enum value. - */ - public static Key findByCode(final int lwjglCode) { - for (final LwjglKey ak : values()) { - if (ak._lwjglCode == lwjglCode) { - return ak._key; - } - } - - return Key.UNKNOWN; - } - - public int getLwjglCode() { - return _lwjglCode; - } - -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglKeyboardWrapper.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglKeyboardWrapper.java deleted file mode 100644 index de4c991..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglKeyboardWrapper.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.input.lwjgl; - -import org.lwjgl.LWJGLException; -import org.lwjgl.input.Keyboard; - -import com.ardor3d.input.Key; -import com.ardor3d.input.KeyEvent; -import com.ardor3d.input.KeyState; -import com.ardor3d.input.KeyboardWrapper; -import com.google.common.collect.AbstractIterator; -import com.google.common.collect.PeekingIterator; - -/** - * Wraps the {@link org.lwjgl.input.Keyboard} class. - */ -public class LwjglKeyboardWrapper implements KeyboardWrapper { - private LwjglKeyEventIterator _currentIterator = null; - - public void init() { - if (!Keyboard.isCreated()) { - try { - Keyboard.create(); - } catch (final LWJGLException e) { - throw new RuntimeException(e); - } - } - } - - public PeekingIterator<KeyEvent> getEvents() { - if (_currentIterator == null || !_currentIterator.hasNext()) { - _currentIterator = new LwjglKeyEventIterator(); - } - - return _currentIterator; - } - - private static class LwjglKeyEventIterator extends AbstractIterator<KeyEvent> implements PeekingIterator<KeyEvent> { - - @Override - protected KeyEvent computeNext() { - if (!Keyboard.next()) { - return endOfData(); - } - - final int keyCode = Keyboard.getEventKey(); - final boolean pressed = Keyboard.getEventKeyState(); - final char keyChar = Keyboard.getEventCharacter(); - - final Key k = LwjglKey.findByCode(keyCode); - - return new KeyEvent(k, pressed ? KeyState.DOWN : KeyState.UP, keyChar); - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseManager.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseManager.java deleted file mode 100644 index b689841..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseManager.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.input.lwjgl; - -import java.nio.ByteBuffer; -import java.nio.IntBuffer; - -import org.lwjgl.LWJGLException; -import org.lwjgl.input.Cursor; -import org.lwjgl.input.Mouse; - -import com.ardor3d.annotation.MainThread; -import com.ardor3d.image.Image; -import com.ardor3d.image.ImageDataFormat; -import com.ardor3d.input.GrabbedState; -import com.ardor3d.input.MouseCursor; -import com.ardor3d.input.MouseManager; -import com.ardor3d.util.geom.BufferUtils; - -/** - * LWJGL-specific implementation of the {@link com.ardor3d.input.MouseManager} interface. No methods in this class - * should be called before the LWJGL Display has been initialized, since this class is dependent on being able to - * initialize the {@link org.lwjgl.input.Mouse} class. - */ -public class LwjglMouseManager implements MouseManager { - private boolean _inited = false; - - private void init() { - if (!_inited) { - if (!Mouse.isCreated()) { - try { - Mouse.create(); - } catch (final Exception e) { - // this typically happens if the Display hasn't been initialized. - throw new RuntimeException("Unable to initialise mouse manager", e); - } - } - _inited = true; - } - } - - @MainThread - public void setCursor(final MouseCursor cursor) { - init(); - - try { - final Cursor lwjglCursor = createLwjglCursor(cursor); - - if (lwjglCursor == null || !lwjglCursor.equals(Mouse.getNativeCursor())) { - Mouse.setNativeCursor(lwjglCursor); - } - } catch (final LWJGLException e) { - throw new RuntimeException("Unable to set cursor", e); - } - } - - private Cursor createLwjglCursor(final MouseCursor cursor) throws LWJGLException { - if (cursor == MouseCursor.SYSTEM_DEFAULT) { - return null; // setting the cursor to null in LWJGL means using the system default one - } - - final boolean eightBitAlpha = (Cursor.getCapabilities() & Cursor.CURSOR_8_BIT_ALPHA) != 0; - - final Image image = cursor.getImage(); - - final boolean isRgba = image.getDataFormat() == ImageDataFormat.RGBA; - final int imageWidth = image.getWidth(); - final int imageHeight = image.getHeight(); - - final ByteBuffer imageData = image.getData(0); - imageData.rewind(); - final IntBuffer imageDataCopy = BufferUtils.createIntBuffer(imageWidth * imageHeight); - - for (int y = 0; y < imageHeight; y++) { - for (int x = 0; x < imageWidth; x++) { - final int index = y * imageWidth + x; - - int r = imageData.get() & 0xff; - int g = imageData.get() & 0xff; - int b = imageData.get() & 0xff; - int a = 0xff; - if (isRgba) { - a = imageData.get() & 0xff; - if (!eightBitAlpha) { - if (a < 0x7f) { - a = 0x00; - // small hack to prevent triggering "reverse screen" on windows. - r = g = b = 0; - } else { - a = 0xff; - } - } - } - - imageDataCopy.put(index, (a << 24) | (r << 16) | (g << 8) | b); - } - } - - return new Cursor(imageWidth, imageHeight, cursor.getHotspotX(), cursor.getHotspotY(), 1, imageDataCopy, null); - } - - public void setPosition(final int x, final int y) { - init(); - - Mouse.setCursorPosition(x, y); - } - - public void setGrabbed(final GrabbedState grabbedState) { - init(); - - switch (grabbedState) { - case GRABBED: - Mouse.setGrabbed(true); - break; - case NOT_GRABBED: - Mouse.setGrabbed(false); - break; - default: - throw new IllegalStateException("Unhandled GrabbedState: " + grabbedState); - } - } - - public boolean isSetPositionSupported() { - return true; - } - - public boolean isSetGrabbedSupported() { - return true; - } - - public GrabbedState getGrabbed() { - return Mouse.isGrabbed() ? GrabbedState.GRABBED : GrabbedState.NOT_GRABBED; - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseWrapper.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseWrapper.java deleted file mode 100644 index d554183..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseWrapper.java +++ /dev/null @@ -1,144 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.input.lwjgl; - -import java.util.EnumMap; -import java.util.EnumSet; - -import org.lwjgl.input.Mouse; - -import com.ardor3d.input.ButtonState; -import com.ardor3d.input.MouseButton; -import com.ardor3d.input.MouseState; -import com.ardor3d.input.MouseWrapper; -import com.google.common.collect.AbstractIterator; -import com.google.common.collect.EnumMultiset; -import com.google.common.collect.Maps; -import com.google.common.collect.Multiset; -import com.google.common.collect.PeekingIterator; - -/** - * Wrapper over the {@link org.lwjgl.input.Mouse} mouse interface class. - */ -public class LwjglMouseWrapper implements MouseWrapper { - private LwjglMouseIterator _currentIterator = null; - - private static final Multiset<MouseButton> _clicks = EnumMultiset.create(MouseButton.class); - private static final EnumMap<MouseButton, Long> _lastClickTime = Maps.newEnumMap(MouseButton.class); - private static final EnumSet<MouseButton> _clickArmed = EnumSet.noneOf(MouseButton.class); - - private static boolean _sendClickState = false; - private static MouseState _nextState; - - public LwjglMouseWrapper() { - for (final MouseButton mb : MouseButton.values()) { - _lastClickTime.put(mb, 0L); - } - } - - public void init() { - if (!Mouse.isCreated()) { - try { - Mouse.create(); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } - } - - public PeekingIterator<MouseState> getEvents() { - // only create a new iterator if there isn't an existing, valid, one. - if (_currentIterator == null || !_currentIterator.hasNext()) { - _currentIterator = new LwjglMouseIterator(); - } - - return _currentIterator; - } - - private static class LwjglMouseIterator extends AbstractIterator<MouseState> implements PeekingIterator<MouseState> { - - public LwjglMouseIterator() {} - - @Override - protected MouseState computeNext() { - if (_nextState != null) { - final MouseState rVal = _nextState; - _nextState = null; - return rVal; - } - - if (!Mouse.next()) { - return endOfData(); - } - - final EnumMap<MouseButton, ButtonState> buttons = Maps.newEnumMap(MouseButton.class); - - if (Mouse.getButtonCount() > 0) { - final boolean down = Mouse.isButtonDown(0); - processButtonForClick(MouseButton.LEFT, down); - buttons.put(MouseButton.LEFT, down ? ButtonState.DOWN : ButtonState.UP); - } - if (Mouse.getButtonCount() > 1) { - final boolean down = Mouse.isButtonDown(1); - processButtonForClick(MouseButton.RIGHT, down); - buttons.put(MouseButton.RIGHT, down ? ButtonState.DOWN : ButtonState.UP); - } - if (Mouse.getButtonCount() > 2) { - final boolean down = Mouse.isButtonDown(2); - processButtonForClick(MouseButton.MIDDLE, down); - buttons.put(MouseButton.MIDDLE, down ? ButtonState.DOWN : ButtonState.UP); - } - - final MouseState nextState = new MouseState(Mouse.getEventX(), Mouse.getEventY(), Mouse.getEventDX(), Mouse - .getEventDY(), Mouse.getEventDWheel(), buttons, null); - - if (nextState.getDx() != 0.0 || nextState.getDy() != 0.0) { - _clickArmed.clear(); - _clicks.clear(); - _sendClickState = false; - } - - if (_sendClickState) { - _nextState = nextState; - _sendClickState = false; - return new MouseState(nextState.getX(), nextState.getY(), nextState.getDx(), nextState.getDy(), - nextState.getDwheel(), buttons, EnumMultiset.create(_clicks)); - } else { - return nextState; - } - } - - private void processButtonForClick(final MouseButton b, final boolean down) { - boolean expired = false; - if (System.currentTimeMillis() - _lastClickTime.get(b) > MouseState.CLICK_TIME_MS) { - _clicks.setCount(b, 0); - expired = true; - } - if (down) { - if (_clickArmed.contains(b)) { - _clicks.setCount(b, 0); - } - _clickArmed.add(b); - _lastClickTime.put(b, System.currentTimeMillis()); - } else { - if (!expired && _clickArmed.contains(b)) { - _clicks.add(b); // increment count of clicks for button b. - // XXX: Note the double event add... this prevents sticky click counts, but is it the best way? - _sendClickState = true; - } else { - _clicks.setCount(b, 0); // clear click count for button b. - } - _clickArmed.remove(b); - } - } - - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglContextCapabilities.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglContextCapabilities.java deleted file mode 100644 index fcc3758..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglContextCapabilities.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.renderer.lwjgl; - -import java.nio.FloatBuffer; -import java.nio.IntBuffer; - -import org.lwjgl.opengl.ARBFragmentShader; -import org.lwjgl.opengl.ARBMultitexture; -import org.lwjgl.opengl.ARBVertexShader; -import org.lwjgl.opengl.EXTFramebufferMultisample; -import org.lwjgl.opengl.EXTFramebufferObject; -import org.lwjgl.opengl.EXTTextureFilterAnisotropic; -import org.lwjgl.opengl.EXTTextureLODBias; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL20; - -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.util.geom.BufferUtils; - -public class LwjglContextCapabilities extends ContextCapabilities { - - public LwjglContextCapabilities(final ContextCapabilities caps) { - super(caps); - } - - public LwjglContextCapabilities(final org.lwjgl.opengl.ContextCapabilities caps) { - final IntBuffer buf = BufferUtils.createIntBuffer(16); - - _supportsVBO = caps.GL_ARB_vertex_buffer_object; - _supportsGL1_2 = caps.OpenGL12; - _supportsMultisample = caps.GL_ARB_multisample; - _supportsDoubleCoefficientsInClipPlaneEquation = true; - - _supportsConstantColor = _supportsEq = caps.GL_ARB_imaging; - _supportsSeparateFunc = caps.GL_EXT_blend_func_separate; - _supportsSeparateEq = caps.GL_EXT_blend_equation_separate; - _supportsMinMax = caps.GL_EXT_blend_minmax; - _supportsSubtract = caps.GL_EXT_blend_subtract; - - _supportsFogCoords = caps.GL_EXT_fog_coord; - _supportsFragmentProgram = caps.GL_ARB_fragment_program; - _supportsVertexProgram = caps.GL_ARB_vertex_program; - - _supportsPointSprites = caps.GL_ARB_point_sprite; - _supportsPointParameters = caps.GL_ARB_point_parameters; - - _supportsTextureLodBias = caps.GL_EXT_texture_lod_bias; - if (_supportsTextureLodBias) { - GL11.glGetInteger(EXTTextureLODBias.GL_MAX_TEXTURE_LOD_BIAS_EXT, buf); - _maxTextureLodBias = buf.get(0); - } else { - _maxTextureLodBias = 0f; - } - - GL11.glGetInteger(GL11.GL_MAX_CLIP_PLANES, buf); - _maxUserClipPlanes = buf.get(0); - - _glslSupported = caps.GL_ARB_shader_objects && caps.GL_ARB_fragment_shader && caps.GL_ARB_vertex_shader - && caps.GL_ARB_shading_language_100; - - _geometryShader4Supported = caps.GL_ARB_geometry_shader4 && _glslSupported; - - _geometryInstancingSupported = caps.GL_EXT_draw_instanced || caps.OpenGL31; - - if (_glslSupported) { - GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB, buf); - _maxGLSLVertexAttribs = buf.get(0); - } - - // Pbuffer - _pbufferSupported = caps.GL_ARB_pixel_buffer_object; - - // FBO - _fboSupported = caps.GL_EXT_framebuffer_object; - if (_fboSupported) { - - _supportsFBOMultisample = caps.GL_EXT_framebuffer_multisample; - _supportsFBOBlit = caps.GL_EXT_framebuffer_blit; - - if (caps.GL_ARB_draw_buffers) { - GL11.glGetInteger(EXTFramebufferObject.GL_MAX_COLOR_ATTACHMENTS_EXT, buf); - _maxFBOColorAttachments = buf.get(0); - } else { - _maxFBOColorAttachments = 1; - } - - // Max multisample samples. - if (caps.GL_EXT_framebuffer_multisample && caps.GL_EXT_framebuffer_blit) { - GL11.glGetInteger(EXTFramebufferMultisample.GL_MAX_SAMPLES_EXT, buf); - _maxFBOSamples = buf.get(0); - } else { - _maxFBOSamples = 0; - } - } else { - _maxFBOColorAttachments = 0; - } - - _twoSidedStencilSupport = caps.GL_EXT_stencil_two_side; - _stencilWrapSupport = caps.GL_EXT_stencil_wrap; - - // number of available auxiliary draw buffers - GL11.glGetInteger(GL11.GL_AUX_BUFFERS, buf); - _numAuxDrawBuffers = buf.get(0); - - // max texture size. - GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE, buf); - _maxTextureSize = buf.get(0); - - // Check for support of multitextures. - _supportsMultiTexture = caps.GL_ARB_multitexture; - - // Support for texture formats - _supportsFloatTextures = caps.GL_ARB_texture_float; - _supportsIntegerTextures = caps.GL_EXT_texture_integer; - _supportsOneTwoComponentTextures = caps.GL_ARB_texture_rg; - - // Check for support of fixed function dot3 environment settings - _supportsEnvDot3 = caps.GL_ARB_texture_env_dot3; - - // Check for support of fixed function dot3 environment settings - _supportsEnvCombine = caps.GL_ARB_texture_env_combine; - - // Check for support of automatic mipmap generation - _automaticMipMaps = caps.GL_SGIS_generate_mipmap; - - _supportsDepthTexture = caps.GL_ARB_depth_texture; - _supportsShadow = caps.GL_ARB_shadow; - - // If we do support multitexturing, find out how many textures we - // can handle. - if (_supportsMultiTexture) { - GL11.glGetInteger(ARBMultitexture.GL_MAX_TEXTURE_UNITS_ARB, buf); - _numFixedTexUnits = buf.get(0); - } else { - _numFixedTexUnits = 1; - } - - // Go on to check number of texture units supported for vertex and - // fragment shaders - if (caps.GL_ARB_shader_objects && caps.GL_ARB_vertex_shader && caps.GL_ARB_fragment_shader) { - GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, buf); - _numVertexTexUnits = buf.get(0); - GL11.glGetInteger(ARBFragmentShader.GL_MAX_TEXTURE_IMAGE_UNITS_ARB, buf); - _numFragmentTexUnits = buf.get(0); - GL11.glGetInteger(ARBFragmentShader.GL_MAX_TEXTURE_COORDS_ARB, buf); - _numFragmentTexCoordUnits = buf.get(0); - } else { - // based on nvidia dev doc: - // http://developer.nvidia.com/object/General_FAQ.html#t6 - // "For GPUs that do not support GL_ARB_fragment_program and - // GL_NV_fragment_program, those two limits are set equal to - // GL_MAX_TEXTURE_UNITS." - _numFragmentTexCoordUnits = _numFixedTexUnits; - _numFragmentTexUnits = _numFixedTexUnits; - - // We'll set this to 0 for now since we do not know: - _numVertexTexUnits = 0; - } - // ARBShaderObjects.GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB - // caps.GL_EXT_bindable_uniform - // EXTBindableUniform.GL_MAX_BINDABLE_UNIFORM_SIZE_EXT; - - // Now determine the maximum number of supported texture units - _numTotalTexUnits = Math.max(_numFragmentTexCoordUnits, - Math.max(_numFixedTexUnits, Math.max(_numFragmentTexUnits, _numVertexTexUnits))); - - // Check for S3 texture compression capability. - _supportsS3TCCompression = caps.GL_EXT_texture_compression_s3tc; - - // Check for LA texture compression capability. - _supportsLATCCompression = caps.GL_EXT_texture_compression_latc; - - // Check for generic texture compression capability. - _supportsGenericCompression = caps.GL_ARB_texture_compression; - - // Check for 3D texture capability. - _supportsTexture3D = caps.OpenGL12; - - // Check for cubemap capability. - _supportsTextureCubeMap = caps.GL_ARB_texture_cube_map; - - // See if we support anisotropic filtering - _supportsAniso = caps.GL_EXT_texture_filter_anisotropic; - - if (_supportsAniso) { - // Due to LWJGL buffer check, you can't use smaller sized - // buffers (min_size = 16 for glGetFloat()). - final FloatBuffer max_a = BufferUtils.createFloatBuffer(16); - max_a.rewind(); - - // Grab the maximum anisotropic filter. - GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, max_a); - - // set max. - _maxAnisotropic = max_a.get(0); - } - - // See if we support textures that are not power of 2 in size. - _supportsNonPowerTwo = caps.GL_ARB_texture_non_power_of_two; - - // See if we support textures that do not have width == height. - _supportsRectangular = caps.GL_ARB_texture_rectangle; - - _supportsMirroredRepeat = caps.GL_ARB_texture_mirrored_repeat; - _supportsMirrorClamp = _supportsMirrorEdgeClamp = _supportsMirrorBorderClamp = caps.GL_EXT_texture_mirror_clamp; - _supportsBorderClamp = caps.GL_ARB_texture_border_clamp; - _supportsEdgeClamp = _supportsGL1_2; - - try { - _displayVendor = GL11.glGetString(GL11.GL_VENDOR); - } catch (final Exception e) { - _displayVendor = "Unable to retrieve vendor."; - } - - try { - _displayRenderer = GL11.glGetString(GL11.GL_RENDERER); - } catch (final Exception e) { - _displayRenderer = "Unable to retrieve adapter details."; - } - - try { - _displayVersion = GL11.glGetString(GL11.GL_VERSION); - } catch (final Exception e) { - _displayVersion = "Unable to retrieve API version."; - } - - try { - _shadingLanguageVersion = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION); - } catch (final Exception e) { - _shadingLanguageVersion = "Unable to retrieve shading language version."; - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglPbufferTextureRenderer.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglPbufferTextureRenderer.java deleted file mode 100644 index da28b53..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglPbufferTextureRenderer.java +++ /dev/null @@ -1,397 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.renderer.lwjgl; - -import java.nio.ByteBuffer; -import java.nio.IntBuffer; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.AWTGLCanvas; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GLContext; -import org.lwjgl.opengl.Pbuffer; -import org.lwjgl.opengl.PixelFormat; -import org.lwjgl.opengl.RenderTexture; - -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.framework.Scene; -import com.ardor3d.image.Texture; -import com.ardor3d.image.Texture.Type; -import com.ardor3d.math.MathUtils; -import com.ardor3d.renderer.AbstractPbufferTextureRenderer; -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.TextureRendererFactory; -import com.ardor3d.renderer.state.RenderState; -import com.ardor3d.renderer.state.record.TextureRecord; -import com.ardor3d.renderer.state.record.TextureStateRecord; -import com.ardor3d.scene.state.lwjgl.LwjglTextureStateUtil; -import com.ardor3d.scene.state.lwjgl.util.LwjglTextureUtil; -import com.ardor3d.scenegraph.Spatial; -import com.ardor3d.util.Ardor3dException; -import com.ardor3d.util.TextureKey; -import com.ardor3d.util.geom.BufferUtils; - -/** - * <p> - * This class is used by Ardor3D's LWJGL implementation to render textures. Users should <b>not </b> create this class - * directly. - * </p> - * - * @see TextureRendererFactory - */ -public class LwjglPbufferTextureRenderer extends AbstractPbufferTextureRenderer { - private static final Logger logger = Logger.getLogger(LwjglPbufferTextureRenderer.class.getName()); - - /* Pbuffer instance */ - private Pbuffer _pbuffer; - - private RenderTexture _texture; - - public LwjglPbufferTextureRenderer(final DisplaySettings settings, final Renderer parentRenderer, - final ContextCapabilities caps) { - super(settings, parentRenderer, caps); - - int pTarget = RenderTexture.RENDER_TEXTURE_2D; - - if (!MathUtils.isPowerOfTwo(_width) || !MathUtils.isPowerOfTwo(_height)) { - pTarget = RenderTexture.RENDER_TEXTURE_RECTANGLE; - } - - // signature: boolean useRGB, boolean useRGBA, boolean useDepth, boolean isRectangle, int target, int mipmaps - _texture = new RenderTexture(false, true, true, pTarget == RenderTexture.RENDER_TEXTURE_RECTANGLE, pTarget, 0); - - setMultipleTargets(false); - } - - /** - * <code>setupTexture</code> initializes a new Texture object for use with TextureRenderer. Generates a valid gl - * texture id for this texture and inits the data type for the texture. - */ - public void setupTexture(final Texture tex) { - if (tex.getType() != Type.TwoDimensional) { - throw new IllegalArgumentException("Unsupported type: " + tex.getType()); - } - final RenderContext context = ContextManager.getCurrentContext(); - final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(RenderState.StateType.Texture); - - // check if we are already setup... if so, throw error. - if (tex.getTextureKey() == null) { - tex.setTextureKey(TextureKey.getRTTKey(tex.getMinificationFilter())); - } else if (tex.getTextureIdForContext(context.getGlContextRep()) != 0) { - throw new Ardor3dException("Texture is already setup and has id."); - } - - // Create the texture - final IntBuffer ibuf = BufferUtils.createIntBuffer(1); - GL11.glGenTextures(ibuf); - final int textureId = ibuf.get(0); - tex.setTextureIdForContext(context.getGlContextRep(), textureId); - - LwjglTextureStateUtil.doTextureBind(tex, 0, true); - - // Initialize our texture with some default data. - final int internalFormat = LwjglTextureUtil.getGLInternalFormat(tex.getTextureStoreFormat()); - final int dataFormat = LwjglTextureUtil.getGLPixelFormatFromStoreFormat(tex.getTextureStoreFormat()); - final int pixelDataType = LwjglTextureUtil.getGLPixelDataType(tex.getRenderedTexturePixelDataType()); - - GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, internalFormat, _width, _height, 0, dataFormat, pixelDataType, - (ByteBuffer) null); - - // Setup filtering and wrap - final TextureRecord texRecord = record.getTextureRecord(textureId, tex.getType()); - LwjglTextureStateUtil.applyFilter(tex, texRecord, 0, record, context.getCapabilities()); - LwjglTextureStateUtil.applyWrap(tex, texRecord, 0, record, context.getCapabilities()); - - logger.fine("setup pbuffer tex" + textureId + ": " + _width + "," + _height); - } - - public void render(final Spatial spat, final Texture tex, final int clear) { - render(null, spat, null, tex, clear); - } - - public void render(final List<? extends Spatial> spat, final Texture tex, final int clear) { - render(spat, null, null, tex, clear); - } - - public void render(final Scene scene, final Texture tex, final int clear) { - render(null, null, scene, tex, clear); - } - - private void render(final List<? extends Spatial> toDrawA, final Spatial toDrawB, final Scene toDrawC, - final Texture tex, final int clear) { - try { - if (_pbuffer == null || _pbuffer.isBufferLost()) { - if (_pbuffer != null && _pbuffer.isBufferLost()) { - logger.warning("PBuffer contents lost - will recreate the buffer"); - deactivate(); - _pbuffer.destroy(); - } - initPbuffer(); - } - - if (_useDirectRender && !tex.getTextureStoreFormat().isDepthFormat()) { - // setup and render directly to a 2d texture. - _pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER); - activate(); - switchCameraIn(clear); - - if (toDrawA != null) { - doDraw(toDrawA); - } else if (toDrawB != null) { - doDraw(toDrawB); - } else { - doDraw(toDrawC); - } - - deactivate(); - switchCameraOut(); - LwjglTextureStateUtil.doTextureBind(tex, 0, true); - _pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER); - } else { - // render and copy to a texture - activate(); - switchCameraIn(clear); - - if (toDrawA != null) { - doDraw(toDrawA); - } else { - doDraw(toDrawB); - } - - switchCameraOut(); - - copyToTexture(tex, 0, 0, _width, _height, 0, 0); - - deactivate(); - } - - } catch (final Exception e) { - logger.logp(Level.SEVERE, this.getClass().toString(), "render(Spatial, Texture)", "Exception", e); - } - } - - public void render(final Spatial spat, final List<Texture> texs, final int clear) { - render(null, spat, null, texs, clear); - } - - public void render(final List<? extends Spatial> spat, final List<Texture> texs, final int clear) { - render(spat, null, null, texs, clear); - } - - public void render(final Scene scene, final List<Texture> texs, final int clear) { - render(null, null, scene, texs, clear); - } - - private void render(final List<? extends Spatial> toDrawA, final Spatial toDrawB, final Scene toDrawC, - final List<Texture> texs, final int clear) { - try { - if (_pbuffer == null || _pbuffer.isBufferLost()) { - if (_pbuffer != null && _pbuffer.isBufferLost()) { - logger.warning("PBuffer contents lost - will recreate the buffer"); - deactivate(); - _pbuffer.destroy(); - } - initPbuffer(); - } - - if (texs.size() == 1 && _useDirectRender && !texs.get(0).getTextureStoreFormat().isDepthFormat()) { - // setup and render directly to a 2d texture. - LwjglTextureStateUtil.doTextureBind(texs.get(0), 0, true); - activate(); - switchCameraIn(clear); - _pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER); - - if (toDrawA != null) { - doDraw(toDrawA); - } else { - doDraw(toDrawB); - } - - switchCameraOut(); - - deactivate(); - _pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER); - } else { - // render and copy to a texture - activate(); - switchCameraIn(clear); - - if (toDrawA != null) { - doDraw(toDrawA); - } else { - doDraw(toDrawB); - } - - switchCameraOut(); - - for (int i = 0; i < texs.size(); i++) { - copyToTexture(texs.get(i), 0, 0, _width, _height, 0, 0); - } - - deactivate(); - } - - } catch (final Exception e) { - logger.logp(Level.SEVERE, this.getClass().toString(), "render(Spatial, Texture)", "Exception", e); - } - } - - public void copyToTexture(final Texture tex, final int x, final int y, final int width, final int height, - final int xoffset, final int yoffset) { - LwjglTextureStateUtil.doTextureBind(tex, 0, true); - - GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, xoffset, yoffset, x, y, width, height); - } - - @Override - protected void clearBuffers(final int clear) { - GL11.glDisable(GL11.GL_SCISSOR_TEST); - _parentRenderer.clearBuffers(clear); - } - - private void initPbuffer() { - - try { - if (_pbuffer != null) { - giveBackContext(); - ContextManager.removeContext(_pbuffer); - } - final PixelFormat format = new PixelFormat(_settings.getAlphaBits(), _settings.getDepthBits(), - _settings.getStencilBits()).withSamples(_settings.getSamples()) - .withBitsPerPixel(_settings.getColorDepth()).withStereo(_settings.isStereo()); - _pbuffer = new Pbuffer(_width, _height, format, _texture, null); - final Object contextKey = _pbuffer; - try { - _pbuffer.makeCurrent(); - } catch (final LWJGLException e) { - throw new RuntimeException(e); - } - - final LwjglContextCapabilities caps = new LwjglContextCapabilities(GLContext.getCapabilities()); - ContextManager.addContext(contextKey, - new RenderContext(contextKey, caps, ContextManager.getCurrentContext())); - - } catch (final Exception e) { - logger.logp(Level.SEVERE, this.getClass().toString(), "initPbuffer()", "Exception", e); - - if (_texture != null && _useDirectRender) { - logger.warning("Your card claims to support Render to Texture but fails to enact it. Updating your driver might solve this problem."); - logger.warning("Attempting to fall back to Copy Texture."); - _texture = null; - _useDirectRender = false; - initPbuffer(); - return; - } - - logger.log(Level.WARNING, "Failed to create Pbuffer.", e); - return; - } - - try { - activate(); - - _width = _pbuffer.getWidth(); - _height = _pbuffer.getHeight(); - - deactivate(); - } catch (final Exception e) { - logger.log(Level.WARNING, "Failed to initialize created Pbuffer.", e); - return; - } - } - - private void activate() { - if (_active == 0) { - try { - _oldContext = ContextManager.getCurrentContext(); - _pbuffer.makeCurrent(); - - ContextManager.switchContext(_pbuffer); - - ContextManager.getCurrentContext().clearEnforcedStates(); - ContextManager.getCurrentContext().enforceStates(_enforcedStates); - - if (_bgColorDirty) { - GL11.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), - _backgroundColor.getBlue(), _backgroundColor.getAlpha()); - _bgColorDirty = false; - } - } catch (final LWJGLException e) { - logger.logp(Level.SEVERE, this.getClass().toString(), "activate()", "Exception", e); - throw new Ardor3dException(); - } - } - _active++; - } - - private void deactivate() { - if (_active == 1) { - try { - giveBackContext(); - } catch (final LWJGLException e) { - logger.logp(Level.SEVERE, this.getClass().toString(), "deactivate()", "Exception", e); - throw new Ardor3dException(); - } - } - _active--; - } - - // XXX: Need another look at this to make it generic? - private void giveBackContext() throws LWJGLException { - if (Display.isCreated()) { - Display.makeCurrent(); - ContextManager.switchContext(_oldContext.getContextKey()); - } else if (_oldContext.getContextKey() instanceof AWTGLCanvas) { - ((AWTGLCanvas) _oldContext.getContextKey()).makeCurrent(); - ContextManager.switchContext(_oldContext.getContextKey()); - } - } - - public void cleanup() { - ContextManager.removeContext(_pbuffer); - _pbuffer.destroy(); - } - - public void setMultipleTargets(final boolean force) { - if (force) { - logger.fine("Copy Texture Pbuffer used!"); - _useDirectRender = false; - _texture = null; - if (_pbuffer != null) { - try { - giveBackContext(); - } catch (final LWJGLException ex) { - } - ContextManager.removeContext(_pbuffer); - } - } else { - if ((Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0) { - logger.fine("Render to Texture Pbuffer supported!"); - if (_texture == null) { - logger.fine("No RenderTexture used in init, falling back to Copy Texture PBuffer."); - _useDirectRender = false; - } else { - _useDirectRender = true; - } - } else { - logger.fine("Copy Texture Pbuffer supported!"); - _texture = null; - } - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglRenderer.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglRenderer.java deleted file mode 100644 index 4ef91e6..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglRenderer.java +++ /dev/null @@ -1,1743 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.renderer.lwjgl; - -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.nio.ShortBuffer; -import java.util.Collection; -import java.util.List; -import java.util.logging.Logger; - -import org.lwjgl.opengl.ARBBufferObject; -import org.lwjgl.opengl.ARBMultitexture; -import org.lwjgl.opengl.ARBPointParameters; -import org.lwjgl.opengl.ARBPointSprite; -import org.lwjgl.opengl.ARBVertexBufferObject; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.EXTFogCoord; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; -import org.lwjgl.opengl.GL31; -import org.lwjgl.opengl.OpenGLException; - -import com.ardor3d.image.ImageDataFormat; -import com.ardor3d.image.PixelDataType; -import com.ardor3d.image.Texture; -import com.ardor3d.image.Texture1D; -import com.ardor3d.image.Texture2D; -import com.ardor3d.image.Texture3D; -import com.ardor3d.image.TextureCubeMap; -import com.ardor3d.image.TextureCubeMap.Face; -import com.ardor3d.math.Matrix4; -import com.ardor3d.math.type.ReadOnlyColorRGBA; -import com.ardor3d.math.type.ReadOnlyRectangle2; -import com.ardor3d.math.type.ReadOnlyTransform; -import com.ardor3d.math.type.ReadOnlyVector3; -import com.ardor3d.renderer.AbstractRenderer; -import com.ardor3d.renderer.Camera; -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.DrawBufferTarget; -import com.ardor3d.renderer.IndexMode; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.queue.RenderBucketType; -import com.ardor3d.renderer.state.BlendState; -import com.ardor3d.renderer.state.ClipState; -import com.ardor3d.renderer.state.ColorMaskState; -import com.ardor3d.renderer.state.CullState; -import com.ardor3d.renderer.state.FogState; -import com.ardor3d.renderer.state.FragmentProgramState; -import com.ardor3d.renderer.state.GLSLShaderObjectsState; -import com.ardor3d.renderer.state.LightState; -import com.ardor3d.renderer.state.MaterialState; -import com.ardor3d.renderer.state.OffsetState; -import com.ardor3d.renderer.state.RenderState; -import com.ardor3d.renderer.state.ShadingState; -import com.ardor3d.renderer.state.StencilState; -import com.ardor3d.renderer.state.TextureState; -import com.ardor3d.renderer.state.VertexProgramState; -import com.ardor3d.renderer.state.WireframeState; -import com.ardor3d.renderer.state.ZBufferState; -import com.ardor3d.renderer.state.record.LineRecord; -import com.ardor3d.renderer.state.record.RendererRecord; -import com.ardor3d.scene.state.lwjgl.LwjglBlendStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglClipStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglColorMaskStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglCullStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglFogStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglFragmentProgramStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglMaterialStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglOffsetStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglShaderObjectsStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglShadingStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglStencilStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglTextureStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglVertexProgramStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglWireframeStateUtil; -import com.ardor3d.scene.state.lwjgl.LwjglZBufferStateUtil; -import com.ardor3d.scene.state.lwjgl.util.LwjglRendererUtil; -import com.ardor3d.scene.state.lwjgl.util.LwjglTextureUtil; -import com.ardor3d.scenegraph.AbstractBufferData; -import com.ardor3d.scenegraph.AbstractBufferData.VBOAccessMode; -import com.ardor3d.scenegraph.FloatBufferData; -import com.ardor3d.scenegraph.IndexBufferData; -import com.ardor3d.scenegraph.Mesh; -import com.ardor3d.scenegraph.Renderable; -import com.ardor3d.scenegraph.Spatial; -import com.ardor3d.scenegraph.hint.NormalsMode; -import com.ardor3d.util.Ardor3dException; -import com.ardor3d.util.Constants; -import com.ardor3d.util.geom.BufferUtils; -import com.ardor3d.util.stat.StatCollector; -import com.ardor3d.util.stat.StatType; - -/** - * <code>LwjglRenderer</code> provides an implementation of the <code>Renderer</code> interface using the LWJGL API. - * - * @see com.ardor3d.renderer.Renderer - */ -public class LwjglRenderer extends AbstractRenderer { - private static final Logger logger = Logger.getLogger(LwjglRenderer.class.getName()); - - private final FloatBuffer _transformBuffer = BufferUtils.createFloatBuffer(16); - private final Matrix4 _transformMatrix = new Matrix4(); - - /** - * Constructor instantiates a new <code>LwjglRenderer</code> object. - */ - public LwjglRenderer() { - logger.fine("LwjglRenderer created."); - } - - public void setBackgroundColor(final ReadOnlyColorRGBA color) { - _backgroundColor.set(color); - GL11.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(), - _backgroundColor.getAlpha()); - } - - @Override - public void renderBuckets() { - renderBuckets(true, true); - } - - @Override - public void renderBuckets(final boolean doSort, final boolean doClear) { - _processingQueue = true; - if (doSort && doClear) { - _queue.renderBuckets(this); - } else { - if (doSort) { - _queue.sortBuckets(); - } - _queue.renderOnly(this); - if (doClear) { - _queue.clearBuckets(); - } - } - _processingQueue = false; - } - - /** - * clear the render queue - */ - public void clearQueue() { - _queue.clearBuckets(); - } - - public void clearBuffers(final int buffers) { - clearBuffers(buffers, false); - } - - public void clearBuffers(final int buffers, final boolean strict) { - - int clear = 0; - - if ((buffers & Renderer.BUFFER_COLOR) != 0) { - clear |= GL11.GL_COLOR_BUFFER_BIT; - } - - if ((buffers & Renderer.BUFFER_DEPTH) != 0) { - clear |= GL11.GL_DEPTH_BUFFER_BIT; - - // make sure no funny business is going on in the z before clearing. - if (defaultStateList.containsKey(RenderState.StateType.ZBuffer)) { - defaultStateList.get(RenderState.StateType.ZBuffer).setNeedsRefresh(true); - doApplyState(defaultStateList.get(RenderState.StateType.ZBuffer)); - } - } - - if ((buffers & Renderer.BUFFER_STENCIL) != 0) { - clear |= GL11.GL_STENCIL_BUFFER_BIT; - - GL11.glClearStencil(_stencilClearValue); - GL11.glStencilMask(~0); - GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT); - } - - if ((buffers & Renderer.BUFFER_ACCUMULATION) != 0) { - clear |= GL11.GL_ACCUM_BUFFER_BIT; - } - - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord record = context.getRendererRecord(); - - if (strict) { - // grab our camera to get width and height info. - final Camera cam = Camera.getCurrentCamera(); - - GL11.glEnable(GL11.GL_SCISSOR_TEST); - GL11.glScissor(0, 0, cam.getWidth(), cam.getHeight()); - record.setClippingTestEnabled(true); - } - - GL11.glClear(clear); - - if (strict) { - // put us back. - LwjglRendererUtil.applyScissors(record); - } - } - - public void flushFrame(final boolean doSwap) { - renderBuckets(); - - GL11.glFlush(); - if (doSwap) { - doApplyState(defaultStateList.get(RenderState.StateType.ColorMask)); - - if (Constants.stats) { - StatCollector.startStat(StatType.STAT_DISPLAYSWAP_TIMER); - } - Display.update(); - if (Constants.stats) { - StatCollector.endStat(StatType.STAT_DISPLAYSWAP_TIMER); - } - } - - if (Constants.stats) { - StatCollector.addStat(StatType.STAT_FRAMES, 1); - } - } - - public void setOrtho() { - if (_inOrthoMode) { - throw new Ardor3dException("Already in Orthographic mode."); - } - // set up ortho mode - final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_PROJECTION); - GL11.glPushMatrix(); - GL11.glLoadIdentity(); - final Camera camera = Camera.getCurrentCamera(); - final double viewportWidth = camera.getWidth() * (camera.getViewPortRight() - camera.getViewPortLeft()); - final double viewportHeight = camera.getHeight() * (camera.getViewPortTop() - camera.getViewPortBottom()); - GL11.glOrtho(0, viewportWidth, 0, viewportHeight, -1, 1); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW); - GL11.glPushMatrix(); - GL11.glLoadIdentity(); - _inOrthoMode = true; - } - - public void unsetOrtho() { - if (!_inOrthoMode) { - throw new Ardor3dException("Not in Orthographic mode."); - } - // remove ortho mode, and go back to original - // state - final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_PROJECTION); - GL11.glPopMatrix(); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW); - GL11.glPopMatrix(); - _inOrthoMode = false; - } - - public void grabScreenContents(final ByteBuffer buff, final ImageDataFormat format, final PixelDataType type, - final int x, final int y, final int w, final int h) { - final int pixFormat = LwjglTextureUtil.getGLPixelFormat(format); - final int pixDataType = LwjglTextureUtil.getGLPixelDataType(type); - GL11.glReadPixels(x, y, w, h, pixFormat, pixDataType, buff); - } - - public void draw(final Spatial s) { - if (s != null) { - s.onDraw(this); - } - } - - public boolean checkAndAdd(final Spatial s) { - final RenderBucketType rqMode = s.getSceneHints().getRenderBucketType(); - if (rqMode != RenderBucketType.Skip) { - getQueue().addToQueue(s, rqMode); - return true; - } - return false; - } - - /** - * re-initializes the GL context for rendering of another piece of geometry. - */ - protected void postdrawGeometry(final Mesh g) { - // Nothing to do here yet - } - - public void flushGraphics() { - GL11.glFlush(); - } - - public void finishGraphics() { - GL11.glFinish(); - } - - public void applyNormalsMode(final NormalsMode normalsMode, final ReadOnlyTransform worldTransform) { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord rendRecord = context.getRendererRecord(); - if (normalsMode != NormalsMode.Off) { - final ContextCapabilities caps = context.getCapabilities(); - switch (normalsMode) { - case NormalizeIfScaled: - if (worldTransform.isRotationMatrix()) { - final ReadOnlyVector3 scale = worldTransform.getScale(); - if (!(scale.getX() == 1.0 && scale.getY() == 1.0 && scale.getZ() == 1.0)) { - if (scale.getX() == scale.getY() && scale.getY() == scale.getZ() - && caps.isOpenGL1_2Supported() - && rendRecord.getNormalMode() != GL12.GL_RESCALE_NORMAL) { - if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) { - GL11.glDisable(GL11.GL_NORMALIZE); - } - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - rendRecord.setNormalMode(GL12.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() != GL11.GL_NORMALIZE) { - if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - GL11.glEnable(GL11.GL_NORMALIZE); - rendRecord.setNormalMode(GL11.GL_NORMALIZE); - } - } else { - if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) { - GL11.glDisable(GL11.GL_NORMALIZE); - } - rendRecord.setNormalMode(GL11.GL_ZERO); - } - } else { - if (!worldTransform.getMatrix().isIdentity()) { - // *might* be scaled... - if (rendRecord.getNormalMode() != GL11.GL_NORMALIZE) { - if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - GL11.glEnable(GL11.GL_NORMALIZE); - rendRecord.setNormalMode(GL11.GL_NORMALIZE); - } - } else { - // not scaled - if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) { - GL11.glDisable(GL11.GL_NORMALIZE); - } - rendRecord.setNormalMode(GL11.GL_ZERO); - } - } - break; - case AlwaysNormalize: - if (rendRecord.getNormalMode() != GL11.GL_NORMALIZE) { - if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - GL11.glEnable(GL11.GL_NORMALIZE); - rendRecord.setNormalMode(GL11.GL_NORMALIZE); - } - break; - case UseProvided: - default: - if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) { - GL11.glDisable(GL11.GL_NORMALIZE); - } - rendRecord.setNormalMode(GL11.GL_ZERO); - break; - } - } else { - if (rendRecord.getNormalMode() == GL12.GL_RESCALE_NORMAL) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() == GL11.GL_NORMALIZE) { - GL11.glDisable(GL11.GL_NORMALIZE); - } - rendRecord.setNormalMode(GL11.GL_ZERO); - } - } - - public void applyDefaultColor(final ReadOnlyColorRGBA defaultColor) { - if (defaultColor != null) { - GL11.glColor4f(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(), - defaultColor.getAlpha()); - } else { - GL11.glColor4f(1, 1, 1, 1); - } - } - - public void deleteVBOs(final Collection<Integer> ids) { - final IntBuffer idBuffer = BufferUtils.createIntBuffer(ids.size()); - idBuffer.clear(); - for (final Integer i : ids) { - if (i != null && i != 0) { - idBuffer.put(i); - } - } - idBuffer.flip(); - if (idBuffer.remaining() > 0) { - ARBBufferObject.glDeleteBuffersARB(idBuffer); - } - } - - public void deleteDisplayLists(final Collection<Integer> ids) { - for (final Integer i : ids) { - if (i != null && i != 0) { - System.err.println("deleted DL: " + i); - GL11.glDeleteLists(i, 1); - } - } - } - - public void deleteVBOs(final AbstractBufferData<?> buffer) { - if (buffer == null) { - return; - } - - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - - final int id = buffer.getVBOID(context.getGlContextRep()); - if (id == 0) { - // Not on card... return. - return; - } - - buffer.removeVBOID(context.getGlContextRep()); - - final IntBuffer idBuff = BufferUtils.createIntBuffer(1); - idBuff.put(id); - idBuff.flip(); - ARBBufferObject.glDeleteBuffersARB(idBuff); - } - - public void updateTexture1DSubImage(final Texture1D destination, final int dstOffsetX, final int dstWidth, - final ByteBuffer source, final int srcOffsetX) { - updateTexSubImage(destination, dstOffsetX, 0, 0, dstWidth, 0, 0, source, srcOffsetX, 0, 0, 0, 0, null); - } - - public void updateTexture2DSubImage(final Texture2D destination, final int dstOffsetX, final int dstOffsetY, - final int dstWidth, final int dstHeight, final ByteBuffer source, final int srcOffsetX, - final int srcOffsetY, final int srcTotalWidth) { - updateTexSubImage(destination, dstOffsetX, dstOffsetY, 0, dstWidth, dstHeight, 0, source, srcOffsetX, - srcOffsetY, 0, srcTotalWidth, 0, null); - } - - public void updateTexture3DSubImage(final Texture3D destination, final int dstOffsetX, final int dstOffsetY, - final int dstOffsetZ, final int dstWidth, final int dstHeight, final int dstDepth, final ByteBuffer source, - final int srcOffsetX, final int srcOffsetY, final int srcOffsetZ, final int srcTotalWidth, - final int srcTotalHeight) { - updateTexSubImage(destination, dstOffsetX, dstOffsetY, dstOffsetZ, dstWidth, dstHeight, dstDepth, source, - srcOffsetX, srcOffsetY, srcOffsetZ, srcTotalWidth, srcTotalHeight, null); - } - - public void updateTextureCubeMapSubImage(final TextureCubeMap destination, final TextureCubeMap.Face dstFace, - final int dstOffsetX, final int dstOffsetY, final int dstWidth, final int dstHeight, - final ByteBuffer source, final int srcOffsetX, final int srcOffsetY, final int srcTotalWidth) { - updateTexSubImage(destination, dstOffsetX, dstOffsetY, 0, dstWidth, dstHeight, 0, source, srcOffsetX, - srcOffsetY, 0, srcTotalWidth, 0, dstFace); - } - - private void updateTexSubImage(final Texture destination, final int dstOffsetX, final int dstOffsetY, - final int dstOffsetZ, final int dstWidth, final int dstHeight, final int dstDepth, final ByteBuffer source, - final int srcOffsetX, final int srcOffsetY, final int srcOffsetZ, final int srcTotalWidth, - final int srcTotalHeight, final Face dstFace) { - - // Ignore textures that do not have an id set - if (destination.getTextureIdForContext(ContextManager.getCurrentContext().getGlContextRep()) == 0) { - logger.warning("Attempting to update a texture that is not currently on the card."); - return; - } - - // Determine the original texture configuration, so that this method can - // restore the texture configuration to its original state. - final IntBuffer idBuff = BufferUtils.createIntBuffer(16); - GL11.glGetInteger(GL11.GL_UNPACK_ALIGNMENT, idBuff); - final int origAlignment = idBuff.get(0); - final int origRowLength = 0; - final int origImageHeight = 0; - final int origSkipPixels = 0; - final int origSkipRows = 0; - final int origSkipImages = 0; - - final int alignment = 1; - - int rowLength; - if (srcTotalWidth == dstWidth) { - // When the row length is zero, then the width parameter is used. - // We use zero in these cases in the hope that we can avoid two - // unnecessary calls to glPixelStorei. - rowLength = 0; - } else { - // The number of pixels in a row is different than the number of - // pixels in the region to be uploaded to the texture. - rowLength = srcTotalWidth; - } - - int imageHeight; - if (srcTotalHeight == dstHeight) { - // When the image height is zero, then the height parameter is used. - // We use zero in these cases in the hope that we can avoid two - // unnecessary calls to glPixelStorei. - imageHeight = 0; - } else { - // The number of pixels in a row is different than the number of - // pixels in the region to be uploaded to the texture. - imageHeight = srcTotalHeight; - } - - // Grab pixel format - final int pixelFormat; - if (destination.getImage() != null) { - pixelFormat = LwjglTextureUtil.getGLPixelFormat(destination.getImage().getDataFormat()); - } else { - pixelFormat = LwjglTextureUtil.getGLPixelFormatFromStoreFormat(destination.getTextureStoreFormat()); - } - - // bind... - LwjglTextureStateUtil.doTextureBind(destination, 0, false); - - // Update the texture configuration (when necessary). - - if (origAlignment != alignment) { - GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, alignment); - } - if (origRowLength != rowLength) { - GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, rowLength); - } - if (origSkipPixels != srcOffsetX) { - GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, srcOffsetX); - } - // NOTE: The below will be skipped for texture types that don't support them because we are passing in 0's. - if (origSkipRows != srcOffsetY) { - GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, srcOffsetY); - } - if (origImageHeight != imageHeight) { - GL11.glPixelStorei(GL12.GL_UNPACK_IMAGE_HEIGHT, imageHeight); - } - if (origSkipImages != srcOffsetZ) { - GL11.glPixelStorei(GL12.GL_UNPACK_SKIP_IMAGES, srcOffsetZ); - } - - // Upload the image region into the texture. - try { - switch (destination.getType()) { - case TwoDimensional: - GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, dstOffsetX, dstOffsetY, dstWidth, dstHeight, - pixelFormat, GL11.GL_UNSIGNED_BYTE, source); - break; - case OneDimensional: - GL11.glTexSubImage1D(GL11.GL_TEXTURE_1D, 0, dstOffsetX, dstWidth, pixelFormat, - GL11.GL_UNSIGNED_BYTE, source); - break; - case ThreeDimensional: - GL12.glTexSubImage3D(GL12.GL_TEXTURE_3D, 0, dstOffsetX, dstOffsetY, dstOffsetZ, dstWidth, - dstHeight, dstDepth, pixelFormat, GL11.GL_UNSIGNED_BYTE, source); - break; - case CubeMap: - GL11.glTexSubImage2D(LwjglTextureStateUtil.getGLCubeMapFace(dstFace), 0, dstOffsetX, dstOffsetY, - dstWidth, dstHeight, pixelFormat, GL11.GL_UNSIGNED_BYTE, source); - break; - default: - throw new Ardor3dException("Unsupported type for updateTextureSubImage: " + destination.getType()); - } - } finally { - // Restore the texture configuration (when necessary)... - // Restore alignment. - if (origAlignment != alignment) { - GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, origAlignment); - } - // Restore row length. - if (origRowLength != rowLength) { - GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, origRowLength); - } - // Restore skip pixels. - if (origSkipPixels != srcOffsetX) { - GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, origSkipPixels); - } - // Restore skip rows. - if (origSkipRows != srcOffsetY) { - GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, origSkipRows); - } - // Restore image height. - if (origImageHeight != imageHeight) { - GL11.glPixelStorei(GL12.GL_UNPACK_IMAGE_HEIGHT, origImageHeight); - } - // Restore skip images. - if (origSkipImages != srcOffsetZ) { - GL11.glPixelStorei(GL12.GL_UNPACK_SKIP_IMAGES, origSkipImages); - } - } - } - - public void checkCardError() throws Ardor3dException { - try { - org.lwjgl.opengl.Util.checkGLError(); - } catch (final OpenGLException exception) { - throw new Ardor3dException("Error in opengl: " + exception.getMessage(), exception); - } - } - - public void draw(final Renderable renderable) { - if (renderLogic != null) { - renderLogic.apply(renderable); - } - renderable.render(this); - if (renderLogic != null) { - renderLogic.restore(renderable); - } - } - - public boolean doTransforms(final ReadOnlyTransform transform) { - // set world matrix - if (!transform.isIdentity()) { - synchronized (_transformMatrix) { - transform.getGLApplyMatrix(_transformBuffer); - - final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW); - GL11.glPushMatrix(); - GL11.glMultMatrix(_transformBuffer); - return true; - } - } - return false; - } - - public void undoTransforms(final ReadOnlyTransform transform) { - final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW); - GL11.glPopMatrix(); - } - - public void setupVertexData(final FloatBufferData vertexBufferData) { - final FloatBuffer vertexBuffer = vertexBufferData != null ? vertexBufferData.getBuffer() : null; - - if (vertexBuffer == null) { - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - } else { - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - vertexBuffer.rewind(); - GL11.glVertexPointer(vertexBufferData.getValuesPerTuple(), 0, vertexBuffer); - } - } - - public void setupNormalData(final FloatBufferData normalBufferData) { - final FloatBuffer normalBuffer = normalBufferData != null ? normalBufferData.getBuffer() : null; - - if (normalBuffer == null) { - GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); - } else { - GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); - normalBuffer.rewind(); - GL11.glNormalPointer(0, normalBuffer); - } - } - - public void setupColorData(final FloatBufferData colorBufferData) { - final FloatBuffer colorBuffer = colorBufferData != null ? colorBufferData.getBuffer() : null; - - if (colorBuffer == null) { - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - } else { - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - colorBuffer.rewind(); - GL11.glColorPointer(colorBufferData.getValuesPerTuple(), 0, colorBuffer); - } - } - - public void setupFogData(final FloatBufferData fogBufferData) { - final FloatBuffer fogBuffer = fogBufferData != null ? fogBufferData.getBuffer() : null; - - if (fogBuffer == null) { - GL11.glDisableClientState(EXTFogCoord.GL_FOG_COORDINATE_ARRAY_EXT); - } else { - GL11.glEnableClientState(EXTFogCoord.GL_FOG_COORDINATE_ARRAY_EXT); - fogBuffer.rewind(); - EXTFogCoord.glFogCoordPointerEXT(0, fogBuffer); - } - } - - public void setupTextureData(final List<FloatBufferData> textureCoords) { - final RenderContext context = ContextManager.getCurrentContext(); - final ContextCapabilities caps = context.getCapabilities(); - final RendererRecord rendRecord = context.getRendererRecord(); - - final TextureState ts = (TextureState) context.getCurrentState(RenderState.StateType.Texture); - int enabledTextures = rendRecord.getEnabledTextures(); - final boolean valid = rendRecord.isTexturesValid(); - boolean isOn, wasOn; - if (ts != null) { - final int max = caps.isMultitextureSupported() ? Math.min(caps.getNumberOfFragmentTexCoordUnits(), - TextureState.MAX_TEXTURES) : 1; - for (int i = 0; i < max; i++) { - wasOn = (enabledTextures & (2 << i)) != 0; - isOn = textureCoords != null && i < textureCoords.size() && textureCoords.get(i) != null - && textureCoords.get(i).getBuffer() != null; - - if (!isOn) { - if (valid && !wasOn) { - continue; - } else { - checkAndSetTextureArrayUnit(i, rendRecord, caps); - - // disable bit in tracking int - enabledTextures &= ~(2 << i); - - // disable state - GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - - continue; - } - } else { - checkAndSetTextureArrayUnit(i, rendRecord, caps); - - if (!valid || !wasOn) { - // enable state - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - - // enable bit in tracking int - enabledTextures |= (2 << i); - } - - final FloatBufferData textureBufferData = textureCoords.get(i); - final FloatBuffer textureBuffer = textureBufferData.getBuffer(); - - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - textureBuffer.rewind(); - GL11.glTexCoordPointer(textureBufferData.getValuesPerTuple(), 0, textureBuffer); - } - } - } - - rendRecord.setEnabledTextures(enabledTextures); - rendRecord.setTexturesValid(true); - } - - @Override - public void drawElements(final IndexBufferData<?> indices, final int[] indexLengths, final IndexMode[] indexModes, - final int primcount) { - if (indices == null || indices.getBuffer() == null) { - logger.severe("Missing indices for drawElements call without VBO"); - return; - } - - if (indexLengths == null) { - final int glIndexMode = getGLIndexMode(indexModes[0]); - - indices.position(0); - if (indices.getBuffer() instanceof IntBuffer) { - if (primcount < 0) { - GL11.glDrawElements(glIndexMode, (IntBuffer) indices.getBuffer()); - } else { - GL31.glDrawElementsInstanced(glIndexMode, (IntBuffer) indices.getBuffer(), primcount); - } - } else if (indices.getBuffer() instanceof ShortBuffer) { - if (primcount < 0) { - GL11.glDrawElements(glIndexMode, (ShortBuffer) indices.getBuffer()); - } else { - GL31.glDrawElementsInstanced(glIndexMode, (ShortBuffer) indices.getBuffer(), primcount); - } - - } else if (indices.getBuffer() instanceof ByteBuffer) { - if (primcount < 0) { - GL11.glDrawElements(glIndexMode, (ByteBuffer) indices.getBuffer()); - } else { - GL31.glDrawElementsInstanced(glIndexMode, (ByteBuffer) indices.getBuffer(), primcount); - } - } - - if (Constants.stats) { - addStats(indexModes[0], indices.getBufferLimit()); - } - } else { - int offset = 0; - int indexModeCounter = 0; - for (int i = 0; i < indexLengths.length; i++) { - final int count = indexLengths[i]; - - final int glIndexMode = getGLIndexMode(indexModes[indexModeCounter]); - - indices.getBuffer().position(offset); - indices.getBuffer().limit(offset + count); - if (indices.getBuffer() instanceof IntBuffer) { - if (primcount < 0) { - GL11.glDrawElements(glIndexMode, (IntBuffer) indices.getBuffer()); - } else { - GL31.glDrawElementsInstanced(glIndexMode, (IntBuffer) indices.getBuffer(), primcount); - } - - } else if (indices.getBuffer() instanceof ShortBuffer) { - if (primcount < 0) { - GL11.glDrawElements(glIndexMode, (ShortBuffer) indices.getBuffer()); - } else { - GL31.glDrawElementsInstanced(glIndexMode, (ShortBuffer) indices.getBuffer(), primcount); - } - - } else if (indices.getBuffer() instanceof ByteBuffer) { - if (primcount < 0) { - GL11.glDrawElements(glIndexMode, (ByteBuffer) indices.getBuffer()); - } else { - GL31.glDrawElementsInstanced(glIndexMode, (ByteBuffer) indices.getBuffer(), primcount); - } - } - - if (Constants.stats) { - addStats(indexModes[indexModeCounter], count); - } - - offset += count; - - if (indexModeCounter < indexModes.length - 1) { - indexModeCounter++; - } - } - } - } - - public static int setupVBO(final AbstractBufferData<? extends Buffer> data, final RenderContext context) { - if (data == null) { - return 0; - } - - final RendererRecord rendRecord = context.getRendererRecord(); - - int vboID = data.getVBOID(context.getGlContextRep()); - if (vboID != 0) { - updateVBO(data, rendRecord, vboID, 0); - - return vboID; - } - - final Buffer dataBuffer = data.getBuffer(); - if (dataBuffer != null) { - // XXX: should we be rewinding? Maybe make that the programmer's responsibility. - dataBuffer.rewind(); - vboID = makeVBOId(); - data.setVBOID(context.getGlContextRep(), vboID); - - rendRecord.invalidateVBO(); - LwjglRendererUtil.setBoundVBO(rendRecord, vboID); - if (dataBuffer instanceof FloatBuffer) { - ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (FloatBuffer) dataBuffer, - getGLVBOAccessMode(data.getVboAccessMode())); - } else if (dataBuffer instanceof ByteBuffer) { - ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (ByteBuffer) dataBuffer, - getGLVBOAccessMode(data.getVboAccessMode())); - } else if (dataBuffer instanceof IntBuffer) { - ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (IntBuffer) dataBuffer, - getGLVBOAccessMode(data.getVboAccessMode())); - } else if (dataBuffer instanceof ShortBuffer) { - ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (ShortBuffer) dataBuffer, - getGLVBOAccessMode(data.getVboAccessMode())); - } - } else { - throw new Ardor3dException("Attempting to create a vbo id for a FloatBufferData with no Buffer value."); - } - return vboID; - } - - public static void updateVBO(final AbstractBufferData<? extends Buffer> data, final RendererRecord rendRecord, - final int vboID, final int offsetBytes) { - if (data.isNeedsRefresh()) { - final Buffer dataBuffer = data.getBuffer(); - dataBuffer.rewind(); - LwjglRendererUtil.setBoundVBO(rendRecord, vboID); - if (dataBuffer instanceof FloatBuffer) { - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes, - (FloatBuffer) dataBuffer); - } else if (dataBuffer instanceof ByteBuffer) { - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes, - (ByteBuffer) dataBuffer); - } else if (dataBuffer instanceof IntBuffer) { - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes, - (IntBuffer) dataBuffer); - } else if (dataBuffer instanceof ShortBuffer) { - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes, - (ShortBuffer) dataBuffer); - } - data.setNeedsRefresh(false); - } - } - - private int setupIndicesVBO(final IndexBufferData<?> data, final RenderContext context, - final RendererRecord rendRecord) { - if (data == null) { - return 0; - } - - int vboID = data.getVBOID(context.getGlContextRep()); - if (vboID != 0) { - if (data.isNeedsRefresh()) { - final Buffer dataBuffer = data.getBuffer(); - dataBuffer.rewind(); - LwjglRendererUtil.setBoundElementVBO(rendRecord, vboID); - if (dataBuffer instanceof IntBuffer) { - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 0, - (IntBuffer) dataBuffer); - } else if (dataBuffer instanceof ShortBuffer) { - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 0, - (ShortBuffer) dataBuffer); - } else if (dataBuffer instanceof ByteBuffer) { - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 0, - (ByteBuffer) dataBuffer); - } - data.setNeedsRefresh(false); - } - - return vboID; - } - - final Buffer dataBuffer = data.getBuffer(); - if (dataBuffer != null) { - // XXX: should we be rewinding? Maybe make that the programmer's responsibility. - dataBuffer.rewind(); - vboID = makeVBOId(); - data.setVBOID(context.getGlContextRep(), vboID); - - rendRecord.invalidateVBO(); - LwjglRendererUtil.setBoundElementVBO(rendRecord, vboID); - if (dataBuffer instanceof IntBuffer) { - ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, - (IntBuffer) dataBuffer, getGLVBOAccessMode(data.getVboAccessMode())); - } else if (dataBuffer instanceof ShortBuffer) { - ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, - (ShortBuffer) dataBuffer, getGLVBOAccessMode(data.getVboAccessMode())); - } else if (dataBuffer instanceof ByteBuffer) { - ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, - (ByteBuffer) dataBuffer, getGLVBOAccessMode(data.getVboAccessMode())); - } - } else { - throw new Ardor3dException("Attempting to create a vbo id for a IndexBufferData with no Buffer value."); - } - return vboID; - } - - public void setupVertexDataVBO(final FloatBufferData data) { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord rendRecord = context.getRendererRecord(); - - final int vboID = setupVBO(data, context); - - if (vboID != 0) { - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - LwjglRendererUtil.setBoundVBO(rendRecord, vboID); - GL11.glVertexPointer(data.getValuesPerTuple(), GL11.GL_FLOAT, 0, 0); - } else { - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - } - } - - public void setupNormalDataVBO(final FloatBufferData data) { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord rendRecord = context.getRendererRecord(); - - final int vboID = setupVBO(data, context); - - if (vboID != 0) { - GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); - LwjglRendererUtil.setBoundVBO(rendRecord, vboID); - GL11.glNormalPointer(GL11.GL_FLOAT, 0, 0); - } else { - GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); - } - } - - public void setupColorDataVBO(final FloatBufferData data) { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord rendRecord = context.getRendererRecord(); - - final int vboID = setupVBO(data, context); - - if (vboID != 0) { - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - LwjglRendererUtil.setBoundVBO(rendRecord, vboID); - GL11.glColorPointer(data.getValuesPerTuple(), GL11.GL_FLOAT, 0, 0); - } else { - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - } - } - - public void setupFogDataVBO(final FloatBufferData data) { - final RenderContext context = ContextManager.getCurrentContext(); - final ContextCapabilities caps = context.getCapabilities(); - - if (!caps.isFogCoordinatesSupported()) { - return; - } - - final RendererRecord rendRecord = context.getRendererRecord(); - final int vboID = setupVBO(data, context); - - if (vboID != 0) { - GL11.glEnableClientState(EXTFogCoord.GL_FOG_COORDINATE_ARRAY_EXT); - LwjglRendererUtil.setBoundVBO(rendRecord, vboID); - EXTFogCoord.glFogCoordPointerEXT(GL11.GL_FLOAT, 0, 0); - } else { - GL11.glDisableClientState(EXTFogCoord.GL_FOG_COORDINATE_ARRAY_EXT); - } - } - - public void setupTextureDataVBO(final List<FloatBufferData> textureCoords) { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord rendRecord = context.getRendererRecord(); - final ContextCapabilities caps = context.getCapabilities(); - - final TextureState ts = (TextureState) context.getCurrentState(RenderState.StateType.Texture); - int enabledTextures = rendRecord.getEnabledTextures(); - final boolean valid = rendRecord.isTexturesValid(); - boolean exists, wasOn; - if (ts != null) { - final int max = caps.isMultitextureSupported() ? Math.min(caps.getNumberOfFragmentTexCoordUnits(), - TextureState.MAX_TEXTURES) : 1; - for (int i = 0; i < max; i++) { - wasOn = (enabledTextures & (2 << i)) != 0; - exists = textureCoords != null && i < textureCoords.size(); - - if (!exists) { - if (valid && !wasOn) { - continue; - } else { - checkAndSetTextureArrayUnit(i, rendRecord, caps); - - // disable bit in tracking int - enabledTextures &= ~(2 << i); - - // disable state - GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - - continue; - } - } else { - checkAndSetTextureArrayUnit(i, rendRecord, caps); - - // grab a vboID and make sure it exists and is up to date. - final FloatBufferData data = textureCoords.get(i); - final int vboID = setupVBO(data, context); - - // Found good vbo - if (vboID != 0) { - if (!valid || !wasOn) { - // enable bit in tracking int - enabledTextures |= (2 << i); - - // enable state - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - } - - // set our active vbo - LwjglRendererUtil.setBoundVBO(rendRecord, vboID); - - // send data - GL11.glTexCoordPointer(data.getValuesPerTuple(), GL11.GL_FLOAT, 0, 0); - } - // Not a good vbo, disable it. - else { - if (!valid || wasOn) { - // disable bit in tracking int - enabledTextures &= ~(2 << i); - - // disable state - GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - } - } - } - } - } - - rendRecord.setEnabledTextures(enabledTextures); - rendRecord.setTexturesValid(true); - } - - public void setupInterleavedDataVBO(final FloatBufferData interleaved, final FloatBufferData vertexCoords, - final FloatBufferData normalCoords, final FloatBufferData colorCoords, - final List<FloatBufferData> textureCoords) { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord rendRecord = context.getRendererRecord(); - final ContextCapabilities caps = context.getCapabilities(); - - final int lengthBytes = getTotalInterleavedSize(context, vertexCoords, normalCoords, colorCoords, textureCoords); - int currLengthBytes = 0; - if (interleaved.getBufferLimit() > 0) { - interleaved.getBuffer().rewind(); - currLengthBytes = Math.round(interleaved.getBuffer().get()); - } - - if (lengthBytes != currLengthBytes || interleaved.getVBOID(context.getGlContextRep()) == 0 - || interleaved.isNeedsRefresh()) { - initializeInterleavedVBO(context, interleaved, vertexCoords, normalCoords, colorCoords, textureCoords, - lengthBytes); - } - - final int vboID = interleaved.getVBOID(context.getGlContextRep()); - LwjglRendererUtil.setBoundVBO(rendRecord, vboID); - - int offsetBytes = 0; - - if (normalCoords != null) { - updateVBO(normalCoords, rendRecord, vboID, offsetBytes); - GL11.glNormalPointer(GL11.GL_FLOAT, 0, offsetBytes); - GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); - offsetBytes += normalCoords.getBufferLimit() * 4; - } else { - GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); - } - - if (colorCoords != null) { - updateVBO(colorCoords, rendRecord, vboID, offsetBytes); - GL11.glColorPointer(colorCoords.getValuesPerTuple(), GL11.GL_FLOAT, 0, offsetBytes); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - offsetBytes += colorCoords.getBufferLimit() * 4; - } else { - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - } - - if (textureCoords != null) { - final TextureState ts = (TextureState) context.getCurrentState(RenderState.StateType.Texture); - int enabledTextures = rendRecord.getEnabledTextures(); - final boolean valid = rendRecord.isTexturesValid(); - boolean exists, wasOn; - if (ts != null) { - final int max = caps.isMultitextureSupported() ? Math.min(caps.getNumberOfFragmentTexCoordUnits(), - TextureState.MAX_TEXTURES) : 1; - for (int i = 0; i < max; i++) { - wasOn = (enabledTextures & (2 << i)) != 0; - exists = textureCoords != null && i < textureCoords.size() && textureCoords.get(i) != null - && i <= ts.getMaxTextureIndexUsed(); - - if (!exists) { - if (valid && !wasOn) { - continue; - } else { - checkAndSetTextureArrayUnit(i, rendRecord, caps); - - // disable bit in tracking int - enabledTextures &= ~(2 << i); - - // disable state - GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - - continue; - } - - } else { - checkAndSetTextureArrayUnit(i, rendRecord, caps); - - // grab a vboID and make sure it exists and is up to date. - final FloatBufferData textureBufferData = textureCoords.get(i); - updateVBO(textureBufferData, rendRecord, vboID, offsetBytes); - - if (!valid || !wasOn) { - // enable bit in tracking int - enabledTextures |= (2 << i); - - // enable state - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - } - - // send data - GL11.glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL11.GL_FLOAT, 0, offsetBytes); - offsetBytes += textureBufferData.getBufferLimit() * 4; - } - } - } - - rendRecord.setEnabledTextures(enabledTextures); - rendRecord.setTexturesValid(true); - } - - if (vertexCoords != null) { - updateVBO(vertexCoords, rendRecord, vboID, offsetBytes); - GL11.glVertexPointer(vertexCoords.getValuesPerTuple(), GL11.GL_FLOAT, 0, offsetBytes); - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - } else { - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - } - } - - private void initializeInterleavedVBO(final RenderContext context, final FloatBufferData interleaved, - final FloatBufferData vertexCoords, final FloatBufferData normalCoords, final FloatBufferData colorCoords, - final List<FloatBufferData> textureCoords, final int bufferSize) { - - // keep around buffer size - if (interleaved.getBufferCapacity() != 1) { - final FloatBuffer buffer = BufferUtils.createFloatBufferOnHeap(1); - interleaved.setBuffer(buffer); - } - interleaved.getBuffer().rewind(); - interleaved.getBuffer().put(bufferSize); - - final RendererRecord rendRecord = context.getRendererRecord(); - final ContextCapabilities caps = context.getCapabilities(); - - final int vboID = makeVBOId(); - interleaved.setVBOID(context.getGlContextRep(), vboID); - - rendRecord.invalidateVBO(); - LwjglRendererUtil.setBoundVBO(rendRecord, vboID); - ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, bufferSize, - getGLVBOAccessMode(interleaved.getVboAccessMode())); - - int offsetBytes = 0; - if (normalCoords != null) { - normalCoords.getBuffer().rewind(); - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes, - normalCoords.getBuffer()); - offsetBytes += normalCoords.getBufferLimit() * 4; - } - if (colorCoords != null) { - colorCoords.getBuffer().rewind(); - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes, - colorCoords.getBuffer()); - offsetBytes += colorCoords.getBufferLimit() * 4; - } - if (textureCoords != null) { - final TextureState ts = (TextureState) context.getCurrentState(RenderState.StateType.Texture); - if (ts != null) { - for (int i = 0; i <= ts.getMaxTextureIndexUsed() && i < caps.getNumberOfFragmentTexCoordUnits(); i++) { - if (textureCoords == null || i >= textureCoords.size()) { - continue; - } - - final FloatBufferData textureBufferData = textureCoords.get(i); - final FloatBuffer textureBuffer = textureBufferData != null ? textureBufferData.getBuffer() : null; - if (textureBuffer != null) { - textureBuffer.rewind(); - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes, - textureBuffer); - offsetBytes += textureBufferData.getBufferLimit() * 4; - } - } - } - } - if (vertexCoords != null) { - vertexCoords.getBuffer().rewind(); - ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes, - vertexCoords.getBuffer()); - } - - interleaved.setNeedsRefresh(false); - } - - @Override - public void drawElementsVBO(final IndexBufferData<?> indices, final int[] indexLengths, - final IndexMode[] indexModes, final int primcount) { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord rendRecord = context.getRendererRecord(); - - final int vboID = setupIndicesVBO(indices, context, rendRecord); - - LwjglRendererUtil.setBoundElementVBO(rendRecord, vboID); - - if (indexLengths == null) { - final int glIndexMode = getGLIndexMode(indexModes[0]); - - final int type = getGLDataType(indices); - if (primcount < 0) { - GL11.glDrawElements(glIndexMode, indices.getBufferLimit(), type, 0); - } else { - GL31.glDrawElementsInstanced(glIndexMode, indices.getBufferLimit(), type, 0, primcount); - } - if (Constants.stats) { - addStats(indexModes[0], indices.getBufferLimit()); - } - } else { - int offset = 0; - int indexModeCounter = 0; - for (int i = 0; i < indexLengths.length; i++) { - final int count = indexLengths[i]; - - final int glIndexMode = getGLIndexMode(indexModes[indexModeCounter]); - - final int type = getGLDataType(indices); - final int byteSize = indices.getByteCount(); - // offset in this call is done in bytes. - if (primcount < 0) { - GL11.glDrawElements(glIndexMode, count, type, offset * byteSize); - } else { - GL31.glDrawElementsInstanced(glIndexMode, count, type, offset * byteSize, primcount); - } - - if (Constants.stats) { - addStats(indexModes[indexModeCounter], count); - } - - offset += count; - - if (indexModeCounter < indexModes.length - 1) { - indexModeCounter++; - } - } - } - } - - @Override - public void drawArrays(final FloatBufferData vertices, final int[] indexLengths, final IndexMode[] indexModes, - final int primcount) { - if (indexLengths == null) { - final int glIndexMode = getGLIndexMode(indexModes[0]); - - if (primcount < 0) { - GL11.glDrawArrays(glIndexMode, 0, vertices.getTupleCount()); - } else { - GL31.glDrawArraysInstanced(glIndexMode, 0, vertices.getTupleCount(), primcount); - } - - if (Constants.stats) { - addStats(indexModes[0], vertices.getTupleCount()); - } - } else { - int offset = 0; - int indexModeCounter = 0; - for (int i = 0; i < indexLengths.length; i++) { - final int count = indexLengths[i]; - - final int glIndexMode = getGLIndexMode(indexModes[indexModeCounter]); - - if (primcount < 0) { - GL11.glDrawArrays(glIndexMode, offset, count); - } else { - GL31.glDrawArraysInstanced(glIndexMode, offset, count, primcount); - } - - if (Constants.stats) { - addStats(indexModes[indexModeCounter], count); - } - - offset += count; - - if (indexModeCounter < indexModes.length - 1) { - indexModeCounter++; - } - } - } - } - - public static int makeVBOId() { - return ARBBufferObject.glGenBuffersARB(); - } - - public void unbindVBO() { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord rendRecord = context.getRendererRecord(); - LwjglRendererUtil.setBoundVBO(rendRecord, 0); - LwjglRendererUtil.setBoundElementVBO(rendRecord, 0); - } - - private static int getGLVBOAccessMode(final VBOAccessMode vboAccessMode) { - int glMode = ARBBufferObject.GL_STATIC_DRAW_ARB; - switch (vboAccessMode) { - case StaticDraw: - glMode = ARBBufferObject.GL_STATIC_DRAW_ARB; - break; - case StaticRead: - glMode = ARBBufferObject.GL_STATIC_READ_ARB; - break; - case StaticCopy: - glMode = ARBBufferObject.GL_STATIC_COPY_ARB; - break; - case DynamicDraw: - glMode = ARBBufferObject.GL_DYNAMIC_DRAW_ARB; - break; - case DynamicRead: - glMode = ARBBufferObject.GL_DYNAMIC_READ_ARB; - break; - case DynamicCopy: - glMode = ARBBufferObject.GL_DYNAMIC_COPY_ARB; - break; - case StreamDraw: - glMode = ARBBufferObject.GL_STREAM_DRAW_ARB; - break; - case StreamRead: - glMode = ARBBufferObject.GL_STREAM_READ_ARB; - break; - case StreamCopy: - glMode = ARBBufferObject.GL_STREAM_COPY_ARB; - break; - } - return glMode; - } - - private int getGLIndexMode(final IndexMode indexMode) { - int glMode = GL11.GL_TRIANGLES; - switch (indexMode) { - case Triangles: - glMode = GL11.GL_TRIANGLES; - break; - case TriangleStrip: - glMode = GL11.GL_TRIANGLE_STRIP; - break; - case TriangleFan: - glMode = GL11.GL_TRIANGLE_FAN; - break; - case Quads: - glMode = GL11.GL_QUADS; - break; - case QuadStrip: - glMode = GL11.GL_QUAD_STRIP; - break; - case Lines: - glMode = GL11.GL_LINES; - break; - case LineStrip: - glMode = GL11.GL_LINE_STRIP; - break; - case LineLoop: - glMode = GL11.GL_LINE_LOOP; - break; - case Points: - glMode = GL11.GL_POINTS; - break; - } - return glMode; - } - - private int getGLDataType(final IndexBufferData<?> indices) { - if (indices.getBuffer() instanceof ByteBuffer) { - return GL11.GL_UNSIGNED_BYTE; - } else if (indices.getBuffer() instanceof ShortBuffer) { - return GL11.GL_UNSIGNED_SHORT; - } else if (indices.getBuffer() instanceof IntBuffer) { - return GL11.GL_UNSIGNED_INT; - } - - throw new IllegalArgumentException("Unknown buffer type: " + indices.getBuffer()); - } - - public void setModelViewMatrix(final FloatBuffer matrix) { - final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW); - loadMatrix(matrix); - } - - public void setProjectionMatrix(final FloatBuffer matrix) { - final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_PROJECTION); - loadMatrix(matrix); - } - - private void loadMatrix(final FloatBuffer matrix) { - GL11.glLoadMatrix(matrix); - } - - public FloatBuffer getModelViewMatrix(final FloatBuffer store) { - return getMatrix(GL11.GL_MODELVIEW_MATRIX, store); - } - - public FloatBuffer getProjectionMatrix(final FloatBuffer store) { - return getMatrix(GL11.GL_PROJECTION_MATRIX, store); - } - - private FloatBuffer getMatrix(final int matrixType, final FloatBuffer store) { - FloatBuffer result = store; - if (result.remaining() < 16) { - result = BufferUtils.createFloatBuffer(16); - } - GL11.glGetFloat(matrixType, store); - return result; - } - - public void setViewport(final int x, final int y, final int width, final int height) { - GL11.glViewport(x, y, width, height); - } - - public void setDepthRange(final double depthRangeNear, final double depthRangeFar) { - GL11.glDepthRange(depthRangeNear, depthRangeFar); - } - - public void setDrawBuffer(final DrawBufferTarget target) { - final RendererRecord record = ContextManager.getCurrentContext().getRendererRecord(); - if (record.getDrawBufferTarget() != target) { - int buffer = GL11.GL_BACK; - switch (target) { - case Back: - break; - case Front: - buffer = GL11.GL_FRONT; - break; - case BackLeft: - buffer = GL11.GL_BACK_LEFT; - break; - case BackRight: - buffer = GL11.GL_BACK_RIGHT; - break; - case FrontLeft: - buffer = GL11.GL_FRONT_LEFT; - break; - case FrontRight: - buffer = GL11.GL_FRONT_RIGHT; - break; - case FrontAndBack: - buffer = GL11.GL_FRONT_AND_BACK; - break; - case Left: - buffer = GL11.GL_LEFT; - break; - case Right: - buffer = GL11.GL_RIGHT; - break; - case Aux0: - buffer = GL11.GL_AUX0; - break; - case Aux1: - buffer = GL11.GL_AUX1; - break; - case Aux2: - buffer = GL11.GL_AUX2; - break; - case Aux3: - buffer = GL11.GL_AUX3; - break; - } - - GL11.glDrawBuffer(buffer); - record.setDrawBufferTarget(target); - } - } - - public void setupLineParameters(final float lineWidth, final int stippleFactor, final short stipplePattern, - final boolean antialiased) { - final LineRecord lineRecord = ContextManager.getCurrentContext().getLineRecord(); - - if (!lineRecord.isValid() || lineRecord.width != lineWidth) { - GL11.glLineWidth(lineWidth); - lineRecord.width = lineWidth; - } - - if (stipplePattern != (short) 0xFFFF) { - if (!lineRecord.isValid() || !lineRecord.stippled) { - GL11.glEnable(GL11.GL_LINE_STIPPLE); - lineRecord.stippled = true; - } - - if (!lineRecord.isValid() || stippleFactor != lineRecord.stippleFactor - || stipplePattern != lineRecord.stipplePattern) { - GL11.glLineStipple(stippleFactor, stipplePattern); - lineRecord.stippleFactor = stippleFactor; - lineRecord.stipplePattern = stipplePattern; - } - } else if (!lineRecord.isValid() || lineRecord.stippled) { - GL11.glDisable(GL11.GL_LINE_STIPPLE); - lineRecord.stippled = false; - } - - if (antialiased) { - if (!lineRecord.isValid() || !lineRecord.smoothed) { - GL11.glEnable(GL11.GL_LINE_SMOOTH); - lineRecord.smoothed = true; - } - if (!lineRecord.isValid() || lineRecord.smoothHint != GL11.GL_NICEST) { - GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); - lineRecord.smoothHint = GL11.GL_NICEST; - } - } else if (!lineRecord.isValid() || lineRecord.smoothed) { - GL11.glDisable(GL11.GL_LINE_SMOOTH); - lineRecord.smoothed = false; - } - - if (!lineRecord.isValid()) { - lineRecord.validate(); - } - } - - @Override - public void setupPointParameters(final float pointSize, final boolean antialiased, final boolean isSprite, - final boolean useDistanceAttenuation, final FloatBuffer attenuationCoefficients, final float minPointSize, - final float maxPointSize) { - final RenderContext context = ContextManager.getCurrentContext(); - - // TODO: make a record for point states - GL11.glPointSize(pointSize); - - if (isSprite && context.getCapabilities().isPointSpritesSupported()) { - GL11.glEnable(ARBPointSprite.GL_POINT_SPRITE_ARB); - GL11.glTexEnvi(ARBPointSprite.GL_POINT_SPRITE_ARB, ARBPointSprite.GL_COORD_REPLACE_ARB, GL11.GL_TRUE); - } - - if (useDistanceAttenuation && context.getCapabilities().isPointParametersSupported()) { - ARBPointParameters.glPointParameterARB(ARBPointParameters.GL_POINT_DISTANCE_ATTENUATION_ARB, - attenuationCoefficients); - ARBPointParameters.glPointParameterfARB(ARBPointParameters.GL_POINT_SIZE_MIN_ARB, minPointSize); - ARBPointParameters.glPointParameterfARB(ARBPointParameters.GL_POINT_SIZE_MAX_ARB, maxPointSize); - } - - if (antialiased) { - GL11.glEnable(GL11.GL_POINT_SMOOTH); - GL11.glHint(GL11.GL_POINT_SMOOTH_HINT, GL11.GL_NICEST); - } - } - - @Override - public void doApplyState(final RenderState state) { - if (state == null) { - logger.warning("tried to apply a null state."); - return; - } - switch (state.getType()) { - case Texture: - LwjglTextureStateUtil.apply((TextureState) state); - return; - case Light: - LwjglLightStateUtil.apply((LightState) state); - return; - case Blend: - LwjglBlendStateUtil.apply((BlendState) state); - return; - case Clip: - LwjglClipStateUtil.apply((ClipState) state); - return; - case ColorMask: - LwjglColorMaskStateUtil.apply((ColorMaskState) state); - return; - case Cull: - LwjglCullStateUtil.apply((CullState) state); - return; - case Fog: - LwjglFogStateUtil.apply((FogState) state); - return; - case FragmentProgram: - LwjglFragmentProgramStateUtil.apply((FragmentProgramState) state); - return; - case GLSLShader: - LwjglShaderObjectsStateUtil.apply(this, (GLSLShaderObjectsState) state); - return; - case Material: - LwjglMaterialStateUtil.apply((MaterialState) state); - return; - case Offset: - LwjglOffsetStateUtil.apply(this, (OffsetState) state); - return; - case Shading: - LwjglShadingStateUtil.apply((ShadingState) state); - return; - case Stencil: - LwjglStencilStateUtil.apply((StencilState) state); - return; - case VertexProgram: - LwjglVertexProgramStateUtil.apply((VertexProgramState) state); - return; - case Wireframe: - LwjglWireframeStateUtil.apply(this, (WireframeState) state); - return; - case ZBuffer: - LwjglZBufferStateUtil.apply((ZBufferState) state); - return; - } - throw new IllegalArgumentException("Unknown state: " + state); - } - - public void deleteTexture(final Texture texture) { - LwjglTextureStateUtil.deleteTexture(texture); - } - - public void loadTexture(final Texture texture, final int unit) { - LwjglTextureStateUtil.load(texture, unit); - } - - public void deleteTextureIds(final Collection<Integer> ids) { - LwjglTextureStateUtil.deleteTextureIds(ids); - } - - /** - * Start a new display list. All further renderer commands that can be stored in a display list are part of this new - * list until {@link #endDisplayList()} is called. - * - * @return id of new display list - */ - public int startDisplayList() { - final int id = GL11.glGenLists(1); - - GL11.glNewList(id, GL11.GL_COMPILE); - - return id; - } - - /** - * Ends a display list. Will likely cause an OpenGL exception is a display list is not currently being generated. - */ - public void endDisplayList() { - GL11.glEndList(); - } - - /** - * Draw the given display list. - */ - public void renderDisplayList(final int displayListID) { - GL11.glCallList(displayListID); - } - - public void clearClips() { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord record = context.getRendererRecord(); - record.getScissorClips().clear(); - - LwjglRendererUtil.applyScissors(record); - } - - public void popClip() { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord record = context.getRendererRecord(); - record.getScissorClips().pop(); - - LwjglRendererUtil.applyScissors(record); - } - - public void pushClip(final ReadOnlyRectangle2 rectangle) { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord record = context.getRendererRecord(); - record.getScissorClips().push(rectangle); - - LwjglRendererUtil.applyScissors(record); - } - - public void pushEmptyClip() { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord record = context.getRendererRecord(); - record.getScissorClips().push(null); - - LwjglRendererUtil.applyScissors(record); - } - - public void setClipTestEnabled(final boolean enabled) { - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord record = context.getRendererRecord(); - - LwjglRendererUtil.setClippingEnabled(record, enabled); - } - - public void checkAndSetTextureArrayUnit(final int unit, final RendererRecord record, final ContextCapabilities caps) { - if (record.getCurrentTextureArraysUnit() != unit && caps.isMultitextureSupported()) { - ARBMultitexture.glClientActiveTextureARB(ARBMultitexture.GL_TEXTURE0_ARB + unit); - record.setCurrentTextureArraysUnit(unit); - } - } - -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglTextureRenderer.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglTextureRenderer.java deleted file mode 100644 index 5f66a48..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglTextureRenderer.java +++ /dev/null @@ -1,566 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.renderer.lwjgl; - -import java.nio.ByteBuffer; -import java.nio.IntBuffer; -import java.util.LinkedList; -import java.util.List; -import java.util.logging.Logger; - -import org.lwjgl.opengl.ARBDepthTexture; -import org.lwjgl.opengl.ARBDrawBuffers; -import org.lwjgl.opengl.EXTFramebufferBlit; -import org.lwjgl.opengl.EXTFramebufferMultisample; -import org.lwjgl.opengl.EXTFramebufferObject; -import org.lwjgl.opengl.GL11; - -import com.ardor3d.framework.Scene; -import com.ardor3d.image.Texture; -import com.ardor3d.image.Texture.Type; -import com.ardor3d.image.TextureCubeMap; -import com.ardor3d.image.TextureCubeMap.Face; -import com.ardor3d.math.type.ReadOnlyColorRGBA; -import com.ardor3d.renderer.AbstractFBOTextureRenderer; -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.TextureRendererFactory; -import com.ardor3d.renderer.state.RenderState; -import com.ardor3d.renderer.state.record.RendererRecord; -import com.ardor3d.renderer.state.record.TextureRecord; -import com.ardor3d.renderer.state.record.TextureStateRecord; -import com.ardor3d.scene.state.lwjgl.LwjglTextureStateUtil; -import com.ardor3d.scene.state.lwjgl.util.LwjglTextureUtil; -import com.ardor3d.scenegraph.Spatial; -import com.ardor3d.util.Ardor3dException; -import com.ardor3d.util.TextureKey; -import com.ardor3d.util.geom.BufferUtils; - -/** - * <p> - * This class is used by Ardor3D's LWJGL implementation to render textures. Users should <b>not</b> create this class - * directly. - * </p> - * - * @see TextureRendererFactory - */ -public class LwjglTextureRenderer extends AbstractFBOTextureRenderer { - private static final Logger logger = Logger.getLogger(LwjglTextureRenderer.class.getName()); - - public LwjglTextureRenderer(final int width, final int height, final int depthBits, final int samples, - final Renderer parentRenderer, final ContextCapabilities caps) { - super(width, height, depthBits, samples, parentRenderer, caps); - - if (caps.getMaxFBOColorAttachments() > 1) { - _attachBuffer = BufferUtils.createIntBuffer(caps.getMaxFBOColorAttachments()); - for (int i = 0; i < caps.getMaxFBOColorAttachments(); i++) { - _attachBuffer.put(EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT + i); - } - } - } - - /** - * <code>setupTexture</code> initializes a new Texture object for use with TextureRenderer. Generates a valid OpenGL - * texture id for this texture and initializes the data type for the texture. - */ - public void setupTexture(final Texture tex) { - if (tex.getType() != Type.TwoDimensional && tex.getType() != Type.CubeMap) { - throw new IllegalArgumentException("Texture type not supported: " + tex.getType()); - } - - final RenderContext context = ContextManager.getCurrentContext(); - final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(RenderState.StateType.Texture); - - // check if we are already setup... if so, throw error. - if (tex.getTextureKey() == null) { - tex.setTextureKey(TextureKey.getRTTKey(tex.getMinificationFilter())); - } else if (tex.getTextureIdForContext(context.getGlContextRep()) != 0) { - throw new Ardor3dException("Texture is already setup and has id."); - } - - // Create the texture - final IntBuffer ibuf = BufferUtils.createIntBuffer(1); - GL11.glGenTextures(ibuf); - final int textureId = ibuf.get(0); - tex.setTextureIdForContext(context.getGlContextRep(), textureId); - - LwjglTextureStateUtil.doTextureBind(tex, 0, true); - - // Initialize our texture with some default data. - final int internalFormat = LwjglTextureUtil.getGLInternalFormat(tex.getTextureStoreFormat()); - final int dataFormat = LwjglTextureUtil.getGLPixelFormatFromStoreFormat(tex.getTextureStoreFormat()); - final int pixelDataType = LwjglTextureUtil.getGLPixelDataType(tex.getRenderedTexturePixelDataType()); - - if (tex.getType() == Type.TwoDimensional) { - GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, internalFormat, _width, _height, 0, dataFormat, pixelDataType, - (ByteBuffer) null); - } else { - for (final Face face : Face.values()) { - GL11.glTexImage2D(LwjglTextureStateUtil.getGLCubeMapFace(face), 0, internalFormat, _width, _height, 0, - dataFormat, pixelDataType, (ByteBuffer) null); - } - } - - // Initialize mipmapping for this texture, if requested - if (tex.getMinificationFilter().usesMipMapLevels()) { - EXTFramebufferObject.glGenerateMipmapEXT(LwjglTextureStateUtil.getGLType(tex.getType())); - } - - // Setup filtering and wrap - final TextureRecord texRecord = record.getTextureRecord(textureId, tex.getType()); - LwjglTextureStateUtil.applyFilter(tex, texRecord, 0, record, context.getCapabilities()); - LwjglTextureStateUtil.applyWrap(tex, texRecord, 0, record, context.getCapabilities()); - - logger.fine("setup fbo tex with id " + textureId + ": " + _width + "," + _height); - } - - public void render(final Spatial spat, final List<Texture> texs, final int clear) { - render(null, spat, null, texs, clear); - } - - public void render(final List<? extends Spatial> spat, final List<Texture> texs, final int clear) { - render(spat, null, null, texs, clear); - } - - @Override - public void render(final Scene scene, final List<Texture> texs, final int clear) { - render(null, null, scene, texs, clear); - } - - private void render(final List<? extends Spatial> toDrawA, final Spatial toDrawB, final Scene toDrawC, - final List<Texture> texs, final int clear) { - - final int maxDrawBuffers = ContextManager.getCurrentContext().getCapabilities().getMaxFBOColorAttachments(); - - // if we only support 1 draw buffer at a time anyway, we'll have to render to each texture individually... - if (maxDrawBuffers == 1 || texs.size() == 1) { - try { - ContextManager.getCurrentContext().pushFBOTextureRenderer(this); - - for (int i = 0; i < texs.size(); i++) { - final Texture tex = texs.get(i); - - setupForSingleTexDraw(tex); - - if (_samples > 0 && _supportsMultisample) { - setMSFBO(); - } - - switchCameraIn(clear); - if (toDrawA != null) { - doDraw(toDrawA); - } else if (toDrawB != null) { - doDraw(toDrawB); - } else { - doDraw(toDrawC); - } - switchCameraOut(); - - if (_samples > 0 && _supportsMultisample) { - blitMSFBO(); - } - - takedownForSingleTexDraw(tex); - } - } finally { - ContextManager.getCurrentContext().popFBOTextureRenderer(); - } - return; - } - try { - ContextManager.getCurrentContext().pushFBOTextureRenderer(this); - - // Otherwise, we can streamline this by rendering to multiple textures at once. - // first determine how many groups we need - final LinkedList<Texture> depths = new LinkedList<Texture>(); - final LinkedList<Texture> colors = new LinkedList<Texture>(); - for (int i = 0; i < texs.size(); i++) { - final Texture tex = texs.get(i); - if (tex.getTextureStoreFormat().isDepthFormat()) { - depths.add(tex); - } else { - colors.add(tex); - } - } - // we can only render to 1 depth texture at a time, so # groups is at minimum == numDepth - final int groups = Math.max(depths.size(), (int) Math.ceil(colors.size() / (float) maxDrawBuffers)); - - final RenderContext context = ContextManager.getCurrentContext(); - for (int i = 0; i < groups; i++) { - // First handle colors - int colorsAdded = 0; - while (colorsAdded < maxDrawBuffers && !colors.isEmpty()) { - final Texture tex = colors.removeFirst(); - if (tex.getType() == Type.TwoDimensional) { - EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT + colorsAdded, GL11.GL_TEXTURE_2D, - tex.getTextureIdForContext(context.getGlContextRep()), 0); - } else if (tex.getType() == Type.CubeMap) { - EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT + colorsAdded, - LwjglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), - tex.getTextureIdForContext(context.getGlContextRep()), 0); - } else { - throw new IllegalArgumentException("Invalid texture type: " + tex.getType()); - } - colorsAdded++; - } - - // Now take care of depth. - if (!depths.isEmpty()) { - final Texture tex = depths.removeFirst(); - // Set up our depth texture - if (tex.getType() == Type.TwoDimensional) { - EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, GL11.GL_TEXTURE_2D, - tex.getTextureIdForContext(context.getGlContextRep()), 0); - } else if (tex.getType() == Type.CubeMap) { - EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, - LwjglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), - tex.getTextureIdForContext(context.getGlContextRep()), 0); - } else { - throw new IllegalArgumentException("Invalid texture type: " + tex.getType()); - } - _usingDepthRB = false; - } else if (!_usingDepthRB) { - // setup our default depth render buffer if not already set - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, - _depthRBID); - _usingDepthRB = true; - } - - setDrawBuffers(colorsAdded); - setReadBuffer(colorsAdded != 0 ? EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT : GL11.GL_NONE); - - // Check FBO complete - checkFBOComplete(_fboID); - - switchCameraIn(clear); - - if (toDrawA != null) { - doDraw(toDrawA); - } else { - doDraw(toDrawB); - } - - switchCameraOut(); - } - - // automatically generate mipmaps for our textures. - for (int x = 0, max = texs.size(); x < max; x++) { - if (texs.get(x).getMinificationFilter().usesMipMapLevels()) { - final Texture tex = texs.get(x); - if (tex.getMinificationFilter().usesMipMapLevels()) { - LwjglTextureStateUtil.doTextureBind(texs.get(x), 0, true); - EXTFramebufferObject.glGenerateMipmapEXT(LwjglTextureStateUtil.getGLType(tex.getType())); - } - } - } - - } finally { - ContextManager.getCurrentContext().popFBOTextureRenderer(); - } - } - - @Override - protected void setupForSingleTexDraw(final Texture tex) { - final RenderContext context = ContextManager.getCurrentContext(); - final int textureId = tex.getTextureIdForContext(context.getGlContextRep()); - - if (tex.getTextureStoreFormat().isDepthFormat()) { - // No color buffer - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, 0); - - // Setup depth texture into FBO - if (tex.getType() == Type.TwoDimensional) { - EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, GL11.GL_TEXTURE_2D, textureId, 0); - } else if (tex.getType() == Type.CubeMap) { - EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, - LwjglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), textureId, - 0); - } else { - throw new IllegalArgumentException("Can not render to texture of type: " + tex.getType()); - } - - setDrawBuffer(GL11.GL_NONE); - setReadBuffer(GL11.GL_NONE); - } else { - // Set color texture into FBO - if (tex.getType() == Type.TwoDimensional) { - EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, textureId, 0); - } else if (tex.getType() == Type.CubeMap) { - EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, - LwjglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), textureId, - 0); - } else { - throw new IllegalArgumentException("Can not render to texture of type: " + tex.getType()); - } - - // setup depth RB - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, _depthRBID); - - setDrawBuffer(EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT); - setReadBuffer(EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT); - } - - // Check FBO complete - checkFBOComplete(_fboID); - } - - private void setReadBuffer(final int attachVal) { - GL11.glReadBuffer(attachVal); - } - - private void setDrawBuffer(final int attachVal) { - GL11.glDrawBuffer(attachVal); - } - - private void setDrawBuffers(final int maxEntry) { - if (maxEntry <= 1) { - setDrawBuffer(maxEntry != 0 ? EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT : GL11.GL_NONE); - } else { - // We should only get to this point if we support ARBDrawBuffers. - _attachBuffer.clear(); - _attachBuffer.limit(maxEntry); - ARBDrawBuffers.glDrawBuffersARB(_attachBuffer); - } - } - - @Override - protected void takedownForSingleTexDraw(final Texture tex) { - // automatically generate mipmaps for our texture. - if (tex.getMinificationFilter().usesMipMapLevels()) { - LwjglTextureStateUtil.doTextureBind(tex, 0, true); - EXTFramebufferObject.glGenerateMipmapEXT(LwjglTextureStateUtil.getGLType(tex.getType())); - } - } - - @Override - protected void setMSFBO() { - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferBlit.GL_DRAW_FRAMEBUFFER_EXT, _msfboID); - } - - @Override - protected void blitMSFBO() { - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferBlit.GL_READ_FRAMEBUFFER_EXT, _msfboID); - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferBlit.GL_DRAW_FRAMEBUFFER_EXT, _fboID); - EXTFramebufferBlit.glBlitFramebufferEXT(0, 0, _width, _height, 0, 0, _width, _height, GL11.GL_COLOR_BUFFER_BIT - | GL11.GL_DEPTH_BUFFER_BIT, GL11.GL_NEAREST); - - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferBlit.GL_READ_FRAMEBUFFER_EXT, 0); - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferBlit.GL_DRAW_FRAMEBUFFER_EXT, 0); - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0); - } - - /** - * Check the currently bound FBO status for completeness. The passed in fboID is for informational purposes only. - * - * @param fboID - * an id to use for log messages, particularly if there are any issues. - */ - public static void checkFBOComplete(final int fboID) { - final int status = EXTFramebufferObject.glCheckFramebufferStatusEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT); - switch (status) { - case EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT: - break; - case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: - throw new IllegalStateException("FrameBuffer: " + fboID - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception"); - case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: - throw new IllegalStateException("FrameBuffer: " + fboID - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception"); - case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: - throw new IllegalStateException("FrameBuffer: " + fboID - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT exception"); - case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: - throw new IllegalStateException("FrameBuffer: " + fboID - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception"); - case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: - throw new IllegalStateException("FrameBuffer: " + fboID - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT exception"); - case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: - throw new IllegalStateException("FrameBuffer: " + fboID - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception"); - case EXTFramebufferObject.GL_FRAMEBUFFER_UNSUPPORTED_EXT: - throw new IllegalStateException("FrameBuffer: " + fboID - + ", has caused a GL_FRAMEBUFFER_UNSUPPORTED_EXT exception."); - case EXTFramebufferMultisample.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT: - throw new IllegalStateException("FrameBuffer: " + fboID - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT exception."); - default: - throw new IllegalStateException("Unexpected reply from glCheckFramebufferStatusEXT: " + status); - } - } - - public void copyToTexture(final Texture tex, final int x, final int y, final int width, final int height, - final int xoffset, final int yoffset) { - LwjglTextureStateUtil.doTextureBind(tex, 0, true); - - if (tex.getType() == Type.TwoDimensional) { - GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, xoffset, yoffset, x, y, width, height); - } else if (tex.getType() == Type.CubeMap) { - GL11.glCopyTexSubImage2D( - LwjglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), 0, xoffset, - yoffset, x, y, width, height); - } else { - throw new IllegalArgumentException("Invalid texture type: " + tex.getType()); - } - } - - @Override - protected void clearBuffers(final int clear) { - GL11.glDisable(GL11.GL_SCISSOR_TEST); - _parentRenderer.clearBuffers(clear); - } - - @Override - protected void activate() { - // Lazy init - if (_fboID == 0) { - final IntBuffer buffer = BufferUtils.createIntBuffer(1); - - // Create our texture binding FBO - EXTFramebufferObject.glGenFramebuffersEXT(buffer); // generate id - _fboID = buffer.get(0); - - // Create a depth renderbuffer to use for RTT use - EXTFramebufferObject.glGenRenderbuffersEXT(buffer); // generate id - _depthRBID = buffer.get(0); - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, _depthRBID); - int format = GL11.GL_DEPTH_COMPONENT; - if (_supportsDepthTexture && _depthBits > 0) { - switch (_depthBits) { - case 16: - format = ARBDepthTexture.GL_DEPTH_COMPONENT16_ARB; - break; - case 24: - format = ARBDepthTexture.GL_DEPTH_COMPONENT24_ARB; - break; - case 32: - format = ARBDepthTexture.GL_DEPTH_COMPONENT32_ARB; - break; - default: - // stick with the "undefined" GL_DEPTH_COMPONENT - } - } - EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, format, _width, - _height); - - // unbind... - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, 0); - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0); - - // If we support it, rustle up a multisample framebuffer + renderbuffers - if (_samples != 0 && _supportsMultisample) { - // create ms framebuffer object - EXTFramebufferObject.glGenFramebuffersEXT(buffer); - _msfboID = buffer.get(0); - - // create ms renderbuffers - EXTFramebufferObject.glGenRenderbuffersEXT(buffer); // generate id - _mscolorRBID = buffer.get(0); - EXTFramebufferObject.glGenRenderbuffersEXT(buffer); // generate id - _msdepthRBID = buffer.get(0); - - // set up renderbuffer properties - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, _mscolorRBID); - EXTFramebufferMultisample.glRenderbufferStorageMultisampleEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, - _samples, GL11.GL_RGBA, _width, _height); - - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, _msdepthRBID); - EXTFramebufferMultisample.glRenderbufferStorageMultisampleEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, - _samples, format, _width, _height); - - EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, 0); - - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _msfboID); - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, - _mscolorRBID); - EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, - EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, - _msdepthRBID); - - // check for errors - checkFBOComplete(_msfboID); - - // release - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0); - } - - } - - if (_active == 0) { - - final RenderContext context = ContextManager.getCurrentContext(); - final RendererRecord record = context.getRendererRecord(); - - // needed as FBOs do not share this flag it seems - record.setClippingTestValid(false); - - // push a delimiter onto the clip stack - _neededClip = _parentRenderer.isClipTestEnabled(); - if (_neededClip) { - _parentRenderer.pushEmptyClip(); - } - - GL11.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(), - _backgroundColor.getAlpha()); - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _fboID); - ContextManager.getCurrentContext().pushEnforcedStates(); - ContextManager.getCurrentContext().clearEnforcedStates(); - ContextManager.getCurrentContext().enforceStates(_enforcedStates); - } - _active++; - } - - @Override - protected void deactivate() { - if (_active == 1) { - final ReadOnlyColorRGBA bgColor = _parentRenderer.getBackgroundColor(); - GL11.glClearColor(bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue(), bgColor.getAlpha()); - EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0); - - ContextManager.getCurrentContext().popEnforcedStates(); - - if (_neededClip) { - _parentRenderer.popClip(); - } - } - _active--; - } - - public void cleanup() { - if (_fboID != 0) { - final IntBuffer id = BufferUtils.createIntBuffer(1); - id.put(_fboID); - id.rewind(); - EXTFramebufferObject.glDeleteFramebuffersEXT(id); - } - - if (_depthRBID != 0) { - final IntBuffer id = BufferUtils.createIntBuffer(1); - id.put(_depthRBID); - id.rewind(); - EXTFramebufferObject.glDeleteRenderbuffersEXT(id); - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglTextureRendererProvider.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglTextureRendererProvider.java deleted file mode 100644 index 594d4bc..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglTextureRendererProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.renderer.lwjgl; - -import java.util.logging.Logger; - -import com.ardor3d.framework.DisplaySettings; -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.TextureRenderer; -import com.ardor3d.renderer.TextureRendererProvider; - -public class LwjglTextureRendererProvider implements TextureRendererProvider { - - private static final Logger logger = Logger.getLogger(LwjglTextureRendererProvider.class.getName()); - - public TextureRenderer createTextureRenderer(final int width, final int height, final Renderer renderer, - final ContextCapabilities caps) { - return createTextureRenderer(width, height, 0, 0, renderer, caps); - } - - public TextureRenderer createTextureRenderer(final int width, final int height, final int depthBits, - final int samples, final Renderer renderer, final ContextCapabilities caps) { - return createTextureRenderer(new DisplaySettings(width, height, depthBits, samples), false, renderer, caps); - } - - public TextureRenderer createTextureRenderer(final DisplaySettings settings, final boolean forcePbuffer, - final Renderer renderer, final ContextCapabilities caps) { - if (!forcePbuffer && caps.isFBOSupported()) { - return new LwjglTextureRenderer(settings.getWidth(), settings.getHeight(), settings.getDepthBits(), - settings.getSamples(), renderer, caps); - } else if (caps.isPbufferSupported()) { - return new LwjglPbufferTextureRenderer(settings, renderer, caps); - } else { - logger.severe("No texture renderer support (FBO or Pbuffer)."); - return null; - } - - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglBlendStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglBlendStateUtil.java deleted file mode 100644 index 9a65133..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglBlendStateUtil.java +++ /dev/null @@ -1,425 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.ARBImaging; -import org.lwjgl.opengl.ARBMultisample; -import org.lwjgl.opengl.EXTBlendColor; -import org.lwjgl.opengl.EXTBlendEquationSeparate; -import org.lwjgl.opengl.EXTBlendFuncSeparate; -import org.lwjgl.opengl.EXTBlendMinmax; -import org.lwjgl.opengl.EXTBlendSubtract; -import org.lwjgl.opengl.GL11; - -import com.ardor3d.math.type.ReadOnlyColorRGBA; -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.BlendState; -import com.ardor3d.renderer.state.BlendState.BlendEquation; -import com.ardor3d.renderer.state.BlendState.DestinationFunction; -import com.ardor3d.renderer.state.BlendState.SourceFunction; -import com.ardor3d.renderer.state.BlendState.TestFunction; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.BlendStateRecord; - -public abstract class LwjglBlendStateUtil { - - public static void apply(final BlendState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final BlendStateRecord record = (BlendStateRecord) context.getStateRecord(StateType.Blend); - final ContextCapabilities caps = context.getCapabilities(); - context.setCurrentState(StateType.Blend, state); - - if (state.isEnabled()) { - applyBlendEquations(state.isBlendEnabled(), state, record, caps); - applyBlendColor(state.isBlendEnabled(), state, record, caps); - applyBlendFunctions(state.isBlendEnabled(), state, record, caps); - - applyTest(state.isTestEnabled(), state, record); - - if (caps.isMultisampleSupported()) { - applyAlphaCoverage(state.isSampleAlphaToCoverageEnabled(), state.isSampleAlphaToOneEnabled(), record, - caps); - applySampleCoverage(state.isSampleCoverageEnabled(), state, record, caps); - } - } else { - // disable blend - applyBlendEquations(false, state, record, caps); - - // disable alpha test - applyTest(false, state, record); - - // disable sample coverage - if (caps.isMultisampleSupported()) { - applyAlphaCoverage(false, false, record, caps); - applySampleCoverage(false, state, record, caps); - } - } - - if (!record.isValid()) { - record.validate(); - } - } - - protected static void applyBlendEquations(final boolean enabled, final BlendState state, - final BlendStateRecord record, final ContextCapabilities caps) { - if (record.isValid()) { - if (enabled) { - if (!record.blendEnabled) { - GL11.glEnable(GL11.GL_BLEND); - record.blendEnabled = true; - } - final int blendEqRGB = getGLEquationValue(state.getBlendEquationRGB(), caps); - if (caps.isSeparateBlendEquationsSupported()) { - final int blendEqAlpha = getGLEquationValue(state.getBlendEquationAlpha(), caps); - if (record.blendEqRGB != blendEqRGB || record.blendEqAlpha != blendEqAlpha) { - EXTBlendEquationSeparate.glBlendEquationSeparateEXT(blendEqRGB, blendEqAlpha); - record.blendEqRGB = blendEqRGB; - record.blendEqAlpha = blendEqAlpha; - } - } else if (caps.isBlendEquationSupported()) { - if (record.blendEqRGB != blendEqRGB) { - ARBImaging.glBlendEquation(blendEqRGB); - record.blendEqRGB = blendEqRGB; - } - } - } else if (record.blendEnabled) { - GL11.glDisable(GL11.GL_BLEND); - record.blendEnabled = false; - } - - } else { - if (enabled) { - GL11.glEnable(GL11.GL_BLEND); - record.blendEnabled = true; - final int blendEqRGB = getGLEquationValue(state.getBlendEquationRGB(), caps); - if (caps.isSeparateBlendEquationsSupported()) { - final int blendEqAlpha = getGLEquationValue(state.getBlendEquationAlpha(), caps); - EXTBlendEquationSeparate.glBlendEquationSeparateEXT(blendEqRGB, blendEqAlpha); - record.blendEqRGB = blendEqRGB; - record.blendEqAlpha = blendEqAlpha; - } else if (caps.isBlendEquationSupported()) { - ARBImaging.glBlendEquation(blendEqRGB); - record.blendEqRGB = blendEqRGB; - } - } else { - GL11.glDisable(GL11.GL_BLEND); - record.blendEnabled = false; - } - } - } - - protected static void applyBlendColor(final boolean enabled, final BlendState state, final BlendStateRecord record, - final ContextCapabilities caps) { - if (enabled) { - final boolean applyConstant = state.getDestinationFunctionRGB().usesConstantColor() - || state.getSourceFunctionRGB().usesConstantColor() - || (caps.isConstantBlendColorSupported() && (state.getDestinationFunctionAlpha() - .usesConstantColor() || state.getSourceFunctionAlpha().usesConstantColor())); - if (applyConstant && caps.isConstantBlendColorSupported()) { - final ReadOnlyColorRGBA constant = state.getConstantColor(); - if (!record.isValid() || (caps.isConstantBlendColorSupported() && !record.blendColor.equals(constant))) { - ARBImaging.glBlendColor(constant.getRed(), constant.getGreen(), constant.getBlue(), - constant.getAlpha()); - record.blendColor.set(constant); - } - } - } - } - - protected static void applyBlendFunctions(final boolean enabled, final BlendState state, - final BlendStateRecord record, final ContextCapabilities caps) { - if (record.isValid()) { - if (enabled) { - final int glSrcRGB = getGLSrcValue(state.getSourceFunctionRGB(), caps); - final int glDstRGB = getGLDstValue(state.getDestinationFunctionRGB(), caps); - if (caps.isSeparateBlendFunctionsSupported()) { - final int glSrcAlpha = getGLSrcValue(state.getSourceFunctionAlpha(), caps); - final int glDstAlpha = getGLDstValue(state.getDestinationFunctionAlpha(), caps); - if (record.srcFactorRGB != glSrcRGB || record.dstFactorRGB != glDstRGB - || record.srcFactorAlpha != glSrcAlpha || record.dstFactorAlpha != glDstAlpha) { - EXTBlendFuncSeparate.glBlendFuncSeparateEXT(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha); - record.srcFactorRGB = glSrcRGB; - record.dstFactorRGB = glDstRGB; - record.srcFactorAlpha = glSrcAlpha; - record.dstFactorAlpha = glDstAlpha; - } - } else if (record.srcFactorRGB != glSrcRGB || record.dstFactorRGB != glDstRGB) { - GL11.glBlendFunc(glSrcRGB, glDstRGB); - record.srcFactorRGB = glSrcRGB; - record.dstFactorRGB = glDstRGB; - } - } - } else { - if (enabled) { - final int glSrcRGB = getGLSrcValue(state.getSourceFunctionRGB(), caps); - final int glDstRGB = getGLDstValue(state.getDestinationFunctionRGB(), caps); - if (caps.isSeparateBlendFunctionsSupported()) { - final int glSrcAlpha = getGLSrcValue(state.getSourceFunctionAlpha(), caps); - final int glDstAlpha = getGLDstValue(state.getDestinationFunctionAlpha(), caps); - EXTBlendFuncSeparate.glBlendFuncSeparateEXT(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha); - record.srcFactorRGB = glSrcRGB; - record.dstFactorRGB = glDstRGB; - record.srcFactorAlpha = glSrcAlpha; - record.dstFactorAlpha = glDstAlpha; - } else { - GL11.glBlendFunc(glSrcRGB, glDstRGB); - record.srcFactorRGB = glSrcRGB; - record.dstFactorRGB = glDstRGB; - } - } - } - } - - protected static void applyAlphaCoverage(final boolean sampleAlphaToCoverageEnabled, - final boolean sampleAlphaToOneEnabled, final BlendStateRecord record, final ContextCapabilities caps) { - if (record.isValid()) { - if (sampleAlphaToCoverageEnabled != record.sampleAlphaToCoverageEnabled) { - if (sampleAlphaToCoverageEnabled) { - GL11.glEnable(ARBMultisample.GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); - } else { - GL11.glDisable(ARBMultisample.GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); - } - record.sampleAlphaToCoverageEnabled = sampleAlphaToCoverageEnabled; - } - if (sampleAlphaToOneEnabled != record.sampleAlphaToOneEnabled) { - if (sampleAlphaToOneEnabled) { - GL11.glEnable(ARBMultisample.GL_SAMPLE_ALPHA_TO_ONE_ARB); - } else { - GL11.glDisable(ARBMultisample.GL_SAMPLE_ALPHA_TO_ONE_ARB); - } - record.sampleAlphaToOneEnabled = sampleAlphaToOneEnabled; - } - } else { - if (sampleAlphaToCoverageEnabled) { - GL11.glEnable(ARBMultisample.GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); - } else { - GL11.glDisable(ARBMultisample.GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); - } - record.sampleAlphaToCoverageEnabled = sampleAlphaToCoverageEnabled; - if (sampleAlphaToOneEnabled) { - GL11.glEnable(ARBMultisample.GL_SAMPLE_ALPHA_TO_ONE_ARB); - } else { - GL11.glDisable(ARBMultisample.GL_SAMPLE_ALPHA_TO_ONE_ARB); - } - record.sampleAlphaToOneEnabled = sampleAlphaToOneEnabled; - } - } - - protected static void applySampleCoverage(final boolean enabled, final BlendState state, - final BlendStateRecord record, final ContextCapabilities caps) { - - final boolean coverageInverted = state.isSampleCoverageInverted(); - final float coverageValue = state.getSampleCoverage(); - - if (record.isValid()) { - if (enabled) { - if (!record.sampleCoverageEnabled) { - GL11.glEnable(ARBMultisample.GL_SAMPLE_COVERAGE_ARB); - record.sampleCoverageEnabled = true; - } - if (record.sampleCoverageInverted != coverageInverted || record.sampleCoverage != coverageValue) { - ARBMultisample.glSampleCoverageARB(coverageValue, coverageInverted); - record.sampleCoverageInverted = coverageInverted; - record.sampleCoverage = coverageValue; - } - } else { - if (record.sampleCoverageEnabled) { - GL11.glDisable(ARBMultisample.GL_SAMPLE_COVERAGE_ARB); - record.sampleCoverageEnabled = false; - } - } - } else { - if (enabled) { - GL11.glEnable(ARBMultisample.GL_SAMPLE_COVERAGE_ARB); - record.sampleCoverageEnabled = true; - ARBMultisample.glSampleCoverageARB(coverageValue, coverageInverted); - record.sampleCoverageInverted = coverageInverted; - record.sampleCoverage = coverageValue; - } else { - GL11.glDisable(ARBMultisample.GL_SAMPLE_COVERAGE_ARB); - record.sampleCoverageEnabled = false; - } - } - } - - protected static int getGLSrcValue(final SourceFunction function, final ContextCapabilities caps) { - switch (function) { - case Zero: - return GL11.GL_ZERO; - case DestinationColor: - return GL11.GL_DST_COLOR; - case OneMinusDestinationColor: - return GL11.GL_ONE_MINUS_DST_COLOR; - case SourceAlpha: - return GL11.GL_SRC_ALPHA; - case OneMinusSourceAlpha: - return GL11.GL_ONE_MINUS_SRC_ALPHA; - case DestinationAlpha: - return GL11.GL_DST_ALPHA; - case OneMinusDestinationAlpha: - return GL11.GL_ONE_MINUS_DST_ALPHA; - case SourceAlphaSaturate: - return GL11.GL_SRC_ALPHA_SATURATE; - case ConstantColor: - if (caps.isConstantBlendColorSupported()) { - return EXTBlendColor.GL_CONSTANT_COLOR_EXT; - } - // FALLS THROUGH - case OneMinusConstantColor: - if (caps.isConstantBlendColorSupported()) { - return EXTBlendColor.GL_ONE_MINUS_CONSTANT_COLOR_EXT; - } - // FALLS THROUGH - case ConstantAlpha: - if (caps.isConstantBlendColorSupported()) { - return EXTBlendColor.GL_CONSTANT_ALPHA_EXT; - } - // FALLS THROUGH - case OneMinusConstantAlpha: - if (caps.isConstantBlendColorSupported()) { - return EXTBlendColor.GL_ONE_MINUS_CONSTANT_ALPHA_EXT; - } - // FALLS THROUGH - case One: - return GL11.GL_ONE; - } - throw new IllegalArgumentException("Invalid source function type: " + function); - } - - protected static int getGLDstValue(final DestinationFunction function, final ContextCapabilities caps) { - switch (function) { - case Zero: - return GL11.GL_ZERO; - case SourceColor: - return GL11.GL_SRC_COLOR; - case OneMinusSourceColor: - return GL11.GL_ONE_MINUS_SRC_COLOR; - case SourceAlpha: - return GL11.GL_SRC_ALPHA; - case OneMinusSourceAlpha: - return GL11.GL_ONE_MINUS_SRC_ALPHA; - case DestinationAlpha: - return GL11.GL_DST_ALPHA; - case OneMinusDestinationAlpha: - return GL11.GL_ONE_MINUS_DST_ALPHA; - case ConstantColor: - if (caps.isConstantBlendColorSupported()) { - return EXTBlendColor.GL_CONSTANT_COLOR_EXT; - } - // FALLS THROUGH - case OneMinusConstantColor: - if (caps.isConstantBlendColorSupported()) { - return EXTBlendColor.GL_ONE_MINUS_CONSTANT_COLOR_EXT; - } - // FALLS THROUGH - case ConstantAlpha: - if (caps.isConstantBlendColorSupported()) { - return EXTBlendColor.GL_CONSTANT_ALPHA_EXT; - } - // FALLS THROUGH - case OneMinusConstantAlpha: - if (caps.isConstantBlendColorSupported()) { - return EXTBlendColor.GL_ONE_MINUS_CONSTANT_ALPHA_EXT; - } - // FALLS THROUGH - case One: - return GL11.GL_ONE; - } - throw new IllegalArgumentException("Invalid destination function type: " + function); - } - - protected static int getGLEquationValue(final BlendEquation eq, final ContextCapabilities caps) { - switch (eq) { - case Min: - if (caps.isMinMaxBlendEquationsSupported()) { - return EXTBlendMinmax.GL_MIN_EXT; - } - // FALLS THROUGH - case Max: - if (caps.isMinMaxBlendEquationsSupported()) { - return EXTBlendMinmax.GL_MAX_EXT; - } else { - return ARBImaging.GL_FUNC_ADD; - } - case Subtract: - if (caps.isSubtractBlendEquationsSupported()) { - return EXTBlendSubtract.GL_FUNC_SUBTRACT_EXT; - } - // FALLS THROUGH - case ReverseSubtract: - if (caps.isSubtractBlendEquationsSupported()) { - return EXTBlendSubtract.GL_FUNC_REVERSE_SUBTRACT_EXT; - } - // FALLS THROUGH - case Add: - return ARBImaging.GL_FUNC_ADD; - } - throw new IllegalArgumentException("Invalid blend equation: " + eq); - } - - protected static void applyTest(final boolean enabled, final BlendState state, final BlendStateRecord record) { - if (record.isValid()) { - if (enabled) { - if (!record.testEnabled) { - GL11.glEnable(GL11.GL_ALPHA_TEST); - record.testEnabled = true; - } - final int glFunc = getGLFuncValue(state.getTestFunction()); - if (record.alphaFunc != glFunc || record.alphaRef != state.getReference()) { - GL11.glAlphaFunc(glFunc, state.getReference()); - record.alphaFunc = glFunc; - record.alphaRef = state.getReference(); - } - } else if (record.testEnabled) { - GL11.glDisable(GL11.GL_ALPHA_TEST); - record.testEnabled = false; - } - - } else { - if (enabled) { - GL11.glEnable(GL11.GL_ALPHA_TEST); - record.testEnabled = true; - final int glFunc = getGLFuncValue(state.getTestFunction()); - GL11.glAlphaFunc(glFunc, state.getReference()); - record.alphaFunc = glFunc; - record.alphaRef = state.getReference(); - } else { - GL11.glDisable(GL11.GL_ALPHA_TEST); - record.testEnabled = false; - } - } - } - - protected static int getGLFuncValue(final TestFunction function) { - switch (function) { - case Never: - return GL11.GL_NEVER; - case LessThan: - return GL11.GL_LESS; - case EqualTo: - return GL11.GL_EQUAL; - case LessThanOrEqualTo: - return GL11.GL_LEQUAL; - case GreaterThan: - return GL11.GL_GREATER; - case NotEqualTo: - return GL11.GL_NOTEQUAL; - case GreaterThanOrEqualTo: - return GL11.GL_GEQUAL; - case Always: - return GL11.GL_ALWAYS; - } - throw new IllegalArgumentException("Invalid test function type: " + function); - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglClipStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglClipStateUtil.java deleted file mode 100644 index 581cbb5..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglClipStateUtil.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import java.nio.DoubleBuffer; - -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.ClipState; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.ClipStateRecord; - -public abstract class LwjglClipStateUtil { - - public static void apply(final ClipState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final ClipStateRecord record = (ClipStateRecord) context.getStateRecord(StateType.Clip); - context.setCurrentState(StateType.Clip, state); - - final ContextCapabilities caps = context.getCapabilities(); - final int max = Math.min(ClipState.MAX_CLIP_PLANES, caps.getMaxUserClipPlanes()); - - if (state.isEnabled()) { - for (int i = 0; i < max; i++) { - enableClipPlane(i, state.getPlaneEnabled(i), state, record); - } - } else { - for (int i = 0; i < max; i++) { - enableClipPlane(i, false, state, record); - } - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static void enableClipPlane(final int planeIndex, final boolean enable, final ClipState state, - final ClipStateRecord record) { - if (enable) { - if (!record.isValid() || !record.planeEnabled[planeIndex]) { - GL11.glEnable(GL11.GL_CLIP_PLANE0 + planeIndex); - record.planeEnabled[planeIndex] = true; - } - - record.buf.rewind(); - ((DoubleBuffer) record.buf).put(state.getPlaneEquations(planeIndex)); - record.buf.flip(); - GL11.glClipPlane(GL11.GL_CLIP_PLANE0 + planeIndex, (DoubleBuffer) record.buf); - - } else { - if (!record.isValid() || record.planeEnabled[planeIndex]) { - GL11.glDisable(GL11.GL_CLIP_PLANE0 + planeIndex); - record.planeEnabled[planeIndex] = false; - } - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglColorMaskStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglColorMaskStateUtil.java deleted file mode 100644 index 0a45a97..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglColorMaskStateUtil.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.ColorMaskState; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.ColorMaskStateRecord; - -public abstract class LwjglColorMaskStateUtil { - - public static void apply(final ColorMaskState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final ColorMaskStateRecord record = (ColorMaskStateRecord) context.getStateRecord(StateType.ColorMask); - context.setCurrentState(StateType.ColorMask, state); - - if (state.isEnabled()) { - if (!record.isValid() || !record.is(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha())) { - GL11.glColorMask(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha()); - record.set(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha()); - } - } else if (!record.isValid() || !record.is(true, true, true, true)) { - GL11.glColorMask(true, true, true, true); - record.set(true, true, true, true); - } - - if (!record.isValid()) { - record.validate(); - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglCullStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglCullStateUtil.java deleted file mode 100644 index 7a27d18..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglCullStateUtil.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.CullState; -import com.ardor3d.renderer.state.CullState.Face; -import com.ardor3d.renderer.state.CullState.PolygonWind; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.CullStateRecord; - -public abstract class LwjglCullStateUtil { - - public static void apply(final CullState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final CullStateRecord record = (CullStateRecord) context.getStateRecord(StateType.Cull); - context.setCurrentState(StateType.Cull, state); - - if (state.isEnabled()) { - final Face useCullMode = state.getCullFace(); - - switch (useCullMode) { - case Front: - setCull(GL11.GL_FRONT, record); - setCullEnabled(true, record); - break; - case Back: - setCull(GL11.GL_BACK, record); - setCullEnabled(true, record); - break; - case FrontAndBack: - setCull(GL11.GL_FRONT_AND_BACK, record); - setCullEnabled(true, record); - break; - case None: - setCullEnabled(false, record); - break; - } - setGLPolygonWind(state.getPolygonWind(), record); - } else { - setCullEnabled(false, record); - setGLPolygonWind(PolygonWind.CounterClockWise, record); - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static void setCullEnabled(final boolean enable, final CullStateRecord record) { - if (!record.isValid() || record.enabled != enable) { - if (enable) { - GL11.glEnable(GL11.GL_CULL_FACE); - } else { - GL11.glDisable(GL11.GL_CULL_FACE); - } - record.enabled = enable; - } - } - - private static void setCull(final int face, final CullStateRecord record) { - if (!record.isValid() || record.face != face) { - GL11.glCullFace(face); - record.face = face; - } - } - - private static void setGLPolygonWind(final PolygonWind windOrder, final CullStateRecord record) { - if (!record.isValid() || record.windOrder != windOrder) { - switch (windOrder) { - case CounterClockWise: - GL11.glFrontFace(GL11.GL_CCW); - break; - case ClockWise: - GL11.glFrontFace(GL11.GL_CW); - break; - } - record.windOrder = windOrder; - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglFogStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglFogStateUtil.java deleted file mode 100644 index 71f4342..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglFogStateUtil.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.EXTFogCoord; -import org.lwjgl.opengl.GL11; - -import com.ardor3d.math.type.ReadOnlyColorRGBA; -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.FogState; -import com.ardor3d.renderer.state.FogState.CoordinateSource; -import com.ardor3d.renderer.state.FogState.DensityFunction; -import com.ardor3d.renderer.state.FogState.Quality; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.FogStateRecord; - -public abstract class LwjglFogStateUtil { - - public static void apply(final FogState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final FogStateRecord record = (FogStateRecord) context.getStateRecord(StateType.Fog); - context.setCurrentState(StateType.Fog, state); - - if (state.isEnabled()) { - enableFog(true, record); - - if (record.isValid()) { - if (record.fogStart != state.getStart()) { - GL11.glFogf(GL11.GL_FOG_START, state.getStart()); - record.fogStart = state.getStart(); - } - if (record.fogEnd != state.getEnd()) { - GL11.glFogf(GL11.GL_FOG_END, state.getEnd()); - record.fogEnd = state.getEnd(); - } - if (record.density != state.getDensity()) { - GL11.glFogf(GL11.GL_FOG_DENSITY, state.getDensity()); - record.density = state.getDensity(); - } - } else { - GL11.glFogf(GL11.GL_FOG_START, state.getStart()); - record.fogStart = state.getStart(); - GL11.glFogf(GL11.GL_FOG_END, state.getEnd()); - record.fogEnd = state.getEnd(); - GL11.glFogf(GL11.GL_FOG_DENSITY, state.getDensity()); - record.density = state.getDensity(); - } - - final ReadOnlyColorRGBA fogColor = state.getColor(); - applyFogColor(fogColor, record); - applyFogMode(state.getDensityFunction(), record); - applyFogHint(state.getQuality(), record); - applyFogSource(state.getSource(), record, context.getCapabilities()); - } else { - enableFog(false, record); - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static void enableFog(final boolean enable, final FogStateRecord record) { - if (record.isValid()) { - if (enable && !record.enabled) { - GL11.glEnable(GL11.GL_FOG); - record.enabled = true; - } else if (!enable && record.enabled) { - GL11.glDisable(GL11.GL_FOG); - record.enabled = false; - } - } else { - if (enable) { - GL11.glEnable(GL11.GL_FOG); - } else { - GL11.glDisable(GL11.GL_FOG); - } - record.enabled = enable; - } - } - - private static void applyFogColor(final ReadOnlyColorRGBA color, final FogStateRecord record) { - if (!record.isValid() || !color.equals(record.fogColor)) { - record.fogColor.set(color); - record.colorBuff.clear(); - record.colorBuff.put(record.fogColor.getRed()).put(record.fogColor.getGreen()) - .put(record.fogColor.getBlue()).put(record.fogColor.getAlpha()); - record.colorBuff.flip(); - GL11.glFog(GL11.GL_FOG_COLOR, record.colorBuff); - } - } - - private static void applyFogSource(final CoordinateSource source, final FogStateRecord record, - final ContextCapabilities caps) { - if (caps.isFogCoordinatesSupported()) { - if (!record.isValid() || !source.equals(record.source)) { - if (source == CoordinateSource.Depth) { - GL11.glFogi(EXTFogCoord.GL_FOG_COORDINATE_SOURCE_EXT, EXTFogCoord.GL_FRAGMENT_DEPTH_EXT); - } else { - GL11.glFogi(EXTFogCoord.GL_FOG_COORDINATE_SOURCE_EXT, EXTFogCoord.GL_FOG_COORDINATE_EXT); - } - } - } - } - - private static void applyFogMode(final DensityFunction densityFunction, final FogStateRecord record) { - int glMode = 0; - switch (densityFunction) { - case Exponential: - glMode = GL11.GL_EXP; - break; - case Linear: - glMode = GL11.GL_LINEAR; - break; - case ExponentialSquared: - glMode = GL11.GL_EXP2; - break; - } - - if (!record.isValid() || record.fogMode != glMode) { - GL11.glFogi(GL11.GL_FOG_MODE, glMode); - record.fogMode = glMode; - } - } - - private static void applyFogHint(final Quality quality, final FogStateRecord record) { - int glHint = 0; - switch (quality) { - case PerVertex: - glHint = GL11.GL_FASTEST; - break; - case PerPixel: - glHint = GL11.GL_NICEST; - break; - } - - if (!record.isValid() || record.fogHint != glHint) { - GL11.glHint(GL11.GL_FOG_HINT, glHint); - record.fogHint = glHint; - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglFragmentProgramStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglFragmentProgramStateUtil.java deleted file mode 100644 index fc2ac8f..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglFragmentProgramStateUtil.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import java.nio.ByteBuffer; -import java.nio.IntBuffer; -import java.util.logging.Logger; - -import org.lwjgl.opengl.ARBFragmentProgram; -import org.lwjgl.opengl.ARBProgram; -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.FragmentProgramState; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.FragmentProgramStateRecord; -import com.ardor3d.util.geom.BufferUtils; - -public final class LwjglFragmentProgramStateUtil { - private static final Logger logger = Logger.getLogger(LwjglFragmentProgramStateUtil.class.getName()); - - /** - * Queries OpenGL for errors in the fragment program. Errors are logged as SEVERE, noting both the line number and - * message. - */ - private static void checkProgramError() { - if (GL11.glGetError() == GL11.GL_INVALID_OPERATION) { - // retrieve the error position - final IntBuffer errorloc = BufferUtils.createIntBuffer(16); - GL11.glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB, errorloc); - - logger.severe("Error " + GL11.glGetString(ARBProgram.GL_PROGRAM_ERROR_STRING_ARB) - + " in fragment program on line " + errorloc.get(0)); - } - } - - private static int create(final ByteBuffer program) { - - final IntBuffer buf = BufferUtils.createIntBuffer(1); - - ARBProgram.glGenProgramsARB(buf); - ARBProgram.glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, buf.get(0)); - ARBProgram.glProgramStringARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, - ARBProgram.GL_PROGRAM_FORMAT_ASCII_ARB, program); - - checkProgramError(); - - return buf.get(0); - } - - public static void apply(final FragmentProgramState state) { - final RenderContext context = ContextManager.getCurrentContext(); - if (context.getCapabilities().isFragmentProgramSupported()) { - final FragmentProgramStateRecord record = (FragmentProgramStateRecord) context - .getStateRecord(StateType.FragmentProgram); - context.setCurrentState(StateType.FragmentProgram, state); - - if (!record.isValid() || record.getReference() != state) { - record.setReference(state); - if (state.isEnabled()) { - // Fragment program not yet loaded - if (state._getProgramID() == -1) { - if (state.getProgramAsBuffer() != null) { - final int id = create(state.getProgramAsBuffer()); - state._setProgramID(id); - } else { - return; - } - } - - GL11.glEnable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB); - ARBProgram.glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, state._getProgramID()); - - // load environmental parameters... - // TODO: Reevaluate how this is done. - /* - * for (int i = 0; i < envparameters.length; i++) if (envparameters[i] != null) - * ARBFragmentProgram.glProgramEnvParameter4fARB( ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, i, - * envparameters[i][0], envparameters[i][1], envparameters[i][2], envparameters[i][3]); - */ - - // load local parameters... - if (state.isUsingParameters()) { - // no parameters are used - for (int i = 0; i < state._getParameters().length; i++) { - if (state._getParameters()[i] != null) { - ARBProgram.glProgramLocalParameter4fARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, i, - state._getParameters()[i][0], state._getParameters()[i][1], - state._getParameters()[i][2], state._getParameters()[i][3]); - } - } - } - - } else { - GL11.glDisable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB); - } - } - - if (!record.isValid()) { - record.validate(); - } - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglLightStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglLightStateUtil.java deleted file mode 100644 index 0ef2391..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglLightStateUtil.java +++ /dev/null @@ -1,372 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import com.ardor3d.light.DirectionalLight; -import com.ardor3d.light.Light; -import com.ardor3d.light.PointLight; -import com.ardor3d.light.SpotLight; -import com.ardor3d.math.ColorRGBA; -import com.ardor3d.math.type.ReadOnlyColorRGBA; -import com.ardor3d.math.type.ReadOnlyMatrix4; -import com.ardor3d.math.type.ReadOnlyVector3; -import com.ardor3d.renderer.Camera; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.LightState; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.LightRecord; -import com.ardor3d.renderer.state.record.LightStateRecord; - -public abstract class LwjglLightStateUtil { - - public static void apply(final LightState state) { - final RenderContext context = ContextManager.getCurrentContext(); - final LightStateRecord record = (LightStateRecord) context.getStateRecord(StateType.Light); - context.setCurrentState(StateType.Light, state); - - if (state.isEnabled() && LightState.LIGHTS_ENABLED) { - setLightEnabled(true, record); - setTwoSided(state.getTwoSidedLighting(), record); - setLocalViewer(state.getLocalViewer(), record); - if (context.getCapabilities().isOpenGL1_2Supported()) { - setSpecularControl(state.getSeparateSpecular(), record); - } - - for (int i = 0, max = state.getNumberOfChildren(); i < max; i++) { - final Light light = state.get(i); - LightRecord lr = record.getLightRecord(i); - // TODO: use the reference to get the lightrecord - rherlitz - - if (lr == null) { - lr = new LightRecord(); - record.setLightRecord(lr, i); - } - - if (light == null) { - setSingleLightEnabled(false, i, record, lr); - } else { - if (light.isEnabled()) { - setLight(i, light, state, record, lr); - } else { - setSingleLightEnabled(false, i, record, lr); - } - } - } - - // disable lights at and above the max count in this state - for (int i = state.getNumberOfChildren(); i < LightState.MAX_LIGHTS_ALLOWED; i++) { - LightRecord lr = record.getLightRecord(i); - - if (lr == null) { - lr = new LightRecord(); - record.setLightRecord(lr, i); - } - setSingleLightEnabled(false, i, record, lr); - } - - if ((state.getLightMask() & LightState.MASK_GLOBALAMBIENT) == 0) { - setModelAmbient(record, state.getGlobalAmbient()); - } else { - setModelAmbient(record, ColorRGBA.BLACK_NO_ALPHA); - } - } else { - setLightEnabled(false, record); - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static void setLight(final int index, final Light light, final LightState state, - final LightStateRecord record, final LightRecord lr) { - setSingleLightEnabled(true, index, record, lr); - - if ((state.getLightMask() & LightState.MASK_AMBIENT) == 0 - && (light.getLightMask() & LightState.MASK_AMBIENT) == 0) { - setAmbient(index, record, light.getAmbient(), lr); - } else { - setAmbient(index, record, ColorRGBA.BLACK_NO_ALPHA, lr); - } - - if ((state.getLightMask() & LightState.MASK_DIFFUSE) == 0 - && (light.getLightMask() & LightState.MASK_DIFFUSE) == 0) { - setDiffuse(index, record, light.getDiffuse(), lr); - } else { - setDiffuse(index, record, ColorRGBA.BLACK_NO_ALPHA, lr); - } - - if ((state.getLightMask() & LightState.MASK_SPECULAR) == 0 - && (light.getLightMask() & LightState.MASK_SPECULAR) == 0) { - setSpecular(index, record, light.getSpecular(), lr); - } else { - setSpecular(index, record, ColorRGBA.BLACK_NO_ALPHA, lr); - } - - if (light.isAttenuate()) { - setAttenuate(true, index, light, record, lr); - - } else { - setAttenuate(false, index, light, record, lr); - - } - - switch (light.getType()) { - case Directional: { - final DirectionalLight dirLight = (DirectionalLight) light; - - final ReadOnlyVector3 direction = dirLight.getDirection(); - setPosition(index, record, -direction.getXf(), -direction.getYf(), -direction.getZf(), 0, lr); - break; - } - case Point: - case Spot: { - final PointLight pointLight = (PointLight) light; - final ReadOnlyVector3 location = pointLight.getLocation(); - setPosition(index, record, location.getXf(), location.getYf(), location.getZf(), 1, lr); - break; - } - } - - if (light.getType() == Light.Type.Spot) { - final SpotLight spot = (SpotLight) light; - setSpotCutoff(index, record, spot.getAngle(), lr); - final ReadOnlyVector3 direction = spot.getDirection(); - setSpotDirection(index, record, direction.getXf(), direction.getYf(), direction.getZf(), 0); - setSpotExponent(index, record, spot.getExponent(), lr); - } else { - // set the cutoff to 180, which causes the other spot params to be - // ignored. - setSpotCutoff(index, record, 180, lr); - } - } - - private static void setSingleLightEnabled(final boolean enable, final int index, final LightStateRecord record, - final LightRecord lr) { - if (!record.isValid() || lr.isEnabled() != enable) { - if (enable) { - GL11.glEnable(GL11.GL_LIGHT0 + index); - } else { - GL11.glDisable(GL11.GL_LIGHT0 + index); - } - - lr.setEnabled(enable); - } - } - - private static void setLightEnabled(final boolean enable, final LightStateRecord record) { - if (!record.isValid() || record.isEnabled() != enable) { - if (enable) { - GL11.glEnable(GL11.GL_LIGHTING); - } else { - GL11.glDisable(GL11.GL_LIGHTING); - } - record.setEnabled(enable); - } - } - - private static void setTwoSided(final boolean twoSided, final LightStateRecord record) { - if (!record.isValid() || record.isTwoSidedOn() != twoSided) { - if (twoSided) { - GL11.glLightModeli(GL11.GL_LIGHT_MODEL_TWO_SIDE, GL11.GL_TRUE); - } else { - GL11.glLightModeli(GL11.GL_LIGHT_MODEL_TWO_SIDE, GL11.GL_FALSE); - } - record.setTwoSidedOn(twoSided); - } - } - - private static void setLocalViewer(final boolean localViewer, final LightStateRecord record) { - if (!record.isValid() || record.isLocalViewer() != localViewer) { - if (localViewer) { - GL11.glLightModeli(GL11.GL_LIGHT_MODEL_LOCAL_VIEWER, GL11.GL_TRUE); - } else { - GL11.glLightModeli(GL11.GL_LIGHT_MODEL_LOCAL_VIEWER, GL11.GL_FALSE); - } - record.setLocalViewer(localViewer); - } - } - - private static void setSpecularControl(final boolean separateSpecularOn, final LightStateRecord record) { - if (!record.isValid() || record.isSeparateSpecular() != separateSpecularOn) { - if (separateSpecularOn) { - GL11.glLightModeli(GL12.GL_LIGHT_MODEL_COLOR_CONTROL, GL12.GL_SEPARATE_SPECULAR_COLOR); - } else { - GL11.glLightModeli(GL12.GL_LIGHT_MODEL_COLOR_CONTROL, GL12.GL_SINGLE_COLOR); - } - record.setSeparateSpecular(separateSpecularOn); - } - } - - private static void setModelAmbient(final LightStateRecord record, final ReadOnlyColorRGBA color) { - if (!record.isValid() || !record.globalAmbient.equals(color)) { - record.lightBuffer.clear(); - record.lightBuffer.put(color.getRed()); - record.lightBuffer.put(color.getGreen()); - record.lightBuffer.put(color.getBlue()); - record.lightBuffer.put(color.getAlpha()); - record.lightBuffer.flip(); - GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, record.lightBuffer); - record.globalAmbient.set(color); - } - } - - private static void setAmbient(final int index, final LightStateRecord record, final ReadOnlyColorRGBA ambient, - final LightRecord lr) { - if (!record.isValid() || !lr.ambient.equals(ambient)) { - record.lightBuffer.clear(); - record.lightBuffer.put(ambient.getRed()); - record.lightBuffer.put(ambient.getGreen()); - record.lightBuffer.put(ambient.getBlue()); - record.lightBuffer.put(ambient.getAlpha()); - record.lightBuffer.flip(); - GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_AMBIENT, record.lightBuffer); - lr.ambient.set(ambient); - } - } - - private static void setDiffuse(final int index, final LightStateRecord record, final ReadOnlyColorRGBA diffuse, - final LightRecord lr) { - if (!record.isValid() || !lr.diffuse.equals(diffuse)) { - record.lightBuffer.clear(); - record.lightBuffer.put(diffuse.getRed()); - record.lightBuffer.put(diffuse.getGreen()); - record.lightBuffer.put(diffuse.getBlue()); - record.lightBuffer.put(diffuse.getAlpha()); - record.lightBuffer.flip(); - GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_DIFFUSE, record.lightBuffer); - lr.diffuse.set(diffuse); - } - } - - private static void setSpecular(final int index, final LightStateRecord record, final ReadOnlyColorRGBA specular, - final LightRecord lr) { - if (!record.isValid() || !lr.specular.equals(specular)) { - record.lightBuffer.clear(); - record.lightBuffer.put(specular.getRed()); - record.lightBuffer.put(specular.getGreen()); - record.lightBuffer.put(specular.getBlue()); - record.lightBuffer.put(specular.getAlpha()); - record.lightBuffer.flip(); - GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_SPECULAR, record.lightBuffer); - lr.specular.set(specular); - } - } - - private static void setPosition(final int index, final LightStateRecord record, final float positionX, - final float positionY, final float positionZ, final float positionW, final LightRecord lr) { - // From OpenGL Docs: - // The light position is transformed by the contents of the current top - // of the ModelView matrix stack when you specify the light position - // with a call to glLightfv(GL_LIGHT_POSITION,...). If you later change - // the ModelView matrix, such as when the view changes for the next - // frame, the light position isn't automatically retransformed by the - // new contents of the ModelView matrix. If you want to update the - // light's position, you must again specify the light position with a - // call to glLightfv(GL_LIGHT_POSITION,...). - - // XXX: This is a hack until we get a better lighting model up - final ReadOnlyMatrix4 modelViewMatrix = Camera.getCurrentCamera().getModelViewMatrix(); - - if (!record.isValid() || lr.position.getXf() != positionX || lr.position.getYf() != positionY - || lr.position.getZf() != positionZ || lr.position.getWf() != positionW - || !lr.modelViewMatrix.equals(modelViewMatrix)) { - - record.lightBuffer.clear(); - record.lightBuffer.put(positionX); - record.lightBuffer.put(positionY); - record.lightBuffer.put(positionZ); - record.lightBuffer.put(positionW); - record.lightBuffer.flip(); - GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_POSITION, record.lightBuffer); - - lr.position.set(positionX, positionY, positionZ, positionW); - if (!Camera.getCurrentCamera().isFrameDirty()) { - lr.modelViewMatrix.set(modelViewMatrix); - } - } - } - - private static void setSpotDirection(final int index, final LightStateRecord record, final float directionX, - final float directionY, final float directionZ, final float value) { - // From OpenGL Docs: - // The light position is transformed by the contents of the current top - // of the ModelView matrix stack when you specify the light position - // with a call to glLightfv(GL_LIGHT_POSITION,...). If you later change - // the ModelView matrix, such as when the view changes for the next - // frame, the light position isn't automatically retransformed by the - // new contents of the ModelView matrix. If you want to update the - // light's position, you must again specify the light position with a - // call to glLightfv(GL_LIGHT_POSITION,...). - record.lightBuffer.clear(); - record.lightBuffer.put(directionX); - record.lightBuffer.put(directionY); - record.lightBuffer.put(directionZ); - record.lightBuffer.put(value); - record.lightBuffer.flip(); - GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_SPOT_DIRECTION, record.lightBuffer); - } - - private static void setConstant(final int index, final float constant, final LightRecord lr, final boolean force) { - if (force || constant != lr.getConstant()) { - GL11.glLightf(GL11.GL_LIGHT0 + index, GL11.GL_CONSTANT_ATTENUATION, constant); - lr.setConstant(constant); - } - } - - private static void setLinear(final int index, final float linear, final LightRecord lr, final boolean force) { - if (force || linear != lr.getLinear()) { - GL11.glLightf(GL11.GL_LIGHT0 + index, GL11.GL_LINEAR_ATTENUATION, linear); - lr.setLinear(linear); - } - } - - private static void setQuadratic(final int index, final float quad, final LightRecord lr, final boolean force) { - if (force || quad != lr.getQuadratic()) { - GL11.glLightf(GL11.GL_LIGHT0 + index, GL11.GL_QUADRATIC_ATTENUATION, quad); - lr.setQuadratic(quad); - } - } - - private static void setAttenuate(final boolean attenuate, final int index, final Light light, - final LightStateRecord record, final LightRecord lr) { - if (attenuate) { - setConstant(index, light.getConstant(), lr, !record.isValid()); - setLinear(index, light.getLinear(), lr, !record.isValid()); - setQuadratic(index, light.getQuadratic(), lr, !record.isValid()); - } else { - setConstant(index, 1, lr, !record.isValid()); - setLinear(index, 0, lr, !record.isValid()); - setQuadratic(index, 0, lr, !record.isValid()); - } - lr.setAttenuate(attenuate); - } - - private static void setSpotExponent(final int index, final LightStateRecord record, final float exponent, - final LightRecord lr) { - if (!record.isValid() || lr.getSpotExponent() != exponent) { - GL11.glLightf(GL11.GL_LIGHT0 + index, GL11.GL_SPOT_EXPONENT, exponent); - lr.setSpotExponent(exponent); - } - } - - private static void setSpotCutoff(final int index, final LightStateRecord record, final float cutoff, - final LightRecord lr) { - if (!record.isValid() || lr.getSpotCutoff() != cutoff) { - GL11.glLightf(GL11.GL_LIGHT0 + index, GL11.GL_SPOT_CUTOFF, cutoff); - lr.setSpotCutoff(cutoff); - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglMaterialStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglMaterialStateUtil.java deleted file mode 100644 index 287624e..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglMaterialStateUtil.java +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.GL11; - -import com.ardor3d.math.type.ReadOnlyColorRGBA; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.MaterialState; -import com.ardor3d.renderer.state.MaterialState.ColorMaterial; -import com.ardor3d.renderer.state.MaterialState.MaterialFace; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.MaterialStateRecord; - -public abstract class LwjglMaterialStateUtil { - - public static void apply(final MaterialState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final MaterialStateRecord record = (MaterialStateRecord) context.getStateRecord(StateType.Material); - context.setCurrentState(StateType.Material, state); - - if (state.isEnabled()) { - // setup colormaterial, if changed. - applyColorMaterial(state.getColorMaterial(), state.getColorMaterialFace(), record); - - // apply colors, if needed and not what is currently set. - applyColor(ColorMaterial.Ambient, state.getAmbient(), state.getBackAmbient(), record); - applyColor(ColorMaterial.Diffuse, state.getDiffuse(), state.getBackDiffuse(), record); - applyColor(ColorMaterial.Emissive, state.getEmissive(), state.getBackEmissive(), record); - applyColor(ColorMaterial.Specular, state.getSpecular(), state.getBackSpecular(), record); - - // set our shine - applyShininess(state.getShininess(), state.getBackShininess(), record); - } else { - // apply defaults - applyColorMaterial(MaterialState.DEFAULT_COLOR_MATERIAL, MaterialState.DEFAULT_COLOR_MATERIAL_FACE, record); - - applyColor(ColorMaterial.Ambient, MaterialState.DEFAULT_AMBIENT, MaterialState.DEFAULT_AMBIENT, record); - applyColor(ColorMaterial.Diffuse, MaterialState.DEFAULT_DIFFUSE, MaterialState.DEFAULT_DIFFUSE, record); - applyColor(ColorMaterial.Emissive, MaterialState.DEFAULT_EMISSIVE, MaterialState.DEFAULT_EMISSIVE, record); - applyColor(ColorMaterial.Specular, MaterialState.DEFAULT_SPECULAR, MaterialState.DEFAULT_SPECULAR, record); - - applyShininess(MaterialState.DEFAULT_SHININESS, MaterialState.DEFAULT_SHININESS, record); - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static void applyColor(final ColorMaterial glMatColor, final ReadOnlyColorRGBA frontColor, - final ReadOnlyColorRGBA backColor, final MaterialStateRecord record) { - final int glMat = getGLColorMaterial(glMatColor); - if (frontColor.equals(backColor)) { - // consolidate to one call - if (!isVertexProvidedColor(MaterialFace.FrontAndBack, glMatColor, record)) { - if (!record.isValid() || !record.isSetColor(MaterialFace.FrontAndBack, glMatColor, frontColor, record)) { - record.tempColorBuff.clear(); - record.tempColorBuff.put(frontColor.getRed()).put(frontColor.getGreen()).put(frontColor.getBlue()) - .put(frontColor.getAlpha()); - record.tempColorBuff.flip(); - GL11.glMaterial(getGLMaterialFace(MaterialFace.FrontAndBack), glMat, record.tempColorBuff); - record.setColor(MaterialFace.FrontAndBack, glMatColor, frontColor); - } - } - } else { - if (!isVertexProvidedColor(MaterialFace.Front, glMatColor, record)) { - if (!record.isValid() || !record.isSetColor(MaterialFace.Front, glMatColor, frontColor, record)) { - record.tempColorBuff.clear(); - record.tempColorBuff.put(frontColor.getRed()).put(frontColor.getGreen()).put(frontColor.getBlue()) - .put(frontColor.getAlpha()); - record.tempColorBuff.flip(); - GL11.glMaterial(getGLMaterialFace(MaterialFace.Front), glMat, record.tempColorBuff); - record.setColor(MaterialFace.Front, glMatColor, frontColor); - } - } - - if (!isVertexProvidedColor(MaterialFace.Back, glMatColor, record)) { - if (!record.isValid() || !record.isSetColor(MaterialFace.Back, glMatColor, backColor, record)) { - record.tempColorBuff.clear(); - record.tempColorBuff.put(backColor.getRed()).put(backColor.getGreen()).put(backColor.getBlue()) - .put(backColor.getAlpha()); - record.tempColorBuff.flip(); - GL11.glMaterial(getGLMaterialFace(MaterialFace.Back), glMat, record.tempColorBuff); - record.setColor(MaterialFace.Back, glMatColor, backColor); - } - } - } - } - - private static boolean isVertexProvidedColor(final MaterialFace face, final ColorMaterial glMatColor, - final MaterialStateRecord record) { - if (face != record.colorMaterialFace) { - return false; - } - switch (glMatColor) { - case Ambient: - return record.colorMaterial == ColorMaterial.Ambient - || record.colorMaterial == ColorMaterial.AmbientAndDiffuse; - case Diffuse: - return record.colorMaterial == ColorMaterial.Diffuse - || record.colorMaterial == ColorMaterial.AmbientAndDiffuse; - case Specular: - return record.colorMaterial == ColorMaterial.Specular; - case Emissive: - return record.colorMaterial == ColorMaterial.Emissive; - } - return false; - } - - private static void applyColorMaterial(final ColorMaterial colorMaterial, final MaterialFace face, - final MaterialStateRecord record) { - if (!record.isValid() || face != record.colorMaterialFace || colorMaterial != record.colorMaterial) { - if (colorMaterial == ColorMaterial.None) { - GL11.glDisable(GL11.GL_COLOR_MATERIAL); - } else { - final int glMat = getGLColorMaterial(colorMaterial); - final int glFace = getGLMaterialFace(face); - - GL11.glColorMaterial(glFace, glMat); - GL11.glEnable(GL11.GL_COLOR_MATERIAL); - record.resetColorsForCM(face, colorMaterial); - } - record.colorMaterial = colorMaterial; - record.colorMaterialFace = face; - } - } - - private static void applyShininess(final float frontShininess, final float backShininess, - final MaterialStateRecord record) { - if (frontShininess == backShininess) { - // consolidate to one call - if (!record.isValid() || frontShininess != record.frontShininess || record.backShininess != backShininess) { - GL11.glMaterialf(getGLMaterialFace(MaterialFace.FrontAndBack), GL11.GL_SHININESS, frontShininess); - record.backShininess = record.frontShininess = frontShininess; - } - } else { - if (!record.isValid() || frontShininess != record.frontShininess) { - GL11.glMaterialf(getGLMaterialFace(MaterialFace.Front), GL11.GL_SHININESS, frontShininess); - record.frontShininess = frontShininess; - } - - if (!record.isValid() || backShininess != record.backShininess) { - GL11.glMaterialf(getGLMaterialFace(MaterialFace.Back), GL11.GL_SHININESS, backShininess); - record.backShininess = backShininess; - } - } - } - - /** - * Converts the color material setting of this state to a GL constant. - * - * @return the GL constant - */ - private static int getGLColorMaterial(final ColorMaterial material) { - switch (material) { - case None: - return GL11.GL_NONE; - case Ambient: - return GL11.GL_AMBIENT; - case Diffuse: - return GL11.GL_DIFFUSE; - case AmbientAndDiffuse: - return GL11.GL_AMBIENT_AND_DIFFUSE; - case Emissive: - return GL11.GL_EMISSION; - case Specular: - return GL11.GL_SPECULAR; - } - throw new IllegalArgumentException("invalid color material setting: " + material); - } - - /** - * Converts the material face setting of this state to a GL constant. - * - * @return the GL constant - */ - private static int getGLMaterialFace(final MaterialFace face) { - switch (face) { - case Front: - return GL11.GL_FRONT; - case Back: - return GL11.GL_BACK; - case FrontAndBack: - return GL11.GL_FRONT_AND_BACK; - } - throw new IllegalArgumentException("invalid material face setting: " + face); - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglOffsetStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglOffsetStateUtil.java deleted file mode 100644 index 2737373..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglOffsetStateUtil.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.lwjgl.LwjglRenderer; -import com.ardor3d.renderer.state.OffsetState; -import com.ardor3d.renderer.state.OffsetState.OffsetType; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.OffsetStateRecord; - -public abstract class LwjglOffsetStateUtil { - - public static void apply(final LwjglRenderer renderer, final OffsetState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final OffsetStateRecord record = (OffsetStateRecord) context.getStateRecord(StateType.Offset); - context.setCurrentState(StateType.Offset, state); - - if (state.isEnabled()) { - // enable any set offset types - setOffsetEnabled(OffsetType.Fill, state.isTypeEnabled(OffsetType.Fill), record); - setOffsetEnabled(OffsetType.Line, state.isTypeEnabled(OffsetType.Line), record); - setOffsetEnabled(OffsetType.Point, state.isTypeEnabled(OffsetType.Point), record); - - // set factor and units. - setOffset(state.getFactor(), state.getUnits(), record); - } else { - // disable all offset types - setOffsetEnabled(OffsetType.Fill, false, record); - setOffsetEnabled(OffsetType.Line, false, record); - setOffsetEnabled(OffsetType.Point, false, record); - - // set factor and units to default 0, 0. - setOffset(0, 0, record); - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static void setOffsetEnabled(final OffsetType type, final boolean typeEnabled, - final OffsetStateRecord record) { - final int glType = getGLType(type); - if (!record.isValid() || typeEnabled != record.enabledOffsets.contains(type)) { - if (typeEnabled) { - GL11.glEnable(glType); - } else { - GL11.glDisable(glType); - } - } - } - - private static void setOffset(final float factor, final float units, final OffsetStateRecord record) { - if (!record.isValid() || record.factor != factor || record.units != units) { - GL11.glPolygonOffset(factor, units); - record.factor = factor; - record.units = units; - } - } - - private static int getGLType(final OffsetType type) { - switch (type) { - case Fill: - return GL11.GL_POLYGON_OFFSET_FILL; - case Line: - return GL11.GL_POLYGON_OFFSET_LINE; - case Point: - return GL11.GL_POLYGON_OFFSET_POINT; - } - throw new IllegalArgumentException("invalid type: " + type); - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglShaderObjectsStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglShaderObjectsStateUtil.java deleted file mode 100644 index 1440cd1..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglShaderObjectsStateUtil.java +++ /dev/null @@ -1,361 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import java.nio.ByteBuffer; -import java.nio.IntBuffer; -import java.util.logging.Logger; - -import org.lwjgl.opengl.ARBFragmentShader; -import org.lwjgl.opengl.ARBGeometryShader4; -import org.lwjgl.opengl.ARBShaderObjects; -import org.lwjgl.opengl.ARBTessellationShader; -import org.lwjgl.opengl.ARBVertexProgram; -import org.lwjgl.opengl.ARBVertexShader; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL20; - -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.lwjgl.LwjglRenderer; -import com.ardor3d.renderer.state.GLSLShaderObjectsState; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.ShaderObjectsStateRecord; -import com.ardor3d.scene.state.lwjgl.shader.LwjglShaderUtil; -import com.ardor3d.util.Ardor3dException; -import com.ardor3d.util.geom.BufferUtils; -import com.ardor3d.util.shader.ShaderVariable; - -public abstract class LwjglShaderObjectsStateUtil { - private static final Logger logger = Logger.getLogger(LwjglShaderObjectsStateUtil.class.getName()); - - protected static void sendToGL(final GLSLShaderObjectsState state, final ContextCapabilities caps) { - if (state.getVertexShader() == null && state.getFragmentShader() == null) { - logger.warning("Could not find shader resources!" + "(both inputbuffers are null)"); - state._needSendShader = false; - return; - } - - if (state._programID == -1) { - state._programID = ARBShaderObjects.glCreateProgramObjectARB(); - } - - if (state.getVertexShader() != null) { - if (state._vertexShaderID != -1) { - removeVertShader(state); - } - - state._vertexShaderID = ARBShaderObjects.glCreateShaderObjectARB(ARBVertexShader.GL_VERTEX_SHADER_ARB); - - // Create the sources - ARBShaderObjects.glShaderSourceARB(state._vertexShaderID, state.getVertexShader()); - - // Compile the vertex shader - final IntBuffer compiled = BufferUtils.createIntBuffer(1); - ARBShaderObjects.glCompileShaderARB(state._vertexShaderID); - ARBShaderObjects.glGetObjectParameterARB(state._vertexShaderID, - ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB, compiled); - checkProgramError(compiled, state._vertexShaderID, state._vertexShaderName); - - // Attach the program - ARBShaderObjects.glAttachObjectARB(state._programID, state._vertexShaderID); - } else if (state._vertexShaderID != -1) { - removeVertShader(state); - state._vertexShaderID = -1; - } - - if (state.getFragmentShader() != null) { - if (state._fragmentShaderID != -1) { - removeFragShader(state); - } - - state._fragmentShaderID = ARBShaderObjects - .glCreateShaderObjectARB(ARBFragmentShader.GL_FRAGMENT_SHADER_ARB); - - // Create the sources - ARBShaderObjects.glShaderSourceARB(state._fragmentShaderID, state.getFragmentShader()); - - // Compile the fragment shader - final IntBuffer compiled = BufferUtils.createIntBuffer(1); - ARBShaderObjects.glCompileShaderARB(state._fragmentShaderID); - ARBShaderObjects.glGetObjectParameterARB(state._fragmentShaderID, - ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB, compiled); - checkProgramError(compiled, state._fragmentShaderID, state._fragmentShaderName); - - // Attach the program - ARBShaderObjects.glAttachObjectARB(state._programID, state._fragmentShaderID); - } else if (state._fragmentShaderID != -1) { - removeFragShader(state); - state._fragmentShaderID = -1; - } - - if (caps.isGeometryShader4Supported()) { - if (state.getGeometryShader() != null) { - if (state._geometryShaderID != -1) { - removeGeomShader(state); - } - - state._geometryShaderID = ARBShaderObjects - .glCreateShaderObjectARB(ARBGeometryShader4.GL_GEOMETRY_SHADER_ARB); - - // Create the sources - ARBShaderObjects.glShaderSourceARB(state._geometryShaderID, state.getGeometryShader()); - - // Compile the fragment shader - final IntBuffer compiled = BufferUtils.createIntBuffer(1); - ARBShaderObjects.glCompileShaderARB(state._geometryShaderID); - ARBShaderObjects.glGetObjectParameterARB(state._geometryShaderID, - ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB, compiled); - checkProgramError(compiled, state._geometryShaderID, state._geometryShaderName); - - // Attach the program - ARBShaderObjects.glAttachObjectARB(state._programID, state._geometryShaderID); - } else if (state._geometryShaderID != -1) { - removeGeomShader(state); - state._geometryShaderID = -1; - } - } - - if (caps.isTessellationShadersSupported()) { - if (state.getTessellationControlShader() != null) { - if (state._tessellationControlShaderID != -1) { - removeTessControlShader(state); - } - - state._tessellationControlShaderID = ARBShaderObjects - .glCreateShaderObjectARB(ARBTessellationShader.GL_TESS_CONTROL_SHADER); - - // Create the sources - ARBShaderObjects.glShaderSourceARB(state._tessellationControlShaderID, - state.getTessellationControlShader()); - - // Compile the tessellation control shader - final IntBuffer compiled = BufferUtils.createIntBuffer(1); - ARBShaderObjects.glCompileShaderARB(state._tessellationControlShaderID); - ARBShaderObjects.glGetObjectParameterARB(state._tessellationControlShaderID, - ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB, compiled); - checkProgramError(compiled, state._tessellationControlShaderID, state._tessellationControlShaderName); - - // Attach the program - ARBShaderObjects.glAttachObjectARB(state._programID, state._tessellationControlShaderID); - } else if (state._tessellationControlShaderID != -1) { - removeTessControlShader(state); - state._tessellationControlShaderID = -1; - } - - if (state.getTessellationEvaluationShader() != null) { - if (state._tessellationEvaluationShaderID != -1) { - removeTessEvalShader(state); - } - - state._tessellationEvaluationShaderID = ARBShaderObjects - .glCreateShaderObjectARB(ARBTessellationShader.GL_TESS_CONTROL_SHADER); - - // Create the sources - ARBShaderObjects.glShaderSourceARB(state._tessellationEvaluationShaderID, - state.getTessellationEvaluationShader()); - - // Compile the tessellation control shader - final IntBuffer compiled = BufferUtils.createIntBuffer(1); - ARBShaderObjects.glCompileShaderARB(state._tessellationEvaluationShaderID); - ARBShaderObjects.glGetObjectParameterARB(state._tessellationEvaluationShaderID, - ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB, compiled); - checkProgramError(compiled, state._tessellationEvaluationShaderID, - state._tessellationEvaluationShaderName); - - // Attach the program - ARBShaderObjects.glAttachObjectARB(state._programID, state._tessellationEvaluationShaderID); - } else if (state._tessellationEvaluationShaderID != -1) { - removeTessEvalShader(state); - state._tessellationEvaluationShaderID = -1; - } - } - - ARBShaderObjects.glLinkProgramARB(state._programID); - checkLinkError(state._programID); - state.setNeedsRefresh(true); - state._needSendShader = false; - } - - private static void checkLinkError(final int programId) { - final IntBuffer compiled = BufferUtils.createIntBuffer(1); - ARBShaderObjects.glGetObjectParameterARB(programId, GL20.GL_LINK_STATUS, compiled); - if (compiled.get(0) == GL11.GL_FALSE) { - ARBShaderObjects.glGetObjectParameterARB(programId, GL20.GL_INFO_LOG_LENGTH, compiled); - final int length = compiled.get(0); - String out = null; - if (length > 0) { - final ByteBuffer infoLog = BufferUtils.createByteBuffer(length); - - ARBShaderObjects.glGetInfoLogARB(programId, compiled, infoLog); - - final byte[] infoBytes = new byte[length]; - infoLog.get(infoBytes); - out = new String(infoBytes); - } - - logger.severe(out); - - throw new Ardor3dException("Error linking GLSL shader: " + out); - } - } - - /** Removes the geometry shader */ - private static void removeGeomShader(final GLSLShaderObjectsState state) { - if (state._geometryShaderID != -1) { - ARBShaderObjects.glDetachObjectARB(state._programID, state._geometryShaderID); - ARBShaderObjects.glDeleteObjectARB(state._geometryShaderID); - } - } - - /** Removes the fragment shader */ - private static void removeFragShader(final GLSLShaderObjectsState state) { - if (state._fragmentShaderID != -1) { - ARBShaderObjects.glDetachObjectARB(state._programID, state._fragmentShaderID); - ARBShaderObjects.glDeleteObjectARB(state._fragmentShaderID); - } - } - - /** - * Removes the vertex shader - */ - private static void removeVertShader(final GLSLShaderObjectsState state) { - if (state._vertexShaderID != -1) { - ARBShaderObjects.glDetachObjectARB(state._programID, state._vertexShaderID); - ARBShaderObjects.glDeleteObjectARB(state._vertexShaderID); - } - } - - /** Removes the tessellation control shader */ - private static void removeTessControlShader(final GLSLShaderObjectsState state) { - if (state._tessellationControlShaderID != -1) { - ARBShaderObjects.glDetachObjectARB(state._programID, state._tessellationControlShaderID); - ARBShaderObjects.glDeleteObjectARB(state._tessellationControlShaderID); - } - } - - /** Removes the tessellation evaluation shader */ - private static void removeTessEvalShader(final GLSLShaderObjectsState state) { - if (state._tessellationEvaluationShaderID != -1) { - ARBShaderObjects.glDetachObjectARB(state._programID, state._tessellationEvaluationShaderID); - ARBShaderObjects.glDeleteObjectARB(state._tessellationEvaluationShaderID); - } - } - - /** - * Check for program errors. If an error is detected, program exits. - * - * @param compiled - * the compiler state for a given shader - * @param id - * shader's id - */ - private static void checkProgramError(final IntBuffer compiled, final int id, final String shaderName) { - if (compiled.get(0) == GL11.GL_FALSE) { - final IntBuffer iVal = BufferUtils.createIntBuffer(1); - ARBShaderObjects.glGetObjectParameterARB(id, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, iVal); - final int length = iVal.get(0); - String out = null; - - if (length > 0) { - final ByteBuffer infoLog = BufferUtils.createByteBuffer(length); - - ARBShaderObjects.glGetInfoLogARB(id, iVal, infoLog); - - final byte[] infoBytes = new byte[length]; - infoLog.get(infoBytes); - out = new String(infoBytes); - } - - logger.severe(out); - final String nameString = shaderName.equals("") ? "" : " [ " + shaderName + " ]"; - throw new Ardor3dException("Error compiling GLSL shader " + nameString + ": " + out); - - } - } - - public static void apply(final LwjglRenderer renderer, final GLSLShaderObjectsState state) { - final RenderContext context = ContextManager.getCurrentContext(); - final ContextCapabilities caps = context.getCapabilities(); - - if (caps.isGLSLSupported()) { - // Ask for the current state record - final ShaderObjectsStateRecord record = (ShaderObjectsStateRecord) context - .getStateRecord(StateType.GLSLShader); - context.setCurrentState(StateType.GLSLShader, state); - - if (state.isEnabled()) { - if (state._needSendShader) { - sendToGL(state, caps); - } - - if (state._shaderDataLogic != null) { - state._shaderDataLogic.applyData(state, state._mesh, renderer); - } - } - - if (!record.isValid() || record.getReference() != state || state.needsRefresh()) { - record.setReference(state); - if (state.isEnabled() && state._programID != -1) { - // clear any previously existing attributes - clearEnabledAttributes(record); - - // set our current shader - LwjglShaderUtil.useShaderProgram(state._programID, record); - - for (int i = state.getShaderAttributes().size(); --i >= 0;) { - final ShaderVariable shaderVariable = state.getShaderAttributes().get(i); - if (shaderVariable.needsRefresh) { - LwjglShaderUtil.updateAttributeLocation(shaderVariable, state._programID); - shaderVariable.needsRefresh = false; - } - LwjglShaderUtil.updateShaderAttribute(renderer, shaderVariable, state.isUseAttributeVBO()); - } - - for (int i = state.getShaderUniforms().size(); --i >= 0;) { - final ShaderVariable shaderVariable = state.getShaderUniforms().get(i); - if (shaderVariable.needsRefresh) { - LwjglShaderUtil.updateUniformLocation(shaderVariable, state._programID); - LwjglShaderUtil.updateShaderUniform(shaderVariable); - shaderVariable.needsRefresh = false; - } - } - } else { - LwjglShaderUtil.useShaderProgram(0, record); - - clearEnabledAttributes(record); - } - } - - if (!record.isValid()) { - record.validate(); - } - } - } - - private static void clearEnabledAttributes(final ShaderObjectsStateRecord record) { - // go through and disable any enabled attributes - if (!record.enabledAttributes.isEmpty()) { - for (int i = 0, maxI = record.enabledAttributes.size(); i < maxI; i++) { - final ShaderVariable var = record.enabledAttributes.get(i); - if (var.getSize() == 1) { - ARBVertexProgram.glDisableVertexAttribArrayARB(var.variableID); - } else { - for (int j = 0, maxJ = var.getSize(); j < maxJ; j++) { - ARBVertexProgram.glDisableVertexAttribArrayARB(var.variableID + j); - } - } - } - record.enabledAttributes.clear(); - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglShadingStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglShadingStateUtil.java deleted file mode 100644 index a46aa17..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglShadingStateUtil.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.ShadingState; -import com.ardor3d.renderer.state.ShadingState.ShadingMode; -import com.ardor3d.renderer.state.record.ShadingStateRecord; - -public abstract class LwjglShadingStateUtil { - - public static void apply(final ShadingState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final ShadingStateRecord record = (ShadingStateRecord) context.getStateRecord(StateType.Shading); - context.setCurrentState(StateType.Shading, state); - - // If not enabled, we'll use smooth - final int toApply = state.isEnabled() ? getGLShade(state.getShadingMode()) : GL11.GL_SMOOTH; - // only apply if we're different. Update record to reflect any changes. - if (!record.isValid() || toApply != record.lastShade) { - GL11.glShadeModel(toApply); - record.lastShade = toApply; - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static int getGLShade(final ShadingMode shadeMode) { - switch (shadeMode) { - case Flat: - return GL11.GL_FLAT; - case Smooth: - return GL11.GL_SMOOTH; - } - throw new IllegalStateException("unknown shade mode: " + shadeMode); - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglStencilStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglStencilStateUtil.java deleted file mode 100644 index 176fc8c..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglStencilStateUtil.java +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.EXTStencilTwoSide; -import org.lwjgl.opengl.EXTStencilWrap; -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.StencilState; -import com.ardor3d.renderer.state.StencilState.StencilFunction; -import com.ardor3d.renderer.state.StencilState.StencilOperation; -import com.ardor3d.renderer.state.record.StencilStateRecord; - -public abstract class LwjglStencilStateUtil { - - public static void apply(final StencilState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final ContextCapabilities caps = context.getCapabilities(); - final StencilStateRecord record = (StencilStateRecord) context.getStateRecord(StateType.Stencil); - context.setCurrentState(StateType.Stencil, state); - - setEnabled(state.isEnabled(), caps.isTwoSidedStencilSupported() ? state.isUseTwoSided() : false, record, caps); - if (state.isEnabled()) { - if (state.isUseTwoSided() && caps.isTwoSidedStencilSupported()) { - EXTStencilTwoSide.glActiveStencilFaceEXT(GL11.GL_BACK); - applyMask(state.getStencilWriteMaskBack(), record, 2); - applyFunc(getGLStencilFunction(state.getStencilFunctionBack()), state.getStencilReferenceBack(), - state.getStencilFuncMaskBack(), record, 2); - applyOp(getGLStencilOp(state.getStencilOpFailBack(), caps), - getGLStencilOp(state.getStencilOpZFailBack(), caps), - getGLStencilOp(state.getStencilOpZPassBack(), caps), record, 2); - - EXTStencilTwoSide.glActiveStencilFaceEXT(GL11.GL_FRONT); - applyMask(state.getStencilWriteMaskFront(), record, 1); - applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(), - state.getStencilFuncMaskFront(), record, 1); - applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps), - getGLStencilOp(state.getStencilOpZFailFront(), caps), - getGLStencilOp(state.getStencilOpZPassFront(), caps), record, 1); - } else { - applyMask(state.getStencilWriteMaskFront(), record, 0); - applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(), - state.getStencilFuncMaskFront(), record, 0); - applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps), - getGLStencilOp(state.getStencilOpZFailFront(), caps), - getGLStencilOp(state.getStencilOpZPassFront(), caps), record, 0); - } - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static int getGLStencilFunction(final StencilFunction function) { - switch (function) { - case Always: - return GL11.GL_ALWAYS; - case Never: - return GL11.GL_NEVER; - case EqualTo: - return GL11.GL_EQUAL; - case NotEqualTo: - return GL11.GL_NOTEQUAL; - case GreaterThan: - return GL11.GL_GREATER; - case GreaterThanOrEqualTo: - return GL11.GL_GEQUAL; - case LessThan: - return GL11.GL_LESS; - case LessThanOrEqualTo: - return GL11.GL_LEQUAL; - } - throw new IllegalArgumentException("unknown function: " + function); - } - - private static int getGLStencilOp(final StencilOperation operation, final ContextCapabilities caps) { - switch (operation) { - case Keep: - return GL11.GL_KEEP; - case DecrementWrap: - if (caps.isStencilWrapSupported()) { - return EXTStencilWrap.GL_DECR_WRAP_EXT; - } - // FALLS THROUGH - case Decrement: - return GL11.GL_DECR; - case IncrementWrap: - if (caps.isStencilWrapSupported()) { - return EXTStencilWrap.GL_INCR_WRAP_EXT; - } - // FALLS THROUGH - case Increment: - return GL11.GL_INCR; - case Invert: - return GL11.GL_INVERT; - case Replace: - return GL11.GL_REPLACE; - case Zero: - return GL11.GL_ZERO; - } - throw new IllegalArgumentException("unknown operation: " + operation); - } - - private static void setEnabled(final boolean enable, final boolean twoSided, final StencilStateRecord record, - final ContextCapabilities caps) { - if (record.isValid()) { - if (enable && !record.enabled) { - GL11.glEnable(GL11.GL_STENCIL_TEST); - } else if (!enable && record.enabled) { - GL11.glDisable(GL11.GL_STENCIL_TEST); - } - } else { - if (enable) { - GL11.glEnable(GL11.GL_STENCIL_TEST); - } else { - GL11.glDisable(GL11.GL_STENCIL_TEST); - } - } - - setTwoSidedEnabled(enable ? twoSided : false, record, caps); - record.enabled = enable; - } - - private static void setTwoSidedEnabled(final boolean enable, final StencilStateRecord record, - final ContextCapabilities caps) { - if (caps.isTwoSidedStencilSupported()) { - if (record.isValid()) { - if (enable && !record.useTwoSided) { - GL11.glEnable(EXTStencilTwoSide.GL_STENCIL_TEST_TWO_SIDE_EXT); - } else if (!enable && record.useTwoSided) { - GL11.glDisable(EXTStencilTwoSide.GL_STENCIL_TEST_TWO_SIDE_EXT); - } - } else { - if (enable) { - GL11.glEnable(EXTStencilTwoSide.GL_STENCIL_TEST_TWO_SIDE_EXT); - } else { - GL11.glDisable(EXTStencilTwoSide.GL_STENCIL_TEST_TWO_SIDE_EXT); - } - } - } - record.useTwoSided = enable; - } - - private static void applyMask(final int writeMask, final StencilStateRecord record, final int face) { - // if (!record.isValid() || writeMask != record.writeMask[face]) { - GL11.glStencilMask(writeMask); - // record.writeMask[face] = writeMask; - // } - } - - private static void applyFunc(final int glfunc, final int stencilRef, final int funcMask, - final StencilStateRecord record, final int face) { - // if (!record.isValid() || glfunc != record.func[face] || stencilRef != record.ref[face] - // || funcMask != record.funcMask[face]) { - GL11.glStencilFunc(glfunc, stencilRef, funcMask); - // record.func[face] = glfunc; - // record.ref[face] = stencilRef; - // record.funcMask[face] = funcMask; - // } - } - - private static void applyOp(final int fail, final int zfail, final int zpass, final StencilStateRecord record, - final int face) { - // if (!record.isValid() || fail != record.fail[face] || zfail != record.zfail[face] - // || zpass != record.zpass[face]) { - GL11.glStencilOp(fail, zfail, zpass); - // record.fail[face] = fail; - // record.zfail[face] = zfail; - // record.zpass[face] = zpass; - // } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglTextureStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglTextureStateUtil.java deleted file mode 100644 index 9affd9e..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglTextureStateUtil.java +++ /dev/null @@ -1,1689 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import java.nio.ByteBuffer; -import java.nio.IntBuffer; -import java.util.Collection; -import java.util.logging.Logger; - -import org.lwjgl.opengl.ARBDepthTexture; -import org.lwjgl.opengl.ARBMultitexture; -import org.lwjgl.opengl.ARBShadow; -import org.lwjgl.opengl.ARBTextureBorderClamp; -import org.lwjgl.opengl.ARBTextureCompression; -import org.lwjgl.opengl.ARBTextureCubeMap; -import org.lwjgl.opengl.ARBTextureEnvCombine; -import org.lwjgl.opengl.ARBTextureMirroredRepeat; -import org.lwjgl.opengl.EXTTextureFilterAnisotropic; -import org.lwjgl.opengl.EXTTextureLODBias; -import org.lwjgl.opengl.EXTTextureMirrorClamp; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; -import org.lwjgl.opengl.SGISGenerateMipmap; -import org.lwjgl.opengl.Util; -import org.lwjgl.util.glu.GLU; -import org.lwjgl.util.glu.MipMap; - -import com.ardor3d.image.Image; -import com.ardor3d.image.Texture; -import com.ardor3d.image.Texture.ApplyMode; -import com.ardor3d.image.Texture.CombinerFunctionAlpha; -import com.ardor3d.image.Texture.CombinerFunctionRGB; -import com.ardor3d.image.Texture.CombinerOperandAlpha; -import com.ardor3d.image.Texture.CombinerOperandRGB; -import com.ardor3d.image.Texture.CombinerSource; -import com.ardor3d.image.Texture.Type; -import com.ardor3d.image.Texture.WrapAxis; -import com.ardor3d.image.Texture.WrapMode; -import com.ardor3d.image.Texture1D; -import com.ardor3d.image.Texture2D; -import com.ardor3d.image.Texture3D; -import com.ardor3d.image.TextureCubeMap; -import com.ardor3d.image.util.ImageUtils; -import com.ardor3d.math.MathUtils; -import com.ardor3d.math.type.ReadOnlyColorRGBA; -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.TextureState; -import com.ardor3d.renderer.state.record.RendererRecord; -import com.ardor3d.renderer.state.record.TextureRecord; -import com.ardor3d.renderer.state.record.TextureStateRecord; -import com.ardor3d.renderer.state.record.TextureUnitRecord; -import com.ardor3d.scene.state.lwjgl.util.LwjglRendererUtil; -import com.ardor3d.scene.state.lwjgl.util.LwjglTextureUtil; -import com.ardor3d.util.Constants; -import com.ardor3d.util.TextureManager; -import com.ardor3d.util.geom.BufferUtils; -import com.ardor3d.util.stat.StatCollector; -import com.ardor3d.util.stat.StatType; - -public abstract class LwjglTextureStateUtil { - private static final Logger logger = Logger.getLogger(LwjglTextureStateUtil.class.getName()); - - public static void load(final Texture texture, final int unit) { - if (texture == null) { - return; - } - - final RenderContext context = ContextManager.getCurrentContext(); - if (context == null) { - logger.warning("RenderContext is null for texture: " + texture); - return; - } - - final ContextCapabilities caps = context.getCapabilities(); - final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(StateType.Texture); - - // Check we are in the right unit - if (record != null) { - checkAndSetUnit(unit, record, caps); - } - - // Create the texture... - // First, look for a texture in the cache just like ours - final Texture cached = TextureManager.findCachedTexture(texture.getTextureKey()); - - if (cached == null) { - TextureManager.addToCache(texture); - } else { - final int textureId = cached.getTextureIdForContext(context.getGlContextRep()); - if (textureId != 0) { - doTextureBind(cached, unit, false); - return; - } - } - - // Create a new texture id for this texture - final IntBuffer id = BufferUtils.createIntBuffer(1); - id.clear(); - GL11.glGenTextures(id); - final int textureId = id.get(0); - - // store the new id by our current gl context. - texture.setTextureIdForContext(context.getGlContextRep(), textureId); - - update(texture, unit); - } - - /** - * bind texture and upload image data to card - */ - public static void update(final Texture texture, final int unit) { - final RenderContext context = ContextManager.getCurrentContext(); - final ContextCapabilities caps = context.getCapabilities(); - - texture.getTextureKey().setClean(context.getGlContextRep()); - - // our texture type: - final Texture.Type type = texture.getType(); - - // bind our texture id to this unit. - doTextureBind(texture, unit, false); - - // pass image data to OpenGL - final Image image = texture.getImage(); - final boolean hasBorder = texture.hasBorder(); - if (image == null) { - logger.warning("Image data for texture is null."); - } - - // set alignment to support images with width % 4 != 0, as images are - // not aligned - GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); - - // Get texture image data. Not all textures have image data. - // For example, ApplyMode.Combine modes can use primary colors, - // texture output, and constants to modify fragments via the - // texture units. - if (image != null) { - final int maxSize = caps.getMaxTextureSize(); - final int actualWidth = image.getWidth(); - final int actualHeight = image.getHeight(); - - final boolean needsPowerOfTwo = !caps.isNonPowerOfTwoTextureSupported() - && (!MathUtils.isPowerOfTwo(image.getWidth()) || !MathUtils.isPowerOfTwo(image.getHeight())); - if (actualWidth > maxSize || actualHeight > maxSize || needsPowerOfTwo) { - if (needsPowerOfTwo) { - logger.warning("(card unsupported) Attempted to apply texture with size that is not power of 2: " - + image.getWidth() + " x " + image.getHeight()); - } - if (actualWidth > maxSize || actualHeight > maxSize) { - logger.warning("(card unsupported) Attempted to apply texture with size bigger than max texture size [" - + maxSize + "]: " + image.getWidth() + " x " + image.getHeight()); - } - - int w = actualWidth; - if (needsPowerOfTwo) { - w = MathUtils.nearestPowerOfTwo(actualWidth); - } - if (w > maxSize) { - w = maxSize; - } - - int h = actualHeight; - if (needsPowerOfTwo) { - h = MathUtils.nearestPowerOfTwo(actualHeight); - } - if (h > maxSize) { - h = maxSize; - } - logger.warning("Rescaling image to " + w + " x " + h + " !!!"); - - // must rescale image to get "top" mipmap texture image - final int pixFormat = LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()); - final int pixDataType = LwjglTextureUtil.getGLPixelDataType(image.getDataType()); - final int bpp = ImageUtils.getPixelByteSize(image.getDataFormat(), image.getDataType()); - final ByteBuffer scaledImage = BufferUtils.createByteBuffer((w + 4) * h * bpp); - final int error = MipMap.gluScaleImage(pixFormat, actualWidth, actualHeight, pixDataType, - image.getData(0), w, h, pixDataType, scaledImage); - if (error != 0) { - Util.checkGLError(); - } - - image.setWidth(w); - image.setHeight(h); - image.setData(scaledImage); - } - - if (!texture.getMinificationFilter().usesMipMapLevels() && !texture.getTextureStoreFormat().isCompressed()) { - - // Load textures which do not need mipmap auto-generating and - // which aren't using compressed images. - - switch (texture.getType()) { - case TwoDimensional: - // ensure the buffer is ready for reading - image.getData(0).rewind(); - // send top level to card - GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); - break; - case OneDimensional: - // ensure the buffer is ready for reading - image.getData(0).rewind(); - // send top level to card - GL11.glTexImage1D(GL11.GL_TEXTURE_1D, 0, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); - break; - case ThreeDimensional: - if (caps.isTexture3DSupported()) { - // concat data into single buffer: - int dSize = 0; - int count = 0; - ByteBuffer data = null; - for (int x = 0; x < image.getData().size(); x++) { - if (image.getData(x) != null) { - data = image.getData(x); - dSize += data.limit(); - count++; - } - } - // reuse buffer if we can. - if (count != 1) { - data = BufferUtils.createByteBuffer(dSize); - for (int x = 0; x < image.getData().size(); x++) { - if (image.getData(x) != null) { - data.put(image.getData(x)); - } - } - // ensure the buffer is ready for reading - data.flip(); - } - // send top level to card - GL12.glTexImage3D(GL12.GL_TEXTURE_3D, 0, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), image.getDepth(), hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), data); - } else { - logger.warning("This card does not support Texture3D."); - } - break; - case CubeMap: - // NOTE: Cubemaps MUST be square, so height is ignored - // on purpose. - if (caps.isTextureCubeMapSupported()) { - for (final TextureCubeMap.Face face : TextureCubeMap.Face.values()) { - // ensure the buffer is ready for reading - image.getData(face.ordinal()).rewind(); - // send top level to card - GL11.glTexImage2D(getGLCubeMapFace(face), 0, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getWidth(), hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), - image.getData(face.ordinal())); - } - } else { - logger.warning("This card does not support Cubemaps."); - } - break; - } - } else if (texture.getMinificationFilter().usesMipMapLevels() && !image.hasMipmaps() - && !texture.getTextureStoreFormat().isCompressed()) { - - // For textures which need mipmaps auto-generating and which - // aren't using compressed images, generate the mipmaps. - // A new mipmap builder may be needed to build mipmaps for - // compressed textures. - - if (caps.isAutomaticMipmapsSupported()) { - // Flag the card to generate mipmaps - GL11.glTexParameteri(getGLType(type), SGISGenerateMipmap.GL_GENERATE_MIPMAP_SGIS, GL11.GL_TRUE); - } - - switch (type) { - case TwoDimensional: - // ensure the buffer is ready for reading - image.getData(0).rewind(); - if (caps.isAutomaticMipmapsSupported()) { - // send top level to card - GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); - } else { - // send to card - GLU.gluBuild2DMipmaps(GL11.GL_TEXTURE_2D, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); - } - break; - case OneDimensional: - // ensure the buffer is ready for reading - image.getData(0).rewind(); - if (caps.isAutomaticMipmapsSupported()) { - // send top level to card - GL11.glTexImage1D(GL11.GL_TEXTURE_1D, 0, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); - } else { - // Note: LWJGL's GLU class does not support - // gluBuild1DMipmaps. - logger.warning("non-fbo 1d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter."); - return; - } - break; - case ThreeDimensional: - if (caps.isTexture3DSupported()) { - if (caps.isAutomaticMipmapsSupported()) { - // concat data into single buffer: - int dSize = 0; - int count = 0; - ByteBuffer data = null; - for (int x = 0; x < image.getData().size(); x++) { - if (image.getData(x) != null) { - data = image.getData(x); - dSize += data.limit(); - count++; - } - } - // reuse buffer if we can. - if (count != 1) { - data = BufferUtils.createByteBuffer(dSize); - for (int x = 0; x < image.getData().size(); x++) { - if (image.getData(x) != null) { - data.put(image.getData(x)); - } - } - // ensure the buffer is ready for reading - data.flip(); - } - // send top level to card - GL12.glTexImage3D(GL12.GL_TEXTURE_3D, 0, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), image.getDepth(), hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), data); - } else { - // Note: LWJGL's GLU class does not support - // gluBuild3DMipmaps. - logger.warning("non-fbo 3d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter."); - return; - } - } else { - logger.warning("This card does not support Texture3D."); - return; - } - break; - case CubeMap: - // NOTE: Cubemaps MUST be square, so height is ignored - // on purpose. - if (caps.isTextureCubeMapSupported()) { - if (caps.isAutomaticMipmapsSupported()) { - for (final TextureCubeMap.Face face : TextureCubeMap.Face.values()) { - // ensure the buffer is ready for reading - image.getData(face.ordinal()).rewind(); - // send top level to card - GL11.glTexImage2D(getGLCubeMapFace(face), 0, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getWidth(), hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), - image.getData(face.ordinal())); - } - } else { - for (final TextureCubeMap.Face face : TextureCubeMap.Face.values()) { - // ensure the buffer is ready for reading - image.getData(face.ordinal()).rewind(); - // send to card - GLU.gluBuild2DMipmaps(getGLCubeMapFace(face), - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getWidth(), - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), - image.getData(face.ordinal())); - } - } - } else { - logger.warning("This card does not support Cubemaps."); - return; - } - break; - } - - if (texture.getTextureMaxLevel() >= 0) { - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, texture.getTextureMaxLevel()); - } - } else { - // Here we handle textures that are either compressed or have predefined mipmaps. - // Get mipmap data sizes and amount of mipmaps to send to opengl. Then loop through all mipmaps and send - // them. - int[] mipSizes = image.getMipMapByteSizes(); - ByteBuffer data = null; - - if (type == Type.CubeMap) { - if (caps.isTextureCubeMapSupported()) { - for (final TextureCubeMap.Face face : TextureCubeMap.Face.values()) { - data = image.getData(face.ordinal()); - int pos = 0; - int max = 1; - - if (mipSizes == null) { - mipSizes = new int[] { data.capacity() }; - } else if (texture.getMinificationFilter().usesMipMapLevels()) { - max = mipSizes.length; - } - - // set max mip level - GL11.glTexParameteri(getGLCubeMapFace(face), GL12.GL_TEXTURE_MAX_LEVEL, max - 1); - - for (int m = 0; m < max; m++) { - final int width = Math.max(1, image.getWidth() >> m); - final int height = Math.max(1, image.getHeight() >> m); - - data.position(pos); - data.limit(pos + mipSizes[m]); - - if (texture.getTextureStoreFormat().isCompressed()) { - ARBTextureCompression.glCompressedTexImage2DARB(getGLCubeMapFace(face), m, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, hasBorder ? 1 : 0, data); - } else { - GL11.glTexImage2D(getGLCubeMapFace(face), m, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), data); - } - pos += mipSizes[m]; - } - } - } else { - logger.warning("This card does not support CubeMaps."); - return; - } - } else { - data = image.getData(0); - int pos = 0; - int max = 1; - - if (mipSizes == null) { - mipSizes = new int[] { data.capacity() }; - } else if (texture.getMinificationFilter().usesMipMapLevels()) { - max = mipSizes.length; - } - - // Set max mip level - switch (type) { - case TwoDimensional: - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, max - 1); - break; - case ThreeDimensional: - GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL12.GL_TEXTURE_MAX_LEVEL, max - 1); - break; - case OneDimensional: - GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL12.GL_TEXTURE_MAX_LEVEL, max - 1); - break; - case CubeMap: - // handled above - break; - } - - if (type == Type.ThreeDimensional) { - if (caps.isTexture3DSupported()) { - // concat data into single buffer: - int dSize = 0; - int count = 0; - for (int x = 0; x < image.getData().size(); x++) { - if (image.getData(x) != null) { - data = image.getData(x); - dSize += data.limit(); - count++; - } - } - // reuse buffer if we can. - if (count != 1) { - data = BufferUtils.createByteBuffer(dSize); - for (int x = 0; x < image.getData().size(); x++) { - if (image.getData(x) != null) { - data.put(image.getData(x)); - } - } - // ensure the buffer is ready for reading - data.flip(); - } - } else { - logger.warning("This card does not support Texture3D."); - return; - } - } - - for (int m = 0; m < max; m++) { - final int width = Math.max(1, image.getWidth() >> m); - final int height = Math.max(1, image.getHeight() >> m); - - data.position(pos); - data.limit(pos + mipSizes[m]); - - switch (type) { - case TwoDimensional: - if (texture.getTextureStoreFormat().isCompressed()) { - ARBTextureCompression.glCompressedTexImage2DARB(GL11.GL_TEXTURE_2D, m, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, hasBorder ? 1 : 0, data); - } else { - GL11.glTexImage2D(GL11.GL_TEXTURE_2D, m, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), data); - } - break; - case OneDimensional: - if (texture.getTextureStoreFormat().isCompressed()) { - ARBTextureCompression.glCompressedTexImage1DARB(GL11.GL_TEXTURE_1D, m, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, hasBorder ? 1 : 0, data); - } else { - GL11.glTexImage1D(GL11.GL_TEXTURE_1D, m, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), data); - } - break; - case ThreeDimensional: - final int depth = Math.max(1, image.getDepth() >> m); - // already checked for support above... - if (texture.getTextureStoreFormat().isCompressed()) { - ARBTextureCompression.glCompressedTexImage3DARB(GL12.GL_TEXTURE_3D, m, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, depth, hasBorder ? 1 : 0, data); - } else { - GL12.glTexImage3D(GL12.GL_TEXTURE_3D, m, - LwjglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, depth, hasBorder ? 1 : 0, - LwjglTextureUtil.getGLPixelFormat(image.getDataFormat()), - LwjglTextureUtil.getGLPixelDataType(image.getDataType()), data); - } - break; - } - pos += mipSizes[m]; - } - } - if (data != null) { - data.clear(); - } - } - } - } - - public static void apply(final TextureState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final ContextCapabilities caps = context.getCapabilities(); - final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(StateType.Texture); - context.setCurrentState(StateType.Texture, state); - - if (state.isEnabled()) { - - Texture texture; - Texture.Type type; - TextureUnitRecord unitRecord; - TextureRecord texRecord; - - final int glHint = LwjglTextureUtil.getPerspHint(state.getCorrectionType()); - if (!record.isValid() || record.hint != glHint) { - // set up correction mode - GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, glHint); - record.hint = glHint; - } - - // loop through all available texture units... - for (int i = 0; i < caps.getNumberOfTotalTextureUnits(); i++) { - unitRecord = record.units[i]; - - // grab a texture for this unit, if available - texture = state.getTexture(i); - - // pull our texture id for this texture, for this context. - int textureId = texture != null ? texture.getTextureIdForContext(context.getGlContextRep()) : 0; - - // check for invalid textures - ones that have no opengl id and - // no image data - if (texture != null && textureId == 0 && texture.getImage() == null) { - texture = null; - } - - // null textures above fixed limit do not need to be disabled - // since they are not really part of the pipeline. - if (texture == null) { - if (i >= caps.getNumberOfFixedTextureUnits()) { - continue; - } else { - // a null texture indicates no texturing at this unit - // Disable texturing on this unit if enabled. - disableTexturing(unitRecord, record, i, caps); - - if (i < state._keyCache.length) { - state._keyCache[i] = null; - } - - // next texture! - continue; - } - } - - type = texture.getType(); - - // disable other texturing types for this unit, if enabled. - disableTexturing(unitRecord, record, i, type, caps); - - // Time to bind the texture, so see if we need to load in image - // data for this texture. - if (textureId == 0) { - // texture not yet loaded. - // this will load and bind and set the records... - load(texture, i); - textureId = texture.getTextureIdForContext(context.getGlContextRep()); - if (textureId == 0) { - continue; - } - } else if (texture.isDirty(context.getGlContextRep())) { - update(texture, i); - textureId = texture.getTextureIdForContext(context.getGlContextRep()); - if (textureId == 0) { - continue; - } - } else { - // texture already exists in OpenGL, just bind it if needed - if (!unitRecord.isValid() || unitRecord.boundTexture != textureId) { - checkAndSetUnit(i, record, caps); - GL11.glBindTexture(getGLType(type), textureId); - if (Constants.stats) { - StatCollector.addStat(StatType.STAT_TEXTURE_BINDS, 1); - } - unitRecord.boundTexture = textureId; - } - } - - // Use the Java Integer object for the getTextureRecord call to avoid - // boxing/unboxing ints for map lookups. - final Integer textureIdInteger = texture.getTextureIdForContextAsInteger(context.getGlContextRep()); - - // Grab our record for this texture - texRecord = record.getTextureRecord(textureIdInteger, texture.getType()); - - // Set the keyCache value for this unit of this texture state - // This is done so during state comparison we don't have to - // spend a lot of time pulling out classes and finding field - // data. - state._keyCache[i] = texture.getTextureKey(); - - // Some texture things only apply to fixed function pipeline - if (i < caps.getNumberOfFixedTextureUnits()) { - - // Enable 2D texturing on this unit if not enabled. - if (!unitRecord.isValid() || !unitRecord.enabled[type.ordinal()]) { - checkAndSetUnit(i, record, caps); - GL11.glEnable(getGLType(type)); - unitRecord.enabled[type.ordinal()] = true; - } - - // Set our blend color, if needed. - applyBlendColor(texture, unitRecord, i, record, caps); - - // Set the texture environment mode if this unit isn't - // already set properly - applyEnvMode(texture.getApply(), unitRecord, i, record, caps); - - // If our mode is combine, and we support multitexturing - // apply combine settings. - if (texture.getApply() == ApplyMode.Combine && caps.isMultitextureSupported() - && caps.isEnvCombineSupported()) { - applyCombineFactors(texture, unitRecord, i, record, caps); - } - } - - // Other items only apply to textures below the frag unit limit - if (i < caps.getNumberOfFragmentTextureUnits()) { - - // texture specific params - applyFilter(texture, texRecord, i, record, caps); - applyWrap(texture, texRecord, i, record, caps); - applyShadow(texture, texRecord, i, record, caps); - - // Set our border color, if needed. - applyBorderColor(texture, texRecord, i, record); - - // all states have now been applied for a tex record, so we - // can safely make it valid - if (!texRecord.isValid()) { - texRecord.validate(); - } - - } - - // Other items only apply to textures below the frag tex coord - // unit limit - if (i < caps.getNumberOfFragmentTexCoordUnits()) { - - // Now time to play with texture matrices - // Determine which transforms to do. - applyTextureTransforms(texture, i, record, caps); - - // Now let's look at automatic texture coordinate - // generation. - applyTexCoordGeneration(texture, unitRecord, i, record, caps); - - // Set our texture lod bias, if needed. - applyLodBias(texture, unitRecord, i, record, caps); - } - - } - - } else { - // turn off texturing - TextureUnitRecord unitRecord; - - if (caps.isMultitextureSupported()) { - for (int i = 0; i < caps.getNumberOfFixedTextureUnits(); i++) { - unitRecord = record.units[i]; - disableTexturing(unitRecord, record, i, caps); - } - } else { - unitRecord = record.units[0]; - disableTexturing(unitRecord, record, 0, caps); - } - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static void disableTexturing(final TextureUnitRecord unitRecord, final TextureStateRecord record, - final int unit, final Type exceptedType, final ContextCapabilities caps) { - if (exceptedType != Type.TwoDimensional) { - if (!unitRecord.isValid() || unitRecord.enabled[Type.TwoDimensional.ordinal()]) { - // Check we are in the right unit - checkAndSetUnit(unit, record, caps); - GL11.glDisable(GL11.GL_TEXTURE_2D); - unitRecord.enabled[Type.TwoDimensional.ordinal()] = false; - } - } - - if (exceptedType != Type.OneDimensional) { - if (!unitRecord.isValid() || unitRecord.enabled[Type.OneDimensional.ordinal()]) { - // Check we are in the right unit - checkAndSetUnit(unit, record, caps); - GL11.glDisable(GL11.GL_TEXTURE_1D); - unitRecord.enabled[Type.OneDimensional.ordinal()] = false; - } - } - - if (caps.isTexture3DSupported() && exceptedType != Type.ThreeDimensional) { - if (!unitRecord.isValid() || unitRecord.enabled[Type.ThreeDimensional.ordinal()]) { - // Check we are in the right unit - checkAndSetUnit(unit, record, caps); - GL11.glDisable(GL12.GL_TEXTURE_3D); - unitRecord.enabled[Type.ThreeDimensional.ordinal()] = false; - } - } - - if (caps.isTextureCubeMapSupported() && exceptedType != Type.CubeMap) { - if (!unitRecord.isValid() || unitRecord.enabled[Type.CubeMap.ordinal()]) { - // Check we are in the right unit - checkAndSetUnit(unit, record, caps); - GL11.glDisable(ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_ARB); - unitRecord.enabled[Type.CubeMap.ordinal()] = false; - } - } - - } - - private static void disableTexturing(final TextureUnitRecord unitRecord, final TextureStateRecord record, - final int unit, final ContextCapabilities caps) { - if (!unitRecord.isValid() || unitRecord.enabled[Type.TwoDimensional.ordinal()]) { - // Check we are in the right unit - checkAndSetUnit(unit, record, caps); - GL11.glDisable(GL11.GL_TEXTURE_2D); - unitRecord.enabled[Type.TwoDimensional.ordinal()] = false; - } - - if (!unitRecord.isValid() || unitRecord.enabled[Type.OneDimensional.ordinal()]) { - // Check we are in the right unit - checkAndSetUnit(unit, record, caps); - GL11.glDisable(GL11.GL_TEXTURE_1D); - unitRecord.enabled[Type.OneDimensional.ordinal()] = false; - } - - if (caps.isTexture3DSupported()) { - if (!unitRecord.isValid() || unitRecord.enabled[Type.ThreeDimensional.ordinal()]) { - // Check we are in the right unit - checkAndSetUnit(unit, record, caps); - GL11.glDisable(GL12.GL_TEXTURE_3D); - unitRecord.enabled[Type.ThreeDimensional.ordinal()] = false; - } - } - - if (caps.isTextureCubeMapSupported()) { - if (!unitRecord.isValid() || unitRecord.enabled[Type.CubeMap.ordinal()]) { - // Check we are in the right unit - checkAndSetUnit(unit, record, caps); - GL11.glDisable(ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_ARB); - unitRecord.enabled[Type.CubeMap.ordinal()] = false; - } - } - - } - - public static void applyCombineFactors(final Texture texture, final TextureUnitRecord unitRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - // check that this is a valid fixed function unit. glTexEnv is only - // supported for unit < GL_MAX_TEXTURE_UNITS - if (unit >= caps.getNumberOfFixedTextureUnits()) { - return; - } - - // first thing's first... if we are doing dot3 and don't - // support it, disable this texture. - boolean checked = false; - if (!caps.isEnvDot3TextureCombineSupported() - && (texture.getCombineFuncRGB() == CombinerFunctionRGB.Dot3RGB || texture.getCombineFuncRGB() == CombinerFunctionRGB.Dot3RGBA)) { - - // disable - disableTexturing(unitRecord, record, unit, caps); - - // No need to continue - return; - } - - // Okay, now let's set our scales if we need to: - // First RGB Combine scale - if (!unitRecord.isValid() || unitRecord.envRGBScale != texture.getCombineScaleRGB()) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_RGB_SCALE_ARB, texture.getCombineScaleRGB() - .floatValue()); - unitRecord.envRGBScale = texture.getCombineScaleRGB(); - } - // Then Alpha Combine scale - if (!unitRecord.isValid() || unitRecord.envAlphaScale != texture.getCombineScaleAlpha()) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_ALPHA_SCALE, texture.getCombineScaleAlpha().floatValue()); - unitRecord.envAlphaScale = texture.getCombineScaleAlpha(); - } - - // Time to set the RGB combines - final CombinerFunctionRGB rgbCombineFunc = texture.getCombineFuncRGB(); - if (!unitRecord.isValid() || unitRecord.rgbCombineFunc != rgbCombineFunc) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_COMBINE_RGB_ARB, - LwjglTextureUtil.getGLCombineFuncRGB(rgbCombineFunc)); - unitRecord.rgbCombineFunc = rgbCombineFunc; - } - - CombinerSource combSrcRGB = texture.getCombineSrc0RGB(); - if (!unitRecord.isValid() || unitRecord.combSrcRGB0 != combSrcRGB) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE0_RGB_ARB, - LwjglTextureUtil.getGLCombineSrc(combSrcRGB)); - unitRecord.combSrcRGB0 = combSrcRGB; - } - - CombinerOperandRGB combOpRGB = texture.getCombineOp0RGB(); - if (!unitRecord.isValid() || unitRecord.combOpRGB0 != combOpRGB) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND0_RGB_ARB, - LwjglTextureUtil.getGLCombineOpRGB(combOpRGB)); - unitRecord.combOpRGB0 = combOpRGB; - } - - // We only need to do Arg1 or Arg2 if we aren't in Replace mode - if (rgbCombineFunc != CombinerFunctionRGB.Replace) { - - combSrcRGB = texture.getCombineSrc1RGB(); - if (!unitRecord.isValid() || unitRecord.combSrcRGB1 != combSrcRGB) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE1_RGB_ARB, - LwjglTextureUtil.getGLCombineSrc(combSrcRGB)); - unitRecord.combSrcRGB1 = combSrcRGB; - } - - combOpRGB = texture.getCombineOp1RGB(); - if (!unitRecord.isValid() || unitRecord.combOpRGB1 != combOpRGB) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND1_RGB_ARB, - LwjglTextureUtil.getGLCombineOpRGB(combOpRGB)); - unitRecord.combOpRGB1 = combOpRGB; - } - - // We only need to do Arg2 if we are in Interpolate mode - if (rgbCombineFunc == CombinerFunctionRGB.Interpolate) { - - combSrcRGB = texture.getCombineSrc2RGB(); - if (!unitRecord.isValid() || unitRecord.combSrcRGB2 != combSrcRGB) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE2_RGB_ARB, - LwjglTextureUtil.getGLCombineSrc(combSrcRGB)); - unitRecord.combSrcRGB2 = combSrcRGB; - } - - combOpRGB = texture.getCombineOp2RGB(); - if (!unitRecord.isValid() || unitRecord.combOpRGB2 != combOpRGB) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND2_RGB_ARB, - LwjglTextureUtil.getGLCombineOpRGB(combOpRGB)); - unitRecord.combOpRGB2 = combOpRGB; - } - - } - } - - // Now Alpha combines - final CombinerFunctionAlpha alphaCombineFunc = texture.getCombineFuncAlpha(); - if (!unitRecord.isValid() || unitRecord.alphaCombineFunc != alphaCombineFunc) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_COMBINE_ALPHA_ARB, - LwjglTextureUtil.getGLCombineFuncAlpha(alphaCombineFunc)); - unitRecord.alphaCombineFunc = alphaCombineFunc; - } - - CombinerSource combSrcAlpha = texture.getCombineSrc0Alpha(); - if (!unitRecord.isValid() || unitRecord.combSrcAlpha0 != combSrcAlpha) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE0_ALPHA_ARB, - LwjglTextureUtil.getGLCombineSrc(combSrcAlpha)); - unitRecord.combSrcAlpha0 = combSrcAlpha; - } - - CombinerOperandAlpha combOpAlpha = texture.getCombineOp0Alpha(); - if (!unitRecord.isValid() || unitRecord.combOpAlpha0 != combOpAlpha) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND0_ALPHA_ARB, - LwjglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); - unitRecord.combOpAlpha0 = combOpAlpha; - } - - // We only need to do Arg1 or Arg2 if we aren't in Replace mode - if (alphaCombineFunc != CombinerFunctionAlpha.Replace) { - - combSrcAlpha = texture.getCombineSrc1Alpha(); - if (!unitRecord.isValid() || unitRecord.combSrcAlpha1 != combSrcAlpha) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE1_ALPHA_ARB, - LwjglTextureUtil.getGLCombineSrc(combSrcAlpha)); - unitRecord.combSrcAlpha1 = combSrcAlpha; - } - - combOpAlpha = texture.getCombineOp1Alpha(); - if (!unitRecord.isValid() || unitRecord.combOpAlpha1 != combOpAlpha) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND1_ALPHA_ARB, - LwjglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); - unitRecord.combOpAlpha1 = combOpAlpha; - } - - // We only need to do Arg2 if we are in Interpolate mode - if (alphaCombineFunc == CombinerFunctionAlpha.Interpolate) { - - combSrcAlpha = texture.getCombineSrc2Alpha(); - if (!unitRecord.isValid() || unitRecord.combSrcAlpha2 != combSrcAlpha) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_SOURCE2_ALPHA_ARB, - LwjglTextureUtil.getGLCombineSrc(combSrcAlpha)); - unitRecord.combSrcAlpha2 = combSrcAlpha; - } - - combOpAlpha = texture.getCombineOp2Alpha(); - if (!unitRecord.isValid() || unitRecord.combOpAlpha2 != combOpAlpha) { - if (!checked) { - checkAndSetUnit(unit, record, caps); - checked = true; - } - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, ARBTextureEnvCombine.GL_OPERAND2_ALPHA_ARB, - LwjglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); - unitRecord.combOpAlpha2 = combOpAlpha; - } - } - } - } - - public static void applyEnvMode(final ApplyMode mode, final TextureUnitRecord unitRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - if (!unitRecord.isValid() || unitRecord.envMode != mode) { - checkAndSetUnit(unit, record, caps); - GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, LwjglTextureUtil.getGLEnvMode(mode)); - unitRecord.envMode = mode; - } - } - - public static void applyBlendColor(final Texture texture, final TextureUnitRecord unitRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - final ReadOnlyColorRGBA texBlend = texture.getConstantColor(); - if (!unitRecord.isValid() || !unitRecord.blendColor.equals(texBlend)) { - checkAndSetUnit(unit, record, caps); - TextureRecord.colorBuffer.clear(); - TextureRecord.colorBuffer.put(texBlend.getRed()).put(texBlend.getGreen()).put(texBlend.getBlue()) - .put(texBlend.getAlpha()); - TextureRecord.colorBuffer.rewind(); - GL11.glTexEnv(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_COLOR, TextureRecord.colorBuffer); - unitRecord.blendColor.set(texBlend); - } - } - - public static void applyLodBias(final Texture texture, final TextureUnitRecord unitRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - if (caps.isTextureLodBiasSupported()) { - final float bias = texture.getLodBias() < caps.getMaxLodBias() ? texture.getLodBias() : caps - .getMaxLodBias(); - if (!unitRecord.isValid() || unitRecord.lodBias != bias) { - checkAndSetUnit(unit, record, caps); - GL11.glTexEnvf(EXTTextureLODBias.GL_TEXTURE_FILTER_CONTROL_EXT, - EXTTextureLODBias.GL_TEXTURE_LOD_BIAS_EXT, bias); - unitRecord.lodBias = bias; - } - } - } - - public static void applyBorderColor(final Texture texture, final TextureRecord texRecord, final int unit, - final TextureStateRecord record) { - final ReadOnlyColorRGBA texBorder = texture.getBorderColor(); - if (!texRecord.isValid() || !texRecord.borderColor.equals(texBorder)) { - TextureRecord.colorBuffer.clear(); - TextureRecord.colorBuffer.put(texBorder.getRed()).put(texBorder.getGreen()).put(texBorder.getBlue()) - .put(texBorder.getAlpha()); - TextureRecord.colorBuffer.rewind(); - GL11.glTexParameter(getGLType(texture.getType()), GL11.GL_TEXTURE_BORDER_COLOR, TextureRecord.colorBuffer); - texRecord.borderColor.set(texBorder); - } - } - - public static void applyTextureTransforms(final Texture texture, final int unit, final TextureStateRecord record, - final ContextCapabilities caps) { - final boolean needsReset = !record.units[unit].identityMatrix; - - // Should we apply the transform? - final boolean doTrans = !texture.getTextureMatrix().isIdentity(); - - // Now do them. - final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - if (doTrans) { - checkAndSetUnit(unit, record, caps); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_TEXTURE); - - record.tmp_matrixBuffer.rewind(); - texture.getTextureMatrix().toDoubleBuffer(record.tmp_matrixBuffer, true); - record.tmp_matrixBuffer.rewind(); - GL11.glLoadMatrix(record.tmp_matrixBuffer); - - record.units[unit].identityMatrix = false; - } else if (needsReset) { - checkAndSetUnit(unit, record, caps); - LwjglRendererUtil.switchMode(matRecord, GL11.GL_TEXTURE); - GL11.glLoadIdentity(); - record.units[unit].identityMatrix = true; - } - // Switch back to the modelview matrix for further operations - LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW); - } - - public static void applyTexCoordGeneration(final Texture texture, final TextureUnitRecord unitRecord, - final int unit, final TextureStateRecord record, final ContextCapabilities caps) { - switch (texture.getEnvironmentalMapMode()) { - case None: - // No coordinate generation - setTextureGen(unitRecord, unit, record, caps, false, false, false, false); - break; - case SphereMap: - // generate spherical texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL11.GL_SPHERE_MAP) { - checkAndSetUnit(unit, record, caps); - - GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_SPHERE_MAP); - unitRecord.textureGenSMode = GL11.GL_SPHERE_MAP; - - GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_SPHERE_MAP); - unitRecord.textureGenTMode = GL11.GL_SPHERE_MAP; - } - - setTextureGen(unitRecord, unit, record, caps, true, true, false, false); - break; - case NormalMap: - // generate normals based texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != ARBTextureCubeMap.GL_NORMAL_MAP_ARB) { - checkAndSetUnit(unit, record, caps); - GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, ARBTextureCubeMap.GL_NORMAL_MAP_ARB); - unitRecord.textureGenSMode = ARBTextureCubeMap.GL_NORMAL_MAP_ARB; - - GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, ARBTextureCubeMap.GL_NORMAL_MAP_ARB); - unitRecord.textureGenTMode = ARBTextureCubeMap.GL_NORMAL_MAP_ARB; - - GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, ARBTextureCubeMap.GL_NORMAL_MAP_ARB); - unitRecord.textureGenRMode = ARBTextureCubeMap.GL_NORMAL_MAP_ARB; - } - - setTextureGen(unitRecord, unit, record, caps, true, true, true, false); - break; - case ReflectionMap: - // generate reflection texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != ARBTextureCubeMap.GL_REFLECTION_MAP_ARB) { - checkAndSetUnit(unit, record, caps); - - GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, ARBTextureCubeMap.GL_REFLECTION_MAP_ARB); - unitRecord.textureGenSMode = ARBTextureCubeMap.GL_REFLECTION_MAP_ARB; - - GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, ARBTextureCubeMap.GL_REFLECTION_MAP_ARB); - unitRecord.textureGenTMode = ARBTextureCubeMap.GL_REFLECTION_MAP_ARB; - - GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, ARBTextureCubeMap.GL_REFLECTION_MAP_ARB); - unitRecord.textureGenRMode = ARBTextureCubeMap.GL_REFLECTION_MAP_ARB; - } - - setTextureGen(unitRecord, unit, record, caps, true, true, true, false); - break; - case EyeLinear: - // do here because we don't check planes - checkAndSetUnit(unit, record, caps); - - // generate eye linear texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL11.GL_EYE_LINEAR) { - GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR); - unitRecord.textureGenSMode = GL11.GL_EYE_LINEAR; - - GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR); - unitRecord.textureGenTMode = GL11.GL_EYE_LINEAR; - - GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR); - unitRecord.textureGenRMode = GL11.GL_EYE_LINEAR; - - GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR); - unitRecord.textureGenQMode = GL11.GL_EYE_LINEAR; - } - - record.prepPlane(texture.getEnvPlaneS(), TextureStateRecord.DEFAULT_S_PLANE); - GL11.glTexGen(GL11.GL_S, GL11.GL_EYE_PLANE, record.plane); - record.prepPlane(texture.getEnvPlaneT(), TextureStateRecord.DEFAULT_T_PLANE); - GL11.glTexGen(GL11.GL_T, GL11.GL_EYE_PLANE, record.plane); - record.prepPlane(texture.getEnvPlaneR(), TextureStateRecord.DEFAULT_R_PLANE); - GL11.glTexGen(GL11.GL_R, GL11.GL_EYE_PLANE, record.plane); - record.prepPlane(texture.getEnvPlaneQ(), TextureStateRecord.DEFAULT_Q_PLANE); - GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, record.plane); - - setTextureGen(unitRecord, unit, record, caps, true, true, true, true); - break; - case ObjectLinear: - // do here because we don't check planes - checkAndSetUnit(unit, record, caps); - - // generate object linear texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL11.GL_OBJECT_LINEAR) { - GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); - unitRecord.textureGenSMode = GL11.GL_OBJECT_LINEAR; - - GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); - unitRecord.textureGenTMode = GL11.GL_OBJECT_LINEAR; - - GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); - unitRecord.textureGenRMode = GL11.GL_OBJECT_LINEAR; - - GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); - unitRecord.textureGenQMode = GL11.GL_OBJECT_LINEAR; - } - - record.prepPlane(texture.getEnvPlaneS(), TextureStateRecord.DEFAULT_S_PLANE); - GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, record.plane); - record.prepPlane(texture.getEnvPlaneT(), TextureStateRecord.DEFAULT_T_PLANE); - GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, record.plane); - record.prepPlane(texture.getEnvPlaneR(), TextureStateRecord.DEFAULT_R_PLANE); - GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, record.plane); - record.prepPlane(texture.getEnvPlaneQ(), TextureStateRecord.DEFAULT_Q_PLANE); - GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, record.plane); - - setTextureGen(unitRecord, unit, record, caps, true, true, true, true); - break; - } - } - - private static void setTextureGen(final TextureUnitRecord unitRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps, final boolean genS, final boolean genT, - final boolean genR, final boolean genQ) { - if (!unitRecord.isValid()) { - checkAndSetUnit(unit, record, caps); - - if (genS) { - GL11.glEnable(GL11.GL_TEXTURE_GEN_S); - } else { - GL11.glDisable(GL11.GL_TEXTURE_GEN_S); - } - if (genT) { - GL11.glEnable(GL11.GL_TEXTURE_GEN_T); - } else { - GL11.glDisable(GL11.GL_TEXTURE_GEN_T); - } - if (genR) { - GL11.glEnable(GL11.GL_TEXTURE_GEN_R); - } else { - GL11.glDisable(GL11.GL_TEXTURE_GEN_R); - } - if (genQ) { - GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); - } else { - GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); - } - } else { - if (genS != unitRecord.textureGenS) { - checkAndSetUnit(unit, record, caps); - if (genS) { - GL11.glEnable(GL11.GL_TEXTURE_GEN_S); - } else { - GL11.glDisable(GL11.GL_TEXTURE_GEN_S); - } - } - if (genT != unitRecord.textureGenT) { - checkAndSetUnit(unit, record, caps); - if (genT) { - GL11.glEnable(GL11.GL_TEXTURE_GEN_T); - } else { - GL11.glDisable(GL11.GL_TEXTURE_GEN_T); - } - } - if (genR != unitRecord.textureGenR) { - checkAndSetUnit(unit, record, caps); - if (genR) { - GL11.glEnable(GL11.GL_TEXTURE_GEN_R); - } else { - GL11.glDisable(GL11.GL_TEXTURE_GEN_R); - } - } - if (genQ != unitRecord.textureGenQ) { - checkAndSetUnit(unit, record, caps); - if (genQ) { - GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); - } else { - GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); - } - } - } - - unitRecord.textureGenS = genS; - unitRecord.textureGenT = genT; - unitRecord.textureGenR = genR; - unitRecord.textureGenQ = genQ; - } - - // If we support multtexturing, specify the unit we are affecting. - public static void checkAndSetUnit(final int unit, final TextureStateRecord record, final ContextCapabilities caps) { - // No need to worry about valid record, since invalidate sets record's - // currentUnit to -1. - if (record.currentUnit != unit) { - if (unit >= caps.getNumberOfTotalTextureUnits() || !caps.isMultitextureSupported() || unit < 0) { - // ignore this request as it is not valid for the user's hardware. - return; - } - ARBMultitexture.glActiveTextureARB(ARBMultitexture.GL_TEXTURE0_ARB + unit); - record.currentUnit = unit; - } - } - - /** - * Check if the filter settings of this particular texture have been changed and apply as needed. - * - * @param texture - * our texture object - * @param texRecord - * our record of the last state of the texture in gl - * @param record - */ - public static void applyShadow(final Texture texture, final TextureRecord texRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - final Type type = texture.getType(); - - if (caps.isDepthTextureSupported()) { - final int depthMode = LwjglTextureUtil.getGLDepthTextureMode(texture.getDepthMode()); - // set up magnification filter - if (!texRecord.isValid() || texRecord.depthTextureMode != depthMode) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(getGLType(type), ARBDepthTexture.GL_DEPTH_TEXTURE_MODE_ARB, depthMode); - texRecord.depthTextureMode = depthMode; - } - } - - if (caps.isARBShadowSupported()) { - final int depthCompareMode = LwjglTextureUtil.getGLDepthTextureCompareMode(texture.getDepthCompareMode()); - // set up magnification filter - if (!texRecord.isValid() || texRecord.depthTextureCompareMode != depthCompareMode) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(getGLType(type), ARBShadow.GL_TEXTURE_COMPARE_MODE_ARB, depthCompareMode); - texRecord.depthTextureCompareMode = depthCompareMode; - } - - final int depthCompareFunc = LwjglTextureUtil.getGLDepthTextureCompareFunc(texture.getDepthCompareFunc()); - // set up magnification filter - if (!texRecord.isValid() || texRecord.depthTextureCompareFunc != depthCompareFunc) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(getGLType(type), ARBShadow.GL_TEXTURE_COMPARE_FUNC_ARB, depthCompareFunc); - texRecord.depthTextureCompareFunc = depthCompareFunc; - } - } - } - - /** - * Check if the filter settings of this particular texture have been changed and apply as needed. - * - * @param texture - * our texture object - * @param texRecord - * our record of the last state of the texture in gl - * @param record - */ - public static void applyFilter(final Texture texture, final TextureRecord texRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - final Type type = texture.getType(); - - final int magFilter = LwjglTextureUtil.getGLMagFilter(texture.getMagnificationFilter()); - // set up magnification filter - if (!texRecord.isValid() || texRecord.magFilter != magFilter) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(getGLType(type), GL11.GL_TEXTURE_MAG_FILTER, magFilter); - texRecord.magFilter = magFilter; - } - - final int minFilter = LwjglTextureUtil.getGLMinFilter(texture.getMinificationFilter()); - // set up mipmap filter - if (!texRecord.isValid() || texRecord.minFilter != minFilter) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(getGLType(type), GL11.GL_TEXTURE_MIN_FILTER, minFilter); - texRecord.minFilter = minFilter; - } - - // set up aniso filter - if (caps.isAnisoSupported()) { - float aniso = texture.getAnisotropicFilterPercent() * (caps.getMaxAnisotropic() - 1.0f); - aniso += 1.0f; - if (!texRecord.isValid() || (texRecord.anisoLevel - aniso > MathUtils.ZERO_TOLERANCE)) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameterf(getGLType(type), EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso); - texRecord.anisoLevel = aniso; - } - } - } - - /** - * Check if the wrap mode of this particular texture has been changed and apply as needed. - * - * @param texture - * our texture object - * @param texRecord - * our record of the last state of the unit in gl - * @param record - */ - public static void applyWrap(final Texture3D texture, final TextureRecord texRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - if (!caps.isTexture3DSupported()) { - return; - } - - final int wrapS = getGLWrap(texture.getWrap(WrapAxis.S), caps); - final int wrapT = getGLWrap(texture.getWrap(WrapAxis.T), caps); - final int wrapR = getGLWrap(texture.getWrap(WrapAxis.R), caps); - - if (!texRecord.isValid() || texRecord.wrapS != wrapS) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_WRAP_S, wrapS); - texRecord.wrapS = wrapS; - } - if (!texRecord.isValid() || texRecord.wrapT != wrapT) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_WRAP_T, wrapT); - texRecord.wrapT = wrapT; - } - if (!texRecord.isValid() || texRecord.wrapR != wrapR) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL12.GL_TEXTURE_WRAP_R, wrapR); - texRecord.wrapR = wrapR; - } - - } - - /** - * Check if the wrap mode of this particular texture has been changed and apply as needed. - * - * @param texture - * our texture object - * @param texRecord - * our record of the last state of the unit in gl - * @param record - */ - public static void applyWrap(final Texture1D texture, final TextureRecord texRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - final int wrapS = getGLWrap(texture.getWrap(WrapAxis.S), caps); - - if (!texRecord.isValid() || texRecord.wrapS != wrapS) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, wrapS); - texRecord.wrapS = wrapS; - } - } - - /** - * Check if the wrap mode of this particular texture has been changed and apply as needed. - * - * @param texture - * our texture object - * @param texRecord - * our record of the last state of the unit in gl - * @param record - */ - public static void applyWrap(final Texture texture, final TextureRecord texRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - if (texture instanceof Texture2D) { - applyWrap((Texture2D) texture, texRecord, unit, record, caps); - } else if (texture instanceof Texture1D) { - applyWrap((Texture1D) texture, texRecord, unit, record, caps); - } else if (texture instanceof Texture3D) { - applyWrap((Texture3D) texture, texRecord, unit, record, caps); - } else if (texture instanceof TextureCubeMap) { - applyWrap((TextureCubeMap) texture, texRecord, unit, record, caps); - } - } - - /** - * Check if the wrap mode of this particular texture has been changed and apply as needed. - * - * @param texture - * our texture object - * @param texRecord - * our record of the last state of the unit in gl - * @param record - */ - public static void applyWrap(final Texture2D texture, final TextureRecord texRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - final int wrapS = getGLWrap(texture.getWrap(WrapAxis.S), caps); - final int wrapT = getGLWrap(texture.getWrap(WrapAxis.T), caps); - - if (!texRecord.isValid() || texRecord.wrapS != wrapS) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, wrapS); - texRecord.wrapS = wrapS; - } - if (!texRecord.isValid() || texRecord.wrapT != wrapT) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, wrapT); - texRecord.wrapT = wrapT; - } - - } - - /** - * Check if the wrap mode of this particular texture has been changed and apply as needed. - * - * @param cubeMap - * our texture object - * @param texRecord - * our record of the last state of the unit in gl - * @param record - */ - public static void applyWrap(final TextureCubeMap cubeMap, final TextureRecord texRecord, final int unit, - final TextureStateRecord record, final ContextCapabilities caps) { - if (!caps.isTextureCubeMapSupported()) { - return; - } - - final int wrapS = getGLWrap(cubeMap.getWrap(WrapAxis.S), caps); - final int wrapT = getGLWrap(cubeMap.getWrap(WrapAxis.T), caps); - final int wrapR = getGLWrap(cubeMap.getWrap(WrapAxis.R), caps); - - if (!texRecord.isValid() || texRecord.wrapS != wrapS) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_ARB, GL11.GL_TEXTURE_WRAP_S, wrapS); - texRecord.wrapS = wrapS; - } - if (!texRecord.isValid() || texRecord.wrapT != wrapT) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_ARB, GL11.GL_TEXTURE_WRAP_T, wrapT); - texRecord.wrapT = wrapT; - } - if (!texRecord.isValid() || texRecord.wrapR != wrapR) { - checkAndSetUnit(unit, record, caps); - GL11.glTexParameteri(ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_ARB, GL12.GL_TEXTURE_WRAP_R, wrapR); - texRecord.wrapR = wrapR; - } - } - - public static void deleteTexture(final Texture texture) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(StateType.Texture); - - final Integer id = texture.getTextureIdForContextAsInteger(context.getGlContextRep()); - if (id.intValue() == 0) { - // Not on card... return. - return; - } - - final IntBuffer idBuffer = BufferUtils.createIntBuffer(1); - idBuffer.clear(); - idBuffer.put(id.intValue()); - idBuffer.rewind(); - GL11.glDeleteTextures(idBuffer); - record.removeTextureRecord(id); - texture.removeFromIdCache(context.getGlContextRep()); - } - - public static void deleteTextureIds(final Collection<Integer> ids) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(StateType.Texture); - - final IntBuffer idBuffer = BufferUtils.createIntBuffer(ids.size()); - idBuffer.clear(); - for (final Integer i : ids) { - if (i != null) { - idBuffer.put(i); - record.removeTextureRecord(i); - } - } - idBuffer.flip(); - if (idBuffer.remaining() > 0) { - GL11.glDeleteTextures(idBuffer); - } - } - - /** - * Useful for external lwjgl based classes that need to safely set the current texture. - */ - public static void doTextureBind(final Texture texture, final int unit, final boolean invalidateState) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final ContextCapabilities caps = context.getCapabilities(); - final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(StateType.Texture); - if (invalidateState) { - // Set this to null because no current state really matches anymore - context.setCurrentState(StateType.Texture, null); - } - checkAndSetUnit(unit, record, caps); - - final int id = texture.getTextureIdForContext(context.getGlContextRep()); - GL11.glBindTexture(getGLType(texture.getType()), id); - if (Constants.stats) { - StatCollector.addStat(StatType.STAT_TEXTURE_BINDS, 1); - } - if (record != null) { - record.units[unit].boundTexture = id; - } - } - - public static int getGLType(final Type type) { - switch (type) { - case TwoDimensional: - return GL11.GL_TEXTURE_2D; - case OneDimensional: - return GL11.GL_TEXTURE_1D; - case ThreeDimensional: - return GL12.GL_TEXTURE_3D; - case CubeMap: - return ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_ARB; - } - throw new IllegalArgumentException("invalid texture type: " + type); - } - - public static int getGLCubeMapFace(final TextureCubeMap.Face face) { - switch (face) { - case PositiveX: - return ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; - case NegativeX: - return ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB; - case PositiveY: - return ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB; - case NegativeY: - return ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB; - case PositiveZ: - return ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB; - case NegativeZ: - return ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB; - } - throw new IllegalArgumentException("invalid cubemap face: " + face); - } - - public static int getGLWrap(final WrapMode wrap, final ContextCapabilities caps) { - switch (wrap) { - case Repeat: - return GL11.GL_REPEAT; - case MirroredRepeat: - if (caps.isTextureMirroredRepeatSupported()) { - return ARBTextureMirroredRepeat.GL_MIRRORED_REPEAT_ARB; - } else { - return GL11.GL_REPEAT; - } - case MirrorClamp: - if (caps.isTextureMirrorClampSupported()) { - return EXTTextureMirrorClamp.GL_MIRROR_CLAMP_EXT; - } - // FALLS THROUGH - case Clamp: - return GL11.GL_CLAMP; - case MirrorBorderClamp: - if (caps.isTextureMirrorBorderClampSupported()) { - return EXTTextureMirrorClamp.GL_MIRROR_CLAMP_TO_BORDER_EXT; - } - // FALLS THROUGH - case BorderClamp: - if (caps.isTextureBorderClampSupported()) { - return ARBTextureBorderClamp.GL_CLAMP_TO_BORDER_ARB; - } else { - return GL11.GL_CLAMP; - } - case MirrorEdgeClamp: - if (caps.isTextureMirrorEdgeClampSupported()) { - return EXTTextureMirrorClamp.GL_MIRROR_CLAMP_TO_EDGE_EXT; - } - // FALLS THROUGH - case EdgeClamp: - if (caps.isTextureEdgeClampSupported()) { - return GL12.GL_CLAMP_TO_EDGE; - } else { - return GL11.GL_CLAMP; - } - } - throw new IllegalArgumentException("invalid WrapMode type: " + wrap); - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglVertexProgramStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglVertexProgramStateUtil.java deleted file mode 100644 index 462b0a3..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglVertexProgramStateUtil.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import java.nio.ByteBuffer; -import java.nio.IntBuffer; -import java.util.logging.Logger; - -import org.lwjgl.opengl.ARBProgram; -import org.lwjgl.opengl.ARBVertexProgram; -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.VertexProgramState; -import com.ardor3d.renderer.state.record.VertexProgramStateRecord; -import com.ardor3d.util.geom.BufferUtils; - -public abstract class LwjglVertexProgramStateUtil { - private static final Logger logger = Logger.getLogger(LwjglVertexProgramStateUtil.class.getName()); - - /** - * Queries OpenGL for errors in the vertex program. Errors are logged as SEVERE, noting both the line number and - * message. - */ - private static void checkProgramError() { - if (GL11.glGetError() == GL11.GL_INVALID_OPERATION) { - // retrieve the error position - final IntBuffer errorloc = BufferUtils.createIntBuffer(16); - GL11.glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB, errorloc); - - logger.severe("Error " + GL11.glGetString(ARBProgram.GL_PROGRAM_ERROR_STRING_ARB) - + " in vertex program on line " + errorloc.get(0)); - } - } - - protected static int create(final ByteBuffer program) { - - final IntBuffer buf = BufferUtils.createIntBuffer(1); - - ARBProgram.glGenProgramsARB(buf); - ARBProgram.glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, buf.get(0)); - ARBProgram.glProgramStringARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, ARBProgram.GL_PROGRAM_FORMAT_ASCII_ARB, - program); - - checkProgramError(); - - return buf.get(0); - } - - /** - * Applies this vertex program to the current scene. Checks if the GL_ARB_vertex_program extension is supported - * before attempting to enable this program. - * - * @see com.ardor3d.renderer.state.RenderState#apply() - */ - public static void apply(final VertexProgramState state) { - final RenderContext context = ContextManager.getCurrentContext(); - if (context.getCapabilities().isVertexProgramSupported()) { - // ask for the current state record - final VertexProgramStateRecord record = (VertexProgramStateRecord) context - .getStateRecord(StateType.VertexProgram); - context.setCurrentState(StateType.VertexProgram, state); - - if (!record.isValid() || record.getReference() != state) { - record.setReference(state); - if (state.isEnabled()) { - // Vertex program not yet loaded - if (state._getProgramID() == -1) { - if (state.getProgramAsBuffer() != null) { - final int id = create(state.getProgramAsBuffer()); - state._setProgramID(id); - } else { - return; - } - } - - GL11.glEnable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB); - ARBProgram.glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, state._getProgramID()); - - // load environmental parameters... - for (int i = 0; i < VertexProgramState._getEnvParameters().length; i++) { - if (VertexProgramState._getEnvParameters()[i] != null) { - ARBProgram.glProgramEnvParameter4fARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, i, - VertexProgramState._getEnvParameters()[i][0], - VertexProgramState._getEnvParameters()[i][1], - VertexProgramState._getEnvParameters()[i][2], - VertexProgramState._getEnvParameters()[i][3]); - } - } - - // load local parameters... - if (state.isUsingParameters()) { - // no parameters are used - for (int i = 0; i < state._getParameters().length; i++) { - if (state._getParameters()[i] != null) { - ARBProgram.glProgramLocalParameter4fARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, i, - state._getParameters()[i][0], state._getParameters()[i][1], - state._getParameters()[i][2], state._getParameters()[i][3]); - } - } - } - - } else { - GL11.glDisable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB); - } - } - - if (!record.isValid()) { - record.validate(); - } - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglWireframeStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglWireframeStateUtil.java deleted file mode 100644 index 7ce1b24..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglWireframeStateUtil.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.lwjgl.LwjglRenderer; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.WireframeState; -import com.ardor3d.renderer.state.record.WireframeStateRecord; - -public abstract class LwjglWireframeStateUtil { - - public static void apply(final LwjglRenderer renderer, final WireframeState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final WireframeStateRecord record = (WireframeStateRecord) context.getStateRecord(StateType.Wireframe); - context.setCurrentState(StateType.Wireframe, state); - - if (state.isEnabled()) { - renderer.setupLineParameters(state.getLineWidth(), 1, (short) 0xFFFF, state.isAntialiased()); - - switch (state.getFace()) { - case Front: - applyPolyMode(GL11.GL_LINE, GL11.GL_FILL, record); - break; - case Back: - applyPolyMode(GL11.GL_FILL, GL11.GL_LINE, record); - break; - case FrontAndBack: - default: - applyPolyMode(GL11.GL_LINE, GL11.GL_LINE, record); - break; - } - } else { - applyPolyMode(GL11.GL_FILL, GL11.GL_FILL, record); - } - - if (!record.isValid()) { - record.validate(); - } - } - - private static void applyPolyMode(final int frontMode, final int backMode, final WireframeStateRecord record) { - - if (record.isValid()) { - if (frontMode == backMode && (record.frontMode != frontMode || record.backMode != backMode)) { - GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, frontMode); - record.frontMode = frontMode; - record.backMode = backMode; - } else if (frontMode != backMode) { - if (record.frontMode != frontMode) { - GL11.glPolygonMode(GL11.GL_FRONT, frontMode); - record.frontMode = frontMode; - } - if (record.backMode != backMode) { - GL11.glPolygonMode(GL11.GL_BACK, backMode); - record.backMode = backMode; - } - } - - } else { - if (frontMode == backMode) { - GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, frontMode); - } else if (frontMode != backMode) { - GL11.glPolygonMode(GL11.GL_FRONT, frontMode); - GL11.glPolygonMode(GL11.GL_BACK, backMode); - } - record.frontMode = frontMode; - record.backMode = backMode; - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglZBufferStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglZBufferStateUtil.java deleted file mode 100644 index dbebc5c..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglZBufferStateUtil.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl; - -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.ZBufferState; -import com.ardor3d.renderer.state.record.ZBufferStateRecord; - -public abstract class LwjglZBufferStateUtil { - - public static void apply(final ZBufferState state) { - // ask for the current state record - final RenderContext context = ContextManager.getCurrentContext(); - final ZBufferStateRecord record = (ZBufferStateRecord) context.getStateRecord(StateType.ZBuffer); - context.setCurrentState(StateType.ZBuffer, state); - - enableDepthTest(state.isEnabled(), record); - if (state.isEnabled()) { - int depthFunc = 0; - switch (state.getFunction()) { - case Never: - depthFunc = GL11.GL_NEVER; - break; - case LessThan: - depthFunc = GL11.GL_LESS; - break; - case EqualTo: - depthFunc = GL11.GL_EQUAL; - break; - case LessThanOrEqualTo: - depthFunc = GL11.GL_LEQUAL; - break; - case GreaterThan: - depthFunc = GL11.GL_GREATER; - break; - case NotEqualTo: - depthFunc = GL11.GL_NOTEQUAL; - break; - case GreaterThanOrEqualTo: - depthFunc = GL11.GL_GEQUAL; - break; - case Always: - depthFunc = GL11.GL_ALWAYS; - } - applyFunction(depthFunc, record); - } - - enableWrite(state.isWritable(), record); - - if (!record.isValid()) { - record.validate(); - } - } - - private static void enableDepthTest(final boolean enable, final ZBufferStateRecord record) { - if (enable && (!record.depthTest || !record.isValid())) { - GL11.glEnable(GL11.GL_DEPTH_TEST); - record.depthTest = true; - } else if (!enable && (record.depthTest || !record.isValid())) { - GL11.glDisable(GL11.GL_DEPTH_TEST); - record.depthTest = false; - } - } - - private static void applyFunction(final int depthFunc, final ZBufferStateRecord record) { - if (depthFunc != record.depthFunc || !record.isValid()) { - GL11.glDepthFunc(depthFunc); - record.depthFunc = depthFunc; - } - } - - private static void enableWrite(final boolean enable, final ZBufferStateRecord record) { - if (enable != record.writable || !record.isValid()) { - GL11.glDepthMask(enable); - record.writable = enable; - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/shader/LwjglShaderUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/shader/LwjglShaderUtil.java deleted file mode 100644 index 877f2fd..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/shader/LwjglShaderUtil.java +++ /dev/null @@ -1,400 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl.shader; - -import java.nio.ByteBuffer; -import java.util.logging.Logger; - -import org.lwjgl.opengl.ARBShaderObjects; -import org.lwjgl.opengl.ARBVertexProgram; -import org.lwjgl.opengl.ARBVertexShader; -import org.lwjgl.opengl.GL11; - -import com.ardor3d.renderer.ContextCapabilities; -import com.ardor3d.renderer.ContextManager; -import com.ardor3d.renderer.RenderContext; -import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.lwjgl.LwjglRenderer; -import com.ardor3d.renderer.state.RenderState.StateType; -import com.ardor3d.renderer.state.record.ShaderObjectsStateRecord; -import com.ardor3d.scene.state.lwjgl.util.LwjglRendererUtil; -import com.ardor3d.util.geom.BufferUtils; -import com.ardor3d.util.shader.ShaderVariable; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableFloat; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableFloat2; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableFloat3; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableFloat4; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableFloatArray; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableInt; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableInt2; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableInt3; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableInt4; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableIntArray; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableMatrix2; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableMatrix3; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableMatrix4; -import com.ardor3d.util.shader.uniformtypes.ShaderVariableMatrix4Array; -import com.ardor3d.util.shader.uniformtypes.ShaderVariablePointerByte; -import com.ardor3d.util.shader.uniformtypes.ShaderVariablePointerFloat; -import com.ardor3d.util.shader.uniformtypes.ShaderVariablePointerFloatMatrix; -import com.ardor3d.util.shader.uniformtypes.ShaderVariablePointerInt; -import com.ardor3d.util.shader.uniformtypes.ShaderVariablePointerShort; - -/** Utility class for updating shadervariables(uniforms and attributes) */ -public abstract class LwjglShaderUtil { - private static final Logger logger = Logger.getLogger(LwjglShaderUtil.class.getName()); - - /** - * Updates a uniform shadervariable. - * - * @param shaderVariable - * variable to update - */ - public static void updateShaderUniform(final ShaderVariable shaderVariable) { - if (!shaderVariable.hasData()) { - throw new IllegalArgumentException("shaderVariable has no data: " + shaderVariable.name + " type: " - + shaderVariable.getClass().getName()); - } - - if (shaderVariable instanceof ShaderVariableInt) { - updateShaderUniform((ShaderVariableInt) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableInt2) { - updateShaderUniform((ShaderVariableInt2) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableInt3) { - updateShaderUniform((ShaderVariableInt3) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableInt4) { - updateShaderUniform((ShaderVariableInt4) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableIntArray) { - updateShaderUniform((ShaderVariableIntArray) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableFloat) { - updateShaderUniform((ShaderVariableFloat) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableFloat2) { - updateShaderUniform((ShaderVariableFloat2) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableFloat3) { - updateShaderUniform((ShaderVariableFloat3) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableFloat4) { - updateShaderUniform((ShaderVariableFloat4) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableFloatArray) { - updateShaderUniform((ShaderVariableFloatArray) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableMatrix2) { - updateShaderUniform((ShaderVariableMatrix2) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableMatrix3) { - updateShaderUniform((ShaderVariableMatrix3) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableMatrix4) { - updateShaderUniform((ShaderVariableMatrix4) shaderVariable); - } else if (shaderVariable instanceof ShaderVariableMatrix4Array) { - updateShaderUniform((ShaderVariableMatrix4Array) shaderVariable); - } else { - logger.warning("updateShaderUniform: Unknown shaderVariable type!"); - } - } - - /** - * Update variableID for uniform shadervariable if needed. - * - * @param variable - * shadervaribale to update ID on - * @param programID - * shader program context ID - */ - public static void updateUniformLocation(final ShaderVariable variable, final int programID) { - if (variable.variableID == -1) { - final ByteBuffer nameBuf = BufferUtils.createByteBuffer(variable.name.getBytes().length + 1); - nameBuf.clear(); - nameBuf.put(variable.name.getBytes()); - nameBuf.rewind(); - - variable.variableID = ARBShaderObjects.glGetUniformLocationARB(programID, nameBuf); - - if (variable.variableID == -1 && !variable.errorLogged) { - logger.severe("Shader uniform [" + variable.name + "] could not be located in shader"); - variable.errorLogged = true; - } - } - } - - private static void updateShaderUniform(final ShaderVariableInt shaderUniform) { - ARBShaderObjects.glUniform1iARB(shaderUniform.variableID, shaderUniform.value1); - } - - private static void updateShaderUniform(final ShaderVariableInt2 shaderUniform) { - ARBShaderObjects.glUniform2iARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); - } - - private static void updateShaderUniform(final ShaderVariableInt3 shaderUniform) { - ARBShaderObjects.glUniform3iARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, - shaderUniform.value3); - } - - private static void updateShaderUniform(final ShaderVariableInt4 shaderUniform) { - ARBShaderObjects.glUniform4iARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, - shaderUniform.value3, shaderUniform.value4); - } - - private static void updateShaderUniform(final ShaderVariableIntArray shaderUniform) { - switch (shaderUniform.size) { - case 1: - ARBShaderObjects.glUniform1ARB(shaderUniform.variableID, shaderUniform.value); - break; - case 2: - ARBShaderObjects.glUniform2ARB(shaderUniform.variableID, shaderUniform.value); - break; - case 3: - ARBShaderObjects.glUniform3ARB(shaderUniform.variableID, shaderUniform.value); - break; - case 4: - ARBShaderObjects.glUniform4ARB(shaderUniform.variableID, shaderUniform.value); - break; - default: - throw new IllegalArgumentException("Wrong size: " + shaderUniform.size); - } - } - - private static void updateShaderUniform(final ShaderVariableFloat shaderUniform) { - ARBShaderObjects.glUniform1fARB(shaderUniform.variableID, shaderUniform.value1); - } - - private static void updateShaderUniform(final ShaderVariableFloat2 shaderUniform) { - ARBShaderObjects.glUniform2fARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); - } - - private static void updateShaderUniform(final ShaderVariableFloat3 shaderUniform) { - ARBShaderObjects.glUniform3fARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, - shaderUniform.value3); - } - - private static void updateShaderUniform(final ShaderVariableFloat4 shaderUniform) { - ARBShaderObjects.glUniform4fARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, - shaderUniform.value3, shaderUniform.value4); - } - - private static void updateShaderUniform(final ShaderVariableFloatArray shaderUniform) { - switch (shaderUniform.size) { - case 1: - ARBShaderObjects.glUniform1ARB(shaderUniform.variableID, shaderUniform.value); - break; - case 2: - ARBShaderObjects.glUniform2ARB(shaderUniform.variableID, shaderUniform.value); - break; - case 3: - ARBShaderObjects.glUniform3ARB(shaderUniform.variableID, shaderUniform.value); - break; - case 4: - ARBShaderObjects.glUniform4ARB(shaderUniform.variableID, shaderUniform.value); - break; - default: - throw new IllegalArgumentException("Wrong size: " + shaderUniform.size); - } - } - - private static void updateShaderUniform(final ShaderVariableMatrix2 shaderUniform) { - shaderUniform.matrixBuffer.rewind(); - ARBShaderObjects.glUniformMatrix2ARB(shaderUniform.variableID, shaderUniform.rowMajor, - shaderUniform.matrixBuffer); - } - - private static void updateShaderUniform(final ShaderVariableMatrix3 shaderUniform) { - shaderUniform.matrixBuffer.rewind(); - ARBShaderObjects.glUniformMatrix3ARB(shaderUniform.variableID, shaderUniform.rowMajor, - shaderUniform.matrixBuffer); - } - - private static void updateShaderUniform(final ShaderVariableMatrix4 shaderUniform) { - shaderUniform.matrixBuffer.rewind(); - ARBShaderObjects.glUniformMatrix4ARB(shaderUniform.variableID, shaderUniform.rowMajor, - shaderUniform.matrixBuffer); - } - - private static void updateShaderUniform(final ShaderVariableMatrix4Array shaderUniform) { - shaderUniform.matrixBuffer.rewind(); - ARBShaderObjects.glUniformMatrix4ARB(shaderUniform.variableID, shaderUniform.rowMajor, - shaderUniform.matrixBuffer); - } - - /** - * Update variableID for attribute shadervariable if needed. - * - * @param variable - * shadervaribale to update ID on - * @param programID - * shader program context ID - */ - public static void updateAttributeLocation(final ShaderVariable variable, final int programID) { - if (variable.variableID == -1) { - final ByteBuffer nameBuf = BufferUtils.createByteBuffer(variable.name.getBytes().length + 1); - nameBuf.clear(); - nameBuf.put(variable.name.getBytes()); - nameBuf.rewind(); - - variable.variableID = ARBVertexShader.glGetAttribLocationARB(programID, nameBuf); - - if (variable.variableID == -1 && !variable.errorLogged) { - logger.severe("Shader attribute [" + variable.name + "] could not be located in shader"); - variable.errorLogged = true; - } - } - } - - /** - * Updates an vertex attribute pointer. - * - * @param renderer - * the current renderer - * @param shaderVariable - * variable to update - * @param useVBO - * if true, we'll use VBO for the attributes, if false we'll use arrays. - */ - public static void updateShaderAttribute(final Renderer renderer, final ShaderVariable shaderVariable, - final boolean useVBO) { - if (shaderVariable.variableID == -1) { - // attribute is not bound, or was not found in shader. - return; - } - - if (!shaderVariable.hasData()) { - throw new IllegalArgumentException("shaderVariable has no data: " + shaderVariable.name + " type: " - + shaderVariable.getClass().getName()); - } - - final RenderContext context = ContextManager.getCurrentContext(); - final ContextCapabilities caps = context.getCapabilities(); - if (caps.isVBOSupported() && !useVBO) { - renderer.unbindVBO(); - } - - final ShaderObjectsStateRecord record = (ShaderObjectsStateRecord) context.getStateRecord(StateType.GLSLShader); - - if (shaderVariable instanceof ShaderVariablePointerFloat) { - updateShaderAttribute((ShaderVariablePointerFloat) shaderVariable, record, useVBO); - } else if (shaderVariable instanceof ShaderVariablePointerFloatMatrix) { - updateShaderAttribute((ShaderVariablePointerFloatMatrix) shaderVariable, record, useVBO); - } else if (shaderVariable instanceof ShaderVariablePointerByte) { - updateShaderAttribute((ShaderVariablePointerByte) shaderVariable, record, useVBO); - } else if (shaderVariable instanceof ShaderVariablePointerInt) { - updateShaderAttribute((ShaderVariablePointerInt) shaderVariable, record, useVBO); - } else if (shaderVariable instanceof ShaderVariablePointerShort) { - updateShaderAttribute((ShaderVariablePointerShort) shaderVariable, record, useVBO); - } else { - logger.warning("updateShaderAttribute: Unknown shaderVariable type!"); - return; - } - } - - public static void useShaderProgram(final int id, final ShaderObjectsStateRecord record) { - if (record.shaderId != id) { - ARBShaderObjects.glUseProgramObjectARB(id); - record.shaderId = id; - } - } - - private static void enableVertexAttribute(final ShaderVariable var, final ShaderObjectsStateRecord record) { - if (!record.enabledAttributes.contains(var)) { - if (var.getSize() == 1) { - ARBVertexProgram.glEnableVertexAttribArrayARB(var.variableID); - } else { - for (int i = 0, max = var.getSize(); i < max; i++) { - ARBVertexProgram.glEnableVertexAttribArrayARB(var.variableID + i); - } - } - record.enabledAttributes.add(var); - } - } - - private static void updateShaderAttribute(final ShaderVariablePointerFloat variable, - final ShaderObjectsStateRecord record, final boolean useVBO) { - enableVertexAttribute(variable, record); - if (useVBO) { - final RenderContext context = ContextManager.getCurrentContext(); - final int vboId = LwjglRenderer.setupVBO(variable.data, context); - LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, GL11.GL_FLOAT, - variable.normalized, variable.stride, 0); - } else { - variable.data.getBuffer().rewind(); - ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.normalized, - variable.stride, variable.data.getBuffer()); - } - } - - private static void updateShaderAttribute(final ShaderVariablePointerFloatMatrix variable, - final ShaderObjectsStateRecord record, final boolean useVBO) { - final int size = variable.size; - final int length = variable.data.getBuffer().capacity() / size; - final RenderContext context = ContextManager.getCurrentContext(); - int pos = 0; - enableVertexAttribute(variable, record); - for (int i = 0; i < size; i++) { - pos = (i * length); - if (useVBO) { - final int vboId = LwjglRenderer.setupVBO(variable.data, context); - LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - ARBVertexProgram.glVertexAttribPointerARB(variable.variableID + i, size, GL11.GL_FLOAT, - variable.normalized, 0, pos); - } else { - variable.data.getBuffer().limit(pos + length - 1); - variable.data.getBuffer().position(pos); - ARBVertexProgram.glVertexAttribPointerARB(variable.variableID + i, size, variable.normalized, 0, - variable.data.getBuffer()); - } - } - } - - private static void updateShaderAttribute(final ShaderVariablePointerByte variable, - final ShaderObjectsStateRecord record, final boolean useVBO) { - enableVertexAttribute(variable, record); - if (useVBO) { - final RenderContext context = ContextManager.getCurrentContext(); - final int vboId = LwjglRenderer.setupVBO(variable.data, context); - LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, - variable.unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, variable.normalized, variable.stride, 0); - } else { - variable.data.getBuffer().rewind(); - ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.unsigned, - variable.normalized, variable.stride, variable.data.getBuffer()); - } - } - - private static void updateShaderAttribute(final ShaderVariablePointerInt variable, - final ShaderObjectsStateRecord record, final boolean useVBO) { - enableVertexAttribute(variable, record); - if (useVBO) { - final RenderContext context = ContextManager.getCurrentContext(); - final int vboId = LwjglRenderer.setupVBO(variable.data, context); - LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, - variable.unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, variable.normalized, variable.stride, 0); - } else { - variable.data.getBuffer().rewind(); - ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.unsigned, - variable.normalized, variable.stride, variable.data.getBuffer()); - } - } - - private static void updateShaderAttribute(final ShaderVariablePointerShort variable, - final ShaderObjectsStateRecord record, final boolean useVBO) { - enableVertexAttribute(variable, record); - if (useVBO) { - final RenderContext context = ContextManager.getCurrentContext(); - final int vboId = LwjglRenderer.setupVBO(variable.data, context); - LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - ARBVertexProgram - .glVertexAttribPointerARB(variable.variableID, variable.size, - variable.unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, variable.normalized, - variable.stride, 0); - } else { - variable.data.getBuffer().rewind(); - ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.unsigned, - variable.normalized, variable.stride, variable.data.getBuffer()); - } - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/util/LwjglRendererUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/util/LwjglRendererUtil.java deleted file mode 100644 index 8abbe4d..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/util/LwjglRendererUtil.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl.util; - -import java.util.Stack; - -import org.lwjgl.opengl.ARBBufferObject; -import org.lwjgl.opengl.ARBVertexBufferObject; -import org.lwjgl.opengl.GL11; - -import com.ardor3d.math.Rectangle2; -import com.ardor3d.math.type.ReadOnlyRectangle2; -import com.ardor3d.renderer.state.record.RendererRecord; - -public abstract class LwjglRendererUtil { - - public static void switchMode(final RendererRecord rendRecord, final int mode) { - if (!rendRecord.isMatrixValid() || rendRecord.getMatrixMode() != mode) { - GL11.glMatrixMode(mode); - rendRecord.setMatrixMode(mode); - rendRecord.setMatrixValid(true); - } - } - - public static void setBoundVBO(final RendererRecord rendRecord, final int id) { - if (!rendRecord.isVboValid() || rendRecord.getCurrentVboId() != id) { - ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, id); - rendRecord.setCurrentVboId(id); - rendRecord.setVboValid(true); - } - } - - public static void setBoundElementVBO(final RendererRecord rendRecord, final int id) { - if (!rendRecord.isElementVboValid() || rendRecord.getCurrentElementVboId() != id) { - ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, id); - rendRecord.setCurrentElementVboId(id); - rendRecord.setElementVboValid(true); - } - } - - public static void applyScissors(final RendererRecord rendRecord) { - final Stack<ReadOnlyRectangle2> clips = rendRecord.getScissorClips(); - - if (clips.size() > 0) { - final Rectangle2 init = Rectangle2.fetchTempInstance(); - init.set(-1, -1, -1, -1); - ReadOnlyRectangle2 r; - boolean first = true; - for (int i = clips.size(); --i >= 0;) { - r = clips.get(i); - - if (r == null) { - break; - } - if (first) { - init.set(r); - first = false; - } else { - init.intersect(r, init); - } - if (init.getWidth() <= 0 || init.getHeight() <= 0) { - init.setWidth(0); - init.setHeight(0); - break; - } - } - - if (init.getWidth() == -1) { - setClippingEnabled(rendRecord, false); - } else { - setClippingEnabled(rendRecord, true); - GL11.glScissor(init.getX(), init.getY(), init.getWidth(), init.getHeight()); - } - Rectangle2.releaseTempInstance(init); - } else { - // no clips, so disable - setClippingEnabled(rendRecord, false); - } - } - - public static void setClippingEnabled(final RendererRecord rendRecord, final boolean enabled) { - if (enabled && (!rendRecord.isClippingTestValid() || !rendRecord.isClippingTestEnabled())) { - GL11.glEnable(GL11.GL_SCISSOR_TEST); - rendRecord.setClippingTestEnabled(true); - } else if (!enabled && (!rendRecord.isClippingTestValid() || rendRecord.isClippingTestEnabled())) { - GL11.glDisable(GL11.GL_SCISSOR_TEST); - rendRecord.setClippingTestEnabled(false); - } - rendRecord.setClippingTestValid(true); - } -} diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/util/LwjglTextureUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/util/LwjglTextureUtil.java deleted file mode 100644 index 1380fe5..0000000 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/util/LwjglTextureUtil.java +++ /dev/null @@ -1,633 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.scene.state.lwjgl.util; - -import org.lwjgl.opengl.ARBDepthBufferFloat; -import org.lwjgl.opengl.ARBDepthTexture; -import org.lwjgl.opengl.ARBHalfFloatPixel; -import org.lwjgl.opengl.ARBMultitexture; -import org.lwjgl.opengl.ARBShadow; -import org.lwjgl.opengl.ARBTextureCompression; -import org.lwjgl.opengl.ARBTextureEnvCombine; -import org.lwjgl.opengl.ARBTextureEnvDot3; -import org.lwjgl.opengl.ARBTextureFloat; -import org.lwjgl.opengl.ARBTextureRg; -import org.lwjgl.opengl.EXTTextureCompressionLATC; -import org.lwjgl.opengl.EXTTextureCompressionS3TC; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; -import org.lwjgl.opengl.GL30; - -import com.ardor3d.image.ImageDataFormat; -import com.ardor3d.image.PixelDataType; -import com.ardor3d.image.Texture.ApplyMode; -import com.ardor3d.image.Texture.CombinerFunctionAlpha; -import com.ardor3d.image.Texture.CombinerFunctionRGB; -import com.ardor3d.image.Texture.CombinerOperandAlpha; -import com.ardor3d.image.Texture.CombinerOperandRGB; -import com.ardor3d.image.Texture.CombinerSource; -import com.ardor3d.image.Texture.DepthTextureCompareFunc; -import com.ardor3d.image.Texture.DepthTextureCompareMode; -import com.ardor3d.image.Texture.DepthTextureMode; -import com.ardor3d.image.Texture.MagnificationFilter; -import com.ardor3d.image.Texture.MinificationFilter; -import com.ardor3d.image.TextureStoreFormat; -import com.ardor3d.renderer.state.TextureState.CorrectionType; - -public abstract class LwjglTextureUtil { - - public static int getGLInternalFormat(final TextureStoreFormat format) { - switch (format) { - // first some frequently used formats - case RGBA8: - return GL11.GL_RGBA8; - case RGB8: - return GL11.GL_RGB8; - case Alpha8: - return GL11.GL_ALPHA8; - case CompressedRGBA: - return ARBTextureCompression.GL_COMPRESSED_RGBA_ARB; - case CompressedRGB: - return ARBTextureCompression.GL_COMPRESSED_RGB_ARB; - case CompressedRG: - return GL30.GL_COMPRESSED_RG; - case CompressedRed: - return GL30.GL_COMPRESSED_RED; - case CompressedLuminance: - return ARBTextureCompression.GL_COMPRESSED_LUMINANCE_ARB; - case CompressedLuminanceAlpha: - return ARBTextureCompression.GL_COMPRESSED_LUMINANCE_ALPHA_ARB; - case NativeDXT1: - return EXTTextureCompressionS3TC.GL_COMPRESSED_RGB_S3TC_DXT1_EXT; - case NativeDXT1A: - return EXTTextureCompressionS3TC.GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - case NativeDXT3: - return EXTTextureCompressionS3TC.GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - case NativeDXT5: - return EXTTextureCompressionS3TC.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - case NativeLATC_L: - return EXTTextureCompressionLATC.GL_COMPRESSED_LUMINANCE_LATC1_EXT; - case NativeLATC_LA: - return EXTTextureCompressionLATC.GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; - - // The rest... - case Alpha4: - return GL11.GL_ALPHA4; - case Alpha12: - return GL11.GL_ALPHA12; - case Alpha16: - return GL11.GL_ALPHA16; - case Luminance4: - return GL11.GL_LUMINANCE4; - case Luminance8: - return GL11.GL_LUMINANCE8; - case Luminance12: - return GL11.GL_LUMINANCE12; - case Luminance16: - return GL11.GL_LUMINANCE16; - case Intensity4: - return GL11.GL_INTENSITY4; - case Intensity8: - return GL11.GL_INTENSITY8; - case Intensity12: - return GL11.GL_INTENSITY12; - case Intensity16: - return GL11.GL_INTENSITY16; - case Luminance4Alpha4: - return GL11.GL_LUMINANCE4_ALPHA4; - case Luminance6Alpha2: - return GL11.GL_LUMINANCE6_ALPHA2; - case Luminance8Alpha8: - return GL11.GL_LUMINANCE8_ALPHA8; - case Luminance12Alpha4: - return GL11.GL_LUMINANCE12_ALPHA4; - case Luminance12Alpha12: - return GL11.GL_LUMINANCE12_ALPHA12; - case Luminance16Alpha16: - return GL11.GL_LUMINANCE16_ALPHA16; - case R3G3B2: - return GL11.GL_R3_G3_B2; - case RGB4: - return GL11.GL_RGB4; - case RGB5: - return GL11.GL_RGB5; - case RGB10: - return GL11.GL_RGB10; - case RGB12: - return GL11.GL_RGB12; - case RGB16: - return GL11.GL_RGB16; - case RGBA2: - return GL11.GL_RGBA2; - case RGBA4: - return GL11.GL_RGBA4; - case RGB5A1: - return GL11.GL_RGB5_A1; - case RGB10A2: - return GL11.GL_RGB10_A2; - case RGBA12: - return GL11.GL_RGBA12; - case RGBA16: - return GL11.GL_RGBA16; - case Depth: - return GL11.GL_DEPTH_COMPONENT; - case Depth16: - return ARBDepthTexture.GL_DEPTH_COMPONENT16_ARB; - case Depth24: - return ARBDepthTexture.GL_DEPTH_COMPONENT24_ARB; - case Depth32: - return ARBDepthTexture.GL_DEPTH_COMPONENT32_ARB; - case Depth32F: - return ARBDepthBufferFloat.GL_DEPTH_COMPONENT32F; - case RGB16F: - return ARBTextureFloat.GL_RGB16F_ARB; - case RGB32F: - return ARBTextureFloat.GL_RGB32F_ARB; - case RGBA16F: - return ARBTextureFloat.GL_RGBA16F_ARB; - case RGBA32F: - return ARBTextureFloat.GL_RGBA32F_ARB; - case Alpha16F: - return ARBTextureFloat.GL_ALPHA16F_ARB; - case Alpha32F: - return ARBTextureFloat.GL_ALPHA32F_ARB; - case Luminance16F: - return ARBTextureFloat.GL_LUMINANCE16F_ARB; - case Luminance32F: - return ARBTextureFloat.GL_LUMINANCE32F_ARB; - case LuminanceAlpha16F: - return ARBTextureFloat.GL_LUMINANCE_ALPHA16F_ARB; - case LuminanceAlpha32F: - return ARBTextureFloat.GL_LUMINANCE_ALPHA32F_ARB; - case Intensity16F: - return ARBTextureFloat.GL_INTENSITY16F_ARB; - case Intensity32F: - return ARBTextureFloat.GL_INTENSITY32F_ARB; - case R8: - return ARBTextureRg.GL_R8; - case R16: - return ARBTextureRg.GL_R16; - case RG8: - return ARBTextureRg.GL_RG8; - case RG16: - return ARBTextureRg.GL_RG16; - case R16F: - return ARBTextureRg.GL_R16F; - case R32F: - return ARBTextureRg.GL_R32F; - case RG16F: - return ARBTextureRg.GL_RG16F; - case RG32F: - return ARBTextureRg.GL_RG32F; - case R8I: - return ARBTextureRg.GL_R8I; - case R8UI: - return ARBTextureRg.GL_R8UI; - case R16I: - return ARBTextureRg.GL_R16I; - case R16UI: - return ARBTextureRg.GL_R16UI; - case R32I: - return ARBTextureRg.GL_R32I; - case R32UI: - return ARBTextureRg.GL_R32UI; - case RG8I: - return ARBTextureRg.GL_RG8I; - case RG8UI: - return ARBTextureRg.GL_RG8UI; - case RG16I: - return ARBTextureRg.GL_RG16I; - case RG16UI: - return ARBTextureRg.GL_RG16UI; - case RG32I: - return ARBTextureRg.GL_RG32I; - case RG32UI: - return ARBTextureRg.GL_RG32UI; - default: - break; - } - throw new IllegalArgumentException("Incorrect format set: " + format); - } - - public static int getGLPixelDataType(final PixelDataType type) { - switch (type) { - case Byte: - return GL11.GL_BYTE; - case Float: - return GL11.GL_FLOAT; - case HalfFloat: - return ARBHalfFloatPixel.GL_HALF_FLOAT_ARB; - case Short: - return GL11.GL_SHORT; - case UnsignedShort: - return GL11.GL_UNSIGNED_SHORT; - case Int: - return GL11.GL_INT; - case UnsignedInt: - return GL11.GL_UNSIGNED_INT; - case UnsignedByte: - return GL11.GL_UNSIGNED_BYTE; - case UnsignedByte_3_3_2: - return GL12.GL_UNSIGNED_BYTE_3_3_2; - case UnsignedByte_2_3_3_Rev: - return GL12.GL_UNSIGNED_BYTE_2_3_3_REV; - case UnsignedShort_5_6_5: - return GL12.GL_UNSIGNED_SHORT_5_6_5; - case UnsignedShort_5_6_5_Rev: - return GL12.GL_UNSIGNED_SHORT_5_6_5_REV; - case UnsignedShort_4_4_4_4: - return GL12.GL_UNSIGNED_SHORT_4_4_4_4; - case UnsignedShort_4_4_4_4_Rev: - return GL12.GL_UNSIGNED_SHORT_4_4_4_4_REV; - case UnsignedShort_5_5_5_1: - return GL12.GL_UNSIGNED_SHORT_5_5_5_1; - case UnsignedShort_1_5_5_5_Rev: - return GL12.GL_UNSIGNED_SHORT_1_5_5_5_REV; - case UnsignedInt_8_8_8_8: - return GL12.GL_UNSIGNED_INT_8_8_8_8; - case UnsignedInt_8_8_8_8_Rev: - return GL12.GL_UNSIGNED_INT_8_8_8_8_REV; - case UnsignedInt_10_10_10_2: - return GL12.GL_UNSIGNED_INT_10_10_10_2; - case UnsignedInt_2_10_10_10_Rev: - return GL12.GL_UNSIGNED_INT_2_10_10_10_REV; - default: - throw new Error("Unhandled type: " + type); - } - } - - public static int getGLPixelFormat(final ImageDataFormat format) { - switch (format) { - case RGBA: - return GL11.GL_RGBA; - case RGB: - return GL11.GL_RGB; - case RG: - return ARBTextureRg.GL_RG; - case Alpha: - return GL11.GL_ALPHA; - case Luminance: - return GL11.GL_LUMINANCE; - case Intensity: - return GL11.GL_INTENSITY; - case LuminanceAlpha: - return GL11.GL_LUMINANCE_ALPHA; - case Depth: - return GL11.GL_DEPTH_COMPONENT; - case BGR: - return GL12.GL_BGR; - case BGRA: - return GL12.GL_BGRA; - case Red: - return GL11.GL_RED; - case Blue: - return GL11.GL_BLUE; - case Green: - return GL11.GL_GREEN; - case ColorIndex: - return GL11.GL_COLOR_INDEX; - case StencilIndex: - return GL11.GL_STENCIL_INDEX; - default: - break; - } - throw new IllegalArgumentException("Incorrect format set: " + format); - } - - public static int getGLPixelFormatFromStoreFormat(final TextureStoreFormat format) { - switch (format) { - case RGBA2: - case RGBA4: - case RGBA8: - case RGB5A1: - case RGB10A2: - case RGBA12: - case RGBA16: - case CompressedRGBA: - case NativeDXT1A: - case NativeDXT3: - case NativeDXT5: - case RGBA16F: - case RGBA32F: - return GL11.GL_RGBA; - case R3G3B2: - case RGB4: - case RGB5: - case RGB8: - case RGB10: - case RGB12: - case RGB16: - case CompressedRGB: - case NativeDXT1: - case RGB16F: - case RGB32F: - return GL11.GL_RGB; - case Alpha4: - case Alpha8: - case Alpha12: - case Alpha16: - case Alpha16F: - case Alpha32F: - return GL11.GL_ALPHA; - case Luminance4: - case Luminance8: - case Luminance12: - case Luminance16: - case Luminance16F: - case Luminance32F: - case CompressedLuminance: - case NativeLATC_L: - return GL11.GL_LUMINANCE; - case Intensity4: - case Intensity8: - case Intensity12: - case Intensity16: - case Intensity16F: - case Intensity32F: - return GL11.GL_INTENSITY; - case Luminance4Alpha4: - case Luminance6Alpha2: - case Luminance8Alpha8: - case Luminance12Alpha4: - case Luminance12Alpha12: - case Luminance16Alpha16: - case LuminanceAlpha16F: - case LuminanceAlpha32F: - case CompressedLuminanceAlpha: - case NativeLATC_LA: - return GL11.GL_LUMINANCE_ALPHA; - case Depth: - case Depth16: - case Depth24: - case Depth32: - case Depth32F: - return GL11.GL_DEPTH_COMPONENT; - case R8: - case R16: - case R16F: - case R32F: - case R8I: - case R8UI: - case R16I: - case R16UI: - case R32I: - case R32UI: - case CompressedRed: - return ARBTextureRg.GL_RED; - case RG8: - case RG16: - case RG16F: - case RG32F: - case RG8I: - case RG8UI: - case RG16I: - case RG16UI: - case RG32I: - case RG32UI: - case CompressedRG: - return ARBTextureRg.GL_RG; - default: - break; - } - throw new IllegalArgumentException("Incorrect format set: " + format); - } - - public static int getGLDepthTextureMode(final DepthTextureMode mode) { - switch (mode) { - case Alpha: - return GL11.GL_ALPHA; - case Luminance: - return GL11.GL_LUMINANCE; - case Intensity: - default: - return GL11.GL_INTENSITY; - } - } - - public static int getGLDepthTextureCompareMode(final DepthTextureCompareMode mode) { - switch (mode) { - case RtoTexture: - return ARBShadow.GL_COMPARE_R_TO_TEXTURE_ARB; - case None: - default: - return GL11.GL_NONE; - } - } - - public static int getGLDepthTextureCompareFunc(final DepthTextureCompareFunc func) { - switch (func) { - case GreaterThanEqual: - return GL11.GL_GEQUAL; - case LessThanEqual: - default: - return GL11.GL_LEQUAL; - } - } - - public static int getGLMagFilter(final MagnificationFilter magFilter) { - switch (magFilter) { - case Bilinear: - return GL11.GL_LINEAR; - case NearestNeighbor: - default: - return GL11.GL_NEAREST; - - } - } - - public static int getGLMinFilter(final MinificationFilter filter) { - switch (filter) { - case BilinearNoMipMaps: - return GL11.GL_LINEAR; - case Trilinear: - return GL11.GL_LINEAR_MIPMAP_LINEAR; - case BilinearNearestMipMap: - return GL11.GL_LINEAR_MIPMAP_NEAREST; - case NearestNeighborNoMipMaps: - return GL11.GL_NEAREST; - case NearestNeighborNearestMipMap: - return GL11.GL_NEAREST_MIPMAP_NEAREST; - case NearestNeighborLinearMipMap: - return GL11.GL_NEAREST_MIPMAP_LINEAR; - } - throw new IllegalArgumentException("invalid MinificationFilter type: " + filter); - } - - public static int getGLEnvMode(final ApplyMode apply) { - switch (apply) { - case Replace: - return GL11.GL_REPLACE; - case Blend: - return GL11.GL_BLEND; - case Combine: - return ARBTextureEnvCombine.GL_COMBINE_ARB; - case Decal: - return GL11.GL_DECAL; - case Add: - return GL11.GL_ADD; - case Modulate: - return GL11.GL_MODULATE; - } - throw new IllegalArgumentException("invalid ApplyMode type: " + apply); - } - - public static int getPerspHint(final CorrectionType type) { - switch (type) { - case Perspective: - return GL11.GL_NICEST; - case Affine: - return GL11.GL_FASTEST; - } - throw new IllegalArgumentException("unknown correction type: " + type); - } - - public static int getGLCombineOpRGB(final CombinerOperandRGB operand) { - switch (operand) { - case SourceColor: - return GL11.GL_SRC_COLOR; - case OneMinusSourceColor: - return GL11.GL_ONE_MINUS_SRC_COLOR; - case SourceAlpha: - return GL11.GL_SRC_ALPHA; - case OneMinusSourceAlpha: - return GL11.GL_ONE_MINUS_SRC_ALPHA; - } - throw new IllegalArgumentException("invalid CombinerOperandRGB type: " + operand); - } - - public static int getGLCombineOpAlpha(final CombinerOperandAlpha operand) { - switch (operand) { - case SourceAlpha: - return GL11.GL_SRC_ALPHA; - case OneMinusSourceAlpha: - return GL11.GL_ONE_MINUS_SRC_ALPHA; - } - throw new IllegalArgumentException("invalid CombinerOperandAlpha type: " + operand); - } - - public static int getGLCombineSrc(final CombinerSource combineSrc) { - switch (combineSrc) { - case CurrentTexture: - return GL11.GL_TEXTURE; - case PrimaryColor: - return ARBTextureEnvCombine.GL_PRIMARY_COLOR_ARB; - case Constant: - return ARBTextureEnvCombine.GL_CONSTANT_ARB; - case Previous: - return ARBTextureEnvCombine.GL_PREVIOUS_ARB; - case TextureUnit0: - return ARBMultitexture.GL_TEXTURE0_ARB; - case TextureUnit1: - return ARBMultitexture.GL_TEXTURE1_ARB; - case TextureUnit2: - return ARBMultitexture.GL_TEXTURE2_ARB; - case TextureUnit3: - return ARBMultitexture.GL_TEXTURE3_ARB; - case TextureUnit4: - return ARBMultitexture.GL_TEXTURE4_ARB; - case TextureUnit5: - return ARBMultitexture.GL_TEXTURE5_ARB; - case TextureUnit6: - return ARBMultitexture.GL_TEXTURE6_ARB; - case TextureUnit7: - return ARBMultitexture.GL_TEXTURE7_ARB; - case TextureUnit8: - return ARBMultitexture.GL_TEXTURE8_ARB; - case TextureUnit9: - return ARBMultitexture.GL_TEXTURE9_ARB; - case TextureUnit10: - return ARBMultitexture.GL_TEXTURE10_ARB; - case TextureUnit11: - return ARBMultitexture.GL_TEXTURE11_ARB; - case TextureUnit12: - return ARBMultitexture.GL_TEXTURE12_ARB; - case TextureUnit13: - return ARBMultitexture.GL_TEXTURE13_ARB; - case TextureUnit14: - return ARBMultitexture.GL_TEXTURE14_ARB; - case TextureUnit15: - return ARBMultitexture.GL_TEXTURE15_ARB; - case TextureUnit16: - return ARBMultitexture.GL_TEXTURE16_ARB; - case TextureUnit17: - return ARBMultitexture.GL_TEXTURE17_ARB; - case TextureUnit18: - return ARBMultitexture.GL_TEXTURE18_ARB; - case TextureUnit19: - return ARBMultitexture.GL_TEXTURE19_ARB; - case TextureUnit20: - return ARBMultitexture.GL_TEXTURE20_ARB; - case TextureUnit21: - return ARBMultitexture.GL_TEXTURE21_ARB; - case TextureUnit22: - return ARBMultitexture.GL_TEXTURE22_ARB; - case TextureUnit23: - return ARBMultitexture.GL_TEXTURE23_ARB; - case TextureUnit24: - return ARBMultitexture.GL_TEXTURE24_ARB; - case TextureUnit25: - return ARBMultitexture.GL_TEXTURE25_ARB; - case TextureUnit26: - return ARBMultitexture.GL_TEXTURE26_ARB; - case TextureUnit27: - return ARBMultitexture.GL_TEXTURE27_ARB; - case TextureUnit28: - return ARBMultitexture.GL_TEXTURE28_ARB; - case TextureUnit29: - return ARBMultitexture.GL_TEXTURE29_ARB; - case TextureUnit30: - return ARBMultitexture.GL_TEXTURE30_ARB; - case TextureUnit31: - return ARBMultitexture.GL_TEXTURE31_ARB; - } - throw new IllegalArgumentException("invalid CombinerSource type: " + combineSrc); - } - - public static int getGLCombineFuncAlpha(final CombinerFunctionAlpha combineFunc) { - switch (combineFunc) { - case Modulate: - return GL11.GL_MODULATE; - case Replace: - return GL11.GL_REPLACE; - case Add: - return GL11.GL_ADD; - case AddSigned: - return ARBTextureEnvCombine.GL_ADD_SIGNED_ARB; - case Subtract: - return ARBTextureEnvCombine.GL_SUBTRACT_ARB; - case Interpolate: - return ARBTextureEnvCombine.GL_INTERPOLATE_ARB; - } - throw new IllegalArgumentException("invalid CombinerFunctionAlpha type: " + combineFunc); - } - - public static int getGLCombineFuncRGB(final CombinerFunctionRGB combineFunc) { - switch (combineFunc) { - case Modulate: - return GL11.GL_MODULATE; - case Replace: - return GL11.GL_REPLACE; - case Add: - return GL11.GL_ADD; - case AddSigned: - return ARBTextureEnvCombine.GL_ADD_SIGNED_ARB; - case Subtract: - return ARBTextureEnvCombine.GL_SUBTRACT_ARB; - case Interpolate: - return ARBTextureEnvCombine.GL_INTERPOLATE_ARB; - case Dot3RGB: - return ARBTextureEnvDot3.GL_DOT3_RGB_ARB; - case Dot3RGBA: - return ARBTextureEnvDot3.GL_DOT3_RGBA_ARB; - } - throw new IllegalArgumentException("invalid CombinerFunctionRGB type: " + combineFunc); - } -} diff --git a/ardor3d-lwjgl/src/test/java/com/ardor3d/input/lwjgl/TestKey.java b/ardor3d-lwjgl/src/test/java/com/ardor3d/input/lwjgl/TestKey.java deleted file mode 100644 index abfb8d4..0000000 --- a/ardor3d-lwjgl/src/test/java/com/ardor3d/input/lwjgl/TestKey.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. - * - * This file is part of Ardor3D. - * - * Ardor3D is free software: you can redistribute it and/or modify it - * under the terms of its license which may be found in the accompanying - * LICENSE file or at <http://www.ardor3d.com/LICENSE>. - */ - -package com.ardor3d.input.lwjgl; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import com.ardor3d.input.Key; - -public class TestKey { - @Test - public void testFindByCode1() throws Exception { - final Key a = LwjglKey.findByCode(LwjglKey.A.getLwjglCode()); - - assertEquals("a found", Key.A, a); - } - - @Test - public void testFindByCode2() throws Exception { - final Key unknown = LwjglKey.findByCode(-14); - - assertEquals("unknown found", Key.UNKNOWN, unknown); - } -} diff --git a/ardor3d-math/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-math/.settings/org.eclipse.jdt.ui.prefs index 681065b..8dc21f4 100644 --- a/ardor3d-math/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-math/.settings/org.eclipse.jdt.ui.prefs @@ -84,7 +84,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=true diff --git a/ardor3d-math/build.gradle b/ardor3d-math/build.gradle new file mode 100644 index 0000000..c3bff24 --- /dev/null +++ b/ardor3d-math/build.gradle @@ -0,0 +1,5 @@ + +description = 'Ardor 3D Math' +dependencies { + compile project(':ardor3d-savable') +} diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/ColorRGBA.java b/ardor3d-math/src/main/java/com/ardor3d/math/ColorRGBA.java index a6879cd..37f39f3 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/ColorRGBA.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/ColorRGBA.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyColorRGBA; import com.ardor3d.util.export.InputCapsule; @@ -107,7 +108,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Constructs a new, mutable color set to the (r, g, b, a) values of the provided source color. - * + * * @param src */ public ColorRGBA(final ReadOnlyColorRGBA src) { @@ -116,7 +117,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Constructs a new color set to (r, g, b, a). - * + * * @param r * @param g * @param b @@ -198,7 +199,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Stores the float values of this color in the given float array. - * + * * @param store * if null, a new float[4] array is created. * @return the float array @@ -222,7 +223,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Sets the red component of this color to the given float value. - * + * * @param r * new red value, generally should be in the range [0.0f, 1.0f] */ @@ -232,7 +233,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Sets the green component of this color to the given float value. - * + * * @param g * new green value, generally should be in the range [0.0f, 1.0f] */ @@ -242,7 +243,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Sets the blue component of this color to the given float value. - * + * * @param b * new blue value, generally should be in the range [0.0f, 1.0f] */ @@ -253,7 +254,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Sets the alpha component of this color to the given float value. Consider that an alpha of 1.0f means opaque (can * not see through) and 0.0f means transparent. - * + * * @param a * new alpha value, generally should be in the range [0.0f, 1.0f] */ @@ -263,7 +264,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Sets the value of this color to (r, g, b, a) - * + * * @param r * new red value, generally should be in the range [0.0f, 1.0f] * @param g @@ -284,7 +285,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Sets the value of this color to the (r, g, b, a) values of the provided source color. - * + * * @param source * @return this color for chaining * @throws NullPointerException @@ -300,7 +301,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Sets the value of this color to (0, 0, 0, 0) - * + * * @return this color for chaining */ public ColorRGBA zero() { @@ -310,7 +311,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Brings all values (r,g,b,a) into the range [0.0f, 1.0f]. If a value is above or below this range it is replaced * with the appropriate end of the range. - * + * * @param store * the color to store the result in for return. If null, a new color object is created and returned. */ @@ -353,7 +354,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Brings all values (r,g,b,a) into the range [0.0f, 1.0f]. If a value is above or below this range it is replaced * with the appropriate end of the range. - * + * * @return this color for chaining */ public ColorRGBA clampLocal() { @@ -405,7 +406,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Reads a color, packed into a 4 byte int as 1 byte values in the order ARGB. These byte values are normalized to * the range [0.0f, 1.0f] - * + * * @param color * @return this color for chaining */ @@ -420,7 +421,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Reads a color, packed into a 4 byte int as 1 byte values in the order RGBA. These byte values are normalized to * the range [0.0f, 1.0f] - * + * * @param color * @return this color for chaining */ @@ -463,7 +464,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Adds the given values to those of this color and returns them in store. - * + * * @param r * @param g * @param b @@ -484,7 +485,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Increments the values of this color with the given r, g, b and a values. - * + * * @param r * @param g * @param b @@ -497,7 +498,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Adds the values of the given source color to those of this color and returns them in store. - * + * * @param source * @param store * the color to store the result in for return. If null, a new color object is created and returned. @@ -512,7 +513,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Increments the values of this color with the r, g, b and a values of the given color. - * + * * @param source * @return this color for chaining * @throws NullPointerException @@ -524,7 +525,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Subtracts the given values from those of this color and returns them in store. - * + * * @param r * @param g * @param b @@ -545,7 +546,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Decrements the values of this color by the given r, g, b and a values. - * + * * @param r * @param g * @param b @@ -558,7 +559,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Subtracts the values of the given source color from those of this color and returns them in store. - * + * * @param source * @param store * the color to store the result in for return. If null, a new color object is created and returned. @@ -573,7 +574,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Decrements the values of this color by the r, g, b and a values from the given source color. - * + * * @param source * @return this color for chaining * @throws NullPointerException @@ -585,7 +586,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Multiplies the values of this color by the given scalar value and returns the result in store. - * + * * @param scalar * @param store * the color to store the result in for return. If null, a new color object is created and returned. @@ -603,10 +604,10 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Internally modifies the values of this color by multiplying them each by the given scalar value. - * + * * @param scalar * @return this color for chaining - * + * * . */ public ColorRGBA multiplyLocal(final float scalar) { @@ -615,7 +616,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Multiplies the values of this color by the given scalar value and returns the result in store. - * + * * @param scale * @param store * the color to store the result in for return. If null, a new color object is created and returned. @@ -634,18 +635,18 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Internally modifies the values of this color by multiplying them each by the given scale values. - * + * * @param scale * @return this color for chaining */ public ColorRGBA multiplyLocal(final ReadOnlyColorRGBA scale) { - return set(getRed() * scale.getRed(), getGreen() * scale.getGreen(), getBlue() * scale.getBlue(), getAlpha() - * scale.getAlpha()); + return set(getRed() * scale.getRed(), getGreen() * scale.getGreen(), getBlue() * scale.getBlue(), + getAlpha() * scale.getAlpha()); } /** * Divides the values of this color by the given scalar value and returns the result in store. - * + * * @param scalar * @param store * the color to store the result in for return. If null, a new color object is created and returned. @@ -663,7 +664,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Internally modifies the values of this color by dividing them each by the given scalar value. - * + * * @param scalar * @return this color for chaining * @throws ArithmeticException @@ -677,7 +678,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Divides the values of this color by the given scale values and returns the result in store. - * + * * @param scale * @param store * the color to store the result in for return. If null, a new color object is created and returned. @@ -696,20 +697,20 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Internally modifies the values of this color by dividing them each by the given scale values. - * + * * @param scale * @return this color for chaining */ public ColorRGBA divideLocal(final ReadOnlyColorRGBA scale) { - return set(getRed() / scale.getRed(), getGreen() / scale.getGreen(), getBlue() / scale.getBlue(), getAlpha() - / scale.getAlpha()); + return set(getRed() / scale.getRed(), getGreen() / scale.getGreen(), getBlue() / scale.getBlue(), + getAlpha() / scale.getAlpha()); } /** * Performs a linear interpolation between this color and the given end color, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the current value of this color and if it is * closer to 1, the result will be closer to the end value. - * + * * @param endColor * @param scalar * @param store @@ -736,7 +737,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo * Performs a linear interpolation between this color and the given end color, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the current value of this color and if it is * closer to 1, the result will be closer to the end value. The result is stored back in this color. - * + * * @param endColor * @param scalar * @return this color for chaining @@ -755,7 +756,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo * Performs a linear interpolation between the given begin and end colors, using the given scalar as a percent. iow, * if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the result * will be closer to the end value. - * + * * @param beginColor * @param endColor * @param scalar @@ -784,7 +785,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo * Performs a linear interpolation between the given begin and end colors, using the given scalar as a percent. iow, * if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the result * will be closer to the end value. The result is stored back in this color. - * + * * @param beginColor * @param endColor * @param changeAmnt @@ -793,7 +794,8 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo * @throws NullPointerException * if beginVec or endVec are null. */ - public ColorRGBA lerpLocal(final ReadOnlyColorRGBA beginColor, final ReadOnlyColorRGBA endColor, final float scalar) { + public ColorRGBA lerpLocal(final ReadOnlyColorRGBA beginColor, final ReadOnlyColorRGBA endColor, + final float scalar) { setRed((1.0f - scalar) * beginColor.getRed() + scalar * endColor.getRed()); setGreen((1.0f - scalar) * beginColor.getGreen() + scalar * endColor.getGreen()); setBlue((1.0f - scalar) * beginColor.getBlue() + scalar * endColor.getBlue()); @@ -803,7 +805,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Check a color... if it is null or its values are NaN or infinite, return false. Else return true. - * + * * @param color * the color to check * @return true or false as stated above. @@ -838,21 +840,8 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo */ @Override public int hashCode() { - int result = 17; - - final int r = Float.floatToIntBits(getRed()); - result += 31 * result + r; - - final int g = Float.floatToIntBits(getGreen()); - result += 31 * result + g; - - final int b = Float.floatToIntBits(getBlue()); - result += 31 * result + b; - - final int a = Float.floatToIntBits(getAlpha()); - result += 31 * result + a; - - return result; + return Objects.hash(Float.valueOf(getRed()), Float.valueOf(getGreen()), Float.valueOf(getBlue()), + Float.valueOf(getAlpha())); } /** @@ -913,7 +902,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -929,7 +918,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -961,7 +950,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo /** * Releases a ColorRGBA back to be used by a future call to fetchTempInstance. TAKE CARE: this ColorRGBA object * should no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param color * the ColorRGBA to release. */ @@ -983,7 +972,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo * <li>6: RRGGBB - RGB is parsed as RR/255, GG/255, BB/255, A=1</li> * <li>8: RRGGBBAA - RGBA is parsed as RR/255, GG/255, BB/255, AA/255</li> * </ul> - * + * * @param colorString * @param store * @return @@ -1030,8 +1019,8 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo b = Integer.parseInt(colorString.substring(5, 7), 16) / 255f; a = Integer.parseInt(colorString.substring(7, 9), 16) / 255f; } else { - throw new IllegalArgumentException("unsupported value, must be 1, 2, 3, 4, 5, 7 or 9 hexvalues: " - + colorString); + throw new IllegalArgumentException( + "unsupported value, must be 1, 2, 3, 4, 5, 7 or 9 hexvalues: " + colorString); } rVal.set(r, g, b, a); diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/FastMath.java b/ardor3d-math/src/main/java/com/ardor3d/math/FastMath.java index 0b45885..9e02e16 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/FastMath.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/FastMath.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Line3.java b/ardor3d-math/src/main/java/com/ardor3d/math/Line3.java index 453f48a..7d05103 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Line3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Line3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -69,6 +69,7 @@ public class Line3 extends Line3Base implements ReadOnlyLine3, Poolable { * @throws NullPointerException * if the point is null. */ + @Override public double distanceSquared(final ReadOnlyVector3 point, final Vector3 store) { final Vector3 vectorA = Vector3.fetchTempInstance(); vectorA.set(point).subtractLocal(_origin); diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Line3Base.java b/ardor3d-math/src/main/java/com/ardor3d/math/Line3Base.java index 6b6e5f7..9b9e6d5 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Line3Base.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Line3Base.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyVector3; import com.ardor3d.util.export.InputCapsule; @@ -46,7 +47,7 @@ public abstract class Line3Base implements Savable, Externalizable { /** * Sets the line's origin point to the values of the given vector. - * + * * @param origin * @throws NullPointerException * if normal is null. @@ -57,7 +58,7 @@ public abstract class Line3Base implements Savable, Externalizable { /** * Sets the line's direction to the values of the given vector. - * + * * @param direction * @throws NullPointerException * if direction is null. @@ -72,27 +73,25 @@ public abstract class Line3Base implements Savable, Externalizable { */ @Override public int hashCode() { - int result = 17; - - result += 31 * result + _origin.hashCode(); - result += 31 * result + _direction.hashCode(); - - return result; + return Objects.hash(getOrigin(), getDirection()); } // ///////////////// // Methods for Savable // ///////////////// + @Override public Class<? extends Line3Base> getClassTag() { return this.getClass(); } + @Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(_origin, "origin", new Vector3(Vector3.ZERO)); capsule.write(_direction, "direction", new Vector3(Vector3.UNIT_Z)); } + @Override public void read(final InputCapsule capsule) throws IOException { _origin.set((Vector3) capsule.readSavable("origin", new Vector3(Vector3.ZERO))); _direction.set((Vector3) capsule.readSavable("direction", new Vector3(Vector3.UNIT_Z))); @@ -104,12 +103,13 @@ public abstract class Line3Base implements Savable, Externalizable { /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException * @throws ClassNotFoundException */ + @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { setOrigin((Vector3) in.readObject()); setDirection((Vector3) in.readObject()); @@ -117,11 +117,12 @@ public abstract class Line3Base implements Savable, Externalizable { /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException */ + @Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeObject(_origin); out.writeObject(_direction); diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/LineSegment3.java b/ardor3d-math/src/main/java/com/ardor3d/math/LineSegment3.java index aa62875..30290b3 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/LineSegment3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/LineSegment3.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -13,6 +13,7 @@ package com.ardor3d.math; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyLineSegment3; import com.ardor3d.math.type.ReadOnlyVector3; @@ -42,7 +43,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo /** * Copy constructor. - * + * * @param source * the line segment to copy from. */ @@ -52,7 +53,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo /** * Constructs a new segment segment using the supplied origin point, unit length direction vector and extent - * + * * @param origin * @param direction * - unit length @@ -65,7 +66,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo /** * Constructs a new segment segment using the supplied start and end points - * + * * @param start * @param end */ @@ -79,7 +80,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo /** * Copies the values of the given source segment into this segment. - * + * * @param source * @return this segment for chaining * @throws NullPointerException @@ -101,7 +102,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo /** * Sets the segment's extent to the provided value. - * + * * @param extent */ public void setExtent(final double extent) { @@ -170,7 +171,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo } /** - * + * * @param position * a random position lying somewhere on this line segment. */ @@ -191,7 +192,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo /** * Check a segment... if it is null or the values of its origin or direction or extent are NaN or infinite, return * false. Else return true. - * + * * @param segment * the segment to check * @return true or false as stated above. @@ -237,14 +238,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo */ @Override public int hashCode() { - int result = 17; - - result += 31 * result + _origin.hashCode(); - result += 31 * result + _direction.hashCode(); - final long ex = Double.doubleToLongBits(_extent); - result += 31 * result + (int) (ex ^ ex >>> 32); - - return result; + return Objects.hash(getOrigin(), getDirection(), Double.valueOf(getExtent())); } // ///////////////// @@ -278,7 +272,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -292,7 +286,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -322,7 +316,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo /** * Releases a LineSegment3 back to be used by a future call to fetchTempInstance. TAKE CARE: this LineSegment3 * object should no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param segment * the LineSegment3 to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/MathConstants.java b/ardor3d-math/src/main/java/com/ardor3d/math/MathConstants.java index fc2d95f..ff7e302 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/MathConstants.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/MathConstants.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/MathUtils.java b/ardor3d-math/src/main/java/com/ardor3d/math/MathUtils.java index 02a745f..4f55718 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/MathUtils.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/MathUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Matrix3.java b/ardor3d-math/src/main/java/com/ardor3d/math/Matrix3.java index 78a9b16..1ae320b 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Matrix3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Matrix3.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -17,6 +17,7 @@ import java.io.ObjectOutput; import java.nio.BufferOverflowException; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyMatrix3; import com.ardor3d.math.type.ReadOnlyQuaternion; @@ -27,7 +28,7 @@ import com.ardor3d.util.export.Savable; /** * Matrix3 represents a double precision 3x3 matrix. - * + * * Note: some algorithms in this class were ported from Eberly, Wolfram, Game Gems and others to Java. */ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatrix3, Poolable { @@ -61,7 +62,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Constructs a new, mutable matrix using the given matrix values (names are mRC = m[ROW][COL]) - * + * * @param m00 * @param m01 * @param m02 @@ -88,7 +89,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Constructs a new, mutable matrix using the values from the given matrix - * + * * @param source */ public Matrix3(final ReadOnlyMatrix3 source) { @@ -235,7 +236,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Same as set(IDENTITY) - * + * * @return this matrix for chaining */ public Matrix3 setIdentity() { @@ -252,7 +253,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the value of this matrix at row, column to the given value. - * + * * @param row * @param column * @param value @@ -319,7 +320,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the values given. - * + * * @param m00 * @param m01 * @param m02 @@ -349,7 +350,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the values of the provided source matrix. - * + * * @param source * @return this matrix for chaining * @throws NullPointerException @@ -373,7 +374,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the rotational value of the given quaternion. - * + * * @param quaternion * @return this matrix for chaining */ @@ -425,7 +426,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Note: data is cast to floats. - * + * * @param store * the buffer to read our matrix data from. * @return this matrix for chaining. @@ -436,7 +437,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Note: data is cast to floats. - * + * * @param store * the buffer to read our matrix data from. * @param rowMajor @@ -471,7 +472,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the values of the provided double array. - * + * * @param source * @return this matrix for chaining * @throws NullPointerException @@ -485,7 +486,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the values of the provided double array. - * + * * @param source * @param rowMajor * @return this matrix for chaining @@ -521,7 +522,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Replaces a column in this matrix with the values of the given vector. - * + * * @param columnIndex * @param columnData * @return this matrix for chaining @@ -555,7 +556,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Replaces a row in this matrix with the values of the given vector. - * + * * @param rowIndex * @param rowData * @return this matrix for chaining @@ -589,7 +590,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Set the values of this matrix from the axes (columns) provided. - * + * * @param uAxis * @param vAxis * @param wAxis @@ -607,7 +608,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets this matrix to the rotation indicated by the given angle and axis of rotation. Note: This method creates an * object, so use fromAngleNormalAxis when possible, particularly if your axis is already normalized. - * + * * @param angle * the angle to rotate (in radians). * @param axis @@ -626,7 +627,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets this matrix to the rotation indicated by the given angle and a unit-length axis of rotation. - * + * * @param angle * the angle to rotate (in radians). * @param axis @@ -665,11 +666,11 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * XXX: Need to redo this again... or at least correct the terms. YRP are arbitrary terms, based on a specific frame * of axis. - * + * * Updates this matrix from the given Euler rotation angles (y,r,p). Note that we are applying in order: roll, * pitch, yaw but we've ordered them in x, y, and z for convenience. See: * http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToMatrix/index.htm - * + * * @param yaw * the Euler yaw of rotation (in radians). (aka Bank, often rot around x) * @param roll @@ -700,8 +701,8 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr public Matrix3 applyRotation(final double angle, final double x, final double y, final double z) { final double m00 = _m00, m01 = _m01, m02 = _m02, // - m10 = _m10, m11 = _m11, m12 = _m12, // - m20 = _m20, m21 = _m21, m22 = _m22; + m10 = _m10, m11 = _m11, m12 = _m12, // + m20 = _m20, m21 = _m21, m22 = _m22; final double cosAngle = Math.cos(angle); final double sinAngle = Math.sin(angle); @@ -740,14 +741,14 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Apply rotation around X (Mrx * this) - * + * * @param angle * @return */ public Matrix3 applyRotationX(final double angle) { final double m01 = _m01, m02 = _m02, // - m11 = _m11, m12 = _m12, // - m21 = _m21, m22 = _m22; + m11 = _m11, m12 = _m12, // + m21 = _m21, m22 = _m22; final double cosAngle = Math.cos(angle); final double sinAngle = Math.sin(angle); @@ -766,14 +767,14 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Apply rotation around Y (Mry * this) - * + * * @param angle * @return */ public Matrix3 applyRotationY(final double angle) { final double m00 = _m00, m02 = _m02, // - m10 = _m10, m12 = _m12, // - m20 = _m20, m22 = _m22; + m10 = _m10, m12 = _m12, // + m20 = _m20, m22 = _m22; final double cosAngle = Math.cos(angle); final double sinAngle = Math.sin(angle); @@ -792,14 +793,14 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Apply rotation around Z (Mrz * this) - * + * * @param angle * @return */ public Matrix3 applyRotationZ(final double angle) { final double m00 = _m00, m01 = _m01, // - m10 = _m10, m11 = _m11, // - m20 = _m20, m21 = _m21; + m10 = _m10, m11 = _m11, // + m20 = _m20, m21 = _m21; final double cosAngle = Math.cos(angle); final double sinAngle = Math.sin(angle); @@ -946,7 +947,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Note: data is cast to floats. - * + * * @param store * the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer * position. @@ -963,7 +964,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Note: data is cast to floats. - * + * * @param store * the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer * position. @@ -1060,7 +1061,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * converts this matrix to Euler rotation angles (yaw, roll, pitch). See * http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/index.htm - * + * * @param store * the double[] array to store the computed angles in. If null, a new double[] will be created * @return the double[] array. @@ -1141,7 +1142,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies this matrix by the diagonal matrix formed by the given vector (v^D * M). If supplied, the result is * stored into the supplied "store" matrix. - * + * * @param vec * @param store * a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for @@ -1168,7 +1169,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies this matrix by the diagonal matrix formed by the given vector (M * v^D). If supplied, the result is * stored into the supplied "store" matrix. - * + * * @param vec * @param store * a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for @@ -1194,7 +1195,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Internally scales all values of this matrix by the given scalar. - * + * * @param scalar * @return this matrix for chaining. */ @@ -1243,7 +1244,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Internally adds the values of the given matrix to this matrix. - * + * * @param matrix * the matrix to add to this. * @return this matrix for chaining @@ -1286,7 +1287,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Internally subtracts the values of the given matrix from this matrix. - * + * * @param matrix * the matrix to subtract from this. * @return this matrix for chaining @@ -1299,7 +1300,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Applies the given scale to this matrix and returns the result as a new matrix - * + * * @param scale * @param store * a matrix to store the result in. If store is null, a new matrix is created. @@ -1322,7 +1323,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Applies the given scale to this matrix values internally - * + * * @param scale * @return this matrix for chaining. * @throws NullPointerException @@ -1334,7 +1335,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * transposes this matrix as a new matrix, basically flipping it across the diagonal - * + * * @param store * a matrix to store the result in. If store is null, a new matrix is created. * @return this matrix for chaining. @@ -1361,7 +1362,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * transposes this matrix in place - * + * * @return this matrix for chaining. * @see <a href="http://en.wikipedia.org/wiki/Transpose">wikipedia.org-Transpose</a> */ @@ -1383,7 +1384,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr * a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for * store == this. * @return a matrix that represents this matrix, inverted. - * + * * if store is not null and is read only * @throws ArithmeticException * if this matrix can not be inverted. @@ -1416,7 +1417,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Inverts this matrix locally. - * + * * @return this matrix inverted internally. * @throws ArithmeticException * if this matrix can not be inverted. @@ -1471,7 +1472,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * A function for creating a rotation matrix that rotates a vector called "start" into another vector called "end". - * + * * @param start * normalized non-zero starting vector * @param end @@ -1554,7 +1555,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies the given vector by this matrix (v * M). If supplied, the result is stored into the supplied "store" * vector. - * + * * @param vec * the vector to multiply this matrix by. * @param store @@ -1584,7 +1585,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies the given vector by this matrix (M * v). If supplied, the result is stored into the supplied "store" * vector. - * + * * @param vec * the vector to multiply this matrix by. * @param store @@ -1613,7 +1614,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Modifies this matrix to equal the rotation required to point the z-axis at 'direction' and the y-axis to 'up'. - * + * * @param direction * where to 'look' at * @param up @@ -1638,7 +1639,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Check a matrix... if it is null or its doubles are NaN or infinite, return false. Else return true. - * + * * @param matrix * the vector to check * @return true or false as stated above. @@ -1704,7 +1705,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr */ @Override public String toString() { - final StringBuffer result = new StringBuffer("com.ardor3d.math.Matrix3\n[\n"); + final StringBuilder result = new StringBuilder("com.ardor3d.math.Matrix3\n[\n"); result.append(' '); result.append(_m00); result.append(' '); @@ -1739,30 +1740,9 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr */ @Override public int hashCode() { - int result = 17; - - long val = Double.doubleToLongBits(_m00); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m01); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m02); - result += 31 * result + (int) (val ^ val >>> 32); - - val = Double.doubleToLongBits(_m10); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m11); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m12); - result += 31 * result + (int) (val ^ val >>> 32); - - val = Double.doubleToLongBits(_m20); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m21); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m22); - result += 31 * result + (int) (val ^ val >>> 32); - - return result; + return Objects.hash(Double.valueOf(getM00()), Double.valueOf(getM01()), Double.valueOf(getM02()), + Double.valueOf(getM10()), Double.valueOf(getM11()), Double.valueOf(getM12()), Double.valueOf(getM20()), + Double.valueOf(getM21()), Double.valueOf(getM22())); } /** @@ -1889,7 +1869,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -1910,7 +1890,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -1947,7 +1927,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Releases a Matrix3 back to be used by a future call to fetchTempInstance. TAKE CARE: this Matrix3 object should * no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param mat * the Matrix3 to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Matrix4.java b/ardor3d-math/src/main/java/com/ardor3d/math/Matrix4.java index 8d21433..2bac484 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Matrix4.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Matrix4.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -17,6 +17,7 @@ import java.io.ObjectOutput; import java.nio.BufferOverflowException; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyMatrix3; import com.ardor3d.math.type.ReadOnlyMatrix4; @@ -30,7 +31,7 @@ import com.ardor3d.util.export.Savable; /** * Matrix4 represents a double precision 4x4 matrix and contains a flag, set at object creation, indicating if the given * Matrix4 object is mutable. - * + * * Note: some algorithms in this class were ported from Eberly, Wolfram, Game Gems and others to Java. */ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatrix4, Poolable { @@ -65,7 +66,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Constructs a new matrix set to the given matrix values. (names are mRC = m[ROW][COL]) - * + * * @param m00 * @param m01 * @param m02 @@ -107,7 +108,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Constructs a new matrix set to the values of the given matrix. - * + * * @param source */ public Matrix4(final ReadOnlyMatrix4 source) { @@ -336,7 +337,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Same as set(IDENTITY) - * + * * @return this matrix for chaining */ public Matrix4 setIdentity() { @@ -353,7 +354,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the value of this matrix at row, column to the given value. - * + * * @param row * @param column * @param value @@ -448,7 +449,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the values given. - * + * * @param m00 * @param m01 * @param m02 @@ -493,7 +494,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the values of the provided source matrix. - * + * * @param source * @return this matrix for chaining * @throws NullPointerException @@ -525,7 +526,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the 3x3 rotation part of this matrix to the values of the provided source matrix. - * + * * @param source * @return this matrix for chaining * @throws NullPointerException @@ -547,7 +548,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the rotational value of the given quaternion. Only modifies the 3x3 rotation * part of this matrix. - * + * * @param quaternion * @return this matrix for chaining */ @@ -613,7 +614,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Note: data is cast to floats. - * + * * @param store * the buffer to read our matrix data from. * @return this matrix for chaining. @@ -624,7 +625,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Note: data is cast to floats. - * + * * @param store * the buffer to read our matrix data from. * @param rowMajor @@ -673,7 +674,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the values of the provided double array. - * + * * @param source * @return this matrix for chaining * @throws NullPointerException @@ -687,7 +688,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the values of this matrix to the values of the provided double array. - * + * * @param source * @param rowMajor * @return this matrix for chaining @@ -737,7 +738,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Replaces a column in this matrix with the values of the given array. - * + * * @param columnIndex * @param columnData * @return this matrix for chaining @@ -782,7 +783,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Replaces a row in this matrix with the values of the given array. - * + * * @param rowIndex * @param rowData * @return this matrix for chaining @@ -829,7 +830,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr * Sets the 3x3 rotation portion of this matrix to the rotation indicated by the given angle and axis of rotation. * Note: This method creates an object, so use fromAngleNormalAxis when possible, particularly if your axis is * already normalized. - * + * * @param angle * the angle to rotate (in radians). * @param axis @@ -849,7 +850,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Sets the 3x3 rotation portion of this matrix to the rotation indicated by the given angle and a unit-length axis * of rotation. - * + * * @param angle * the angle to rotate (in radians). * @param axis @@ -887,9 +888,9 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr public Matrix4 applyRotation(final double angle, final double x, final double y, final double z) { final double m00 = _m00, m01 = _m01, m02 = _m02, // - m10 = _m10, m11 = _m11, m12 = _m12, // - m20 = _m20, m21 = _m21, m22 = _m22, // - m30 = _m30, m31 = _m31, m32 = _m32; + m10 = _m10, m11 = _m11, m12 = _m12, // + m20 = _m20, m21 = _m21, m22 = _m22, // + m30 = _m30, m31 = _m31, m32 = _m32; final double cosAngle = Math.cos(angle); final double sinAngle = Math.sin(angle); @@ -936,9 +937,9 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr public Matrix4 applyRotationX(final double angle) { final double m01 = _m01, m02 = _m02, // - m11 = _m11, m12 = _m12, // - m21 = _m21, m22 = _m22, // - m31 = _m31, m32 = _m32; + m11 = _m11, m12 = _m12, // + m21 = _m21, m22 = _m22, // + m31 = _m31, m32 = _m32; final double cosAngle = Math.cos(angle); final double sinAngle = Math.sin(angle); @@ -960,9 +961,9 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr public Matrix4 applyRotationY(final double angle) { final double m00 = _m00, m02 = _m02, // - m10 = _m10, m12 = _m12, // - m20 = _m20, m22 = _m22, // - m30 = _m30, m32 = _m32; + m10 = _m10, m12 = _m12, // + m20 = _m20, m22 = _m22, // + m30 = _m30, m32 = _m32; final double cosAngle = Math.cos(angle); final double sinAngle = Math.sin(angle); @@ -984,9 +985,9 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr public Matrix4 applyRotationZ(final double angle) { final double m00 = _m00, m01 = _m01, // - m10 = _m10, m11 = _m11, // - m20 = _m20, m21 = _m21, // - m30 = _m30, m31 = _m31; + m10 = _m10, m11 = _m11, // + m20 = _m20, m21 = _m21, // + m30 = _m30, m31 = _m31; final double cosAngle = Math.cos(angle); final double sinAngle = Math.sin(angle); @@ -1008,7 +1009,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * M*T - * + * * @param x * @param y * @param z @@ -1025,7 +1026,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * T*M - * + * * @param x * @param y * @param z @@ -1200,7 +1201,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Note: data is cast to floats. - * + * * @param store * the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer * @return matrix data as a FloatBuffer in row major order. The position is at the end of the inserted data. @@ -1216,7 +1217,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Note: data is cast to floats. - * + * * @param store * the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer * @param rowMajor @@ -1340,7 +1341,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies this matrix by the diagonal matrix formed by the given vector (v^D * M). If supplied, the result is * stored into the supplied "store" matrix. - * + * * @param vec * @param store * a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for @@ -1368,7 +1369,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies this matrix by the diagonal matrix formed by the given vector (M * v^D). If supplied, the result is * stored into the supplied "store" matrix. - * + * * @param vec * @param store * a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for @@ -1419,41 +1420,41 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr result = new Matrix4(); } - final double temp00 = _m00 * matrix.getM00() + _m01 * matrix.getM10() + _m02 * matrix.getM20() + _m03 - * matrix.getM30(); - final double temp01 = _m00 * matrix.getM01() + _m01 * matrix.getM11() + _m02 * matrix.getM21() + _m03 - * matrix.getM31(); - final double temp02 = _m00 * matrix.getM02() + _m01 * matrix.getM12() + _m02 * matrix.getM22() + _m03 - * matrix.getM32(); - final double temp03 = _m00 * matrix.getM03() + _m01 * matrix.getM13() + _m02 * matrix.getM23() + _m03 - * matrix.getM33(); - - final double temp10 = _m10 * matrix.getM00() + _m11 * matrix.getM10() + _m12 * matrix.getM20() + _m13 - * matrix.getM30(); - final double temp11 = _m10 * matrix.getM01() + _m11 * matrix.getM11() + _m12 * matrix.getM21() + _m13 - * matrix.getM31(); - final double temp12 = _m10 * matrix.getM02() + _m11 * matrix.getM12() + _m12 * matrix.getM22() + _m13 - * matrix.getM32(); - final double temp13 = _m10 * matrix.getM03() + _m11 * matrix.getM13() + _m12 * matrix.getM23() + _m13 - * matrix.getM33(); - - final double temp20 = _m20 * matrix.getM00() + _m21 * matrix.getM10() + _m22 * matrix.getM20() + _m23 - * matrix.getM30(); - final double temp21 = _m20 * matrix.getM01() + _m21 * matrix.getM11() + _m22 * matrix.getM21() + _m23 - * matrix.getM31(); - final double temp22 = _m20 * matrix.getM02() + _m21 * matrix.getM12() + _m22 * matrix.getM22() + _m23 - * matrix.getM32(); - final double temp23 = _m20 * matrix.getM03() + _m21 * matrix.getM13() + _m22 * matrix.getM23() + _m23 - * matrix.getM33(); - - final double temp30 = _m30 * matrix.getM00() + _m31 * matrix.getM10() + _m32 * matrix.getM20() + _m33 - * matrix.getM30(); - final double temp31 = _m30 * matrix.getM01() + _m31 * matrix.getM11() + _m32 * matrix.getM21() + _m33 - * matrix.getM31(); - final double temp32 = _m30 * matrix.getM02() + _m31 * matrix.getM12() + _m32 * matrix.getM22() + _m33 - * matrix.getM32(); - final double temp33 = _m30 * matrix.getM03() + _m31 * matrix.getM13() + _m32 * matrix.getM23() + _m33 - * matrix.getM33(); + final double temp00 = _m00 * matrix.getM00() + _m01 * matrix.getM10() + _m02 * matrix.getM20() + + _m03 * matrix.getM30(); + final double temp01 = _m00 * matrix.getM01() + _m01 * matrix.getM11() + _m02 * matrix.getM21() + + _m03 * matrix.getM31(); + final double temp02 = _m00 * matrix.getM02() + _m01 * matrix.getM12() + _m02 * matrix.getM22() + + _m03 * matrix.getM32(); + final double temp03 = _m00 * matrix.getM03() + _m01 * matrix.getM13() + _m02 * matrix.getM23() + + _m03 * matrix.getM33(); + + final double temp10 = _m10 * matrix.getM00() + _m11 * matrix.getM10() + _m12 * matrix.getM20() + + _m13 * matrix.getM30(); + final double temp11 = _m10 * matrix.getM01() + _m11 * matrix.getM11() + _m12 * matrix.getM21() + + _m13 * matrix.getM31(); + final double temp12 = _m10 * matrix.getM02() + _m11 * matrix.getM12() + _m12 * matrix.getM22() + + _m13 * matrix.getM32(); + final double temp13 = _m10 * matrix.getM03() + _m11 * matrix.getM13() + _m12 * matrix.getM23() + + _m13 * matrix.getM33(); + + final double temp20 = _m20 * matrix.getM00() + _m21 * matrix.getM10() + _m22 * matrix.getM20() + + _m23 * matrix.getM30(); + final double temp21 = _m20 * matrix.getM01() + _m21 * matrix.getM11() + _m22 * matrix.getM21() + + _m23 * matrix.getM31(); + final double temp22 = _m20 * matrix.getM02() + _m21 * matrix.getM12() + _m22 * matrix.getM22() + + _m23 * matrix.getM32(); + final double temp23 = _m20 * matrix.getM03() + _m21 * matrix.getM13() + _m22 * matrix.getM23() + + _m23 * matrix.getM33(); + + final double temp30 = _m30 * matrix.getM00() + _m31 * matrix.getM10() + _m32 * matrix.getM20() + + _m33 * matrix.getM30(); + final double temp31 = _m30 * matrix.getM01() + _m31 * matrix.getM11() + _m32 * matrix.getM21() + + _m33 * matrix.getM31(); + final double temp32 = _m30 * matrix.getM02() + _m31 * matrix.getM12() + _m32 * matrix.getM22() + + _m33 * matrix.getM32(); + final double temp33 = _m30 * matrix.getM03() + _m31 * matrix.getM13() + _m32 * matrix.getM23() + + _m33 * matrix.getM33(); result._m00 = temp00; result._m01 = temp01; @@ -1477,7 +1478,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Internally scales all values of this matrix by the given scalar. - * + * * @param scalar * @return this matrix for chaining. */ @@ -1541,7 +1542,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Internally adds the values of the given matrix to this matrix. - * + * * @param matrix * the matrix to add to this. * @return this matrix for chaining @@ -1591,7 +1592,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Internally subtracts the values of the given matrix from this matrix. - * + * * @param matrix * the matrix to subtract from this. * @return this matrix for chaining @@ -1604,7 +1605,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Applies the given scale to this matrix and returns the result as a new matrix - * + * * @param scale * @param store * a matrix to store the result in. If store is null, a new matrix is created. @@ -1628,7 +1629,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Applies the given scale to this matrix values internally - * + * * @param scale * @return this matrix for chaining. * @throws NullPointerException @@ -1640,7 +1641,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * transposes this matrix as a new matrix, basically flipping it across the diagonal - * + * * @param store * a matrix to store the result in. If store is null, a new matrix is created. It is NOT safe for store * to == this. @@ -1676,7 +1677,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * transposes this matrix in place - * + * * @return this matrix for chaining. * @see <a href="http://en.wikipedia.org/wiki/Transpose">wikipedia.org-Transpose</a> */ @@ -1761,7 +1762,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * inverts this matrix locally. - * + * * @return this matrix inverted internally. * @throws ArithmeticException * if this matrix can not be inverted. @@ -1846,7 +1847,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies the given vector by this matrix (v * M). If supplied, the result is stored into the supplied "store" * vector. - * + * * @param vector * the vector to multiply this matrix by. * @param store @@ -1878,7 +1879,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies the given vector by this matrix (M * v). If supplied, the result is stored into the supplied "store" * vector. - * + * * @param vector * the vector to multiply this matrix by. * @param store @@ -1910,7 +1911,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies the given point by this matrix (M * p). If supplied, the result is stored into the supplied "store" * vector. - * + * * @param point * the point to multiply against this matrix. * @param store @@ -1940,7 +1941,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Multiplies the given vector by this matrix (M * v). If supplied, the result is stored into the supplied "store" * vector. - * + * * @param vector * the vector to multiply this matrix by. * @param store @@ -1969,7 +1970,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Check a matrix... if it is null or its doubles are NaN or infinite, return false. Else return true. - * + * * @param matrix * the vector to check * @return true or false as stated above. @@ -2098,7 +2099,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr */ @Override public String toString() { - final StringBuffer result = new StringBuffer("com.ardor3d.math.Matrix4\n[\n"); + final StringBuilder result = new StringBuilder("com.ardor3d.math.Matrix4\n[\n"); result.append(' '); result.append(_m00); result.append(' '); @@ -2149,45 +2150,11 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr */ @Override public int hashCode() { - int result = 17; - - long val = Double.doubleToLongBits(_m00); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m01); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m02); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m03); - result += 31 * result + (int) (val ^ val >>> 32); - - val = Double.doubleToLongBits(_m10); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m11); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m12); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m13); - result += 31 * result + (int) (val ^ val >>> 32); - - val = Double.doubleToLongBits(_m20); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m21); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m22); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m23); - result += 31 * result + (int) (val ^ val >>> 32); - - val = Double.doubleToLongBits(_m30); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m31); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m32); - result += 31 * result + (int) (val ^ val >>> 32); - val = Double.doubleToLongBits(_m33); - result += 31 * result + (int) (val ^ val >>> 32); - - return result; + return Objects.hash(Double.valueOf(getM00()), Double.valueOf(getM01()), Double.valueOf(getM02()), + Double.valueOf(getM03()), Double.valueOf(getM10()), Double.valueOf(getM11()), Double.valueOf(getM12()), + Double.valueOf(getM13()), Double.valueOf(getM20()), Double.valueOf(getM21()), Double.valueOf(getM22()), + Double.valueOf(getM23()), Double.valueOf(getM30()), Double.valueOf(getM31()), Double.valueOf(getM32()), + Double.valueOf(getM33())); } /** @@ -2356,7 +2323,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -2384,7 +2351,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -2428,7 +2395,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr /** * Releases a Matrix4 back to be used by a future call to fetchTempInstance. TAKE CARE: this Matrix4 object should * no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param mat * the Matrix4 to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/ObjectPool.java b/ardor3d-math/src/main/java/com/ardor3d/math/ObjectPool.java index 2c2110b..53fcf1c 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/ObjectPool.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/ObjectPool.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -24,7 +24,7 @@ public abstract class ObjectPool<T extends Poolable> { private final ThreadLocal<List<T>> _pool = new ThreadLocal<List<T>>() { @Override protected List<T> initialValue() { - return new ArrayList<T>(_maxSize); + return new ArrayList<>(_maxSize); } }; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Plane.java b/ardor3d-math/src/main/java/com/ardor3d/math/Plane.java index 7567310..85d3d31 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Plane.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Plane.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyPlane; import com.ardor3d.math.type.ReadOnlyVector3; @@ -48,7 +49,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Copy constructor. - * + * * @param source * the plane to copy from. */ @@ -58,7 +59,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Constructs a new plane using the supplied normal vector and plane constant - * + * * @param normal * @param constant */ @@ -73,7 +74,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, } /** - * + * * @return normal as a readable vector */ @Override @@ -83,7 +84,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Sets the value of this plane to the constant and normal values of the provided source plane. - * + * * @param source * @return this plane for chaining * @throws NullPointerException @@ -97,7 +98,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Sets the constant value of this plane to the given double value. - * + * * @param constant */ public void setConstant(final double constant) { @@ -106,7 +107,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Sets the plane normal to the values of the given vector. - * + * * @param normal * @throws NullPointerException * if normal is null. @@ -148,7 +149,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Sets this plane to the plane defined by the given three points. - * + * * @param pointA * @param pointB * @param pointC @@ -156,7 +157,8 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, * @throws NullPointerException * if one or more of the points are null. */ - public Plane setPlanePoints(final ReadOnlyVector3 pointA, final ReadOnlyVector3 pointB, final ReadOnlyVector3 pointC) { + public Plane setPlanePoints(final ReadOnlyVector3 pointA, final ReadOnlyVector3 pointB, + final ReadOnlyVector3 pointC) { _normal.set(pointB).subtractLocal(pointA); _normal.crossLocal(pointC.getX() - pointA.getX(), pointC.getY() - pointA.getY(), pointC.getZ() - pointA.getZ()) .normalizeLocal(); @@ -166,7 +168,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Reflects an incoming vector across the normal of this Plane. - * + * * @param unitVector * the incoming vector. Must be a unit vector. * @param store @@ -189,7 +191,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Check a plane... if it is null or its constant, or the doubles of its normal are NaN or infinite, return false. * Else return true. - * + * * @param plane * the plane to check * @return true or false as stated above. @@ -219,14 +221,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, */ @Override public int hashCode() { - int result = 17; - - result += 31 * result + _normal.hashCode(); - - final long c = Double.doubleToLongBits(getConstant()); - result += 31 * result + (int) (c ^ c >>> 32); - - return result; + return Objects.hash(getNormal(), Double.valueOf(getConstant())); } /** @@ -282,7 +277,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -296,7 +291,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -326,7 +321,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane, /** * Releases a Plane back to be used by a future call to fetchTempInstance. TAKE CARE: this Plane object should no * longer have other classes referencing it or "Bad Things" will happen. - * + * * @param plane * the Plane to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Poolable.java b/ardor3d-math/src/main/java/com/ardor3d/math/Poolable.java index 46ec934..73d47bd 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Poolable.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Poolable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Quaternion.java b/ardor3d-math/src/main/java/com/ardor3d/math/Quaternion.java index 7cb1b3b..a7838ab 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Quaternion.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Quaternion.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyMatrix3; import com.ardor3d.math.type.ReadOnlyQuaternion; @@ -25,7 +26,7 @@ import com.ardor3d.util.export.Savable; /** * Quaternion represents a 4 value math object used in Ardor3D to describe rotations. It has the advantage of being able * to avoid lock by adding a 4th dimension to rotation. - * + * * Note: some algorithms in this class were ported from Eberly, Wolfram, Game Gems and others to Java. */ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQuaternion, Poolable { @@ -57,7 +58,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Constructs a new quaternion set to the (x, y, z, w) values of the given source quaternion. - * + * * @param source */ public Quaternion(final ReadOnlyQuaternion source) { @@ -66,7 +67,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Constructs a new quaternion set to (x, y, z, w). - * + * * @param x * @param y * @param z @@ -121,7 +122,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Stores the double values of this quaternion in the given double array as (x,y,z,w). - * + * * @param store * The array in which to store the values of this quaternion. If null, a new double[4] array is created. * @return the double array @@ -143,7 +144,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the x component of this quaternion to the given double value. - * + * * @param x */ public void setX(final double x) { @@ -152,7 +153,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the y component of this quaternion to the given double value. - * + * * @param y */ public void setY(final double y) { @@ -161,7 +162,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the z component of this quaternion to the given double value. - * + * * @param z */ public void setZ(final double z) { @@ -170,7 +171,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the w component of this quaternion to the given double value. - * + * * @param w */ public void setW(final double w) { @@ -179,7 +180,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the value of this quaternion to (x, y, z, w) - * + * * @param x * @param y * @param z @@ -196,7 +197,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the value of this quaternion to the (x, y, z, w) values of the provided source quaternion. - * + * * @param source * @return this quaternion for chaining * @throws NullPointerException @@ -213,7 +214,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Updates this quaternion from the given Euler rotation angles, applied in the given order: heading, attitude, * bank. - * + * * @param angles * the Euler angles of rotation (in radians) stored as heading, attitude, and bank. * @return this quaternion for chaining @@ -229,7 +230,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Updates this quaternion from the given Euler rotation angles, applied in the given order: heading, attitude, * bank. - * + * * @param heading * the Euler heading angle in radians. (rotation about the y axis) * @param attitude @@ -237,8 +238,8 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ * @param bank * the Euler bank angle in radians. (rotation about the x axis) * @return this quaternion for chaining - * @see <a - * href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm">euclideanspace.com-eulerToQuaternion</a> + * @see <a href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm"> + * euclideanspace.com-eulerToQuaternion</a> */ public Quaternion fromEulerAngles(final double heading, final double attitude, final double bank) { double angle = heading * 0.5; @@ -269,14 +270,14 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Converts this quaternion to Euler rotation angles in radians (heading, attitude, bank). - * + * * @param store * the double[] array to store the computed angles in. If null, a new double[] will be created * @return the double[] array, filled with heading, attitude and bank in that order.. * @throws ArrayIndexOutOfBoundsException * if non-null store is not at least length 3 - * @see <a - * href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm">euclideanspace.com-quaternionToEuler</a> + * @see <a href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm"> + * euclideanspace.com-quaternionToEuler</a> * @see #fromEulerAngles(double, double, double) */ @Override @@ -313,7 +314,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the value of this quaternion to the rotation described by the given matrix. - * + * * @param matrix * @return this quaternion for chaining * @throws NullPointerException @@ -326,7 +327,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the value of this quaternion to the rotation described by the given matrix values. - * + * * @param m00 * @param m01 * @param m02 @@ -387,7 +388,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ * @param store * the matrix to store our result in. If null, a new matrix is created. * @return the rotation matrix representation of this quaternion (normalized) - * + * * if store is not null and is read only. */ @Override @@ -534,7 +535,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ * Sets the values of this quaternion to the values represented by a given angle and axis of rotation. Note that * this method creates an object, so use fromAngleNormalAxis if your axis is already normalized. If axis == 0,0,0 * the quaternion is set to identity. - * + * * @param angle * the angle to rotate (in radians). * @param axis @@ -553,7 +554,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the values of this quaternion to the values represented by a given angle and unit length axis of rotation. * If axis == 0,0,0 the quaternion is set to identity. - * + * * @param angle * the angle to rotate (in radians). * @param axis @@ -578,7 +579,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Returns the rotation angle represented by this quaternion. If a non-null vector is provided, the axis of rotation * is stored in that vector as well. - * + * * @param axisStore * the object we'll store the computed axis in. If null, no computations are done to determine axis. * @return the angle of rotation in radians. @@ -610,7 +611,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets this quaternion to that which will rotate vector "from" into vector "to". from and to do not have to be the * same length. - * + * * @param from * the source vector to rotate * @param to @@ -696,7 +697,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ * Calculates the <i>multiplicative inverse</i> <code>Q<sup>-1</sup></code> of this quaternion <code>Q</code> such * that <code>QQ<sup>-1</sup> = [0,0,0,1]</code> (the identity quaternion). Note that for unit quaternions, a * quaternion's inverse is equal to its (far easier to calculate) conjugate. - * + * * @param store * the <code>Quaternion</code> to store the result in. If <code>null</code>, a new one is created. * @see #conjugate(Quaternion) @@ -719,9 +720,9 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ * Locally sets this quaternion <code>Q</code> to its <i>multiplicative inverse</i> <code>Q<sup>-1</sup></code> such * that <code>QQ<sup>-1</sup> = [0,0,0,1]</code> (the identity quaternion). Note that for unit quaternions, a * quaternion's inverse is equal to its (far easier to calculate) conjugate. - * + * * @see #conjugate(Quaternion) - * + * * @return this <code>Quaternion</code> for chaining. */ public Quaternion invertLocal() { @@ -736,7 +737,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Creates a new quaternion that is the conjugate <code>[-x, -y, -z, w]</code> of this quaternion. - * + * * @param store * the <code>Quaternion</code> to store the result in. If <code>null</code>, a new one is created. * @return the conjugate to this quaternion. @@ -751,7 +752,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Internally sets this quaternion to its conjugate <code>[-x, -y, -z, w]</code>. - * + * * @return this <code>Quaternion</code> for chaining. */ public Quaternion conjugateLocal() { @@ -760,7 +761,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Adds this quaternion to another and places the result in the given store. - * + * * @param quat * @param store * the Quaternion to store the result in. if null, a new one is created. @@ -778,7 +779,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Internally increments the fields of this quaternion with the field values of the given quaternion. - * + * * @param quat * @return this quaternion for chaining */ @@ -808,7 +809,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Internally decrements the fields of this quaternion by the field values of the given quaternion. - * + * * @param quat * @return this quaternion for chaining. */ @@ -822,7 +823,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Multiplies each value of this quaternion by the given scalar value. - * + * * @param scalar * the quaternion to multiply this quaternion by. * @param store @@ -841,7 +842,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Multiplies each value of this quaternion by the given scalar value. The result is stored in this quaternion. - * + * * @param scalar * the quaternion to multiply this quaternion by. * @return this quaternion for chaining. @@ -857,15 +858,15 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Multiplies this quaternion by the supplied quaternion. The result is stored in the given store quaternion or a * new quaternion if store is null. - * + * * It IS safe for quat and store to be the same object. - * + * * @param quat * the quaternion to multiply this quaternion by. * @param store * the quaternion to store the result in. * @return the new quaternion. - * + * * if the given store is read only. */ @Override @@ -882,7 +883,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Multiplies this quaternion by the supplied quaternion. The result is stored locally. - * + * * @param quat * The Quaternion to multiply this one by. * @return this quaternion for chaining @@ -895,7 +896,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Multiplies this quaternion by the supplied matrix. The result is stored locally. - * + * * @param matrix * the matrix to apply to this quaternion. * @return this quaternion for chaining @@ -916,7 +917,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Multiplies this quaternion by the supplied quaternion values. The result is stored locally. - * + * * @param qx * @param qy * @param qz @@ -934,7 +935,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Multiply this quaternion by a rotational quaternion made from the given angle and axis. The axis must be a * normalized vector. - * + * * @param angle * in radians * @param x @@ -968,7 +969,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Apply rotation around X - * + * * @param angle * in radians * @return this quaternion for chaining. @@ -988,7 +989,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Apply rotation around Y - * + * * @param angle * in radians * @return this quaternion for chaining. @@ -1008,7 +1009,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Apply rotation around Z - * + * * @param angle * in radians * @return this quaternion for chaining. @@ -1028,7 +1029,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Rotates the given vector by this quaternion. If supplied, the result is stored into the supplied "store" vector. - * + * * @param vec * the vector to multiply this quaternion by. * @param store @@ -1037,7 +1038,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ * @return the store vector, or a new vector if store is null. * @throws NullPointerException * if vec is null - * + * * if the given store is read only. */ @Override @@ -1048,15 +1049,15 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ if (vec.equals(Vector3.ZERO)) { store.set(0, 0, 0); } else { - final double x = getW() * getW() * vec.getX() + 2 * getY() * getW() * vec.getZ() - 2 * getZ() * getW() - * vec.getY() + getX() * getX() * vec.getX() + 2 * getY() * getX() * vec.getY() + 2 * getZ() - * getX() * vec.getZ() - getZ() * getZ() * vec.getX() - getY() * getY() * vec.getX(); - final double y = 2 * getX() * getY() * vec.getX() + getY() * getY() * vec.getY() + 2 * getZ() * getY() - * vec.getZ() + 2 * getW() * getZ() * vec.getX() - getZ() * getZ() * vec.getY() + getW() * getW() - * vec.getY() - 2 * getX() * getW() * vec.getZ() - getX() * getX() * vec.getY(); - final double z = 2 * getX() * getZ() * vec.getX() + 2 * getY() * getZ() * vec.getY() + getZ() * getZ() - * vec.getZ() - 2 * getW() * getY() * vec.getX() - getY() * getY() * vec.getZ() + 2 * getW() - * getX() * vec.getY() - getX() * getX() * vec.getZ() + getW() * getW() * vec.getZ(); + final double x = getW() * getW() * vec.getX() + 2 * getY() * getW() * vec.getZ() + - 2 * getZ() * getW() * vec.getY() + getX() * getX() * vec.getX() + 2 * getY() * getX() * vec.getY() + + 2 * getZ() * getX() * vec.getZ() - getZ() * getZ() * vec.getX() - getY() * getY() * vec.getX(); + final double y = 2 * getX() * getY() * vec.getX() + getY() * getY() * vec.getY() + + 2 * getZ() * getY() * vec.getZ() + 2 * getW() * getZ() * vec.getX() - getZ() * getZ() * vec.getY() + + getW() * getW() * vec.getY() - 2 * getX() * getW() * vec.getZ() - getX() * getX() * vec.getY(); + final double z = 2 * getX() * getZ() * vec.getX() + 2 * getY() * getZ() * vec.getY() + + getZ() * getZ() * vec.getZ() - 2 * getW() * getY() * vec.getX() - getY() * getY() * vec.getZ() + + 2 * getW() * getX() * vec.getY() - getX() * getX() * vec.getZ() + getW() * getW() * vec.getZ(); store.set(x, y, z); } return store; @@ -1066,7 +1067,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ * Updates this quaternion to represent a rotation formed by the given three axes. These axes are assumed to be * orthogonal and no error checking is applied. It is the user's job to insure that the three axes being provided * indeed represent a proper right handed coordinate system. - * + * * @param xAxis * vector representing the x-axis of the coordinate system. * @param yAxis @@ -1082,7 +1083,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Converts this quaternion to a rotation matrix and then extracts rotation axes. - * + * * @param axes * the array of vectors to be filled. * @throws ArrayIndexOutOfBoundsException @@ -1102,7 +1103,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change * amount. - * + * * @param endQuat * @param changeAmnt * @param store @@ -1118,7 +1119,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change * amount. Stores the results locally in this quaternion. - * + * * @param endQuat * @param changeAmnt * @return this quaternion for chaining. @@ -1130,7 +1131,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Does a spherical linear interpolation between the given start and end quaternions by the given change amount. * Returns the result as a new quaternion. - * + * * @param startQuat * @param endQuat * @param changeAmnt @@ -1198,7 +1199,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Does a spherical linear interpolation between the given start and end quaternions by the given change amount. * Stores the result locally. - * + * * @param startQuat * @param endQuat * @param changeAmnt @@ -1264,7 +1265,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Does a spherical linear interpolation between the given start and end quaternions by the given change amount. * Stores the result locally. - * + * * @param startQuat * @param endQuat * @param changeAmnt @@ -1283,7 +1284,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Modifies this quaternion to equal the rotation required to point the z-axis at 'direction' and the y-axis to * 'up'. - * + * * @param direction * where to 'look' at * @param up @@ -1351,7 +1352,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Sets the value of this quaternion to (0, 0, 0, 1). Equivalent to calling set(0, 0, 0, 1) - * + * * @return this quaternion for chaining */ public Quaternion setIdentity() { @@ -1368,7 +1369,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Check a quaternion... if it is null or its doubles are NaN or infinite, return false. Else return true. - * + * * @param quat * the quaternion to check * @return true or false as stated above. @@ -1406,21 +1407,8 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ */ @Override public int hashCode() { - int result = 17; - - final long x = Double.doubleToLongBits(getX()); - result += 31 * result + (int) (x ^ x >>> 32); - - final long y = Double.doubleToLongBits(getY()); - result += 31 * result + (int) (y ^ y >>> 32); - - final long z = Double.doubleToLongBits(getZ()); - result += 31 * result + (int) (z ^ z >>> 32); - - final long w = Double.doubleToLongBits(getW()); - result += 31 * result + (int) (w ^ w >>> 32); - - return result; + return Objects.hash(Double.valueOf(getX()), Double.valueOf(getY()), Double.valueOf(getZ()), + Double.valueOf(getW())); } /** @@ -1500,7 +1488,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -1516,7 +1504,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -1548,7 +1536,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ /** * Releases a Quaternion back to be used by a future call to fetchTempInstance. TAKE CARE: this Quaternion object * should no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param mat * the Quaternion to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Ray3.java b/ardor3d-math/src/main/java/com/ardor3d/math/Ray3.java index 9c1432f..1ac5715 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Ray3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Ray3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle2.java b/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle2.java index ced2fe8..9a62e1b 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle2.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle2.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyRectangle2; import com.ardor3d.util.export.InputCapsule; @@ -46,7 +47,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Constructor creates a new <code>Rectangle2</code> with using the given x,y,width and height values. - * + * */ public Rectangle2(final int x, final int y, final int width, final int height) { setX(x); @@ -57,7 +58,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Constructor creates a new <code>Rectangle2</code> using the values of the provided source rectangle. - * + * * @param source * the rectangle to copy from */ @@ -167,14 +168,8 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR */ @Override public int hashCode() { - int result = 17; - - result += 31 * result + _x; - result += 31 * result + _y; - result += 31 * result + _width; - result += 31 * result + _height; - - return result; + return Objects.hash(Integer.valueOf(getX()), Integer.valueOf(getY()), Integer.valueOf(getWidth()), + Integer.valueOf(getHeight())); } /** @@ -235,7 +230,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -251,7 +246,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -283,7 +278,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Releases a Rectangle2 back to be used by a future call to fetchTempInstance. TAKE CARE: this object should no * longer have other classes referencing it or "Bad Things" will happen. - * + * * @param rectangle * the Rectangle2 to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle3.java b/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle3.java index be10f94..2010f8d 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle3.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyRectangle3; import com.ardor3d.math.type.ReadOnlyVector3; @@ -43,7 +44,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Constructor creates a new Rectangle3 using the values of the provided source rectangle. - * + * * @param source * the rectangle to copy from */ @@ -53,7 +54,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Constructor creates a new Rectangle3 with defined A, B, and C points that define the area of the rectangle. - * + * * @param a * the first corner of the rectangle. * @param b @@ -69,7 +70,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Copy the value of the given source Rectangle3 into this Rectangle3. - * + * * @param source * the source of the data to copy. * @return this rectangle for chaining @@ -85,7 +86,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * getA returns the first point of the rectangle. - * + * * @return the first point of the rectangle. */ @Override @@ -95,7 +96,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * setA sets the first point of the rectangle. - * + * * @param a * the first point of the rectangle. */ @@ -105,7 +106,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * getB returns the second point of the rectangle. - * + * * @return the second point of the rectangle. */ @Override @@ -115,7 +116,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * setB sets the second point of the rectangle. - * + * * @param b * the second point of the rectangle. */ @@ -125,7 +126,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * getC returns the third point of the rectangle. - * + * * @return the third point of the rectangle. */ @Override @@ -135,7 +136,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * setC sets the third point of the rectangle. - * + * * @param c * the third point of the rectangle. */ @@ -145,7 +146,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * random returns a random point within the plane defined by: A, B, C, and (B + C) - A. - * + * * @param result * Vector to store result in * @return a random point within the rectangle. @@ -184,13 +185,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR */ @Override public int hashCode() { - int result = 17; - - result += 31 * result + _a.hashCode(); - result += 31 * result + _b.hashCode(); - result += 31 * result + _c.hashCode(); - - return result; + return Objects.hash(getA(), getB(), getC()); } /** @@ -248,7 +243,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -263,7 +258,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -294,7 +289,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR /** * Releases a Rectangle3 back to be used by a future call to fetchTempInstance. TAKE CARE: this object should no * longer have other classes referencing it or "Bad Things" will happen. - * + * * @param rectangle * the Rectangle3 to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Ring.java b/ardor3d-math/src/main/java/com/ardor3d/math/Ring.java index d734003..f9a9eb1 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Ring.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Ring.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyRing; import com.ardor3d.math.type.ReadOnlyVector3; @@ -46,7 +47,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * Copy constructor. - * + * * @param source * the ring to copy from. */ @@ -56,7 +57,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * Constructor creates a new <code>Ring</code> with defined center point, up vector, and inner and outer radii. - * + * * @param center * the center of the ring. * @param up @@ -76,7 +77,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * Copy the value of the given source Ring into this Ring. - * + * * @param source * the source of the data to copy. * @return this ring for chaining @@ -93,7 +94,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * <code>getCenter</code> returns the center of the ring. - * + * * @return the center of the ring. */ @Override @@ -103,7 +104,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * <code>setCenter</code> sets the center of the ring. - * + * * @param center * the center of the ring. */ @@ -113,7 +114,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * <code>getUp</code> returns the ring's up vector. - * + * * @return the ring's up vector. */ @Override @@ -123,7 +124,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * <code>setUp</code> sets the ring's up vector. - * + * * @param up * the ring's up vector. */ @@ -133,7 +134,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * <code>getInnerRadius</code> returns the ring's inner radius. - * + * * @return the ring's inner radius. */ @Override @@ -143,7 +144,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * <code>setInnerRadius</code> sets the ring's inner radius. - * + * * @param innerRadius * the ring's inner radius. */ @@ -153,7 +154,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * <code>getOuterRadius</code> returns the ring's outer radius. - * + * * @return the ring's outer radius. */ @Override @@ -163,7 +164,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * <code>setOuterRadius</code> sets the ring's outer radius. - * + * * @param outerRadius * the ring's outer radius. */ @@ -172,9 +173,9 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P } /** - * + * * <code>random</code> returns a random point within the ring. - * + * * @param store * Vector to store result in * @return a random point within the ring. @@ -213,7 +214,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * Check a ring... if it is null or its radii, or the doubles of its center or up are NaN or infinite, return false. * Else return true. - * + * * @param ring * the ring to check * @return true or false as stated above. @@ -247,18 +248,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P */ @Override public int hashCode() { - int result = 17; - - result += 31 * result + _center.hashCode(); - result += 31 * result + _up.hashCode(); - - final long ir = Double.doubleToLongBits(getInnerRadius()); - result += 31 * result + (int) (ir ^ ir >>> 32); - - final long or = Double.doubleToLongBits(getOuterRadius()); - result += 31 * result + (int) (or ^ or >>> 32); - - return result; + return Objects.hash(getCenter(), getUp(), Double.valueOf(getInnerRadius()), Double.valueOf(getOuterRadius())); } /** @@ -320,7 +310,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -336,7 +326,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -368,7 +358,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P /** * Releases a Ring back to be used by a future call to fetchTempInstance. TAKE CARE: this Ring object should no * longer have other classes referencing it or "Bad Things" will happen. - * + * * @param ring * the Ring to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Transform.java b/ardor3d-math/src/main/java/com/ardor3d/math/Transform.java index 47d0a88..1be57e8 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Transform.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Transform.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -16,6 +16,7 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyMatrix3; import com.ardor3d.math.type.ReadOnlyMatrix4; @@ -78,7 +79,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Constructs a new Transform object from the information stored in the given source Transform. - * + * * @param source * @throws NullPointerException * if source is null. @@ -96,7 +97,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Internal only constructor, generally used for making an immutable transform. - * + * * @param matrix * @param scale * @param translation @@ -158,7 +159,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Resets this transform to identity and resets all flags. - * + * * @return this Transform for chaining. */ public Transform setIdentity() { @@ -173,10 +174,10 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Sets the matrix portion of this transform to the given value. - * + * * NB: Calling this with a matrix that is not purely rotational (orthonormal) will result in a Transform whose scale * comes from its matrix. Further attempts to set scale directly will throw an error. - * + * * @param rotation * our new matrix. * @return this transform for chaining. @@ -193,7 +194,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Sets the matrix portion of this transform to the rotational value of the given Quaternion. Calling this allows * scale to be set and used. - * + * * @param rotation * @return this transform for chaining. * @throws NullPointerException @@ -207,7 +208,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Sets the translation portion of this transform to the given value. - * + * * @param translation * @return this transform for chaining. * @throws NullPointerException @@ -221,7 +222,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Sets the translation portion of this transform to the given values. - * + * * @param x * @param y * @param z @@ -235,7 +236,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Sets the scale portion of this transform to the given value. - * + * * @param scale * @return this transform for chaining. * @throws NullPointerException @@ -262,7 +263,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Sets the scale portion of this transform to the given values. - * + * * @param x * @param y * @param z @@ -291,7 +292,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Sets the scale portion of this transform to the given value as a vector (u, u, u) - * + * * @param uniformScale * @return this transform for chaining. * @throws TransformException @@ -316,7 +317,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Copies the given transform values into this transform object. - * + * * @param source * @return this transform for chaining. * @throws NullPointerException @@ -339,7 +340,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Locally adds to the translation of this transform. - * + * * @param x * @param y * @param z @@ -353,7 +354,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Locally adds to the translation of this transform. - * + * * @param vec * @return this transform for chaining. */ @@ -365,7 +366,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Locally applies this transform to the given point: P' = M*P+T - * + * * @param point * @return the transformed point. * @throws NullPointerException @@ -402,7 +403,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Applies this transform to the given point and returns the result in the given store vector: P' = M*P+T - * + * * @param point * @param store * the vector to store our result in. if null, a new vector will be created. @@ -422,7 +423,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Locally applies the inverse of this transform to the given point: P' = M^{-1}*(P-T) - * + * * @param point * @return the transformed point. * @throws NullPointerException @@ -467,7 +468,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Applies the inverse of this transform to the given point and returns the result in the given store vector: P' = * M^{-1}*(P-T) - * + * * @param point * @param store * the vector to store our result in. if null, a new vector will be created. @@ -487,7 +488,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Locally applies this transform to the given vector: V' = M*V - * + * * @param vector * @return the transformed vector. * @throws NullPointerException @@ -522,7 +523,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Applies this transform to the given vector and returns the result in the given store vector: V' = M*V - * + * * @param vector * @param store * the vector to store our result in. if null, a new vector will be created. @@ -542,7 +543,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Locally applies the inverse of this transform to the given vector: V' = M^{-1}*V - * + * * @param vector * @return the transformed vector. * @throws NullPointerException @@ -584,7 +585,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Applies the inverse of this transform to the given vector and returns the result in the given store vector: V' = * M^{-1}*V - * + * * @param vector * @param store * the vector to store our result in. if null, a new vector will be created. @@ -605,7 +606,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Calculates the product of this transform with the given "transformBy" transform (P = this * T) and stores this in * store. - * + * * @param transformBy * @param store * the transform to store the result in for return. If null, a new transform object is created and @@ -654,11 +655,12 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr } // In all remaining cases, the matrix cannot be written as R*S*X+T. - final ReadOnlyMatrix3 matrixA = isRotationMatrix() ? _matrix.multiplyDiagonalPost(_scale, - Matrix3.fetchTempInstance()) : _matrix; + final ReadOnlyMatrix3 matrixA = isRotationMatrix() + ? _matrix.multiplyDiagonalPost(_scale, Matrix3.fetchTempInstance()) : _matrix; - final ReadOnlyMatrix3 matrixB = transformBy.isRotationMatrix() ? transformBy.getMatrix().multiplyDiagonalPost( - transformBy.getScale(), Matrix3.fetchTempInstance()) : transformBy.getMatrix(); + final ReadOnlyMatrix3 matrixB = transformBy.isRotationMatrix() + ? transformBy.getMatrix().multiplyDiagonalPost(transformBy.getScale(), Matrix3.fetchTempInstance()) + : transformBy.getMatrix(); final Matrix3 newMatrix = result._matrix; newMatrix.set(matrixA).multiplyLocal(matrixB); @@ -684,7 +686,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Updates _rotationMatrix, _uniformScale and _identity based on the current contents of this Transform. - * + * * @param rotationMatrixGuaranteed * true if we know for sure that the _matrix component is rotational. */ @@ -701,7 +703,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Calculates the inverse of this transform. - * + * * @param store * the transform to store the result in for return. If null, a new transform object is created and * returned. It IS safe for store to be the same object as "this". @@ -744,13 +746,13 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr * @param store * the matrix to store the result in for return. If null, a new matrix object is created and returned. * @return this transform represented as a 4x4 matrix: - * + * * <pre> * R R R Tx * R R R Ty * R R R Tz * 0 0 0 1 - * </pre> + * </pre> */ @Override public Matrix4 getHomogeneousMatrix(final Matrix4 store) { @@ -855,7 +857,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Reads in a 4x4 matrix as a 3x3 matrix and translation. - * + * * @param matrix * @return this matrix for chaining. * @throws NullPointerException @@ -872,10 +874,10 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Check a transform... if it is null or one of its members are invalid, return false. Else return true. - * + * * @param transform * the transform to check - * + * * @return true or false as stated above. */ public static boolean isValid(final ReadOnlyTransform transform) { @@ -903,13 +905,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr */ @Override public int hashCode() { - int result = 17; - - result += 31 * result + _matrix.hashCode(); - result += 31 * result + _scale.hashCode(); - result += 31 * result + _translation.hashCode(); - - return result; + return Objects.hash(getMatrix(), getScale(), getTranslation()); } /** @@ -997,7 +993,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -1015,9 +1011,9 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /* * Used with serialization. Not to be called manually. - * + * * @param out ObjectOutput - * + * * @throws IOException */ @Override @@ -1049,7 +1045,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr /** * Releases a Transform back to be used by a future call to fetchTempInstance. TAKE CARE: this Transform object * should no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param trans * the Transform to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/TransformException.java b/ardor3d-math/src/main/java/com/ardor3d/math/TransformException.java index bfb43bc..5cf499f 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/TransformException.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/TransformException.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Triangle.java b/ardor3d-math/src/main/java/com/ardor3d/math/Triangle.java index d1db728..454a43e 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Triangle.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Triangle.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyTriangle; import com.ardor3d.math.type.ReadOnlyVector3; @@ -51,7 +52,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Copy constructor. - * + * * @param source * the triangle to copy from. */ @@ -61,7 +62,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Construct a new, mutable triangle using the given points and an index of 0. - * + * * @param pointA * @param pointB * @param pointC @@ -72,7 +73,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Constructs a new triangle using the given points and index. - * + * * @param pointA * @param pointB * @param pointC @@ -88,7 +89,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Copies the values of the given source Triangle into this Triangle. - * + * * @param source * @return this Triangle for chaining * @throws NullPointerException @@ -138,7 +139,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Obtains the unit length normal vector of this triangle... Will create and recalculate this normal vector if this * is the first request, or if one of the points on the triangle has changed since the last request. - * + * * @return the normal vector * @throws NullPointerException * if store is null. @@ -165,7 +166,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Sets the index value of this triangle to the given int value. - * + * * @param index */ public void setIndex(final int index) { @@ -174,7 +175,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Sets the first point of this triangle to the values of the given vector. - * + * * @param pointA */ public void setA(final ReadOnlyVector3 pointA) { @@ -184,7 +185,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Sets the second point of this triangle to the values of the given vector. - * + * * @param pointB */ public void setB(final ReadOnlyVector3 pointB) { @@ -194,7 +195,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Sets the third point of this triangle to the values of the given vector. - * + * * @param pointC */ public void setC(final ReadOnlyVector3 pointC) { @@ -204,7 +205,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Sets a point to a new value. - * + * * @param index * the index of the point to set (0-2, corresponding to A-C) * @param point @@ -257,7 +258,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Check a triangle... if it is null or its points are invalid, return false. Else return true. - * + * * @param triangle * the triangle to check * @return true or false as stated above. @@ -289,14 +290,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri */ @Override public int hashCode() { - int result = 17; - - result += 31 * result + _pointA.hashCode(); - result += 31 * result + _pointB.hashCode(); - result += 31 * result + _pointC.hashCode(); - result += 31 * result + _index; - - return result; + return Objects.hash(getA(), getB(), getC(), Integer.valueOf(getIndex())); } /** @@ -357,7 +351,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -373,7 +367,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -405,7 +399,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri /** * Releases a Triangle back to be used by a future call to fetchTempInstance. TAKE CARE: this Triangle object should * no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param tri * the Triangle to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/ValidatingTransform.java b/ardor3d-math/src/main/java/com/ardor3d/math/ValidatingTransform.java index 09b43d4..9c22e73 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/ValidatingTransform.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/ValidatingTransform.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Vector2.java b/ardor3d-math/src/main/java/com/ardor3d/math/Vector2.java index c6f1d46..b0a6f8b 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Vector2.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Vector2.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyVector2; import com.ardor3d.util.export.InputCapsule; @@ -77,7 +78,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Constructs a new vector set to the (x, y) values of the given source vector. - * + * * @param src */ public Vector2(final ReadOnlyVector2 src) { @@ -86,7 +87,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Constructs a new vector set to (x, y). - * + * * @param x * @param y */ @@ -160,7 +161,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Stores the double values of this vector in the given double array. - * + * * @param store * if null, a new double[2] array is created. * @return the double array @@ -180,7 +181,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the first component of this vector to the given double value. - * + * * @param x */ public void setX(final double x) { @@ -189,7 +190,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the second component of this vector to the given double value. - * + * * @param y */ public void setY(final double y) { @@ -198,7 +199,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the value of this vector to (x, y) - * + * * @param x * @param y * @return this vector for chaining @@ -211,7 +212,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the value of this vector to the (x, y) values of the provided source vector. - * + * * @param source * @return this vector for chaining * @throws NullPointerException @@ -225,7 +226,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the value of this vector to (0, 0) - * + * * @return this vector for chaining */ public Vector2 zero() { @@ -235,7 +236,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Adds the given values to those of this vector and returns them in store * @param store the vector to store the * result in for return. If null, a new vector object is created and returned. . - * + * * @param x * @param y * @param store @@ -254,7 +255,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Increments the values of this vector with the given x and y values. - * + * * @param x * @param y * @return this vector for chaining @@ -265,7 +266,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Adds the values of the given source vector to those of this vector and returns them in store. - * + * * @param source * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -280,7 +281,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Increments the values of this vector with the x and y values of the given vector. - * + * * @param source * @return this vector for chaining * @throws NullPointerException @@ -292,7 +293,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Subtracts the given values from those of this vector and returns them in store. - * + * * @param x * @param y * @param store @@ -311,7 +312,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Decrements the values of this vector by the given x and y values. - * + * * @param x * @param y * @return this vector for chaining @@ -322,7 +323,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Subtracts the values of the given source vector from those of this vector and returns them in store. - * + * * @param source * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -337,7 +338,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Decrements the values of this vector by the x and y values from the given source vector. - * + * * @param source * @return this vector for chaining * @throws NullPointerException @@ -349,7 +350,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Multiplies the values of this vector by the given scalar value and returns the result in store. - * + * * @param scalar * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -367,7 +368,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by multiplying them each by the given scalar value. - * + * * @param scalar * @return this vector for chaining */ @@ -377,7 +378,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Multiplies the values of this vector by the given scale values and returns the result in store. - * + * * @param scale * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -395,7 +396,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by multiplying them each by the values of the given scale. - * + * * @param scale * @return this vector for chaining */ @@ -405,7 +406,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Multiplies the values of this vector by the given scale values and returns the result in store. - * + * * @param x * @param y * @param store @@ -424,7 +425,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by multiplying them each by the values of the given scale. - * + * * @param x * @param y * @return this vector for chaining @@ -435,7 +436,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Divides the values of this vector by the given scalar value and returns the result in store. - * + * * @param scalar * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -453,7 +454,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by dividing them each by the given scalar value. - * + * * @param scalar * @return this vector for chaining * @throws ArithmeticException @@ -467,7 +468,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Divides the values of this vector by the given scale values and returns the result in store. - * + * * @param scale * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -485,7 +486,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by dividing them each by the values of the given scale. - * + * * @param scale * @return this vector for chaining */ @@ -495,7 +496,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Divides the values of this vector by the given scale values and returns the result in store. - * + * * @param x * @param y * @param store @@ -514,7 +515,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by dividing them each by the values of the given scale. - * + * * @param x * @param y * @return this vector for chaining @@ -524,10 +525,10 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect } /** - * + * * Internally modifies this vector by multiplying its values with a given scale value, then adding a given "add" * value. - * + * * @param scale * the value to multiply this vector by. * @param add @@ -543,7 +544,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Scales this vector by multiplying its values with a given scale value, then adding a given "add" value. The * result is store in the given store parameter. - * + * * @param scale * the value to multiply by. * @param add @@ -584,7 +585,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Creates a new unit length vector from this one by dividing by length. If the length is 0, (ie, if the vector is * 0, 0) then a new vector (0, 0) is returned. - * + * * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. * @return a new unit vector (or 0, 0 if this unit is 0 length) @@ -602,7 +603,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Converts this vector into a unit vector by dividing it internally by its length. If the length is 0, (ie, if the * vector is 0, 0) then no action is taken. - * + * * @return this vector for chaining */ public Vector2 normalizeLocal() { @@ -616,7 +617,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Creates a new vector representing this vector rotated around 0,0 by a specified angle in a given direction. - * + * * @param angle * in radians * @param clockwise @@ -642,7 +643,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally rotates this vector around 0,0 by a specified angle in a given direction. - * + * * @param angle * in radians * @param clockwise @@ -662,7 +663,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between this vector and the given end vector, using the given scalar as a * percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if * it is closer to 1, the result will be closer to the end value. The result is returned as a new vector object. - * + * * @param endVec * @param scalar * @param store @@ -687,7 +688,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between this vector and the given end vector, using the given scalar as a * percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if * it is closer to 1, the result will be closer to the end value. The result is stored back in this vector. - * + * * @param endVec * @param scalar * @return this vector for chaining @@ -704,7 +705,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the * result will be closer to the end value. The result is returned as a new vector object. - * + * * @param beginVec * @param endVec * @param scalar @@ -731,7 +732,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the * result will be closer to the end value. The result is stored back in this vector. - * + * * @param beginVec * @param endVec * @param changeAmnt @@ -834,8 +835,8 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * @return the angle - in radians [-pi, pi) - represented by this Vector2 as expressed by a conversion from - * rectangular coordinates (<code>x</code>, <code>y</code>) to polar coordinates - * (r, <i>theta</i>). + * rectangular coordinates (<code>x</code>, <code>y</code>) to polar coordinates (r, <i>theta</i> + * ). */ @Override public double getPolarAngle() { @@ -872,7 +873,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Check a vector... if it is null or its doubles are NaN or infinite, return false. Else return true. - * + * * @param vector * the vector to check * @return true or false as stated above. @@ -904,15 +905,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect */ @Override public int hashCode() { - int result = 17; - - final long x = Double.doubleToLongBits(getX()); - result += 31 * result + (int) (x ^ x >>> 32); - - final long y = Double.doubleToLongBits(getY()); - result += 31 * result + (int) (y ^ y >>> 32); - - return result; + return Objects.hash(Double.valueOf(getX()), Double.valueOf(getY())); } /** @@ -968,7 +961,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -982,7 +975,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -1012,7 +1005,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Releases a Vector2 back to be used by a future call to fetchTempInstance. TAKE CARE: this Vector2 object should * no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param vec * the Vector2 to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Vector3.java b/ardor3d-math/src/main/java/com/ardor3d/math/Vector3.java index f8754b2..1f5f108 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Vector3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Vector3.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyVector3; import com.ardor3d.util.export.InputCapsule; @@ -88,7 +89,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Constructs a new vector set to the (x, y, z) values of the given source vector. - * + * * @param src */ public Vector3(final ReadOnlyVector3 src) { @@ -97,7 +98,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Constructs a new vector set to (x, y, z). - * + * * @param x * @param y * @param z @@ -191,7 +192,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Stores the double values of this vector in the given double array. - * + * * @param store * if null, a new double[3] array is created. * @return the double array @@ -213,7 +214,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Stores the double values of this vector in the given float array. - * + * * @param store * if null, a new float[3] array is created. * @return the float array @@ -236,7 +237,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the first component of this vector to the given double value. - * + * * @param x */ public void setX(final double x) { @@ -245,7 +246,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the second component of this vector to the given double value. - * + * * @param y */ public void setY(final double y) { @@ -254,7 +255,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the third component of this vector to the given double value. - * + * * @param z */ public void setZ(final double z) { @@ -263,7 +264,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the value of this vector to (x, y, z) - * + * * @param x * @param y * @param z @@ -278,7 +279,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the value of this vector to the (x, y, z) values of the provided source vector. - * + * * @param source * @return this vector for chaining * @throws NullPointerException @@ -293,7 +294,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the value of this vector to (0, 0, 0) - * + * * @return this vector for chaining */ public Vector3 zero() { @@ -303,7 +304,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Adds the given values to those of this vector and returns them in store * @param store the vector to store the * result in for return. If null, a new vector object is created and returned. . - * + * * @param x * @param y * @param z @@ -323,7 +324,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Increments the values of this vector with the given x, y and z values. - * + * * @param x * @param y * @param z @@ -335,7 +336,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Adds the values of the given source vector to those of this vector and returns them in store. - * + * * @param source * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -350,7 +351,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Increments the values of this vector with the x, y and z values of the given vector. - * + * * @param source * @return this vector for chaining * @throws NullPointerException @@ -362,7 +363,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Subtracts the given values from those of this vector and returns them in store. - * + * * @param x * @param y * @param z @@ -382,7 +383,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Decrements the values of this vector by the given x, y and z values. - * + * * @param x * @param y * @param z @@ -394,7 +395,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Subtracts the values of the given source vector from those of this vector and returns them in store. - * + * * @param source * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -409,7 +410,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Decrements the values of this vector by the x, y and z values from the given source vector. - * + * * @param source * @return this vector for chaining * @throws NullPointerException @@ -421,7 +422,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Multiplies the values of this vector by the given scalar value and returns the result in store. - * + * * @param scalar * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -439,7 +440,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by multiplying them each by the given scalar value. - * + * * @param scalar * @return this vector for chaining */ @@ -449,7 +450,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Multiplies the values of this vector by the given scale values and returns the result in store. - * + * * @param scale * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -467,7 +468,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by multiplying them each by the given scale values. - * + * * @param scalar * @return this vector for chaining */ @@ -477,7 +478,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Multiplies the values of this vector by the given scale values and returns the result in store. - * + * * @param x * @param y * @param z @@ -497,7 +498,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by multiplying them each by the given scale values. - * + * * @param x * @param y * @param z @@ -509,7 +510,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Divides the values of this vector by the given scalar value and returns the result in store. - * + * * @param scalar * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -527,7 +528,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by dividing them each by the given scalar value. - * + * * @param scalar * @return this vector for chaining * @throws ArithmeticException @@ -541,7 +542,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Divides the values of this vector by the given scale values and returns the result in store. - * + * * @param scale * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -559,7 +560,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by dividing them each by the given scale values. - * + * * @param scale * @return this vector for chaining */ @@ -569,7 +570,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Divides the values of this vector by the given scale values and returns the result in store. - * + * * @param x * @param y * @param z @@ -589,7 +590,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by dividing them each by the given scale values. - * + * * @param x * @param y * @param z @@ -600,10 +601,10 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect } /** - * + * * Internally modifies this vector by multiplying its values with a given scale value, then adding a given "add" * value. - * + * * @param scale * the value to multiply this vector by. * @param add @@ -620,7 +621,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Scales this vector by multiplying its values with a given scale value, then adding a given "add" value. The * result is store in the given store parameter. - * + * * @param scale * the value to multiply by. * @param add @@ -662,7 +663,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Creates a new unit length vector from this one by dividing by length. If the length is 0, (ie, if the vector is * 0, 0, 0) then a new vector (0, 0, 0) is returned. - * + * * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. * @return a new unit vector (or 0, 0, 0 if this unit is 0 length) @@ -680,7 +681,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Converts this vector into a unit vector by dividing it internally by its length. If the length is 0, (ie, if the * vector is 0, 0, 0) then no action is taken. - * + * * @return this vector for chaining */ public Vector3 normalizeLocal() { @@ -696,7 +697,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between this vector and the given end vector, using the given scalar as a * percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if * it is closer to 1, the result will be closer to the end value. The result is returned as a new vector object. - * + * * @param endVec * @param scalar * @param store @@ -722,7 +723,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between this vector and the given end vector, using the given scalar as a * percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if * it is closer to 1, the result will be closer to the end value. The result is stored back in this vector. - * + * * @param endVec * @param scalar * @return this vector for chaining @@ -740,7 +741,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the * result will be closer to the end value. The result is returned as a new vector object. - * + * * @param beginVec * @param endVec * @param scalar @@ -774,7 +775,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the * result will be closer to the end value. The result is stored back in this vector. - * + * * @param beginVec * @param endVec * @param changeAmnt @@ -959,7 +960,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Check a vector... if it is null or its doubles are NaN or infinite, return false. Else return true. - * + * * @param vector * the vector to check * @return true or false as stated above. @@ -979,7 +980,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Check if a vector is non-null and has infinite values. - * + * * @param vector * the vector to check * @return true or false as stated above. @@ -1008,18 +1009,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect */ @Override public int hashCode() { - int result = 17; - - final long x = Double.doubleToLongBits(getX()); - result += 31 * result + (int) (x ^ x >>> 32); - - final long y = Double.doubleToLongBits(getY()); - result += 31 * result + (int) (y ^ y >>> 32); - - final long z = Double.doubleToLongBits(getZ()); - result += 31 * result + (int) (z ^ z >>> 32); - - return result; + return Objects.hash(Double.valueOf(getX()), Double.valueOf(getY()), Double.valueOf(getZ())); } /** @@ -1077,7 +1067,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -1092,7 +1082,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -1123,7 +1113,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Releases a Vector3 back to be used by a future call to fetchTempInstance. TAKE CARE: this Vector3 object should * no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param vec * the Vector3 to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Vector4.java b/ardor3d-math/src/main/java/com/ardor3d/math/Vector4.java index 74927d6..d62eac7 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/Vector4.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/Vector4.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.Objects; import com.ardor3d.math.type.ReadOnlyVector4; import com.ardor3d.util.export.InputCapsule; @@ -99,7 +100,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Constructs a new vector set to the (x, y, z, w) values of the given source vector. - * + * * @param src */ public Vector4(final ReadOnlyVector4 src) { @@ -108,7 +109,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Constructs a new vector set to (x, y, z, w). - * + * * @param x * @param y * @param z @@ -201,7 +202,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect * to set to one of x, y, z or w. * @throws IllegalArgumentException * if index is not one of 0, 1, 2, 3. - * + * * if this vector is read only */ public void setValue(final int index, final double value) { @@ -224,7 +225,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Stores the double values of this vector in the given double array. - * + * * @param store * if null, a new double[4] array is created. * @return the double array @@ -246,7 +247,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the first component of this vector to the given double value. - * + * * @param x */ public void setX(final double x) { @@ -255,7 +256,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the second component of this vector to the given double value. - * + * * @param y */ public void setY(final double y) { @@ -264,7 +265,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the third component of this vector to the given double value. - * + * * @param z */ public void setZ(final double z) { @@ -273,7 +274,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the fourth component of this vector to the given double value. - * + * * @param w */ public void setW(final double w) { @@ -282,7 +283,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the value of this vector to (x, y, z, w) - * + * * @param x * @param y * @param z @@ -299,7 +300,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the value of this vector to the (x, y, z, w) values of the provided source vector. - * + * * @param source * @return this vector for chaining * @throws NullPointerException @@ -315,7 +316,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Sets the value of this vector to (0, 0, 0, 0) - * + * * @return this vector for chaining */ public Vector4 zero() { @@ -324,7 +325,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Adds the given values to those of this vector and returns them in store. - * + * * @param x * @param y * @param z @@ -345,7 +346,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Increments the values of this vector with the given x, y, z and w values. - * + * * @param x * @param y * @param z @@ -358,7 +359,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Adds the values of the given source vector to those of this vector and returns them in store. - * + * * @param source * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -373,7 +374,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Increments the values of this vector with the x, y, z and w values of the given vector. - * + * * @param source * @return this vector for chaining * @throws NullPointerException @@ -385,7 +386,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Subtracts the given values from those of this vector and returns them in store. - * + * * @param x * @param y * @param z @@ -406,7 +407,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Decrements the values of this vector by the given x, y, z and w values. - * + * * @param x * @param y * @param z @@ -419,7 +420,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Subtracts the values of the given source vector from those of this vector and returns them in store. - * + * * @param source * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -434,7 +435,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Decrements the values of this vector by the x, y, z and w values from the given source vector. - * + * * @param source * @return this vector for chaining * @throws NullPointerException @@ -446,7 +447,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Multiplies the values of this vector by the given scalar value and returns the result in store. - * + * * @param scalar * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -464,7 +465,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by multiplying them each by the given scalar value. - * + * * @param scalar * @return this vector for chaining */ @@ -474,7 +475,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Multiplies the values of this vector by the given scalar value and returns the result in store. - * + * * @param scale * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -492,7 +493,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by multiplying them each by the given scale values. - * + * * @param scale * @return this vector for chaining */ @@ -502,7 +503,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Multiplies the values of this vector by the given scalar value and returns the result in store. - * + * * @param x * @param y * @param z @@ -523,7 +524,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by multiplying them each by the given scale values. - * + * * @param x * @param y * @param z @@ -536,7 +537,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Divides the values of this vector by the given scalar value and returns the result in store. - * + * * @param scalar * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -554,11 +555,11 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by dividing them each by the given scalar value. - * + * * @param scalar * @return this vector for chaining - * - * + * + * * @throws ArithmeticException * if scalar is 0 */ @@ -570,7 +571,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Divides the values of this vector by the given scale values and returns the result in store. - * + * * @param scale * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. @@ -588,7 +589,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by dividing them each by the given scale values. - * + * * @param scale * @return this vector for chaining */ @@ -598,7 +599,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Divides the values of this vector by the given scale values and returns the result in store. - * + * * @param x * @param y * @param z @@ -619,7 +620,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Internally modifies the values of this vector by dividing them each by the given scale values. - * + * * @param x * @param y * @param z @@ -631,10 +632,10 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect } /** - * + * * Internally modifies this vector by multiplying its values with a given scale value, then adding a given "add" * value. - * + * * @param scale * the value to multiply this vector by. * @param add @@ -652,7 +653,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Scales this vector by multiplying its values with a given scale value, then adding a given "add" value. The * result is store in the given store parameter. - * + * * @param scale * the value to multiply by. * @param add @@ -695,7 +696,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Creates a new unit length vector from this one by dividing by length. If the length is 0, (ie, if the vector is * 0, 0, 0, 0) then a new vector (0, 0, 0, 0) is returned. - * + * * @param store * the vector to store the result in for return. If null, a new vector object is created and returned. * @return a new unit vector (or 0, 0, 0, 0 if this unit is 0 length) @@ -713,7 +714,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Converts this vector into a unit vector by dividing it internally by its length. If the length is 0, (ie, if the * vector is 0, 0, 0, 0) then no action is taken. - * + * * @return this vector for chaining */ public Vector4 normalizeLocal() { @@ -729,7 +730,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between this vector and the given end vector, using the given scalar as a * percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if * it is closer to 1, the result will be closer to the end value. The result is returned as a new vector object. - * + * * @param endVec * @param scalar * @param store @@ -756,12 +757,12 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between this vector and the given end vector, using the given scalar as a * percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if * it is closer to 1, the result will be closer to the end value. The result is stored back in this vector. - * + * * @param endVec * @param scalar * @return this vector for chaining - * - * + * + * * @throws NullPointerException * if endVec is null. */ @@ -777,7 +778,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the * result will be closer to the end value. The result is returned as a new vector object. - * + * * @param beginVec * @param endVec * @param scalar @@ -806,14 +807,14 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect * Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the * result will be closer to the end value. The result is stored back in this vector. - * + * * @param beginVec * @param endVec * @param changeAmnt * the scalar as a percent. * @return this vector for chaining - * - * + * + * * @throws NullPointerException * if beginVec or endVec are null. */ @@ -922,7 +923,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Check a vector... if it is null or its doubles are NaN or infinite, return false. Else return true. - * + * * @param vector * the vector to check * @return true or false as stated above. @@ -956,21 +957,8 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect */ @Override public int hashCode() { - int result = 17; - - final long x = Double.doubleToLongBits(getX()); - result += 31 * result + (int) (x ^ x >>> 32); - - final long y = Double.doubleToLongBits(getY()); - result += 31 * result + (int) (y ^ y >>> 32); - - final long z = Double.doubleToLongBits(getZ()); - result += 31 * result + (int) (z ^ z >>> 32); - - final long w = Double.doubleToLongBits(getW()); - result += 31 * result + (int) (w ^ w >>> 32); - - return result; + return Objects.hash(Double.valueOf(getX()), Double.valueOf(getY()), Double.valueOf(getZ()), + Double.valueOf(getW())); } /** @@ -1030,7 +1018,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Used with serialization. Not to be called manually. - * + * * @param in * ObjectInput * @throws IOException @@ -1046,7 +1034,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Used with serialization. Not to be called manually. - * + * * @param out * ObjectOutput * @throws IOException @@ -1078,7 +1066,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect /** * Releases a Vector4 back to be used by a future call to fetchTempInstance. TAKE CARE: this Vector4 object should * no longer have other classes referencing it or "Bad Things" will happen. - * + * * @param vec * the Vector4 to release. */ diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/ArchimedeanSpiralFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/ArchimedeanSpiralFunction3D.java index c2952c5..1affa90 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/ArchimedeanSpiralFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/ArchimedeanSpiralFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -57,6 +57,7 @@ public class ArchimedeanSpiralFunction3D implements Function3D { * * @return A result which is generally, but not always, in the -1 to 1 range. */ + @Override public double eval(final double x, final double y, final double z) { final double radius = Math.sqrt(x * x + y * y); diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/BrickGridFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/BrickGridFunction3D.java index 53b0909..b467da4 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/BrickGridFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/BrickGridFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/CheckerFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/CheckerFunction3D.java index b782051..d2457d5 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/CheckerFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/CheckerFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -17,6 +17,7 @@ import com.ardor3d.math.MathUtils; */ public class CheckerFunction3D implements Function3D { + @Override public double eval(final double x, final double y, final double z) { if ((MathUtils.floor(x) + MathUtils.floor(y) + MathUtils.floor(z)) % 2 == 0) { return -1; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/CloudsFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/CloudsFunction3D.java index 10dcb39..1bbebde 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/CloudsFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/CloudsFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/CylinderFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/CylinderFunction3D.java index 6ec23b0..36e51ce 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/CylinderFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/CylinderFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -30,6 +30,7 @@ public class CylinderFunction3D implements Function3D { setFrequency(frequency); } + @Override public double eval(final double x, final double y, final double z) { final double dx = x * _frequency; final double dz = z * _frequency; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/FbmFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/FbmFunction3D.java index 7aa48b4..f5cc355 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/FbmFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/FbmFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -54,6 +54,7 @@ public class FbmFunction3D implements Function3D { _lacunarity = lacunarity; } + @Override public double eval(final double x, final double y, final double z) { double sum = 0; double dx = x * _frequency, dy = y * _frequency, dz = z * _frequency; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/Function3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/Function3D.java index 143d858..633392c 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/Function3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/Function3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/Functions.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/Functions.java index b0ba25d..869bd06 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/Functions.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/Functions.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -25,6 +25,7 @@ public class Functions { */ public static Function3D constant(final double constant) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return constant; } @@ -39,6 +40,7 @@ public class Functions { */ public static Function3D scaleBias(final Function3D source, final double scale, final double bias) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return source.eval(x, y, z) * scale + bias; } @@ -51,6 +53,7 @@ public class Functions { */ public static Function3D abs(final Function3D source) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return Math.abs(source.eval(x, y, z)); } @@ -65,6 +68,7 @@ public class Functions { */ public static Function3D clamp(final Function3D source, final double min, final double max) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return MathUtils.clamp(source.eval(x, y, z), min, max); } @@ -77,6 +81,7 @@ public class Functions { */ public static Function3D invert(final Function3D source) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return -source.eval(x, y, z); } @@ -90,6 +95,7 @@ public class Functions { */ public static Function3D add(final Function3D sourceA, final Function3D sourceB) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return sourceA.eval(x, y, z) + sourceB.eval(x, y, z); } @@ -103,6 +109,7 @@ public class Functions { */ public static Function3D multiply(final Function3D sourceA, final Function3D sourceB) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return sourceA.eval(x, y, z) * sourceB.eval(x, y, z); } @@ -116,6 +123,7 @@ public class Functions { */ public static Function3D min(final Function3D sourceA, final Function3D sourceB) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return Math.min(sourceA.eval(x, y, z), sourceB.eval(x, y, z)); } @@ -129,6 +137,7 @@ public class Functions { */ public static Function3D max(final Function3D sourceA, final Function3D sourceB) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return Math.max(sourceA.eval(x, y, z), sourceB.eval(x, y, z)); } @@ -145,6 +154,7 @@ public class Functions { */ public static Function3D lerp(final Function3D sourceA, final Function3D sourceB, final double amount) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return MathUtils.lerp(amount, sourceA.eval(x, y, z), sourceB.eval(x, y, z)); } @@ -159,6 +169,7 @@ public class Functions { */ public static Function3D rotateInput(final Function3D source, final ReadOnlyMatrix3 rotation) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { final Vector3 temp = Vector3.fetchTempInstance(); temp.set(x, y, z); @@ -180,6 +191,7 @@ public class Functions { public static Function3D scaleInput(final Function3D source, final double scaleX, final double scaleY, final double scaleZ) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return source.eval(x * scaleX, y * scaleY, z * scaleZ); } @@ -196,6 +208,7 @@ public class Functions { public static Function3D translateInput(final Function3D source, final double transX, final double transY, final double transZ) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { return source.eval(x + transX, y + transY, z + transZ); } @@ -213,6 +226,7 @@ public class Functions { public static Function3D remap(final Function3D source, final double oldLow, final double oldHigh, final double newLow, final double newHigh) { return new Function3D() { + @Override public double eval(final double x, final double y, final double z) { double val = source.eval(x, y, z); // Zero out old domain @@ -233,6 +247,7 @@ public class Functions { return new Function3D() { SimplexNoise noiseGenerator = new SimplexNoise(); + @Override public double eval(final double x, final double y, final double z) { return noiseGenerator.noise(x, y, z); } diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/GridPatternFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/GridPatternFunction3D.java index 1d74d00..d3fa1c8 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/GridPatternFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/GridPatternFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -51,6 +51,7 @@ public class GridPatternFunction3D implements Function3D { * * @return */ + @Override public double eval(double x, double y, final double z) { x = Math.abs(x); y = Math.abs(y); diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/HexGridFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/HexGridFunction3D.java index 6452ede..657d6db 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/HexGridFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/HexGridFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/MandelbrotFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/MandelbrotFunction3D.java index d81c105..6331ad3 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/MandelbrotFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/MandelbrotFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -23,6 +23,7 @@ public class MandelbrotFunction3D implements Function3D { setIterations(iterations); } + @Override public double eval(final double x, final double y, final double z) { double dx = 0; double dy = 0; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/MapperFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/MapperFunction3D.java index 5502f7f..3ce582c 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/MapperFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/MapperFunction3D.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -22,12 +22,12 @@ import com.ardor3d.math.MathUtils; public class MapperFunction3D implements Function3D { private Function3D _mapFunction; - private final List<Entry> _entries = new ArrayList<Entry>(); + private final List<Entry> _entries = new ArrayList<>(); private double _domainStart, _domainEnd; /** * Construct a mapper function using the given map function and a start and end for the domain we'll use. - * + * * @param mapFunction * @param domainStart * @param domainEnd @@ -38,6 +38,8 @@ public class MapperFunction3D implements Function3D { _domainEnd = domainEnd; } + @SuppressWarnings("null") + @Override public double eval(final double x, final double y, final double z) { // grab a value from our map function. final double mappingValue = MathUtils.clamp(_mapFunction.eval(x, y, z), _domainStart, _domainEnd); @@ -65,7 +67,7 @@ public class MapperFunction3D implements Function3D { // check if we are in the ease-out region and have a next function. else if (next != null && mappingValue > end - current.easeOut) { // ...interpolate with a quintic S-curve. - final double ratio = ((mappingValue - end) / current.easeOut) + 1; + final double ratio = (mappingValue - end) / current.easeOut + 1; final double amount = MathUtils.scurve5(ratio); return MathUtils.lerp(amount, current.source.eval(x, y, z), next.source.eval(x, y, z)); } @@ -107,7 +109,7 @@ public class MapperFunction3D implements Function3D { /** * Add a new source function to the end of our set of ranged functions. Our place in the range is based on the place * of the previous source function and the offsetStart provided. - * + * * @param source * the new function to add * @param offsetStart @@ -119,7 +121,8 @@ public class MapperFunction3D implements Function3D { * a "fade out" range between this function and the next function, starting at the next function's * offsetStart - easeOut. Over this range we'll lerp between the two functions. */ - public void addFunction(final Function3D source, final double offsetStart, final double easeIn, final double easeOut) { + public void addFunction(final Function3D source, final double offsetStart, final double easeIn, + final double easeOut) { final Entry e = new Entry(); e.source = source; e.offsetStart = offsetStart; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/MeshFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/MeshFunction3D.java index e399d95..3b20a12 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/MeshFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/MeshFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -38,6 +38,7 @@ public class MeshFunction3D implements Function3D { /** * Evaluate the function. */ + @Override public double eval(final double x, final double y, final double z) { final double value = (Math.sin(x) + Math.sin(y) + Math.sin(z)) / _lineSize; return ((value * value) * 2.0) - 1.0; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/RidgeFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/RidgeFunction3D.java index 669c09b..fd72fa0 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/RidgeFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/RidgeFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -44,6 +44,7 @@ public class RidgeFunction3D implements Function3D { updateWeights(); } + @Override public double eval(final double x, final double y, final double z) { double value = 0, signal = 0, weight = 1; double dx = x * _frequency, dy = y * _frequency, dz = z * _frequency; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/SimplexNoise.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/SimplexNoise.java index ee0ec96..cf9e8fc 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/SimplexNoise.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/SimplexNoise.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/TurbulenceFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/TurbulenceFunction3D.java index be32008..a2f3566 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/TurbulenceFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/TurbulenceFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -40,6 +40,7 @@ public class TurbulenceFunction3D implements Function3D { _distortModule = new FbmFunction3D(Functions.simplexNoise(), roughness, frequency, 0.5, 2.0); } + @Override public double eval(final double x, final double y, final double z) { // tweak the incoming x, y, and z with some magic numbers to prevent singularities as integer boundaries. final double x0 = x + .1985; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/VoroniFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/VoroniFunction3D.java index f17ba34..05b189e 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/VoroniFunction3D.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/VoroniFunction3D.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -31,7 +31,7 @@ public class VoroniFunction3D implements Function3D { private int _seed = 0; // A cache for cube values - private final Map<Key, Vector3> _points = new HashMap<Key, Vector3>(); + private final Map<Key, Vector3> _points = new HashMap<>(); /** * Construct with default values. @@ -58,6 +58,7 @@ public class VoroniFunction3D implements Function3D { _seed = seed; } + @Override public double eval(final double x, final double y, final double z) { final double dx = x * _frequency, dy = y * _frequency, dz = z * _frequency; diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyColorRGBA.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyColorRGBA.java index 849b37d..fd5bfc9 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyColorRGBA.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyColorRGBA.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLine3.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLine3.java index 120f938..b55122e 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLine3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLine3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLine3Base.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLine3Base.java index cecb4a0..585bd4c 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLine3Base.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLine3Base.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLineSegment3.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLineSegment3.java index e321dbe..a456a16 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLineSegment3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyLineSegment3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyMatrix3.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyMatrix3.java index 3b71537..0dbc182 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyMatrix3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyMatrix3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyMatrix4.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyMatrix4.java index 07d6eda..28d90ff 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyMatrix4.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyMatrix4.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyPlane.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyPlane.java index 92b313a..7d6ddd4 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyPlane.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyPlane.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyQuaternion.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyQuaternion.java index 2adf747..63d0a23 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyQuaternion.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyQuaternion.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRay3.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRay3.java index 685dc4d..34932b2 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRay3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRay3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRectangle2.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRectangle2.java index d89c71d..7de3e75 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRectangle2.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRectangle2.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRectangle3.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRectangle3.java index 0de185d..d723ef5 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRectangle3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRectangle3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRing.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRing.java index 2d359e6..a6765a9 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRing.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyRing.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyTransform.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyTransform.java index 43eeccd..b1d9868 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyTransform.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyTransform.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyTriangle.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyTriangle.java index 3f6b109..3275df7 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyTriangle.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyTriangle.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector2.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector2.java index c2a07d3..724be96 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector2.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector2.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector3.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector3.java index 3138df4..ccb41dc 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector3.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector4.java b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector4.java index 8b9dd7a..5a6e1e8 100644 --- a/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector4.java +++ b/ardor3d-math/src/main/java/com/ardor3d/math/type/ReadOnlyVector4.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestColorRGBA.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestColorRGBA.java index 6126d67..95ec149 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestColorRGBA.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestColorRGBA.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestFastMath.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestFastMath.java index 37cde8b..8236b55 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestFastMath.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestFastMath.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestLine3.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestLine3.java index 3a62b6f..002b9fc 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestLine3.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestLine3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestLineSegment3.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestLineSegment3.java index eb5167a..b43846a 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestLineSegment3.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestLineSegment3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestMathExceptions.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestMathExceptions.java index a38074c..c300b52 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestMathExceptions.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestMathExceptions.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestMatrix3.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestMatrix3.java index 80d993c..5de2157 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestMatrix3.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestMatrix3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestMatrix4.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestMatrix4.java index e91ab5b..04471f2 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestMatrix4.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestMatrix4.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestObjectPool.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestObjectPool.java index 9ecfe95..37ee80e 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestObjectPool.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestObjectPool.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestPlane.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestPlane.java index cbae5fe..def7096 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestPlane.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestPlane.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestQuaternion.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestQuaternion.java index 4ef89e7..5c558eb 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestQuaternion.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestQuaternion.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestRay3.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestRay3.java index a7064ad..17da9a3 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestRay3.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestRay3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestRectangle2.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestRectangle2.java index 353813f..2dbca95 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestRectangle2.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestRectangle2.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestRectangle3.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestRectangle3.java index 8206045..a76f3d6 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestRectangle3.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestRectangle3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestRing.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestRing.java index f4db455..d30b688 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestRing.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestRing.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestTransform.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestTransform.java index b47c1c3..9d1a43e 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestTransform.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestTransform.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestTriangle.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestTriangle.java index fbba4c4..f280b79 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestTriangle.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestTriangle.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestValidatingTransform.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestValidatingTransform.java index 6821220..e1e549c 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestValidatingTransform.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestValidatingTransform.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestVector2.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestVector2.java index 2df1de8..d4c6b4b 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestVector2.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestVector2.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestVector3.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestVector3.java index 9146fc6..609be5f 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestVector3.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestVector3.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-math/src/test/java/com/ardor3d/math/TestVector4.java b/ardor3d-math/src/test/java/com/ardor3d/math/TestVector4.java index 98d39de..59c1915 100644 --- a/ardor3d-math/src/test/java/com/ardor3d/math/TestVector4.java +++ b/ardor3d-math/src/test/java/com/ardor3d/math/TestVector4.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-performance/.classpath b/ardor3d-performance/.classpath index 9e160b9..69713a5 100644 --- a/ardor3d-performance/.classpath +++ b/ardor3d-performance/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src/main/java"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry combineaccessrules="false" kind="src" path="/ardor3d-core"/> <classpathentry combineaccessrules="false" kind="src" path="/ardor3d-math"/> <classpathentry combineaccessrules="false" kind="src" path="/ardor3d-savable"/> diff --git a/ardor3d-performance/.settings/org.eclipse.jdt.core.prefs b/ardor3d-performance/.settings/org.eclipse.jdt.core.prefs index dfb6c07..a73fbb1 100644 --- a/ardor3d-performance/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-performance/.settings/org.eclipse.jdt.core.prefs @@ -1,14 +1,14 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/ardor3d-performance/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-performance/.settings/org.eclipse.jdt.ui.prefs index 8cbb22a..9e14bb1 100644 --- a/ardor3d-performance/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-performance/.settings/org.eclipse.jdt.ui.prefs @@ -78,7 +78,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=true diff --git a/ardor3d-savable/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-savable/.settings/org.eclipse.jdt.ui.prefs index 681065b..8dc21f4 100644 --- a/ardor3d-savable/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-savable/.settings/org.eclipse.jdt.ui.prefs @@ -84,7 +84,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=true diff --git a/ardor3d-savable/build.gradle b/ardor3d-savable/build.gradle new file mode 100644 index 0000000..dfc3dba --- /dev/null +++ b/ardor3d-savable/build.gradle @@ -0,0 +1,2 @@ + +description = 'Ardor 3D Savable' diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dExporter.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dExporter.java index 495bf6f..bd40c21 100644 --- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dExporter.java +++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dExporter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dImporter.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dImporter.java index 12a4277..747b5f1 100644 --- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dImporter.java +++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dImporter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java index 1c32f12..1380128 100644 --- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java +++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -22,7 +22,7 @@ public abstract class ByteUtils { /** * Takes an InputStream and returns the complete byte content of it - * + * * @param inputStream * The input stream to read from * @return The byte array containing the data from the input stream @@ -30,30 +30,28 @@ public abstract class ByteUtils { * thrown if there is a problem reading from the input stream provided */ public static byte[] getByteContent(final InputStream inputStream) throws IOException { - final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024); - final byte[] buffer = new byte[1024]; - int byteCount = -1; - byte[] data = null; - - // Read the byte content into the output stream first - while ((byteCount = inputStream.read(buffer)) > 0) { - outputStream.write(buffer, 0, byteCount); - } - - // Set data with byte content from stream - data = outputStream.toByteArray(); + try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024)) { + final byte[] buffer = new byte[1024]; + int byteCount = -1; + byte[] data = null; + + // Read the byte content into the output stream first + while ((byteCount = inputStream.read(buffer)) > 0) { + outputStream.write(buffer, 0, byteCount); + } - // Release resources - outputStream.close(); + // Set data with byte content from stream + data = outputStream.toByteArray(); - return data; + return data; + } } // ********** byte <> short METHODS ********** /** * Writes a short out to an OutputStream. - * + * * @param outputStream * The OutputStream the short will be written to * @param value @@ -79,7 +77,7 @@ public abstract class ByteUtils { /** * Read in a short from an InputStream - * + * * @param inputStream * The InputStream used to read the short * @return A short, which is the next 2 bytes converted from the InputStream @@ -111,7 +109,7 @@ public abstract class ByteUtils { /** * Writes an integer out to an OutputStream. - * + * * @param outputStream * The OutputStream the integer will be written to * @param integer @@ -139,7 +137,7 @@ public abstract class ByteUtils { /** * Read in an integer from an InputStream - * + * * @param inputStream * The InputStream used to read the integer * @return An int, which is the next 4 bytes converted from the InputStream @@ -172,7 +170,7 @@ public abstract class ByteUtils { /** * Writes a long out to an OutputStream. - * + * * @param outputStream * The OutputStream the long will be written to * @param value @@ -191,28 +189,28 @@ public abstract class ByteUtils { public static byte[] convertToBytes(long n) { final byte[] bytes = new byte[8]; - bytes[7] = (byte) (n); + bytes[7] = (byte) n; n >>>= 8; - bytes[6] = (byte) (n); + bytes[6] = (byte) n; n >>>= 8; - bytes[5] = (byte) (n); + bytes[5] = (byte) n; n >>>= 8; - bytes[4] = (byte) (n); + bytes[4] = (byte) n; n >>>= 8; - bytes[3] = (byte) (n); + bytes[3] = (byte) n; n >>>= 8; - bytes[2] = (byte) (n); + bytes[2] = (byte) n; n >>>= 8; - bytes[1] = (byte) (n); + bytes[1] = (byte) n; n >>>= 8; - bytes[0] = (byte) (n); + bytes[0] = (byte) n; return bytes; } /** * Read in a long from an InputStream - * + * * @param inputStream * The InputStream used to read the long * @return A long, which is the next 8 bytes converted from the InputStream @@ -236,17 +234,17 @@ public abstract class ByteUtils { public static long convertLongFromBytes(final byte[] bytes, final int offset) { // Convert it to an long - return ((((long) bytes[offset + 7]) & 0xFF) + ((((long) bytes[offset + 6]) & 0xFF) << 8) - + ((((long) bytes[offset + 5]) & 0xFF) << 16) + ((((long) bytes[offset + 4]) & 0xFF) << 24) - + ((((long) bytes[offset + 3]) & 0xFF) << 32) + ((((long) bytes[offset + 2]) & 0xFF) << 40) - + ((((long) bytes[offset + 1]) & 0xFF) << 48) + ((((long) bytes[offset + 0]) & 0xFF) << 56)); + return ((long) bytes[offset + 7] & 0xFF) + (((long) bytes[offset + 6] & 0xFF) << 8) + + (((long) bytes[offset + 5] & 0xFF) << 16) + (((long) bytes[offset + 4] & 0xFF) << 24) + + (((long) bytes[offset + 3] & 0xFF) << 32) + (((long) bytes[offset + 2] & 0xFF) << 40) + + (((long) bytes[offset + 1] & 0xFF) << 48) + (((long) bytes[offset + 0] & 0xFF) << 56); } // ********** byte <> double METHODS ********** /** * Writes a double out to an OutputStream. - * + * * @param outputStream * The OutputStream the double will be written to * @param value @@ -269,7 +267,7 @@ public abstract class ByteUtils { /** * Read in a double from an InputStream - * + * * @param inputStream * The InputStream used to read the double * @return A double, which is the next 8 bytes converted from the InputStream @@ -301,7 +299,7 @@ public abstract class ByteUtils { /** * Writes an float out to an OutputStream. - * + * * @param outputStream * The OutputStream the float will be written to * @param fVal @@ -324,7 +322,7 @@ public abstract class ByteUtils { /** * Read in a float from an InputStream - * + * * @param inputStream * The InputStream used to read the float * @return A float, which is the next 4 bytes converted from the InputStream @@ -356,7 +354,7 @@ public abstract class ByteUtils { /** * Writes a boolean out to an OutputStream. - * + * * @param outputStream * The OutputStream the boolean will be written to * @param bVal @@ -380,7 +378,7 @@ public abstract class ByteUtils { /** * Read in a boolean from an InputStream - * + * * @param inputStream * The InputStream used to read the boolean * @return A boolean, which is the next byte converted from the InputStream (iow, byte != 0) diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/CapsuleUtils.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/CapsuleUtils.java index 1d3cc35..9b90aab 100644 --- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/CapsuleUtils.java +++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/CapsuleUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/InputCapsule.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/InputCapsule.java index 8dd51b1..abbd113 100644 --- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/InputCapsule.java +++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/InputCapsule.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/OutputCapsule.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/OutputCapsule.java index 226bc40..67c79d0 100644 --- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/OutputCapsule.java +++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/OutputCapsule.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ReadListener.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ReadListener.java index ec9b724..b7c2411 100644 --- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ReadListener.java +++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ReadListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Savable.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Savable.java index d021554..9e3f34f 100644 --- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Savable.java +++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Savable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-swt/.settings/org.eclipse.jdt.core.prefs b/ardor3d-swt/.settings/org.eclipse.jdt.core.prefs index 16496e9..941c850 100644 --- a/ardor3d-swt/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-swt/.settings/org.eclipse.jdt.core.prefs @@ -89,12 +89,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs index 2cb0f4c..9cac248 100644 --- a/ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs @@ -59,7 +59,7 @@ org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\r\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\r\n *\r\n * This file is part of Ardor3D.\r\n *\r\n * Ardor3D is free software\: you can redistribute it and/or modify it \r\n * under the terms of its license which may be found in the accompanying\r\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\r\n */\r\n\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -82,7 +82,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false diff --git a/ardor3d-swt/build.gradle b/ardor3d-swt/build.gradle new file mode 100644 index 0000000..d57d225 --- /dev/null +++ b/ardor3d-swt/build.gradle @@ -0,0 +1,6 @@ + +description = 'Ardor 3D SWT' +dependencies { + compile project(':ardor3d-core') + compile group: 'org.eclipse.swt', name: 'org.eclipse.swt.gtk.linux.x86_64', version:'3.8' +} diff --git a/ardor3d-swt/src/main/java/com/ardor3d/framework/swt/SwtCanvas.java b/ardor3d-swt/src/main/java/com/ardor3d/framework/swt/SwtCanvas.java index 97aebf3..a2aa339 100644 --- a/ardor3d-swt/src/main/java/com/ardor3d/framework/swt/SwtCanvas.java +++ b/ardor3d-swt/src/main/java/com/ardor3d/framework/swt/SwtCanvas.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -75,11 +75,13 @@ public class SwtCanvas extends GLCanvas implements Canvas { _inited = true; } + @Override @MainThread public void init() { privateInit(); } + @Override @MainThread public void draw(final CountDownLatch latch) { if (!_inited) { @@ -98,6 +100,7 @@ public class SwtCanvas extends GLCanvas implements Canvas { latch.countDown(); } + @Override public CanvasRenderer getCanvasRenderer() { return _canvasRenderer; } diff --git a/ardor3d-swt/src/main/java/com/ardor3d/image/util/SWTImageUtil.java b/ardor3d-swt/src/main/java/com/ardor3d/image/util/SWTImageUtil.java index cb6348e..b4967b3 100644 --- a/ardor3d-swt/src/main/java/com/ardor3d/image/util/SWTImageUtil.java +++ b/ardor3d-swt/src/main/java/com/ardor3d/image/util/SWTImageUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.image.util; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.List; import org.eclipse.swt.graphics.Color; @@ -19,7 +20,6 @@ import org.eclipse.swt.graphics.PaletteData; import com.ardor3d.image.Image; import com.ardor3d.image.PixelDataType; -import com.google.common.collect.Lists; /** * Utility methods for converting Ardor3D Images to SWT ImageData. @@ -65,7 +65,7 @@ public abstract class SWTImageUtil { final int width = input.getWidth(), height = input.getHeight(); // create our return list - final List<ImageData> rVal = Lists.newArrayList(); + final List<ImageData> rVal = new ArrayList<>(); // Calculate our modulation or "tint" values per channel final double tRed = tint != null ? tint.getRed() / 255. : 1.0; diff --git a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtFocusWrapper.java b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtFocusWrapper.java index 930c43a..9a6a786 100644 --- a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtFocusWrapper.java +++ b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtFocusWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -30,14 +30,17 @@ public class SwtFocusWrapper implements FocusWrapper, FocusListener { _control = checkNotNull(control, "control"); } + @Override public void focusGained(final FocusEvent focusEvent) { // nothing to do } + @Override public void focusLost(final FocusEvent focusEvent) { _focusLost = true; } + @Override public boolean getAndClearFocusLost() { final boolean result = _focusLost; @@ -46,6 +49,7 @@ public class SwtFocusWrapper implements FocusWrapper, FocusListener { return result; } + @Override public void init() { _control.addFocusListener(this); } diff --git a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKey.java b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKey.java index be52efd..1d786fe 100644 --- a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKey.java +++ b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKey.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKeyboardWrapper.java b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKeyboardWrapper.java index 7a7535b..614bd40 100644 --- a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKeyboardWrapper.java +++ b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKeyboardWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -42,14 +42,16 @@ public class SwtKeyboardWrapper implements KeyboardWrapper, KeyListener { private Key _lastKeyPressed = null; public SwtKeyboardWrapper(final Control control) { - _upcomingEvents = new LinkedList<KeyEvent>(); + _upcomingEvents = new LinkedList<>(); _control = checkNotNull(control, "control"); } + @Override public void init() { _control.addKeyListener(this); } + @Override public synchronized PeekingIterator<KeyEvent> getEvents() { if (_currentIterator == null || !_currentIterator.hasNext()) { _currentIterator = new SwtKeyboardIterator(); @@ -58,6 +60,7 @@ public class SwtKeyboardWrapper implements KeyboardWrapper, KeyListener { return _currentIterator; } + @Override public synchronized void keyPressed(final org.eclipse.swt.events.KeyEvent event) { final Key key = fromKeyEventToKey(event); if (key == _lastKeyPressed) { @@ -81,6 +84,7 @@ public class SwtKeyboardWrapper implements KeyboardWrapper, KeyListener { _upcomingEvents.add(new KeyEvent(key, KeyState.DOWN, keyChar)); } + @Override public synchronized void keyReleased(final org.eclipse.swt.events.KeyEvent event) { _upcomingEvents.add(new KeyEvent(fromKeyEventToKey(event), KeyState.UP, event.character)); _lastKeyPressed = null; diff --git a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseManager.java b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseManager.java index 8918263..e0dd9cc 100644 --- a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseManager.java +++ b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -48,6 +48,7 @@ public class SwtMouseManager implements MouseManager { _control = control; } + @Override public void setCursor(final MouseCursor cursor) { if (cursor == MouseCursor.SYSTEM_DEFAULT) { _control.setCursor(null); @@ -62,11 +63,13 @@ public class SwtMouseManager implements MouseManager { _control.setCursor(swtCursor); } + @Override public void setPosition(final int x, final int y) { final Point p = new Point(x, _control.getSize().y - y); _control.getDisplay().setCursorLocation(_control.toDisplay(p)); } + @Override public void setGrabbed(final GrabbedState grabbedState) { if (!isSetGrabbedSupported()) { throw new UnsupportedOperationException(); @@ -105,14 +108,17 @@ public class SwtMouseManager implements MouseManager { return _transparentCursor; } + @Override public boolean isSetPositionSupported() { return true; } + @Override public boolean isSetGrabbedSupported() { return true; } + @Override public GrabbedState getGrabbed() { return _grabbedState; } diff --git a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseWrapper.java b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseWrapper.java index 46266d7..19a48f6 100644 --- a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseWrapper.java +++ b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseWrapper.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -30,7 +30,6 @@ import com.ardor3d.input.MouseState; import com.ardor3d.input.MouseWrapper; import com.google.common.collect.AbstractIterator; import com.google.common.collect.EnumMultiset; -import com.google.common.collect.Maps; import com.google.common.collect.Multiset; import com.google.common.collect.PeekingIterator; @@ -40,7 +39,7 @@ import com.google.common.collect.PeekingIterator; @ThreadSafe public class SwtMouseWrapper implements MouseWrapper, MouseListener, MouseMoveListener, MouseWheelListener { @GuardedBy("this") - private final LinkedList<MouseState> _upcomingEvents = new LinkedList<MouseState>(); + private final LinkedList<MouseState> _upcomingEvents = new LinkedList<>(); private final Control _control; @@ -51,7 +50,7 @@ public class SwtMouseWrapper implements MouseWrapper, MouseListener, MouseMoveLi private MouseState _lastState = null; private final Multiset<MouseButton> _clicks = EnumMultiset.create(MouseButton.class); - private final EnumMap<MouseButton, Long> _lastClickTime = Maps.newEnumMap(MouseButton.class); + private final EnumMap<MouseButton, Long> _lastClickTime = new EnumMap<>(MouseButton.class); private final EnumSet<MouseButton> _clickArmed = EnumSet.noneOf(MouseButton.class); public SwtMouseWrapper(final Control control) { @@ -61,12 +60,14 @@ public class SwtMouseWrapper implements MouseWrapper, MouseListener, MouseMoveLi } } + @Override public void init() { _control.addMouseListener(this); _control.addMouseMoveListener(this); _control.addMouseWheelListener(this); } + @Override public synchronized PeekingIterator<MouseState> getEvents() { expireClickEvents(); @@ -87,10 +88,12 @@ public class SwtMouseWrapper implements MouseWrapper, MouseListener, MouseMoveLi } } + @Override public synchronized void mouseDoubleClick(final MouseEvent mouseEvent) { - // ignoring this. We'll handle (multi)click in a uniform way + // ignoring this. We'll handle (multi)click in a uniform way } + @Override public synchronized void mouseDown(final MouseEvent e) { final MouseButton b = getButtonForEvent(e); if (_clickArmed.contains(b)) { @@ -108,6 +111,7 @@ public class SwtMouseWrapper implements MouseWrapper, MouseListener, MouseMoveLi addNewState(e, 0, buttons, null); } + @Override public synchronized void mouseUp(final MouseEvent e) { initState(e); @@ -164,12 +168,31 @@ public class SwtMouseWrapper implements MouseWrapper, MouseListener, MouseMoveLi case 2: button = MouseButton.MIDDLE; break; + case 4: + button = MouseButton.FOUR; + break; + case 5: + button = MouseButton.FIVE; + break; + case 6: + button = MouseButton.SIX; + break; + case 7: + button = MouseButton.SEVEN; + break; + case 8: + button = MouseButton.EIGHT; + break; + case 9: + button = MouseButton.NINE; + break; default: throw new RuntimeException("unknown button: " + e.button); } return button; } + @Override public synchronized void mouseMove(final MouseEvent mouseEvent) { _clickArmed.clear(); _clicks.clear(); @@ -180,6 +203,7 @@ public class SwtMouseWrapper implements MouseWrapper, MouseListener, MouseMoveLi addNewState(mouseEvent, 0, _lastState.getButtonStates(), null); } + @Override public synchronized void mouseScrolled(final MouseEvent mouseEvent) { initState(mouseEvent); diff --git a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java index ec93b17..ead864b 100644 --- a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java +++ b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtKeyboardWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java index 9af464d..9bece60 100644 --- a/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java +++ b/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/.settings/org.eclipse.jdt.core.prefs b/ardor3d-terrain/.settings/org.eclipse.jdt.core.prefs index d24ad96..3fa3efd 100644 --- a/ardor3d-terrain/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-terrain/.settings/org.eclipse.jdt.core.prefs @@ -91,12 +91,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-terrain/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-terrain/.settings/org.eclipse.jdt.ui.prefs index 6fb9f48..09672d1 100644 --- a/ardor3d-terrain/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-terrain/.settings/org.eclipse.jdt.ui.prefs @@ -63,7 +63,7 @@ org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -86,7 +86,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false diff --git a/ardor3d-terrain/ardorSettings.properties b/ardor3d-terrain/ardorSettings.properties index d455af7..2a7266b 100644 --- a/ardor3d-terrain/ardorSettings.properties +++ b/ardor3d-terrain/ardorSettings.properties @@ -3,7 +3,7 @@ SAMPLES=0 FREQ=-1 WIDTH=800 -RENDERER=LWJGL +RENDERER=JOGL HEIGHT=600 DEPTH=24 FULLSCREEN=false diff --git a/ardor3d-terrain/build.gradle b/ardor3d-terrain/build.gradle new file mode 100644 index 0000000..c4a1a0a --- /dev/null +++ b/ardor3d-terrain/build.gradle @@ -0,0 +1,6 @@ + +description = 'Ardor 3D Terrain' +dependencies { + compile project(':ardor3d-core') + compile project(':ardor3d-awt') +} diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/ClipmapLevel.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/ClipmapLevel.java index 1c48584..c25aea9 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/ClipmapLevel.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/ClipmapLevel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/Terrain.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/Terrain.java index cad6281..6087ddf 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/Terrain.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/Terrain.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,7 +11,6 @@ package com.ardor3d.extension.terrain.client; import java.io.IOException; -import java.io.InputStream; import java.nio.FloatBuffer; import java.util.ArrayList; import java.util.Collections; @@ -48,8 +47,7 @@ import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.event.DirtyType; import com.ardor3d.scenegraph.hint.DataMode; import com.ardor3d.util.resource.ResourceLocatorTool; -import com.google.common.collect.Lists; -import com.google.common.io.InputSupplier; +import com.google.common.io.ByteSource; /** * An implementation of geometry clipmapping @@ -75,7 +73,7 @@ public class Terrain extends Node implements Pickable { private GLSLShaderObjectsState _geometryClipmapShader; /** Reference to the texture clipmap */ - private final List<TextureClipmap> _textureClipmaps = Lists.newArrayList(); + private final List<TextureClipmap> _textureClipmaps = new ArrayList<>(); /** Reference to normal map */ private TextureClipmap _normalClipmap; @@ -83,10 +81,10 @@ public class Terrain extends Node implements Pickable { private final Vector3 transformedFrustumPos = new Vector3(); - private final DoubleBufferedList<Region> mailBox = new DoubleBufferedList<Region>(); + private final DoubleBufferedList<Region> mailBox = new DoubleBufferedList<>(); - private InputSupplier<? extends InputStream> vertexShader; - private InputSupplier<? extends InputStream> pixelShader; + private ByteSource vertexShader; + private ByteSource pixelShader; /** Timers for mailbox updates */ private long oldTime = 0; @@ -132,7 +130,7 @@ public class Terrain extends Node implements Pickable { // getSceneHints().setLightCombineMode(LightCombineMode.Off); try { - _clips = new ArrayList<ClipmapLevel>(); + _clips = new ArrayList<>(); final float heightScale = terrainConfiguration.getScale().getYf(); @@ -169,7 +167,7 @@ public class Terrain extends Node implements Pickable { setHeightRange(terrainConfiguration.getHeightRangeMin(), terrainConfiguration.getHeightRangeMax()); } - private final List<Long> timers = Lists.newArrayList(); + private final List<Long> timers = new ArrayList<>(); @Override protected void updateChildren(final double time) { @@ -421,8 +419,8 @@ public class Terrain extends Node implements Pickable { if (caps.isGLSLSupported()) { _geometryClipmapShader = new GLSLShaderObjectsState(); try { - _geometryClipmapShader.setVertexShader(vertexShader.getInput()); - _geometryClipmapShader.setFragmentShader(pixelShader.getInput()); + _geometryClipmapShader.setVertexShader(vertexShader.openStream()); + _geometryClipmapShader.setFragmentShader(pixelShader.openStream()); } catch (final IOException ex) { Terrain.logger .logp(Level.SEVERE, getClass().getName(), "init(Renderer)", "Could not load shaders.", ex); @@ -445,6 +443,7 @@ public class Terrain extends Node implements Pickable { } _geometryClipmapShader.setShaderDataLogic(new GLSLShaderDataLogic() { + @Override public void applyData(final GLSLShaderObjectsState shader, final Mesh mesh, final Renderer renderer) { if (mesh instanceof ClipmapLevel) { shader.setUniform("vertexDistance", (float) ((ClipmapLevel) mesh).getVertexDistance()); @@ -620,11 +619,11 @@ public class Terrain extends Node implements Pickable { return _clips; } - public void setVertexShader(final InputSupplier<? extends InputStream> vertexShader) { + public void setVertexShader(final ByteSource vertexShader) { this.vertexShader = vertexShader; } - public void setPixelShader(final InputSupplier<? extends InputStream> pixelShader) { + public void setPixelShader(final ByteSource pixelShader) { this.pixelShader = pixelShader; } diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainBuilder.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainBuilder.java index 0a132d5..49ad44b 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainBuilder.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainBuilder.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.terrain.client; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; @@ -26,7 +27,6 @@ import com.ardor3d.extension.terrain.util.TerrainGridCachePanel; import com.ardor3d.extension.terrain.util.TextureGridCachePanel; import com.ardor3d.math.Vector3; import com.ardor3d.renderer.Camera; -import com.google.common.collect.Lists; import com.google.common.util.concurrent.ThreadFactoryBuilder; public class TerrainBuilder { @@ -51,7 +51,7 @@ public class TerrainBuilder { private boolean showDebugPanels = false; - private final List<TextureSource> extraTextureSources = Lists.newArrayList(); + private final List<TextureSource> extraTextureSources = new ArrayList<>(); public TerrainBuilder(final TerrainDataProvider terrainDataProvider, final Camera camera) { this.terrainDataProvider = terrainDataProvider; @@ -112,7 +112,7 @@ public class TerrainBuilder { logger.info("server clipmapLevels: " + clipmapLevels); - final List<TerrainCache> cacheList = Lists.newArrayList(); + final List<TerrainCache> cacheList = new ArrayList<>(); TerrainCache parentCache = null; final int baseLevel = Math.max(clipmapLevels - clipLevelCount, 0); @@ -167,7 +167,7 @@ public class TerrainBuilder { logger.info("server clipmapLevels: " + clipmapLevels); - final List<TextureCache> cacheList = Lists.newArrayList(); + final List<TextureCache> cacheList = new ArrayList<>(); TextureCache parentCache = null; final int baseLevel = Math.max(clipmapLevels - textureClipLevelCount, 0); int level = textureClipLevelCount - 1; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainCache.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainCache.java index d889e69..aed8da5 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainCache.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainCache.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainConfiguration.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainConfiguration.java index e8362ca..6193172 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainConfiguration.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainConfiguration.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainDataProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainDataProvider.java index e1ca2a7..eb89f12 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainDataProvider.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainDataProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java index fb772cc..1e50ba7 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -11,7 +11,9 @@ package com.ardor3d.extension.terrain.client; import java.nio.FloatBuffer; +import java.util.HashSet; import java.util.Iterator; +import java.util.Objects; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.Future; @@ -24,7 +26,6 @@ import com.ardor3d.extension.terrain.util.Region; import com.ardor3d.extension.terrain.util.Tile; import com.ardor3d.math.MathUtils; import com.ardor3d.math.type.ReadOnlyVector3; -import com.google.common.collect.Sets; /** * Special tile/grid based cache for terrain data @@ -48,9 +49,9 @@ public class TerrainGridCache implements TerrainCache, Runnable { private final int clipmapLevel; private final int requestedLevel; - private final Set<TileLoadingData> currentTiles = Sets.newHashSet(); - private Set<TileLoadingData> newThreadTiles = Sets.newHashSet(); - private Set<TileLoadingData> backThreadTiles = Sets.newHashSet(); + private final Set<TileLoadingData> currentTiles = new HashSet<>(); + private Set<TileLoadingData> newThreadTiles = new HashSet<>(); + private Set<TileLoadingData> backThreadTiles = new HashSet<>(); private final Object SWAP_LOCK = new Object(); private int backCurrentTileX = Integer.MAX_VALUE; private int backCurrentTileY = Integer.MAX_VALUE; @@ -66,12 +67,12 @@ public class TerrainGridCache implements TerrainCache, Runnable { private boolean exit = false; private final boolean enableDebug = true; - private final Set<TileLoadingData> debugTiles = Sets.newHashSet(); + private final Set<TileLoadingData> debugTiles = new HashSet<>(); public Set<TileLoadingData> getDebugTiles() { Set<TileLoadingData> copyTiles = null; synchronized (debugTiles) { - copyTiles = Sets.newHashSet(debugTiles); + copyTiles = new HashSet<>(debugTiles); } return copyTiles; } @@ -122,8 +123,8 @@ public class TerrainGridCache implements TerrainCache, Runnable { public Set<Tile> handleUpdateRequests() { Set<Tile> updateTiles; try { - updateTiles = source.getInvalidTiles(requestedLevel, backCurrentTileX - cacheSize / 2, backCurrentTileY - - cacheSize / 2, cacheSize, cacheSize); + updateTiles = source.getInvalidTiles(requestedLevel, backCurrentTileX - cacheSize / 2, + backCurrentTileY - cacheSize / 2, cacheSize, cacheSize); if (updateTiles == null || updateTiles.isEmpty()) { return null; } @@ -160,6 +161,7 @@ public class TerrainGridCache implements TerrainCache, Runnable { return updateTiles; } + @Override public void setCurrentPosition(final int x, final int y) { final int tileX = MathUtils.floor((float) x / tileSize); final int tileY = MathUtils.floor((float) y / tileSize); @@ -175,7 +177,7 @@ public class TerrainGridCache implements TerrainCache, Runnable { backCurrentTileX = tileX; backCurrentTileY = tileY; - final Set<TileLoadingData> newTiles = Sets.newHashSet(); + final Set<TileLoadingData> newTiles = new HashSet<>(); for (int i = 0; i < cacheSize; i++) { for (int j = 0; j < cacheSize; j++) { final int sourceX = tileX + j - cacheSize / 2; @@ -264,8 +266,8 @@ public class TerrainGridCache implements TerrainCache, Runnable { || tileY <= locatorTile.getY() - locatorSize / 2 + 1 || tileY >= locatorTile.getY() + locatorSize / 2 - 2) { try { - validTiles = source.getValidTiles(requestedLevel, tileX - locatorSize / 2, tileY - locatorSize - / 2, locatorSize, locatorSize); + validTiles = source.getValidTiles(requestedLevel, tileX - locatorSize / 2, + tileY - locatorSize / 2, locatorSize, locatorSize); } catch (final Exception e) { logger.log(Level.WARNING, "Exception getting source info", e); } @@ -559,7 +561,8 @@ public class TerrainGridCache implements TerrainCache, Runnable { final int vertexDistance = MathUtils.pow2(clipmapLevel); final Region region = new Region(clipmapLevel, sourceTile.getX() * tileSize * vertexDistance, - sourceTile.getY() * tileSize * vertexDistance, tileSize * vertexDistance, tileSize * vertexDistance); + sourceTile.getY() * tileSize * vertexDistance, tileSize * vertexDistance, + tileSize * vertexDistance); if (mailBox != null) { mailBox.add(region); } @@ -580,11 +583,7 @@ public class TerrainGridCache implements TerrainCache, Runnable { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (destTile == null ? 0 : destTile.hashCode()); - result = prime * result + (sourceTile == null ? 0 : sourceTile.hashCode()); - return result; + return Objects.hash(destTile, sourceTile); } @Override @@ -630,6 +629,7 @@ public class TerrainGridCache implements TerrainCache, Runnable { } } + @Override public boolean isValid() { int nrValid = 0; for (final TileLoadingData data : currentTiles) { @@ -640,10 +640,12 @@ public class TerrainGridCache implements TerrainCache, Runnable { return nrValid != 0; } + @Override public void setMailBox(final DoubleBufferedList<Region> mailBox) { this.mailBox = mailBox; } + @Override public void shutdown() { exit = true; started = false; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureCache.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureCache.java index f6d9aaa..b3a2391 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureCache.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureCache.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureClipmap.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureClipmap.java index be2461f..bab0b61 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureClipmap.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureClipmap.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -13,8 +13,10 @@ package com.ardor3d.extension.terrain.client; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.logging.Level; @@ -28,9 +30,9 @@ import com.ardor3d.image.Image; import com.ardor3d.image.ImageDataFormat; import com.ardor3d.image.PixelDataType; import com.ardor3d.image.Texture; -import com.ardor3d.image.Texture3D; import com.ardor3d.image.Texture.MagnificationFilter; import com.ardor3d.image.Texture.MinificationFilter; +import com.ardor3d.image.Texture3D; import com.ardor3d.math.MathUtils; import com.ardor3d.math.Vector3; import com.ardor3d.math.type.ReadOnlyVector3; @@ -39,8 +41,6 @@ import com.ardor3d.renderer.state.GLSLShaderObjectsState; import com.ardor3d.util.TextureKey; import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.resource.ResourceLocatorTool; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; /** * An implementation of texture clipmapping @@ -60,7 +60,7 @@ public class TextureClipmap { private Texture3D textureClipmap; private GLSLShaderObjectsState textureClipmapShader; - private final List<LevelData> levelDataList = Lists.newArrayList(); + private final List<LevelData> levelDataList = new ArrayList<>(); private final FloatBuffer sliceDataBuffer; @@ -70,7 +70,7 @@ public class TextureClipmap { private final List<TextureCache> cacheList; - private final DoubleBufferedList<Region> mailBox = new DoubleBufferedList<Region>(); + private final DoubleBufferedList<Region> mailBox = new DoubleBufferedList<>(); private final boolean useAlpha; private final int colorBits; @@ -115,7 +115,7 @@ public class TextureClipmap { createTexture(); } - private final List<Long> timers = Lists.newArrayList(); + private final List<Long> timers = new ArrayList<>(); public void update(final Renderer renderer, final ReadOnlyVector3 position) { eyePosition.set(position); @@ -279,7 +279,7 @@ public class TextureClipmap { Collections.sort(regionList, regionSorter); - final Set<Integer> affectedUnits = Sets.newHashSet(); + final Set<Integer> affectedUnits = new HashSet<>(); for (int i = regionList.size() - 1; i >= 0; i--) { final Region region = regionList.get(i); @@ -326,8 +326,8 @@ public class TextureClipmap { final Region region = new Region(level - 1, x * 2, y * 2, width * 2, height * 2); if (!regionList.contains(region)) { regionList.add(region); - recursiveAddUpdates(regionList, region.getLevel(), region.getX(), region.getY(), region.getWidth(), region - .getHeight()); + recursiveAddUpdates(regionList, region.getLevel(), region.getX(), region.getY(), region.getWidth(), + region.getHeight()); } } diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureConfiguration.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureConfiguration.java index 6ad448d..43c05d1 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureConfiguration.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureConfiguration.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureGridCache.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureGridCache.java index 27df40d..db59784 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureGridCache.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureGridCache.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -11,7 +11,9 @@ package com.ardor3d.extension.terrain.client; import java.nio.ByteBuffer; +import java.util.HashSet; import java.util.Iterator; +import java.util.Objects; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.Future; @@ -27,7 +29,6 @@ import com.ardor3d.extension.terrain.util.Region; import com.ardor3d.extension.terrain.util.Tile; import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.math.MathUtils; -import com.google.common.collect.Sets; /** * Special tile/grid based cache for texture data @@ -51,9 +52,9 @@ public class TextureGridCache implements TextureCache, Runnable { private final int clipmapLevel; private final int requestedLevel; - private final Set<TileLoadingData> currentTiles = Sets.newHashSet(); - private Set<TileLoadingData> newThreadTiles = Sets.newHashSet(); - private Set<TileLoadingData> backThreadTiles = Sets.newHashSet(); + private final Set<TileLoadingData> currentTiles = new HashSet<>(); + private Set<TileLoadingData> newThreadTiles = new HashSet<>(); + private Set<TileLoadingData> backThreadTiles = new HashSet<>(); private final Object SWAP_LOCK = new Object(); private int backCurrentTileX = Integer.MAX_VALUE; private int backCurrentTileY = Integer.MAX_VALUE; @@ -69,12 +70,12 @@ public class TextureGridCache implements TextureCache, Runnable { // Debug private final boolean enableDebug = true; - private final Set<TileLoadingData> debugTiles = Sets.newHashSet(); + private final Set<TileLoadingData> debugTiles = new HashSet<>(); public Set<TileLoadingData> getDebugTiles() { Set<TileLoadingData> copyTiles = null; synchronized (debugTiles) { - copyTiles = Sets.newHashSet(debugTiles); + copyTiles = new HashSet<>(debugTiles); } return copyTiles; } @@ -129,8 +130,8 @@ public class TextureGridCache implements TextureCache, Runnable { public Set<Tile> handleUpdateRequests() { Set<Tile> updateTiles; try { - updateTiles = source.getInvalidTiles(requestedLevel, backCurrentTileX - cacheSize / 2, backCurrentTileY - - cacheSize / 2, cacheSize, cacheSize); + updateTiles = source.getInvalidTiles(requestedLevel, backCurrentTileX - cacheSize / 2, + backCurrentTileY - cacheSize / 2, cacheSize, cacheSize); if (updateTiles == null || updateTiles.isEmpty()) { return null; } @@ -158,8 +159,8 @@ public class TextureGridCache implements TextureCache, Runnable { final int destX = MathUtils.moduloPositive(tile.getX(), cacheSize); final int destY = MathUtils.moduloPositive(tile.getY(), cacheSize); - final TextureStoreFormat format = textureConfiguration.getTextureDataType(source.getContributorId( - requestedLevel, tile)); + final TextureStoreFormat format = textureConfiguration + .getTextureDataType(source.getContributorId(requestedLevel, tile)); CacheFunctionUtil.applyFunction(useAlpha, function, sourceData, data, destX, destY, format, tileSize, dataSize); } @@ -167,6 +168,7 @@ public class TextureGridCache implements TextureCache, Runnable { return updateTiles; } + @Override public void setCurrentPosition(final int x, final int y) { final int tileX = MathUtils.floor((float) x / tileSize); final int tileY = MathUtils.floor((float) y / tileSize); @@ -182,7 +184,7 @@ public class TextureGridCache implements TextureCache, Runnable { backCurrentTileX = tileX; backCurrentTileY = tileY; - final Set<TileLoadingData> newTiles = Sets.newHashSet(); + final Set<TileLoadingData> newTiles = new HashSet<>(); for (int i = 0; i < cacheSize; i++) { for (int j = 0; j < cacheSize; j++) { final int sourceX = tileX + j - cacheSize / 2; @@ -272,8 +274,8 @@ public class TextureGridCache implements TextureCache, Runnable { || tileY <= locatorTile.getY() - locatorSize / 2 + 1 || tileY >= locatorTile.getY() + locatorSize / 2 - 2) { try { - validTiles = source.getValidTiles(requestedLevel, tileX - locatorSize / 2, tileY - locatorSize - / 2, locatorSize, locatorSize); + validTiles = source.getValidTiles(requestedLevel, tileX - locatorSize / 2, + tileY - locatorSize / 2, locatorSize, locatorSize); } catch (final Exception e) { logger.log(Level.WARNING, "Exception getting source info", e); } @@ -409,8 +411,8 @@ public class TextureGridCache implements TextureCache, Runnable { destinationData.put(rgbArray, 0, (destinationSize - dataX) * colorBits); destinationData.position(destIndex); - destinationData.put(rgbArray, (destinationSize - dataX) * colorBits, (dataX + width - destinationSize) - * colorBits); + destinationData.put(rgbArray, (destinationSize - dataX) * colorBits, + (dataX + width - destinationSize) * colorBits); } else { final int destIndex = (dataY * destinationSize + dataX) * colorBits; destinationData.position(destIndex); @@ -449,9 +451,8 @@ public class TextureGridCache implements TextureCache, Runnable { public TileLoadingData(final DoubleBufferedList<Region> mailBox, final Tile sourceTile, final Tile destTile, final TextureSource source, final CacheData[][] cache, final byte[] data, final int tileSize, - final int dataSize, final SourceCacheFunction function, - final TextureConfiguration textureConfiguration, final boolean useAlpha, final int clipmapLevel, - final int requestedLevel) { + final int dataSize, final SourceCacheFunction function, final TextureConfiguration textureConfiguration, + final boolean useAlpha, final int clipmapLevel, final int requestedLevel) { this.mailBox = mailBox; this.sourceTile = sourceTile; @@ -493,8 +494,8 @@ public class TextureGridCache implements TextureCache, Runnable { return false; } - final TextureStoreFormat format = textureConfiguration.getTextureDataType(source.getContributorId( - requestedLevel, sourceTile)); + final TextureStoreFormat format = textureConfiguration + .getTextureDataType(source.getContributorId(requestedLevel, sourceTile)); CacheFunctionUtil.applyFunction(useAlpha, function, sourceData, data, destTile.getX(), destTile.getY(), format, tileSize, dataSize); @@ -527,11 +528,7 @@ public class TextureGridCache implements TextureCache, Runnable { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (destTile == null ? 0 : destTile.hashCode()); - result = prime * result + (sourceTile == null ? 0 : sourceTile.hashCode()); - return result; + return Objects.hash(destTile, sourceTile); } @Override @@ -577,6 +574,7 @@ public class TextureGridCache implements TextureCache, Runnable { } } + @Override public boolean isValid() { int nrValid = 0; for (final TileLoadingData data : currentTiles) { @@ -587,6 +585,7 @@ public class TextureGridCache implements TextureCache, Runnable { return nrValid != 0; } + @Override public void setMailBox(final DoubleBufferedList<Region> mailBox) { this.mailBox = mailBox; } @@ -599,6 +598,7 @@ public class TextureGridCache implements TextureCache, Runnable { this.function = function; } + @Override public void shutdown() { exit = true; started = false; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/UrlInputSupplier.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/UrlInputSupplier.java index 99bec4d..5dee8af 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/UrlInputSupplier.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/UrlInputSupplier.java @@ -1,20 +1,21 @@ -package com.ardor3d.extension.terrain.client; -import com.google.common.io.InputSupplier; +package com.ardor3d.extension.terrain.client; import java.io.IOException; import java.io.InputStream; import java.net.URL; -public class UrlInputSupplier implements InputSupplier<InputStream> { - private final URL url; +import com.google.common.io.ByteSource; + +public class UrlInputSupplier extends ByteSource { + private final URL url; - public UrlInputSupplier(URL url) { - this.url = url; - } + public UrlInputSupplier(final URL url) { + this.url = url; + } - @Override - public InputStream getInput() throws IOException { - return url.openStream(); - } + @Override + public InputStream openStream() throws IOException { + return url.openStream(); + } } diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance12ToRGBFunction.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance12ToRGBFunction.java index a2d5102..dfeac17 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance12ToRGBFunction.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance12ToRGBFunction.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -24,6 +24,7 @@ public class Luminance12ToRGBFunction implements SourceCacheFunction { return INSTANCE; } + @Override public void doConversion(final ByteBuffer sourceData, final byte[] store, final int destX, final int destY, final int dataSize, final int tileSize) { final int offset = (destY * tileSize * dataSize + destX * tileSize) * 3; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance8Alpha8ToRGBAFunction.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance8Alpha8ToRGBAFunction.java index 7cdc316..11a562c 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance8Alpha8ToRGBAFunction.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance8Alpha8ToRGBAFunction.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance8ToRGBFunction.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance8ToRGBFunction.java index 983851a..e7d0bf7 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance8ToRGBFunction.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/Luminance8ToRGBFunction.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -23,6 +23,7 @@ public class Luminance8ToRGBFunction implements SourceCacheFunction { return INSTANCE; } + @Override public void doConversion(final ByteBuffer sourceData, final byte[] store, final int destX, final int destY, final int dataSize, final int tileSize) { final int offset = (destY * tileSize * dataSize + destX * tileSize) * 3; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGB8ToRGBAFunction.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGB8ToRGBAFunction.java index 836ae39..6ed787e 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGB8ToRGBAFunction.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGB8ToRGBAFunction.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -23,6 +23,7 @@ public class RGB8ToRGBAFunction implements SourceCacheFunction { return INSTANCE; } + @Override public void doConversion(final ByteBuffer sourceData, final byte[] store, final int destX, final int destY, final int dataSize, final int tileSize) { try { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGB8ToRGBFunction.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGB8ToRGBFunction.java index 6a161f6..cdc6fa2 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGB8ToRGBFunction.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGB8ToRGBFunction.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -23,6 +23,7 @@ public class RGB8ToRGBFunction implements SourceCacheFunction { return INSTANCE; } + @Override public void doConversion(final ByteBuffer sourceData, final byte[] store, final int destX, final int destY, final int dataSize, final int tileSize) { try { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGBA8ToRGBAFunction.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGBA8ToRGBAFunction.java index 88ca47a..345a313 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGBA8ToRGBAFunction.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGBA8ToRGBAFunction.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -23,6 +23,7 @@ public class RGBA8ToRGBAFunction implements SourceCacheFunction { return INSTANCE; } + @Override public void doConversion(final ByteBuffer sourceData, final byte[] store, final int destX, final int destY, final int dataSize, final int tileSize) { try { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGBA8ToRGBFunction.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGBA8ToRGBFunction.java index 8c0c4df..d457786 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGBA8ToRGBFunction.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/RGBA8ToRGBFunction.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -23,6 +23,7 @@ public class RGBA8ToRGBFunction implements SourceCacheFunction { return INSTANCE; } + @Override public void doConversion(final ByteBuffer sourceData, final byte[] store, final int destX, final int destY, final int dataSize, final int tileSize) { try { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/SourceCacheFunction.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/SourceCacheFunction.java index c999a64..0f3be01 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/SourceCacheFunction.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/SourceCacheFunction.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/ImageHeightMap.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/ImageHeightMap.java index 99a816a..a810987 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/ImageHeightMap.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/ImageHeightMap.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/MidPointHeightMapGenerator.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/MidPointHeightMapGenerator.java index 20c26fa..56e68e8 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/MidPointHeightMapGenerator.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/MidPointHeightMapGenerator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/RawHeightMap.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/RawHeightMap.java index 032f32d..cf2ef71 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/RawHeightMap.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/RawHeightMap.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -83,7 +83,7 @@ public class RawHeightMap { /** * <code>load</code> fills the height data array with the appropriate data from the set RAW image stream or file. - * + * * @return true if the load is successful, false otherwise. */ public boolean loadHeightmap() { @@ -91,14 +91,14 @@ public class RawHeightMap { heightData = new float[size * size]; // attempt to connect to the supplied file. - BufferedInputStream bis = null; - try { - bis = new BufferedInputStream(stream); - final DataInputStream dis = new DataInputStream(bis); - DataInput di = dis; + try (final BufferedInputStream bis = new BufferedInputStream(stream); + final DataInputStream dis = new DataInputStream(bis)) { + final DataInput di; if (isLittleEndian) { di = new LittleEndianDataInput(dis); + } else { + di = dis; } // read the raw file @@ -143,7 +143,6 @@ public class RawHeightMap { } } } - dis.close(); } catch (final IOException e1) { logger.warning("Error reading height data from stream."); return false; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainDataProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainDataProvider.java index 21e9062..7be5466 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainDataProvider.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainDataProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,7 +10,9 @@ package com.ardor3d.extension.terrain.providers.array; +import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,8 +23,6 @@ import com.ardor3d.extension.terrain.providers.image.ImageTextureSource; import com.ardor3d.extension.terrain.util.NormalMapUtil; import com.ardor3d.image.Image; import com.ardor3d.math.type.ReadOnlyVector3; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; public class ArrayTerrainDataProvider implements TerrainDataProvider { private static final int tileSize = 128; @@ -49,8 +49,8 @@ public class ArrayTerrainDataProvider implements TerrainDataProvider { final int clipLevelCount = 6; int currentSize = size; - heightMaps = Lists.newArrayList(); - heightMapSizes = Lists.newArrayList(); + heightMaps = new ArrayList<>(); + heightMapSizes = new ArrayList<>(); heightMaps.add(data); heightMapSizes.add(currentSize); float[] parentHeightMap = data; @@ -73,7 +73,7 @@ public class ArrayTerrainDataProvider implements TerrainDataProvider { @Override public Map<Integer, String> getAvailableMaps() throws Exception { - final Map<Integer, String> maps = Maps.newHashMap(); + final Map<Integer, String> maps = new HashMap<>(); maps.put(0, "ArrayBasedMap"); return maps; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainSource.java index 990570c..1002004 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.terrain.providers.array; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -17,7 +18,6 @@ import com.ardor3d.extension.terrain.client.TerrainConfiguration; import com.ardor3d.extension.terrain.client.TerrainSource; import com.ardor3d.extension.terrain.util.Tile; import com.ardor3d.math.type.ReadOnlyVector3; -import com.google.common.collect.Sets; public class ArrayTerrainSource implements TerrainSource { private final int tileSize; @@ -52,7 +52,7 @@ public class ArrayTerrainSource implements TerrainSource { @Override public Set<Tile> getValidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX, final int numTilesY) throws Exception { - final Set<Tile> validTiles = Sets.newHashSet(); + final Set<Tile> validTiles = new HashSet<>(); final int heightMapSize = heightMapSizes.get(clipmapLevel); for (int y = 0; y < numTilesY; y++) { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTextureSource.java index 218d39a..7074245 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTextureSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTextureSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,8 @@ package com.ardor3d.extension.terrain.providers.array; import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -20,8 +22,6 @@ import com.ardor3d.extension.terrain.client.TextureSource; import com.ardor3d.extension.terrain.util.Tile; import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; public class ArrayTextureSource implements TextureSource { private final int tileSize; @@ -43,7 +43,7 @@ public class ArrayTextureSource implements TextureSource { @Override public TextureConfiguration getConfiguration() throws Exception { - final Map<Integer, TextureStoreFormat> textureStoreFormat = Maps.newHashMap(); + final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>(); textureStoreFormat.put(0, TextureStoreFormat.Luminance8); return new TextureConfiguration(heightMaps.size(), textureStoreFormat, tileSize, 1f, true, false); @@ -52,7 +52,7 @@ public class ArrayTextureSource implements TextureSource { @Override public Set<Tile> getValidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX, final int numTilesY) throws Exception { - final Set<Tile> validTiles = Sets.newHashSet(); + final Set<Tile> validTiles = new HashSet<>(); final int heightMapSize = heightMapSizes.get(clipmapLevel); for (int y = 0; y < numTilesY; y++) { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AbstractAwtElement.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AbstractAwtElement.java index a56eacb..24d6c20 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AbstractAwtElement.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AbstractAwtElement.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -14,6 +14,7 @@ import java.awt.AlphaComposite; import java.awt.Composite; import java.awt.RenderingHints; import java.awt.image.BufferedImage; +import java.util.HashMap; import java.util.Map; import com.ardor3d.math.Transform; @@ -21,14 +22,13 @@ import com.ardor3d.math.Vector3; import com.ardor3d.math.Vector4; import com.ardor3d.math.type.ReadOnlyTransform; import com.ardor3d.math.type.ReadOnlyVector4; -import com.google.common.collect.Maps; public abstract class AbstractAwtElement { protected final Transform _transform = new Transform(); protected Composite _compositeOverride; protected ElementUpdateListener _listener; - protected Map<RenderingHints.Key, Object> hints = Maps.newHashMap(); + protected Map<RenderingHints.Key, Object> hints = new HashMap<>(); protected Vector4 _awtBounds = new Vector4(); @@ -69,10 +69,10 @@ public abstract class AbstractAwtElement { updateBoundsFromElement(); // So apply transform - final double x = _awtBounds.getX(), y = _awtBounds.getY(), width = _awtBounds.getZ(), height = _awtBounds - .getW(); + final double x = _awtBounds.getX(), y = _awtBounds.getY(), width = _awtBounds.getZ(), + height = _awtBounds.getW(); final Vector3[] vects = new Vector3[] { // - // + // new Vector3(x, y, 0), // new Vector3(x + width, y, 0), // new Vector3(x + width, y + height, 0), // diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtElementProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtElementProvider.java index c8b5ae4..02d5965 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtElementProvider.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtElementProvider.java @@ -1,23 +1,23 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.terrain.providers.awt; +import java.util.LinkedList; import java.util.List; import com.ardor3d.math.type.ReadOnlyVector4; -import com.google.common.collect.Lists; public class AwtElementProvider implements ElementUpdateListener { - private final List<AbstractAwtElement> _elements = Lists.newLinkedList(); - private final List<ElementUpdateListener> _updateListeners = Lists.newLinkedList(); + private final List<AbstractAwtElement> _elements = new LinkedList<>(); + private final List<ElementUpdateListener> _updateListeners = new LinkedList<>(); public List<AbstractAwtElement> getElements() { return _elements; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtImageElement.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtImageElement.java index a16a090..7f0bafb 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtImageElement.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtImageElement.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtShapeElement.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtShapeElement.java index bbfcdc8..b8bd5a2 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtShapeElement.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtShapeElement.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -18,13 +18,13 @@ import java.awt.RenderingHints; import java.awt.Shape; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.util.HashMap; import java.util.Map; import com.ardor3d.math.MathUtils; import com.ardor3d.math.Transform; import com.ardor3d.math.Vector4; import com.ardor3d.math.type.ReadOnlyTransform; -import com.google.common.collect.Maps; public class AwtShapeElement extends AbstractAwtElement { @@ -40,7 +40,7 @@ public class AwtShapeElement extends AbstractAwtElement { protected Vector4 _margin = new Vector4(1, 1, 1, 1); - protected final Map<Integer, BasicStroke> _strokes = Maps.newHashMap(); + protected final Map<Integer, BasicStroke> _strokes = new HashMap<>(); public AwtShapeElement(final Shape shape) { this(shape, Transform.IDENTITY, null); diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtTextureSource.java index e83be4a..d38fb5e 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtTextureSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtTextureSource.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -16,6 +16,9 @@ import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -29,9 +32,6 @@ import com.ardor3d.math.MathUtils; import com.ardor3d.math.Transform; import com.ardor3d.math.type.ReadOnlyVector4; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; public class AwtTextureSource implements TextureSource, ElementUpdateListener { private static final int tileSize = 128; @@ -69,7 +69,7 @@ public class AwtTextureSource implements TextureSource, ElementUpdateListener { for (int i = 0; i < availableClipmapLevels; i++) { _image[i] = new BufferedImage(tileSize, tileSize, BufferedImage.TYPE_INT_ARGB); - _updatedTiles[i] = Sets.newHashSet(); + _updatedTiles[i] = new HashSet<>(); } } @@ -79,7 +79,7 @@ public class AwtTextureSource implements TextureSource, ElementUpdateListener { @Override public TextureConfiguration getConfiguration() throws Exception { - final Map<Integer, TextureStoreFormat> textureStoreFormat = Maps.newHashMap(); + final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>(); textureStoreFormat.put(0, format); return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, false, true); @@ -100,7 +100,7 @@ public class AwtTextureSource implements TextureSource, ElementUpdateListener { return null; } - final Set<Tile> tiles = Sets.newHashSet(); + final Set<Tile> tiles = new HashSet<>(); int checkX, checkY; for (final Iterator<Tile> it = _updatedTiles[baseClipmapLevel].iterator(); it.hasNext();) { @@ -149,7 +149,7 @@ public class AwtTextureSource implements TextureSource, ElementUpdateListener { graphics.setComposite(composite); // get list of elements that intersect the given region - final List<AbstractAwtElement> elements = Lists.newArrayList(provider.getElements()); + final List<AbstractAwtElement> elements = new ArrayList<>(provider.getElements()); for (final Iterator<AbstractAwtElement> it = elements.iterator(); it.hasNext();) { final AbstractAwtElement element = it.next(); diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/ElementUpdateListener.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/ElementUpdateListener.java index 06078d4..d5f12f4 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/ElementUpdateListener.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/ElementUpdateListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/image/ImageTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/image/ImageTextureSource.java index 68e0bdc..07c3cd8 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/image/ImageTextureSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/image/ImageTextureSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,7 +11,10 @@ package com.ardor3d.extension.terrain.providers.image; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -22,9 +25,6 @@ import com.ardor3d.extension.terrain.util.Tile; import com.ardor3d.image.Image; import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; public class ImageTextureSource implements TextureSource { private final int tileSize; @@ -40,8 +40,8 @@ public class ImageTextureSource implements TextureSource { public ImageTextureSource(final int tileSize, final Image map, final List<Integer> heightMapSizes) { this.tileSize = tileSize; - maps = Lists.newArrayListWithExpectedSize(heightMapSizes.size()); - this.heightMapSizes = Lists.newArrayList(heightMapSizes); + maps = new ArrayList<>(heightMapSizes.size()); + this.heightMapSizes = new ArrayList<>(heightMapSizes); buildMips(map); } @@ -72,7 +72,7 @@ public class ImageTextureSource implements TextureSource { @Override public TextureConfiguration getConfiguration() throws Exception { - final Map<Integer, TextureStoreFormat> textureStoreFormat = Maps.newHashMap(); + final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>(); textureStoreFormat.put(0, TextureStoreFormat.RGB8); return new TextureConfiguration(maps.size(), textureStoreFormat, tileSize, 1f, true, false); @@ -81,7 +81,7 @@ public class ImageTextureSource implements TextureSource { @Override public Set<Tile> getValidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX, final int numTilesY) throws Exception { - final Set<Tile> validTiles = Sets.newHashSet(); + final Set<Tile> validTiles = new HashSet<>(); final int heightMapSize = heightMapSizes.get(clipmapLevel); for (int y = 0; y < numTilesY; y++) { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainDataProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainDataProvider.java index 4df7c3b..c7bdde6 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainDataProvider.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainDataProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,8 @@ package com.ardor3d.extension.terrain.providers.inmemory; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -20,8 +22,6 @@ import com.ardor3d.extension.terrain.providers.image.ImageTextureSource; import com.ardor3d.extension.terrain.providers.inmemory.data.InMemoryTerrainData; import com.ardor3d.extension.terrain.util.NormalMapUtil; import com.ardor3d.image.Image; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; public class InMemoryTerrainDataProvider implements TerrainDataProvider { private static final int tileSize = 128; @@ -40,7 +40,7 @@ public class InMemoryTerrainDataProvider implements TerrainDataProvider { @Override public Map<Integer, String> getAvailableMaps() throws Exception { - final Map<Integer, String> maps = Maps.newHashMap(); + final Map<Integer, String> maps = new HashMap<>(); maps.put(0, "InMemoryData"); return maps; @@ -64,7 +64,7 @@ public class InMemoryTerrainDataProvider implements TerrainDataProvider { inMemoryTerrainData.getSide(), inMemoryTerrainData.getMaxHeight(), inMemoryTerrainData .getScale().getX(), inMemoryTerrainData.getScale().getY()); - final List<Integer> heightMapSizes = Lists.newArrayList(); + final List<Integer> heightMapSizes = new ArrayList<>(); int currentSize = inMemoryTerrainData.getSide(); heightMapSizes.add(currentSize); for (int i = 0; i < inMemoryTerrainData.getClipmapLevels(); i++) { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainSource.java index 32a0542..44ee020 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.terrain.providers.inmemory; +import java.util.HashSet; import java.util.Iterator; import java.util.Set; @@ -17,7 +18,6 @@ import com.ardor3d.extension.terrain.client.TerrainConfiguration; import com.ardor3d.extension.terrain.client.TerrainSource; import com.ardor3d.extension.terrain.providers.inmemory.data.InMemoryTerrainData; import com.ardor3d.extension.terrain.util.Tile; -import com.google.common.collect.Sets; public class InMemoryTerrainSource implements TerrainSource { private final int tileSize; @@ -41,7 +41,7 @@ public class InMemoryTerrainSource implements TerrainSource { final int numTilesY) throws Exception { final int baseClipmapLevel = availableClipmapLevels - clipmapLevel - 1; - final Set<Tile> validTiles = Sets.newHashSet(); + final Set<Tile> validTiles = new HashSet<>(); final int levelSize = 1 << baseClipmapLevel; final int size = inMemoryTerrainData.getSide(); @@ -70,7 +70,7 @@ public class InMemoryTerrainSource implements TerrainSource { final int baseClipmapLevel = availableClipmapLevels - clipmapLevel - 1; - final Set<Tile> tiles = Sets.newHashSet(); + final Set<Tile> tiles = new HashSet<>(); synchronized (updatedTiles[baseClipmapLevel]) { if (updatedTiles[baseClipmapLevel].isEmpty()) { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTextureSource.java index 80fdc82..1f746eb 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTextureSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTextureSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,8 @@ package com.ardor3d.extension.terrain.providers.inmemory; import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -21,8 +23,6 @@ import com.ardor3d.extension.terrain.providers.inmemory.data.InMemoryTerrainData import com.ardor3d.extension.terrain.util.Tile; import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; public class InMemoryTextureSource implements TextureSource { private final int tileSize; @@ -37,7 +37,7 @@ public class InMemoryTextureSource implements TextureSource { @Override public TextureConfiguration getConfiguration() throws Exception { - final Map<Integer, TextureStoreFormat> textureStoreFormat = Maps.newHashMap(); + final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>(); textureStoreFormat.put(0, TextureStoreFormat.RGBA8); return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, true, true); @@ -48,7 +48,7 @@ public class InMemoryTextureSource implements TextureSource { final int numTilesY) throws Exception { final int baseClipmapLevel = availableClipmapLevels - clipmapLevel - 1; - final Set<Tile> validTiles = Sets.newHashSet(); + final Set<Tile> validTiles = new HashSet<>(); final int levelSize = 1 << baseClipmapLevel; final int size = inMemoryTerrainData.getSide(); @@ -77,7 +77,7 @@ public class InMemoryTextureSource implements TextureSource { final int baseClipmapLevel = availableClipmapLevels - clipmapLevel - 1; - final Set<Tile> tiles = Sets.newHashSet(); + final Set<Tile> tiles = new HashSet<>(); synchronized (updatedTiles[baseClipmapLevel]) { if (updatedTiles[baseClipmapLevel].isEmpty()) { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/data/InMemoryTerrainData.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/data/InMemoryTerrainData.java index 5418266..80a8d07 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/data/InMemoryTerrainData.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/data/InMemoryTerrainData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.terrain.providers.inmemory.data; +import java.util.HashSet; import java.util.Set; import com.ardor3d.extension.terrain.util.Tile; @@ -20,7 +21,6 @@ import com.ardor3d.math.functions.FbmFunction3D; import com.ardor3d.math.functions.Function3D; import com.ardor3d.math.functions.Functions; import com.ardor3d.math.type.ReadOnlyVector3; -import com.google.common.collect.Sets; public class InMemoryTerrainData { @@ -62,8 +62,8 @@ public class InMemoryTerrainData { updatedTerrainTiles = new Set[clipmapLevels]; updatedTextureTiles = new Set[clipmapLevels]; for (int i = 0; i < clipmapLevels; i++) { - updatedTerrainTiles[i] = Sets.newHashSet(); - updatedTextureTiles[i] = Sets.newHashSet(); + updatedTerrainTiles[i] = new HashSet<>(); + updatedTextureTiles[i] = new HashSet<>(); } final double procScale = 1.0 / 4000.0; @@ -175,10 +175,10 @@ public class InMemoryTerrainData { dr = (radius - r) / radius; index = i * side + j; heightData[index] = Math.max(minHeight, Math.min(heightData[index] + dr * offset, maxHeight)); - red = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 0] & 0xff, (paint.getRed() * 255)) & 0xff); - green = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 1] & 0xff, (paint.getGreen() * 255)) & 0xff); - blue = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 2] & 0xff, (paint.getBlue() * 255)) & 0xff); - alpha = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 3] & 0xff, (paint.getAlpha() * 255)) & 0xff); + red = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 0] & 0xff, paint.getRed() * 255) & 0xff); + green = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 1] & 0xff, paint.getGreen() * 255) & 0xff); + blue = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 2] & 0xff, paint.getBlue() * 255) & 0xff); + alpha = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 3] & 0xff, paint.getAlpha() * 255) & 0xff); colorData[index * 4 + 0] = red; colorData[index * 4 + 1] = green; colorData[index * 4 + 2] = blue; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java index ec4313b..bc97dc6 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.extension.terrain.providers.procedural; import java.nio.ByteBuffer; +import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; @@ -22,7 +23,6 @@ import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.math.Vector3; import com.ardor3d.math.functions.Function3D; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Maps; public class ProceduralNormalMapSource implements TextureSource { private final Function3D function; @@ -44,7 +44,7 @@ public class ProceduralNormalMapSource implements TextureSource { @Override public TextureConfiguration getConfiguration() throws Exception { - final Map<Integer, TextureStoreFormat> textureStoreFormat = Maps.newHashMap(); + final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>(); textureStoreFormat.put(0, TextureStoreFormat.RGB8); return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, false, false); diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainDataProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainDataProvider.java index 6d1c8e3..1d56098 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainDataProvider.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainDataProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.terrain.providers.procedural; +import java.util.HashMap; import java.util.Map; import com.ardor3d.extension.terrain.client.TerrainDataProvider; @@ -17,7 +18,6 @@ import com.ardor3d.extension.terrain.client.TerrainSource; import com.ardor3d.extension.terrain.client.TextureSource; import com.ardor3d.math.functions.Function3D; import com.ardor3d.math.type.ReadOnlyVector3; -import com.google.common.collect.Maps; public class ProceduralTerrainDataProvider implements TerrainDataProvider { private final Function3D function; @@ -43,7 +43,7 @@ public class ProceduralTerrainDataProvider implements TerrainDataProvider { @Override public Map<Integer, String> getAvailableMaps() throws Exception { - final Map<Integer, String> maps = Maps.newHashMap(); + final Map<Integer, String> maps = new HashMap<>(); maps.put(0, "ProceduralMap"); return maps; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainSource.java index 4fae73a..0f493bf 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTextureSource.java index 3b1b4dc..27236f7 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTextureSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTextureSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.extension.terrain.providers.procedural; import java.nio.ByteBuffer; +import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; @@ -24,7 +25,6 @@ import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.functions.Function3D; import com.ardor3d.math.type.ReadOnlyColorRGBA; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Maps; public class ProceduralTextureSource implements TextureSource { private final Function3D function; @@ -59,7 +59,7 @@ public class ProceduralTextureSource implements TextureSource { @Override public TextureConfiguration getConfiguration() throws Exception { - final Map<Integer, TextureStoreFormat> textureStoreFormat = Maps.newHashMap(); + final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>(); textureStoreFormat.put(0, TextureStoreFormat.RGB8); return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, false, false); diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainDataProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainDataProvider.java index c41b4bf..ef32d71 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainDataProvider.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainDataProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,8 @@ package com.ardor3d.extension.terrain.providers.simplearray; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -19,8 +21,6 @@ import com.ardor3d.extension.terrain.client.TextureSource; import com.ardor3d.extension.terrain.providers.image.ImageTextureSource; import com.ardor3d.extension.terrain.util.NormalMapUtil; import com.ardor3d.image.Image; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; public class SimpleArrayTerrainDataProvider implements TerrainDataProvider { private static final int tileSize = 128; @@ -45,7 +45,7 @@ public class SimpleArrayTerrainDataProvider implements TerrainDataProvider { @Override public Map<Integer, String> getAvailableMaps() throws Exception { - final Map<Integer, String> maps = Maps.newHashMap(); + final Map<Integer, String> maps = new HashMap<>(); maps.put(0, "InMemoryData"); return maps; @@ -66,7 +66,7 @@ public class SimpleArrayTerrainDataProvider implements TerrainDataProvider { if (generateNormalMap) { try { final Image normalImage = NormalMapUtil.constructNormalMap(heightData, side, 1, 1, 1); - final List<Integer> heightMapSizes = Lists.newArrayList(); + final List<Integer> heightMapSizes = new ArrayList<>(); int currentSize = side; heightMapSizes.add(currentSize); for (int i = 0; i < 8; i++) { diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainSource.java index 3b52fe1..e2ffcc9 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTextureSource.java index 924265d..f1b2d77 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTextureSource.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTextureSource.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,8 @@ package com.ardor3d.extension.terrain.providers.simplearray; import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -19,8 +21,6 @@ import com.ardor3d.extension.terrain.client.TextureSource; import com.ardor3d.extension.terrain.util.Tile; import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; public class SimpleArrayTextureSource implements TextureSource { private final int tileSize; @@ -36,7 +36,7 @@ public class SimpleArrayTextureSource implements TextureSource { @Override public TextureConfiguration getConfiguration() throws Exception { - final Map<Integer, TextureStoreFormat> textureStoreFormat = Maps.newHashMap(); + final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>(); textureStoreFormat.put(0, TextureStoreFormat.RGBA8); return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, true, true); @@ -45,7 +45,7 @@ public class SimpleArrayTextureSource implements TextureSource { @Override public Set<Tile> getValidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX, final int numTilesY) throws Exception { - final Set<Tile> validTiles = Sets.newHashSet(); + final Set<Tile> validTiles = new HashSet<>(); final int levelSize = 1 << availableClipmapLevels - clipmapLevel; diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/AbstractBresenhamTracer.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/AbstractBresenhamTracer.java index b6cd470..9e9aabc 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/AbstractBresenhamTracer.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/AbstractBresenhamTracer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/BresenhamYUpGridTracer.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/BresenhamYUpGridTracer.java index 6ea35cd..2048311 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/BresenhamYUpGridTracer.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/BresenhamYUpGridTracer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/BresenhamZUpGridTracer.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/BresenhamZUpGridTracer.java index eaa288b..29f6a67 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/BresenhamZUpGridTracer.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/BresenhamZUpGridTracer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/ClipmapTerrainPicker.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/ClipmapTerrainPicker.java index 7ced2ba..e979212 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/ClipmapTerrainPicker.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/ClipmapTerrainPicker.java @@ -1,15 +1,16 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.terrain.util; +import java.util.ArrayList; import java.util.List; import com.ardor3d.extension.terrain.client.ClipmapLevel; @@ -22,7 +23,6 @@ import com.ardor3d.math.Vector3; import com.ardor3d.math.type.ReadOnlyRay3; import com.ardor3d.math.type.ReadOnlyTransform; import com.ardor3d.math.type.ReadOnlyVector3; -import com.google.common.collect.Lists; /** * A picking assistant to be used with ClipmapLevel and an AbstractBresenhamTracer. @@ -41,7 +41,7 @@ public class ClipmapTerrainPicker { /** * Construct a new picker using the supplied pyramid, tracer and arguments. - * + * * @param levels * the source for our height information.. * @param tracerClass @@ -57,7 +57,7 @@ public class ClipmapTerrainPicker { final Class<? extends AbstractBresenhamTracer> tracerClass, final int maxChecks, final Vector3 initialSpacing) throws InstantiationException, IllegalAccessException { _clipmapLevels = levels; - _tracers = Lists.newArrayList(); + _tracers = new ArrayList<>(); for (int i = 0, max = levels.size(); i < max; i++) { final AbstractBresenhamTracer tracer = tracerClass.newInstance(); final int space = 1 << i; @@ -117,8 +117,8 @@ public class ClipmapTerrainPicker { final double x = _workEyePos.getX(); final double z = _workEyePos.getZ(); final double intOnX = x - Math.floor(x), intOnZ = z - Math.floor(z); - final double height = MathUtils - .lerp(intOnZ, MathUtils.lerp(intOnX, h1, h2), MathUtils.lerp(intOnX, h3, h4)); + final double height = MathUtils.lerp(intOnZ, MathUtils.lerp(intOnX, h1, h2), + MathUtils.lerp(intOnX, h3, h4)); intersection.set(x, height, z); terrainWorldTransform.applyForward(intersection, intersection); @@ -208,7 +208,7 @@ public class ClipmapTerrainPicker { /** * Check the two triangles of a given grid space for intersection. - * + * * @param gridX * grid row * @param gridY @@ -225,8 +225,8 @@ public class ClipmapTerrainPicker { } if (!_workRay.intersectsTriangle(_gridTriA.getA(), _gridTriA.getB(), _gridTriA.getC(), store)) { - final boolean intersects = _workRay.intersectsTriangle(_gridTriB.getA(), _gridTriB.getB(), - _gridTriB.getC(), store); + final boolean intersects = _workRay.intersectsTriangle(_gridTriB.getA(), _gridTriB.getB(), _gridTriB.getC(), + store); if (intersects && normalStore != null) { final Vector3 edge1 = Vector3.fetchTempInstance().set(_gridTriB.getB()).subtractLocal(_gridTriB.getA()); final Vector3 edge2 = Vector3.fetchTempInstance().set(_gridTriB.getC()).subtractLocal(_gridTriB.getA()); @@ -247,7 +247,7 @@ public class ClipmapTerrainPicker { /** * Calculate the triangles (in world coordinate space) of a Pyramid that correspond to the given grid location. The * triangles are stored in the class fields _gridTriA and _gridTriB. - * + * * @param gridX * grid row * @param gridY @@ -267,7 +267,8 @@ public class ClipmapTerrainPicker { final float h1 = getWeightedHeight(tileStore[0], tileStore[1], tileStore[2], tileStore[3], scaledClipSideSize); final float h2 = getWeightedHeight(tileStore[4], tileStore[5], tileStore[6], tileStore[7], scaledClipSideSize); - final float h3 = getWeightedHeight(tileStore[8], tileStore[9], tileStore[10], tileStore[11], scaledClipSideSize); + final float h3 = getWeightedHeight(tileStore[8], tileStore[9], tileStore[10], tileStore[11], + scaledClipSideSize); final float h4 = getWeightedHeight(tileStore[12], tileStore[13], tileStore[14], tileStore[15], scaledClipSideSize); diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/DoubleBufferedList.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/DoubleBufferedList.java index f6c12da..4ae0591 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/DoubleBufferedList.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/DoubleBufferedList.java @@ -1,18 +1,17 @@ package com.ardor3d.extension.terrain.util; +import java.util.ArrayList; import java.util.List; -import com.google.common.collect.Lists; - /** * Utility class used by the mailbox update system. * * @param <T> */ public class DoubleBufferedList<T> { - private List<T> frontList = Lists.newArrayList(); - private List<T> backList = Lists.newArrayList(); + private List<T> frontList = new ArrayList<>(); + private List<T> backList = new ArrayList<>(); /** * The add method can be called at any point. diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/IntColorUtils.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/IntColorUtils.java index 0ad23fa..17f31d5 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/IntColorUtils.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/IntColorUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/NormalMapUtil.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/NormalMapUtil.java index 89e012b..429d625 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/NormalMapUtil.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/NormalMapUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Region.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Region.java index d46d85f..5110730 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Region.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Region.java @@ -1,15 +1,17 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.terrain.util; +import java.util.Objects; + /** * Used to calculate clipmap block boundaries etc */ @@ -201,14 +203,8 @@ public class Region { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + height; - result = prime * result + level; - result = prime * result + width; - result = prime * result + x; - result = prime * result + y; - return result; + return Objects.hash(Integer.valueOf(getHeight()), Integer.valueOf(getLevel()), Integer.valueOf(getWidth()), + Integer.valueOf(getX()), Integer.valueOf(getY())); } @Override diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TerrainGridCachePanel.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TerrainGridCachePanel.java index 5a6bb60..2f8f2ed 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TerrainGridCachePanel.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TerrainGridCachePanel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TextureGridCachePanel.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TextureGridCachePanel.java index 8eb3a2d..122c88a 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TextureGridCachePanel.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TextureGridCachePanel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Tile.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Tile.java index 7210382..4aebc8e 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Tile.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Tile.java @@ -2,6 +2,7 @@ package com.ardor3d.extension.terrain.util; import java.io.Serializable; +import java.util.Objects; public class Tile implements Serializable { private static final long serialVersionUID = 1L; @@ -23,10 +24,7 @@ public class Tile implements Serializable { @Override public int hashCode() { - int result = 17; - result += 31 * result + x; - result += 31 * result + y; - return result; + return Objects.hash(Integer.valueOf(getX()), Integer.valueOf(getY())); } @Override diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TileLocator.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TileLocator.java index 1d0a22d..71f6d7f 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TileLocator.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TileLocator.java @@ -3,6 +3,7 @@ package com.ardor3d.extension.terrain.util; import java.io.Serializable; import java.net.URL; +import java.util.Objects; public class TileLocator implements Serializable { private static final long serialVersionUID = 1L; @@ -37,12 +38,7 @@ public class TileLocator implements Serializable { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + clipmapLevel; - result = prime * result + sourceId; - result = prime * result + (tile == null ? 0 : tile.hashCode()); - return result; + return Objects.hash(Integer.valueOf(getClipmapLevel()), Integer.valueOf(getSourceId()), tile); } @Override diff --git a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShader.frag b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShader.frag index cab2b17..b852bc0 100644 --- a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShader.frag +++ b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShader.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2011 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShaderPCF.frag b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShaderPCF.frag index c186002..d0c545f 100644 --- a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShaderPCF.frag +++ b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShaderPCF.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2011 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShader_normalMap.frag b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShader_normalMap.frag index b1b6f49..54759a1 100644 --- a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShader_normalMap.frag +++ b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/shadowedGeometryClipmapShader_normalMap.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2011 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/textureClipmapShader.frag b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/textureClipmapShader.frag index 99335f4..db46a79 100644 --- a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/textureClipmapShader.frag +++ b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/textureClipmapShader.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2011 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/textureClipmapShader.vert b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/textureClipmapShader.vert index deeb208..eac4525 100644 --- a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/textureClipmapShader.vert +++ b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/textureClipmapShader.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2011 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader.frag b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader.frag index 0eb893c..664fda4 100644 --- a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader.frag +++ b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2011 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader.vert b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader.vert index af0f2d4..5155337 100644 --- a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader.vert +++ b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader.vert @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2011 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader_normalMap.frag b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader_normalMap.frag index 779db28..9dd8f15 100644 --- a/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader_normalMap.frag +++ b/ardor3d-terrain/src/main/resources/com/ardor3d/extension/terrain/texturedGeometryClipmapShader_normalMap.frag @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2011 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRGB.java b/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRGB.java index 887a85c..f95fc62 100644 --- a/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRGB.java +++ b/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRGB.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRegion.java b/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRegion.java index 66f3345..210ea6e 100644 --- a/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRegion.java +++ b/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRegion.java @@ -1,17 +1,16 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.terrain.util; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; public class TestRegion { diff --git a/ardor3d-ui/.settings/org.eclipse.jdt.core.prefs b/ardor3d-ui/.settings/org.eclipse.jdt.core.prefs index 692a876..65ceabb 100644 --- a/ardor3d-ui/.settings/org.eclipse.jdt.core.prefs +++ b/ardor3d-ui/.settings/org.eclipse.jdt.core.prefs @@ -81,12 +81,9 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/ardor3d-ui/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-ui/.settings/org.eclipse.jdt.ui.prefs index cbc8d28..5404099 100644 --- a/ardor3d-ui/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-ui/.settings/org.eclipse.jdt.ui.prefs @@ -55,7 +55,7 @@ editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_ArdorLabs formatter_settings_version=11 org.eclipse.jdt.ui.javadoc=false -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"></template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2010 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"></template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/**\n * Copyright (c) 2008-2014 Ardor Labs, Inc.\n *\n * This file is part of Ardor3D.\n *\n * Ardor3D is free software\: you can redistribute it and/or modify it \n * under the terms of its license which may be found in the accompanying\n * LICENSE file or at <http\://www.ardor3d.com/LICENSE>.\n */\n\n${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -78,7 +78,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=true diff --git a/ardor3d-ui/build.gradle b/ardor3d-ui/build.gradle new file mode 100644 index 0000000..d6fb8aa --- /dev/null +++ b/ardor3d-ui/build.gradle @@ -0,0 +1,5 @@ + +description = 'Ardor 3D UI' +dependencies { + compile project(':ardor3d-core') +} diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/AbstractLabelUIComponent.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/AbstractLabelUIComponent.java index 6d87247..cca5f2c 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/AbstractLabelUIComponent.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/AbstractLabelUIComponent.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -77,6 +77,7 @@ public abstract class AbstractLabelUIComponent extends StateBasedUIComponent imp /** * @return the currently set text value of this label. */ + @Override public String getText() { return _uiText != null ? _uiText.getText() : null; } @@ -87,6 +88,7 @@ public abstract class AbstractLabelUIComponent extends StateBasedUIComponent imp * @param text * the new text */ + @Override public void setText(String text) { if (text != null && text.length() == 0) { text = null; @@ -101,10 +103,12 @@ public abstract class AbstractLabelUIComponent extends StateBasedUIComponent imp updateMinimumSizeFromContents(); } + @Override public boolean isStyledText() { return _styled; } + @Override public void setStyledText(final boolean value) { _styled = value; fireStyleChanged(); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/AbstractUITextEntryComponent.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/AbstractUITextEntryComponent.java index 8b6f0ff..32ed776 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/AbstractUITextEntryComponent.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/AbstractUITextEntryComponent.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -77,6 +77,7 @@ public abstract class AbstractUITextEntryComponent extends StateBasedUIComponent /** * @return the text value of this text entry widget */ + @Override public String getText() { return _uiText != null ? _uiText.getText() : ""; } @@ -87,6 +88,7 @@ public abstract class AbstractUITextEntryComponent extends StateBasedUIComponent * @param text * the new text */ + @Override public void setText(String text) { if (text != null && text.length() == 0) { text = null; @@ -111,10 +113,12 @@ public abstract class AbstractUITextEntryComponent extends StateBasedUIComponent updateMinimumSizeFromContents(); } + @Override public boolean isStyledText() { return _styled; } + @Override public void setStyledText(final boolean value) { _styled = value; } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/FloatingUIContainer.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/FloatingUIContainer.java index 1958016..8b5ef55 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/FloatingUIContainer.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/FloatingUIContainer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/LabelState.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/LabelState.java index be7bb6c..9704962 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/LabelState.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/LabelState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/Orientation.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/Orientation.java index 812f839..c009f27 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/Orientation.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/Orientation.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/StateBasedUIComponent.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/StateBasedUIComponent.java index 15bde3e..e07d7cb 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/StateBasedUIComponent.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/StateBasedUIComponent.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/Textable.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/Textable.java index e04417f..cb29a93 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/Textable.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/Textable.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIButton.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIButton.java index e7273ca..2a5a30c 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIButton.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIButton.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -45,7 +45,7 @@ public class UIButton extends AbstractLabelUIComponent { protected LabelState _disabledSelectedState = new LabelState(); /** List of action listeners notified when this button is pressed. */ - private final List<ActionListener> _listeners = new ArrayList<ActionListener>(); + private final List<ActionListener> _listeners = new ArrayList<>(); /** True if this is button is selectable/toggleable. */ private boolean _selectable = false; @@ -67,7 +67,7 @@ public class UIButton extends AbstractLabelUIComponent { /** * Construct a new button with the given text. - * + * * @param text */ public UIButton(final String text) { @@ -76,7 +76,7 @@ public class UIButton extends AbstractLabelUIComponent { /** * Construct a new button with the given text and icon. - * + * * @param text * @param icon */ @@ -106,7 +106,7 @@ public class UIButton extends AbstractLabelUIComponent { /** * Add the specified listener to this button's list of listeners notified when pressed. - * + * * @param listener */ public void addActionListener(final ActionListener listener) { @@ -115,7 +115,7 @@ public class UIButton extends AbstractLabelUIComponent { /** * Remove the given listener from the notification list. - * + * * @param listener */ public boolean removeActionListener(final ActionListener listener) { @@ -195,7 +195,7 @@ public class UIButton extends AbstractLabelUIComponent { /** * If selectable, set this button's state to either selected (true) or default (false) - or disabled versions of * each if currently disabled. - * + * * @param selected */ public void setSelected(boolean selected) { @@ -297,7 +297,7 @@ public class UIButton extends AbstractLabelUIComponent { /** * Sets the text on this button and all contained states. - * + * * @param text * the new text */ @@ -312,7 +312,7 @@ public class UIButton extends AbstractLabelUIComponent { /** * Sets the text on this button and all contained states. - * + * * @param text * the new text * @param isStyled @@ -331,7 +331,7 @@ public class UIButton extends AbstractLabelUIComponent { /** * Sets the icon on this button and all contained states. - * + * * @param icon * the new icon */ diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UICheckBox.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UICheckBox.java index eb277b6..4bc35b5 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UICheckBox.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UICheckBox.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComboBox.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComboBox.java index df93d7f..e4e9303 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComboBox.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComboBox.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.ui; +import java.util.ArrayList; import java.util.List; import com.ardor3d.extension.ui.event.ActionEvent; @@ -24,7 +25,6 @@ import com.ardor3d.extension.ui.text.StyleConstants; import com.ardor3d.input.InputState; import com.ardor3d.input.MouseButton; import com.ardor3d.scenegraph.Spatial; -import com.google.common.collect.Lists; /** * A UI component that contains several possible choices, but shows only the currently selected one. Changing the @@ -40,7 +40,7 @@ public class UIComboBox extends UIPanel { protected int _selectedIndex = 0; - private final List<SelectionListener<UIComboBox>> _listeners = Lists.newArrayList(); + private final List<SelectionListener<UIComboBox>> _listeners = new ArrayList<>(); private SkinningTask _itemSkinCallback; diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java index 69ea13f..e34b896 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.ui; +import java.util.HashMap; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.FutureTask; @@ -46,7 +47,6 @@ import com.ardor3d.renderer.state.RenderState.StateType; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.event.DirtyType; import com.ardor3d.scenegraph.hint.PickingHint; -import com.google.common.collect.Maps; /** * Base UI class. All UI components/widgets/controls extend this class. @@ -93,9 +93,9 @@ public abstract class UIComponent extends Node implements UIKeyHandler { private static int _defaultFontSize = 18; /** The default font styles to use. */ - private static Map<String, Object> _defaultFontStyles = Maps.newHashMap(); + private static Map<String, Object> _defaultFontStyles = new HashMap<>(); /** The font styles to use for text on this component, if needed. */ - private Map<String, Object> _fontStyles = Maps.newHashMap(); + private Map<String, Object> _fontStyles = new HashMap<>(); /** Optional information used by a parent container's layout. */ private UILayoutData _layoutData = null; @@ -232,7 +232,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler { if (getParent() != null && getParent() instanceof UIComponent) { styles = ((UIComponent) getParent()).getFontStyles(); } else { - styles = Maps.newHashMap(UIComponent._defaultFontStyles); + styles = new HashMap<>(UIComponent._defaultFontStyles); styles.put(StyleConstants.KEY_COLOR, UIComponent.DEFAULT_FOREGROUND_COLOR); } styles.putAll(_fontStyles); @@ -1009,7 +1009,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler { vec.set(hudX, hudY, 0); getWorldTransform().applyInverse(vec); - final Insets margin = getMargin() != null ? getMargin() : Insets.EMPTY; + final Insets margin = getMargin() == null ? Insets.EMPTY : getMargin(); final double x = vec.getX() - margin.getLeft(); final double y = vec.getY() - margin.getBottom(); Vector3.releaseTempInstance(vec); @@ -1167,9 +1167,9 @@ public abstract class UIComponent extends Node implements UIKeyHandler { */ public static void setDefaultFontStyles(final Map<String, Object> defaultStyles) { if (defaultStyles == null) { - UIComponent._defaultFontStyles = Maps.newHashMap(); + UIComponent._defaultFontStyles = new HashMap<>(); } else { - UIComponent._defaultFontStyles = Maps.newHashMap(defaultStyles); + UIComponent._defaultFontStyles = new HashMap<>(defaultStyles); } } @@ -1336,6 +1336,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler { final UIHud hud = getHud(); if (hud != null && getTooltipText() != null) { final Callable<Void> show = new Callable<Void>() { + @Override public Void call() throws Exception { while (true) { @@ -1387,7 +1388,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler { }; cancelTooltipTimer(); resetToolTipTime(); - _showTask = new FutureTask<Void>(show); + _showTask = new FutureTask<>(show); final Thread t = new Thread() { @Override public void run() { @@ -1527,6 +1528,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler { * current tracked state of the input system. * @return true if we want to consider the event "consumed" by the UI system. */ + @Override public boolean keyPressed(final Key key, final InputState state) { if (!_consumeKeyEvents && getParent() instanceof UIComponent) { return ((UIComponent) getParent()).keyPressed(key, state); @@ -1544,6 +1546,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler { * current tracked state of the input system. * @return true if we want to consider the event "consumed" by the UI system. */ + @Override public boolean keyHeld(final Key key, final InputState state) { if (!_consumeKeyEvents && getParent() instanceof UIComponent) { return ((UIComponent) getParent()).keyHeld(key, state); @@ -1561,6 +1564,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler { * current tracked state of the input system. * @return true if we want to consider the event "consumed" by the UI system. */ + @Override public boolean keyReleased(final Key key, final InputState state) { if (!_consumeKeyEvents && getParent() instanceof UIComponent) { return ((UIComponent) getParent()).keyReleased(key, state); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIContainer.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIContainer.java index 5b597f0..7308b5f 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIContainer.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIContainer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrame.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrame.java index 5bbf7b6..bf4845f 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrame.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrame.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -378,6 +378,7 @@ public class UIFrame extends UIContainer { */ public static void resetTextureRenderer(final Object queueKey) { final Callable<Void> exe = new Callable<Void>() { + @Override public Void call() { if (UIContainer._textureRenderer != null) { UIContainer._textureRenderer.cleanup(); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrameBar.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrameBar.java index 9b43b22..69cdc6c 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrameBar.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrameBar.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -47,6 +47,7 @@ public class UIFrameBar extends UIPanel { if (buttons.contains(FrameButtons.HELP)) { _helpButton = createFrameButton("?"); _helpButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { // TODO: Implement } @@ -59,6 +60,7 @@ public class UIFrameBar extends UIPanel { if (buttons.contains(FrameButtons.MINIMIZE)) { _minimizeButton = createFrameButton("_"); _minimizeButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { // TODO: Implement } @@ -71,6 +73,7 @@ public class UIFrameBar extends UIPanel { if (buttons.contains(FrameButtons.MAXIMIZE)) { _maximizeButton = createFrameButton("^"); _maximizeButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { // XXX: Should this also update the button img? final UIFrame frame = (UIFrame) getParent(); @@ -89,6 +92,7 @@ public class UIFrameBar extends UIPanel { if (buttons.contains(FrameButtons.CLOSE)) { _closeButton = createFrameButton("x"); _closeButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { ((UIFrame) getParent()).close(); } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrameStatusBar.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrameStatusBar.java index 9a82844..f97a5fd 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrameStatusBar.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIFrameStatusBar.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIHud.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIHud.java index 0ece8fa..47c5b67 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIHud.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIHud.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -46,7 +46,6 @@ import com.ardor3d.scenegraph.hint.CullHint; import com.ardor3d.scenegraph.hint.LightCombineMode; import com.ardor3d.scenegraph.hint.TextureCombineMode; import com.google.common.base.Predicate; -import com.google.common.collect.Lists; /** * UIHud represents a "Heads Up Display" or the base of a game UI scenegraph. Various UI Input, dragging, events, etc. @@ -95,7 +94,7 @@ public class UIHud extends Node { * List of potential drag listeners. When a drag operation is detected, we will offer it to each item in the list * until one accepts it. */ - private final List<WeakReference<DragListener>> _dragListeners = new ArrayList<WeakReference<DragListener>>(); + private final List<WeakReference<DragListener>> _dragListeners = new ArrayList<>(); /** Our current drag listener. When an drag finished, this is set back to null. */ private DragListener _dragListener = null; @@ -109,7 +108,7 @@ public class UIHud extends Node { /** * List of hud listeners. */ - private final List<HudListener> _hudListeners = Lists.newArrayList(); + private final List<HudListener> _hudListeners = new ArrayList<>(); /** * An optional mouseManager, required in order to test mouse is grabbed. @@ -119,7 +118,7 @@ public class UIHud extends Node { /** * The list of currently displayed popup menus, with each entry being a submenu of the one previous. */ - private final List<UIPopupMenu> _popupMenus = Lists.newArrayList(); + private final List<UIPopupMenu> _popupMenus = new ArrayList<>(); /** * Construct a new UIHud @@ -377,7 +376,7 @@ public class UIHud extends Node { * the listener to add */ public void addDragListener(final DragListener listener) { - _dragListeners.add(new WeakReference<DragListener>(listener)); + _dragListeners.add(new WeakReference<>(listener)); // Clean list. for (int i = _dragListeners.size(); --i >= 0;) { @@ -532,11 +531,13 @@ public class UIHud extends Node { */ protected void setupLogicalLayer() { _logicalLayer.registerTrigger(new InputTrigger(new Predicate<TwoInputStates>() { + @Override public boolean apply(final TwoInputStates arg0) { // always trigger this. return true; } }, new TriggerAction() { + @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _mouseInputConsumed = offerMouseInputToUI(inputStates); _keyInputConsumed = offerKeyInputToUI(inputStates); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UILabel.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UILabel.java index 3001f2e..7a877bc 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UILabel.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UILabel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIMenuItem.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIMenuItem.java index 05c16e0..f43bd56 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIMenuItem.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIMenuItem.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -27,6 +27,7 @@ public class UIMenuItem extends UIButton { // Close menus when a menu item is clicked addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { final UIHud hud = getHud(); if (hud != null) { diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPanel.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPanel.java index ad3bd5b..43cd7c5 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPanel.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPanel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPasswordField.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPasswordField.java index 4476b73..0b25243 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPasswordField.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPasswordField.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPopupMenu.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPopupMenu.java index 11df42b..f141cfe 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPopupMenu.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPopupMenu.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -35,7 +35,7 @@ public class UIPopupMenu extends UIFrame { if (x + width > displayW) { setHudX(displayW - width); } else { - final Insets border = getBorder() != null ? getBorder() : Insets.EMPTY; + final Insets border = getBorder() == null ? Insets.EMPTY : getBorder(); setHudX(x - border.getLeft()); } y = y - height; diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIProgressBar.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIProgressBar.java index ebb9ace..dae3493 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIProgressBar.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIProgressBar.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIRadioButton.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIRadioButton.java index 8a8463d..d982054 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIRadioButton.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIRadioButton.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollBar.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollBar.java index d077a7b..bb83788 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollBar.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollBar.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -29,7 +29,7 @@ public class UIScrollBar extends UIPanel { private final UIButton btBottomRight; private int sliderLength; /** List of action listeners notified when this scrollbar is changed. */ - private final List<ActionListener> _listeners = new ArrayList<ActionListener>(); + private final List<ActionListener> _listeners = new ArrayList<>(); public UIScrollBar(final Orientation orientation) { setLayout(new BorderLayout()); @@ -55,6 +55,7 @@ public class UIScrollBar extends UIPanel { layout(); final ActionListener al = new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { int direction; if (event.getSource() == btTopLeft) { @@ -81,6 +82,7 @@ public class UIScrollBar extends UIPanel { btTopLeft.addActionListener(al); btBottomRight.addActionListener(al); slider.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { fireChangeEvent(); } @@ -96,7 +98,7 @@ public class UIScrollBar extends UIPanel { /** * Add the specified listener to this scrollbar's list of listeners notified when it's changed. - * + * * @param listener */ public void addActionListener(final ActionListener listener) { diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollPanel.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollPanel.java index e7c74cb..adf9b5c 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollPanel.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollPanel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -50,6 +50,7 @@ public class UIScrollPanel extends UIPanel { add(verticalScrollBar); setDoClip(true); horizontalScrollBar.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { offsetX = horizontalScrollBar.getValue(); fireComponentDirty(); @@ -57,6 +58,7 @@ public class UIScrollPanel extends UIPanel { } }); verticalScrollBar.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { offsetY = verticalScrollBar.getValue(); fireComponentDirty(); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISlider.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISlider.java index 0cd086e..38d780b 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISlider.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISlider.java @@ -1,22 +1,22 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.ui; +import java.util.ArrayList; import java.util.List; import com.ardor3d.extension.ui.event.ActionEvent; import com.ardor3d.extension.ui.event.ActionListener; import com.ardor3d.extension.ui.model.DefaultSliderModel; import com.ardor3d.extension.ui.model.SliderModel; -import com.google.common.collect.Lists; /** * A widget allowing display and control of a choice from a range of values. @@ -33,7 +33,7 @@ public class UISlider extends UIContainer { private final UISliderKnob _knob; /** List of action listeners notified when this slider is changed. */ - private final List<ActionListener> _listeners = Lists.newArrayList(); + private final List<ActionListener> _listeners = new ArrayList<>(); /** The orientation of this slider knob. */ private final Orientation _orientation; @@ -43,7 +43,7 @@ public class UISlider extends UIContainer { /** * create a slider widget with a default range of [0,100]. Initial value is 50. - * + * * @param orientation * the orientation of the slider (Orientation.Horizontal or Orientation.Vertical) */ @@ -53,7 +53,7 @@ public class UISlider extends UIContainer { /** * create a slider widget with a default range of [minValue,maxOffset] and the given initialValue. - * + * * @param orientation * the orientation of the slider (Orientation.Horizontal or Orientation.Vertical) * @param minValue @@ -66,7 +66,8 @@ public class UISlider extends UIContainer { public UISlider(final Orientation orientation, final int minValue, final int maxValue, final int initialValue) { assert orientation != null : "orientation must not be null."; assert minValue <= maxValue : "minValue must be less than maxValue."; - assert minValue <= initialValue && initialValue <= maxValue : "initialValue must be between minValue and maxValue."; + assert minValue <= initialValue + && initialValue <= maxValue : "initialValue must be between minValue and maxValue."; // Set our orientation _orientation = orientation; @@ -150,7 +151,7 @@ public class UISlider extends UIContainer { /** * Set the value on this slider - * + * * @param value * the new value. Clamps between min and max values. */ @@ -196,7 +197,7 @@ public class UISlider extends UIContainer { /** * Add the specified listener to this slider's list of listeners notified when it has changed. - * + * * @param listener * the listener to add */ @@ -206,7 +207,7 @@ public class UISlider extends UIContainer { /** * Remove a listener from this slider's list of listeners. - * + * * @param listener * the listener to remove * @return true if the listener was removed. diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISliderKnob.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISliderKnob.java index 8790618..16daa71 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISliderKnob.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISliderKnob.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -180,6 +180,7 @@ public class UISliderKnob extends UIContainer { private int _initialHudLoc; private int _delta; + @Override public void startDrag(final int x, final int y) { // skip out if not enabled. if (!isEnabled()) { @@ -201,6 +202,7 @@ public class UISliderKnob extends UIContainer { } } + @Override public void drag(final int x, final int y) { if (!isEnabled()) { return; @@ -228,11 +230,13 @@ public class UISliderKnob extends UIContainer { _parentSlider); } + @Override public void endDrag(final UIComponent dropOn, final int x, final int y) { // call back to our parent slider, allowing for snapping _parentSlider.knobReleased(); } + @Override public boolean isDragHandle(final UIComponent w, final int x, final int y) { // if not enabled, we don't slide if (!isEnabled()) { diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIState.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIState.java index f3f6b79..9c352d5 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIState.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITab.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITab.java index c793106..7096c9b 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITab.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITab.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITabbedPane.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITabbedPane.java index eaf9ea5..5e87e4b 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITabbedPane.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITabbedPane.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -32,7 +32,7 @@ public class UITabbedPane extends UIPanel { private static final Logger logger = Logger.getLogger(UITabbedPane.class.getName()); /** Our contents... Used instead of the normal children field because we need to track and show just one at a time. */ - private final ArrayList<UIComponent> _contents = new ArrayList<UIComponent>(); + private final ArrayList<UIComponent> _contents = new ArrayList<>(); /** The panel containing our navigation tab buttons. */ private final UIPanel _tabsPanel; @@ -272,7 +272,7 @@ public class UITabbedPane extends UIPanel { * @return an array of tabs from our tab panel. */ private ArrayList<UITab> getTabs() { - final ArrayList<UITab> buttons = new ArrayList<UITab>(); + final ArrayList<UITab> buttons = new ArrayList<>(); for (int x = 0, max = _tabsPanel.getNumberOfChildren(); x < max; x++) { final Spatial spat = _tabsPanel.getChild(x); if (spat instanceof UITab) { @@ -301,6 +301,7 @@ public class UITabbedPane extends UIPanel { private UITab makeTab(final String label, final SubTex icon) { final UITab button = new UITab(label, icon, _placement); button.addActionListener(new ActionListener() { + @Override public void actionPerformed(final ActionEvent event) { setCurrentTab(button); } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextArea.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextArea.java index ebf9cdb..1c460b4 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextArea.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextArea.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextField.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextField.java index 3a70e1f..3541c67 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextField.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextField.java @@ -1,9 +1,9 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -16,8 +16,8 @@ import java.util.List; import com.ardor3d.extension.ui.event.ActionEvent; import com.ardor3d.extension.ui.event.ActionListener; import com.ardor3d.extension.ui.text.DefaultLatinTextFieldKeyHandler; -import com.ardor3d.extension.ui.text.UIKeyHandler; import com.ardor3d.extension.ui.text.TextSelection.SelectionState; +import com.ardor3d.extension.ui.text.UIKeyHandler; import com.ardor3d.input.InputState; import com.ardor3d.input.Key; import com.ardor3d.input.MouseButton; @@ -37,7 +37,7 @@ public class UITextField extends AbstractUITextEntryComponent { private final Rectangle2 _clipRectangleStore = new Rectangle2(); /** List of action listeners notified when the enter key is pressed. */ - private final List<ActionListener> _listeners = new ArrayList<ActionListener>(); + private final List<ActionListener> _listeners = new ArrayList<>(); public UITextField() { _disabledState = new UIState(); @@ -91,7 +91,7 @@ public class UITextField extends AbstractUITextEntryComponent { /** * Add the specified listener to this button's list of listeners notified when pressed. - * + * * @param listener */ public void addActionListener(final ActionListener listener) { @@ -100,7 +100,7 @@ public class UITextField extends AbstractUITextEntryComponent { /** * Remove the given listener from the notification list. - * + * * @param listener */ public boolean removeActionListener(final ActionListener listener) { @@ -169,8 +169,8 @@ public class UITextField extends AbstractUITextEntryComponent { // TODO: alpha of text... final boolean needsPop = getWorldRotation().isIdentity(); if (needsPop) { - _clipRectangleStore.set(getHudX() + getTotalLeft(), getHudY() + getTotalBottom(), - getContentWidth(), getContentHeight()); + _clipRectangleStore.set(getHudX() + getTotalLeft(), getHudY() + getTotalBottom(), getContentWidth(), + getContentHeight()); r.pushClip(_clipRectangleStore); } _uiText.render(r); @@ -206,12 +206,12 @@ public class UITextField extends AbstractUITextEntryComponent { @Override public void mouseEntered(final int mouseX, final int mouseY, final InputState state) { - // TODO: set cursor to text entry + // TODO: set cursor to text entry } @Override public void mouseDeparted(final int mouseX, final int mouseY, final InputState state) { - // TODO: set cursor to default + // TODO: set cursor to default } @Override diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITooltip.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITooltip.java index b1dcd7b..bc48ed7 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITooltip.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITooltip.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/EmptyBackdrop.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/EmptyBackdrop.java index a345520..5f9a213 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/EmptyBackdrop.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/EmptyBackdrop.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/GradientBackdrop.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/GradientBackdrop.java index ee156ad..6a7d090 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/GradientBackdrop.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/GradientBackdrop.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -97,8 +97,8 @@ public class GradientBackdrop extends UIBackdrop { final float pAlpha = UIComponent.getCurrentOpacity(); final Vector3 v = Vector3.fetchTempInstance(); - final Insets margin = comp.getMargin() != null ? comp.getMargin() : Insets.EMPTY; - final Insets border = comp.getBorder() != null ? comp.getBorder() : Insets.EMPTY; + final Insets margin = comp.getMargin() == null ? Insets.EMPTY : comp.getMargin(); + final Insets border = comp.getBorder() == null ? Insets.EMPTY : comp.getBorder(); v.set(margin.getLeft() + border.getLeft(), margin.getBottom() + border.getBottom(), 0); final Transform t = Transform.fetchTempInstance(); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/ImageBackdrop.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/ImageBackdrop.java index 79316bf..a9e3a4a 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/ImageBackdrop.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/ImageBackdrop.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -84,8 +84,8 @@ public class ImageBackdrop extends SolidBackdrop { final double width = _dims[2]; final double height = _dims[3]; - final Insets margin = comp.getMargin() != null ? comp.getMargin() : Insets.EMPTY; - final Insets border = comp.getBorder() != null ? comp.getBorder() : Insets.EMPTY; + final Insets margin = comp.getMargin() == null ? Insets.EMPTY : comp.getMargin(); + final Insets border = comp.getBorder() == null ? Insets.EMPTY : comp.getBorder(); x += margin.getLeft() + border.getLeft(); y += margin.getBottom() + border.getBottom(); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/MultiImageBackdrop.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/MultiImageBackdrop.java index d19c994..2b617ee 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/MultiImageBackdrop.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/MultiImageBackdrop.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -28,7 +28,7 @@ import com.ardor3d.renderer.Renderer; public class MultiImageBackdrop extends SolidBackdrop { /** The image(s) to draw. */ - private final List<TransformedSubTex> _images = new ArrayList<TransformedSubTex>(); + private final List<TransformedSubTex> _images = new ArrayList<>(); /** * Construct this back drop, using the default, no alpha backdrop color. @@ -74,8 +74,8 @@ public class MultiImageBackdrop extends SolidBackdrop { for (final TransformedSubTex entry : _images) { MultiImageBackdrop.getDimensions(entry, comp, bgwidth, bgheight, store); - final Insets margin = comp.getMargin() != null ? comp.getMargin() : Insets.EMPTY; - final Insets border = comp.getBorder() != null ? comp.getBorder() : Insets.EMPTY; + final Insets margin = comp.getMargin() == null ? Insets.EMPTY : comp.getMargin(); + final Insets border = comp.getBorder() == null ? Insets.EMPTY : comp.getBorder(); store[0] += margin.getLeft() + border.getLeft(); store[1] += margin.getBottom() + border.getBottom(); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/SolidBackdrop.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/SolidBackdrop.java index 000ff64..805190a 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/SolidBackdrop.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/SolidBackdrop.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -74,8 +74,8 @@ public class SolidBackdrop extends UIBackdrop { SolidBackdrop._standin.setDefaultColor(_color); final Vector3 v = Vector3.fetchTempInstance(); - final Insets margin = comp.getMargin() != null ? comp.getMargin() : Insets.EMPTY; - final Insets border = comp.getBorder() != null ? comp.getBorder() : Insets.EMPTY; + final Insets margin = comp.getMargin() == null ? Insets.EMPTY : comp.getMargin(); + final Insets border = comp.getBorder() == null ? Insets.EMPTY : comp.getBorder(); v.set(margin.getLeft() + border.getLeft(), margin.getBottom() + border.getBottom(), 0); final Transform t = Transform.fetchTempInstance(); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/UIBackdrop.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/UIBackdrop.java index 028b0c9..a0e2b79 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/UIBackdrop.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/UIBackdrop.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/EmptyBorder.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/EmptyBorder.java index 005f367..2b42930 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/EmptyBorder.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/EmptyBorder.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/ImageBorder.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/ImageBorder.java index 1146ecd..ba2f35c 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/ImageBorder.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/ImageBorder.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -149,7 +149,7 @@ public class ImageBorder extends UIBorder { final int borderHeight = UIBorder.getBorderHeight(comp); // Figure out our bottom left corner - final Insets margin = comp.getMargin() != null ? comp.getMargin() : Insets.EMPTY; + final Insets margin = comp.getMargin() == null ? Insets.EMPTY : comp.getMargin(); final double dX = margin.getLeft(); final double dY = margin.getBottom(); @@ -199,13 +199,13 @@ public class ImageBorder extends UIBorder { _topLeftCorner.getWidth(), _topLeftCorner.getHeight(), comp.getWorldTransform()); } if (_bottomLeftCorner != null) { - SubTexUtil.drawSubTex(renderer, _bottomLeftCorner, dX, dY, _bottomLeftCorner.getWidth(), - _bottomLeftCorner.getHeight(), comp.getWorldTransform()); + SubTexUtil.drawSubTex(renderer, _bottomLeftCorner, dX, dY, _bottomLeftCorner.getWidth(), _bottomLeftCorner + .getHeight(), comp.getWorldTransform()); } if (_topRightCorner != null) { SubTexUtil.drawSubTex(renderer, _topRightCorner, dX + (borderWidth - _topRightCorner.getWidth()), dY - + (borderHeight - _topRightCorner.getHeight()), _topRightCorner.getWidth(), - _topRightCorner.getHeight(), comp.getWorldTransform()); + + (borderHeight - _topRightCorner.getHeight()), _topRightCorner.getWidth(), _topRightCorner + .getHeight(), comp.getWorldTransform()); } if (_bottomRightCorner != null) { SubTexUtil.drawSubTex(renderer, _bottomRightCorner, dX + (borderWidth - _bottomRightCorner.getWidth()), dY, diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/SolidBorder.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/SolidBorder.java index 0024bc9..3c92d1b 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/SolidBorder.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/SolidBorder.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -132,7 +132,7 @@ public class SolidBorder extends UIBorder { final float pAlpha = UIComponent.getCurrentOpacity(); final Vector3 v = Vector3.fetchTempInstance(); - final Insets margin = comp.getMargin() != null ? comp.getMargin() : Insets.EMPTY; + final Insets margin = comp.getMargin() == null ? Insets.EMPTY : comp.getMargin(); v.set(margin.getLeft(), margin.getBottom(), 0); final Transform t = Transform.fetchTempInstance(); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/UIBorder.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/UIBorder.java index 645cf98..061ee9e 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/UIBorder.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/border/UIBorder.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/ActionEvent.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/ActionEvent.java index 82a441c..a3c5a89 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/ActionEvent.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/ActionEvent.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/ActionListener.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/ActionListener.java index d98a8e7..5438642 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/ActionListener.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/ActionListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/DragListener.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/DragListener.java index 1316f3e..4ab5f37 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/DragListener.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/DragListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/FrameDragListener.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/FrameDragListener.java index 66d639a..35b9d40 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/FrameDragListener.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/FrameDragListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -26,11 +26,13 @@ public class FrameDragListener implements DragListener { this.uiFrame = uiFrame; } + @Override public void startDrag(final int mouseX, final int mouseY) { oldX = mouseX; oldY = mouseY; } + @Override public void drag(final int mouseX, final int mouseY) { if (!uiFrame.isDraggable()) { return; @@ -63,11 +65,13 @@ public class FrameDragListener implements DragListener { /** * Do nothing. */ + @Override public void endDrag(final UIComponent component, final int mouseX, final int mouseY) {} /** * Check if we are dragging's the frames title bar label. */ + @Override public boolean isDragHandle(final UIComponent component, final int mouseX, final int mouseY) { return component == uiFrame.getTitleBar().getTitleLabel(); } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/FrameResizeListener.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/FrameResizeListener.java index 47a5d5c..1479757 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/FrameResizeListener.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/FrameResizeListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -28,6 +28,7 @@ public final class FrameResizeListener implements DragListener { _uiFrameStatusBar = uiFrameStatusBar; } + @Override public void startDrag(final int mouseX, final int mouseY) { final Vector3 vec = Vector3.fetchTempInstance(); vec.set(mouseX, mouseY, 0); @@ -44,10 +45,12 @@ public final class FrameResizeListener implements DragListener { _initFrameTransform.set(frame.getWorldTransform()); } + @Override public void drag(final int mouseX, final int mouseY) { resizeFrameByPosition(mouseX, mouseY); } + @Override public void endDrag(final UIComponent component, final int mouseX, final int mouseY) { resizeFrameByPosition(mouseX, mouseY); } @@ -104,6 +107,7 @@ public final class FrameResizeListener implements DragListener { frame.layout(); } + @Override public boolean isDragHandle(final UIComponent component, final int mouseX, final int mouseY) { return component == _uiFrameStatusBar.getResizeButton(); } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/SelectionListener.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/SelectionListener.java index 6fceb29..d1b2db7 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/SelectionListener.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/event/SelectionListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayout.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayout.java index b136420..611eea1 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayout.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayout.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.extension.ui.layout; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -20,7 +21,6 @@ import com.ardor3d.extension.ui.util.Alignment; import com.ardor3d.math.Rectangle2; import com.ardor3d.math.Vector2; import com.ardor3d.scenegraph.Spatial; -import com.google.common.collect.Maps; /** * <p> @@ -51,7 +51,7 @@ import com.google.common.collect.Maps; public class AnchorLayout extends UILayout { /** map used to track anchor relationship during layout. */ - private final Map<UIComponent, AnchorRecord> _records = Maps.newHashMap(); + private final Map<UIComponent, AnchorRecord> _records = new HashMap<>(); // Various min/max values set and used during a layout operation. private int _maxX = 0; @@ -219,6 +219,6 @@ public class AnchorLayout extends UILayout { private class AnchorRecord { private transient boolean visited = false; - private transient final ArrayList<UIComponent> dependants = new ArrayList<UIComponent>(); + private transient final ArrayList<UIComponent> dependants = new ArrayList<>(); } } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayoutData.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayoutData.java index d26c08b..ddb839d 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayoutData.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayoutData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/BorderLayout.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/BorderLayout.java index b7c7f40..d596b19 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/BorderLayout.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/BorderLayout.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/BorderLayoutData.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/BorderLayoutData.java index fbf71a0..d3a2694 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/BorderLayoutData.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/BorderLayoutData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayout.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayout.java index 44b9666..b4e8e1d 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayout.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayout.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -198,8 +198,8 @@ public class GridLayout extends UILayout { ArrayList<Integer> columnWidths; LayoutGrid() { - components = new LinkedList<LayoutComponent>(); - columnWidths = new ArrayList<Integer>(); + components = new LinkedList<>(); + columnWidths = new ArrayList<>(); } void add(final UIComponent c) { diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayoutData.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayoutData.java index e58f750..38b8b31 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayoutData.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayoutData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java index 82fb762..61c3a10 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,13 +10,13 @@ package com.ardor3d.extension.ui.layout; +import java.util.ArrayList; import java.util.List; import com.ardor3d.extension.ui.UIComponent; import com.ardor3d.extension.ui.UIContainer; import com.ardor3d.math.Rectangle2; import com.ardor3d.scenegraph.Spatial; -import com.google.common.collect.Lists; /** * This layout places components in either a horizontal or vertical row, ordered as they are placed in their container. @@ -94,8 +94,8 @@ public class RowLayout extends UILayout { final Rectangle2 storeB = Rectangle2.fetchTempInstance(); // Grab a list of components, squeezing them down to their min size on the flow axis - List<UIComponent> comps = Lists.newArrayList(); - List<UIComponent> compsBack = Lists.newArrayList(); + List<UIComponent> comps = new ArrayList<>(); + List<UIComponent> compsBack = new ArrayList<>(); for (int i = 0; i < content.size(); i++) { final Spatial spat = content.get(i); if (spat instanceof UIComponent) { @@ -179,8 +179,8 @@ public class RowLayout extends UILayout { final Rectangle2 rect = comp.getRelativeComponentBounds(storeA); if (_horizontal) { - comp.setLocalXY(x - rect.getX(), Math.max(container.getContentHeight() / 2 - rect.getHeight() / 2 - - rect.getY(), 0)); + comp.setLocalXY(x - rect.getX(), + Math.max(container.getContentHeight() / 2 - rect.getHeight() / 2 - rect.getY(), 0)); x += rect.getWidth(); } else { comp.setLocalXY(Math.max(container.getContentWidth() / 2 - rect.getWidth() / 2 - rect.getX(), 0), y diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/UILayout.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/UILayout.java index f902a78..90977e8 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/UILayout.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/UILayout.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/UILayoutData.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/UILayoutData.java index 643e6c2..94f9176 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/UILayoutData.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/UILayoutData.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/ComboBoxModel.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/ComboBoxModel.java index 1d88da0..7064cfa 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/ComboBoxModel.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/ComboBoxModel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultComboBoxModel.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultComboBoxModel.java index e2f4796..38fd80e 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultComboBoxModel.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultComboBoxModel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,16 +10,15 @@ package com.ardor3d.extension.ui.model; +import java.util.ArrayList; import java.util.List; -import com.google.common.collect.Lists; - /** * Default implementation of a ComboBox model. */ public class DefaultComboBoxModel implements ComboBoxModel { - protected List<ModelElement> _elements = Lists.newArrayList(); + protected List<ModelElement> _elements = new ArrayList<>(); public DefaultComboBoxModel() {} diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultSliderModel.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultSliderModel.java index 8a5b7ab..4963f39 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultSliderModel.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultSliderModel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -40,14 +40,17 @@ public class DefaultSliderModel implements SliderModel { setMaxValue(maxValue); } + @Override public int getCurrentValue() { return _currentValue; } + @Override public void setCurrentValue(final int currentValue) { setCurrentValue(currentValue, null); } + @Override public void setCurrentValue(final int currentValue, final UISlider slider) { if (_currentValue == currentValue) { return; @@ -58,18 +61,22 @@ public class DefaultSliderModel implements SliderModel { } } + @Override public int getMaxValue() { return _maxValue; } + @Override public void setMaxValue(final int maxValue) { _maxValue = maxValue; } + @Override public int getMinValue() { return _minValue; } + @Override public void setMinValue(final int minValue) { _minValue = minValue; } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/SliderModel.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/SliderModel.java index a6cd7b8..296354e 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/SliderModel.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/SliderModel.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/Skin.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/Skin.java index 8d7b5bc..d867102 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/Skin.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/Skin.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/SkinManager.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/SkinManager.java index 6cc5005..fcd2eab 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/SkinManager.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/SkinManager.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/SkinningTask.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/SkinningTask.java index 5907c48..8dfc173 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/SkinningTask.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/SkinningTask.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/generic/GenericSkin.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/generic/GenericSkin.java index d3efb0e..e62f38b 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/generic/GenericSkin.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/skin/generic/GenericSkin.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CharacterDescriptor.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CharacterDescriptor.java index 2daa02f..10b6db9 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CharacterDescriptor.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CharacterDescriptor.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CopyPasteManager.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CopyPasteManager.java index a2d47b0..2ac0bb1 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CopyPasteManager.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/CopyPasteManager.java @@ -1,15 +1,18 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.ui.text; +import com.ardor3d.ui.text.CopyPasteImpl; +import com.ardor3d.ui.text.NullCopyPasteImpl; + public enum CopyPasteManager { INSTANCE; @@ -21,14 +24,22 @@ public enum CopyPasteManager { public String getClipBoardContents() { if (_impl == null) { - _impl = new AwtCopyPasteImpl(); + try { + _impl = (CopyPasteImpl) Class.forName("com.ardor3d.ui.text.awt.AwtCopyPasteImpl").newInstance(); + } catch (final Throwable t) { + _impl = new NullCopyPasteImpl(); + } } return _impl.getClipBoardContents(); } public void setClipBoardContents(final String contents) { if (_impl == null) { - _impl = new AwtCopyPasteImpl(); + try { + _impl = (CopyPasteImpl) Class.forName("com.ardor3d.ui.text.awt.AwtCopyPasteImpl").newInstance(); + } catch (final Throwable t) { + _impl = new NullCopyPasteImpl(); + } } _impl.setClipBoardContents(contents); } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextAreaKeyHandler.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextAreaKeyHandler.java index af850ee..98aee91 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextAreaKeyHandler.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextAreaKeyHandler.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextFieldKeyHandler.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextFieldKeyHandler.java index 5efe4ba..a8d0a59 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextFieldKeyHandler.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextFieldKeyHandler.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/RenderedText.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/RenderedText.java index ac75b7a..cb8c004 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/RenderedText.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/RenderedText.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,7 +10,9 @@ package com.ardor3d.extension.ui.text; +import java.util.ArrayList; import java.util.Collection; +import java.util.LinkedList; import java.util.List; import com.ardor3d.math.Vector2; @@ -21,12 +23,11 @@ import com.ardor3d.scenegraph.Renderable; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.scenegraph.event.DirtyType; import com.ardor3d.util.scenegraph.RenderDelegate; -import com.google.common.collect.Lists; public class RenderedText extends Node implements Renderable { protected String _plainText = null; - protected List<StyleSpan> _parsedStyles = Lists.newLinkedList(); + protected List<StyleSpan> _parsedStyles = new LinkedList<>(); protected float _width; protected float _height; @@ -202,11 +203,11 @@ public class RenderedText extends Node implements Renderable { } public static class RenderedTextData { - public List<Integer> _xStarts = Lists.newArrayList(); - public List<Integer> _lineHeights = Lists.newArrayList(); - public List<Integer> _lineEnds = Lists.newArrayList(); - public List<Integer> _fontHeights = Lists.newArrayList(); - public List<CharacterDescriptor> _characters = Lists.newArrayList(); + public List<Integer> _xStarts = new ArrayList<>(); + public List<Integer> _lineHeights = new ArrayList<>(); + public List<Integer> _lineEnds = new ArrayList<>(); + public List<Integer> _fontHeights = new ArrayList<>(); + public List<CharacterDescriptor> _characters = new ArrayList<>(); public RenderedTextData() {} diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/StyleConstants.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/StyleConstants.java index cdd2912..612e5ad 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/StyleConstants.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/StyleConstants.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/StyleSpan.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/StyleSpan.java index 111a287..85c2db2 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/StyleSpan.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/StyleSpan.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextCaret.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextCaret.java index bd987b5..ba5460d 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextCaret.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextCaret.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextFactory.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextFactory.java index f187d57..66fdc35 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextFactory.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,8 +11,10 @@ package com.ardor3d.extension.ui.text; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -32,8 +34,6 @@ import com.ardor3d.renderer.state.TextureState; import com.ardor3d.scenegraph.FloatBufferData; import com.ardor3d.scenegraph.MeshData; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.collect.Multimap; public enum TextFactory { @@ -83,11 +83,11 @@ public enum TextFactory { rVal.setStyled(styled); // note: spans must be in order by start index - final LinkedList<StyleSpan> spans = Lists.newLinkedList(); + final LinkedList<StyleSpan> spans = new LinkedList<>(); final String plainText; if (styled && _styleParser != null) { // parse text for style spans - final List<StyleSpan> styleStore = Lists.newArrayList(); + final List<StyleSpan> styleStore = new ArrayList<>(); plainText = _styleParser.parseStyleSpans(text, styleStore); Collections.sort(styleStore); if (!styleStore.isEmpty()) { @@ -110,7 +110,7 @@ public enum TextFactory { textData.reset(); char prevChar = 0, c = 0; - final List<StyleSpan> currentStyles = Lists.newLinkedList(); + final List<StyleSpan> currentStyles = new LinkedList<>(); // indexed by character offset final List<CharacterDescriptor> descs = textData._characters; final List<Integer> descXStarts = textData._xStarts; @@ -123,7 +123,7 @@ public enum TextFactory { int maxLineHeight = 0, xOffset = 0, maxSizeHeight = 0; UIFont prevFont = null; double scale = 1, prevScale = 0; - final Map<String, Object> stylesMap = Maps.newHashMap(); + final Map<String, Object> stylesMap = new HashMap<>(); final char[] chars = plainText.toCharArray(); for (int i = 0; i < chars.length; i++) { @@ -156,7 +156,7 @@ public enum TextFactory { } // find the UIFont related to the given font family & size & styles - final AtomicReference<Double> scaleRef = new AtomicReference<Double>(); + final AtomicReference<Double> scaleRef = new AtomicReference<>(); final UIFont font = _fontProvider.getClosestMatchingFont(stylesMap, scaleRef); if (font == null) { return rVal; diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextMesh.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextMesh.java index c7e3a91..5cdc215 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextMesh.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextMesh.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextSelection.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextSelection.java index d305b1f..15c71c0 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextSelection.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextSelection.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.extension.ui.text; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.List; import com.ardor3d.extension.ui.UIComponent; @@ -25,7 +26,6 @@ import com.ardor3d.renderer.state.BlendState.SourceFunction; import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.MeshData; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.Lists; public abstract class TextSelection { @@ -184,7 +184,7 @@ public abstract class TextSelection { final RenderedTextData data = getTextData(); float xStart = 0, xEnd = 0, height = 0, yOffset = 0; boolean exit = false; - final List<Float> verts = Lists.newArrayList(); + final List<Float> verts = new ArrayList<>(); for (int j = 0; !exit && j < data._lineEnds.size(); j++) { height = data._lineHeights.get(j); final int end = data._lineEnds.get(j); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/UIKeyHandler.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/UIKeyHandler.java index fbffb75..3dc62e0 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/UIKeyHandler.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/UIKeyHandler.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/BMFontProvider.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/BMFontProvider.java index 6e89361..d93f39d 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/BMFontProvider.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/BMFontProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -12,6 +12,8 @@ package com.ardor3d.extension.ui.text.font; import java.io.IOException; import java.net.URL; +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; @@ -26,8 +28,6 @@ import com.ardor3d.ui.text.BMFont.Char; import com.ardor3d.util.export.binary.BinaryImporter; import com.ardor3d.util.resource.ResourceLocatorTool; import com.ardor3d.util.resource.URLResourceSource; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; /** * Provides BMFonts for use in UIFont. @@ -36,9 +36,9 @@ public class BMFontProvider implements FontProvider { private static Logger logger = Logger.getLogger(BMFontProvider.class.getName()); - protected Map<UIFont, Integer> _scoreMap = Maps.newHashMap(); + protected Map<UIFont, Integer> _scoreMap = new HashMap<>(); - protected final Set<FontInfo> _fonts = Sets.newHashSet(); + protected final Set<FontInfo> _fonts = new HashSet<>(); public void addFont(final String source, final String family, final int size, final boolean bold, final boolean italic) { @@ -128,7 +128,7 @@ public class BMFontProvider implements FontProvider { } } - final Map<Character, CharacterDescriptor> descriptors = Maps.newHashMap(); + final Map<Character, CharacterDescriptor> descriptors = new HashMap<>(); for (final int val : closest.bmFont.getMappedChars()) { final Char c = closest.bmFont.getChar(val); final CharacterDescriptor desc = new CharacterDescriptor(c.x, c.y, c.width, c.height, c.xadvance, diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/FontProvider.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/FontProvider.java index 16a5090..d84c650 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/FontProvider.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/FontProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/UIFont.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/UIFont.java index f0a191d..4bb01de 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/UIFont.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/UIFont.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,19 +10,19 @@ package com.ardor3d.extension.ui.text.font; +import java.util.HashMap; import java.util.Map; import com.ardor3d.extension.ui.text.CharacterDescriptor; import com.ardor3d.image.Texture2D; -import com.google.common.collect.Maps; /** * Defines a texture based font for use in the UI system. */ public class UIFont { - private final Map<Character, CharacterDescriptor> _charDescriptors = Maps.newHashMap(); - private final Map<Character, Map<Character, Integer>> _kernMap = Maps.newHashMap(); + private final Map<Character, CharacterDescriptor> _charDescriptors = new HashMap<>(); + private final Map<Character, Map<Character, Integer>> _kernMap = new HashMap<>(); private final Texture2D _fontTexture; private final int _fontHeight; private final int _fontSize; @@ -59,7 +59,7 @@ public class UIFont { public void addKerning(final char charA, final char charB, final int amount) { Map<Character, Integer> map = _kernMap.get(charA); if (map == null) { - map = Maps.newHashMap(); + map = new HashMap<>(); _kernMap.put(charA, map); } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParser.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParser.java index 6afa78f..fc56e8b 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParser.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParser.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,7 @@ package com.ardor3d.extension.ui.text.parser; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; @@ -21,11 +22,11 @@ import com.ardor3d.extension.ui.text.StyleConstants; import com.ardor3d.extension.ui.text.StyleSpan; import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.type.ReadOnlyColorRGBA; -import com.google.common.collect.Lists; public class ForumLikeMarkupParser implements StyleParser { Comparator<StyleSpan> endSorter = new Comparator<StyleSpan>() { + @Override public int compare(final StyleSpan o1, final StyleSpan o2) { return o1.getSpanStart() + o1.getSpanLength() - (o2.getSpanStart() + o2.getSpanLength()); } @@ -37,7 +38,7 @@ public class ForumLikeMarkupParser implements StyleParser { int index = 0; TagStatus tagStatus = TagStatus.NONE; String currTagText = ""; - final LinkedList<StyleSpan> buildingSpans = Lists.newLinkedList(); + final LinkedList<StyleSpan> buildingSpans = new LinkedList<>(); final StringTokenizer st = new StringTokenizer(text, "[]\\", true); String token; while (st.hasMoreTokens()) { @@ -183,12 +184,12 @@ public class ForumLikeMarkupParser implements StyleParser { } // list of spans, sorted by start index - final List<StyleSpan> starts = Lists.newArrayList(); + final List<StyleSpan> starts = new ArrayList<>(); starts.addAll(spans); Collections.sort(starts); // list of spans, to be sorted by end index - final List<StyleSpan> ends = Lists.newLinkedList(); + final List<StyleSpan> ends = new LinkedList<>(); final StringBuilder builder = new StringBuilder(); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/StyleParser.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/StyleParser.java index 8405ed6..de71b40 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/StyleParser.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/StyleParser.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Alignment.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Alignment.java index 9f79f66..63c1cc2 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Alignment.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Alignment.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/ButtonGroup.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/ButtonGroup.java index ad7f059..42b661a 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/ButtonGroup.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/ButtonGroup.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -23,7 +23,7 @@ import com.ardor3d.extension.ui.UIButton; public class ButtonGroup { /** The list of buttons participating in this group. */ - private final List<UIButton> _buttons = new ArrayList<UIButton>(); + private final List<UIButton> _buttons = new ArrayList<>(); /** The currently selected button. */ private UIButton _selected; diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Dimension.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Dimension.java index 31cb508..922d5a6 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Dimension.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Dimension.java @@ -1,15 +1,17 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.extension.ui.util; +import java.util.Objects; + /** * This class is patterned after awt's {@link java.awt.Dimension Dimension} class. It describes the width and height of * something (in our case, generally a UI element.) @@ -28,7 +30,7 @@ public class Dimension { /** * Construct a new dimension object using the given values. - * + * * @param width * @param height */ @@ -39,7 +41,7 @@ public class Dimension { /** * Construct a new dimension object using the values of the given source. - * + * * @param source */ public Dimension(final Dimension source) { @@ -90,10 +92,7 @@ public class Dimension { @Override public int hashCode() { - int result = 17; - result += 31 * result + getWidth(); - result += 31 * result + getHeight(); - return result; + return Objects.hash(Integer.valueOf(getWidth()), Integer.valueOf(getHeight())); } @Override diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/HudListener.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/HudListener.java index 443308a..7a1750f 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/HudListener.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/HudListener.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Insets.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Insets.java index 941b707..ded4388 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Insets.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Insets.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,6 +10,8 @@ package com.ardor3d.extension.ui.util; +import java.util.Objects; + /** * This class is patterned after awt's {@link java.awt.Insets Insets} class. It describes the margins on four sides of a * rectangular area and is the foundation of our UIBorder class. @@ -119,11 +121,7 @@ public class Insets { @Override public int hashCode() { - int result = 17; - result += 31 * result + getLeft(); - result += 31 * result + getRight(); - result += 31 * result + getTop(); - result += 31 * result + getBottom(); - return result; + return Objects.hash(Integer.valueOf(getLeft()), Integer.valueOf(getRight()), Integer.valueOf(getTop()), + Integer.valueOf(getBottom())); } } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/SubTex.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/SubTex.java index 7d84897..551a7db 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/SubTex.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/SubTex.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/SubTexUtil.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/SubTexUtil.java index 92c50f9..24fc794 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/SubTexUtil.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/SubTexUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/TransformedSubTex.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/TransformedSubTex.java index dc3140d..c17bd00 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/TransformedSubTex.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/TransformedSubTex.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -66,6 +66,7 @@ public class TransformedSubTex extends SubTex implements Comparable<TransformedS return _priority; } + @Override public int compareTo(final TransformedSubTex other) { return _priority - other._priority; } diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/UIQuad.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/UIQuad.java index 64fd253..b9d98b8 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/UIQuad.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/UIQuad.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/ardor3d-ui/src/main/test/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParserTest.java b/ardor3d-ui/src/test/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParserTest.java index ccd67cc..7b21df7 100644 --- a/ardor3d-ui/src/main/test/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParserTest.java +++ b/ardor3d-ui/src/test/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParserTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -10,9 +10,11 @@ package com.ardor3d.extension.ui.text.parser; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.SortedSet; +import java.util.TreeSet; import org.junit.Assert; import org.junit.Before; @@ -20,8 +22,6 @@ import org.junit.Test; import com.ardor3d.extension.ui.text.StyleConstants; import com.ardor3d.extension.ui.text.StyleSpan; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; public class ForumLikeMarkupParserTest { @@ -35,7 +35,7 @@ public class ForumLikeMarkupParserTest { @Test public void parseWithoutMarkup() { final String text = "A text without any markup what so ever [13] dum di dum [/23]"; - final List<StyleSpan> spans = Lists.newArrayList(); + final List<StyleSpan> spans = new ArrayList<>(); final String result = parser.parseStyleSpans(text, spans); Assert.assertEquals(text, result); @@ -46,7 +46,7 @@ public class ForumLikeMarkupParserTest { @Test public void parseWithSimpleStyle() throws Exception { final String text = "A text with [size=30]simple markup[/size] dum di dum"; - final List<StyleSpan> spans = Lists.newArrayList(); + final List<StyleSpan> spans = new ArrayList<>(); final String result = parser.parseStyleSpans(text, spans); Assert.assertEquals("A text with simple markup dum di dum", result); @@ -62,13 +62,13 @@ public class ForumLikeMarkupParserTest { @Test public void parseWithNestedStyle() throws Exception { final String text = "A text [size=30]with [f=arial]simple markup[/f][/size] dum di dum"; - final List<StyleSpan> spans = Lists.newArrayList(); + final List<StyleSpan> spans = new ArrayList<>(); final String result = parser.parseStyleSpans(text, spans); Assert.assertEquals("A text with simple markup dum di dum", result); Assert.assertEquals(2, spans.size()); - final SortedSet<StyleSpan> sortedSpans = Sets.newTreeSet(spans); + final SortedSet<StyleSpan> sortedSpans = new TreeSet<>(spans); final Iterator<StyleSpan> spanIterator = sortedSpans.iterator(); final StyleSpan span1 = spanIterator.next(); Assert.assertEquals(7, span1.getSpanStart()); @@ -83,13 +83,13 @@ public class ForumLikeMarkupParserTest { @Test public void parseWithNestedSameStyleBackToBackTags() throws Exception { final String text = "[size=10][size=20]A text [/size]with simple markup[/size] dum di dum"; - final List<StyleSpan> spans = Lists.newArrayList(); + final List<StyleSpan> spans = new ArrayList<>(); final String result = parser.parseStyleSpans(text, spans); Assert.assertEquals("A text with simple markup dum di dum", result); Assert.assertEquals(2, spans.size()); - final SortedSet<StyleSpan> sortedSpans = Sets.newTreeSet(spans); + final SortedSet<StyleSpan> sortedSpans = new TreeSet<>(spans); final Iterator<StyleSpan> spanIterator = sortedSpans.iterator(); final StyleSpan span1 = spanIterator.next(); Assert.assertEquals(0, span1.getSpanStart()); diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..7bdaa56 --- /dev/null +++ b/build.gradle @@ -0,0 +1,36 @@ +allprojects { + apply plugin: 'maven' + + group = 'com.ardor3d' +version = '1.0-SNAPSHOT' +} + +subprojects { + apply plugin: 'java' + sourceCompatibility = 1.7 + targetCompatibility = 1.7 + + task packageSources(type: Jar) { +classifier = 'sources' +from sourceSets.main.allSource + +} +artifacts.archives packageSources + repositories { + mavenLocal() + + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } + maven { url "http://repo.maven.apache.org/maven2" } + maven { url "http://jogamp.org/deployment/maven" } + maven { url "https://swt-repo.googlecode.com/svn/repo/" } + } + + configurations.all { +} + dependencies { + testCompile group: 'junit', name: 'junit', version:'4.10' + testCompile group: 'org.easymock', name: 'easymockclassextension', version:'2.4' +} + + +} diff --git a/eclipse_formats/Ardor3DTemplates.xml b/eclipse_formats/Ardor3DTemplates.xml index 339600b..b80324c 100644 --- a/eclipse_formats/Ardor3DTemplates.xml +++ b/eclipse_formats/Ardor3DTemplates.xml @@ -14,7 +14,7 @@ ${body_statement}</template><template autoinsert="true" context="settercomment_c </template><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/** * @return the ${bare_field_name} */</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template><template autoinsert="false" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">/** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 0000000..b761216 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1443763 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Aug 02 13:25:47 GMT+01:00 2014 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-bin.zip @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +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" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@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 + +@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= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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 init + +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 init + +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 + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +: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 %CMD_LINE_ARGS% + +: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 @@ -5,10 +5,10 @@ <packaging>pom</packaging> <version>1.0-SNAPSHOT</version> - <name>Ardor 3D</name> - <description>A free, open source 3D graphics engine written in Java</description> - <url>http://www.ardor3d.com</url> - <inceptionYear>2008</inceptionYear> + <name>JogAmp's Ardor3D Continuation</name> + <description>A general-purpose, professionally oriented, open source, scenegraph based 3D engine written in Java</description> + <url>http://jogamp.org/deployment/ardor3d/</url> + <inceptionYear>2014</inceptionYear> <licenses> <license> @@ -19,33 +19,41 @@ </licenses> <scm> - <connection>scm:git:git://github.com/Renanse/Ardor3D.git</connection> - <developerConnection>scm:git:[email protected]:Renanse/Ardor3D.git</developerConnection> - <url>https://github.com/Renanse/Ardor3D</url> + <connection>scm:git:git://github.com/gouessej/Ardor3D.git</connection> + <developerConnection>scm:git:[email protected]:gouessej/Ardor3D.git</developerConnection> + <url>https://github.com/gouessej/Ardor3D</url> </scm> <developers> <developer> - <id>renanse</id> - <name>Joshua Slack</name> - <email>[email protected]</email> + <id>gouessej</id> + <name>Julien Gouesse</name> + <url>http://gouessej.wordpress.com</url> + <organization>JogAmp community</organization> + <organizationUrl>http://jogamp.org</organizationUrl> </developer> </developers> + <issueManagement> + <url>https://github.com/gouessej/Ardor3D/issues</url> + </issueManagement> + <parent> <groupId>org.sonatype.oss</groupId> <artifactId>oss-parent</artifactId> - <version>7</version> + <version>9</version> </parent> <modules> <module>ardor3d-savable</module> <module>ardor3d-math</module> <module>ardor3d-core</module> + <module>ardor3d-jinput</module> <module>ardor3d-jogl</module> - <module>ardor3d-lwjgl</module> <module>ardor3d-swt</module> + <module>ardor3d-jogl-swt</module> <module>ardor3d-awt</module> + <module>ardor3d-jogl-awt</module> <module>ardor3d-extras</module> <module>ardor3d-effects</module> <module>ardor3d-collada</module> @@ -64,16 +72,16 @@ --> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> - <version>2.5.2</version> + <version>3.0.2</version> <configuration> <threshold>Normal</threshold> </configuration> </plugin> - <plugin> + <!--<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> - <version>2.5.2</version> - </plugin> + <version>2.7</version> + </plugin>--> <plugin> <!-- NOTE: Due to http://jira.codehaus.org/browse/MJAVADOC-116 to generate the aggregated javadoc one first has to do 'mvn install' @@ -81,18 +89,20 @@ --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>2.9.1</version> + <version>2.10.3</version> <configuration> <bottom><![CDATA[<i>Copyright © {inceptionYear}-{currentYear} Ardor Labs. All Rights Reserved.</i>]]> </bottom> <links> <link>http://docs.oracle.com/javase/6/docs/api/</link> </links> + <destDir>javadoc</destDir> <linksource>true</linksource> <quiet>true</quiet> <show>private</show> <sourcepath>${basedir}${path.separator}src${path.separator}main${path.separator}java</sourcepath> <encoding>UTF-8</encoding> + <additionalparam>-Xdoclint:none</additionalparam> </configuration> <reportSets> <reportSet> @@ -107,27 +117,36 @@ </reporting> <build> + <!-- Allows deployment over ssh --> + <extensions> + <extension> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-ssh-external</artifactId> + <version>2.10</version> + </extension> + </extensions> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.1</version> + <version>3.3</version> <configuration> - <source>1.6</source> - <target>1.6</target> + <source>1.7</source> + <target>1.7</target> <encoding>UTF-8</encoding> + <debug>true</debug> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>2.4</version> + <version>2.6</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> - <version>2.6</version> + <version>2.7</version> <configuration> <encoding>UTF-8</encoding> </configuration> @@ -135,12 +154,12 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> - <version>2.2.1</version> + <version>2.4</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>2.9.1</version> + <version>2.10.3</version> <!-- duplicated because of http://jira.codehaus.org/browse/MSITE-523 --> <configuration> <bottom><![CDATA[<i>Copyright © {inceptionYear}-{currentYear} Ardor Labs. All Rights Reserved.</i>]]> @@ -148,6 +167,7 @@ <links> <link>http://docs.oracle.com/javase/6/docs/api/</link> </links> + <destDir>javadoc</destDir> <linksource>true</linksource> <quiet>true</quiet> <show>private</show> @@ -158,22 +178,22 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> - <version>2.4</version> + <version>2.5.5</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> - <version>2.8.1</version> + <version>2.8.2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> - <version>2.4</version> + <version>2.5.2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> - <version>2.4.1</version> + <version>2.5.2</version> <configuration> <autoVersionSubmodules>true</autoVersionSubmodules> <tagNameFormat>v@{project.version}</tagNameFormat> @@ -188,6 +208,11 @@ </configuration> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>2.8.1</version> + </plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> @@ -210,8 +235,8 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> - <source>1.6</source> - <target>1.6</target> + <source>1.7</source> + <target>1.7</target> </configuration> </plugin> <plugin> @@ -233,7 +258,7 @@ <manifestLocation>target/classes/META-INF</manifestLocation> <instructions> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> - <Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnvironment> + <Bundle-RequiredExecutionEnvironment>JavaSE-1.7</Bundle-RequiredExecutionEnvironment> </instructions> </configuration> </plugin> @@ -244,8 +269,8 @@ <!-- these properties help simplify specifying some commonly occurring variables --> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <jogamp.version>2.1.4-rc-20140126</jogamp.version> - <lwjgl.version>2.8.4</lwjgl.version> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <jogamp.version>2.3.2</jogamp.version> <swt.version>4.3</swt.version> </properties> @@ -257,18 +282,18 @@ <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> - <version>14.0.1</version> + <version>19.0</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.10</version> + <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.easymock</groupId> <artifactId>easymockclassextension</artifactId> - <version>2.4</version> + <version>3.2</version> <scope>test</scope> </dependency> <dependency> @@ -292,24 +317,24 @@ <version>${jogamp.version}</version> </dependency> <dependency> - <groupId>org.lwjgl.lwjgl</groupId> - <artifactId>lwjgl</artifactId> - <version>${lwjgl.version}</version> + <groupId>net.java.jinput</groupId> + <artifactId>jinput</artifactId> + <version>2.0.6</version> </dependency> <dependency> - <groupId>org.lwjgl.lwjgl</groupId> - <artifactId>lwjgl_util</artifactId> - <version>${lwjgl.version}</version> + <groupId>net.java.jinput</groupId> + <artifactId>jinput-platform</artifactId> + <version>2.0.6</version> </dependency> <dependency> <groupId>org.jdom</groupId> <artifactId>jdom2</artifactId> - <version>2.0.4</version> + <version>2.0.6</version> </dependency> <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> - <version>1.1.4</version> + <version>1.1.6</version> </dependency> <dependency> <groupId>org.eclipse.swt</groupId> @@ -324,20 +349,20 @@ </dependencies> </dependencyManagement> - <profiles> - <!-- This profile activated by specifying -Phudson on command line --> + <!-- This profile activated by specifying -Phudson on command line (not used yet) --> + <!--<profiles> <profile> <id>hudson</id> <distributionManagement> <repository> <id>Ardor3D-releases</id> <name>Ardor3D releases</name> - <url>http://ardor3d.com:8081/nexus/content/repositories/releases</url> + <url>scpexe://jogamp.org/srv/www/jogamp.org/deployment/ardor3d/releases</url> </repository> <snapshotRepository> <id>Ardor3D-snapshots</id> <name>Ardor3D snapshots</name> - <url>http://ardor3d.com:8081/nexus/content/repositories/snapshots</url> + <url>scpexe://jogamp.org/srv/www/jogamp.org/deployment/ardor3d/snapshots</url> </snapshotRepository> </distributionManagement> <build> @@ -353,7 +378,7 @@ </plugins> </build> </profile> - </profiles> + </profiles>--> <!-- this section specifies dependencies that are inherited by all sub-modules --> <dependencies> diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..5838923 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,36 @@ +rootProject.name = 'ardor3d' +include ':ardor3d-savable' +include ':ardor3d-math' +include ':ardor3d-core' +include ':ardor3d-jinput' +include ':ardor3d-jogl' +include ':ardor3d-swt' +include ':ardor3d-jogl-swt' +include ':ardor3d-awt' +include ':ardor3d-jogl-awt' +include ':ardor3d-extras' +include ':ardor3d-effects' +include ':ardor3d-collada' +include ':ardor3d-animation' +include ':ardor3d-ui' +include ':ardor3d-terrain' +include ':ardor3d-examples' +include ':distribution' + +project(':ardor3d-savable').projectDir = "$rootDir/ardor3d-savable" as File +project(':ardor3d-math').projectDir = "$rootDir/ardor3d-math" as File +project(':ardor3d-core').projectDir = "$rootDir/ardor3d-core" as File +project(':ardor3d-jinput').projectDir = "$rootDir/ardor3d-jinput" as File +project(':ardor3d-jogl').projectDir = "$rootDir/ardor3d-jogl" as File +project(':ardor3d-swt').projectDir = "$rootDir/ardor3d-swt" as File +project(':ardor3d-jogl-swt').projectDir = "$rootDir/ardor3d-jogl-swt" as File +project(':ardor3d-awt').projectDir = "$rootDir/ardor3d-awt" as File +project(':ardor3d-jogl-awt').projectDir = "$rootDir/ardor3d-jogl-awt" as File +project(':ardor3d-extras').projectDir = "$rootDir/ardor3d-extras" as File +project(':ardor3d-effects').projectDir = "$rootDir/ardor3d-effects" as File +project(':ardor3d-collada').projectDir = "$rootDir/ardor3d-collada" as File +project(':ardor3d-animation').projectDir = "$rootDir/ardor3d-animation" as File +project(':ardor3d-ui').projectDir = "$rootDir/ardor3d-ui" as File +project(':ardor3d-terrain').projectDir = "$rootDir/ardor3d-terrain" as File +project(':ardor3d-examples').projectDir = "$rootDir/ardor3d-examples" as File +project(':distribution').projectDir = "$rootDir/ardor3d-distribution" as File
\ No newline at end of file |