ホーム › Graphics.Direct3D12 › D3D12_VIEWPORT
D3D12_VIEWPORT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| TopLeftX | FLOAT | 4 | +0 | +0 | ビューポート左上のX座標(ピクセル)。 |
| TopLeftY | FLOAT | 4 | +4 | +4 | ビューポート左上のY座標(ピクセル)。 |
| Width | FLOAT | 4 | +8 | +8 | ビューポートの幅(ピクセル)。 |
| Height | FLOAT | 4 | +12 | +12 | ビューポートの高さ(ピクセル)。 |
| MinDepth | FLOAT | 4 | +16 | +16 | 深度範囲の最小値。通常0.0。 |
| MaxDepth | FLOAT | 4 | +20 | +20 | 深度範囲の最大値。通常1.0。 |
各言語での定義
#include <windows.h>
// D3D12_VIEWPORT (x64 24 / x86 24 バイト)
typedef struct D3D12_VIEWPORT {
FLOAT TopLeftX;
FLOAT TopLeftY;
FLOAT Width;
FLOAT Height;
FLOAT MinDepth;
FLOAT MaxDepth;
} D3D12_VIEWPORT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIEWPORT
{
public float TopLeftX;
public float TopLeftY;
public float Width;
public float Height;
public float MinDepth;
public float MaxDepth;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIEWPORT
Public TopLeftX As Single
Public TopLeftY As Single
Public Width As Single
Public Height As Single
Public MinDepth As Single
Public MaxDepth As Single
End Structureimport ctypes
from ctypes import wintypes
class D3D12_VIEWPORT(ctypes.Structure):
_fields_ = [
("TopLeftX", ctypes.c_float),
("TopLeftY", ctypes.c_float),
("Width", ctypes.c_float),
("Height", ctypes.c_float),
("MinDepth", ctypes.c_float),
("MaxDepth", ctypes.c_float),
]#[repr(C)]
pub struct D3D12_VIEWPORT {
pub TopLeftX: f32,
pub TopLeftY: f32,
pub Width: f32,
pub Height: f32,
pub MinDepth: f32,
pub MaxDepth: f32,
}import "golang.org/x/sys/windows"
type D3D12_VIEWPORT struct {
TopLeftX float32
TopLeftY float32
Width float32
Height float32
MinDepth float32
MaxDepth float32
}type
D3D12_VIEWPORT = record
TopLeftX: Single;
TopLeftY: Single;
Width: Single;
Height: Single;
MinDepth: Single;
MaxDepth: Single;
end;const D3D12_VIEWPORT = extern struct {
TopLeftX: f32,
TopLeftY: f32,
Width: f32,
Height: f32,
MinDepth: f32,
MaxDepth: f32,
};type
D3D12_VIEWPORT {.bycopy.} = object
TopLeftX: float32
TopLeftY: float32
Width: float32
Height: float32
MinDepth: float32
MaxDepth: float32struct D3D12_VIEWPORT
{
float TopLeftX;
float TopLeftY;
float Width;
float Height;
float MinDepth;
float MaxDepth;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_VIEWPORT サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; TopLeftX : FLOAT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; TopLeftY : FLOAT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Width : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Height : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; MinDepth : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; MaxDepth : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D12_VIEWPORT
#field float TopLeftX
#field float TopLeftY
#field float Width
#field float Height
#field float MinDepth
#field float MaxDepth
#endstruct
stdim st, D3D12_VIEWPORT ; NSTRUCT 変数を確保
st->TopLeftX = 100
mes "TopLeftX=" + st->TopLeftX