Ignore:
Timestamp:
Oct 31, 2011, 9:19:09 AM (9 years ago)
Author:
sam
Message:

core: new combinations of integer vectors (unsigned, 8-bit, etc.), dot and
cross product, normalize, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/matrix.h

    r1035 r1041  
    114114        using namespace std; \
    115115        return sqrtf((float)sqlen()); \
    116     }
     116    } \
     117    \
     118    template<typename U> \
     119    friend U dot(Vec##elems<U>, Vec##elems<U>); \
     120    template<typename U> \
     121    friend Vec##elems<U> normalize(Vec##elems<U>); \
     122    \
     123    void printf() const;
    117124
    118125#define SWIZZLE2(e1, e2) \
     
    206213};
    207214
     215typedef Vec2<half> f16vec2;
    208216typedef Vec2<float> vec2;
    209 typedef Vec2<int> ivec2;
     217typedef Vec2<int8_t> i8vec2;
     218typedef Vec2<uint8_t> u8vec2;
     219typedef Vec2<int16_t> i16vec2;
     220typedef Vec2<uint16_t> u16vec2;
     221typedef Vec2<int32_t> ivec2;
     222typedef Vec2<uint32_t> uvec2;
     223typedef Vec2<int64_t> i64vec2;
     224typedef Vec2<uint64_t> u64vec2;
    210225
    211226/*
     
    227242    SWIZZLE4333(x); SWIZZLE4333(y); SWIZZLE4333(z);
    228243
     244    template<typename U>
     245    friend Vec3<U> cross(Vec3<U>, Vec3<U>);
     246
    229247#if !defined __ANDROID__
    230248    template<typename U>
     
    237255};
    238256
     257typedef Vec3<half> f16vec3;
    239258typedef Vec3<float> vec3;
    240 typedef Vec3<int> ivec3;
     259typedef Vec3<int8_t> i8vec3;
     260typedef Vec3<uint8_t> u8vec3;
     261typedef Vec3<int16_t> i16vec3;
     262typedef Vec3<uint16_t> u16vec3;
     263typedef Vec3<int32_t> ivec3;
     264typedef Vec3<uint32_t> uvec3;
     265typedef Vec3<int64_t> i64vec3;
     266typedef Vec3<uint64_t> u64vec3;
    241267
    242268/*
     
    273299};
    274300
     301typedef Vec4<half> f16vec4;
    275302typedef Vec4<float> vec4;
    276 typedef Vec4<int> ivec4;
     303typedef Vec4<int8_t> i8vec4;
     304typedef Vec4<uint8_t> u8vec4;
     305typedef Vec4<int16_t> i16vec4;
     306typedef Vec4<uint16_t> u16vec4;
     307typedef Vec4<int32_t> ivec4;
     308typedef Vec4<uint32_t> uvec4;
     309typedef Vec4<int64_t> i64vec4;
     310typedef Vec4<uint64_t> u64vec4;
    277311
    278312#define SCALAR_GLOBAL(elems, op, U) \
     
    327361    static Mat4<T> ortho(T left, T right, T bottom, T top, T near, T far);
    328362    static Mat4<T> frustum(T left, T right, T bottom, T top, T near, T far);
     363    static Mat4<T> lookat(Vec3<T> eye, Vec3<T> center, Vec3<T> up);
    329364    static Mat4<T> perspective(T theta, T width, T height, T near, T far);
    330365    static Mat4<T> translate(T x, T y, T z);
     366    static Mat4<T> translate(Vec3<T> v);
    331367    static Mat4<T> rotate(T theta, T x, T y, T z);
     368    static Mat4<T> rotate(T theta, Vec3<T> v);
    332369
    333370    void printf() const;
     
    401438};
    402439
     440typedef Mat4<half> f16mat4;
    403441typedef Mat4<float> mat4;
    404 typedef Mat4<int> imat4;
     442typedef Mat4<int8_t> i8mat4;
     443typedef Mat4<uint8_t> u8mat4;
     444typedef Mat4<int16_t> i16mat4;
     445typedef Mat4<uint16_t> u16mat4;
     446typedef Mat4<int32_t> imat4;
     447typedef Mat4<uint32_t> umat4;
     448typedef Mat4<int64_t> i64mat4;
     449typedef Mat4<uint64_t> u64mat4;
    405450
    406451} /* namespace lol */
Note: See TracChangeset for help on using the changeset viewer.