Win32 API 日本語リファレンス
ホームGraphics.Direct3D12 › D3D12_BOX

D3D12_BOX

構造体
サイズx64: 24 バイト / x86: 24 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
leftDWORD4+0+0ボックスの左端の x 座標です。
topDWORD4+4+4ボックスの上端の y 座標です。
frontDWORD4+8+8ボックスの前面の z 座標です。
rightDWORD4+12+12ボックスの右端の x 座標に 1 を加えた値です。つまり right - left がボックスの幅と等しくなります。
bottomDWORD4+16+16ボックスの下端の y 座標に 1 を加えた値です。つまり bottom - top がボックスの高さと等しくなります。
backDWORD4+20+20ボックスの背面の z 座標に 1 を加えた値です。つまり back - front がボックスの奥行きと等しくなります。

公式ドキュメント

3D のボックスを表します。

解説(Remarks)

この構造体は、WriteToSubresourceReadFromSubresourceCopyTextureRegion の各メソッドで使用されます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// D3D12_BOX  (x64 24 / x86 24 バイト)
typedef struct D3D12_BOX {
    DWORD left;
    DWORD top;
    DWORD front;
    DWORD right;
    DWORD bottom;
    DWORD back;
} D3D12_BOX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_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 D3D12_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 Structure
import ctypes
from ctypes import wintypes

class D3D12_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 D3D12_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 D3D12_BOX struct {
	left uint32
	top uint32
	front uint32
	right uint32
	bottom uint32
	back uint32
}
type
  D3D12_BOX = record
    left: DWORD;
    top: DWORD;
    front: DWORD;
    right: DWORD;
    bottom: DWORD;
    back: DWORD;
  end;
const D3D12_BOX = extern struct {
    left: u32,
    top: u32,
    front: u32,
    right: u32,
    bottom: u32,
    back: u32,
};
type
  D3D12_BOX {.bycopy.} = object
    left: uint32
    top: uint32
    front: uint32
    right: uint32
    bottom: uint32
    back: uint32
struct D3D12_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 レイアウト)
; D3D12_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 D3D12_BOX
    #field int left
    #field int top
    #field int front
    #field int right
    #field int bottom
    #field int back
#endstruct

stdim st, D3D12_BOX        ; NSTRUCT 変数を確保
st->left = 100
mes "left=" + st->left