Ignore:
Timestamp:
Sep 12, 2011, 10:17:23 PM (8 years ago)
Author:
Sam Hocevar
Message:

core: rename vec2i to ivec2 and update matrix.h from Lol Engine.

Location:
abuse/trunk/src/lol
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/lol/matrix.cpp

    r555 r682  
    8383}
    8484
     85#if !defined __ANDROID__
     86template<> std::ostream &operator<<(std::ostream &stream, ivec2 const &v)
     87{
     88    return stream << "(" << v.x << ", " << v.y << ")";
     89}
     90
     91template<> std::ostream &operator<<(std::ostream &stream, ivec3 const &v)
     92{
     93    return stream << "(" << v.x << ", " << v.y << ", " << v.z << ")";
     94}
     95
     96template<> std::ostream &operator<<(std::ostream &stream, ivec4 const &v)
     97{
     98    return stream << "(" << v.x << ", " << v.y << ", "
     99                         << v.z << ", " << v.w << ")";
     100}
     101
     102template<> std::ostream &operator<<(std::ostream &stream, vec2 const &v)
     103{
     104    return stream << "(" << v.x << ", " << v.y << ")";
     105}
     106
     107template<> std::ostream &operator<<(std::ostream &stream, vec3 const &v)
     108{
     109    return stream << "(" << v.x << ", " << v.y << ", " << v.z << ")";
     110}
     111
     112template<> std::ostream &operator<<(std::ostream &stream, vec4 const &v)
     113{
     114    return stream << "(" << v.x << ", " << v.y << ", "
     115                         << v.z << ", " << v.w << ")";
     116}
     117
     118template<> std::ostream &operator<<(std::ostream &stream, mat4 const &m)
     119{
     120    stream << "((" << m[0][0] << ", " << m[1][0]
     121            << ", " << m[2][0] << ", " << m[3][0] << "), ";
     122    stream << "(" << m[0][1] << ", " << m[1][1]
     123           << ", " << m[2][1] << ", " << m[3][1] << "), ";
     124    stream << "(" << m[0][2] << ", " << m[1][2]
     125           << ", " << m[2][2] << ", " << m[3][2] << "), ";
     126    stream << "(" << m[0][3] << ", " << m[1][3]
     127           << ", " << m[2][3] << ", " << m[3][3] << "))";
     128    return stream;
     129}
     130#endif
     131
    85132template<> mat4 mat4::ortho(float left, float right, float bottom,
    86133                            float top, float near, float far)
  • abuse/trunk/src/lol/matrix.h

    r660 r682  
    1818
    1919#include <cmath>
     20#if !defined __ANDROID__
     21#   include <iostream>
     22#endif
    2023
    2124namespace lol
     
    6770        for (int n = 0; n < elems && n < dest; n++) \
    6871            ret[n] = (*this)[n]; \
     72        for (int n = elems; n < dest; n++) \
     73            ret[n] = 0; \
    6974        return ret; \
    7075    }
     
    138143    OPERATORS(2)
    139144
     145#if !defined __ANDROID__
     146    template<typename U>
     147    friend std::ostream &operator<<(std::ostream &stream, Vec2<U> const &v);
     148#endif
     149
    140150    union { T x; T a; T i; };
    141151    union { T y; T b; T j; };
     
    143153
    144154typedef Vec2<float> vec2;
    145 typedef Vec2<int> vec2i;
     155typedef Vec2<int> ivec2;
    146156
    147157template <typename T> struct Vec3
     
    152162
    153163    OPERATORS(3)
     164
     165#if !defined __ANDROID__
     166    template<typename U>
     167    friend std::ostream &operator<<(std::ostream &stream, Vec3<U> const &v);
     168#endif
    154169
    155170    union { T x; T a; T i; };
     
    159174
    160175typedef Vec3<float> vec3;
    161 typedef Vec3<int> vec3i;
     176typedef Vec3<int> ivec3;
    162177
    163178template <typename T> struct Vec4
     
    168183
    169184    OPERATORS(4)
     185
     186#if !defined __ANDROID__
     187    template<typename U>
     188    friend std::ostream &operator<<(std::ostream &stream, Vec4<U> const &v);
     189#endif
    170190
    171191    union { T x; T a; T i; };
     
    176196
    177197typedef Vec4<float> vec4;
    178 typedef Vec4<int> vec4i;
     198typedef Vec4<int> ivec4;
    179199
    180200#define SCALAR_GLOBAL(elems, op, U) \
     
    230250
    231251    void printf() const;
     252
     253#if !defined __ANDROID__
     254    template<class U>
     255    friend std::ostream &operator<<(std::ostream &stream, Mat4<U> const &m);
     256#endif
    232257
    233258    inline Mat4<T> operator +(Mat4<T> const val) const
     
    295320
    296321typedef Mat4<float> mat4;
    297 typedef Mat4<int> mat4i;
     322typedef Mat4<int> imat4;
    298323
    299324} /* namespace lol */
Note: See TracChangeset for help on using the changeset viewer.