ホーム › Graphics.Direct3D11 › D3D11_VIEWPORT
D3D11_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、範囲は0.0〜1.0である。 |
| MaxDepth | FLOAT | 4 | +20 | +20 | 深度の最大値。通常1.0、範囲は0.0〜1.0である。 |
各言語での定義
#include <windows.h>
// D3D11_VIEWPORT (x64 24 / x86 24 バイト)
typedef struct D3D11_VIEWPORT {
FLOAT TopLeftX;
FLOAT TopLeftY;
FLOAT Width;
FLOAT Height;
FLOAT MinDepth;
FLOAT MaxDepth;
} D3D11_VIEWPORT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D11_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 D3D11_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 D3D11_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 D3D11_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 D3D11_VIEWPORT struct {
TopLeftX float32
TopLeftY float32
Width float32
Height float32
MinDepth float32
MaxDepth float32
}type
D3D11_VIEWPORT = record
TopLeftX: Single;
TopLeftY: Single;
Width: Single;
Height: Single;
MinDepth: Single;
MaxDepth: Single;
end;const D3D11_VIEWPORT = extern struct {
TopLeftX: f32,
TopLeftY: f32,
Width: f32,
Height: f32,
MinDepth: f32,
MaxDepth: f32,
};type
D3D11_VIEWPORT {.bycopy.} = object
TopLeftX: float32
TopLeftY: float32
Width: float32
Height: float32
MinDepth: float32
MaxDepth: float32struct D3D11_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 レイアウト)
; D3D11_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 D3D11_VIEWPORT
#field float TopLeftX
#field float TopLeftY
#field float Width
#field float Height
#field float MinDepth
#field float MaxDepth
#endstruct
stdim st, D3D11_VIEWPORT ; NSTRUCT 変数を確保
st->TopLeftX = 100
mes "TopLeftX=" + st->TopLeftX