Ignore:
Timestamp:
Feb 18, 2011, 1:09:28 AM (10 years ago)
Author:
sam
Message:

Get rid of float3, float4, int3 etc. in favour of GLSL types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/matrix.cpp

    r661 r664  
    2828}
    2929
    30 static inline float cofact3(float4x4 const &mat, int i, int j)
     30static inline float cofact3(mat4 const &mat, int i, int j)
    3131{
    3232    return det3(mat[(i + 1) & 3][(j + 1) & 3],
     
    4141}
    4242
    43 template<> float float4x4::det() const
     43template<> float mat4::det() const
    4444{
    4545    float ret = 0;
     
    4949}
    5050
    51 template<> float4x4 float4x4::invert() const
     51template<> mat4 mat4::invert() const
    5252{
    53     float4x4 ret;
     53    mat4 ret;
    5454    float d = det();
    5555    if (d)
     
    6363}
    6464
    65 template<> float4x4 float4x4::ortho(float left, float right, float bottom,
    66                                     float top, float near, float far)
     65template<> mat4 mat4::ortho(float left, float right, float bottom,
     66                            float top, float near, float far)
    6767{
    6868    float invrl = (right != left) ? 1.0f / (right - left) : 0.0f;
     
    7070    float invfn = (far != near) ? 1.0f / (far - near) : 0.0f;
    7171
    72     float4x4 ret(0.0f);
     72    mat4 ret(0.0f);
    7373    ret[0][0] = 2.0f * invrl;
    7474    ret[1][1] = 2.0f * invtb;
     
    8181}
    8282
    83 template<> float4x4 float4x4::frustum(float left, float right, float bottom,
    84                                       float top, float near, float far)
     83template<> mat4 mat4::frustum(float left, float right, float bottom,
     84                              float top, float near, float far)
    8585{
    8686    float invrl = (right != left) ? 1.0f / (right - left) : 0.0f;
     
    8888    float invfn = (far != near) ? 1.0f / (far - near) : 0.0f;
    8989
    90     float4x4 ret(0.0f);
     90    mat4 ret(0.0f);
    9191    ret[0][0] = 2.0f * near * invrl;
    9292    ret[1][1] = 2.0f * near * invtb;
     
    9999}
    100100
    101 template<> float4x4 float4x4::perspective(float theta, float width,
    102                                           float height, float near, float far)
     101template<> mat4 mat4::perspective(float theta, float width,
     102                                  float height, float near, float far)
    103103{
    104104    float t1 = tanf(theta / 2.0f);
     
    108108}
    109109
    110 template<> float4x4 float4x4::translate(float x, float y, float z)
     110template<> mat4 mat4::translate(float x, float y, float z)
    111111{
    112     float4x4 ret(1.0f);
     112    mat4 ret(1.0f);
    113113    ret[3][0] = x;
    114114    ret[3][1] = y;
     
    117117}
    118118
    119 template<> float4x4 float4x4::rotate(float theta, float x, float y, float z)
     119template<> mat4 mat4::rotate(float theta, float x, float y, float z)
    120120{
    121121    float st = sinf(theta);
     
    132132    float mtz = (1.0f - ct) * z;
    133133
    134     float4x4 ret(1.0f);
     134    mat4 ret(1.0f);
    135135
    136136    ret[0][0] = x * mtx + ct;
Note: See TracChangeset for help on using the changeset viewer.