add quaternion
This commit is contained in:
parent
c6ce943f61
commit
748d52c9c9
3 changed files with 20 additions and 2 deletions
|
|
@ -27,6 +27,16 @@ namespace fishbone {
|
|||
float y;
|
||||
float z;
|
||||
};
|
||||
|
||||
struct Quaternion {
|
||||
struct fishbone::Quaternion operator+(struct fishbone::Quaternion q) const;
|
||||
struct fishbone::Quaternion operator-(struct fishbone::Quaternion q) const;
|
||||
|
||||
float w;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ float r = 0;
|
|||
bool fishbone::Client::step() {
|
||||
this->renderer->prepare();
|
||||
|
||||
m->draw((struct fishbone::Vector3){0, 0, 0}, (struct fishbone::Vector3){0, r, 0});
|
||||
r++;
|
||||
m->draw((struct fishbone::Vector3){0, 0, 0}, (struct fishbone::Vector3){r, r, r});
|
||||
r += 30.0 / 60;
|
||||
|
||||
this->window->swapBuffer();
|
||||
|
||||
|
|
|
|||
|
|
@ -54,3 +54,11 @@ struct fishbone::Vector3 fishbone::Vector3::normalize() {
|
|||
|
||||
return {this->x * l, this->y * l, this->z * l};
|
||||
}
|
||||
|
||||
struct fishbone::Quaternion fishbone::Quaternion::operator+(struct fishbone::Quaternion q) const {
|
||||
return {this->w + q.w, this->x + q.x, this->y + q.y, this->z + q.z};
|
||||
}
|
||||
|
||||
struct fishbone::Quaternion fishbone::Quaternion::operator-(struct fishbone::Quaternion q) const {
|
||||
return {this->w - q.w, this->x - q.x, this->y - q.y, this->z - q.z};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue