Win32 API 日本語リファレンス
ホームGraphics.Direct3D9 › D3DTRANSFORMDATA

D3DTRANSFORMDATA

構造体
サイズx64: 80 バイト / x86: 52 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0本構造体のサイズ(バイト単位)。
lpInvoid*8/4+8+4入力頂点データを指すポインタ。
dwInSizeDWORD4+16+8入力頂点1個あたりのサイズ(バイト単位)。
lpOutvoid*8/4+24+12変換後出力頂点データを格納するポインタ。
dwOutSizeDWORD4+32+16出力頂点1個あたりのサイズ(バイト単位)。
lpHOutD3DHVERTEX*8/4+40+20同次出力頂点(D3DHVERTEX)を格納するポインタ。
dwClipDWORD4+48+24クリップ処理に関するフラグ。
dwClipIntersectionDWORD4+52+28全頂点のクリップフラグの論理積。
dwClipUnionDWORD4+56+32全頂点のクリップフラグの論理和。
drExtentD3DRECT16+60+36変換結果の包含矩形(D3DRECT)。

各言語での定義

#include <windows.h>

// D3DRECT  (x64 16 / x86 16 バイト)
typedef struct D3DRECT {
    INT x1;
    INT y1;
    INT x2;
    INT y2;
} D3DRECT;

// D3DTRANSFORMDATA  (x64 80 / x86 52 バイト)
typedef struct D3DTRANSFORMDATA {
    DWORD dwSize;
    void* lpIn;
    DWORD dwInSize;
    void* lpOut;
    DWORD dwOutSize;
    D3DHVERTEX* lpHOut;
    DWORD dwClip;
    DWORD dwClipIntersection;
    DWORD dwClipUnion;
    D3DRECT drExtent;
} D3DTRANSFORMDATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DRECT
{
    public int x1;
    public int y1;
    public int x2;
    public int y2;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DTRANSFORMDATA
{
    public uint dwSize;
    public IntPtr lpIn;
    public uint dwInSize;
    public IntPtr lpOut;
    public uint dwOutSize;
    public IntPtr lpHOut;
    public uint dwClip;
    public uint dwClipIntersection;
    public uint dwClipUnion;
    public D3DRECT drExtent;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DRECT
    Public x1 As Integer
    Public y1 As Integer
    Public x2 As Integer
    Public y2 As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DTRANSFORMDATA
    Public dwSize As UInteger
    Public lpIn As IntPtr
    Public dwInSize As UInteger
    Public lpOut As IntPtr
    Public dwOutSize As UInteger
    Public lpHOut As IntPtr
    Public dwClip As UInteger
    Public dwClipIntersection As UInteger
    Public dwClipUnion As UInteger
    Public drExtent As D3DRECT
End Structure
import ctypes
from ctypes import wintypes

class D3DRECT(ctypes.Structure):
    _fields_ = [
        ("x1", ctypes.c_int),
        ("y1", ctypes.c_int),
        ("x2", ctypes.c_int),
        ("y2", ctypes.c_int),
    ]

class D3DTRANSFORMDATA(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("lpIn", ctypes.c_void_p),
        ("dwInSize", wintypes.DWORD),
        ("lpOut", ctypes.c_void_p),
        ("dwOutSize", wintypes.DWORD),
        ("lpHOut", ctypes.c_void_p),
        ("dwClip", wintypes.DWORD),
        ("dwClipIntersection", wintypes.DWORD),
        ("dwClipUnion", wintypes.DWORD),
        ("drExtent", D3DRECT),
    ]
#[repr(C)]
pub struct D3DRECT {
    pub x1: i32,
    pub y1: i32,
    pub x2: i32,
    pub y2: i32,
}

#[repr(C)]
pub struct D3DTRANSFORMDATA {
    pub dwSize: u32,
    pub lpIn: *mut core::ffi::c_void,
    pub dwInSize: u32,
    pub lpOut: *mut core::ffi::c_void,
    pub dwOutSize: u32,
    pub lpHOut: *mut core::ffi::c_void,
    pub dwClip: u32,
    pub dwClipIntersection: u32,
    pub dwClipUnion: u32,
    pub drExtent: D3DRECT,
}
import "golang.org/x/sys/windows"

type D3DRECT struct {
	x1 int32
	y1 int32
	x2 int32
	y2 int32
}

type D3DTRANSFORMDATA struct {
	dwSize uint32
	lpIn uintptr
	dwInSize uint32
	lpOut uintptr
	dwOutSize uint32
	lpHOut uintptr
	dwClip uint32
	dwClipIntersection uint32
	dwClipUnion uint32
	drExtent D3DRECT
}
type
  D3DRECT = record
    x1: Integer;
    y1: Integer;
    x2: Integer;
    y2: Integer;
  end;

  D3DTRANSFORMDATA = record
    dwSize: DWORD;
    lpIn: Pointer;
    dwInSize: DWORD;
    lpOut: Pointer;
    dwOutSize: DWORD;
    lpHOut: Pointer;
    dwClip: DWORD;
    dwClipIntersection: DWORD;
    dwClipUnion: DWORD;
    drExtent: D3DRECT;
  end;
const D3DRECT = extern struct {
    x1: i32,
    y1: i32,
    x2: i32,
    y2: i32,
};

const D3DTRANSFORMDATA = extern struct {
    dwSize: u32,
    lpIn: ?*anyopaque,
    dwInSize: u32,
    lpOut: ?*anyopaque,
    dwOutSize: u32,
    lpHOut: ?*anyopaque,
    dwClip: u32,
    dwClipIntersection: u32,
    dwClipUnion: u32,
    drExtent: D3DRECT,
};
type
  D3DRECT {.bycopy.} = object
    x1: int32
    y1: int32
    x2: int32
    y2: int32

  D3DTRANSFORMDATA {.bycopy.} = object
    dwSize: uint32
    lpIn: pointer
    dwInSize: uint32
    lpOut: pointer
    dwOutSize: uint32
    lpHOut: pointer
    dwClip: uint32
    dwClipIntersection: uint32
    dwClipUnion: uint32
    drExtent: D3DRECT
struct D3DRECT
{
    int x1;
    int y1;
    int x2;
    int y2;
}

struct D3DTRANSFORMDATA
{
    uint dwSize;
    void* lpIn;
    uint dwInSize;
    void* lpOut;
    uint dwOutSize;
    void* lpHOut;
    uint dwClip;
    uint dwClipIntersection;
    uint dwClipUnion;
    D3DRECT drExtent;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D3DTRANSFORMDATA サイズ: 52 バイト(x86)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; lpIn : void* (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwInSize : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; lpOut : void* (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwOutSize : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; lpHOut : D3DHVERTEX* (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; dwClip : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwClipIntersection : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwClipUnion : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; drExtent : D3DRECT (+36, 16byte)  varptr(st)+36 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DTRANSFORMDATA サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; lpIn : void* (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dwInSize : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; lpOut : void* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; dwOutSize : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; lpHOut : D3DHVERTEX* (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; dwClip : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwClipIntersection : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; dwClipUnion : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; drExtent : D3DRECT (+60, 16byte)  varptr(st)+60 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3DRECT
    #field int x1
    #field int y1
    #field int x2
    #field int y2
#endstruct

#defstruct global D3DTRANSFORMDATA
    #field int dwSize
    #field intptr lpIn
    #field int dwInSize
    #field intptr lpOut
    #field int dwOutSize
    #field intptr lpHOut
    #field int dwClip
    #field int dwClipIntersection
    #field int dwClipUnion
    #field D3DRECT drExtent
#endstruct

stdim st, D3DTRANSFORMDATA        ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize