2025-08-02 12:09:34 +08:00
|
|
|
|
---
|
|
|
|
|
title: DirectX12学习笔记(1)——DirectXMath库
|
|
|
|
|
date: 2023-03-01 19:39:43
|
|
|
|
|
excerpt:
|
|
|
|
|
tags:
|
|
|
|
|
rating: ⭐
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
DXM库利用**SIMD(单指令多数据)** 可以仅使用一条指令就同时完成多个数据的运算或处理。
|
|
|
|
|
|
|
|
|
|
# 向量
|
|
|
|
|
需要包含头文件
|
|
|
|
|
```c++
|
|
|
|
|
#include <DirectXMath.h>
|
|
|
|
|
#include <DirectXPackedVector.h>
|
|
|
|
|
```
|
|
|
|
|
`DirectXPackedVector.h`的代码主要位于`DirectX::PackedVector`中。
|
|
|
|
|
|
|
|
|
|
## Type
|
|
|
|
|
- XMVECTOR
|
|
|
|
|
- XMFLOAT2
|
|
|
|
|
- XMFLOAT3
|
|
|
|
|
- XMFLOAT4
|
|
|
|
|
|
|
|
|
|
## Method
|
|
|
|
|
- XMLoadFloat():XMFLOAT =>XMVECTOR
|
|
|
|
|
- XMStoreFloat():XMVECTOR => XMFLOAT
|
|
|
|
|
- XMVectorGet()
|
|
|
|
|
- XMVectorSet()
|
|
|
|
|
|
|
|
|
|
# 矩阵
|
|
|
|
|
## Type
|
|
|
|
|
- XMMATRIX:代表一个4x4矩阵
|
|
|
|
|
|
|
|
|
|
## Method
|
2025-10-01 11:50:31 +08:00
|
|
|
|
- XMMAtrixSet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 杂项
|
|
|
|
|
- XMVerifyCPUSupport():检查是否支持SSE2指令集。需要#include <windows.h>
|
|
|
|
|
- XMVector3NearEqual():判断是否数值接近。
|