Skip to content

Commit

Permalink
[misc] converted all math namespace to be lower case
Browse files Browse the repository at this point in the history
  • Loading branch information
PanosK92 committed Jan 9, 2025
1 parent 510130f commit 30e843d
Show file tree
Hide file tree
Showing 117 changed files with 611 additions and 613 deletions.
20 changes: 10 additions & 10 deletions editor/ImGui/ImGui_Extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace ImGuiSp
return ImGui::Button(label);
}

static bool image_button(spartan::RHI_Texture* texture, const IconType icon, const spartan::Math::Vector2& size, bool border, ImVec4 tint = {1,1,1,1})
static bool image_button(spartan::RHI_Texture* texture, const IconType icon, const spartan::math::Vector2& size, bool border, ImVec4 tint = {1,1,1,1})
{
if (!border)
{
Expand Down Expand Up @@ -183,7 +183,7 @@ namespace ImGuiSp
);
}

static void image(spartan::RHI_Texture* texture, const spartan::Math::Vector2& size, bool border = false)
static void image(spartan::RHI_Texture* texture, const spartan::math::Vector2& size, bool border = false)
{
if (!border)
{
Expand Down Expand Up @@ -410,19 +410,19 @@ namespace ImGuiSp
return selection_made;
}

static void vector3(const char* label, spartan::Math::Vector3& vector)
static void vector3(const char* label, spartan::math::Vector3& vector)
{
const float label_indetation = 15.0f * spartan::Window::GetDpiScale();

const auto show_float = [](spartan::Math::Vector3 axis, float* value)
const auto show_float = [](spartan::math::Vector3 axis, float* value)
{
const float label_float_spacing = 15.0f * spartan::Window::GetDpiScale();
const float step = 0.01f;

// Label
ImGui::TextUnformatted(axis.x == 1.0f ? "X" : axis.y == 1.0f ? "Y" : "Z");
ImGui::SameLine(label_float_spacing);
spartan::Math::Vector2 pos_post_label = ImGui::GetCursorScreenPos();
spartan::math::Vector2 pos_post_label = ImGui::GetCursorScreenPos();

// Float
ImGui::PushItemWidth(128.0f);
Expand All @@ -435,8 +435,8 @@ namespace ImGuiSp
static const ImU32 color_x = IM_COL32(168, 46, 2, 255);
static const ImU32 color_y = IM_COL32(112, 162, 22, 255);
static const ImU32 color_z = IM_COL32(51, 122, 210, 255);
static const spartan::Math::Vector2 size = spartan::Math::Vector2(4.0f, 19.0f);
static const spartan::Math::Vector2 offset = spartan::Math::Vector2(5.0f, 4.0);
static const spartan::math::Vector2 size = spartan::math::Vector2(4.0f, 19.0f);
static const spartan::math::Vector2 offset = spartan::math::Vector2(5.0f, 4.0);
pos_post_label += offset;
ImRect axis_color_rect = ImRect(pos_post_label.x, pos_post_label.y, pos_post_label.x + size.x, pos_post_label.y + size.y);
ImGui::GetWindowDrawList()->AddRectFilled(axis_color_rect.Min, axis_color_rect.Max, axis.x == 1.0f ? color_x : axis.y == 1.0f ? color_y : color_z);
Expand All @@ -446,9 +446,9 @@ namespace ImGuiSp
ImGui::Indent(label_indetation);
ImGui::TextUnformatted(label);
ImGui::Unindent(label_indetation);
show_float(spartan::Math::Vector3(1.0f, 0.0f, 0.0f), &vector.x);
show_float(spartan::Math::Vector3(0.0f, 1.0f, 0.0f), &vector.y);
show_float(spartan::Math::Vector3(0.0f, 0.0f, 1.0f), &vector.z);
show_float(spartan::math::Vector3(1.0f, 0.0f, 0.0f), &vector.x);
show_float(spartan::math::Vector3(0.0f, 1.0f, 0.0f), &vector.y);
show_float(spartan::math::Vector3(0.0f, 0.0f, 1.0f), &vector.z);
ImGui::EndGroup();
};

Expand Down
20 changes: 10 additions & 10 deletions editor/ImGui/ImGui_TransformGizmo.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

namespace ImGui::TransformGizmo
{
const spartan::Math::Vector3 snap = spartan::Math::Vector3(0.1f, 0.1f, 0.1f);
const spartan::math::Vector3 snap = spartan::math::Vector3(0.1f, 0.1f, 0.1f);

bool first_use = true;
spartan::Math::Vector3 position_previous;
spartan::Math::Quaternion rotation_previous;
spartan::Math::Vector3 scale_previous;
spartan::math::Vector3 position_previous;
spartan::math::Quaternion rotation_previous;
spartan::math::Vector3 scale_previous;

void apply_style()
{
Expand Down Expand Up @@ -102,19 +102,19 @@ namespace ImGui::TransformGizmo
}

// get matrices
const spartan::Math::Matrix& matrix_view = camera->GetViewMatrix().Transposed();
const spartan::Math::Matrix& matrix_projection = camera->GetProjectionMatrix().Transposed();
const spartan::math::Matrix& matrix_view = camera->GetViewMatrix().Transposed();
const spartan::math::Matrix& matrix_projection = camera->GetProjectionMatrix().Transposed();

// begin
const bool is_orthographic = false;
ImGuizmo::SetOrthographic(is_orthographic);
ImGuizmo::BeginFrame();

// map transform to ImGuizmo
spartan::Math::Vector3 position = entity->GetPosition();
spartan::Math::Vector3 scale = entity->GetScale();
spartan::Math::Quaternion rotation = entity->GetRotation();
spartan::Math::Matrix transform_matrix = spartan::Math::Matrix::GenerateRowFirst(position, rotation, scale);
spartan::math::Vector3 position = entity->GetPosition();
spartan::math::Vector3 scale = entity->GetScale();
spartan::math::Quaternion rotation = entity->GetRotation();
spartan::math::Matrix transform_matrix = spartan::math::Matrix::GenerateRowFirst(position, rotation, scale);

// set viewport rectangle
ImGuizmo::SetDrawlist();
Expand Down
4 changes: 2 additions & 2 deletions editor/ImGui/Implementation/ImGui_RHI.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace ImGui::RHI
{
//= NAMESPACES =========
using namespace spartan;
using namespace Math;
using namespace math;
using namespace std;
//======================

Expand Down Expand Up @@ -301,7 +301,7 @@ namespace ImGui::RHI
{
// set scissor rectangle
{
Math::Rectangle scissor_rect;
math::Rectangle scissor_rect;
scissor_rect.left = pcmd->ClipRect.x - draw_data->DisplayPos.x;
scissor_rect.top = pcmd->ClipRect.y - draw_data->DisplayPos.y;
scissor_rect.right = pcmd->ClipRect.z - draw_data->DisplayPos.x;
Expand Down
8 changes: 4 additions & 4 deletions editor/ImGui/Source/imconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@
#include "Math/Vector4.h"

#define IM_VEC2_CLASS_EXTRA \
ImVec2(const spartan::Math::Vector2& f) { x = f.x; y = f.y; } \
operator spartan::Math::Vector2() const { return spartan::Math::Vector2(x,y); }
ImVec2(const spartan::math::Vector2& f) { x = f.x; y = f.y; } \
operator spartan::math::Vector2() const { return spartan::math::Vector2(x,y); }

#define IM_VEC4_CLASS_EXTRA \
ImVec4(const spartan::Math::Vector4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
operator spartan::Math::Vector4() const { return spartan::Math::Vector4(x, y, z, w); }
ImVec4(const spartan::math::Vector4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
operator spartan::math::Vector4() const { return spartan::math::Vector4(x, y, z, w); }

//---- ...Or use Dear ImGui's own very basic math operators.
//#define IMGUI_DEFINE_MATH_OPERATORS
Expand Down
2 changes: 1 addition & 1 deletion editor/MenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ namespace
const float offset_right = 120.0f * spartan::Window::GetDpiScale();
ImGui::SetCursorPosX(size_avail_x - offset_right);

spartan::Math::Vector2 icon_size = spartan::Math::Vector2(24.0f, 24.0f);
spartan::math::Vector2 icon_size = spartan::math::Vector2(24.0f, 24.0f);
if (ImGuiSp::image_button(nullptr, IconType::Window_Minimize, icon_size, false))
{
spartan::Window::Minimize();
Expand Down
2 changes: 1 addition & 1 deletion editor/Widgets/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//= NAMESPACES =========
using namespace std;
using namespace spartan;
using namespace Math;
using namespace math;
//======================

namespace
Expand Down
2 changes: 1 addition & 1 deletion editor/Widgets/FileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//= NAMESPACES ===============
using namespace std;
using namespace spartan;
using namespace spartan::Math;
using namespace spartan::math;
//============================

namespace
Expand Down
4 changes: 2 additions & 2 deletions editor/Widgets/FileDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class FileDialog
const bool m_drop_shadow = true;
const float m_item_size_min = 50.0f;
const float m_item_size_max = 200.0f;
const spartan::Math::Vector4 m_content_background_color = spartan::Math::Vector4(0.0f, 0.0f, 0.0f, 50.0f);
const spartan::math::Vector4 m_content_background_color = spartan::math::Vector4(0.0f, 0.0f, 0.0f, 50.0f);

// Flags
bool m_is_window;
Expand All @@ -141,7 +141,7 @@ class FileDialog
FileDialog_Operation m_operation;
FileDialog_Filter m_filter;
std::vector<FileDialogItem> m_items;
spartan::Math::Vector2 m_item_size;
spartan::math::Vector2 m_item_size;
ImGuiTextFilter m_search_filter;
std::string m_current_path;

Expand Down
2 changes: 1 addition & 1 deletion editor/Widgets/Profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

//= NAMESPACES ===============
using namespace std;
using namespace spartan::Math;
using namespace spartan::math;
//============================

namespace
Expand Down
10 changes: 5 additions & 5 deletions editor/Widgets/Profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#pragma once

//= INCLUDES ===============
//= INCLUDES ===========
#include "Widget.h"
#include "Math/MathHelper.h"
#include "Math/Helper.h"
#include <array>
//==========================
//======================

struct Timings
{
Timings() { Clear(); }

void AddSample(const float sample)
{
m_min = spartan::Math::Helper::Min(m_min, sample);
m_max = spartan::Math::Helper::Max(m_max, sample);
m_min = spartan::math::helper::Min(m_min, sample);
m_max = spartan::math::helper::Max(m_max, sample);
m_sum += sample;
m_sample_count++;
m_avg = float(m_sum / static_cast<float>(m_sample_count));
Expand Down
2 changes: 1 addition & 1 deletion editor/Widgets/ProgressDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//= NAMESPACES ===============
using namespace std;
using namespace spartan;
using namespace spartan::Math;
using namespace spartan::math;
//============================

namespace
Expand Down
10 changes: 5 additions & 5 deletions editor/Widgets/Properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//= NAMESPACES =========
using namespace std;
using namespace spartan;
using namespace Math;
using namespace math;
//======================

weak_ptr<Entity> Properties::m_inspected_entity;
Expand Down Expand Up @@ -252,7 +252,7 @@ void Properties::ShowLight(shared_ptr<Light> light) const
static vector<string> types = { "Directional", "Point", "Spot" };
float intensity = light->GetIntensityLumens();
float temperature_kelvin = light->GetTemperature();
float angle = light->GetAngle() * Math::Helper::RAD_TO_DEG * 2.0f;
float angle = light->GetAngle() * math::helper::RAD_TO_DEG * 2.0f;
bool shadows = light->GetFlag(spartan::LightFlags::Shadows);
bool shadows_transparent = light->GetFlag(spartan::LightFlags::ShadowsTransparent);
bool shadows_screen_space = light->GetFlag(spartan::LightFlags::ShadowsScreenSpace);
Expand Down Expand Up @@ -362,7 +362,7 @@ void Properties::ShowLight(shared_ptr<Light> light) const

//= MAP ===================================================================================================================
if (intensity != light->GetIntensityLumens()) light->SetIntensity(intensity);
if (angle != light->GetAngle() * Math::Helper::RAD_TO_DEG * 0.5f) light->SetAngle(angle * Math::Helper::DEG_TO_RAD * 0.5f);
if (angle != light->GetAngle() * math::helper::RAD_TO_DEG * 0.5f) light->SetAngle(angle * math::helper::DEG_TO_RAD * 0.5f);
if (range != light->GetRange()) light->SetRange(range);
if (m_colorPicker_light->GetColor() != light->GetColor()) light->SetColor(m_colorPicker_light->GetColor());
if (temperature_kelvin != light->GetTemperature()) light->SetTemperature(temperature_kelvin);
Expand Down Expand Up @@ -679,12 +679,12 @@ void Properties::ShowMaterial(Material* material) const
if (component_begin("Material", IconType::Component_Material, nullptr, false))
{
//= REFLECT ================================================
Math::Vector2 tiling = Vector2(
math::Vector2 tiling = Vector2(
material->GetProperty(MaterialProperty::TextureTilingX),
material->GetProperty(MaterialProperty::TextureTilingY)
);

Math::Vector2 offset = Vector2(
math::Vector2 offset = Vector2(
material->GetProperty(MaterialProperty::TextureOffsetX),
material->GetProperty(MaterialProperty::TextureOffsetY)
);
Expand Down
4 changes: 2 additions & 2 deletions editor/Widgets/RenderOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//= NAMESPACES ===============
using namespace std;
using namespace spartan;
using namespace spartan::Math;
using namespace spartan::math;
//============================

namespace
Expand Down Expand Up @@ -133,7 +133,7 @@ namespace
ImGui::InputFloat("", &value, step, 0.0f, format);
ImGui::PopItemWidth();
ImGui::PopID();
value = Math::Helper::Clamp(value, min, max);
value = math::helper::Clamp(value, min, max);

// Only update if changed
if (Renderer::GetOption<float>(render_option) != value)
Expand Down
2 changes: 1 addition & 1 deletion editor/Widgets/Style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//= NAMESPACES =========
using namespace std;
using namespace spartan;
using namespace Math;
using namespace math;
using namespace ImGui::Style;
//======================

Expand Down
6 changes: 3 additions & 3 deletions editor/Widgets/TextureViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//= NAMESPACES =========
using namespace std;
using namespace spartan;
using namespace Math;
using namespace math;
//======================

namespace
Expand Down Expand Up @@ -169,7 +169,7 @@ void TextureViewer::OnTickVisible()
ImGui::PushItemWidth(85 * spartan::Window::GetDpiScale());
ImGui::InputInt("Mip", &mip_level);
ImGui::PopItemWidth();
mip_level = Math::Helper::Clamp(mip_level, 0, static_cast<int>(texture_current->GetMipCount()) - 1);
mip_level = math::helper::Clamp(mip_level, 0, static_cast<int>(texture_current->GetMipCount()) - 1);
}

// array level control
Expand All @@ -179,7 +179,7 @@ void TextureViewer::OnTickVisible()
ImGui::PushItemWidth(85 * spartan::Window::GetDpiScale());
ImGui::InputInt("Array", &array_level);
ImGui::PopItemWidth();
array_level = Math::Helper::Clamp(array_level, 0, static_cast<int>(texture_current->GetDepth()) - 1);
array_level = math::helper::Clamp(array_level, 0, static_cast<int>(texture_current->GetDepth()) - 1);
}

ImGui::BeginGroup();
Expand Down
2 changes: 1 addition & 1 deletion editor/Widgets/Viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//= NAMESPACES =========
using namespace std;
using namespace spartan;
using namespace Math;
using namespace math;
//======================

namespace
Expand Down
2 changes: 1 addition & 1 deletion editor/Widgets/Viewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ class Viewport : public Widget
void OnTickVisible() override;

private:
spartan::Math::Vector2 m_offset = spartan::Math::Vector2::Zero;
spartan::math::Vector2 m_offset = spartan::math::Vector2::Zero;
float m_window_padding = 4.0f;
};
2 changes: 1 addition & 1 deletion editor/Widgets/Widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void Widget::OnPreBegin()
}
}

spartan::Math::Vector2 Widget::GetCenter() const
spartan::math::Vector2 Widget::GetCenter() const
{
ImVec2 pos = m_window->Pos;
ImVec2 sze = m_window->Size;
Expand Down
10 changes: 5 additions & 5 deletions editor/Widgets/Widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Widget
void PushStyleVar(ImGuiStyleVar idx, T val) { ImGui::PushStyleVar(idx, val); m_var_push_count++; }

// properties
spartan::Math::Vector2 GetCenter() const;
spartan::math::Vector2 GetCenter() const;
float GetHeight() const { return m_height; }
ImGuiWindow* GetWindow() const { return m_window; }
const auto& GetTitle() const { return m_title; }
Expand All @@ -77,10 +77,10 @@ class Widget
int m_flags = ImGuiWindowFlags_NoCollapse;
float m_height = 0;
float m_alpha = -1.0f;
spartan::Math::Vector2 m_size_initial = k_widget_default_property;
spartan::Math::Vector2 m_size_min = k_widget_default_property;
spartan::Math::Vector2 m_size_max = FLT_MAX;
spartan::Math::Vector2 m_padding = k_widget_default_property;
spartan::math::Vector2 m_size_initial = k_widget_default_property;
spartan::math::Vector2 m_size_min = k_widget_default_property;
spartan::math::Vector2 m_size_max = FLT_MAX;
spartan::math::Vector2 m_padding = k_widget_default_property;
std::string m_title = "Title";

// the ImGui window this widget corresponds to
Expand Down
2 changes: 1 addition & 1 deletion runtime/Audio/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace spartan
if (m_listener)
{
auto position = m_listener->GetPosition();
auto velocity = Math::Vector3::Zero;
auto velocity = math::Vector3::Zero;
auto forward = m_listener->GetForward();
auto up = m_listener->GetUp();

Expand Down
2 changes: 1 addition & 1 deletion runtime/Audio/AudioClip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

//= NAMESPACES ================
using namespace std;
using namespace spartan::Math;
using namespace spartan::math;
//=============================

namespace spartan
Expand Down
Loading

0 comments on commit 30e843d

Please sign in to comment.