Fonction XMSHORTN4::XMSHORTN4(constfloat*) (directxpackedvector.h)
Initialise une nouvelle instance de XMSHORTN4 à partir d’un argument de tableau de quatre élémentsfloat
.
Ce constructeur initialise une nouvelle instance de XMSHORTN4 à partir d’un argument de tableau à quatre élémentsfloat
.
Syntaxe
void XMSHORTN4(
const float *pArray
) noexcept;
Paramètres
pArray
Tableau à virgule flottante à quatre éléments contenant les valeurs utilisées pour initialiser les quatre composants d’un nouveau instance de XMSHORTN4.
Valeur de retour
None
Notes
Les éléments tableaux sont mappés aux composants vectoriels d’une nouvelle instance de XMSHORTN4 comme suit :
Composant Vector | Élément Array | Plage | Description |
---|---|---|---|
x | pArray[0] | -1.0, 1.0 | Pendant l’instanciation, pArray[0] est serré entre -1 et 1, multiplié par 32767.0f et affecté à x. |
y | pArray[1] | -1.0, 1.0 | Pendant l’instanciation, pArray[1] est serré entre -1 et 1, multiplié par 32767.0f, puis affecté à y. |
z | pArray[2] | -1.0, 1.0 | Pendant l’instanciation, pArray[2] est serré entre -1 et 1, multiplié par 32767.0f, puis affecté à z. |
w | pArray[3] | -1.0, 1.0 | Pendant l’instanciation, pArray[3] est serré entre -1 et 1, multiplié par 32767.0f, puis affecté à w. |
Le pseudocode suivant illustre le fonctionnement de ce constructeur :
XMSHORTN4 instance;
_x1=min( max( pArray[0], -1.0 ), 1.0 );
_y1=min( max( pArray[1], -1.0 ), 1.0 );
_z1=min( max( pArray[2], -1.0 ), 1.0 );
_w1=min( max( pArray[3], -1.0 ), 1.0 );
_x1 = round( _x1 * 32767.0f);
_y1 = round( _y1 * 32767.0f);
_z1 = round( _z1 * 32767.0f);
_w1 = round( _w1 * 32767.0f);
instance._x = _x1;
instance._y = _y1;
instance._z = _z1;
instance._w = _w1;
Spécifications
Plateforme cible | Windows |
En-tête | directxpackedvector.h |
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour