Skip to content
Snippets Groups Projects
Verified Commit 6ea58489 authored by tristan.muller's avatar tristan.muller Committed by philippe.verley_ird.fr
Browse files

Add documentation to the visualization project.

parent 9c532bca
No related branches found
No related tags found
No related merge requests found
Showing
with 559 additions and 77 deletions
......@@ -22,6 +22,7 @@
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization;
import fr.amap.lidar.amapvox.visualization.views.VisualizationScene;
......@@ -30,12 +31,9 @@ import fr.amap.commons.util.debug.Debugger;
import fr.amap.commons.util.swing.jprogress.JProgressFrame;
import java.io.InputStream;
import fr.amap.lidar.amapvox.visualization.views.MainView;
import java.io.FileInputStream;
import java.io.FileReader;
/**
* Visualization class of the Voxelization project.
* @author Tristan Muller (tristan.muller@cirad.fr)
* Main class of the Voxelization project.
*/
public class Visualization {
......
......@@ -22,6 +22,7 @@
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization.controllers;
import java.awt.Color;
......@@ -32,21 +33,35 @@ import fr.amap.lidar.amapvox.visualization.opengl.util.Skyboxes;
import fr.amap.lidar.amapvox.visualization.util.ProjectProperties;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* Controller of the options view.
*/
public class OptionsController {
/**
* The current visualization scene.
*/
private VisualizationScene scene;
/**
* Create an options controller with empty scene.
*/
public OptionsController() {
this.scene = null;
}
/**
* Set the current visualization scene.
* @param scene
*/
public final void setScene(final VisualizationScene scene) {
this.scene = scene;
}
/**
* Chnage the background of the scene.
* @param background
* @throws IOException
*/
public final void changeBackground(final String background)
throws IOException {
if (scene != null) {
......@@ -55,6 +70,10 @@ public class OptionsController {
}
}
/**
* Change the color bar of the voxel space.
* @param name
*/
public final void changeColorBar(final String name) {
final Color[] colorBar = ColorBars.getColorBar(name);
scene.getVoxelSpaceComponent().setColorBar(colorBar);
......@@ -62,17 +81,29 @@ public class OptionsController {
ProjectProperties.setProperty("colorBar", name);
}
/**
* Change the draw fast property of the voxel space.
* @param enabled
*/
public final void changeDrawFast(final boolean enabled) {
scene.getVoxelSpaceComponent().setDrawFastEnabled(enabled);
ProjectProperties.setProperty("drawFastEnabled", Boolean.toString(enabled));
}
/**
* Change the voxel size
* @param size
*/
public final void changeVoxelSize(final int size) {
final float normalizedSize = (float) size / 100;
scene.getVoxelSpaceComponent().setDrawingMode(normalizedSize);
ProjectProperties.setProperty("voxelSize", Integer.toString(size));
}
/**
* Enable or disable the reflections of the voxel space.
* @param enabled
*/
public final void changeEnableReflection(final boolean enabled) {
if (scene != null) {
scene.getVoxelSpaceComponent().setReflectionEnabled(enabled);
......@@ -80,6 +111,10 @@ public class OptionsController {
}
}
/**
* Hide or show the grid entity.
* @param hide
*/
public final void setHideGrid(final boolean hide) {
if (scene != null) {
scene.setHideGrid(hide);
......@@ -88,6 +123,10 @@ public class OptionsController {
}
}
/**
* Hide or show the boundingbox entity.
* @param hide
*/
public final void setHideBoundingbox(final boolean hide) {
if (scene != null) {
scene.setHideBoundingBox(hide);
......@@ -96,6 +135,10 @@ public class OptionsController {
}
}
/**
* Set the voxels shape.
* @param index
*/
public final void setShape(final int index) {
if (scene != null) {
scene.getVoxelSpaceComponent().setDrawPixel(index == 0);
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* This software is governed by the CeCILL-B license under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/ or redistribute the software under the terms of the CeCILL-B license as
* circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy, modify
* and redistribute granted by the license, users are provided only with a
* limited warranty and the software's author, the holder of the economic
* rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated with
* loading, using, modifying and/or developing or reproducing the software by
* the user in light of its specific status of free software, that may mean that
* it is complicated to manipulate, and that also therefore means that it is
* reserved for developers and experienced professionals having in-depth
* computer knowledge. Users are therefore encouraged to load and test the
* software's suitability as regards their requirements in conditions enabling
* the security of their systems and/or data to be ensured and, more generally,
* to use and operate it in the same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization.controllers;
import fr.amap.lidar.amapvox.visualization.opengl.entities.util.VoxelFilter;
import fr.amap.lidar.amapvox.visualization.views.VisualizationScene;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* Controller of the properties view.
*/
public class PropertiesController {
/**
* The current scene.
*/
private VisualizationScene scene;
/**
* Create a property controller with an empty scene.
*/
public PropertiesController() {
this.scene = null;
}
/**
* Change the current scene.
* @param scene
*/
public final void setScene(final VisualizationScene scene) {
this.scene = scene;
}
/**
* Get the current scene.
* @return
*/
public final VisualizationScene getScene() {
return scene;
}
/**
* Change the displayed property of the voxel space.
* @param property
*/
public final void changeCurrentProperty(final String property) {
if (scene != null) {
scene.getVoxelSpaceComponent().setProperty(property);
......@@ -35,6 +72,12 @@ public class PropertiesController {
}
}
/**
* Change the min and max of the current property values.
* (not used by the UI)
* @param min
* @param max
*/
public final void changeMinAndMax(final float min, final float max) {
if (scene != null) {
scene.getVoxelSpaceComponent().setColorMinAndMax(min, max);
......@@ -42,6 +85,10 @@ public class PropertiesController {
}
}
/**
* Add or replace a particular filter of a voxel property.
* @param filter
*/
public final void changeFilter(final VoxelFilter filter) {
if (scene != null && filter != null) {
scene.getVoxelSpaceComponent().setFilter(filter);
......@@ -49,6 +96,10 @@ public class PropertiesController {
}
}
/**
* Remove a filter of a voxel property.
* @param filter
*/
public final void removeFilter(final int filter) {
if (scene != null) {
scene.getVoxelSpaceComponent().removeFilter(filter);
......@@ -56,6 +107,9 @@ public class PropertiesController {
}
}
/**
* Remove all voxel filters.
*/
public final void clearFilters() {
if (scene != null) {
scene.getVoxelSpaceComponent().resetFilters();
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* This software is governed by the CeCILL-B license under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/ or redistribute the software under the terms of the CeCILL-B license as
* circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy, modify
* and redistribute granted by the license, users are provided only with a
* limited warranty and the software's author, the holder of the economic
* rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated with
* loading, using, modifying and/or developing or reproducing the software by
* the user in light of its specific status of free software, that may mean that
* it is complicated to manipulate, and that also therefore means that it is
* reserved for developers and experienced professionals having in-depth
* computer knowledge. Users are therefore encouraged to load and test the
* software's suitability as regards their requirements in conditions enabling
* the security of their systems and/or data to be ensured and, more generally,
* to use and operate it in the same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization.controllers;
import fr.amap.commons.util.swing.jprogress.JProgressFrame;
......@@ -14,25 +34,44 @@ import java.io.InputStream;
import fr.amap.lidar.amapvox.visualization.views.VisualizationScene;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* Controller of the toolbar view.
*/
public class ToolbarController {
/**
* The current visualization scene.
*/
private VisualizationScene scene;
/**
* Create a new toolbar controller with an empty visualization scene.
*/
public ToolbarController() {
this.scene = null;
}
/**
* Set the current visualization scene.
* @param scene
*/
public final void setScene(final VisualizationScene scene) {
this.scene = scene;
}
/**
* Get the current visualization scene.
* @return
*/
public final VisualizationScene getScene() {
return scene;
}
/**
* Open a new voxel space file.
* @param file
* @param progressFrame
* @throws FileNotFoundException
*/
public final void openVoxelSpaceFile(final File file,
final JProgressFrame progressFrame)
throws FileNotFoundException {
......@@ -43,6 +82,10 @@ public class ToolbarController {
}
}
/**
* Change the current camera angle.
* @param viewType
*/
public final void setCameraView(final ViewType viewType) {
if (scene != null) {
scene.getCameraController().setView(viewType);
......
......@@ -31,22 +31,39 @@ import fr.amap.lidar.amapvox.visualization.views.VisualizationScene;
import java.awt.Color;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* Controller of the view view.
*/
public class ViewController {
/**
* The OpenGL canvas used to draw 3D elements.
*/
private GLNewtCanvas canvas;
/**
* The current visualization scene.
*/
private VisualizationScene scene;
/**
* Create a view controller with an empty canvas and an empty scene.
*/
public ViewController() {
this.canvas = null;
}
/**
* Set the OpenGL canvas of the view component.
* @param canvas
*/
public void setCanvas(final GLNewtCanvas canvas) {
this.canvas = canvas;
}
/**
* Set the current visualization scene.
* @param scene
*/
public final void setScene(final Scene scene) {
if (canvas != null) {
canvas.getGLEventListener().setScene(scene);
......@@ -54,6 +71,10 @@ public class ViewController {
}
}
/**
* Get the current used color bar.
* @return
*/
public final Color[] getCurrentColorBar() {
if (scene != null) {
return scene.getVoxelSpaceComponent().getColorBar();
......
......@@ -25,25 +25,43 @@
package fr.amap.lidar.amapvox.visualization.opengl.entities.base;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* Class to add to an entity to give it a behaviour.
*/
public abstract class Component extends Behaviour {
/**
* The entity of this component.
*/
protected Entity parent;
/**
* Create an abstract component.
*/
public Component() {
super();
}
/**
* Set the entity of this component.
* @param parent
*/
public final void setParent(final Entity parent) {
this.parent = parent;
}
/**
* Get the entity of this component.
* @return
*/
public final Entity getParent() {
return parent;
}
/**
* Implement it to receive messages from the scene.
* @param name
* @param object
*/
protected abstract void receiveMessage(final String name, final Object object);
}
......@@ -81,27 +81,52 @@ public final class Entity extends Behaviour {
transform.setParent(parent.getTransform());
}
/**
* Set the layout of this entity.
* @param layout
*/
public final void setLayout(final String layout) {
this.layout = layout;
}
/**
* Get the layout of this entity.
* @return
*/
public final String getLayout() {
return layout;
}
/**
* Set the scene where this entity is contained.
* @param scene
*/
public final void setScene(final Scene scene) {
this.scene = scene;
}
/**
* Get the scene where this entity is contained.
* @return
*/
public final Scene getScene() {
return scene;
}
/**
* Add a component to this entity.
* @param component
*/
public final void addComponent(final Component component) {
component.setParent(this);
components.add(component);
}
/**
* Check if this entity has the specified component.
* @param type
* @return
*/
public final boolean hasComponent(final Class<? extends Component> type) {
for (Component component : components) {
if (type.isInstance(component)) {
......@@ -112,6 +137,12 @@ public final class Entity extends Behaviour {
return false;
}
/**
* Get the specified component type from this entity.
* @param <T>
* @param type
* @return
*/
public final <T extends Component> T getComponent(final Class<T> type) {
for (Component component : components) {
if (type.isInstance(component)) {
......@@ -122,10 +153,18 @@ public final class Entity extends Behaviour {
return null;
}
/**
* Check if this entity has been modify during the frame.
* @return
*/
public final boolean isModified() {
return modified || transform.isModified();
}
/**
* Set if this entity has been modifyed during this frame.
* @param modified
*/
public final void setModified(final boolean modified) {
this.modified = modified;
}
......@@ -138,6 +177,11 @@ public final class Entity extends Behaviour {
return transform;
}
/**
* Send a message to each components.
* @param name
* @param object
*/
public final void sendMessage(final String name, final Object object) {
components.forEach((component) -> {
component.receiveMessage(name, object);
......
......@@ -45,8 +45,8 @@ import fr.amap.lidar.amapvox.visualization.opengl.resources.programs.SkyboxProgr
import fr.amap.lidar.amapvox.visualization.opengl.resources.textures.TextureCubemap;
/**
* A parent object that can be used to regroup many entities and make them work.
* @author Tristan Muller (tristan.muller@cirad.fr)
* A parent object that can be used to regroup
* many entities and make them work.
*/
public class Scene extends Behaviour {
......@@ -90,6 +90,9 @@ public class Scene extends Behaviour {
*/
protected boolean somethingsModified;
/**
* If the scene has been drawed twice.
*/
private boolean drawDouble;
/**
......@@ -144,14 +147,25 @@ public class Scene extends Behaviour {
}
}
/**
* Check if somethings has been modified in the scene during the frame.
* @return
*/
public final boolean isSomethingsHasBeenTransformed() {
return somethingsModified && !drawDouble;
}
/**
* Set that somethings has been modified during the frame.
*/
public final void setSomethingsModified() {
somethingsModified = true;
}
/**
* Change the background image of the scene.
* @param cubemap
*/
public final void setBackground(final TextureCubemap cubemap) {
this.skyboxCubemap = cubemap;
......
......@@ -32,7 +32,6 @@ import org.joml.Vector4f;
/**
* A transformation class that have a tridimentionnal position vector,
* a rotation quaternion and tridimensionnal scale vector and a parent transform.
* @author Tristan Muller (tristan.muller@cirad.fr)
*/
public final class Transform {
......@@ -119,6 +118,10 @@ public final class Transform {
return scale;
}
/**
* Get the position of this transform compared to its parent hierarchy.
* @return
*/
public final Vector3f getWorldPosition() {
final Vector4f worldPos = new Vector4f(position, 1);
......@@ -129,10 +132,18 @@ public final class Transform {
return new Vector3f(worldPos.x, worldPos.y, worldPos.z);
}
/**
* Get the rotation of this transform.
* @return
*/
public final Quaternionf getWorldRotation() {
return rotation;
}
/**
* Get the scale of this transform compared to its parent hierarchy.
* @return
*/
public final Vector3f getWorldScale() {
final Vector3f worldScale = new Vector3f(scale);
......@@ -162,6 +173,11 @@ public final class Transform {
return modified;
}
/**
* Get the translation matrix.
* @deprecated Moved in the GLSL shaders.
* @return
*/
public final Matrix4f getTranslationMatrix() {
/* Generate an identity matrix */
final Matrix4f transformation = new Matrix4f().identity();
......@@ -179,6 +195,11 @@ public final class Transform {
return transformation;
}
/**
* Get the rotation matrix.
* @deprecated Moved in the GLSL shaders.
* @return
*/
public final Matrix4f getRotationMatrix() {
/* Generate an identity matrix */
final Matrix4f transformation = new Matrix4f().identity();
......@@ -199,6 +220,7 @@ public final class Transform {
/**
* Get the transformation matrix from the parent transformation matrix
* and the current position, rotation and scale (also called a "model" matrix).
* @deprecated Moved in the GLSL shaders.
* @return
*/
public final Matrix4f getTransformation() {
......
......@@ -83,14 +83,29 @@ public final class Camera extends Component {
*/
private Matrix4f projection;
/**
* The framebuffer assiciated with this camera.
*/
private FrameBuffer frameBuffer;
/**
* The post process list of this camera.
*/
private final List<PostProcess> postProcesses;
/**
* The rendered layouts.
*/
private final List<String> renderedLayouts;
/**
* If the zoom functionnality is enabled.
*/
private boolean zoomEnabled;
/**
* The zooming callback function.
*/
private Consumer<Float> onZoomCallback;
/**
......@@ -109,6 +124,11 @@ public final class Camera extends Component {
this.renderedLayouts = new ArrayList();
}
/**
* Add a new post process to this camera.
* @param index
* @param postProcess
*/
public final void addPostProcess(final int index, final PostProcess postProcess) {
if (index < postProcesses.size()) {
this.postProcesses.add(index, postProcess);
......@@ -117,6 +137,10 @@ public final class Camera extends Component {
}
}
/**
* Add a rendered layout to this camera.
* @param layout
*/
public final void addLayout(final String layout) {
renderedLayouts.add(layout);
}
......@@ -129,6 +153,10 @@ public final class Camera extends Component {
this.fov = fov;
}
/**
* Set the zooming callback method.
* @param onZoomCallback
*/
public void setOnZoomCallback(Consumer<Float> onZoomCallback) {
this.onZoomCallback = onZoomCallback;
}
......@@ -175,6 +203,10 @@ public final class Camera extends Component {
return projection;
}
/**
* get the current rendered layouts.
* @return
*/
public final List<String> getRenderedLayouts() {
return renderedLayouts;
}
......@@ -186,6 +218,7 @@ public final class Camera extends Component {
@Override
public void onInputting(final InputEvent event, final InputStatus status) {
/* Perform zoom if that is enabled */
if (status == InputStatus.MOUSE_WHEEL_MOVED && zoomEnabled) {
final MouseEvent mouseEvent = (MouseEvent) event;
fov -= mouseEvent.getRotation()[1];
......
......@@ -22,6 +22,7 @@
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization.opengl.entities.extended;
import com.jogamp.newt.event.InputEvent;
......@@ -33,18 +34,38 @@ import fr.amap.lidar.amapvox.visualization.opengl.entities.util.ViewType;
import fr.amap.lidar.amapvox.visualization.opengl.util.InputStatus;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* Component to move the camera with the mouse.
*/
public class CameraController extends Component {
/**
* The mouse rotation quaternion.
*/
private final Quaternionf mouseRotation;
/**
* The last mouse x position.
*/
private int lastMouseX;
/**
* The last mouse y position.
*/
private int lastMouseY;
/**
* The width of the screen.
*/
private int screenWidth;
/**
* The height of the screen.
*/
private int screenheight;
/**
* Create a camera controller component.
*/
public CameraController() {
this.mouseRotation = new Quaternionf();
}
......@@ -127,11 +148,12 @@ public class CameraController extends Component {
@Override
public final void onDestroy(final GL3bc gl) {
/* Nothing needed to do */
}
@Override
protected final void receiveMessage(final String name, final Object object) {
/* Nothing needed to do */
}
}
......@@ -22,6 +22,7 @@
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization.opengl.entities.extended;
import com.jogamp.newt.event.InputEvent;
......@@ -30,7 +31,6 @@ import fr.amap.lidar.amapvox.visualization.opengl.util.InputStatus;
/**
* A particular component to draw a mesh in a scene.
* @author Tristan Muller (tristan.muller@cirad.fr)
*/
public final class MeshRenderer extends Renderer {
......@@ -57,6 +57,7 @@ public final class MeshRenderer extends Renderer {
throw(new NullPointerException("The current material is null."));
}
/* Send transform values to the material */
getMaterial().setPosition(parent.getTransform().getWorldPosition());
getMaterial().setRotation(parent.getTransform().getWorldRotation());
getMaterial().setScale(parent.getTransform().getWorldScale());
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* This software is governed by the CeCILL-B license under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/ or redistribute the software under the terms of the CeCILL-B license as
* circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy, modify
* and redistribute granted by the license, users are provided only with a
* limited warranty and the software's author, the holder of the economic
* rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated with
* loading, using, modifying and/or developing or reproducing the software by
* the user in light of its specific status of free software, that may mean that
* it is complicated to manipulate, and that also therefore means that it is
* reserved for developers and experienced professionals having in-depth
* computer knowledge. Users are therefore encouraged to load and test the
* software's suitability as regards their requirements in conditions enabling
* the security of their systems and/or data to be ensured and, more generally,
* to use and operate it in the same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization.opengl.entities.extended;
import org.joml.Matrix4f;
......@@ -15,8 +35,7 @@ import fr.amap.lidar.amapvox.visualization.opengl.resources.programs.Program;
import fr.amap.lidar.amapvox.visualization.opengl.resources.textures.TextureCubemap;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* A particular component to draw something in a scene.
*/
public abstract class Renderer extends Component {
......@@ -30,6 +49,9 @@ public abstract class Renderer extends Component {
*/
private Mesh mesh;
/**
* Create a renderer component.
*/
public Renderer() {
this.material = null;
this.mesh = null;
......
......@@ -49,8 +49,7 @@ import fr.amap.lidar.amapvox.visualization.opengl.resources.textures.TextureCube
import fr.amap.lidar.amapvox.visualization.opengl.util.InputStatus;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* Component used to display a voxel space.
*/
public class VoxelSpace extends Component {
......@@ -68,7 +67,10 @@ public class VoxelSpace extends Component {
* The size of each voxel drawables.
*/
private float voxelSize;
/**
* If each voxel is displayed has a pixel.
*/
private boolean drawPixel;
/**
......@@ -86,20 +88,56 @@ public class VoxelSpace extends Component {
*/
private float colorMax;
/**
* The default program.
*/
private final StandardProgram program;
/**
* The fast rendering program.
*/
private final StandardProgram fastProgram;
/**
* The materials list.
*/
private List<Material> materials;
/**
* The fast rendering materials list.
*/
private List<Material> fastMaterials;
/**
* The albedo texture used to display each voxel models.
*/
private Texture2D albedo;
/**
* The current rendered property.
*/
private String currentProperty;
/**
* If the fast drawing mode is enabled or not.
*/
private boolean drawFastEnabled;
/**
* The main camera fov used to resize the pixels.
*/
private float cameraFOV = 60;
/**
* The screen aspect used to resize the voxels displayed has pixels.
*/
private float screenAspect = 1f;
/**
* Create a voxel space component with the Equatorial colorbar.
* @param voxelMesh
* @throws IOException
*/
public VoxelSpace(final Mesh voxelMesh) throws IOException {
this.filters = new ConcurrentHashMap();
this.colorBar = ColorGradient.GRADIENT_GREEN_YELLOW_ORANGE_RED;
......@@ -125,6 +163,10 @@ public class VoxelSpace extends Component {
fastProgram.setMesh(fastMesh);
}
/**
* Change the voxel space file rendered by this component.
* @param file
*/
public final void setFile(final VoxelSpaceFile file) {
this.file = file;
......@@ -163,6 +205,10 @@ public class VoxelSpace extends Component {
}
}
/**
* Remove a filter from the current list.
* @param index
*/
public final void removeFilter(final int index) {
filters.remove(index);
setProperty(currentProperty);
......@@ -229,29 +275,34 @@ public class VoxelSpace extends Component {
final float n = (v - min) / (max - min);
/* Hide the filtered voxels */
if (null != next.getFilteringType())
if (null != next.getFilteringType()) {
switch (next.getFilteringType()) {
case EQUAL:
if (next.isHiden(n)) {
equalHiden = true;
} break;
case NOTEQUAL:
notEqualFilter = true;
if (next.isHiden(n)) {
notEqualHiden = true;
} break;
case LESSER:
if (next.isHiden(n)) {
lesserHiden = true;
} break;
case GREATER:
if (next.isHiden(n)) {
greaterHiden = true;
} break;
case EQUAL:
if (next.isHiden(n)) {
equalHiden = true;
}
break;
case NOTEQUAL:
notEqualFilter = true;
if (next.isHiden(n)) {
notEqualHiden = true;
}
break;
case LESSER:
if (next.isHiden(n)) {
lesserHiden = true;
}
break;
case GREATER:
if (next.isHiden(n)) {
greaterHiden = true;
}
break;
}
}
}
if (notEqualFilter) {
hiden = notEqualHiden;
} else if (equalHiden || (!lesserHiden && greaterHiden) || (lesserHiden && !greaterHiden)) {
......@@ -297,56 +348,97 @@ public class VoxelSpace extends Component {
}
}
/**
* The min and max of the color bar.
* @param min
* @param max
*/
public final void setColorMinAndMax(final float min, final float max) {
this.colorMin = min;
this.colorMax = max;
setProperty(currentProperty);
}
/**
* Change if the fast drawing mode is enabled or not.
* @param drawFastEnabled
*/
public final void setDrawFastEnabled(final boolean drawFastEnabled) {
this.drawFastEnabled = drawFastEnabled;
}
/**
* Set if the pixels are displayed as pixels.
* @param drawPixel
*/
public final void setDrawPixel(final boolean drawPixel) {
this.drawPixel = drawPixel;
}
/**
* Chnage the current color bar.
* @param colorBar
*/
public final void setColorBar(final Color[] colorBar) {
this.colorBar = colorBar;
setProperty(currentProperty);
}
/**
* Get the current color bar.
* @return
*/
public final Color[] getColorBar() {
return colorBar;
}
/**
* Get the ground height position of the current voxel space file.
* @return
*/
public final float getGroundHeightPosition() {
return -file.getDepth() - 0.01f;
}
/**
* Set if the reflection are displayed.
* @param reflectionEnabled
*/
public final void setReflectionEnabled(final boolean reflectionEnabled) {
program.setReflectionEnabled(reflectionEnabled);
fastProgram.setReflectionEnabled(reflectionEnabled);
parent.getScene().setSomethingsModified();
}
/**
* Set the main camera field of view.
* @param cameraFOV
*/
public void setCameraFOV(float cameraFOV) {
this.cameraFOV = cameraFOV;
}
/**
* Set the voxel size.
* @param mode
*/
public final void setDrawingMode(final float mode) {
voxelSize = mode;
for (Material material : materials) {
material.setScale(new Vector3f(voxelSize));
}
for (Material material : fastMaterials) {
material.setScale(new Vector3f(voxelSize));
}
parent.getScene().setSomethingsModified();
}
/**
* Set the current albedo texture used to display each voxels.
* @param albedo
*/
public final void setAlbedo(final Texture2D albedo) {
this.albedo = albedo;
......@@ -355,6 +447,12 @@ public class VoxelSpace extends Component {
}
}
/**
* Get the camera Z position to display the entire current voxel space file
* datas.
* @param fov
* @return
*/
public final float getCameraRetreat(final float fov) {
return (float) ((file.getWidth() + file.getHeight() + file.getDepth())
/ Math.sin(Math.toRadians(fov) * 2));
......@@ -377,18 +475,24 @@ public class VoxelSpace extends Component {
@Override
public final void onDisplay(final GL3bc gl) {
if ((parent.getScene().isSomethingsHasBeenTransformed()
if ((parent.getScene().isSomethingsHasBeenTransformed()
&& drawFastEnabled) || drawPixel) {
/* Get each pixel size aspects */
float voxelSizeAspect = ((file.getWidth() + file.getHeight() + file.getDepth()) / 3);
voxelSizeAspect = voxelSizeAspect / (voxelSizeAspect + 1);
float cameraFovAspect = (1 - cameraFOV / (cameraFOV + 1));
float drawFastAspect = drawPixel ? 1f : 0.9f;
gl.glPointSize(voxelSize * (1 - voxelSizeAspect)
/* Change the size of the pixels */
gl.glPointSize(voxelSize * (1 - voxelSizeAspect)
* cameraFovAspect * drawFastAspect * screenAspect * 20);
/* Draw the fast rendering mode program */
fastProgram.updateProperties();
fastProgram.bind(gl);
fastProgram.draw(gl);
} else {
/* Draw the default program */
program.updateProperties();
program.bind(gl);
program.draw(gl);
......@@ -397,7 +501,7 @@ public class VoxelSpace extends Component {
@Override
public final void onRescale(final GL3bc gl, final int width, final int height) {
/* Nothing needed to do */
/* Update the screen aspect used to resize each pixels */
screenAspect = (float) (width + height);
}
......
......@@ -25,14 +25,13 @@
package fr.amap.lidar.amapvox.visualization.opengl.entities.util;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* The type of view angle to set to a camera component.
*/
public enum ViewType {
X_NEG,
X_POS,
Y_NEG,
Y_POS,
Z_NEG,
Z_POS
Z_NEG, /* not used by the project */
Z_POS /* not used by the project */
}
......@@ -111,10 +111,12 @@ public class VoxelFilter {
* @return False if between or False.
*/
public final boolean isHiden(final float value) {
/* Hide NaN values */
if (hideNaN && Float.isNaN(value)) {
return true;
}
/* Hide voxel */
switch(filteringType) {
case NOTEQUAL: return value != this.value;
case LESSER: return value < this.value;
......
......@@ -25,8 +25,7 @@
package fr.amap.lidar.amapvox.visualization.opengl.entities.util;
/**
*
* @author Tristan Muller (tristan.muller@cirad.fr)
* Voxel filtering mode enum.
*/
public enum VoxelFilteringType {
LESSER,
......
......@@ -22,6 +22,7 @@
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization.opengl.entities.util;
import fr.amap.commons.util.swing.jprogress.JProgressEvent;
......@@ -36,8 +37,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
......
/*
* This software is governed by the CeCILL-B license under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/ or redistribute the software under the terms of the CeCILL-B license as
* circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy, modify
* and redistribute granted by the license, users are provided only with a
* limited warranty and the software's author, the holder of the economic
* rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated with
* loading, using, modifying and/or developing or reproducing the software by
* the user in light of its specific status of free software, that may mean that
* it is complicated to manipulate, and that also therefore means that it is
* reserved for developers and experienced professionals having in-depth
* computer knowledge. Users are therefore encouraged to load and test the
* software's suitability as regards their requirements in conditions enabling
* the security of their systems and/or data to be ensured and, more generally,
* to use and operate it in the same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization.opengl.resources;
import com.jogamp.opengl.GL3bc;
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* This software is governed by the CeCILL-B license under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/ or redistribute the software under the terms of the CeCILL-B license as
* circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy, modify
* and redistribute granted by the license, users are provided only with a
* limited warranty and the software's author, the holder of the economic
* rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated with
* loading, using, modifying and/or developing or reproducing the software by
* the user in light of its specific status of free software, that may mean that
* it is complicated to manipulate, and that also therefore means that it is
* reserved for developers and experienced professionals having in-depth
* computer knowledge. Users are therefore encouraged to load and test the
* software's suitability as regards their requirements in conditions enabling
* the security of their systems and/or data to be ensured and, more generally,
* to use and operate it in the same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
package fr.amap.lidar.amapvox.visualization.opengl.resources;
import java.util.HashMap;
/**
*
* Class to regroup resource in a single place (not used by the project).
* @author Tristan Muller (tristan.muller@cirad.fr)
*/
public class ResourceManager {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment