@@ -33,10 +33,12 @@ void array_base<T, ARRAY>::Shuffle() | |||||
template<typename T, typename ARRAY> | template<typename T, typename ARRAY> | ||||
void array_base<T, ARRAY>::Sort(int sort) | void array_base<T, ARRAY>::Sort(int sort) | ||||
{ | { | ||||
#if SORT_WORKS // yeah cause it's shite. | |||||
int s = 0; | int s = 0; | ||||
// Classic bubble | // Classic bubble | ||||
if (s++ == sort) | if (s++ == sort) | ||||
{ | { | ||||
#endif //SORT_WORKS | |||||
int d = 1; | int d = 1; | ||||
for (ptrdiff_t i = 0; i < Count() - 1; i = lol::max(i + d, (ptrdiff_t)0)) | for (ptrdiff_t i = 0; i < Count() - 1; i = lol::max(i + d, (ptrdiff_t)0)) | ||||
{ | { | ||||
@@ -48,12 +50,14 @@ void array_base<T, ARRAY>::Sort(int sort) | |||||
d = -1; | d = -1; | ||||
} | } | ||||
} | } | ||||
#if SORT_WORKS | |||||
} | } | ||||
// Quick sort with swap | // Quick sort with swap | ||||
else if (s++ == sort) | else if (s++ == sort) | ||||
{ | { | ||||
SortQuickSwap(0, Count()); | SortQuickSwap(0, Count()); | ||||
} | } | ||||
#endif //SORT_WORKS | |||||
} | } | ||||
template<typename T, typename ARRAY> | template<typename T, typename ARRAY> | ||||
@@ -383,7 +383,7 @@ public: | |||||
} | } | ||||
void Shuffle(); | void Shuffle(); | ||||
void Sort(int sort); | |||||
void Sort(int sort = 0); | |||||
void SortQuickSwap(ptrdiff_t start, ptrdiff_t stop); | void SortQuickSwap(ptrdiff_t start, ptrdiff_t stop); | ||||
/* TODO: remove these legacy functions one day */ | /* TODO: remove these legacy functions one day */ | ||||
@@ -26,6 +26,7 @@ | |||||
namespace lol | namespace lol | ||||
{ | { | ||||
//AxisBase -------------------------------------------------------------------- | |||||
struct AxisBase | struct AxisBase | ||||
{ | { | ||||
enum Type | enum Type | ||||
@@ -38,6 +39,20 @@ protected: | |||||
}; | }; | ||||
typedef SafeEnum<AxisBase> Axis; | typedef SafeEnum<AxisBase> Axis; | ||||
//DirectionBase --------------------------------------------------------------- | |||||
struct DirectionBase | |||||
{ | |||||
enum Type | |||||
{ | |||||
Up = 0, Down, Left, Right, MAX, | |||||
}; | |||||
protected: | |||||
static inline char const *GetDescription() { return "Up,Down,Left,Right,MAX"; } | |||||
static inline char const **GetCustomString() { return nullptr; } | |||||
}; | |||||
typedef SafeEnum<DirectionBase> Direction; | |||||
//LOL_BOX_TYPEDEFS ------------------------------------------------------------ | |||||
#define LOL_BOX_TYPEDEFS(tname, suffix) \ | #define LOL_BOX_TYPEDEFS(tname, suffix) \ | ||||
template <typename T> struct tname; \ | template <typename T> struct tname; \ | ||||
typedef tname<float> suffix; \ | typedef tname<float> suffix; \ | ||||
@@ -18,13 +18,33 @@ | |||||
#include <lol/gpu/vertexbuffer.h> | #include <lol/gpu/vertexbuffer.h> | ||||
#include <lol/gpu/indexbuffer.h> | #include <lol/gpu/indexbuffer.h> | ||||
//Assimp supports http://assimp.sourceforge.net/main_features_formats.html | |||||
#if USE_ASSIMP | |||||
//Cause build has a problem with function choice. | |||||
#if _WIN32 || _WIN64 | |||||
#define sin lol::sin | |||||
#define asin lol::asin | |||||
#define cos lol::cos | |||||
#define acos lol::acos | |||||
#endif //_WIN32 || _WIN64 | |||||
#include <assimp/Importer.hpp> // C++ importer interface | |||||
#include <assimp/scene.h> // Output data structure | |||||
#include <assimp/postprocess.h> // Post processing flags | |||||
#if _WIN32 || _WIN64 | |||||
#undef sin | |||||
#undef asin | |||||
#undef cos | |||||
#undef acos | |||||
#endif //_WIN32 || _WIN64 | |||||
#endif //USE_ASSIMP | |||||
namespace lol | namespace lol | ||||
{ | { | ||||
/* | /* | ||||
* A mesh contains a list of submeshes. This is a convenient way to | * A mesh contains a list of submeshes. This is a convenient way to | ||||
* handle different materials or mesh types (static, skeletal, morph | |||||
* targets, etc.) within the same container object. | |||||
* handle different materials or mesh types (static, skeletal, morph targets, etc.) | |||||
* within the same container object. | |||||
*/ | */ | ||||
class Mesh | class Mesh | ||||