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

D3D10_RASTERIZER_DESC

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

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

フィールド

フィールドサイズx64x86説明
FillModeD3D10_FILL_MODE4+0+0レンダリング時に使用する塗りつぶしモードを決定する D3D10_FILL_MODE 列挙型のメンバーです。既定値は D3D10_FILL_SOLID です。
CullModeD3D10_CULL_MODE4+4+4指定された方向を向いた三角形を描画するかどうかを示す D3D10_CULL_MODE 列挙型のメンバーです。既定値は D3D10_CULL_BACK です。
FrontCounterClockwiseBOOL4+8+8三角形が前向きか後ろ向きかを決定します。このパラメーターが TRUE の場合、頂点がレンダーターゲット上で反時計回りであれば三角形は前向きとみなされ、時計回りであれば後ろ向きとみなされます。このパラメーターが FALSE の場合は逆になります。既定値は FALSE です。
DepthBiasINT4+12+12指定されたピクセルに加算される深度値を指定します。既定値は 0 です。深度バイアスの詳細については、Depth Bias を参照してください。
DepthBiasClampFLOAT4+16+16ピクセルの最大深度バイアスを指定します。既定値は 0.0f です。深度バイアスの詳細については、Depth Bias を参照してください。
SlopeScaledDepthBiasFLOAT4+20+20指定されたピクセルの傾きに対するスカラー値を指定します。既定値は 0.0f です。深度バイアスの詳細については、Depth Bias を参照してください。
DepthClipEnableBOOL4+24+24

距離に基づくクリッピングを有効または無効にします。既定値は TRUE です。

ハードウェアは、ラスタライズされた座標の x および y のクリッピングを常に実行します。DepthClipEnable が既定値に設定されている場合、ハードウェアは z 値のクリッピングも実行します (つまり、次のアルゴリズムの最後のステップを実行します)。


0 < w
-w <= x <= w (or arbitrarily wider range if implementation uses a guard band to reduce clipping burden)
-w <= y <= w (or arbitrarily wider range if implementation uses a guard band to reduce clipping burden)
0 <= z <= w

DepthClipEnable を FALSE に設定すると、ハードウェアは z クリッピング (つまり、前述のアルゴリズムの最後のステップ) をスキップします。ただし、"0 < w" のクリッピングは引き続き実行されます。z クリッピングを無効にすると、ピクセルレベルで深度の順序が正しくならない場合があります。一方で、z クリッピングを無効にするとステンシルシャドウの実装が簡素化されます。つまり、後方クリッピング平面を越えるジオメトリに対する複雑な特殊処理を回避できます。

ScissorEnableBOOL4+28+28シザー矩形によるカリングを有効または無効にします。アクティブなシザー矩形の外側のピクセルはすべてカリングされます。既定値は FALSE です。詳細については、Set the Scissor Rectangle を参照してください。
MultisampleEnableBOOL4+32+32マルチサンプル アンチエイリアシング (MSAA) のレンダーターゲットで、四辺形ラインとアルファ ラインのどちらのアンチエイリアシング アルゴリズムを使用するかを指定します。既定値は FALSE です。四辺形ライン アンチエイリアシング アルゴリズムを使用する場合は TRUE に、アルファ ライン アンチエイリアシング アルゴリズムを使用する場合は FALSE に設定します。このメンバーの詳細については、「解説」を参照してください。
AntialiasedLineEnableBOOL4+36+36ライン アンチエイリアシングを有効にするかどうかを指定します。これは、アルファ ブレンディングが有効で、線を描画しており、かつ MultisampleEnable メンバーが FALSE の場合にのみ適用されます。既定値は FALSE です。このメンバーの詳細については、「解説」を参照してください。

公式ドキュメント

ラスタライザーステートを記述します。

解説(Remarks)

ラスタライザーステートは、ラスタライザーステージの動作を定義します。ラスタライザーステートオブジェクトを作成するには、ID3D10Device::CreateRasterizerState を呼び出します。ラスタライザーステートを設定するには、ID3D10Device::RSSetState を呼び出します。

Note 機能レベル 9.1、9.2、9.3、および 10.0 では、MultisampleEnableFALSE に設定すると、サンプル数が 1 より大きいレンダーターゲットであっても、ランタイムはすべての点、線、三角形をアンチエイリアシングなしで描画します。機能レベル 10.1 では、MultisampleEnable の設定は MSAA に関して点および三角形には影響せず、次の表に示すようにライン描画アルゴリズムの選択にのみ影響します。
ライン描画アルゴリズム MultisampleEnable AntialiasedLineEnable
エイリアス (アンチエイリアシングなし) FALSE FALSE
アルファ アンチエイリアス FALSE TRUE
四辺形 TRUE FALSE
四辺形 TRUE TRUE

MultisampleEnable メンバーと AntialiasedLineEnable メンバーの設定は、マルチサンプル アンチエイリアシング (MSAA) のレンダーターゲット (つまり、サンプル数が 1 より大きいレンダーターゲット) にのみ適用されます。機能レベルによる動作の違いがあるため、線の描画を行わない場合、または線が四辺形として描画されても問題ない場合は、MSAA のレンダーターゲットに描画する際は常に MultisampleEnableTRUE に設定することをお勧めします。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// D3D10_RASTERIZER_DESC  (x64 40 / x86 40 バイト)
typedef struct D3D10_RASTERIZER_DESC {
    D3D10_FILL_MODE FillMode;
    D3D10_CULL_MODE CullMode;
    BOOL FrontCounterClockwise;
    INT DepthBias;
    FLOAT DepthBiasClamp;
    FLOAT SlopeScaledDepthBias;
    BOOL DepthClipEnable;
    BOOL ScissorEnable;
    BOOL MultisampleEnable;
    BOOL AntialiasedLineEnable;
} D3D10_RASTERIZER_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D10_RASTERIZER_DESC
{
    public int FillMode;
    public int CullMode;
    [MarshalAs(UnmanagedType.Bool)] public bool FrontCounterClockwise;
    public int DepthBias;
    public float DepthBiasClamp;
    public float SlopeScaledDepthBias;
    [MarshalAs(UnmanagedType.Bool)] public bool DepthClipEnable;
    [MarshalAs(UnmanagedType.Bool)] public bool ScissorEnable;
    [MarshalAs(UnmanagedType.Bool)] public bool MultisampleEnable;
    [MarshalAs(UnmanagedType.Bool)] public bool AntialiasedLineEnable;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D10_RASTERIZER_DESC
    Public FillMode As Integer
    Public CullMode As Integer
    <MarshalAs(UnmanagedType.Bool)> Public FrontCounterClockwise As Boolean
    Public DepthBias As Integer
    Public DepthBiasClamp As Single
    Public SlopeScaledDepthBias As Single
    <MarshalAs(UnmanagedType.Bool)> Public DepthClipEnable As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public ScissorEnable As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public MultisampleEnable As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public AntialiasedLineEnable As Boolean
End Structure
import ctypes
from ctypes import wintypes

class D3D10_RASTERIZER_DESC(ctypes.Structure):
    _fields_ = [
        ("FillMode", ctypes.c_int),
        ("CullMode", ctypes.c_int),
        ("FrontCounterClockwise", wintypes.BOOL),
        ("DepthBias", ctypes.c_int),
        ("DepthBiasClamp", ctypes.c_float),
        ("SlopeScaledDepthBias", ctypes.c_float),
        ("DepthClipEnable", wintypes.BOOL),
        ("ScissorEnable", wintypes.BOOL),
        ("MultisampleEnable", wintypes.BOOL),
        ("AntialiasedLineEnable", wintypes.BOOL),
    ]
#[repr(C)]
pub struct D3D10_RASTERIZER_DESC {
    pub FillMode: i32,
    pub CullMode: i32,
    pub FrontCounterClockwise: i32,
    pub DepthBias: i32,
    pub DepthBiasClamp: f32,
    pub SlopeScaledDepthBias: f32,
    pub DepthClipEnable: i32,
    pub ScissorEnable: i32,
    pub MultisampleEnable: i32,
    pub AntialiasedLineEnable: i32,
}
import "golang.org/x/sys/windows"

type D3D10_RASTERIZER_DESC struct {
	FillMode int32
	CullMode int32
	FrontCounterClockwise int32
	DepthBias int32
	DepthBiasClamp float32
	SlopeScaledDepthBias float32
	DepthClipEnable int32
	ScissorEnable int32
	MultisampleEnable int32
	AntialiasedLineEnable int32
}
type
  D3D10_RASTERIZER_DESC = record
    FillMode: Integer;
    CullMode: Integer;
    FrontCounterClockwise: BOOL;
    DepthBias: Integer;
    DepthBiasClamp: Single;
    SlopeScaledDepthBias: Single;
    DepthClipEnable: BOOL;
    ScissorEnable: BOOL;
    MultisampleEnable: BOOL;
    AntialiasedLineEnable: BOOL;
  end;
const D3D10_RASTERIZER_DESC = extern struct {
    FillMode: i32,
    CullMode: i32,
    FrontCounterClockwise: i32,
    DepthBias: i32,
    DepthBiasClamp: f32,
    SlopeScaledDepthBias: f32,
    DepthClipEnable: i32,
    ScissorEnable: i32,
    MultisampleEnable: i32,
    AntialiasedLineEnable: i32,
};
type
  D3D10_RASTERIZER_DESC {.bycopy.} = object
    FillMode: int32
    CullMode: int32
    FrontCounterClockwise: int32
    DepthBias: int32
    DepthBiasClamp: float32
    SlopeScaledDepthBias: float32
    DepthClipEnable: int32
    ScissorEnable: int32
    MultisampleEnable: int32
    AntialiasedLineEnable: int32
struct D3D10_RASTERIZER_DESC
{
    int FillMode;
    int CullMode;
    int FrontCounterClockwise;
    int DepthBias;
    float DepthBiasClamp;
    float SlopeScaledDepthBias;
    int DepthClipEnable;
    int ScissorEnable;
    int MultisampleEnable;
    int AntialiasedLineEnable;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D10_RASTERIZER_DESC サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; FillMode : D3D10_FILL_MODE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; CullMode : D3D10_CULL_MODE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; FrontCounterClockwise : BOOL (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; DepthBias : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; DepthBiasClamp : FLOAT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; SlopeScaledDepthBias : FLOAT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; DepthClipEnable : BOOL (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ScissorEnable : BOOL (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; MultisampleEnable : BOOL (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; AntialiasedLineEnable : BOOL (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D10_RASTERIZER_DESC
    #field int FillMode
    #field int CullMode
    #field bool FrontCounterClockwise
    #field int DepthBias
    #field float DepthBiasClamp
    #field float SlopeScaledDepthBias
    #field bool DepthClipEnable
    #field bool ScissorEnable
    #field bool MultisampleEnable
    #field bool AntialiasedLineEnable
#endstruct

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