Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:31

0001 #pragma once
0002 
0003 #include <glm/glm.hpp>
0004 #include "scuda.h"
0005 #include <vector>
0006 
0007 struct SCE
0008 {
0009     template<typename T>
0010     static void Corners(std::vector<glm::tvec4<T>>& corners, const glm::tvec4<T>& _ce ); 
0011     static void Corners(std::vector<float4>& corners, const float4& _ce ); 
0012 
0013     template<typename T>
0014     static void Midface(std::vector<glm::tvec4<T>>& midface, const glm::tvec4<T>& _ce ); 
0015     static void Midface(std::vector<float4>& midface, const float4& _ce ); 
0016 
0017 };
0018 
0019 /**
0020 SCE::Corners
0021 -------------
0022 
0023 ::
0024 
0025      ZYX 
0026    0:000    
0027    1:001    +X
0028    2:010    +Y
0029    3:011
0030    4:100    +Z
0031    5:101
0032    6:110
0033    7:111
0034 
0035 
0036                110----------111         
0037                 |            |
0038                 |            |
0039   +Z   100----------101      | 
0040         |       |    |       | 
0041         |       |    |       |
0042         |      010---|------011       +Y
0043         |            | 
0044         |            | 
0045   -Z   000----------001        -Y        
0046                 
0047        -X           +X
0048 
0049 
0050 
0051 **/
0052 
0053 template<typename T>
0054 inline void SCE::Corners(std::vector<glm::tvec4<T>>& corners, const glm::tvec4<T>& _ce ) // static
0055 {
0056     for(int c=0 ; c < 8 ; c++) corners.push_back({  
0057                _ce.x + ( c & 1 ? _ce.w : -_ce.w ),
0058                _ce.y + ( c & 2 ? _ce.w : -_ce.w ),
0059                _ce.z + ( c & 4 ? _ce.w : -_ce.w ),
0060                T(1)
0061             }) ;
0062 }
0063 
0064 inline void SCE::Corners(std::vector<float4>& corners, const float4& _ce ) // static
0065 {
0066     typedef float T ; 
0067     for(int c=0 ; c < 8 ; c++) corners.push_back({  
0068                _ce.x + ( c & 1 ? _ce.w : -_ce.w ),
0069                _ce.y + ( c & 2 ? _ce.w : -_ce.w ),
0070                _ce.z + ( c & 4 ? _ce.w : -_ce.w ),
0071                T(1)
0072             }) ;
0073 }
0074 
0075 
0076 template<typename T>
0077 inline void SCE::Midface(std::vector<glm::tvec4<T>>& midface, const glm::tvec4<T>& _ce ) // static
0078 {
0079     for(int i=0 ; i < 3 ; i++) for(int j=0 ; j < 2 ; j++)
0080     {
0081         T sign = ( j == 0 ? T(-1) : T(1) ) ; 
0082         midface.push_back({
0083                                  _ce.x + ( i == 0 ? sign*_ce.w : T(0) ), 
0084                                  _ce.y + ( i == 1 ? sign*_ce.w : T(0) ),   
0085                                  _ce.z + ( i == 2 ? sign*_ce.w : T(0) ),
0086                                  T(1)
0087                               });
0088         
0089     }
0090     midface.push_back({ _ce.x, _ce.y, _ce.z, T(1) });   
0091 }
0092 
0093 
0094 
0095 inline void SCE::Midface(std::vector<float4>& midface, const float4& _ce ) // static
0096 {
0097     typedef float T ; 
0098     for(int i=0 ; i < 3 ; i++) for(int j=0 ; j < 2 ; j++)
0099     {
0100         T sign = ( j == 0 ? T(-1) : T(1) ) ; 
0101         midface.push_back({
0102                                  _ce.x + ( i == 0 ? sign*_ce.w : T(0) ), 
0103                                  _ce.y + ( i == 1 ? sign*_ce.w : T(0) ),   
0104                                  _ce.z + ( i == 2 ? sign*_ce.w : T(0) ),
0105                                  T(1)
0106                               });
0107         
0108     }
0109     midface.push_back({ _ce.x, _ce.y, _ce.z, T(1) });   
0110 }
0111 
0112