Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::Util Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  Circle
 
class  CRC32
 
struct  DrawReturnValue
 
struct  GraphPlot
 
struct  GraphPlot2D
 
struct  GraphPlot3D
 

Concepts

concept  valid_replace_string
 

Functions

bool FindCommandLineArgument (int argc, char **argv, const char *target_arg, const char *arg_prefix="--")
 
bool ExtractStartupProject (int argc, char **argv, string &projectOut, const char *arg_prefix="--")
 
template<typename T_str = string>
requires valid_replace_string<T_str>
bool ReplaceStringInPlace (T_str &subject, std::span< const std::string_view > search, std::string_view replace, bool recursive=false)
 
template<typename T_str = string>
requires valid_replace_string<T_str>
T_str ReplaceString (std::string_view subject, std::span< const std::string_view > search, std::string_view replace, bool recursive=false)
 
template<typename T_str = string>
requires valid_replace_string<T_str>
bool ReplaceStringInPlace (T_str &subject, std::string_view search, std::string_view replace, bool recursive=false)
 
template<typename T_str = string>
requires valid_replace_string<T_str>
T_str ReplaceString (std::string_view subject, std::string_view search, std::string_view replace, bool recursive=false)
 
string MakeXMLSafe (std::string_view subject)
 
ResourcePath MakeXMLSafe (const ResourcePath &subject)
 
template<typename T_str = string>
requires valid_replace_string<T_str>
void GetPermutations (std::string_view subject, vector< T_str > &permutationContainer)
 
template<typename T_str = string>
requires is_string<T_str>
bool IsNumber (const T_str &s)
 
bool IsNumber (const char *s)
 
bool BeginsWith (std::string_view input, std::string_view compare, bool ignoreWhitespace)
 
template<typename T_str = string>
requires is_string<T_str>
T_str GetTrailingCharacters (const T_str &input, size_t count)
 
template<typename T_str = string>
requires is_string<T_str>
T_str GetStartingCharacters (const T_str &input, size_t count)
 
bool CompareIgnoreCase (const char *a, const char *b) noexcept
 
bool CompareIgnoreCase (std::string_view a, std::string_view b) noexcept
 
template<typename T_vec , typename T_str >
requires is_vector<T_vec, T_str> && is_string<T_str>
T_vec Split (const char *input, char delimiter)
 http://stackoverflow.com/questions/236129/split-a-string-in-c
 
template<typename T_vec , typename T_str >
requires is_vector<T_vec, T_str> && is_string<T_str>
void Split (const char *input, char delimiter, T_vec &elems)
 
template<typename T_str = string>
requires is_string<T_str>
T_str & Ltrim (T_str &s)
 http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
 
template<typename T_str = string>
requires is_string<T_str>
T_str Ltrim (const T_str &s)
 http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
 
template<typename T_str = string>
requires is_string<T_str>
T_str & Rtrim (T_str &s)
 
template<typename T_str = string>
requires is_string<T_str>
T_str Rtrim (const T_str &s)
 
template<typename T_str = string>
requires is_string<T_str>
T_str & Trim (T_str &s)
 
template<typename T_str = string>
requires is_string<T_str>
T_str Trim (const T_str &s)
 
template<typename T_str = string>
requires is_string<T_str>
bool GetLine (istringstream &input, T_str &line, char delimiter='\n')
 
template<typename Str = string, typename... Args>
requires (!concept_const_char<Str>)
Str StringFormat (const char *fmt, Args &&...args)
 
template<typename Str = string, typename... Args>
requires (!concept_const_char<Str>)
void StringFormat (Str &output, const char *fmt, Args &&...args)
 
template<typename T >
string to_string (GET_PASS_TYPE< T > value)
 
template<typename T_str = string>
requires is_string<T_str>
U32 LineCount (const T_str &str)
 
void CStringRemoveChar (char *str, char charToRemove) noexcept
 
bool IsEmptyOrNull (const char *str) noexcept
 
char * commaprint (U64 number) noexcept
 
template<>
bool ReplaceStringInPlace (ResourcePath &subject, const std::string_view search, const std::string_view replace, const bool recursive)
 
template<typename Str , typename... Args>
requires (!concept_const_char<Str>)
FORCE_INLINE Str StringFormat (const char *fmt, Args &&...args)
 
template<typename Str , typename... Args>
requires (!concept_const_char<Str>)
FORCE_INLINE void StringFormat (Str &output, const char *fmt, Args &&...args)
 
template<typename T >
FORCE_INLINE string to_string (T value)
 
bool IntersectCircles (const Circle &cA, const Circle &cB, vec2< F32 > *pointsOut) noexcept
 
ptrdiff_t size_tGetAlignmentCorrected (const size_t value, const size_t alignment) noexcept
 
template<typename T , typename... Rest>
void Hash_combine (size_t &seed, const T &v, const Rest &... rest) noexcept
 a la Boost
 
template<typename U , typename T >
ConvertData (const T &data)
 
template<class FwdIt , class Compare = std::less<typename std::iterator_traits<FwdIt>::value_type>>
void InsertionSort (FwdIt first, FwdIt last, Compare cmp=Compare())
 
void Normalize (vec3< F32 > &inputRotation, bool degrees=false, bool normYaw=true, bool normPitch=true, bool normRoll=true) noexcept
 Normalise the selected rotations to be within the +/-180 degree range.
 
UColour4 ToByteColour (const FColour4 &floatColour) noexcept
 
UColour3 ToByteColour (const FColour3 &floatColour) noexcept
 
FColour4 ToFloatColour (const UColour4 &byteColour) noexcept
 
FColour3 ToFloatColour (const UColour3 &byteColour) noexcept
 
FColour4 ToFloatColour (const vec4< U32 > &colour) noexcept
 
FColour3 ToFloatColour (const vec3< U32 > &colour) noexcept
 
void ToByteColour (const FColour4 &floatColour, UColour4 &colourOut) noexcept
 
void ToByteColour (const FColour3 &floatColour, UColour3 &colourOut) noexcept
 
void ToFloatColour (const UColour4 &byteColour, FColour4 &colourOut) noexcept
 
void ToFloatColour (const UColour3 &byteColour, FColour3 &colourOut) noexcept
 
void ToFloatColour (const vec4< U32 > &uintColour, FColour4 &colourOut) noexcept
 
void ToFloatColour (const vec3< U32 > &uintColour, FColour3 &colourOut) noexcept
 
bool decomposeMatrix (const mat4< F32 > &transform, vec3< F32 > &translationOut, vec3< F32 > &scaleOut, vec3< Angle::RADIANS< F32 > > &rotationOut, bool &isUniformScaleOut)
 
bool decomposeMatrix (const mat4< F32 > &transform, vec3< F32 > &translationOut, vec3< F32 > &scaleOut, vec3< Angle::RADIANS< F32 > > &rotationOut)
 
bool decomposeMatrix (const mat4< F32 > &transform, vec3< F32 > &translationOut, vec3< F32 > &scaleOut)
 
bool decomposeMatrix (const mat4< F32 > &transform, vec3< F32 > &translationOut)
 
F32 PACK_VEC3 (F32_SNORM x, F32_SNORM y, F32_SNORM z) noexcept
 
F32 PACK_VEC3 (U8 x, U8 y, U8 z) noexcept
 
F32 PACK_VEC3 (const vec3< F32_SNORM > &value) noexcept
 
U32 PACK_HALF2x16 (vec2< F32 > value)
 
void UNPACK_HALF2x16 (U32 src, vec2< F32 > &value)
 
vec2< F32UNPACK_HALF2x16 (U32 src)
 
U32 PACK_HALF2x16 (F32 x, F32 y)
 
void UNPACK_HALF2x16 (U32 src, F32 &x, F32 &y)
 
U16 PACK_HALF1x16 (F32 value)
 Only convert the range [-1024., 1024.] for accurate results.
 
void UNPACK_HALF1x16 (U16 src, F32 &value)
 Only convert the range [-1024., 1024.] for accurate results.
 
F32 UNPACK_HALF1x16 (U16 src)
 Only convert the range [-1024., 1024.] for accurate results.
 
F32 UINT_TO_FLOAT (U32 src)
 
U32 FLOAT_TO_UINT (F32 src)
 
F32 INT_TO_FLOAT (I32 src)
 
I32 FLOAT_TO_INT (F32 src)
 
U32 PACK_UNORM4x8 (const vec4< F32_NORM > &value)
 
U32 PACK_UNORM4x8 (vec4< U8 > value)
 
void UNPACK_UNORM4x8 (U32 src, vec4< F32_NORM > &value)
 
U32 PACK_UNORM4x8 (F32_NORM x, F32_NORM y, F32_NORM z, F32_NORM w)
 
U32 PACK_UNORM4x8 (U8 x, U8 y, U8 z, U8 w)
 
void UNPACK_UNORM4x8 (U32 src, F32_NORM &x, F32_NORM &y, F32_NORM &z, F32_NORM &w)
 
void UNPACK_UNORM4x8 (U32 src, U8 &x, U8 &y, U8 &z, U8 &w)
 
vec4< U8UNPACK_UNORM4x8_U8 (U32 src)
 
vec4< F32_NORMUNPACK_UNORM4x8_F32 (U32 src)
 
void UNPACK_VEC3 (F32 src, F32_SNORM &x, F32_SNORM &y, F32_SNORM &z) noexcept
 
void UNPACK_VEC3 (F32 src, vec3< F32_SNORM > &res) noexcept
 
vec3< F32_SNORMUNPACK_VEC3 (F32 src) noexcept
 
U32 PACK_11_11_10 (const vec3< F32_NORM > &value)
 
void UNPACK_11_11_10 (U32 src, vec3< F32_NORM > &res)
 
vec3< F32_NORMUNPACK_11_11_10 (U32 src)
 
U32 PACK_11_11_10 (F32_NORM x, F32_NORM y, F32_NORM z)
 
void UNPACK_11_11_10 (U32 src, F32_NORM &x, F32_NORM &y, F32_NORM &z)
 
FORCE_INLINE size_t GetAlignmentCorrected (const size_t value, const size_t alignment) noexcept
 
template<typename T , typename... Rest>
FORCE_INLINE void Hash_combine (std::size_t &seed, const T &v, const Rest &... rest) noexcept
 a la Boost
 
template<typename T , typename... Rest>
requires std::is_integral<T>
::value &&std::is_unsigned< T >::value FORCE_INLINE void Hash_combine (size_t &seed, const T &v, const Rest &... rest) noexcept
 a la Boost
 
template<typename TargetType , typename SourceType >
TargetType ConvertData (const SourceType &data)
 
template<typename T , bool SeparateActivate, typename Pred >
void RegisterUndo (Editor &editor, PushConstantType type, const T &oldVal, const T &newVal, const char *name, Pred &&dataSetter)
 
template<typename T , size_t N, bool isSlider>
DrawReturnValue DrawVec (ImGuiDataType data_type, const char *label, T *values, ImGuiInputTextFlags flags, T resetValue=0, const char *format="%.2f")
 
template<typename T , size_t N, bool isSlider>
DrawReturnValue DrawVec (ImGuiDataType data_type, const char *label, const char *const compLabels[], T *values, ImGuiInputTextFlags flags, T resetValue=0, T minValue=0, T maxValue=0, T step=0, T stepFast=0, const char *format="%.2f")
 
template<typename T , bool isSlider>
DrawReturnValue DrawVecComponent (ImGuiDataType data_type, const char *label, T &value, T resetValue, T minValue, T maxValue, T step, T stepFast, ImVec4 buttonColour, ImVec4 buttonColourHovered, ImVec4 buttonColourActive, ImGuiInputTextFlags flags, const char *format="%.2f")
 
const char * GetFormat (ImGuiDataType dataType, const char *input, bool hex)
 
bool colourInput4 (Editor &parent, EditorComponentField &field)
 
bool colourInput3 (Editor &parent, EditorComponentField &field)
 
template<typename Pred >
bool colourInput4 (Editor &parent, const char *name, FColour4 &col, const bool readOnly, Pred &&dataSetter)
 
template<typename Pred >
bool colourInput3 (Editor &parent, const char *name, FColour3 &col, const bool readOnly, Pred &&dataSetter)
 
template<typename FieldDataType , typename ComponentType , size_t num_comp>
bool inputOrSlider (Editor &parent, const bool isSlider, const char *label, const F32 stepIn, ImGuiDataType data_type, EditorComponentField &field, ImGuiInputTextFlags flags, const char *format)
 
template<typename FieldDataType , typename ComponentType , size_t num_comp, bool IsSlider>
bool inputOrSlider (Editor &parent, const char *label, const F32 stepIn, const ImGuiDataType data_type, EditorComponentField &field, const ImGuiInputTextFlags flags, const char *format)
 
template<typename T , size_t num_rows>
bool inputMatrix (Editor &parent, const char *label, const F32 stepIn, const ImGuiDataType data_type, EditorComponentField &field, const ImGuiInputTextFlags flags, const char *format)
 
F32 GetLineHeight () noexcept
 
void AddUnderLine ()
 
void BeginPropertyTable (I32 numComponents, const char *label)
 
void EndPropertyTable ()
 
void PushButtonStyle (bool bold, ImVec4 buttonColour, ImVec4 buttonColourHovered, ImVec4 buttonColourActive)
 
void PopButtonStyle ()
 
void PushBoldFont ()
 
void PopBoldFont ()
 
void PushNarrowLabelWidth ()
 
void PopNarrowLabelWidth ()
 
void PushTooltip (const char *tooltip)
 
void PopTooltip ()
 
bool IsPushedTooltip ()
 
const char * PushedToolTip ()
 
void CenterNextWindow ()
 
void OpenCenteredPopup (const char *name, ImGui::ImGuiPopupFlags popup_flags=0)
 
void PrintColouredText (const std::string_view text, const ImVec4 &colour)
 
ImGuiInputTextFlags GetDefaultFlagsForSettings (bool readOnly, bool hex)
 
ImGuiInputTextFlags GetDefaultFlagsForField (const EditorComponentField &field)
 
template<typename T , size_t N, bool isSlider>
FORCE_INLINE DrawReturnValue DrawVec (ImGuiDataType data_type, const char *label, T *values, const ImGuiInputTextFlags flags, T resetValue, const char *format)
 
void OpenCenteredPopup (const char *name, const ImGuiPopupFlags popup_flags)
 
vec3< F32toVec3 (const physx::PxVec3 &vec) noexcept
 
physx::PxVec3 toVec3 (const vec3< F32 > &vec) noexcept
 

Variables

constexpr F32 LabelColumnWidth = 200.f
 
constexpr F32 LabelColumnWidthNarrow = 110.f
 
static const ImVec4 Colours []
 
static const ImVec4 ColoursHovered []
 
constexpr const char * FieldLabels []
 

Function Documentation

◆ AddUnderLine()

void Divide::Util::AddUnderLine ( )

Definition at line 229 of file Utils.cpp.

◆ BeginPropertyTable()

void Divide::Util::BeginPropertyTable ( I32  numComponents,
const char *  label 
)

Definition at line 237 of file Utils.cpp.

◆ BeginsWith()

bool Divide::Util::BeginsWith ( std::string_view  input,
std::string_view  compare,
bool  ignoreWhitespace 
)
inline

Definition at line 214 of file StringHelper.inl.

◆ CenterNextWindow()

void Divide::Util::CenterNextWindow ( )

Definition at line 406 of file Utils.cpp.

◆ colourInput3() [1/2]

template<typename Pred >
bool Divide::Util::colourInput3 ( Editor parent,
const char *  name,
FColour3 col,
const bool  readOnly,
Pred &&  dataSetter 
)
inline

Definition at line 207 of file Utils.inl.

◆ colourInput3() [2/2]

bool Divide::Util::colourInput3 ( Editor parent,
EditorComponentField field 
)

Definition at line 390 of file Utils.cpp.

◆ colourInput4() [1/2]

template<typename Pred >
bool Divide::Util::colourInput4 ( Editor parent,
const char *  name,
FColour4 col,
const bool  readOnly,
Pred &&  dataSetter 
)
inline

Definition at line 179 of file Utils.inl.

◆ colourInput4() [2/2]

bool Divide::Util::colourInput4 ( Editor parent,
EditorComponentField field 
)

Definition at line 374 of file Utils.cpp.

◆ commaprint()

char * Divide::Util::commaprint ( U64  number)
noexcept

Definition at line 66 of file StringHelper.cpp.

◆ CompareIgnoreCase() [1/2]

bool Divide::Util::CompareIgnoreCase ( const char *  a,
const char *  b 
)
inlinenoexcept

Definition at line 247 of file StringHelper.inl.

◆ CompareIgnoreCase() [2/2]

bool Divide::Util::CompareIgnoreCase ( std::string_view  a,
std::string_view  b 
)
inlinenoexcept

Definition at line 257 of file StringHelper.inl.

◆ ConvertData() [1/2]

template<typename TargetType , typename SourceType >
TargetType Divide::Util::ConvertData ( const SourceType &  data)

Definition at line 806 of file MathHelper.inl.

◆ ConvertData() [2/2]

template<typename U , typename T >
U Divide::Util::ConvertData ( const T &  data)

◆ CStringRemoveChar()

void Divide::Util::CStringRemoveChar ( char *  str,
char  charToRemove 
)
noexcept

Definition at line 52 of file StringHelper.cpp.

◆ decomposeMatrix() [1/4]

bool Divide::Util::decomposeMatrix ( const mat4< F32 > &  transform,
vec3< F32 > &  translationOut 
)

Definition at line 125 of file MathHelper.cpp.

◆ decomposeMatrix() [2/4]

bool Divide::Util::decomposeMatrix ( const mat4< F32 > &  transform,
vec3< F32 > &  translationOut,
vec3< F32 > &  scaleOut 
)

Definition at line 81 of file MathHelper.cpp.

◆ decomposeMatrix() [3/4]

bool Divide::Util::decomposeMatrix ( const mat4< F32 > &  transform,
vec3< F32 > &  translationOut,
vec3< F32 > &  scaleOut,
vec3< Angle::RADIANS< F32 > > &  rotationOut 
)

Definition at line 73 of file MathHelper.cpp.

◆ decomposeMatrix() [4/4]

bool Divide::Util::decomposeMatrix ( const mat4< F32 > &  transform,
vec3< F32 > &  translationOut,
vec3< F32 > &  scaleOut,
vec3< Angle::RADIANS< F32 > > &  rotationOut,
bool &  isUniformScaleOut 
)

Definition at line 14 of file MathHelper.cpp.

◆ DrawVec() [1/3]

template<typename T , size_t N, bool isSlider>
DrawReturnValue Divide::Util::DrawVec ( ImGuiDataType  data_type,
const char *  label,
const char *const  compLabels[],
T *  values,
ImGuiInputTextFlags  flags,
resetValue = 0,
minValue = 0,
maxValue = 0,
step = 0,
stepFast = 0,
const char *  format = "%.2f" 
)
inline

Definition at line 140 of file Utils.inl.

◆ DrawVec() [2/3]

template<typename T , size_t N, bool isSlider>
FORCE_INLINE DrawReturnValue Divide::Util::DrawVec ( ImGuiDataType  data_type,
const char *  label,
T *  values,
const ImGuiInputTextFlags  flags,
resetValue,
const char *  format 
)

Definition at line 168 of file Utils.inl.

◆ DrawVec() [3/3]

template<typename T , size_t N, bool isSlider>
DrawReturnValue Divide::Util::DrawVec ( ImGuiDataType  data_type,
const char *  label,
T *  values,
ImGuiInputTextFlags  flags,
resetValue = 0,
const char *  format = "%.2f" 
)

Definition at line 168 of file Utils.inl.

◆ DrawVecComponent()

template<typename T , bool isSlider>
DrawReturnValue Divide::Util::DrawVecComponent ( ImGuiDataType  data_type,
const char *  label,
T &  value,
resetValue,
minValue,
maxValue,
step,
stepFast,
ImVec4  buttonColour,
ImVec4  buttonColourHovered,
ImVec4  buttonColourActive,
ImGuiInputTextFlags  flags,
const char *  format = "%.2f" 
)
inline

Definition at line 71 of file Utils.inl.

◆ EndPropertyTable()

void Divide::Util::EndPropertyTable ( )

Definition at line 271 of file Utils.cpp.

◆ ExtractStartupProject()

bool Divide::Util::ExtractStartupProject ( int  argc,
char **  argv,
string projectOut,
const char *  arg_prefix = "--" 
)

Definition at line 28 of file StringHelper.cpp.

◆ FindCommandLineArgument()

bool Divide::Util::FindCommandLineArgument ( int  argc,
char **  argv,
const char *  target_arg,
const char *  arg_prefix = "--" 
)

Definition at line 14 of file StringHelper.cpp.

◆ FLOAT_TO_INT()

I32 Divide::Util::FLOAT_TO_INT ( F32  src)

Definition at line 353 of file MathHelper.cpp.

◆ FLOAT_TO_UINT()

U32 Divide::Util::FLOAT_TO_UINT ( F32  src)

Definition at line 345 of file MathHelper.cpp.

◆ GetAlignmentCorrected()

FORCE_INLINE size_t Divide::Util::GetAlignmentCorrected ( const size_t  value,
const size_t  alignment 
)
noexcept

Definition at line 783 of file MathHelper.inl.

◆ GetDefaultFlagsForField()

ImGuiInputTextFlags Divide::Util::GetDefaultFlagsForField ( const EditorComponentField field)

Definition at line 437 of file Utils.cpp.

◆ GetDefaultFlagsForSettings()

ImGuiInputTextFlags Divide::Util::GetDefaultFlagsForSettings ( bool  readOnly,
bool  hex 
)

Definition at line 429 of file Utils.cpp.

◆ GetFormat()

const char * Divide::Util::GetFormat ( ImGuiDataType  dataType,
const char *  input,
bool  hex 
)

Definition at line 357 of file Utils.cpp.

◆ GetLine()

template<typename T_str = string>
requires is_string<T_str>
bool Divide::Util::GetLine ( istringstream input,
T_str &  line,
char  delimiter = '\n' 
)

Definition at line 330 of file StringHelper.inl.

◆ GetLineHeight()

F32 Divide::Util::GetLineHeight ( )
noexcept

Definition at line 224 of file Utils.cpp.

◆ GetPermutations()

template<typename T_str = string>
requires valid_replace_string<T_str>
void Divide::Util::GetPermutations ( std::string_view  subject,
vector< T_str > &  permutationContainer 
)

Definition at line 98 of file StringHelper.inl.

◆ GetStartingCharacters()

template<typename T_str = string>
requires is_string<T_str>
T_str Divide::Util::GetStartingCharacters ( const T_str &  input,
size_t  count 
)

Definition at line 239 of file StringHelper.inl.

◆ GetTrailingCharacters()

template<typename T_str = string>
requires is_string<T_str>
T_str Divide::Util::GetTrailingCharacters ( const T_str &  input,
size_t  count 
)

Definition at line 230 of file StringHelper.inl.

◆ Hash_combine() [1/3]

template<typename T , typename... Rest>
void Divide::Util::Hash_combine ( size_t &  seed,
const T &  v,
const Rest &...  rest 
)
noexcept

a la Boost

Definition at line 799 of file MathHelper.inl.

◆ Hash_combine() [2/3]

template<typename T , typename... Rest>
requires std::is_integral<T>
::value &&std::is_unsigned< T >::value FORCE_INLINE void Divide::Util::Hash_combine ( size_t &  seed,
const T &  v,
const Rest &...  rest 
)
noexcept

a la Boost

Definition at line 799 of file MathHelper.inl.

◆ Hash_combine() [3/3]

template<typename T , typename... Rest>
FORCE_INLINE void Divide::Util::Hash_combine ( std::size_t &  seed,
const T &  v,
const Rest &...  rest 
)
noexcept

a la Boost

Definition at line 792 of file MathHelper.inl.

◆ inputMatrix()

template<typename T , size_t num_rows>
bool Divide::Util::inputMatrix ( Editor parent,
const char *  label,
const F32  stepIn,
const ImGuiDataType  data_type,
EditorComponentField field,
const ImGuiInputTextFlags  flags,
const char *  format 
)
inline

Definition at line 325 of file Utils.inl.

◆ inputOrSlider() [1/2]

template<typename FieldDataType , typename ComponentType , size_t num_comp>
bool Divide::Util::inputOrSlider ( Editor parent,
const bool  isSlider,
const char *  label,
const F32  stepIn,
ImGuiDataType  data_type,
EditorComponentField field,
ImGuiInputTextFlags  flags,
const char *  format 
)
inline

Definition at line 236 of file Utils.inl.

◆ inputOrSlider() [2/2]

template<typename FieldDataType , typename ComponentType , size_t num_comp, bool IsSlider>
bool Divide::Util::inputOrSlider ( Editor parent,
const char *  label,
const F32  stepIn,
const ImGuiDataType  data_type,
EditorComponentField field,
const ImGuiInputTextFlags  flags,
const char *  format 
)
inline

Definition at line 247 of file Utils.inl.

◆ InsertionSort()

template<class FwdIt , class Compare = std::less<typename std::iterator_traits<FwdIt>::value_type>>
void Divide::Util::InsertionSort ( FwdIt  first,
FwdIt  last,
Compare  cmp = Compare() 
)

Definition at line 816 of file MathHelper.inl.

◆ INT_TO_FLOAT()

F32 Divide::Util::INT_TO_FLOAT ( I32  src)

Definition at line 349 of file MathHelper.cpp.

◆ IntersectCircles()

bool Divide::Util::IntersectCircles ( const Circle cA,
const Circle cB,
vec2< F32 > *  pointsOut 
)
noexcept

Definition at line 150 of file MathHelper.cpp.

◆ IsEmptyOrNull()

bool Divide::Util::IsEmptyOrNull ( const char *  str)
noexcept

Definition at line 61 of file StringHelper.cpp.

◆ IsNumber() [1/2]

bool Divide::Util::IsNumber ( const char *  s)

Definition at line 44 of file StringHelper.cpp.

◆ IsNumber() [2/2]

template<typename T_str = string>
requires is_string<T_str>
bool Divide::Util::IsNumber ( const T_str &  s)

Definition at line 92 of file StringHelper.inl.

◆ IsPushedTooltip()

bool Divide::Util::IsPushedTooltip ( )

Definition at line 326 of file Utils.cpp.

◆ LineCount()

template<typename T_str = string>
requires is_string<T_str>
U32 Divide::Util::LineCount ( const T_str &  str)

Definition at line 276 of file StringHelper.inl.

◆ Ltrim() [1/2]

template<typename T_str = string>
requires is_string<T_str>
T_str Divide::Util::Ltrim ( const T_str &  s)

◆ Ltrim() [2/2]

template<typename T_str = string>
requires is_string<T_str>
T_str & Divide::Util::Ltrim ( T_str &  s)

◆ MakeXMLSafe() [1/2]

FORCE_INLINE ResourcePath Divide::Util::MakeXMLSafe ( const ResourcePath subject)

Definition at line 209 of file StringHelper.inl.

◆ MakeXMLSafe() [2/2]

string Divide::Util::MakeXMLSafe ( std::string_view  subject)
inline

Definition at line 199 of file StringHelper.inl.

◆ Normalize()

void Divide::Util::Normalize ( vec3< F32 > &  inputRotation,
bool  degrees = false,
bool  normYaw = true,
bool  normPitch = true,
bool  normRoll = true 
)
noexcept

Normalise the selected rotations to be within the +/-180 degree range.

Ogre3D

The normalise uses a wrap around,

so for example a yaw of 360 degrees becomes 0 degrees, and -190 degrees becomes 170.

Parameters
inputRotationrotation to normalize
degreesif true, values are in degrees, otherwise we use radians
normYawIf false, the yaw isn't normalized.
normPitchIf false, the pitch isn't normalized.
normRollIf false, the roll isn't normalized.

Definition at line 449 of file MathHelper.cpp.

◆ OpenCenteredPopup() [1/2]

void Divide::Util::OpenCenteredPopup ( const char *  name,
const ImGuiPopupFlags  popup_flags 
)

Definition at line 416 of file Utils.cpp.

◆ OpenCenteredPopup() [2/2]

void Divide::Util::OpenCenteredPopup ( const char *  name,
ImGui::ImGuiPopupFlags  popup_flags = 0 
)

◆ PACK_11_11_10() [1/2]

U32 Divide::Util::PACK_11_11_10 ( const vec3< F32_NORM > &  value)

Definition at line 426 of file MathHelper.cpp.

◆ PACK_11_11_10() [2/2]

U32 Divide::Util::PACK_11_11_10 ( F32_NORM  x,
F32_NORM  y,
F32_NORM  z 
)

Definition at line 434 of file MathHelper.cpp.

◆ PACK_HALF1x16()

U16 Divide::Util::PACK_HALF1x16 ( F32  value)

Only convert the range [-1024., 1024.] for accurate results.

Definition at line 327 of file MathHelper.cpp.

◆ PACK_HALF2x16() [1/2]

U32 Divide::Util::PACK_HALF2x16 ( F32  x,
F32  y 
)

Definition at line 357 of file MathHelper.cpp.

◆ PACK_HALF2x16() [2/2]

U32 Divide::Util::PACK_HALF2x16 ( vec2< F32 value)

Definition at line 312 of file MathHelper.cpp.

◆ PACK_UNORM4x8() [1/4]

U32 Divide::Util::PACK_UNORM4x8 ( const vec4< F32_NORM > &  value)

Definition at line 369 of file MathHelper.cpp.

◆ PACK_UNORM4x8() [2/4]

U32 Divide::Util::PACK_UNORM4x8 ( F32_NORM  x,
F32_NORM  y,
F32_NORM  z,
F32_NORM  w 
)

Definition at line 388 of file MathHelper.cpp.

◆ PACK_UNORM4x8() [3/4]

U32 Divide::Util::PACK_UNORM4x8 ( U8  x,
U8  y,
U8  z,
U8  w 
)

Definition at line 381 of file MathHelper.cpp.

◆ PACK_UNORM4x8() [4/4]

U32 Divide::Util::PACK_UNORM4x8 ( vec4< U8 value)

Definition at line 373 of file MathHelper.cpp.

◆ PACK_VEC3() [1/3]

F32 Divide::Util::PACK_VEC3 ( const vec3< F32_SNORM > &  value)
noexcept

Definition at line 292 of file MathHelper.cpp.

◆ PACK_VEC3() [2/3]

F32 Divide::Util::PACK_VEC3 ( F32_SNORM  x,
F32_SNORM  y,
F32_SNORM  z 
)
inlinenoexcept

Definition at line 316 of file MathHelper.inl.

◆ PACK_VEC3() [3/3]

F32 Divide::Util::PACK_VEC3 ( U8  x,
U8  y,
U8  z 
)
inlinenoexcept

Definition at line 328 of file MathHelper.inl.

◆ PopBoldFont()

void Divide::Util::PopBoldFont ( )

Definition at line 291 of file Utils.cpp.

◆ PopButtonStyle()

void Divide::Util::PopButtonStyle ( )

Definition at line 350 of file Utils.cpp.

◆ PopNarrowLabelWidth()

void Divide::Util::PopNarrowLabelWidth ( )

Definition at line 308 of file Utils.cpp.

◆ PopTooltip()

void Divide::Util::PopTooltip ( )

Definition at line 321 of file Utils.cpp.

◆ PrintColouredText()

void Divide::Util::PrintColouredText ( const std::string_view  text,
const ImVec4 &  colour 
)

Definition at line 422 of file Utils.cpp.

◆ PushBoldFont()

void Divide::Util::PushBoldFont ( )

Definition at line 282 of file Utils.cpp.

◆ PushButtonStyle()

void Divide::Util::PushButtonStyle ( bool  bold,
ImVec4  buttonColour,
ImVec4  buttonColourHovered,
ImVec4  buttonColourActive 
)

Definition at line 336 of file Utils.cpp.

◆ PushedToolTip()

const char * Divide::Util::PushedToolTip ( )

Definition at line 331 of file Utils.cpp.

◆ PushNarrowLabelWidth()

void Divide::Util::PushNarrowLabelWidth ( )

Definition at line 300 of file Utils.cpp.

◆ PushTooltip()

void Divide::Util::PushTooltip ( const char *  tooltip)

Definition at line 316 of file Utils.cpp.

◆ RegisterUndo()

template<typename T , bool SeparateActivate, typename Pred >
void Divide::Util::RegisterUndo ( Editor editor,
PushConstantType  type,
const T &  oldVal,
const T &  newVal,
const char *  name,
Pred &&  dataSetter 
)
inline

Definition at line 50 of file Utils.inl.

◆ ReplaceString() [1/2]

template<typename T_str = string>
requires valid_replace_string<T_str>
T_str Divide::Util::ReplaceString ( std::string_view  subject,
std::span< const std::string_view >  search,
std::string_view  replace,
bool  recursive = false 
)

Definition at line 130 of file StringHelper.inl.

◆ ReplaceString() [2/2]

template<typename T_str = string>
requires valid_replace_string<T_str>
T_str Divide::Util::ReplaceString ( std::string_view  subject,
std::string_view  search,
std::string_view  replace,
bool  recursive = false 
)

Definition at line 189 of file StringHelper.inl.

◆ ReplaceStringInPlace() [1/3]

template<>
bool Divide::Util::ReplaceStringInPlace ( ResourcePath subject,
const std::string_view  search,
const std::string_view  replace,
const bool  recursive 
)
inline

Definition at line 177 of file StringHelper.inl.

◆ ReplaceStringInPlace() [2/3]

template<typename T_str = string>
requires valid_replace_string<T_str>
bool Divide::Util::ReplaceStringInPlace ( T_str &  subject,
std::span< const std::string_view >  search,
std::string_view  replace,
bool  recursive = false 
)

Definition at line 111 of file StringHelper.inl.

◆ ReplaceStringInPlace() [3/3]

template<typename T_str = string>
requires valid_replace_string<T_str>
bool Divide::Util::ReplaceStringInPlace ( T_str &  subject,
std::string_view  search,
std::string_view  replace,
bool  recursive = false 
)

Definition at line 147 of file StringHelper.inl.

◆ Rtrim() [1/2]

template<typename T_str = string>
requires is_string<T_str>
T_str Divide::Util::Rtrim ( const T_str &  s)

Definition at line 300 of file StringHelper.inl.

◆ Rtrim() [2/2]

template<typename T_str = string>
requires is_string<T_str>
T_str & Divide::Util::Rtrim ( T_str &  s)

Definition at line 307 of file StringHelper.inl.

◆ size_tGetAlignmentCorrected()

ptrdiff_t Divide::Util::size_tGetAlignmentCorrected ( const size_t  value,
const size_t  alignment 
)
noexcept

◆ Split() [1/2]

template<typename T_vec , typename T_str >
requires is_vector<T_vec, T_str> && is_string<T_str>
T_vec Divide::Util::Split ( const char *  input,
char  delimiter 
)

◆ Split() [2/2]

template<typename T_vec , typename T_str >
requires is_vector<T_vec, T_str> && is_string<T_str>
void Divide::Util::Split ( const char *  input,
char  delimiter,
T_vec &  elems 
)

Definition at line 47 of file StringHelper.inl.

◆ StringFormat() [1/4]

template<typename Str = string, typename... Args>
requires (!concept_const_char<Str>)
Str Divide::Util::StringFormat ( const char *  fmt,
Args &&...  args 
)

Definition at line 358 of file StringHelper.inl.

◆ StringFormat() [2/4]

template<typename Str , typename... Args>
requires (!concept_const_char<Str>)
FORCE_INLINE Str Divide::Util::StringFormat ( const char *  fmt,
Args &&...  args 
)

Definition at line 358 of file StringHelper.inl.

◆ StringFormat() [3/4]

template<typename Str = string, typename... Args>
requires (!concept_const_char<Str>)
void Divide::Util::StringFormat ( Str output,
const char *  fmt,
Args &&...  args 
)

Definition at line 365 of file StringHelper.inl.

◆ StringFormat() [4/4]

template<typename Str , typename... Args>
requires (!concept_const_char<Str>)
FORCE_INLINE void Divide::Util::StringFormat ( Str output,
const char *  fmt,
Args &&...  args 
)

Definition at line 365 of file StringHelper.inl.

◆ to_string() [1/2]

template<typename T >
string Divide::Util::to_string ( GET_PASS_TYPE< T >  value)

◆ to_string() [2/2]

template<typename T >
FORCE_INLINE string Divide::Util::to_string ( value)

Definition at line 372 of file StringHelper.inl.

◆ ToByteColour() [1/4]

UColour3 Divide::Util::ToByteColour ( const FColour3 floatColour)
noexcept

Definition at line 262 of file MathHelper.cpp.

◆ ToByteColour() [2/4]

void Divide::Util::ToByteColour ( const FColour3 floatColour,
UColour3 colourOut 
)
noexcept

Definition at line 224 of file MathHelper.cpp.

◆ ToByteColour() [3/4]

UColour4 Divide::Util::ToByteColour ( const FColour4 floatColour)
noexcept

Definition at line 256 of file MathHelper.cpp.

◆ ToByteColour() [4/4]

void Divide::Util::ToByteColour ( const FColour4 floatColour,
UColour4 colourOut 
)
noexcept

Definition at line 217 of file MathHelper.cpp.

◆ ToFloatColour() [1/8]

FColour3 Divide::Util::ToFloatColour ( const UColour3 byteColour)
noexcept

Definition at line 274 of file MathHelper.cpp.

◆ ToFloatColour() [2/8]

void Divide::Util::ToFloatColour ( const UColour3 byteColour,
FColour3 colourOut 
)
noexcept

Definition at line 237 of file MathHelper.cpp.

◆ ToFloatColour() [3/8]

FColour4 Divide::Util::ToFloatColour ( const UColour4 byteColour)
noexcept

Definition at line 268 of file MathHelper.cpp.

◆ ToFloatColour() [4/8]

void Divide::Util::ToFloatColour ( const UColour4 byteColour,
FColour4 colourOut 
)
noexcept

Definition at line 230 of file MathHelper.cpp.

◆ ToFloatColour() [5/8]

FColour3 Divide::Util::ToFloatColour ( const vec3< U32 > &  colour)
noexcept

Definition at line 286 of file MathHelper.cpp.

◆ ToFloatColour() [6/8]

void Divide::Util::ToFloatColour ( const vec3< U32 > &  uintColour,
FColour3 colourOut 
)
noexcept

Definition at line 250 of file MathHelper.cpp.

◆ ToFloatColour() [7/8]

FColour4 Divide::Util::ToFloatColour ( const vec4< U32 > &  colour)
noexcept

Definition at line 280 of file MathHelper.cpp.

◆ ToFloatColour() [8/8]

void Divide::Util::ToFloatColour ( const vec4< U32 > &  uintColour,
FColour4 colourOut 
)
noexcept

Definition at line 243 of file MathHelper.cpp.

◆ toVec3() [1/2]

vec3< F32 > Divide::Util::toVec3 ( const physx::PxVec3 &  vec)
noexcept

Definition at line 10 of file PhysXActor.cpp.

◆ toVec3() [2/2]

physx::PxVec3 Divide::Util::toVec3 ( const vec3< F32 > &  vec)
noexcept

Definition at line 14 of file PhysXActor.cpp.

◆ Trim() [1/2]

template<typename T_str = string>
requires is_string<T_str>
T_str Divide::Util::Trim ( const T_str &  s)

Definition at line 323 of file StringHelper.inl.

◆ Trim() [2/2]

template<typename T_str = string>
requires is_string<T_str>
T_str & Divide::Util::Trim ( T_str &  s)

Definition at line 317 of file StringHelper.inl.

◆ UINT_TO_FLOAT()

F32 Divide::Util::UINT_TO_FLOAT ( U32  src)

Definition at line 341 of file MathHelper.cpp.

◆ UNPACK_11_11_10() [1/3]

vec3< F32_NORM > Divide::Util::UNPACK_11_11_10 ( U32  src)

Definition at line 306 of file MathHelper.cpp.

◆ UNPACK_11_11_10() [2/3]

void Divide::Util::UNPACK_11_11_10 ( U32  src,
F32_NORM x,
F32_NORM y,
F32_NORM z 
)

Definition at line 442 of file MathHelper.cpp.

◆ UNPACK_11_11_10() [3/3]

void Divide::Util::UNPACK_11_11_10 ( U32  src,
vec3< F32_NORM > &  res 
)

Definition at line 430 of file MathHelper.cpp.

◆ UNPACK_HALF1x16() [1/2]

F32 Divide::Util::UNPACK_HALF1x16 ( U16  src)

Only convert the range [-1024., 1024.] for accurate results.

Definition at line 335 of file MathHelper.cpp.

◆ UNPACK_HALF1x16() [2/2]

void Divide::Util::UNPACK_HALF1x16 ( U16  src,
F32 value 
)

Only convert the range [-1024., 1024.] for accurate results.

Definition at line 331 of file MathHelper.cpp.

◆ UNPACK_HALF2x16() [1/3]

vec2< F32 > Divide::Util::UNPACK_HALF2x16 ( U32  src)

Definition at line 321 of file MathHelper.cpp.

◆ UNPACK_HALF2x16() [2/3]

void Divide::Util::UNPACK_HALF2x16 ( U32  src,
F32 x,
F32 y 
)

Definition at line 361 of file MathHelper.cpp.

◆ UNPACK_HALF2x16() [3/3]

void Divide::Util::UNPACK_HALF2x16 ( U32  src,
vec2< F32 > &  value 
)

Definition at line 316 of file MathHelper.cpp.

◆ UNPACK_UNORM4x8() [1/3]

void Divide::Util::UNPACK_UNORM4x8 ( U32  src,
F32_NORM x,
F32_NORM y,
F32_NORM z,
F32_NORM w 
)

Definition at line 405 of file MathHelper.cpp.

◆ UNPACK_UNORM4x8() [2/3]

void Divide::Util::UNPACK_UNORM4x8 ( U32  src,
U8 x,
U8 y,
U8 z,
U8 w 
)

Definition at line 397 of file MathHelper.cpp.

◆ UNPACK_UNORM4x8() [3/3]

void Divide::Util::UNPACK_UNORM4x8 ( U32  src,
vec4< F32_NORM > &  value 
)

Definition at line 377 of file MathHelper.cpp.

◆ UNPACK_UNORM4x8_F32()

vec4< F32_NORM > Divide::Util::UNPACK_UNORM4x8_F32 ( U32  src)

Definition at line 420 of file MathHelper.cpp.

◆ UNPACK_UNORM4x8_U8()

vec4< U8 > Divide::Util::UNPACK_UNORM4x8_U8 ( U32  src)

Definition at line 414 of file MathHelper.cpp.

◆ UNPACK_VEC3() [1/3]

vec3< F32_SNORM > Divide::Util::UNPACK_VEC3 ( F32  src)
noexcept

Definition at line 300 of file MathHelper.cpp.

◆ UNPACK_VEC3() [2/3]

void Divide::Util::UNPACK_VEC3 ( F32  src,
F32_SNORM x,
F32_SNORM y,
F32_SNORM z 
)
inlinenoexcept

Definition at line 335 of file MathHelper.inl.

◆ UNPACK_VEC3() [3/3]

void Divide::Util::UNPACK_VEC3 ( F32  src,
vec3< F32_SNORM > &  res 
)
noexcept

Definition at line 296 of file MathHelper.cpp.

Variable Documentation

◆ Colours

const ImVec4 Divide::Util::Colours[]
static
Initial value:
= {
{0.8f, 0.1f, 0.15f, 1.f},
{0.2f, 0.7f, 0.2f, 1.f},
{0.1f, 0.25f, 0.8f, 1.f}
}

Definition at line 58 of file Utils.h.

◆ ColoursHovered

const ImVec4 Divide::Util::ColoursHovered[]
static
Initial value:
= {
{0.9f, 0.2f, 0.2f, 1.f},
{0.3f, 0.8f, 0.3f, 1.f},
{0.2f, 0.35f, 0.8f, 1.f}
}

Definition at line 63 of file Utils.h.

◆ FieldLabels

constexpr const char* Divide::Util::FieldLabels[]
constexpr
Initial value:
= {
"X", "Y", "Z", "W", "U", "V", "T"
}

Definition at line 69 of file Utils.h.

◆ LabelColumnWidth

constexpr F32 Divide::Util::LabelColumnWidth = 200.f
constexpr

Definition at line 55 of file Utils.h.

◆ LabelColumnWidthNarrow

constexpr F32 Divide::Util::LabelColumnWidthNarrow = 110.f
constexpr

Definition at line 56 of file Utils.h.