ホーム › Graphics.Direct3D11 › D3D11_VIEWPORT
D3D11_VIEWPORT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| TopLeftX | FLOAT | 4 | +0 | +0 | ビューポートの左端の X 位置です。D3D11_VIEWPORT_BOUNDS_MIN から D3D11_VIEWPORT_BOUNDS_MAX までの範囲を取ります。 |
| TopLeftY | FLOAT | 4 | +4 | +4 | ビューポートの上端の Y 位置です。D3D11_VIEWPORT_BOUNDS_MIN から D3D11_VIEWPORT_BOUNDS_MAX までの範囲を取ります。 |
| Width | FLOAT | 4 | +8 | +8 | ビューポートの幅です。 |
| Height | FLOAT | 4 | +12 | +12 | ビューポートの高さです。 |
| MinDepth | FLOAT | 4 | +16 | +16 | ビューポートの最小深度です。0 から 1 までの範囲を取ります。 |
| MaxDepth | FLOAT | 4 | +20 | +20 | ビューポートの最大深度です。0 から 1 までの範囲を取ります。 |
公式ドキュメント
ビューポートの寸法を定義します。
解説(Remarks)
いずれの場合も、Width と Height は >= 0 でなければならず、TopLeftX + Width および TopLeftY + Height は <= D3D11_VIEWPORT_BOUNDS_MAX でなければなりません。
|
Direct3D 11 と Direct3D 10 におけるビューポートのサイズと機能レベルのサポートの違い:
ビューポートの最小サイズと最大サイズの範囲は、D3D_FEATURE_LEVEL で定義される機能レベルに依存します。
|
メモ 機能レベル 9_x に対する ID3D11DeviceContext::RSSetViewports の呼び出しで pViewports 配列の D3D11_VIEWPORT 構造体のメンバーに float 値を指定した場合でも、RSSetViewports は内部的に DWORD を使用します。この動作のため、ビューポートの左上隅に負の値を使用すると、機能レベル 9_x に対する RSSetViewports の呼び出しは失敗します。この失敗は、9_x 用の RSSetViewports が浮動小数点値を検証せずに符号なし整数にキャストし、整数オーバーフローが発生するために起こります。
出典・ライセンス: 上記「公式ドキュメント」の内容は 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_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