godot/thirdparty/embree/include/embree3/rtcore_quaternion.h
jfons 767e374dce Upgrade Embree to the latest official release.
Since Embree v3.13.0 supports AARCH64, switch back to the
official repo instead of using Embree-aarch64.

`thirdparty/embree/patches/godot-changes.patch` should now contain
an accurate diff of the changes done to the library.
2021-05-21 17:00:24 +02:00

102 lines
2.4 KiB
C++

// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "rtcore_common.h"
RTC_NAMESPACE_BEGIN
/*
* Structure for transformation respresentation as a matrix decomposition using
* a quaternion
*/
struct RTC_ALIGN(16) RTCQuaternionDecomposition
{
float scale_x;
float scale_y;
float scale_z;
float skew_xy;
float skew_xz;
float skew_yz;
float shift_x;
float shift_y;
float shift_z;
float quaternion_r;
float quaternion_i;
float quaternion_j;
float quaternion_k;
float translation_x;
float translation_y;
float translation_z;
};
RTC_FORCEINLINE void rtcInitQuaternionDecomposition(struct RTCQuaternionDecomposition* qdecomp)
{
qdecomp->scale_x = 1.f;
qdecomp->scale_y = 1.f;
qdecomp->scale_z = 1.f;
qdecomp->skew_xy = 0.f;
qdecomp->skew_xz = 0.f;
qdecomp->skew_yz = 0.f;
qdecomp->shift_x = 0.f;
qdecomp->shift_y = 0.f;
qdecomp->shift_z = 0.f;
qdecomp->quaternion_r = 1.f;
qdecomp->quaternion_i = 0.f;
qdecomp->quaternion_j = 0.f;
qdecomp->quaternion_k = 0.f;
qdecomp->translation_x = 0.f;
qdecomp->translation_y = 0.f;
qdecomp->translation_z = 0.f;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetQuaternion(
struct RTCQuaternionDecomposition* qdecomp,
float r, float i, float j, float k)
{
qdecomp->quaternion_r = r;
qdecomp->quaternion_i = i;
qdecomp->quaternion_j = j;
qdecomp->quaternion_k = k;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetScale(
struct RTCQuaternionDecomposition* qdecomp,
float scale_x, float scale_y, float scale_z)
{
qdecomp->scale_x = scale_x;
qdecomp->scale_y = scale_y;
qdecomp->scale_z = scale_z;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetSkew(
struct RTCQuaternionDecomposition* qdecomp,
float skew_xy, float skew_xz, float skew_yz)
{
qdecomp->skew_xy = skew_xy;
qdecomp->skew_xz = skew_xz;
qdecomp->skew_yz = skew_yz;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetShift(
struct RTCQuaternionDecomposition* qdecomp,
float shift_x, float shift_y, float shift_z)
{
qdecomp->shift_x = shift_x;
qdecomp->shift_y = shift_y;
qdecomp->shift_z = shift_z;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetTranslation(
struct RTCQuaternionDecomposition* qdecomp,
float translation_x, float translation_y, float translation_z)
{
qdecomp->translation_x = translation_x;
qdecomp->translation_y = translation_y;
qdecomp->translation_z = translation_z;
}
RTC_NAMESPACE_END