ホーム › Graphics.Direct3D9 › D3DVERTEXELEMENT9
D3DVERTEXELEMENT9
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Stream | WORD | 2 | +0 | +0 | 頂点要素を取得するストリーム番号。 |
| Offset | WORD | 2 | +2 | +2 | ストリーム内での要素のバイトオフセット。 |
| Type | BYTE | 1 | +4 | +4 | データ型を示すD3DDECLTYPE値(BYTE格納)。 |
| Method | BYTE | 1 | +5 | +5 | テッセレータ処理メソッドを示すD3DDECLMETHOD(BYTE格納)。 |
| Usage | BYTE | 1 | +6 | +6 | 要素の用途を示すD3DDECLUSAGE(位置/法線等、BYTE格納)。 |
| UsageIndex | BYTE | 1 | +7 | +7 | 同一用途を区別するインデックス(BYTE格納)。 |
各言語での定義
#include <windows.h>
// D3DVERTEXELEMENT9 (x64 8 / x86 8 バイト)
typedef struct D3DVERTEXELEMENT9 {
WORD Stream;
WORD Offset;
BYTE Type;
BYTE Method;
BYTE Usage;
BYTE UsageIndex;
} D3DVERTEXELEMENT9;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DVERTEXELEMENT9
{
public ushort Stream;
public ushort Offset;
public byte Type;
public byte Method;
public byte Usage;
public byte UsageIndex;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DVERTEXELEMENT9
Public Stream As UShort
Public Offset As UShort
Public Type As Byte
Public Method As Byte
Public Usage As Byte
Public UsageIndex As Byte
End Structureimport ctypes
from ctypes import wintypes
class D3DVERTEXELEMENT9(ctypes.Structure):
_fields_ = [
("Stream", ctypes.c_ushort),
("Offset", ctypes.c_ushort),
("Type", ctypes.c_ubyte),
("Method", ctypes.c_ubyte),
("Usage", ctypes.c_ubyte),
("UsageIndex", ctypes.c_ubyte),
]#[repr(C)]
pub struct D3DVERTEXELEMENT9 {
pub Stream: u16,
pub Offset: u16,
pub Type: u8,
pub Method: u8,
pub Usage: u8,
pub UsageIndex: u8,
}import "golang.org/x/sys/windows"
type D3DVERTEXELEMENT9 struct {
Stream uint16
Offset uint16
Type byte
Method byte
Usage byte
UsageIndex byte
}type
D3DVERTEXELEMENT9 = record
Stream: Word;
Offset: Word;
Type: Byte;
Method: Byte;
Usage: Byte;
UsageIndex: Byte;
end;const D3DVERTEXELEMENT9 = extern struct {
Stream: u16,
Offset: u16,
Type: u8,
Method: u8,
Usage: u8,
UsageIndex: u8,
};type
D3DVERTEXELEMENT9 {.bycopy.} = object
Stream: uint16
Offset: uint16
Type: uint8
Method: uint8
Usage: uint8
UsageIndex: uint8struct D3DVERTEXELEMENT9
{
ushort Stream;
ushort Offset;
ubyte Type;
ubyte Method;
ubyte Usage;
ubyte UsageIndex;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DVERTEXELEMENT9 サイズ: 8 バイト(x64)
dim st, 2 ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; Stream : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Offset : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; Type : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; Method : BYTE (+5, 1byte) poke st,5,値 / 値 = peek(st,5)
; Usage : BYTE (+6, 1byte) poke st,6,値 / 値 = peek(st,6)
; UsageIndex : BYTE (+7, 1byte) poke st,7,値 / 値 = peek(st,7)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3DVERTEXELEMENT9
#field short Stream
#field short Offset
#field byte Type
#field byte Method
#field byte Usage
#field byte UsageIndex
#endstruct
stdim st, D3DVERTEXELEMENT9 ; NSTRUCT 変数を確保
st->Stream = 100
mes "Stream=" + st->Stream