zadeh79:
These images require acount at myspace to view. Can you do something about it?
Zengar:
Why don’t you dig some of your own old code? My archive would be full of “how not do do it” examples if I had old files in it.
In the meantime you can have a look at my current coding practices. Perhaps you will have a suggestion or two for me? This is part of my framework, but I think I’ll just release these vector classes separately:
template <typename T1> class vec2t;
template <typename T1> class Swizzle2
{
protected: T1 _X, _Y;
};
#define VEC2TEMPL_OPERATORS_DECL1 \
vec2t<T1> operator=(const vec2t<T1>& src); \
vec2t<T1> operator+=(const vec2t<T1>& src); \
(...)
#define VEC2TEMPL_SWIZZLE_DECL1(a,b) \
template <typename T1> class Swizzle2 ## a ## b : public Swizzle2<T1> \
{ \
public: \
VEC2TEMPL_OPERATORS_DECL1 \
operator vec2t<T1>(void); \
};
#define VEC2TEMPL_SWIZZLE_DECL2(a) VEC2TEMPL_SWIZZLE_DECL1(a,X) VEC2TEMPL_SWIZZLE_DECL1(a,Y)
#define VEC2TEMPL_SWIZZLE_DECL VEC2TEMPL_SWIZZLE_DECL2(X) VEC2TEMPL_SWIZZLE_DECL2(Y)
VEC2TEMPL_SWIZZLE_DECL
#define VEC2TEMPL_SWIZZLE1(v1,v2,v3,v4,v5,v6,v7,v8) \
Swizzle2 ## v1 ## v5 <T1> v2 ## v6; \
Swizzle2 ## v1 ## v5 <T1> v3 ## v7; \
Swizzle2 ## v1 ## v5 <T1> v4 ## v8;
#define VEC2TEMPL_SWIZZLE2(v1,v2,v3,v4) VEC2TEMPL_SWIZZLE1(v1,v2,v3,v4,X,x,r,s) VEC2TEMPL_SWIZZLE1(v1,v2,v3,v4,Y,y,g,t)
#define VEC2TEMPL_SWIZZLE VEC2TEMPL_SWIZZLE2(X,x,r,s) VEC2TEMPL_SWIZZLE2(Y,y,g,t)
template <typename T1> class vec2t
{
public:
union
{
struct
{
T1 x, y;
};
struct
{
T1 r, g;
};
struct
{
T1 s, t;
};
VEC2TEMPL_SWIZZLE
};
(...)
That’s fragment of my vec2.h file. Guess (or work it out if you prefer) what it does…
I’m still working on it - implementation is in asm, since I want to replace all unnecessary stuff that compiler would put in my code with my own unnecessary stuff