ホーム › Graphics.Direct3D11 › D3D11_BOX
D3D11_BOX
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| left | DWORD | 4 | +0 | +0 | ボックスの左辺の x 位置です。 |
| top | DWORD | 4 | +4 | +4 | ボックスの上辺の y 位置です。 |
| front | DWORD | 4 | +8 | +8 | ボックスの前面の z 位置です。 |
| right | DWORD | 4 | +12 | +12 | ボックスの右辺の x 位置です。 |
| bottom | DWORD | 4 | +16 | +16 | ボックスの下辺の y 位置です。 |
| back | DWORD | 4 | +20 | +20 | ボックスの背面の z 位置です。 |
公式ドキュメント
3D のボックスを定義します。
解説(Remarks)
次の図は、左・前・上の角を原点とする 3D のボックスを示しています。
right、bottom、back の値は、いずれもボックス領域に含まれるピクセルの終端から 1 ピクセル先を指します。つまり、left、top、front の値はボックス領域に含まれますが、right、bottom、back の値はボックス領域から除外されます。たとえば幅が 1 ピクセルのボックスでは、(right - left) == 1 となり、ボックス領域には左のピクセルが含まれますが右のピクセルは含まれません。
ボックスの座標は、バッファーの場合はバイト単位、テクスチャの場合はテクセル単位です。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// D3D11_BOX (x64 24 / x86 24 バイト)
typedef struct D3D11_BOX {
DWORD left;
DWORD top;
DWORD front;
DWORD right;
DWORD bottom;
DWORD back;
} D3D11_BOX;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D11_BOX
{
public uint left;
public uint top;
public uint front;
public uint right;
public uint bottom;
public uint back;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D11_BOX
Public left As UInteger
Public top As UInteger
Public front As UInteger
Public right As UInteger
Public bottom As UInteger
Public back As UInteger
End Structureimport ctypes
from ctypes import wintypes
class D3D11_BOX(ctypes.Structure):
_fields_ = [
("left", wintypes.DWORD),
("top", wintypes.DWORD),
("front", wintypes.DWORD),
("right", wintypes.DWORD),
("bottom", wintypes.DWORD),
("back", wintypes.DWORD),
]#[repr(C)]
pub struct D3D11_BOX {
pub left: u32,
pub top: u32,
pub front: u32,
pub right: u32,
pub bottom: u32,
pub back: u32,
}import "golang.org/x/sys/windows"
type D3D11_BOX struct {
left uint32
top uint32
front uint32
right uint32
bottom uint32
back uint32
}type
D3D11_BOX = record
left: DWORD;
top: DWORD;
front: DWORD;
right: DWORD;
bottom: DWORD;
back: DWORD;
end;const D3D11_BOX = extern struct {
left: u32,
top: u32,
front: u32,
right: u32,
bottom: u32,
back: u32,
};type
D3D11_BOX {.bycopy.} = object
left: uint32
top: uint32
front: uint32
right: uint32
bottom: uint32
back: uint32struct D3D11_BOX
{
uint left;
uint top;
uint front;
uint right;
uint bottom;
uint back;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D11_BOX サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; left : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; top : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; front : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; right : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; bottom : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; back : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D11_BOX
#field int left
#field int top
#field int front
#field int right
#field int bottom
#field int back
#endstruct
stdim st, D3D11_BOX ; NSTRUCT 変数を確保
st->left = 100
mes "left=" + st->left