[haiku-development] Re: GLTeapot, world space rotation
- From: Alexandre Deckner <alex@xxxxxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Tue, 26 Feb 2008 17:02:11 +0100
Euan Kirkhope wrote :
If it's just the relevant source files cherry piced and compiled in to
the exe, I'm all for it. :)
I'd prefer not to have a whole physics lib added to the source just
for a teapot and a couple of potential future games. R5 is renowned
for being compact and minimalist in terms of libs etc. I think it
would be overkill. Nice tea pot though.
Ok! To clear things up, a quaternion is a math object that represents a
3d rotation with 4 floats,
here is what i need for glteapot, i was just lazy and took an existing
implementation :-D
Quaternion(const Vector3& axis, const float& angle)
{
setRotation(axis, angle);
}
void Quaternion::setRotation(const Vector3& axis, const float& angle)
{
float d = axis.length();
assert(d != float(0.0));
float s = sin(angle * float(0.5)) / d;
setValue(axis.x() * s, axis.y() * s, axis.z() * s,
cos(angle * float(0.5)));
}
Quaternion& operator*=(const Quaternion& q)
{
setValue(m_w * q.x() + m_x * q.m__w + m_y * q.z() - m_z * q.y(),
m_w * q.y() + m_y * q.m_w + m_z * q.x() - m_x * q.z(),
m_w * q.z() + m_z * q.m_w + m_x * q.y() - m_y * q.x(),
m_w * q.m_w - m_x * q.x() - m_y * q.y() - m_z * q.z());
return *this;
}
//This one is not from bullet, found it on the web
void Quaternion::toOpenGLMatrix(float m[4][4]){
float wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2;
// calculate coefficients
x2 = m_x + m_x; y2 = m_y + m_y;
z2 = m_z + m_z;
xx = m_x * x2; xy = m_x * y2; xz = m_x * z2;
yy = m_y * y2; yz = m_y * z2; zz = m_z * z2;
wx = m_w * x2; wy = m_w * y2; wz = m_w * z2;
m[0][0] = 1.0 - (yy + zz); m[1][0] = xy - wz;
m[2][0] = xz + wy; m[3][0] = 0.0;
m[0][1] = xy + wz; m[1][1] = 1.0 - (xx + zz);
m[2][1] = yz - wx; m[3][1] = 0.0;
m[0][2] = xz - wy; m[1][2] = yz + wx;
m[2][2] = 1.0 - (xx + yy); m[3][2] = 0.0;
m[0][3] = 0; m[1][3] = 0;
m[2][3] = 0; m[3][3] = 1;
}
That's all the big deal :)
I don't really think a physics engine is appropriate for an operating
system. I personally wouldn't even want one part of the standard
build if it was included.
It could have its use in a 3d interface, or a 3rd party app, just the
problem of picking an object with a mouse needs 3d ray-object collision.
I can imagine other non-game uses too. But like you, i'm not sure if it
has to be included in an os or not, it's debatable i think!
It's certainly a really nice download for people to pull from bebits /
haikuware though, or be packaged in a distro.
Sure it was just a thought, we don't want to Be-ify everything, or bloat
the sources :-)
Having a nice modern bumpy demo to attract the eye on booths with the
Haiku brand could be worth it though! Like you said, Haiku is compact
and minimalist, but it has to be fun and exciting too :-)
The application source folder would contain a copy of the lib's sources,
just like we do when needed (ex: translators, codecs, new layout), and
keep in mind that bullet source size is really reasonable (200 files,
1MB), the size argument isn't really fair imho.
Regards,
Alex
- Follow-Ups:
- [haiku-development] Re: GLTeapot, world space rotation
- From: François Revol
- [haiku-development] Re: GLTeapot, world space rotation
- From: Euan Kirkhope
- References:
- [haiku-development] GLTeapot, world space rotation
- From: Alexandre Deckner
- [haiku-development] Re: GLTeapot, world space rotation
- From: Stephan Assmus
- [haiku-development] Re: GLTeapot, world space rotation
- From: Alexandre Deckner
- [haiku-development] Re: GLTeapot, world space rotation
- From: Euan Kirkhope
Other related posts:
- » [haiku-development] GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
- » [haiku-development] Re: GLTeapot, world space rotation
If it's just the relevant source files cherry piced and compiled in to the exe, I'm all for it. :) I'd prefer not to have a whole physics lib added to the source just for a teapot and a couple of potential future games. R5 is renowned for being compact and minimalist in terms of libs etc. I think it would be overkill. Nice tea pot though.
I don't really think a physics engine is appropriate for an operating system. I personally wouldn't even want one part of the standard build if it was included.
It's certainly a really nice download for people to pull from bebits / haikuware though, or be packaged in a distro.
- [haiku-development] Re: GLTeapot, world space rotation
- From: François Revol
- [haiku-development] Re: GLTeapot, world space rotation
- From: Euan Kirkhope
- [haiku-development] GLTeapot, world space rotation
- From: Alexandre Deckner
- [haiku-development] Re: GLTeapot, world space rotation
- From: Stephan Assmus
- [haiku-development] Re: GLTeapot, world space rotation
- From: Alexandre Deckner
- [haiku-development] Re: GLTeapot, world space rotation
- From: Euan Kirkhope