Browse Source

Added various stuff

undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 10 years ago
parent
commit
796232d22b
4 changed files with 42 additions and 3 deletions
  1. +4
    -0
      src/lol/algorithm/sort.h
  2. +1
    -1
      src/lol/base/array.h
  3. +15
    -0
      src/lol/math/geometry.h
  4. +22
    -2
      src/mesh/mesh.h

+ 4
- 0
src/lol/algorithm/sort.h View File

@@ -33,10 +33,12 @@ void array_base<T, ARRAY>::Shuffle()
template<typename T, typename ARRAY>
void array_base<T, ARRAY>::Sort(int sort)
{
#if SORT_WORKS // yeah cause it's shite.
int s = 0;
// Classic bubble
if (s++ == sort)
{
#endif //SORT_WORKS
int d = 1;
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;
}
}
#if SORT_WORKS
}
// Quick sort with swap
else if (s++ == sort)
{
SortQuickSwap(0, Count());
}
#endif //SORT_WORKS
}

template<typename T, typename ARRAY>


+ 1
- 1
src/lol/base/array.h View File

@@ -383,7 +383,7 @@ public:
}

void Shuffle();
void Sort(int sort);
void Sort(int sort = 0);
void SortQuickSwap(ptrdiff_t start, ptrdiff_t stop);

/* TODO: remove these legacy functions one day */


+ 15
- 0
src/lol/math/geometry.h View File

@@ -26,6 +26,7 @@
namespace lol
{

//AxisBase --------------------------------------------------------------------
struct AxisBase
{
enum Type
@@ -38,6 +39,20 @@ protected:
};
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) \
template <typename T> struct tname; \
typedef tname<float> suffix; \


+ 22
- 2
src/mesh/mesh.h View File

@@ -18,13 +18,33 @@
#include <lol/gpu/vertexbuffer.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
{

/*
* 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


Loading…
Cancel
Save