From 26f130ffd5b2b9a329eba743de559fd996e4ce54 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 23 Mar 2022 13:37:49 +0100 Subject: [PATCH] [DEV] commit all with new insland --- samples/.settings/org.eclipse.jdt.ui.prefs | 139 ++++++++++++++++++ .../CollisionTestApplication.java | 2 +- .../ege/lightTest/LightTestApplication.java | 4 +- .../ege/lowPoly/LowPolyApplication.java | 33 ++--- .../loxelEngine/LoxelApplicationPerso.java | 2 +- .../atriasoft/ege/mapFactory/EgeScene.java | 6 +- .../atriasoft/ege/mapFactory/MainWindows.java | 24 +-- .../ege/mapFactory/tools/ToolMapHeight.java | 4 +- .../ege/s1_texturedCube/S1Application.java | 2 +- .../atriasoft/ege/ControlCameraPlayer.java | 2 +- .../atriasoft/ege/ControlCameraPlayerFPS.java | 2 +- .../atriasoft/ege/ControlCameraSimple.java | 2 +- src/org/atriasoft/ege/ControlInterface.java | 4 +- src/org/atriasoft/ege/Environement.java | 5 +- src/org/atriasoft/ege/camera/Camera.java | 3 + .../ege/camera/ProjectionInterface.java | 1 + .../ege/camera/ProjectionOrthogonal.java | 8 + .../ege/camera/ProjectionPerspective.java | 8 + 18 files changed, 204 insertions(+), 47 deletions(-) diff --git a/samples/.settings/org.eclipse.jdt.ui.prefs b/samples/.settings/org.eclipse.jdt.ui.prefs index 7103be7..35cdff9 100644 --- a/samples/.settings/org.eclipse.jdt.ui.prefs +++ b/samples/.settings/org.eclipse.jdt.ui.prefs @@ -1,2 +1,141 @@ eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_all=false +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_missing_override_annotations_interface_methods=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=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.array_with_curly=true +sp_cleanup.arrays_fill=true +sp_cleanup.bitwise_conditional_expression=false +sp_cleanup.boolean_literal=false +sp_cleanup.boolean_value_rather_than_comparison=false +sp_cleanup.break_loop=false +sp_cleanup.collection_cloning=true +sp_cleanup.comparing_on_criteria=true +sp_cleanup.comparison_statement=false +sp_cleanup.controlflow_merge=false +sp_cleanup.convert_functional_interfaces=true +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false +sp_cleanup.convert_to_switch_expressions=true +sp_cleanup.correct_indentation=true +sp_cleanup.do_while_rather_than_while=false +sp_cleanup.double_negation=false +sp_cleanup.else_if=false +sp_cleanup.embedded_if=false +sp_cleanup.evaluate_nullable=false +sp_cleanup.extract_increment=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.hash=false +sp_cleanup.if_condition=true +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.instanceof=true +sp_cleanup.instanceof_keyword=false +sp_cleanup.invert_equals=false +sp_cleanup.join=true +sp_cleanup.lazy_logical_operator=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.map_cloning=true +sp_cleanup.merge_conditional_blocks=false +sp_cleanup.multi_catch=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.no_string_creation=false +sp_cleanup.no_super=true +sp_cleanup.number_suffix=false +sp_cleanup.objects_equals=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=false +sp_cleanup.operand_factorization=false +sp_cleanup.organize_imports=true +sp_cleanup.overridden_assignment=false +sp_cleanup.plain_replacement=false +sp_cleanup.precompile_regex=false +sp_cleanup.primitive_comparison=false +sp_cleanup.primitive_parsing=false +sp_cleanup.primitive_rather_than_wrapper=false +sp_cleanup.primitive_serialization=false +sp_cleanup.pull_out_if_from_if_else=true +sp_cleanup.pull_up_assignment=false +sp_cleanup.push_down_negation=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.reduce_indentation=false +sp_cleanup.redundant_comparator=false +sp_cleanup.redundant_falling_through_block_end=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=true +sp_cleanup.remove_redundant_semicolons=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=false +sp_cleanup.remove_trailing_whitespaces_ignore_empty=true +sp_cleanup.remove_unnecessary_array_creation=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +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.return_expression=false +sp_cleanup.simplify_lambda_expression_and_method_ref=false +sp_cleanup.single_used_field=false +sp_cleanup.sort_members=true +sp_cleanup.sort_members_all=false +sp_cleanup.standard_comparison=false +sp_cleanup.static_inner_class=false +sp_cleanup.strictly_equal_or_different=false +sp_cleanup.stringbuffer_to_stringbuilder=false +sp_cleanup.stringbuilder=true +sp_cleanup.stringbuilder_for_local_vars=true +sp_cleanup.stringconcat_to_textblock=true +sp_cleanup.substring=false +sp_cleanup.switch=false +sp_cleanup.system_property=false +sp_cleanup.system_property_boolean=false +sp_cleanup.system_property_file_encoding=false +sp_cleanup.system_property_file_separator=false +sp_cleanup.system_property_line_separator=false +sp_cleanup.system_property_path_separator=false +sp_cleanup.ternary_operator=false +sp_cleanup.try_with_resource=false +sp_cleanup.unlooped_while=false +sp_cleanup.unreachable_block=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_autoboxing=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_directly_map_method=true +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_string_is_blank=false +sp_cleanup.use_this_for_non_static_field_access=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_unboxing=false +sp_cleanup.use_var=false +sp_cleanup.useless_continue=true +sp_cleanup.useless_return=true +sp_cleanup.valueof_rather_than_instantiation=false diff --git a/samples/src/sample/atriasoft/ege/collisiontest/CollisionTestApplication.java b/samples/src/sample/atriasoft/ege/collisiontest/CollisionTestApplication.java index 44526d8..0efdd3e 100644 --- a/samples/src/sample/atriasoft/ege/collisiontest/CollisionTestApplication.java +++ b/samples/src/sample/atriasoft/ege/collisiontest/CollisionTestApplication.java @@ -283,7 +283,7 @@ public class CollisionTestApplication extends GaleApplication { @Override public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { - this.env.onPointer(special, type, pointerID, pos, state); + this.env.onPointer(special, type, pointerID, new Vector3f(pos.x(), pos.y(), 0), state); } @Override diff --git a/samples/src/sample/atriasoft/ege/lightTest/LightTestApplication.java b/samples/src/sample/atriasoft/ege/lightTest/LightTestApplication.java index 9f4cbe6..8ad910d 100644 --- a/samples/src/sample/atriasoft/ege/lightTest/LightTestApplication.java +++ b/samples/src/sample/atriasoft/ege/lightTest/LightTestApplication.java @@ -91,7 +91,7 @@ public class LightTestApplication extends GaleApplication { basicTree.addComponent(new ComponentRenderTexturedMaterialsStaticMesh(new Uri("DATA", "basicMaterial.vert", "loxelEngine"), new Uri("DATA", "basicMaterial.frag", "loxelEngine"), (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); this.env.addEntity(basicTree); - + for (int xxx = -10; xxx < 10; xxx++) { for (int yyy = -10; yyy < 10; yyy++) { final Entity superGrass = new Entity(this.env); @@ -156,7 +156,7 @@ public class LightTestApplication extends GaleApplication { @Override public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { - this.env.onPointer(special, type, pointerID, pos, state); + this.env.onPointer(special, type, pointerID, new Vector3f(pos.x(), pos.y(), 0), state); } @Override diff --git a/samples/src/sample/atriasoft/ege/lowPoly/LowPolyApplication.java b/samples/src/sample/atriasoft/ege/lowPoly/LowPolyApplication.java index 2f3295b..1aee1da 100644 --- a/samples/src/sample/atriasoft/ege/lowPoly/LowPolyApplication.java +++ b/samples/src/sample/atriasoft/ege/lowPoly/LowPolyApplication.java @@ -91,10 +91,8 @@ public class LowPolyApplication extends GaleApplication { basicTree.addComponent(new ComponentMesh(new Uri("DATA", "tree1.emf"))); basicTree.addComponent(new ComponentTexturePalette(new Uri("DATA", "palette_1.json"))); //basicTree.addComponent(new ComponentRenderTexturedStaticMesh(new Uri("DATA", "basic.vert", "loxelEngine"), new Uri("DATA", "basic.frag", "loxelEngine"))); - basicTree.addComponent(new ComponentRenderMeshPalette(new Uri("DATA", "basicPalette.vert"), new Uri("DATA", "basicPalette.frag"), - (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); + basicTree.addComponent(new ComponentRenderMeshPalette(new Uri("DATA", "basicPalette.vert"), new Uri("DATA", "basicPalette.frag"), (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); this.env.addEntity(basicTree); - basicTree = new Entity(this.env); this.objectPosition = new ComponentPosition(new Transform3D(new Vector3f(3, 2, 0))); @@ -104,22 +102,21 @@ public class LowPolyApplication extends GaleApplication { basicTree.addComponent(new ComponentMesh(new Uri("DATA", "tree2.emf"))); basicTree.addComponent(new ComponentTexturePalette(new Uri("DATA", "palette_1.json"))); //basicTree.addComponent(new ComponentRenderTexturedStaticMesh(new Uri("DATA", "basic.vert", "loxelEngine"), new Uri("DATA", "basic.frag", "loxelEngine"))); - basicTree.addComponent(new ComponentRenderMeshPalette(new Uri("DATA", "basicPalette.vert"), new Uri("DATA", "basicPalette.frag"), - (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); + basicTree.addComponent(new ComponentRenderMeshPalette(new Uri("DATA", "basicPalette.vert"), new Uri("DATA", "basicPalette.frag"), (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); this.env.addEntity(basicTree); -// for (int xxx = -10; xxx < 10; xxx++) { -// for (int yyy = -10; yyy < 10; yyy++) { -// final Entity superGrass = new Entity(this.env); -// superGrass.addComponent(new ComponentPosition(new Transform3D(new Vector3f(xxx, yyy, -1)))); -// superGrass.addComponent(new ComponentMaterial(new Material())); -// superGrass.addComponent(new ComponentStaticMesh(new Uri("RES", "cube-one.obj"))); -// superGrass.addComponent(new ComponentTexture(new Uri("RES", "dirt.png"))); -// superGrass.addComponent(new ComponentRenderTexturedMaterialsStaticMesh(new Uri("DATA", "basicMaterial.vert", "loxelEngine"), new Uri("DATA", "basicMaterial.frag", "loxelEngine"), -// (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); -// this.env.addEntity(superGrass); -// } -// } + // for (int xxx = -10; xxx < 10; xxx++) { + // for (int yyy = -10; yyy < 10; yyy++) { + // final Entity superGrass = new Entity(this.env); + // superGrass.addComponent(new ComponentPosition(new Transform3D(new Vector3f(xxx, yyy, -1)))); + // superGrass.addComponent(new ComponentMaterial(new Material())); + // superGrass.addComponent(new ComponentStaticMesh(new Uri("RES", "cube-one.obj"))); + // superGrass.addComponent(new ComponentTexture(new Uri("RES", "dirt.png"))); + // superGrass.addComponent(new ComponentRenderTexturedMaterialsStaticMesh(new Uri("DATA", "basicMaterial.vert", "loxelEngine"), new Uri("DATA", "basicMaterial.frag", "loxelEngine"), + // (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); + // this.env.addEntity(superGrass); + // } + // } final Camera mainView = new Camera(); this.env.addCamera("default", mainView); @@ -172,7 +169,7 @@ public class LowPolyApplication extends GaleApplication { @Override public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { - this.env.onPointer(special, type, pointerID, pos, state); + this.env.onPointer(special, type, pointerID, new Vector3f(pos.x(), pos.y(), 0), state); } @Override diff --git a/samples/src/sample/atriasoft/ege/loxelEngine/LoxelApplicationPerso.java b/samples/src/sample/atriasoft/ege/loxelEngine/LoxelApplicationPerso.java index 27d8782..27d76f9 100644 --- a/samples/src/sample/atriasoft/ege/loxelEngine/LoxelApplicationPerso.java +++ b/samples/src/sample/atriasoft/ege/loxelEngine/LoxelApplicationPerso.java @@ -495,7 +495,7 @@ public class LoxelApplicationPerso extends GaleApplication { @Override public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { - this.env.onPointer(special, type, pointerID, pos, state); + this.env.onPointer(special, type, pointerID, new Vector3f(pos.x(), pos.y(), 0), state); } @Override diff --git a/samples/src/sample/atriasoft/ege/mapFactory/EgeScene.java b/samples/src/sample/atriasoft/ege/mapFactory/EgeScene.java index 018a280..7c7e85c 100644 --- a/samples/src/sample/atriasoft/ege/mapFactory/EgeScene.java +++ b/samples/src/sample/atriasoft/ege/mapFactory/EgeScene.java @@ -80,7 +80,7 @@ public class EgeScene extends Widget { public void calculateMinMaxSize() { // call main class super.calculateMinMaxSize(); - this.minSize = Vector2f.VALUE_128; + this.minSize = Vector3f.VALUE_128; // verify the min max of the min size ... checkMinSize(); Log.error("min size = " + this.minSize); @@ -105,7 +105,7 @@ public class EgeScene extends Widget { OpenGL.setMatrix(this.projection.getMatrix()); // set the basic openGL view port: (Draw in all the windows...) - OpenGL.setViewPort(new Vector2f(0, 0), getSize()); + OpenGL.setViewPort(new Vector2f(0, 0), new Vector2f(getSize().x(), getSize().y())); // clear background //final Color bgColor = new Color(0.0f, 1.0f, 0.0f, 1.0f); @@ -136,7 +136,7 @@ public class EgeScene extends Widget { @Override public boolean onEventInput(final EventInput event) { keepFocus(); - Vector2f relPos = relativePosition(event.pos()); + Vector3f relPos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0)); //Log.warning("Event on Input ... " + event + " relPos = " + relPos); this.env.onPointer(event.specialKey(), event.type(), event.inputId(), relPos, event.status()); diff --git a/samples/src/sample/atriasoft/ege/mapFactory/MainWindows.java b/samples/src/sample/atriasoft/ege/mapFactory/MainWindows.java index ba72a3a..3ad7d9f 100644 --- a/samples/src/sample/atriasoft/ege/mapFactory/MainWindows.java +++ b/samples/src/sample/atriasoft/ege/mapFactory/MainWindows.java @@ -1,6 +1,6 @@ package sample.atriasoft.ege.mapFactory; -import org.atriasoft.etk.math.Vector2b; +import org.atriasoft.etk.math.Vector3b; import org.atriasoft.ewol.widget.Button; import org.atriasoft.ewol.widget.Sizer; import org.atriasoft.ewol.widget.Sizer.DisplayMode; @@ -40,32 +40,32 @@ public class MainWindows extends Windows { setPropertyTitle("Map Factory (create your dream world)"); Sizer sizerHoryMain = new Sizer(DisplayMode.modeHori); - sizerHoryMain.setPropertyExpand(Vector2b.TRUE_TRUE); - sizerHoryMain.setPropertyFill(Vector2b.TRUE_TRUE); + sizerHoryMain.setPropertyExpand(Vector3b.TRUE); + sizerHoryMain.setPropertyFill(Vector3b.TRUE); setSubWidget(sizerHoryMain); this.scene = new ApplScene(); - this.scene.setPropertyExpand(Vector2b.TRUE_TRUE); - this.scene.setPropertyFill(Vector2b.TRUE_TRUE); + this.scene.setPropertyExpand(Vector3b.TRUE); + this.scene.setPropertyFill(Vector3b.TRUE); sizerHoryMain.subWidgetAdd(this.scene); Sizer sizerMenu = new Sizer(DisplayMode.modeVert); - sizerMenu.setPropertyExpand(Vector2b.FALSE_TRUE); - sizerMenu.setPropertyLockExpand(Vector2b.TRUE_TRUE); - sizerMenu.setPropertyFill(Vector2b.TRUE_TRUE); + sizerMenu.setPropertyExpand(Vector3b.FALSE_TRUE_FALSE); + sizerMenu.setPropertyLockExpand(Vector3b.TRUE); + sizerMenu.setPropertyFill(Vector3b.TRUE); sizerHoryMain.subWidgetAdd(sizerMenu); this.toolButton = new Button(); this.toolButton.setPropertyValue("Heigher"); - this.toolButton.setPropertyExpand(Vector2b.TRUE_FALSE); - this.toolButton.setPropertyFill(Vector2b.TRUE_TRUE); + this.toolButton.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + this.toolButton.setPropertyFill(Vector3b.TRUE); sizerMenu.subWidgetAdd(this.toolButton); this.toolButton.signalClick.connectAuto(this, MainWindows::eventButtonTool); this.heightButton = new Button(); this.heightButton.setPropertyValue("Increase"); - this.heightButton.setPropertyExpand(Vector2b.TRUE_FALSE); - this.heightButton.setPropertyFill(Vector2b.TRUE_TRUE); + this.heightButton.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + this.heightButton.setPropertyFill(Vector3b.TRUE); sizerMenu.subWidgetAdd(this.heightButton); this.heightButton.signalClick.connectAuto(this, MainWindows::eventButtonIncrease); diff --git a/samples/src/sample/atriasoft/ege/mapFactory/tools/ToolMapHeight.java b/samples/src/sample/atriasoft/ege/mapFactory/tools/ToolMapHeight.java index 2d2fa06..2b88721 100644 --- a/samples/src/sample/atriasoft/ege/mapFactory/tools/ToolMapHeight.java +++ b/samples/src/sample/atriasoft/ege/mapFactory/tools/ToolMapHeight.java @@ -3,7 +3,6 @@ package sample.atriasoft.ege.mapFactory.tools; import org.atriasoft.ege.geometry.Ray; import org.atriasoft.etk.Color; import org.atriasoft.etk.math.Transform3D; -import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.event.EventEntry; import org.atriasoft.ewol.event.EventInput; @@ -46,7 +45,8 @@ public class ToolMapHeight implements MapToolInterface { @Override public boolean onEventInput(EventInput event, Map map, EgeScene widget) { - Vector2f relPos = widget.relativePosition(event.pos()); + Vector3f globalPos = new Vector3f(event.pos().x(), event.pos().y(), 0); + Vector3f relPos = widget.relativePosition(globalPos); // simple ray-cast on the ground Ray mouseRay = widget.mainView.getRayFromScreen(widget.projection, widget.getSize(), relPos); this.positionRay = mouseRay.intersectPlane(new Vector3f(0.0f, 0.0f, 1.0f), 0.0f); diff --git a/samples/src/sample/atriasoft/ege/s1_texturedCube/S1Application.java b/samples/src/sample/atriasoft/ege/s1_texturedCube/S1Application.java index c0f19af..38d0a1a 100644 --- a/samples/src/sample/atriasoft/ege/s1_texturedCube/S1Application.java +++ b/samples/src/sample/atriasoft/ege/s1_texturedCube/S1Application.java @@ -113,7 +113,7 @@ public class S1Application extends GaleApplication { @Override public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { - this.env.onPointer(special, type, pointerID, pos, state); + this.env.onPointer(special, type, pointerID, new Vector3f(pos.x(), pos.y(), 0), state); } @Override diff --git a/src/org/atriasoft/ege/ControlCameraPlayer.java b/src/org/atriasoft/ege/ControlCameraPlayer.java index 577271f..b881ee2 100644 --- a/src/org/atriasoft/ege/ControlCameraPlayer.java +++ b/src/org/atriasoft/ege/ControlCameraPlayer.java @@ -78,7 +78,7 @@ public class ControlCameraPlayer implements ControlInterface { } @Override - public boolean onEventInput(final EventInput event, final Vector2f relativePosition) { + public boolean onEventInput(final EventInput event, final Vector3f relativePosition) { // Log.info("" + event); // TODO Auto-generated method stub if (!this.fpsMode) { diff --git a/src/org/atriasoft/ege/ControlCameraPlayerFPS.java b/src/org/atriasoft/ege/ControlCameraPlayerFPS.java index 1cfc3ec..06f63eb 100644 --- a/src/org/atriasoft/ege/ControlCameraPlayerFPS.java +++ b/src/org/atriasoft/ege/ControlCameraPlayerFPS.java @@ -58,7 +58,7 @@ public class ControlCameraPlayerFPS implements ControlInterface { } @Override - public boolean onEventInput(final EventInput event, final Vector2f relativePosition) { + public boolean onEventInput(final EventInput event, final Vector3f relativePosition) { // Log.info("" + event); // in grabbing mouse only: if (!Gale.getContext().isGrabPointerEvents()) { diff --git a/src/org/atriasoft/ege/ControlCameraSimple.java b/src/org/atriasoft/ege/ControlCameraSimple.java index d69f57e..8d38abf 100644 --- a/src/org/atriasoft/ege/ControlCameraSimple.java +++ b/src/org/atriasoft/ege/ControlCameraSimple.java @@ -52,7 +52,7 @@ public class ControlCameraSimple implements ControlInterface { } @Override - public boolean onEventInput(final EventInput event, final Vector2f relativePosition) { + public boolean onEventInput(final EventInput event, final Vector3f relativePosition) { // TODO Auto-generated method stub if (event.inputId() == 4) { Vector3f delta = this.camera.getConvertionMatrix().transpose().multiply(new Vector3f(0,0,-1)); diff --git a/src/org/atriasoft/ege/ControlInterface.java b/src/org/atriasoft/ege/ControlInterface.java index 62c25a6..4c03add 100644 --- a/src/org/atriasoft/ege/ControlInterface.java +++ b/src/org/atriasoft/ege/ControlInterface.java @@ -1,6 +1,6 @@ package org.atriasoft.ege; -import org.atriasoft.etk.math.Vector2f; +import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.event.EventEntry; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventTime; @@ -8,7 +8,7 @@ import org.atriasoft.ewol.event.EventTime; public interface ControlInterface { boolean onEventEntry(EventEntry event); - boolean onEventInput(EventInput event, Vector2f relativePosition); + boolean onEventInput(EventInput event, Vector3f relativePosition); /** * Periodic call to update grapgic display diff --git a/src/org/atriasoft/ege/Environement.java b/src/org/atriasoft/ege/Environement.java index 6ab6927..f339f59 100644 --- a/src/org/atriasoft/ege/Environement.java +++ b/src/org/atriasoft/ege/Environement.java @@ -19,6 +19,7 @@ import org.atriasoft.ege.engines.EngineRender; import org.atriasoft.ege.internal.Log; //import org.atriasoft.ege.resource.Mesh; import org.atriasoft.etk.math.Vector2f; +import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.event.EventEntry; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventTime; @@ -320,8 +321,8 @@ public class Environement { } } - public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { - final EventInput event = new EventInput(type, state, pointerID, pos, special); + public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector3f pos, final KeyStatus state) { + final EventInput event = new EventInput(type, state, pointerID, new Vector2f(pos.x(), pos.y()), special); for (final ControlInterface elem : this.controls) { elem.onEventInput(event, pos); } diff --git a/src/org/atriasoft/ege/camera/Camera.java b/src/org/atriasoft/ege/camera/Camera.java index 67a6dbc..bc59835 100644 --- a/src/org/atriasoft/ege/camera/Camera.java +++ b/src/org/atriasoft/ege/camera/Camera.java @@ -71,4 +71,7 @@ public class Camera { ValueLine result = reverseTransform(elem); return Ray.createFromPoint(result.near(), result.far()); } + public Ray getRayFromScreen(ProjectionInterface projection, Vector3f diplaySize, Vector3f mousePosition) { + return getRayFromScreen(projection, new Vector2f(diplaySize.x(), diplaySize.y()), new Vector2f(mousePosition.x(), mousePosition.y())); + } } diff --git a/src/org/atriasoft/ege/camera/ProjectionInterface.java b/src/org/atriasoft/ege/camera/ProjectionInterface.java index 3f24100..ce2be66 100644 --- a/src/org/atriasoft/ege/camera/ProjectionInterface.java +++ b/src/org/atriasoft/ege/camera/ProjectionInterface.java @@ -9,6 +9,7 @@ public interface ProjectionInterface { public record ValueLine(Vector3f near, Vector3f far) {}; Matrix4f getMatrix(); Matrix4f updateMatrix(Vector2f diplaySize); + Matrix4f updateMatrix(Vector3f diplaySize); ValueLine reverseTransform(Vector2f diplaySize, Vector2f mousePosition); } diff --git a/src/org/atriasoft/ege/camera/ProjectionOrthogonal.java b/src/org/atriasoft/ege/camera/ProjectionOrthogonal.java index 3d82545..be64467 100644 --- a/src/org/atriasoft/ege/camera/ProjectionOrthogonal.java +++ b/src/org/atriasoft/ege/camera/ProjectionOrthogonal.java @@ -33,6 +33,14 @@ public class ProjectionOrthogonal implements ProjectionInterface { nearView, farView);; return lastMatrix; } + @Override + public Matrix4f updateMatrix(Vector3f diplaySize) { + lastMatrix = Matrix4f.createMatrixOrtho( + diplaySize.x() * -0.5f, diplaySize.x() * 0.5f, // width + diplaySize.y() * -0.5f, diplaySize.y() * 0.5f, // height + nearView, farView); + return lastMatrix; + } public float getNear() { return nearView; } diff --git a/src/org/atriasoft/ege/camera/ProjectionPerspective.java b/src/org/atriasoft/ege/camera/ProjectionPerspective.java index 142e0a8..676a096 100644 --- a/src/org/atriasoft/ege/camera/ProjectionPerspective.java +++ b/src/org/atriasoft/ege/camera/ProjectionPerspective.java @@ -14,6 +14,9 @@ public class ProjectionPerspective implements ProjectionInterface { protected float getAspectRatio(Vector2f size) { return size.x() / size.y(); } + protected float getAspectRatio(Vector3f size) { + return size.x() / size.y(); + } public void setAngleViewRad(float angle) { this.angleViewRad = angle; } @@ -30,6 +33,11 @@ public class ProjectionPerspective implements ProjectionInterface { return lastMatrix; } @Override + public Matrix4f updateMatrix(Vector3f diplaySize) { + lastMatrix = Matrix4f.createMatrixPerspective(getAngleViewRad(), getAspectRatio(diplaySize), nearView, farView);; + return lastMatrix; + } + @Override public ValueLine reverseTransform(Vector2f diplaySize, Vector2f mousePosition) { float mouse_pos_x_clip = mousePosition.x() / diplaySize.x() * 2.0f - 1.0f;