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