コード例 #1
0
ファイル: normal2.cpp プロジェクト: yjfcool/gbmath
normal2& normal2::direction_between( const point2& src , const point2& dst )
{
    //vec2 vsrc(src._x , src._y);
    //vec2 vdst(dst._x , dst._y);
    _x = dst.x() - src.x();
    _y = dst.y() - src.y();
    return __normalize();
}
コード例 #2
0
 void OpenGLES1RenderManager::gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx,
                GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy,GLfloat upz)
 {
     GLfloat forward[3], side[3], up[3];
     GLfloat m[4][4];
     
     forward[0] = centerx - eyex;
     forward[1] = centery - eyey;
     forward[2] = centerz - eyez;
     
     up[0] = upx;
     up[1] = upy;
     up[2] = upz;
     
     __normalize(forward);
     
     /* Side = forward x up */
     __cross(forward, up, side);
     __normalize(side);
     
     /* Recompute up as: up = side x forward */
     __cross(side, forward, up);
     
     __gluMakeIdentityf(&m[0][0]);
     m[0][0] = side[0];
     m[1][0] = side[1];
     m[2][0] = side[2];
     
     m[0][1] = up[0];
     m[1][1] = up[1];
     m[2][1] = up[2];
     
     m[0][2] = -forward[0];
     m[1][2] = -forward[1];
     m[2][2] = -forward[2];
     
     glMultMatrixf(&m[0][0]);
     glTranslatef(-eyex, -eyey, -eyez);
 }
コード例 #3
0
ファイル: normal2.cpp プロジェクト: yjfcool/gbmath
normal2& normal2::operator = (const vec2& a)
{
    _x = a.x;
    _y = a.y;
    return __normalize();
}