godot/thirdparty/embree/common/math/affinespace.h

// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "linearspace2.h"
#include "linearspace3.h"
#include "quaternion.h"
#include "bbox.h"
#include "vec4.h"

namespace embree
{
  #define VectorT
  #define ScalarT

  ////////////////////////////////////////////////////////////////////////////////
  // Affine Space
  ////////////////////////////////////////////////////////////////////////////////

  template<typename L>
    struct AffineSpaceT
    {};
  
  // template specialization to get correct identity matrix for type AffineSpace3fa
  template<>
    __forceinline AffineSpaceT<LinearSpace3ff>::AffineSpaceT( OneTy )  :{}

  ////////////////////////////////////////////////////////////////////////////////
  // Unary Operators
  ////////////////////////////////////////////////////////////////////////////////

  template<typename L> __forceinline AffineSpaceT<L> operator -( const AffineSpaceT<L>& a ) {}
  template<typename L> __forceinline AffineSpaceT<L> operator +( const AffineSpaceT<L>& a ) {}
  template<typename L> __forceinline AffineSpaceT<L>        rcp( const AffineSpaceT<L>& a ) {}

  ////////////////////////////////////////////////////////////////////////////////
  // Binary Operators
  ////////////////////////////////////////////////////////////////////////////////

  template<typename L> __forceinline const AffineSpaceT<L> operator +( const AffineSpaceT<L>& a, const AffineSpaceT<L>& b ) {}
  template<typename L> __forceinline const AffineSpaceT<L> operator -( const AffineSpaceT<L>& a, const AffineSpaceT<L>& b ) {}

  template<typename L> __forceinline const AffineSpaceT<L> operator *( const ScalarT        & a, const AffineSpaceT<L>& b ) {}
  template<typename L> __forceinline const AffineSpaceT<L> operator *( const AffineSpaceT<L>& a, const AffineSpaceT<L>& b ) {}
  template<typename L> __forceinline const AffineSpaceT<L> operator /( const AffineSpaceT<L>& a, const AffineSpaceT<L>& b ) {}
  template<typename L> __forceinline const AffineSpaceT<L> operator /( const AffineSpaceT<L>& a, const ScalarT        & b ) {}

  template<typename L> __forceinline AffineSpaceT<L>& operator *=( AffineSpaceT<L>& a, const AffineSpaceT<L>& b ) {}
  template<typename L> __forceinline AffineSpaceT<L>& operator *=( AffineSpaceT<L>& a, const ScalarT        & b ) {}
  template<typename L> __forceinline AffineSpaceT<L>& operator /=( AffineSpaceT<L>& a, const AffineSpaceT<L>& b ) {}
  template<typename L> __forceinline AffineSpaceT<L>& operator /=( AffineSpaceT<L>& a, const ScalarT        & b ) {}

  template<typename L> __forceinline VectorT xfmPoint (const AffineSpaceT<L>& m, const VectorT& p) {}
  template<typename L> __forceinline VectorT xfmVector(const AffineSpaceT<L>& m, const VectorT& v) {}
  template<typename L> __forceinline VectorT xfmNormal(const AffineSpaceT<L>& m, const VectorT& n) {}

  __forceinline const BBox<Vec3fa> xfmBounds(const AffineSpaceT<LinearSpace3<Vec3fa> >& m, const BBox<Vec3fa>& b) 
  {}

  ////////////////////////////////////////////////////////////////////////////////
  /// Comparison Operators
  ////////////////////////////////////////////////////////////////////////////////

  template<typename L> __forceinline bool operator ==( const AffineSpaceT<L>& a, const AffineSpaceT<L>& b ) {}
  template<typename L> __forceinline bool operator !=( const AffineSpaceT<L>& a, const AffineSpaceT<L>& b ) {}

  ////////////////////////////////////////////////////////////////////////////////
  /// Select
  ////////////////////////////////////////////////////////////////////////////////

  template<typename L> __forceinline AffineSpaceT<L> select ( const typename L::Vector::Scalar::Bool& s, const AffineSpaceT<L>& t, const AffineSpaceT<L>& f ) {}

  ////////////////////////////////////////////////////////////////////////////////
  // Output Operators
  ////////////////////////////////////////////////////////////////////////////////

  template<typename L> static embree_ostream operator<<(embree_ostream cout, const AffineSpaceT<L>& m) {}

  ////////////////////////////////////////////////////////////////////////////////
  // Template Instantiations
  ////////////////////////////////////////////////////////////////////////////////

  AffineSpace2f;
  AffineSpace3f;
  AffineSpace3fa;
  AffineSpace3fx;
  AffineSpace3ff;
  OrthonormalSpace3f;

  AffineSpace3vf;
  AffineSpace3vf4;
  AffineSpace3vf8;
  AffineSpace3vf16;

  AffineSpace3vff;
  AffineSpace3vfa4;
  AffineSpace3vfa8;
  AffineSpace3vfa16;

  //////////////////////////////////////////////////////////////////////////////
  /// Interpolation
  //////////////////////////////////////////////////////////////////////////////
  template<typename T, typename R>
  __forceinline AffineSpaceT<T> lerp(const AffineSpaceT<T>& M0,
                                     const AffineSpaceT<T>& M1,
                                     const R& t)
  {}

  // slerp interprets the 16 floats of the matrix M = D * R * S as components of
  // three matrizes (D, R, S) that are interpolated individually.
  template<typename T> __forceinline AffineSpaceT<LinearSpace3<Vec3<T>>>
  slerp(const AffineSpaceT<LinearSpace3<Vec4<T>>>& M0,
        const AffineSpaceT<LinearSpace3<Vec4<T>>>& M1,
        const T& t)
  {}

  // this is a specialized version for Vec3fa because that does
  // not play along nicely with the other templated Vec3/Vec4 types
  __forceinline AffineSpace3fa slerp(const AffineSpace3ff& M0,
                                     const AffineSpace3ff& M1,
                                     const float& t)
  {}
  
  __forceinline AffineSpace3fa quaternionDecompositionToAffineSpace(const AffineSpace3ff& qd)
  {}
  
  __forceinline void quaternionDecomposition(const AffineSpace3ff& qd, Vec3fa& T, Quaternion3f& q, AffineSpace3fa& S)
  {}

  __forceinline AffineSpace3fx quaternionDecomposition(Vec3fa const& T, Quaternion3f const& q, AffineSpace3fa const& S)
  {}

  struct __aligned(16) QuaternionDecomposition
  {};

  __forceinline QuaternionDecomposition quaternionDecomposition(AffineSpace3ff const& M)
  {}

  ////////////////////////////////////////////////////////////////////////////////
  /*
   * ! Template Specialization for 2D: return matrix for rotation around point
   * (rotation around arbitrarty vector is not meaningful in 2D)
   */
  template<> __forceinline
  AffineSpace2f AffineSpace2f::rotate(const Vec2f& p, const float& r) {}

  ////////////////////////////////////////////////////////////////////////////////
  // Similarity Transform
  //
  // checks, if M is a similarity transformation, i.e if there exists a factor D
  // such that for all x,y: distance(Mx, My) = D * distance(x, y)
  ////////////////////////////////////////////////////////////////////////////////
  __forceinline bool similarityTransform(const AffineSpace3fa& M, float* D)
  {}
  
  __forceinline void AffineSpace3fa_store_unaligned(const AffineSpace3fa &source, AffineSpace3fa* ptr)
  {}

  __forceinline AffineSpace3fa AffineSpace3fa_load_unaligned(AffineSpace3fa* ptr)
  {}

  #undef VectorT
  #undef ScalarT
}