Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.vscode
[bB]uild
third/vcpkg
*.jpg
*.ini
*.ini
docs
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ add_subdirectory("deps/nifti")
include_directories("deps/nifti/include/")

# imgui include
file(GLOB IMGUI_SRC "deps/imgui/src/*.cpp")
file(GLOB IMGUI_SRC "deps/imgui-1.89/src/*.cpp")
add_library(IMGUI ${IMGUI_SRC})
target_link_libraries(IMGUI PRIVATE glfw GLAD)
include_directories("deps/imgui/include/")
include_directories("deps/imgui-1.89/include/")
add_compile_definitions(IMGUI_IMPL_OPENGL_LOADER_GLAD)

# file dialog include
add_library(IMGUI_FILE_DIA "deps/ImGuiFileDialog-Lib_Only/ImGuiFileDialog.cpp")
target_link_libraries(IMGUI_FILE_DIA PRIVATE IMGUI)
include_directories("deps/ImGuiFileDialog-Lib_Only/dirent/" "deps/ImGuiFileDialog-Lib_Only/")
add_compile_definitions(USE_STD_FILESYSTEM)

# std image loader include
include_directories("deps/stb/include/")

Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2299,7 +2299,7 @@ HIDE_UNDOC_RELATIONS = YES
# set to NO
# The default value is: YES.

HAVE_DOT = NO
HAVE_DOT = YES

# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
# to run in parallel. When set to 0 doxygen will base this on the number of
Expand Down
1 change: 1 addition & 0 deletions Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ target_link_libraries(dmriexplorer PRIVATE GLAD)
target_link_libraries(dmriexplorer PRIVATE glfw)
target_link_libraries(dmriexplorer PRIVATE NIFTI_LIB)
target_link_libraries(dmriexplorer PRIVATE IMGUI)
target_link_libraries(dmriexplorer PRIVATE IMGUI_FILE_DIA)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

Expand Down
125 changes: 0 additions & 125 deletions Engine/include/application.h

This file was deleted.

33 changes: 14 additions & 19 deletions Engine/include/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,29 @@
#include <shader_data.h>
#include <memory>
#include <coordinate_system.h>
#include <application_state.h>

namespace Slicer
{
enum class CameraMode
{
X_VIEW_2D = 0,
Y_VIEW_2D = 1,
Z_VIEW_2D = 2,
FREE_3D = 3
};

/// Class for camera object.
class Camera
{
public:
/// Default constructor.
Camera() = default;

/// Constructor.
/// \param[in] position Starting position in world coordinates.
/// \param[in] upVector Up vector in world coordinates.
/// \param[in] lookAt Point at center of view.
/// \param[in] fov Field of view in radians.
/// \param[in] aspect Aspect ratio of window (width / height).
/// \param[in] near Near clipping distance.
/// \param[in] far Far clipping distance.
/// \param[in] state Pointer to ApplicationState instance.
Camera(const glm::vec3& position,
const glm::vec3& upVector,
const glm::vec3& lookAt,
const float& fov, const float& aspect,
const float& near, const float& far,
const std::shared_ptr<ApplicationState>& state);
const float& near, const float& far);

/// Constructor.
/// \param[in] camera The camera object used for instantiation.
Expand Down Expand Up @@ -58,15 +55,14 @@ class Camera
/// Update camera attributes on the GPU.
void UpdateGPU();

private:
/// Set the state for the camera mode
/// \param[in] previous Previous value.
/// \param[in] mode New value for fading behaviour.
void setMode(State::CameraMode previous, State::CameraMode mode);
void SetMode(CameraMode mode);

/// \see Model::registerStateCallbacks()
void registerStateCallbacks();
inline CameraMode GetMode() const { return mMode; };

private:
/// Struct containing camera attributes to push on the GPU.
struct CameraData
{
Expand Down Expand Up @@ -101,13 +97,12 @@ class Camera
/// View matrix.
glm::mat4 mViewMatrix;

/// Pointer to the ApplicationState, containing global parameters.
std::shared_ptr<ApplicationState> mState;

/// Shader data for camera attributes.
GPU::ShaderData mCamParamsData;

//Boolean to block the rotation of the scene
bool mBlockRotation;

CameraMode mMode = CameraMode::FREE_3D;
};
} // namespace Slicer
23 changes: 23 additions & 0 deletions Engine/include/draw_elements_indirect_command.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

namespace Slicer
{
/// Struct for glMultiDrawElementsIndirect command.
struct DrawElementsIndirectCommand
{
/// Number of elements to be rendered.
unsigned int count;

/// Number of instances of the indexed geometry to draw.
unsigned int instanceCount;

/// Offset to the beginning of elements.
unsigned int firstIndex;

/// Constant that should be added to each element of indices.
unsigned int baseVertex;

/// Base instance for use in fetching instanced vertex attributes.
unsigned int baseInstance;
};
} // namespace Slicer
47 changes: 47 additions & 0 deletions Engine/include/grid_model.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#pragma once
#include <glm/glm.hpp>

namespace Slicer
{
class GridModel
{
public:
GridModel() = delete;
GridModel(unsigned int x, unsigned int y, unsigned int z);
bool AssertDimensions(unsigned int x, unsigned int y, unsigned int z) const;
inline glm::uvec3 GetDimensions() const { return glm::uvec3(mNX, mNY, mNZ); };
inline glm::uvec3 GetSlicesLocation() const { return glm::uvec3(mSliceX, mSliceY, mSliceZ); };
inline glm::bvec3 GetIsVisible() const { return glm::bvec3(mIsVisibleX, mIsVisibleY, mIsVisibleZ); };
inline unsigned int GetLastEditedSlice() const { return mLastEditedSlice; };

// TODO: Nb voxels per plane could be members of this class instead of TensorModel/SHModel

inline void SetIsXVisible(bool isVisible) { mIsVisibleX = isVisible; };
inline void SetIsYVisible(bool isVisible) { mIsVisibleY = isVisible; };
inline void SetIsZVisible(bool isVisible) { mIsVisibleZ = isVisible; };

inline void SetSliceXLocation(unsigned int x) { mSliceX = x; mLastEditedSlice = 0; };
inline void SetSliceYLocation(unsigned int y) { mSliceY = y; mLastEditedSlice = 1; };
inline void SetSliceZLocation(unsigned int z) { mSliceZ = z; mLastEditedSlice = 2; };

inline void SetLastEditedSlice(unsigned int slice) { mLastEditedSlice = slice; };

private:
// image dimension along each axis
unsigned int mNX = 0;
unsigned int mNY = 0;
unsigned int mNZ = 0;

// slicer location along each axis
unsigned int mSliceX = 0;
unsigned int mSliceY = 0;
unsigned int mSliceZ = 0;

unsigned int mLastEditedSlice = 0;

// visibility status of each slice
bool mIsVisibleX = true;
bool mIsVisibleY = true;
bool mIsVisibleZ = true;
};
} // namespace Slicer
9 changes: 3 additions & 6 deletions Engine/include/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,18 @@ class UIManager
/// Draw the preferences window.
void drawPreferencesWindow();

/// Draw ImGUI demo window.
void drawDemoWindow();

/// Pointer to GLFW window.
GLFWwindow* mWindow;

/// Pointer to ImGuiIO object.
ImGuiIO* mIO;

// Window flags for imgui windows
ImGuiWindowFlags mWindowFlags;

/// Reference to ApplicationState.
std::shared_ptr<ApplicationState> mState;

/// True to show demo window.
bool mShowDemoWindow;

/// True to show magnifiying mode.
bool mShowMagnifyingMode;

Expand Down
2 changes: 1 addition & 1 deletion Engine/include/mt_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <shader.h>
#include <mutex>
#include <model.h>
#include <sh_field.h>
#include <draw_elements_indirect_command.h>

namespace Slicer
{
Expand Down
Loading