Version 3 (modified by sam, 7 years ago) (diff)

more tasks

Small tasks for beginners

There are some tasks that do not require enormous amounts of work or engine knowledge. We try to summarise them here.

Legacy methods in array.h and string.h

Difficulty: 0/5

Following some renaming/refactoring that occurred in trunk/src/lol/base/array.h and trunk/src/lol/base/string.h, some methods only remain here for backwards compatibility. Look for the string “TODO” in these files:

    /* TODO: remove these legacy functions one day */
    inline void Push(T... args) { push(args...); }
    inline void Insert(ptrdiff_t pos, T... args) { insert(pos, args...); }

Each of these methods needs to be removed and all resulting compilation errors fixed. Do not perform a blind search/replace, and pay attention to indentation.

Variadic versions of min() and max()

Difficulty: 2/5

The prototypes for min() and max() in trunk/src/lol/base/functions.h are defined as follows:

    static inline T min(T x, T y) { return std::min(x, y); }
    static inline T max(T x, T y) { return std::max(x, y); }

We would like a variadic version that takes an arbitrary number of arguments instead. Maybe something like this:

    template<typename T, typename... Ts>
    static inline T min(T x, T y, Ts&&... z) { ... }

This will allow us to write the following:

float foo = min(x, y, z, w);

Be careful that the code should build with Visual Studio 2013, which is actually the real difficulty here.

rand() for vector types

Difficulty: 2/5

We would like to write the following code:

vec4 p1 = rand<vec4>();
vec3 p2 = rand(vec3(-1.f), vec3(1.f));

This involves specialising the following templates from trunk/src/lol/math/rand.h:

template<typename T> static inline T rand();
template<typename T> static inline T rand(T a);
template<typename T> static inline T rand(T a, T b);

Make sure it works for all vec_t<N,T> types, not just vec3 or vec4.