/s/KRQuaternion/Quaternion/
This commit is contained in:
@@ -200,7 +200,7 @@ void KRModel::render(KRCamera *pCamera, std::vector<KRPointLight *> &point_light
|
|||||||
if(m_faces_camera) {
|
if(m_faces_camera) {
|
||||||
Vector3 model_center = Matrix4::Dot(matModel, Vector3::Zero());
|
Vector3 model_center = Matrix4::Dot(matModel, Vector3::Zero());
|
||||||
Vector3 camera_pos = viewport.getCameraPosition();
|
Vector3 camera_pos = viewport.getCameraPosition();
|
||||||
matModel = KRQuaternion(Vector3::Forward(), Vector3::Normalize(camera_pos - model_center)).rotationMatrix() * matModel;
|
matModel = Quaternion(Vector3::Forward(), Vector3::Normalize(camera_pos - model_center)).rotationMatrix() * matModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
pModel->render(getName(), pCamera, point_lights, directional_lights, spot_lights, viewport, matModel, m_pLightMap, renderPass, m_bones[pModel], m_rim_color, m_rim_power, lod_coverage);
|
pModel->render(getName(), pCamera, point_lights, directional_lights, spot_lights, viewport, matModel, m_pLightMap, renderPass, m_bones[pModel], m_rim_color, m_rim_power, lod_coverage);
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ void KRNode::setWorldTranslation(const Vector3 &v)
|
|||||||
void KRNode::setWorldRotation(const Vector3 &v)
|
void KRNode::setWorldRotation(const Vector3 &v)
|
||||||
{
|
{
|
||||||
if(m_parentNode) {
|
if(m_parentNode) {
|
||||||
setLocalRotation((KRQuaternion(v) * -m_parentNode->getWorldRotation()).eulerXYZ());
|
setLocalRotation((Quaternion(v) * -m_parentNode->getWorldRotation()).eulerXYZ());
|
||||||
setPreRotation(Vector3::Zero());
|
setPreRotation(Vector3::Zero());
|
||||||
setPostRotation(Vector3::Zero());
|
setPostRotation(Vector3::Zero());
|
||||||
} else {
|
} else {
|
||||||
@@ -543,7 +543,7 @@ const Matrix4 &KRNode::getModelMatrix()
|
|||||||
* Matrix4::Translation(m_scalingPivot)
|
* Matrix4::Translation(m_scalingPivot)
|
||||||
* Matrix4::Translation(m_scalingOffset)
|
* Matrix4::Translation(m_scalingOffset)
|
||||||
* Matrix4::Translation(-m_rotationPivot)
|
* Matrix4::Translation(-m_rotationPivot)
|
||||||
//* (KRQuaternion(m_postRotation) * KRQuaternion(m_localRotation) * KRQuaternion(m_preRotation)).rotationMatrix()
|
//* (Quaternion(m_postRotation) * Quaternion(m_localRotation) * Quaternion(m_preRotation)).rotationMatrix()
|
||||||
* Matrix4::Rotation(m_postRotation)
|
* Matrix4::Rotation(m_postRotation)
|
||||||
* Matrix4::Rotation(m_localRotation)
|
* Matrix4::Rotation(m_localRotation)
|
||||||
* Matrix4::Rotation(m_preRotation)
|
* Matrix4::Rotation(m_preRotation)
|
||||||
@@ -565,7 +565,7 @@ const Matrix4 &KRNode::getModelMatrix()
|
|||||||
* Matrix4::Translation(m_scalingPivot)
|
* Matrix4::Translation(m_scalingPivot)
|
||||||
* Matrix4::Translation(m_scalingOffset)
|
* Matrix4::Translation(m_scalingOffset)
|
||||||
* Matrix4::Translation(-m_rotationPivot)
|
* Matrix4::Translation(-m_rotationPivot)
|
||||||
//* (KRQuaternion(m_postRotation) * KRQuaternion(m_localRotation) * KRQuaternion(m_preRotation)).rotationMatrix()
|
//* (Quaternion(m_postRotation) * Quaternion(m_localRotation) * Quaternion(m_preRotation)).rotationMatrix()
|
||||||
* Matrix4::Rotation(m_postRotation)
|
* Matrix4::Rotation(m_postRotation)
|
||||||
* Matrix4::Rotation(m_localRotation)
|
* Matrix4::Rotation(m_localRotation)
|
||||||
* Matrix4::Rotation(m_preRotation)
|
* Matrix4::Rotation(m_preRotation)
|
||||||
@@ -600,7 +600,7 @@ const Matrix4 &KRNode::getBindPoseMatrix()
|
|||||||
* Matrix4::Translation(m_initialScalingPivot)
|
* Matrix4::Translation(m_initialScalingPivot)
|
||||||
* Matrix4::Translation(m_initialScalingOffset)
|
* Matrix4::Translation(m_initialScalingOffset)
|
||||||
* Matrix4::Translation(-m_initialRotationPivot)
|
* Matrix4::Translation(-m_initialRotationPivot)
|
||||||
//* (KRQuaternion(m_initialPostRotation) * KRQuaternion(m_initialLocalRotation) * KRQuaternion(m_initialPreRotation)).rotationMatrix()
|
//* (Quaternion(m_initialPostRotation) * Quaternion(m_initialLocalRotation) * Quaternion(m_initialPreRotation)).rotationMatrix()
|
||||||
* Matrix4::Rotation(m_initialPostRotation)
|
* Matrix4::Rotation(m_initialPostRotation)
|
||||||
* Matrix4::Rotation(m_initialLocalRotation)
|
* Matrix4::Rotation(m_initialLocalRotation)
|
||||||
* Matrix4::Rotation(m_initialPreRotation)
|
* Matrix4::Rotation(m_initialPreRotation)
|
||||||
@@ -623,7 +623,7 @@ const Matrix4 &KRNode::getBindPoseMatrix()
|
|||||||
* Matrix4::Translation(m_initialScalingPivot)
|
* Matrix4::Translation(m_initialScalingPivot)
|
||||||
* Matrix4::Translation(m_initialScalingOffset)
|
* Matrix4::Translation(m_initialScalingOffset)
|
||||||
* Matrix4::Translation(-m_initialRotationPivot)
|
* Matrix4::Translation(-m_initialRotationPivot)
|
||||||
// * (KRQuaternion(m_initialPostRotation) * KRQuaternion(m_initialLocalRotation) * KRQuaternion(m_initialPreRotation)).rotationMatrix()
|
// * (Quaternion(m_initialPostRotation) * Quaternion(m_initialLocalRotation) * Quaternion(m_initialPreRotation)).rotationMatrix()
|
||||||
* Matrix4::Rotation(m_initialPostRotation)
|
* Matrix4::Rotation(m_initialPostRotation)
|
||||||
* Matrix4::Rotation(m_initialLocalRotation)
|
* Matrix4::Rotation(m_initialLocalRotation)
|
||||||
* Matrix4::Rotation(m_initialPreRotation)
|
* Matrix4::Rotation(m_initialPreRotation)
|
||||||
@@ -701,24 +701,24 @@ const Matrix4 &KRNode::getActivePoseMatrix()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const KRQuaternion KRNode::getWorldRotation() {
|
const Quaternion KRNode::getWorldRotation() {
|
||||||
KRQuaternion world_rotation = KRQuaternion(m_postRotation) * KRQuaternion(m_localRotation) * KRQuaternion(m_preRotation);
|
Quaternion world_rotation = Quaternion(m_postRotation) * Quaternion(m_localRotation) * Quaternion(m_preRotation);
|
||||||
if(m_parentNode) {
|
if(m_parentNode) {
|
||||||
world_rotation = world_rotation * m_parentNode->getWorldRotation();
|
world_rotation = world_rotation * m_parentNode->getWorldRotation();
|
||||||
}
|
}
|
||||||
return world_rotation;
|
return world_rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
const KRQuaternion KRNode::getBindPoseWorldRotation() {
|
const Quaternion KRNode::getBindPoseWorldRotation() {
|
||||||
KRQuaternion world_rotation = KRQuaternion(m_initialPostRotation) * KRQuaternion(m_initialLocalRotation) * KRQuaternion(m_initialPreRotation);
|
Quaternion world_rotation = Quaternion(m_initialPostRotation) * Quaternion(m_initialLocalRotation) * Quaternion(m_initialPreRotation);
|
||||||
if(dynamic_cast<KRBone *>(m_parentNode)) {
|
if(dynamic_cast<KRBone *>(m_parentNode)) {
|
||||||
world_rotation = world_rotation * m_parentNode->getBindPoseWorldRotation();
|
world_rotation = world_rotation * m_parentNode->getBindPoseWorldRotation();
|
||||||
}
|
}
|
||||||
return world_rotation;
|
return world_rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
const KRQuaternion KRNode::getActivePoseWorldRotation() {
|
const Quaternion KRNode::getActivePoseWorldRotation() {
|
||||||
KRQuaternion world_rotation = KRQuaternion(m_postRotation) * KRQuaternion(m_localRotation) * KRQuaternion(m_preRotation);
|
Quaternion world_rotation = Quaternion(m_postRotation) * Quaternion(m_localRotation) * Quaternion(m_preRotation);
|
||||||
if(dynamic_cast<KRBone *>(m_parentNode)) {
|
if(dynamic_cast<KRBone *>(m_parentNode)) {
|
||||||
world_rotation = world_rotation * m_parentNode->getActivePoseWorldRotation();
|
world_rotation = world_rotation * m_parentNode->getActivePoseWorldRotation();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,10 +111,10 @@ public:
|
|||||||
|
|
||||||
const Vector3 getWorldTranslation();
|
const Vector3 getWorldTranslation();
|
||||||
const Vector3 getWorldScale();
|
const Vector3 getWorldScale();
|
||||||
const KRQuaternion getWorldRotation();
|
const Quaternion getWorldRotation();
|
||||||
|
|
||||||
const KRQuaternion getBindPoseWorldRotation();
|
const Quaternion getBindPoseWorldRotation();
|
||||||
const KRQuaternion getActivePoseWorldRotation();
|
const Quaternion getActivePoseWorldRotation();
|
||||||
|
|
||||||
const Vector3 localToWorld(const Vector3 &local_point);
|
const Vector3 localToWorld(const Vector3 &local_point);
|
||||||
const Vector3 worldToLocal(const Vector3 &world_point);
|
const Vector3 worldToLocal(const Vector3 &world_point);
|
||||||
|
|||||||
@@ -565,7 +565,7 @@ void KRScene::addDefaultLights()
|
|||||||
{
|
{
|
||||||
KRDirectionalLight *light1 = new KRDirectionalLight(*this, "default_light1");
|
KRDirectionalLight *light1 = new KRDirectionalLight(*this, "default_light1");
|
||||||
|
|
||||||
light1->setLocalRotation((KRQuaternion(Vector3(0.0, M_PI * 0.10, 0.0)) * KRQuaternion(Vector3(0.0, 0.0, -M_PI * 0.15))).eulerXYZ());
|
light1->setLocalRotation((Quaternion(Vector3(0.0, M_PI * 0.10, 0.0)) * Quaternion(Vector3(0.0, 0.0, -M_PI * 0.15))).eulerXYZ());
|
||||||
m_pRootNode->addChild(light1);
|
m_pRootNode->addChild(light1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
445
kraken/matrix4.cpp
Normal file
445
kraken/matrix4.cpp
Normal file
@@ -0,0 +1,445 @@
|
|||||||
|
//
|
||||||
|
// Matrix4.cpp
|
||||||
|
// KREngine
|
||||||
|
//
|
||||||
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "KREngine-common.h"
|
||||||
|
|
||||||
|
#include "public/Matrix4.h"
|
||||||
|
|
||||||
|
Matrix4::Matrix4() {
|
||||||
|
// Default constructor - Initialize with an identity matrix
|
||||||
|
static const float IDENTITY_MATRIX[] = {
|
||||||
|
1.0, 0.0, 0.0, 0.0,
|
||||||
|
0.0, 1.0, 0.0, 0.0,
|
||||||
|
0.0, 0.0, 1.0, 0.0,
|
||||||
|
0.0, 0.0, 0.0, 1.0
|
||||||
|
};
|
||||||
|
memcpy(c, IDENTITY_MATRIX, sizeof(float) * 16);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4::Matrix4(float *pMat) {
|
||||||
|
memcpy(c, pMat, sizeof(float) * 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4::Matrix4(const Vector3 &axis_x, const Vector3 &axis_y, const Vector3 &axis_z, const Vector3 &trans)
|
||||||
|
{
|
||||||
|
c[0] = axis_x.x; c[1] = axis_x.y; c[2] = axis_x.z; c[3] = 0.0f;
|
||||||
|
c[4] = axis_y.x; c[5] = axis_y.y; c[6] = axis_y.z; c[7] = 0.0f;
|
||||||
|
c[8] = axis_z.x; c[9] = axis_z.y; c[10] = axis_z.z; c[11] = 0.0f;
|
||||||
|
c[12] = trans.x; c[13] = trans.y; c[14] = trans.z; c[15] = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4::~Matrix4() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float *Matrix4::getPointer() {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy constructor
|
||||||
|
Matrix4::Matrix4(const Matrix4 &m) {
|
||||||
|
memcpy(c, m.c, sizeof(float) * 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4& Matrix4::operator=(const Matrix4 &m) {
|
||||||
|
if(this != &m) { // Prevent self-assignment.
|
||||||
|
memcpy(c, m.c, sizeof(float) * 16);
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
float& Matrix4::operator[](unsigned i) {
|
||||||
|
return c[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
float Matrix4::operator[](unsigned i) const {
|
||||||
|
return c[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overload comparison operator
|
||||||
|
bool Matrix4::operator==(const Matrix4 &m) const {
|
||||||
|
return memcmp(c, m.c, sizeof(float) * 16) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overload compound multiply operator
|
||||||
|
Matrix4& Matrix4::operator*=(const Matrix4 &m) {
|
||||||
|
float temp[16];
|
||||||
|
|
||||||
|
int x,y;
|
||||||
|
|
||||||
|
for (x=0; x < 4; x++)
|
||||||
|
{
|
||||||
|
for(y=0; y < 4; y++)
|
||||||
|
{
|
||||||
|
temp[y + (x*4)] = (c[x*4] * m.c[y]) +
|
||||||
|
(c[(x*4)+1] * m.c[y+4]) +
|
||||||
|
(c[(x*4)+2] * m.c[y+8]) +
|
||||||
|
(c[(x*4)+3] * m.c[y+12]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(c, temp, sizeof(float) << 4);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overload multiply operator
|
||||||
|
Matrix4 Matrix4::operator*(const Matrix4 &m) const {
|
||||||
|
Matrix4 ret = *this;
|
||||||
|
ret *= m;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Generate a perspective view matrix using a field of view angle fov,
|
||||||
|
* window aspect ratio, near and far clipping planes */
|
||||||
|
void Matrix4::perspective(float fov, float aspect, float nearz, float farz) {
|
||||||
|
|
||||||
|
memset(c, 0, sizeof(float) * 16);
|
||||||
|
|
||||||
|
float range= tan(fov * 0.5) * nearz;
|
||||||
|
c[0] = (2 * nearz) / ((range * aspect) - (-range * aspect));
|
||||||
|
c[5] = (2 * nearz) / (2 * range);
|
||||||
|
c[10] = -(farz + nearz) / (farz - nearz);
|
||||||
|
c[11] = -1;
|
||||||
|
c[14] = -(2 * farz * nearz) / (farz - nearz);
|
||||||
|
/*
|
||||||
|
float range= atan(fov / 20.0f) * nearz;
|
||||||
|
float r = range * aspect;
|
||||||
|
float t = range * 1.0;
|
||||||
|
|
||||||
|
c[0] = nearz / r;
|
||||||
|
c[5] = nearz / t;
|
||||||
|
c[10] = -(farz + nearz) / (farz - nearz);
|
||||||
|
c[11] = -(2.0 * farz * nearz) / (farz - nearz);
|
||||||
|
c[14] = -1.0;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Perform translation operations on a matrix */
|
||||||
|
void Matrix4::translate(float x, float y, float z) {
|
||||||
|
Matrix4 newMatrix; // Create new identity matrix
|
||||||
|
|
||||||
|
newMatrix.c[12] = x;
|
||||||
|
newMatrix.c[13] = y;
|
||||||
|
newMatrix.c[14] = z;
|
||||||
|
|
||||||
|
*this *= newMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Matrix4::translate(const Vector3 &v)
|
||||||
|
{
|
||||||
|
translate(v.x, v.y, v.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rotate a matrix by an angle on a X, Y, or Z axis */
|
||||||
|
void Matrix4::rotate(float angle, AXIS axis) {
|
||||||
|
const int cos1[3] = { 5, 0, 0 }; // cos(angle)
|
||||||
|
const int cos2[3] = { 10, 10, 5 }; // cos(angle)
|
||||||
|
const int sin1[3] = { 9, 2, 4 }; // -sin(angle)
|
||||||
|
const int sin2[3] = { 6, 8, 1 }; // sin(angle)
|
||||||
|
|
||||||
|
/*
|
||||||
|
X_AXIS:
|
||||||
|
|
||||||
|
1, 0, 0, 0
|
||||||
|
0, cos(angle), -sin(angle), 0
|
||||||
|
0, sin(angle), cos(angle), 0
|
||||||
|
0, 0, 0, 1
|
||||||
|
|
||||||
|
Y_AXIS:
|
||||||
|
|
||||||
|
cos(angle), 0, -sin(angle), 0
|
||||||
|
0, 1, 0, 0
|
||||||
|
sin(angle), 0, cos(angle), 0
|
||||||
|
0, 0, 0, 1
|
||||||
|
|
||||||
|
Z_AXIS:
|
||||||
|
|
||||||
|
cos(angle), -sin(angle), 0, 0
|
||||||
|
sin(angle), cos(angle), 0, 0
|
||||||
|
0, 0, 1, 0
|
||||||
|
0, 0, 0, 1
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Matrix4 newMatrix; // Create new identity matrix
|
||||||
|
|
||||||
|
newMatrix.c[cos1[axis]] = cos(angle);
|
||||||
|
newMatrix.c[sin1[axis]] = -sin(angle);
|
||||||
|
newMatrix.c[sin2[axis]] = -newMatrix.c[sin1[axis]];
|
||||||
|
newMatrix.c[cos2[axis]] = newMatrix.c[cos1[axis]];
|
||||||
|
|
||||||
|
*this *= newMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Matrix4::rotate(const Quaternion &q)
|
||||||
|
{
|
||||||
|
*this *= q.rotationMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scale matrix by separate x, y, and z amounts */
|
||||||
|
void Matrix4::scale(float x, float y, float z) {
|
||||||
|
Matrix4 newMatrix; // Create new identity matrix
|
||||||
|
|
||||||
|
newMatrix.c[0] = x;
|
||||||
|
newMatrix.c[5] = y;
|
||||||
|
newMatrix.c[10] = z;
|
||||||
|
|
||||||
|
*this *= newMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Matrix4::scale(const Vector3 &v) {
|
||||||
|
scale(v.x, v.y, v.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scale all dimensions equally */
|
||||||
|
void Matrix4::scale(float s) {
|
||||||
|
scale(s,s,s);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize with a bias matrix
|
||||||
|
void Matrix4::bias() {
|
||||||
|
static const float BIAS_MATRIX[] = {
|
||||||
|
0.5, 0.0, 0.0, 0.0,
|
||||||
|
0.0, 0.5, 0.0, 0.0,
|
||||||
|
0.0, 0.0, 0.5, 0.0,
|
||||||
|
0.5, 0.5, 0.5, 1.0
|
||||||
|
};
|
||||||
|
memcpy(c, BIAS_MATRIX, sizeof(float) * 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Generate an orthographic view matrix */
|
||||||
|
void Matrix4::ortho(float left, float right, float top, float bottom, float nearz, float farz) {
|
||||||
|
memset(c, 0, sizeof(float) * 16);
|
||||||
|
c[0] = 2.0f / (right - left);
|
||||||
|
c[5] = 2.0f / (bottom - top);
|
||||||
|
c[10] = -1.0f / (farz - nearz);
|
||||||
|
c[11] = -nearz / (farz - nearz);
|
||||||
|
c[15] = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replace matrix with its inverse */
|
||||||
|
bool Matrix4::invert() {
|
||||||
|
// Based on gluInvertMatrix implementation
|
||||||
|
|
||||||
|
float inv[16], det;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
inv[0] = c[5]*c[10]*c[15] - c[5]*c[11]*c[14] - c[9]*c[6]*c[15]
|
||||||
|
+ c[9]*c[7]*c[14] + c[13]*c[6]*c[11] - c[13]*c[7]*c[10];
|
||||||
|
inv[4] = -c[4]*c[10]*c[15] + c[4]*c[11]*c[14] + c[8]*c[6]*c[15]
|
||||||
|
- c[8]*c[7]*c[14] - c[12]*c[6]*c[11] + c[12]*c[7]*c[10];
|
||||||
|
inv[8] = c[4]*c[9]*c[15] - c[4]*c[11]*c[13] - c[8]*c[5]*c[15]
|
||||||
|
+ c[8]*c[7]*c[13] + c[12]*c[5]*c[11] - c[12]*c[7]*c[9];
|
||||||
|
inv[12] = -c[4]*c[9]*c[14] + c[4]*c[10]*c[13] + c[8]*c[5]*c[14]
|
||||||
|
- c[8]*c[6]*c[13] - c[12]*c[5]*c[10] + c[12]*c[6]*c[9];
|
||||||
|
inv[1] = -c[1]*c[10]*c[15] + c[1]*c[11]*c[14] + c[9]*c[2]*c[15]
|
||||||
|
- c[9]*c[3]*c[14] - c[13]*c[2]*c[11] + c[13]*c[3]*c[10];
|
||||||
|
inv[5] = c[0]*c[10]*c[15] - c[0]*c[11]*c[14] - c[8]*c[2]*c[15]
|
||||||
|
+ c[8]*c[3]*c[14] + c[12]*c[2]*c[11] - c[12]*c[3]*c[10];
|
||||||
|
inv[9] = -c[0]*c[9]*c[15] + c[0]*c[11]*c[13] + c[8]*c[1]*c[15]
|
||||||
|
- c[8]*c[3]*c[13] - c[12]*c[1]*c[11] + c[12]*c[3]*c[9];
|
||||||
|
inv[13] = c[0]*c[9]*c[14] - c[0]*c[10]*c[13] - c[8]*c[1]*c[14]
|
||||||
|
+ c[8]*c[2]*c[13] + c[12]*c[1]*c[10] - c[12]*c[2]*c[9];
|
||||||
|
inv[2] = c[1]*c[6]*c[15] - c[1]*c[7]*c[14] - c[5]*c[2]*c[15]
|
||||||
|
+ c[5]*c[3]*c[14] + c[13]*c[2]*c[7] - c[13]*c[3]*c[6];
|
||||||
|
inv[6] = -c[0]*c[6]*c[15] + c[0]*c[7]*c[14] + c[4]*c[2]*c[15]
|
||||||
|
- c[4]*c[3]*c[14] - c[12]*c[2]*c[7] + c[12]*c[3]*c[6];
|
||||||
|
inv[10] = c[0]*c[5]*c[15] - c[0]*c[7]*c[13] - c[4]*c[1]*c[15]
|
||||||
|
+ c[4]*c[3]*c[13] + c[12]*c[1]*c[7] - c[12]*c[3]*c[5];
|
||||||
|
inv[14] = -c[0]*c[5]*c[14] + c[0]*c[6]*c[13] + c[4]*c[1]*c[14]
|
||||||
|
- c[4]*c[2]*c[13] - c[12]*c[1]*c[6] + c[12]*c[2]*c[5];
|
||||||
|
inv[3] = -c[1]*c[6]*c[11] + c[1]*c[7]*c[10] + c[5]*c[2]*c[11]
|
||||||
|
- c[5]*c[3]*c[10] - c[9]*c[2]*c[7] + c[9]*c[3]*c[6];
|
||||||
|
inv[7] = c[0]*c[6]*c[11] - c[0]*c[7]*c[10] - c[4]*c[2]*c[11]
|
||||||
|
+ c[4]*c[3]*c[10] + c[8]*c[2]*c[7] - c[8]*c[3]*c[6];
|
||||||
|
inv[11] = -c[0]*c[5]*c[11] + c[0]*c[7]*c[9] + c[4]*c[1]*c[11]
|
||||||
|
- c[4]*c[3]*c[9] - c[8]*c[1]*c[7] + c[8]*c[3]*c[5];
|
||||||
|
inv[15] = c[0]*c[5]*c[10] - c[0]*c[6]*c[9] - c[4]*c[1]*c[10]
|
||||||
|
+ c[4]*c[2]*c[9] + c[8]*c[1]*c[6] - c[8]*c[2]*c[5];
|
||||||
|
|
||||||
|
det = c[0]*inv[0] + c[1]*inv[4] + c[2]*inv[8] + c[3]*inv[12];
|
||||||
|
|
||||||
|
if (det == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
det = 1.0 / det;
|
||||||
|
|
||||||
|
for (i = 0; i < 16; i++) {
|
||||||
|
c[i] = inv[i] * det;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Matrix4::transpose() {
|
||||||
|
float trans[16];
|
||||||
|
for(int x=0; x<4; x++) {
|
||||||
|
for(int y=0; y<4; y++) {
|
||||||
|
trans[x + y * 4] = c[y + x * 4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memcpy(c, trans, sizeof(float) * 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dot Product, returning Vector3 */
|
||||||
|
Vector3 Matrix4::Dot(const Matrix4 &m, const Vector3 &v) {
|
||||||
|
return Vector3(
|
||||||
|
v.c[0] * m.c[0] + v.c[1] * m.c[4] + v.c[2] * m.c[8] + m.c[12],
|
||||||
|
v.c[0] * m.c[1] + v.c[1] * m.c[5] + v.c[2] * m.c[9] + m.c[13],
|
||||||
|
v.c[0] * m.c[2] + v.c[1] * m.c[6] + v.c[2] * m.c[10] + m.c[14]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector4 Matrix4::Dot4(const Matrix4 &m, const Vector4 &v) {
|
||||||
|
#ifdef KRAKEN_USE_ARM_NEON
|
||||||
|
|
||||||
|
Vector4 d;
|
||||||
|
asm volatile (
|
||||||
|
"vld1.32 {d0, d1}, [%1] \n\t" //Q0 = v
|
||||||
|
"vld1.32 {d18, d19}, [%0]! \n\t" //Q1 = m
|
||||||
|
"vld1.32 {d20, d21}, [%0]! \n\t" //Q2 = m+4
|
||||||
|
"vld1.32 {d22, d23}, [%0]! \n\t" //Q3 = m+8
|
||||||
|
"vld1.32 {d24, d25}, [%0]! \n\t" //Q4 = m+12
|
||||||
|
|
||||||
|
"vmul.f32 q13, q9, d0[0] \n\t" //Q5 = Q1*Q0[0]
|
||||||
|
"vmla.f32 q13, q10, d0[1] \n\t" //Q5 += Q1*Q0[1]
|
||||||
|
"vmla.f32 q13, q11, d1[0] \n\t" //Q5 += Q2*Q0[2]
|
||||||
|
"vmla.f32 q13, q12, d1[1] \n\t" //Q5 += Q3*Q0[3]
|
||||||
|
|
||||||
|
"vst1.32 {d26, d27}, [%2] \n\t" //Q4 = m+12
|
||||||
|
: /* no output registers */
|
||||||
|
: "r"(m.c), "r"(v.c), "r"(d.c)
|
||||||
|
: "q0", "q9", "q10","q11", "q12", "q13", "memory"
|
||||||
|
);
|
||||||
|
return d;
|
||||||
|
#else
|
||||||
|
return Vector4(
|
||||||
|
v.c[0] * m.c[0] + v.c[1] * m.c[4] + v.c[2] * m.c[8] + m.c[12],
|
||||||
|
v.c[0] * m.c[1] + v.c[1] * m.c[5] + v.c[2] * m.c[9] + m.c[13],
|
||||||
|
v.c[0] * m.c[2] + v.c[1] * m.c[6] + v.c[2] * m.c[10] + m.c[14],
|
||||||
|
v.c[0] * m.c[3] + v.c[1] * m.c[7] + v.c[2] * m.c[11] + m.c[15]
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dot product without including translation; useful for transforming normals and tangents
|
||||||
|
Vector3 Matrix4::DotNoTranslate(const Matrix4 &m, const Vector3 &v)
|
||||||
|
{
|
||||||
|
return Vector3(
|
||||||
|
v.x * m.c[0] + v.y * m.c[4] + v.z * m.c[8],
|
||||||
|
v.x * m.c[1] + v.y * m.c[5] + v.z * m.c[9],
|
||||||
|
v.x * m.c[2] + v.y * m.c[6] + v.z * m.c[10]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dot Product, returning w component as if it were a Vector4 (This will be deprecated once Vector4 is implemented instead*/
|
||||||
|
float Matrix4::DotW(const Matrix4 &m, const Vector3 &v) {
|
||||||
|
return v.x * m.c[0*4 + 3] + v.y * m.c[1*4 + 3] + v.z * m.c[2*4 + 3] + m.c[3*4 + 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dot Product followed by W-divide */
|
||||||
|
Vector3 Matrix4::DotWDiv(const Matrix4 &m, const Vector3 &v) {
|
||||||
|
Vector4 r = Dot4(m, Vector4(v, 1.0f));
|
||||||
|
return Vector3(r) / r.w;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4 Matrix4::LookAt(const Vector3 &cameraPos, const Vector3 &lookAtPos, const Vector3 &upDirection)
|
||||||
|
{
|
||||||
|
Matrix4 matLookat;
|
||||||
|
Vector3 lookat_z_axis = lookAtPos - cameraPos;
|
||||||
|
lookat_z_axis.normalize();
|
||||||
|
Vector3 lookat_x_axis = Vector3::Cross(upDirection, lookat_z_axis);
|
||||||
|
lookat_x_axis.normalize();
|
||||||
|
Vector3 lookat_y_axis = Vector3::Cross(lookat_z_axis, lookat_x_axis);
|
||||||
|
|
||||||
|
matLookat.getPointer()[0] = lookat_x_axis.x;
|
||||||
|
matLookat.getPointer()[1] = lookat_y_axis.x;
|
||||||
|
matLookat.getPointer()[2] = lookat_z_axis.x;
|
||||||
|
|
||||||
|
matLookat.getPointer()[4] = lookat_x_axis.y;
|
||||||
|
matLookat.getPointer()[5] = lookat_y_axis.y;
|
||||||
|
matLookat.getPointer()[6] = lookat_z_axis.y;
|
||||||
|
|
||||||
|
matLookat.getPointer()[8] = lookat_x_axis.z;
|
||||||
|
matLookat.getPointer()[9] = lookat_y_axis.z;
|
||||||
|
matLookat.getPointer()[10] = lookat_z_axis.z;
|
||||||
|
|
||||||
|
matLookat.getPointer()[12] = -Vector3::Dot(lookat_x_axis, cameraPos);
|
||||||
|
matLookat.getPointer()[13] = -Vector3::Dot(lookat_y_axis, cameraPos);
|
||||||
|
matLookat.getPointer()[14] = -Vector3::Dot(lookat_z_axis, cameraPos);
|
||||||
|
|
||||||
|
return matLookat;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4 Matrix4::Invert(const Matrix4 &m)
|
||||||
|
{
|
||||||
|
Matrix4 matInvert = m;
|
||||||
|
matInvert.invert();
|
||||||
|
return matInvert;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4 Matrix4::Transpose(const Matrix4 &m)
|
||||||
|
{
|
||||||
|
Matrix4 matTranspose = m;
|
||||||
|
matTranspose.transpose();
|
||||||
|
return matTranspose;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4 Matrix4::Translation(const Vector3 &v)
|
||||||
|
{
|
||||||
|
Matrix4 m;
|
||||||
|
m[12] = v.x;
|
||||||
|
m[13] = v.y;
|
||||||
|
m[14] = v.z;
|
||||||
|
// m.translate(v);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4 Matrix4::Rotation(const Vector3 &v)
|
||||||
|
{
|
||||||
|
Matrix4 m;
|
||||||
|
m.rotate(v.x, X_AXIS);
|
||||||
|
m.rotate(v.y, Y_AXIS);
|
||||||
|
m.rotate(v.z, Z_AXIS);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4 Matrix4::Scaling(const Vector3 &v)
|
||||||
|
{
|
||||||
|
Matrix4 m;
|
||||||
|
m.scale(v);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
// or implied, of Kearwood Gilbert.
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef KRTRIANGLE3_H
|
#ifndef KRAKEN_TRIANGLE3_H
|
||||||
#define KRTRIANGLE3_H
|
#define KRAKEN_TRIANGLE3_H
|
||||||
|
|
||||||
#include "Vector3.h"
|
#include "Vector3.h"
|
||||||
|
|
||||||
@@ -62,4 +62,4 @@ public:
|
|||||||
|
|
||||||
} // namespace kraken
|
} // namespace kraken
|
||||||
|
|
||||||
#endif // KRTRIANGLE3_H
|
#endif // KRAKEN_TRIANGLE3_H
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
#include "vector2.h"
|
#include "vector2.h"
|
||||||
#include "vector3.h"
|
#include "vector3.h"
|
||||||
#include "vector4.h"
|
#include "vector4.h"
|
||||||
#include "Matrix4.h"
|
#include "matrix4.h"
|
||||||
#include "KRQuaternion.h"
|
#include "quaternion.h"
|
||||||
#include "KRAABB.h"
|
#include "KRAABB.h"
|
||||||
#include "KRTriangle3.h"
|
#include "KRTriangle3.h"
|
||||||
|
|
||||||
|
|||||||
115
kraken/public/matrix4.h
Normal file
115
kraken/public/matrix4.h
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
//
|
||||||
|
// Matrix4.h
|
||||||
|
// Kraken
|
||||||
|
//
|
||||||
|
// Copyright 2017 Kearwood Gilbert. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "vector3.h"
|
||||||
|
#include "vector4.h"
|
||||||
|
|
||||||
|
#ifndef KRAKEN_MATRIX4_H
|
||||||
|
#define KRAKEN_MATRIX4_H
|
||||||
|
|
||||||
|
namespace kraken {
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
X_AXIS,
|
||||||
|
Y_AXIS,
|
||||||
|
Z_AXIS
|
||||||
|
} AXIS;
|
||||||
|
|
||||||
|
class Quaternion;
|
||||||
|
|
||||||
|
class Matrix4 {
|
||||||
|
public:
|
||||||
|
|
||||||
|
float c[16]; // Matrix components, in column-major order
|
||||||
|
|
||||||
|
// Default constructor - Creates an identity matrix
|
||||||
|
Matrix4();
|
||||||
|
|
||||||
|
Matrix4(float *pMat);
|
||||||
|
|
||||||
|
Matrix4(const Vector3 &axis_x, const Vector3 &axis_y, const Vector3 &axis_z, const Vector3 &trans);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~Matrix4();
|
||||||
|
|
||||||
|
// Copy constructor
|
||||||
|
Matrix4(const Matrix4 &m);
|
||||||
|
|
||||||
|
// Overload assignment operator
|
||||||
|
Matrix4& operator=(const Matrix4 &m);
|
||||||
|
|
||||||
|
// Overload comparison operator
|
||||||
|
bool operator==(const Matrix4 &m) const;
|
||||||
|
|
||||||
|
// Overload compound multiply operator
|
||||||
|
Matrix4& operator*=(const Matrix4 &m);
|
||||||
|
|
||||||
|
float& operator[](unsigned i);
|
||||||
|
float operator[](unsigned i) const;
|
||||||
|
|
||||||
|
// Overload multiply operator
|
||||||
|
//Matrix4& operator*(const Matrix4 &m);
|
||||||
|
Matrix4 operator*(const Matrix4 &m) const;
|
||||||
|
|
||||||
|
float *getPointer();
|
||||||
|
|
||||||
|
void perspective(float fov, float aspect, float nearz, float farz);
|
||||||
|
void ortho(float left, float right, float top, float bottom, float nearz, float farz);
|
||||||
|
void translate(float x, float y, float z);
|
||||||
|
void translate(const Vector3 &v);
|
||||||
|
void scale(float x, float y, float z);
|
||||||
|
void scale(const Vector3 &v);
|
||||||
|
void scale(float s);
|
||||||
|
void rotate(float angle, AXIS axis);
|
||||||
|
void rotate(const Quaternion &q);
|
||||||
|
void bias();
|
||||||
|
bool invert();
|
||||||
|
void transpose();
|
||||||
|
|
||||||
|
static Vector3 DotNoTranslate(const Matrix4 &m, const Vector3 &v); // Dot product without including translation; useful for transforming normals and tangents
|
||||||
|
static Matrix4 Invert(const Matrix4 &m);
|
||||||
|
static Matrix4 Transpose(const Matrix4 &m);
|
||||||
|
static Vector3 Dot(const Matrix4 &m, const Vector3 &v);
|
||||||
|
static Vector4 Dot4(const Matrix4 &m, const Vector4 &v);
|
||||||
|
static float DotW(const Matrix4 &m, const Vector3 &v);
|
||||||
|
static Vector3 DotWDiv(const Matrix4 &m, const Vector3 &v);
|
||||||
|
|
||||||
|
static Matrix4 LookAt(const Vector3 &cameraPos, const Vector3 &lookAtPos, const Vector3 &upDirection);
|
||||||
|
|
||||||
|
static Matrix4 Translation(const Vector3 &v);
|
||||||
|
static Matrix4 Rotation(const Vector3 &v);
|
||||||
|
static Matrix4 Scaling(const Vector3 &v);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace kraken
|
||||||
|
|
||||||
|
#endif // KRAKEN_MATRIX4_H
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// KRQuaternion.h
|
// Quaternion.h
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
@@ -29,40 +29,40 @@
|
|||||||
// or implied, of Kearwood Gilbert.
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef KRQUATERNION_H
|
#ifndef KRAKEN_QUATERNION_H
|
||||||
#define KRQUATERNION_H
|
#define KRAKEN_QUATERNION_H
|
||||||
|
|
||||||
#include "Vector3.h"
|
#include "vector3.h"
|
||||||
|
|
||||||
namespace kraken {
|
namespace kraken {
|
||||||
|
|
||||||
class KRQuaternion {
|
class Quaternion {
|
||||||
public:
|
public:
|
||||||
KRQuaternion();
|
Quaternion();
|
||||||
KRQuaternion(float w, float x, float y, float z);
|
Quaternion(float w, float x, float y, float z);
|
||||||
KRQuaternion(const KRQuaternion& p);
|
Quaternion(const Quaternion& p);
|
||||||
KRQuaternion(const Vector3 &euler);
|
Quaternion(const Vector3 &euler);
|
||||||
KRQuaternion(const Vector3 &from_vector, const Vector3 &to_vector);
|
Quaternion(const Vector3 &from_vector, const Vector3 &to_vector);
|
||||||
~KRQuaternion();
|
~Quaternion();
|
||||||
|
|
||||||
KRQuaternion& operator =( const KRQuaternion& p );
|
Quaternion& operator =( const Quaternion& p );
|
||||||
KRQuaternion operator +(const KRQuaternion &v) const;
|
Quaternion operator +(const Quaternion &v) const;
|
||||||
KRQuaternion operator -(const KRQuaternion &v) const;
|
Quaternion operator -(const Quaternion &v) const;
|
||||||
KRQuaternion operator +() const;
|
Quaternion operator +() const;
|
||||||
KRQuaternion operator -() const;
|
Quaternion operator -() const;
|
||||||
|
|
||||||
KRQuaternion operator *(const KRQuaternion &v);
|
Quaternion operator *(const Quaternion &v);
|
||||||
KRQuaternion operator *(float num) const;
|
Quaternion operator *(float num) const;
|
||||||
KRQuaternion operator /(float num) const;
|
Quaternion operator /(float num) const;
|
||||||
|
|
||||||
KRQuaternion& operator +=(const KRQuaternion& v);
|
Quaternion& operator +=(const Quaternion& v);
|
||||||
KRQuaternion& operator -=(const KRQuaternion& v);
|
Quaternion& operator -=(const Quaternion& v);
|
||||||
KRQuaternion& operator *=(const KRQuaternion& v);
|
Quaternion& operator *=(const Quaternion& v);
|
||||||
KRQuaternion& operator *=(const float& v);
|
Quaternion& operator *=(const float& v);
|
||||||
KRQuaternion& operator /=(const float& v);
|
Quaternion& operator /=(const float& v);
|
||||||
|
|
||||||
friend bool operator ==(KRQuaternion &v1, KRQuaternion &v2);
|
friend bool operator ==(Quaternion &v1, Quaternion &v2);
|
||||||
friend bool operator !=(KRQuaternion &v1, KRQuaternion &v2);
|
friend bool operator !=(Quaternion &v1, Quaternion &v2);
|
||||||
float& operator [](unsigned i);
|
float& operator [](unsigned i);
|
||||||
float operator [](unsigned i) const;
|
float operator [](unsigned i) const;
|
||||||
|
|
||||||
@@ -72,19 +72,19 @@ public:
|
|||||||
Matrix4 rotationMatrix() const;
|
Matrix4 rotationMatrix() const;
|
||||||
|
|
||||||
void normalize();
|
void normalize();
|
||||||
static KRQuaternion Normalize(const KRQuaternion &v1);
|
static Quaternion Normalize(const Quaternion &v1);
|
||||||
|
|
||||||
void conjugate();
|
void conjugate();
|
||||||
static KRQuaternion Conjugate(const KRQuaternion &v1);
|
static Quaternion Conjugate(const Quaternion &v1);
|
||||||
|
|
||||||
static KRQuaternion FromAngleAxis(const Vector3 &axis, float angle);
|
static Quaternion FromAngleAxis(const Vector3 &axis, float angle);
|
||||||
static KRQuaternion Lerp(const KRQuaternion &a, const KRQuaternion &b, float t);
|
static Quaternion Lerp(const Quaternion &a, const Quaternion &b, float t);
|
||||||
static KRQuaternion Slerp(const KRQuaternion &a, const KRQuaternion &b, float t);
|
static Quaternion Slerp(const Quaternion &a, const Quaternion &b, float t);
|
||||||
static float Dot(const KRQuaternion &v1, const KRQuaternion &v2);
|
static float Dot(const Quaternion &v1, const Quaternion &v2);
|
||||||
private:
|
private:
|
||||||
float m_val[4];
|
float m_val[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace kraken
|
} // namespace kraken
|
||||||
|
|
||||||
#endif // KRQUATERNION_H
|
#endif // KRAKEN_QUATERNION_H
|
||||||
98
kraken/KRQuaternion.cpp → kraken/quaternion.cpp
Executable file → Normal file
98
kraken/KRQuaternion.cpp → kraken/quaternion.cpp
Executable file → Normal file
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// KRQuaternion.cpp
|
// Quaternion.cpp
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
@@ -35,28 +35,28 @@
|
|||||||
|
|
||||||
namespace kraken {
|
namespace kraken {
|
||||||
|
|
||||||
KRQuaternion::KRQuaternion() {
|
Quaternion::Quaternion() {
|
||||||
m_val[0] = 1.0;
|
m_val[0] = 1.0;
|
||||||
m_val[1] = 0.0;
|
m_val[1] = 0.0;
|
||||||
m_val[2] = 0.0;
|
m_val[2] = 0.0;
|
||||||
m_val[3] = 0.0;
|
m_val[3] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion::KRQuaternion(float w, float x, float y, float z) {
|
Quaternion::Quaternion(float w, float x, float y, float z) {
|
||||||
m_val[0] = w;
|
m_val[0] = w;
|
||||||
m_val[1] = x;
|
m_val[1] = x;
|
||||||
m_val[2] = y;
|
m_val[2] = y;
|
||||||
m_val[3] = z;
|
m_val[3] = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion::KRQuaternion(const KRQuaternion& p) {
|
Quaternion::Quaternion(const Quaternion& p) {
|
||||||
m_val[0] = p[0];
|
m_val[0] = p[0];
|
||||||
m_val[1] = p[1];
|
m_val[1] = p[1];
|
||||||
m_val[2] = p[2];
|
m_val[2] = p[2];
|
||||||
m_val[3] = p[3];
|
m_val[3] = p[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion& KRQuaternion::operator =( const KRQuaternion& p ) {
|
Quaternion& Quaternion::operator =( const Quaternion& p ) {
|
||||||
m_val[0] = p[0];
|
m_val[0] = p[0];
|
||||||
m_val[1] = p[1];
|
m_val[1] = p[1];
|
||||||
m_val[2] = p[2];
|
m_val[2] = p[2];
|
||||||
@@ -64,11 +64,11 @@ KRQuaternion& KRQuaternion::operator =( const KRQuaternion& p ) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion::KRQuaternion(const Vector3 &euler) {
|
Quaternion::Quaternion(const Vector3 &euler) {
|
||||||
setEulerZYX(euler);
|
setEulerZYX(euler);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion::KRQuaternion(const Vector3 &from_vector, const Vector3 &to_vector) {
|
Quaternion::Quaternion(const Vector3 &from_vector, const Vector3 &to_vector) {
|
||||||
|
|
||||||
Vector3 a = Vector3::Cross(from_vector, to_vector);
|
Vector3 a = Vector3::Cross(from_vector, to_vector);
|
||||||
m_val[0] = a[0];
|
m_val[0] = a[0];
|
||||||
@@ -78,18 +78,18 @@ KRQuaternion::KRQuaternion(const Vector3 &from_vector, const Vector3 &to_vector)
|
|||||||
normalize();
|
normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion::~KRQuaternion() {
|
Quaternion::~Quaternion() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRQuaternion::setEulerXYZ(const Vector3 &euler)
|
void Quaternion::setEulerXYZ(const Vector3 &euler)
|
||||||
{
|
{
|
||||||
*this = KRQuaternion::FromAngleAxis(Vector3(1.0f, 0.0f, 0.0f), euler.x)
|
*this = Quaternion::FromAngleAxis(Vector3(1.0f, 0.0f, 0.0f), euler.x)
|
||||||
* KRQuaternion::FromAngleAxis(Vector3(0.0f, 1.0f, 0.0f), euler.y)
|
* Quaternion::FromAngleAxis(Vector3(0.0f, 1.0f, 0.0f), euler.y)
|
||||||
* KRQuaternion::FromAngleAxis(Vector3(0.0f, 0.0f, 1.0f), euler.z);
|
* Quaternion::FromAngleAxis(Vector3(0.0f, 0.0f, 1.0f), euler.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRQuaternion::setEulerZYX(const Vector3 &euler) {
|
void Quaternion::setEulerZYX(const Vector3 &euler) {
|
||||||
// ZYX Order!
|
// ZYX Order!
|
||||||
float c1 = cos(euler[0] * 0.5f);
|
float c1 = cos(euler[0] * 0.5f);
|
||||||
float c2 = cos(euler[1] * 0.5f);
|
float c2 = cos(euler[1] * 0.5f);
|
||||||
@@ -104,15 +104,15 @@ void KRQuaternion::setEulerZYX(const Vector3 &euler) {
|
|||||||
m_val[3] = c1 * c2 * s3 - s1 * s2 * c3;
|
m_val[3] = c1 * c2 * s3 - s1 * s2 * c3;
|
||||||
}
|
}
|
||||||
|
|
||||||
float KRQuaternion::operator [](unsigned i) const {
|
float Quaternion::operator [](unsigned i) const {
|
||||||
return m_val[i];
|
return m_val[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
float &KRQuaternion::operator [](unsigned i) {
|
float &Quaternion::operator [](unsigned i) {
|
||||||
return m_val[i];
|
return m_val[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 KRQuaternion::eulerXYZ() const {
|
Vector3 Quaternion::eulerXYZ() const {
|
||||||
double a2 = 2 * (m_val[0] * m_val[2] - m_val[1] * m_val[3]);
|
double a2 = 2 * (m_val[0] * m_val[2] - m_val[1] * m_val[3]);
|
||||||
if(a2 <= -0.99999) {
|
if(a2 <= -0.99999) {
|
||||||
return Vector3(
|
return Vector3(
|
||||||
@@ -137,7 +137,7 @@ Vector3 KRQuaternion::eulerXYZ() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator ==(KRQuaternion &v1, KRQuaternion &v2) {
|
bool operator ==(Quaternion &v1, Quaternion &v2) {
|
||||||
return
|
return
|
||||||
v1[0] == v2[0]
|
v1[0] == v2[0]
|
||||||
&& v1[1] == v2[1]
|
&& v1[1] == v2[1]
|
||||||
@@ -145,7 +145,7 @@ bool operator ==(KRQuaternion &v1, KRQuaternion &v2) {
|
|||||||
&& v1[3] == v2[3];
|
&& v1[3] == v2[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator !=(KRQuaternion &v1, KRQuaternion &v2) {
|
bool operator !=(Quaternion &v1, Quaternion &v2) {
|
||||||
return
|
return
|
||||||
v1[0] != v2[0]
|
v1[0] != v2[0]
|
||||||
|| v1[1] != v2[1]
|
|| v1[1] != v2[1]
|
||||||
@@ -153,7 +153,7 @@ bool operator !=(KRQuaternion &v1, KRQuaternion &v2) {
|
|||||||
|| v1[3] != v2[3];
|
|| v1[3] != v2[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::operator *(const KRQuaternion &v) {
|
Quaternion Quaternion::operator *(const Quaternion &v) {
|
||||||
float t0 = (m_val[3]-m_val[2])*(v[2]-v[3]);
|
float t0 = (m_val[3]-m_val[2])*(v[2]-v[3]);
|
||||||
float t1 = (m_val[0]+m_val[1])*(v[0]+v[1]);
|
float t1 = (m_val[0]+m_val[1])*(v[0]+v[1]);
|
||||||
float t2 = (m_val[0]-m_val[1])*(v[2]+v[3]);
|
float t2 = (m_val[0]-m_val[1])*(v[2]+v[3]);
|
||||||
@@ -165,7 +165,7 @@ KRQuaternion KRQuaternion::operator *(const KRQuaternion &v) {
|
|||||||
float t8 = t5+t6+t7;
|
float t8 = t5+t6+t7;
|
||||||
float t9 = (t4+t8)/2;
|
float t9 = (t4+t8)/2;
|
||||||
|
|
||||||
return KRQuaternion(
|
return Quaternion(
|
||||||
t0+t9-t5,
|
t0+t9-t5,
|
||||||
t1+t9-t8,
|
t1+t9-t8,
|
||||||
t2+t9-t7,
|
t2+t9-t7,
|
||||||
@@ -173,24 +173,24 @@ KRQuaternion KRQuaternion::operator *(const KRQuaternion &v) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::operator *(float v) const {
|
Quaternion Quaternion::operator *(float v) const {
|
||||||
return KRQuaternion(m_val[0] * v, m_val[1] * v, m_val[2] * v, m_val[3] * v);
|
return Quaternion(m_val[0] * v, m_val[1] * v, m_val[2] * v, m_val[3] * v);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::operator /(float num) const {
|
Quaternion Quaternion::operator /(float num) const {
|
||||||
float inv_num = 1.0f / num;
|
float inv_num = 1.0f / num;
|
||||||
return KRQuaternion(m_val[0] * inv_num, m_val[1] * inv_num, m_val[2] * inv_num, m_val[3] * inv_num);
|
return Quaternion(m_val[0] * inv_num, m_val[1] * inv_num, m_val[2] * inv_num, m_val[3] * inv_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::operator +(const KRQuaternion &v) const {
|
Quaternion Quaternion::operator +(const Quaternion &v) const {
|
||||||
return KRQuaternion(m_val[0] + v[0], m_val[1] + v[1], m_val[2] + v[2], m_val[3] + v[3]);
|
return Quaternion(m_val[0] + v[0], m_val[1] + v[1], m_val[2] + v[2], m_val[3] + v[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::operator -(const KRQuaternion &v) const {
|
Quaternion Quaternion::operator -(const Quaternion &v) const {
|
||||||
return KRQuaternion(m_val[0] - v[0], m_val[1] - v[1], m_val[2] - v[2], m_val[3] - v[3]);
|
return Quaternion(m_val[0] - v[0], m_val[1] - v[1], m_val[2] - v[2], m_val[3] - v[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion& KRQuaternion::operator +=(const KRQuaternion& v) {
|
Quaternion& Quaternion::operator +=(const Quaternion& v) {
|
||||||
m_val[0] += v[0];
|
m_val[0] += v[0];
|
||||||
m_val[1] += v[1];
|
m_val[1] += v[1];
|
||||||
m_val[2] += v[2];
|
m_val[2] += v[2];
|
||||||
@@ -198,7 +198,7 @@ KRQuaternion& KRQuaternion::operator +=(const KRQuaternion& v) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion& KRQuaternion::operator -=(const KRQuaternion& v) {
|
Quaternion& Quaternion::operator -=(const Quaternion& v) {
|
||||||
m_val[0] -= v[0];
|
m_val[0] -= v[0];
|
||||||
m_val[1] -= v[1];
|
m_val[1] -= v[1];
|
||||||
m_val[2] -= v[2];
|
m_val[2] -= v[2];
|
||||||
@@ -206,7 +206,7 @@ KRQuaternion& KRQuaternion::operator -=(const KRQuaternion& v) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion& KRQuaternion::operator *=(const KRQuaternion& v) {
|
Quaternion& Quaternion::operator *=(const Quaternion& v) {
|
||||||
float t0 = (m_val[3]-m_val[2])*(v[2]-v[3]);
|
float t0 = (m_val[3]-m_val[2])*(v[2]-v[3]);
|
||||||
float t1 = (m_val[0]+m_val[1])*(v[0]+v[1]);
|
float t1 = (m_val[0]+m_val[1])*(v[0]+v[1]);
|
||||||
float t2 = (m_val[0]-m_val[1])*(v[2]+v[3]);
|
float t2 = (m_val[0]-m_val[1])*(v[2]+v[3]);
|
||||||
@@ -226,7 +226,7 @@ KRQuaternion& KRQuaternion::operator *=(const KRQuaternion& v) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion& KRQuaternion::operator *=(const float& v) {
|
Quaternion& Quaternion::operator *=(const float& v) {
|
||||||
m_val[0] *= v;
|
m_val[0] *= v;
|
||||||
m_val[1] *= v;
|
m_val[1] *= v;
|
||||||
m_val[2] *= v;
|
m_val[2] *= v;
|
||||||
@@ -234,7 +234,7 @@ KRQuaternion& KRQuaternion::operator *=(const float& v) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion& KRQuaternion::operator /=(const float& v) {
|
Quaternion& Quaternion::operator /=(const float& v) {
|
||||||
float inv_v = 1.0f / v;
|
float inv_v = 1.0f / v;
|
||||||
m_val[0] *= inv_v;
|
m_val[0] *= inv_v;
|
||||||
m_val[1] *= inv_v;
|
m_val[1] *= inv_v;
|
||||||
@@ -243,17 +243,17 @@ KRQuaternion& KRQuaternion::operator /=(const float& v) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::operator +() const {
|
Quaternion Quaternion::operator +() const {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::operator -() const {
|
Quaternion Quaternion::operator -() const {
|
||||||
return KRQuaternion(-m_val[0], -m_val[1], -m_val[2], -m_val[3]);
|
return Quaternion(-m_val[0], -m_val[1], -m_val[2], -m_val[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion Normalize(const KRQuaternion &v1) {
|
Quaternion Normalize(const Quaternion &v1) {
|
||||||
float inv_magnitude = 1.0f / sqrtf(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2] + v1[3] * v1[3]);
|
float inv_magnitude = 1.0f / sqrtf(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2] + v1[3] * v1[3]);
|
||||||
return KRQuaternion(
|
return Quaternion(
|
||||||
v1[0] * inv_magnitude,
|
v1[0] * inv_magnitude,
|
||||||
v1[1] * inv_magnitude,
|
v1[1] * inv_magnitude,
|
||||||
v1[2] * inv_magnitude,
|
v1[2] * inv_magnitude,
|
||||||
@@ -261,7 +261,7 @@ KRQuaternion Normalize(const KRQuaternion &v1) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRQuaternion::normalize() {
|
void Quaternion::normalize() {
|
||||||
float inv_magnitude = 1.0f / sqrtf(m_val[0] * m_val[0] + m_val[1] * m_val[1] + m_val[2] * m_val[2] + m_val[3] * m_val[3]);
|
float inv_magnitude = 1.0f / sqrtf(m_val[0] * m_val[0] + m_val[1] * m_val[1] + m_val[2] * m_val[2] + m_val[3] * m_val[3]);
|
||||||
m_val[0] *= inv_magnitude;
|
m_val[0] *= inv_magnitude;
|
||||||
m_val[1] *= inv_magnitude;
|
m_val[1] *= inv_magnitude;
|
||||||
@@ -269,17 +269,17 @@ void KRQuaternion::normalize() {
|
|||||||
m_val[3] *= inv_magnitude;
|
m_val[3] *= inv_magnitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion Conjugate(const KRQuaternion &v1) {
|
Quaternion Conjugate(const Quaternion &v1) {
|
||||||
return KRQuaternion(v1[0], -v1[1], -v1[2], -v1[3]);
|
return Quaternion(v1[0], -v1[1], -v1[2], -v1[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRQuaternion::conjugate() {
|
void Quaternion::conjugate() {
|
||||||
m_val[1] = -m_val[1];
|
m_val[1] = -m_val[1];
|
||||||
m_val[2] = -m_val[2];
|
m_val[2] = -m_val[2];
|
||||||
m_val[3] = -m_val[3];
|
m_val[3] = -m_val[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix4 KRQuaternion::rotationMatrix() const {
|
Matrix4 Quaternion::rotationMatrix() const {
|
||||||
Matrix4 matRotate;
|
Matrix4 matRotate;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -309,19 +309,19 @@ Matrix4 KRQuaternion::rotationMatrix() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::FromAngleAxis(const Vector3 &axis, float angle)
|
Quaternion Quaternion::FromAngleAxis(const Vector3 &axis, float angle)
|
||||||
{
|
{
|
||||||
float ha = angle * 0.5f;
|
float ha = angle * 0.5f;
|
||||||
float sha = sin(ha);
|
float sha = sin(ha);
|
||||||
return KRQuaternion(cos(ha), axis.x * sha, axis.y * sha, axis.z * sha);
|
return Quaternion(cos(ha), axis.x * sha, axis.y * sha, axis.z * sha);
|
||||||
}
|
}
|
||||||
|
|
||||||
float KRQuaternion::Dot(const KRQuaternion &v1, const KRQuaternion &v2)
|
float Quaternion::Dot(const Quaternion &v1, const Quaternion &v2)
|
||||||
{
|
{
|
||||||
return v1.m_val[0] * v2.m_val[0] + v1.m_val[1] * v2.m_val[1] + v1.m_val[2] * v2.m_val[2] + v1.m_val[3] * v2.m_val[3];
|
return v1.m_val[0] * v2.m_val[0] + v1.m_val[1] * v2.m_val[1] + v1.m_val[2] * v2.m_val[2] + v1.m_val[3] * v2.m_val[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::Lerp(const KRQuaternion &a, const KRQuaternion &b, float t)
|
Quaternion Quaternion::Lerp(const Quaternion &a, const Quaternion &b, float t)
|
||||||
{
|
{
|
||||||
if (t <= 0.0f) {
|
if (t <= 0.0f) {
|
||||||
return a;
|
return a;
|
||||||
@@ -332,7 +332,7 @@ KRQuaternion KRQuaternion::Lerp(const KRQuaternion &a, const KRQuaternion &b, fl
|
|||||||
return a * (1.0f - t) + b * t;
|
return a * (1.0f - t) + b * t;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRQuaternion KRQuaternion::Slerp(const KRQuaternion &a, const KRQuaternion &b, float t)
|
Quaternion Quaternion::Slerp(const Quaternion &a, const Quaternion &b, float t)
|
||||||
{
|
{
|
||||||
if (t <= 0.0f) {
|
if (t <= 0.0f) {
|
||||||
return a;
|
return a;
|
||||||
@@ -343,7 +343,7 @@ KRQuaternion KRQuaternion::Slerp(const KRQuaternion &a, const KRQuaternion &b, f
|
|||||||
}
|
}
|
||||||
|
|
||||||
float coshalftheta = Dot(a, b);
|
float coshalftheta = Dot(a, b);
|
||||||
KRQuaternion c = a;
|
Quaternion c = a;
|
||||||
|
|
||||||
// Angle is greater than 180. We can negate the angle/quat to get the
|
// Angle is greater than 180. We can negate the angle/quat to get the
|
||||||
// shorter rotation to reach the same destination.
|
// shorter rotation to reach the same destination.
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
<ClCompile Include="..\kraken\KRParticleSystem.cpp" />
|
<ClCompile Include="..\kraken\KRParticleSystem.cpp" />
|
||||||
<ClCompile Include="..\kraken\KRParticleSystemNewtonian.cpp" />
|
<ClCompile Include="..\kraken\KRParticleSystemNewtonian.cpp" />
|
||||||
<ClCompile Include="..\kraken\KRPointLight.cpp" />
|
<ClCompile Include="..\kraken\KRPointLight.cpp" />
|
||||||
<ClCompile Include="..\kraken\KRQuaternion.cpp" />
|
<ClCompile Include="..\kraken\quaternion.cpp" />
|
||||||
<ClCompile Include="..\kraken\KRRenderSettings.cpp" />
|
<ClCompile Include="..\kraken\KRRenderSettings.cpp" />
|
||||||
<ClCompile Include="..\kraken\KRResource+blend.cpp" />
|
<ClCompile Include="..\kraken\KRResource+blend.cpp" />
|
||||||
<ClCompile Include="..\kraken\KRResource+fbx.cpp" />
|
<ClCompile Include="..\kraken\KRResource+fbx.cpp" />
|
||||||
@@ -275,7 +275,7 @@
|
|||||||
<ClInclude Include="..\kraken\public\kraken.h" />
|
<ClInclude Include="..\kraken\public\kraken.h" />
|
||||||
<ClInclude Include="..\kraken\public\scalar.h" />
|
<ClInclude Include="..\kraken\public\scalar.h" />
|
||||||
<ClInclude Include="..\kraken\public\matrix4.h" />
|
<ClInclude Include="..\kraken\public\matrix4.h" />
|
||||||
<ClInclude Include="..\kraken\public\KRQuaternion.h" />
|
<ClInclude Include="..\kraken\public\quaternion.h" />
|
||||||
<ClInclude Include="..\kraken\public\KRTriangle3.h" />
|
<ClInclude Include="..\kraken\public\KRTriangle3.h" />
|
||||||
<ClInclude Include="..\kraken\public\vector2.h" />
|
<ClInclude Include="..\kraken\public\vector2.h" />
|
||||||
<ClInclude Include="..\kraken\public\vector3.h" />
|
<ClInclude Include="..\kraken\public\vector3.h" />
|
||||||
|
|||||||
@@ -42,9 +42,6 @@
|
|||||||
<ClCompile Include="..\kraken\KRViewport.cpp">
|
<ClCompile Include="..\kraken\KRViewport.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\kraken\KRQuaternion.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\kraken\KRDataBlock.cpp">
|
<ClCompile Include="..\kraken\KRDataBlock.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -252,6 +249,9 @@
|
|||||||
<ClCompile Include="..\kraken\matrix4.cpp">
|
<ClCompile Include="..\kraken\matrix4.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\kraken\quaternion.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\3rdparty\tinyxml2\tinyxml2.h">
|
<ClInclude Include="..\3rdparty\tinyxml2\tinyxml2.h">
|
||||||
@@ -482,9 +482,6 @@
|
|||||||
<ClInclude Include="..\kraken\public\KRTriangle3.h">
|
<ClInclude Include="..\kraken\public\KRTriangle3.h">
|
||||||
<Filter>Header Files\public</Filter>
|
<Filter>Header Files\public</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\kraken\public\KRQuaternion.h">
|
|
||||||
<Filter>Header Files\public</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\kraken\public\vector2.h">
|
<ClInclude Include="..\kraken\public\vector2.h">
|
||||||
<Filter>Header Files\public</Filter>
|
<Filter>Header Files\public</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -500,5 +497,8 @@
|
|||||||
<ClInclude Include="..\kraken\public\matrix4.h">
|
<ClInclude Include="..\kraken\public\matrix4.h">
|
||||||
<Filter>Header Files\public</Filter>
|
<Filter>Header Files\public</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\kraken\public\quaternion.h">
|
||||||
|
<Filter>Header Files\public</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user