ホーム › Graphics.Direct3D10 › D3D10_VIEWPORT
D3D10_VIEWPORT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| TopLeftX | INT | 4 | +0 | +0 | ビューポート左上隅のX座標(ピクセル単位)。整数値で指定する。 |
| TopLeftY | INT | 4 | +4 | +4 | ビューポート左上隅のY座標(ピクセル単位)。整数値で指定する。 |
| Width | DWORD | 4 | +8 | +8 | ビューポートの幅(ピクセル単位)。 |
| Height | DWORD | 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>
// D3D10_VIEWPORT (x64 24 / x86 24 バイト)
typedef struct D3D10_VIEWPORT {
INT TopLeftX;
INT TopLeftY;
DWORD Width;
DWORD Height;
FLOAT MinDepth;
FLOAT MaxDepth;
} D3D10_VIEWPORT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D10_VIEWPORT
{
public int TopLeftX;
public int TopLeftY;
public uint Width;
public uint Height;
public float MinDepth;
public float MaxDepth;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D10_VIEWPORT
Public TopLeftX As Integer
Public TopLeftY As Integer
Public Width As UInteger
Public Height As UInteger
Public MinDepth As Single
Public MaxDepth As Single
End Structureimport ctypes
from ctypes import wintypes
class D3D10_VIEWPORT(ctypes.Structure):
_fields_ = [
("TopLeftX", ctypes.c_int),
("TopLeftY", ctypes.c_int),
("Width", wintypes.DWORD),
("Height", wintypes.DWORD),
("MinDepth", ctypes.c_float),
("MaxDepth", ctypes.c_float),
]#[repr(C)]
pub struct D3D10_VIEWPORT {
pub TopLeftX: i32,
pub TopLeftY: i32,
pub Width: u32,
pub Height: u32,
pub MinDepth: f32,
pub MaxDepth: f32,
}import "golang.org/x/sys/windows"
type D3D10_VIEWPORT struct {
TopLeftX int32
TopLeftY int32
Width uint32
Height uint32
MinDepth float32
MaxDepth float32
}type
D3D10_VIEWPORT = record
TopLeftX: Integer;
TopLeftY: Integer;
Width: DWORD;
Height: DWORD;
MinDepth: Single;
MaxDepth: Single;
end;const D3D10_VIEWPORT = extern struct {
TopLeftX: i32,
TopLeftY: i32,
Width: u32,
Height: u32,
MinDepth: f32,
MaxDepth: f32,
};type
D3D10_VIEWPORT {.bycopy.} = object
TopLeftX: int32
TopLeftY: int32
Width: uint32
Height: uint32
MinDepth: float32
MaxDepth: float32struct D3D10_VIEWPORT
{
int TopLeftX;
int TopLeftY;
uint Width;
uint 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 レイアウト)
; D3D10_VIEWPORT サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; TopLeftX : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; TopLeftY : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Width : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Height : DWORD (+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 D3D10_VIEWPORT
#field int TopLeftX
#field int TopLeftY
#field int Width
#field int Height
#field float MinDepth
#field float MaxDepth
#endstruct
stdim st, D3D10_VIEWPORT ; NSTRUCT 変数を確保
st->TopLeftX = 100
mes "TopLeftX=" + st->TopLeftX