mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:24:03 +02:00
Revert "Add common vector constants to JS"
This commit is contained in:
parent
1e2374da87
commit
08e4fe2dc2
5 changed files with 23 additions and 129 deletions
|
@ -18,26 +18,6 @@
|
|||
#include "ScriptEngineLogging.h"
|
||||
#include "Quat.h"
|
||||
|
||||
quat Quat::normalize(const glm::quat& q) {
|
||||
return glm::normalize(q);
|
||||
}
|
||||
|
||||
glm::quat Quat::rotationBetween(const glm::vec3& v1, const glm::vec3& v2) {
|
||||
return ::rotationBetween(v1, v2);
|
||||
}
|
||||
|
||||
glm::quat Quat::lookAt(const glm::vec3& eye, const glm::vec3& center, const glm::vec3& up) {
|
||||
return glm::quat_cast(glm::lookAt(eye, center, up));
|
||||
}
|
||||
|
||||
glm::quat Quat::lookAtSimple(const glm::vec3& eye, const glm::vec3& center) {
|
||||
auto dir = glm::normalize(center - eye);
|
||||
// if the direction is nearly aligned with the Y axis, then use the X axis for 'up'
|
||||
if (dir.x < 0.001f && dir.z < 0.001f) {
|
||||
return lookAt(eye, center, Vectors::UNIT_X);
|
||||
}
|
||||
return lookAt(eye, center, Vectors::UNIT_Y);
|
||||
}
|
||||
|
||||
glm::quat Quat::multiply(const glm::quat& q1, const glm::quat& q2) {
|
||||
return q1 * q2;
|
||||
|
|
|
@ -25,10 +25,6 @@ class Quat : public QObject {
|
|||
|
||||
public slots:
|
||||
glm::quat multiply(const glm::quat& q1, const glm::quat& q2);
|
||||
glm::quat normalize(const glm::quat& q);
|
||||
glm::quat lookAt(const glm::vec3& eye, const glm::vec3& center, const glm::vec3& up);
|
||||
glm::quat lookAtSimple(const glm::vec3& eye, const glm::vec3& center);
|
||||
glm::quat rotationBetween(const glm::vec3& v1, const glm::vec3& v2);
|
||||
glm::quat fromVec3Degrees(const glm::vec3& vec3); // degrees
|
||||
glm::quat fromVec3Radians(const glm::vec3& vec3); // radians
|
||||
glm::quat fromPitchYawRollDegrees(float pitch, float yaw, float roll); // degrees
|
||||
|
|
|
@ -123,70 +123,3 @@ glm::vec3 Vec3::fromPolar(float elevation, float azimuth) {
|
|||
return fromPolar(v);
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_X() {
|
||||
return Vectors::UNIT_X;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_Y() {
|
||||
return Vectors::UNIT_Y;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_Z() {
|
||||
return Vectors::UNIT_Z;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_NEG_X() {
|
||||
return Vectors::UNIT_NEG_X;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_NEG_Y() {
|
||||
return Vectors::UNIT_NEG_Y;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_NEG_Z() {
|
||||
return Vectors::UNIT_NEG_Z;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_XY() {
|
||||
return Vectors::UNIT_XY;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_XZ() {
|
||||
return Vectors::UNIT_XZ;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_YZ() {
|
||||
return Vectors::UNIT_YZ;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UNIT_XYZ() {
|
||||
return Vectors::UNIT_XYZ;
|
||||
}
|
||||
|
||||
const vec3& Vec3::FLOAT_MAX() {
|
||||
return Vectors::MAX;
|
||||
}
|
||||
|
||||
const vec3& Vec3::FLOAT_MIN() {
|
||||
return Vectors::MIN;
|
||||
}
|
||||
|
||||
const vec3& Vec3::ZERO() {
|
||||
return Vectors::ZERO;
|
||||
}
|
||||
|
||||
const vec3& Vec3::ONE() {
|
||||
return Vectors::ONE;
|
||||
}
|
||||
|
||||
const vec3& Vec3::RIGHT() {
|
||||
return Vectors::RIGHT;
|
||||
}
|
||||
|
||||
const vec3& Vec3::UP() {
|
||||
return Vectors::UNIT_X;
|
||||
}
|
||||
|
||||
const vec3& Vec3::FRONT() {
|
||||
return Vectors::FRONT;
|
||||
}
|
||||
|
|
|
@ -13,52 +13,36 @@
|
|||
|
||||
#ifndef hifi_Vec3_h
|
||||
#define hifi_Vec3_h
|
||||
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#include "GLMHelpers.h"
|
||||
|
||||
/// Scriptable interface a Vec3ernion helper class object. Used exclusively in the JavaScript API
|
||||
class Vec3 : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
vec3 reflect(const vec3& v1, const vec3& v2);
|
||||
vec3 cross(const vec3& v1, const vec3& v2);
|
||||
float dot(const vec3& v1, const vec3& v2);
|
||||
vec3 multiply(const vec3& v1, float f);
|
||||
vec3 multiply(float, const vec3& v1);
|
||||
vec3 multiplyQbyV(const glm::quat& q, const vec3& v);
|
||||
vec3 sum(const vec3& v1, const vec3& v2);
|
||||
vec3 subtract(const vec3& v1, const vec3& v2);
|
||||
float length(const vec3& v);
|
||||
float distance(const vec3& v1, const vec3& v2);
|
||||
float orientedAngle(const vec3& v1, const vec3& v2, const vec3& v3);
|
||||
vec3 normalize(const vec3& v);
|
||||
vec3 mix(const vec3& v1, const vec3& v2, float m);
|
||||
void print(const QString& lable, const vec3& v);
|
||||
bool equal(const vec3& v1, const vec3& v2);
|
||||
vec3 toPolar(const vec3& v);
|
||||
vec3 fromPolar(const vec3& polar);
|
||||
vec3 fromPolar(float elevation, float azimuth);
|
||||
const vec3& UNIT_X();
|
||||
const vec3& UNIT_Y();
|
||||
const vec3& UNIT_Z();
|
||||
const vec3& UNIT_NEG_X();
|
||||
const vec3& UNIT_NEG_Y();
|
||||
const vec3& UNIT_NEG_Z();
|
||||
const vec3& UNIT_XY();
|
||||
const vec3& UNIT_XZ();
|
||||
const vec3& UNIT_YZ();
|
||||
const vec3& UNIT_XYZ();
|
||||
const vec3& FLOAT_MAX();
|
||||
const vec3& FLOAT_MIN();
|
||||
const vec3& ZERO();
|
||||
const vec3& ONE();
|
||||
const vec3& RIGHT();
|
||||
const vec3& UP();
|
||||
const vec3& FRONT();
|
||||
glm::vec3 reflect(const glm::vec3& v1, const glm::vec3& v2);
|
||||
glm::vec3 cross(const glm::vec3& v1, const glm::vec3& v2);
|
||||
float dot(const glm::vec3& v1, const glm::vec3& v2);
|
||||
glm::vec3 multiply(const glm::vec3& v1, float f);
|
||||
glm::vec3 multiply(float, const glm::vec3& v1);
|
||||
glm::vec3 multiplyQbyV(const glm::quat& q, const glm::vec3& v);
|
||||
glm::vec3 sum(const glm::vec3& v1, const glm::vec3& v2);
|
||||
glm::vec3 subtract(const glm::vec3& v1, const glm::vec3& v2);
|
||||
float length(const glm::vec3& v);
|
||||
float distance(const glm::vec3& v1, const glm::vec3& v2);
|
||||
float orientedAngle(const glm::vec3& v1, const glm::vec3& v2, const glm::vec3& v3);
|
||||
glm::vec3 normalize(const glm::vec3& v);
|
||||
glm::vec3 mix(const glm::vec3& v1, const glm::vec3& v2, float m);
|
||||
void print(const QString& lable, const glm::vec3& v);
|
||||
bool equal(const glm::vec3& v1, const glm::vec3& v2);
|
||||
glm::vec3 toPolar(const glm::vec3& v);
|
||||
glm::vec3 fromPolar(const glm::vec3& polar);
|
||||
glm::vec3 fromPolar(float elevation, float azimuth);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ public:
|
|||
static const vec3 UNIT_XY;
|
||||
static const vec3 UNIT_XZ;
|
||||
static const vec3 UNIT_YZ;
|
||||
static const vec3 UNIT_ZX;
|
||||
static const vec3 UNIT_XYZ;
|
||||
static const vec3 MAX;
|
||||
static const vec3 MIN;
|
||||
|
|
Loading…
Reference in a new issue