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 y;
|
||||||
float z;
|
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
|
}; // namespace fishbone
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ float r = 0;
|
||||||
bool fishbone::Client::step() {
|
bool fishbone::Client::step() {
|
||||||
this->renderer->prepare();
|
this->renderer->prepare();
|
||||||
|
|
||||||
m->draw((struct fishbone::Vector3){0, 0, 0}, (struct fishbone::Vector3){0, r, 0});
|
m->draw((struct fishbone::Vector3){0, 0, 0}, (struct fishbone::Vector3){r, r, r});
|
||||||
r++;
|
r += 30.0 / 60;
|
||||||
|
|
||||||
this->window->swapBuffer();
|
this->window->swapBuffer();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,3 +54,11 @@ struct fishbone::Vector3 fishbone::Vector3::normalize() {
|
||||||
|
|
||||||
return {this->x * l, this->y * l, this->z * l};
|
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