[DEV] commit all with new insland

This commit is contained in:
Edouard DUPIN 2022-03-23 13:37:49 +01:00
parent 66bee2e43b
commit 26f130ffd5
18 changed files with 204 additions and 47 deletions

View File

@ -1,2 +1,141 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
org.eclipse.jdt.ui.text.custom_code_templates= 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

View File

@ -283,7 +283,7 @@ public class CollisionTestApplication extends GaleApplication {
@Override @Override
public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { 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 @Override

View File

@ -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"), basicTree.addComponent(new ComponentRenderTexturedMaterialsStaticMesh(new Uri("DATA", "basicMaterial.vert", "loxelEngine"), new Uri("DATA", "basicMaterial.frag", "loxelEngine"),
(EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME)));
this.env.addEntity(basicTree); this.env.addEntity(basicTree);
for (int xxx = -10; xxx < 10; xxx++) { for (int xxx = -10; xxx < 10; xxx++) {
for (int yyy = -10; yyy < 10; yyy++) { for (int yyy = -10; yyy < 10; yyy++) {
final Entity superGrass = new Entity(this.env); final Entity superGrass = new Entity(this.env);
@ -156,7 +156,7 @@ public class LightTestApplication extends GaleApplication {
@Override @Override
public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { 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 @Override

View File

@ -91,10 +91,8 @@ public class LowPolyApplication extends GaleApplication {
basicTree.addComponent(new ComponentMesh(new Uri("DATA", "tree1.emf"))); basicTree.addComponent(new ComponentMesh(new Uri("DATA", "tree1.emf")));
basicTree.addComponent(new ComponentTexturePalette(new Uri("DATA", "palette_1.json"))); 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 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"), basicTree.addComponent(new ComponentRenderMeshPalette(new Uri("DATA", "basicPalette.vert"), new Uri("DATA", "basicPalette.frag"), (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME)));
(EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME)));
this.env.addEntity(basicTree); this.env.addEntity(basicTree);
basicTree = new Entity(this.env); basicTree = new Entity(this.env);
this.objectPosition = new ComponentPosition(new Transform3D(new Vector3f(3, 2, 0))); 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 ComponentMesh(new Uri("DATA", "tree2.emf")));
basicTree.addComponent(new ComponentTexturePalette(new Uri("DATA", "palette_1.json"))); 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 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"), basicTree.addComponent(new ComponentRenderMeshPalette(new Uri("DATA", "basicPalette.vert"), new Uri("DATA", "basicPalette.frag"), (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME)));
(EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME)));
this.env.addEntity(basicTree); this.env.addEntity(basicTree);
// for (int xxx = -10; xxx < 10; xxx++) { // for (int xxx = -10; xxx < 10; xxx++) {
// for (int yyy = -10; yyy < 10; yyy++) { // for (int yyy = -10; yyy < 10; yyy++) {
// final Entity superGrass = new Entity(this.env); // final Entity superGrass = new Entity(this.env);
// superGrass.addComponent(new ComponentPosition(new Transform3D(new Vector3f(xxx, yyy, -1)))); // superGrass.addComponent(new ComponentPosition(new Transform3D(new Vector3f(xxx, yyy, -1))));
// superGrass.addComponent(new ComponentMaterial(new Material())); // superGrass.addComponent(new ComponentMaterial(new Material()));
// superGrass.addComponent(new ComponentStaticMesh(new Uri("RES", "cube-one.obj"))); // superGrass.addComponent(new ComponentStaticMesh(new Uri("RES", "cube-one.obj")));
// superGrass.addComponent(new ComponentTexture(new Uri("RES", "dirt.png"))); // 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"), // superGrass.addComponent(new ComponentRenderTexturedMaterialsStaticMesh(new Uri("DATA", "basicMaterial.vert", "loxelEngine"), new Uri("DATA", "basicMaterial.frag", "loxelEngine"),
// (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); // (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME)));
// this.env.addEntity(superGrass); // this.env.addEntity(superGrass);
// } // }
// } // }
final Camera mainView = new Camera(); final Camera mainView = new Camera();
this.env.addCamera("default", mainView); this.env.addCamera("default", mainView);
@ -172,7 +169,7 @@ public class LowPolyApplication extends GaleApplication {
@Override @Override
public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { 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 @Override

View File

@ -495,7 +495,7 @@ public class LoxelApplicationPerso extends GaleApplication {
@Override @Override
public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { 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 @Override

View File

@ -80,7 +80,7 @@ public class EgeScene extends Widget {
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
// call main class // call main class
super.calculateMinMaxSize(); super.calculateMinMaxSize();
this.minSize = Vector2f.VALUE_128; this.minSize = Vector3f.VALUE_128;
// verify the min max of the min size ... // verify the min max of the min size ...
checkMinSize(); checkMinSize();
Log.error("min size = " + this.minSize); Log.error("min size = " + this.minSize);
@ -105,7 +105,7 @@ public class EgeScene extends Widget {
OpenGL.setMatrix(this.projection.getMatrix()); OpenGL.setMatrix(this.projection.getMatrix());
// set the basic openGL view port: (Draw in all the windows...) // 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 // clear background
//final Color bgColor = new Color(0.0f, 1.0f, 0.0f, 1.0f); //final Color bgColor = new Color(0.0f, 1.0f, 0.0f, 1.0f);
@ -136,7 +136,7 @@ public class EgeScene extends Widget {
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
keepFocus(); 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); //Log.warning("Event on Input ... " + event + " relPos = " + relPos);
this.env.onPointer(event.specialKey(), event.type(), event.inputId(), relPos, event.status()); this.env.onPointer(event.specialKey(), event.type(), event.inputId(), relPos, event.status());

View File

@ -1,6 +1,6 @@
package sample.atriasoft.ege.mapFactory; 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.Button;
import org.atriasoft.ewol.widget.Sizer; import org.atriasoft.ewol.widget.Sizer;
import org.atriasoft.ewol.widget.Sizer.DisplayMode; import org.atriasoft.ewol.widget.Sizer.DisplayMode;
@ -40,32 +40,32 @@ public class MainWindows extends Windows {
setPropertyTitle("Map Factory (create your dream world)"); setPropertyTitle("Map Factory (create your dream world)");
Sizer sizerHoryMain = new Sizer(DisplayMode.modeHori); Sizer sizerHoryMain = new Sizer(DisplayMode.modeHori);
sizerHoryMain.setPropertyExpand(Vector2b.TRUE_TRUE); sizerHoryMain.setPropertyExpand(Vector3b.TRUE);
sizerHoryMain.setPropertyFill(Vector2b.TRUE_TRUE); sizerHoryMain.setPropertyFill(Vector3b.TRUE);
setSubWidget(sizerHoryMain); setSubWidget(sizerHoryMain);
this.scene = new ApplScene(); this.scene = new ApplScene();
this.scene.setPropertyExpand(Vector2b.TRUE_TRUE); this.scene.setPropertyExpand(Vector3b.TRUE);
this.scene.setPropertyFill(Vector2b.TRUE_TRUE); this.scene.setPropertyFill(Vector3b.TRUE);
sizerHoryMain.subWidgetAdd(this.scene); sizerHoryMain.subWidgetAdd(this.scene);
Sizer sizerMenu = new Sizer(DisplayMode.modeVert); Sizer sizerMenu = new Sizer(DisplayMode.modeVert);
sizerMenu.setPropertyExpand(Vector2b.FALSE_TRUE); sizerMenu.setPropertyExpand(Vector3b.FALSE_TRUE_FALSE);
sizerMenu.setPropertyLockExpand(Vector2b.TRUE_TRUE); sizerMenu.setPropertyLockExpand(Vector3b.TRUE);
sizerMenu.setPropertyFill(Vector2b.TRUE_TRUE); sizerMenu.setPropertyFill(Vector3b.TRUE);
sizerHoryMain.subWidgetAdd(sizerMenu); sizerHoryMain.subWidgetAdd(sizerMenu);
this.toolButton = new Button(); this.toolButton = new Button();
this.toolButton.setPropertyValue("Heigher"); this.toolButton.setPropertyValue("Heigher");
this.toolButton.setPropertyExpand(Vector2b.TRUE_FALSE); this.toolButton.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
this.toolButton.setPropertyFill(Vector2b.TRUE_TRUE); this.toolButton.setPropertyFill(Vector3b.TRUE);
sizerMenu.subWidgetAdd(this.toolButton); sizerMenu.subWidgetAdd(this.toolButton);
this.toolButton.signalClick.connectAuto(this, MainWindows::eventButtonTool); this.toolButton.signalClick.connectAuto(this, MainWindows::eventButtonTool);
this.heightButton = new Button(); this.heightButton = new Button();
this.heightButton.setPropertyValue("Increase"); this.heightButton.setPropertyValue("Increase");
this.heightButton.setPropertyExpand(Vector2b.TRUE_FALSE); this.heightButton.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
this.heightButton.setPropertyFill(Vector2b.TRUE_TRUE); this.heightButton.setPropertyFill(Vector3b.TRUE);
sizerMenu.subWidgetAdd(this.heightButton); sizerMenu.subWidgetAdd(this.heightButton);
this.heightButton.signalClick.connectAuto(this, MainWindows::eventButtonIncrease); this.heightButton.signalClick.connectAuto(this, MainWindows::eventButtonIncrease);

View File

@ -3,7 +3,6 @@ package sample.atriasoft.ege.mapFactory.tools;
import org.atriasoft.ege.geometry.Ray; import org.atriasoft.ege.geometry.Ray;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.math.Transform3D; import org.atriasoft.etk.math.Transform3D;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.event.EventEntry; import org.atriasoft.ewol.event.EventEntry;
import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventInput;
@ -46,7 +45,8 @@ public class ToolMapHeight implements MapToolInterface {
@Override @Override
public boolean onEventInput(EventInput event, Map map, EgeScene widget) { 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 // simple ray-cast on the ground
Ray mouseRay = widget.mainView.getRayFromScreen(widget.projection, widget.getSize(), relPos); Ray mouseRay = widget.mainView.getRayFromScreen(widget.projection, widget.getSize(), relPos);
this.positionRay = mouseRay.intersectPlane(new Vector3f(0.0f, 0.0f, 1.0f), 0.0f); this.positionRay = mouseRay.intersectPlane(new Vector3f(0.0f, 0.0f, 1.0f), 0.0f);

View File

@ -113,7 +113,7 @@ public class S1Application extends GaleApplication {
@Override @Override
public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) { 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 @Override

View File

@ -78,7 +78,7 @@ public class ControlCameraPlayer implements ControlInterface {
} }
@Override @Override
public boolean onEventInput(final EventInput event, final Vector2f relativePosition) { public boolean onEventInput(final EventInput event, final Vector3f relativePosition) {
// Log.info("" + event); // Log.info("" + event);
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (!this.fpsMode) { if (!this.fpsMode) {

View File

@ -58,7 +58,7 @@ public class ControlCameraPlayerFPS implements ControlInterface {
} }
@Override @Override
public boolean onEventInput(final EventInput event, final Vector2f relativePosition) { public boolean onEventInput(final EventInput event, final Vector3f relativePosition) {
// Log.info("" + event); // Log.info("" + event);
// in grabbing mouse only: // in grabbing mouse only:
if (!Gale.getContext().isGrabPointerEvents()) { if (!Gale.getContext().isGrabPointerEvents()) {

View File

@ -52,7 +52,7 @@ public class ControlCameraSimple implements ControlInterface {
} }
@Override @Override
public boolean onEventInput(final EventInput event, final Vector2f relativePosition) { public boolean onEventInput(final EventInput event, final Vector3f relativePosition) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (event.inputId() == 4) { if (event.inputId() == 4) {
Vector3f delta = this.camera.getConvertionMatrix().transpose().multiply(new Vector3f(0,0,-1)); Vector3f delta = this.camera.getConvertionMatrix().transpose().multiply(new Vector3f(0,0,-1));

View File

@ -1,6 +1,6 @@
package org.atriasoft.ege; 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.EventEntry;
import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.event.EventTime; import org.atriasoft.ewol.event.EventTime;
@ -8,7 +8,7 @@ import org.atriasoft.ewol.event.EventTime;
public interface ControlInterface { public interface ControlInterface {
boolean onEventEntry(EventEntry event); boolean onEventEntry(EventEntry event);
boolean onEventInput(EventInput event, Vector2f relativePosition); boolean onEventInput(EventInput event, Vector3f relativePosition);
/** /**
* Periodic call to update grapgic display * Periodic call to update grapgic display

View File

@ -19,6 +19,7 @@ import org.atriasoft.ege.engines.EngineRender;
import org.atriasoft.ege.internal.Log; import org.atriasoft.ege.internal.Log;
//import org.atriasoft.ege.resource.Mesh; //import org.atriasoft.ege.resource.Mesh;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.event.EventEntry; import org.atriasoft.ewol.event.EventEntry;
import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.event.EventTime; 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) { 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, pos, special); final EventInput event = new EventInput(type, state, pointerID, new Vector2f(pos.x(), pos.y()), special);
for (final ControlInterface elem : this.controls) { for (final ControlInterface elem : this.controls) {
elem.onEventInput(event, pos); elem.onEventInput(event, pos);
} }

View File

@ -71,4 +71,7 @@ public class Camera {
ValueLine result = reverseTransform(elem); ValueLine result = reverseTransform(elem);
return Ray.createFromPoint(result.near(), result.far()); 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()));
}
} }

View File

@ -9,6 +9,7 @@ public interface ProjectionInterface {
public record ValueLine(Vector3f near, Vector3f far) {}; public record ValueLine(Vector3f near, Vector3f far) {};
Matrix4f getMatrix(); Matrix4f getMatrix();
Matrix4f updateMatrix(Vector2f diplaySize); Matrix4f updateMatrix(Vector2f diplaySize);
Matrix4f updateMatrix(Vector3f diplaySize);
ValueLine reverseTransform(Vector2f diplaySize, Vector2f mousePosition); ValueLine reverseTransform(Vector2f diplaySize, Vector2f mousePosition);
} }

View File

@ -33,6 +33,14 @@ public class ProjectionOrthogonal implements ProjectionInterface {
nearView, farView);; nearView, farView);;
return lastMatrix; 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() { public float getNear() {
return nearView; return nearView;
} }

View File

@ -14,6 +14,9 @@ public class ProjectionPerspective implements ProjectionInterface {
protected float getAspectRatio(Vector2f size) { protected float getAspectRatio(Vector2f size) {
return size.x() / size.y(); return size.x() / size.y();
} }
protected float getAspectRatio(Vector3f size) {
return size.x() / size.y();
}
public void setAngleViewRad(float angle) { public void setAngleViewRad(float angle) {
this.angleViewRad = angle; this.angleViewRad = angle;
} }
@ -30,6 +33,11 @@ public class ProjectionPerspective implements ProjectionInterface {
return lastMatrix; return lastMatrix;
} }
@Override @Override
public Matrix4f updateMatrix(Vector3f diplaySize) {
lastMatrix = Matrix4f.createMatrixPerspective(getAngleViewRad(), getAspectRatio(diplaySize), nearView, farView);;
return lastMatrix;
}
@Override
public ValueLine reverseTransform(Vector2f diplaySize, Vector2f mousePosition) { public ValueLine reverseTransform(Vector2f diplaySize, Vector2f mousePosition) {
float mouse_pos_x_clip = mousePosition.x() / diplaySize.x() * 2.0f - 1.0f; float mouse_pos_x_clip = mousePosition.x() / diplaySize.x() * 2.0f - 1.0f;