次の方法で共有


Light.Type

Type プロパティ

使用例

  • 振り子のように揺れるディレクショナル ライトを設定する

光源の種類を取得または設定する。

定義

Visual Basic Public Property Type As LightType
C# public LightType Type { get; set; }
Managed C++ public: __property LightType get_Type();
public: __property void set_Type(LightType);
JScript public function get Type() : LightType
public function set Type(LightType);

プロパティ値

Microsoft.DirectX.Direct3D.LightType.

これは読み取り/書き込み可能プロパティである。 

使用例

振り子のように揺れるディレクショナル ライトを設定する

この例では、Microsoft® Direct3D® オブジェクトを照らす、振り子のように揺れる色付きのディレクショナル ライトを設定する方法を示す。

ここでは、プライベート メソッドの SetUpLightsLight オブジェクトをインスタンス化している。このオブジェクトの Type プロパティは、LightType 列挙の Directional 定数に設定する。Light.Diffuse プロパティは、システム定義の暗い青緑色に設定する。

Light.Direction プロパティは、光源の方向を指定する Vector3 構造体を受け取る。この構造体に含まれる (x,y,z) フィールドでは、y には常に 1.0 が設定され、x および z には時間によって変わる値が設定される。

using Microsoft.DirectX.Direct3D;

Device device = null;  // Create rendering device

private void SetupLights() //  Method to set up lighting of the object
{
    device.RenderState.Lighting = true; // Make sure lighting is enabled

    // Set up a dark turquoise-colored directional light, with an oscillating
    // direction. Note that many lights may be active at a time (but each one
    // slows downthe rendering of the scene). However, here just use one.
    
    Light light = new Light(); // Void constructor
    light.Type = LightType.Directional;
    light.Diffuse = System.Drawing.Color.DarkTurquoise;
    light.Direction = new DirectX.Vector3(
                 (float)System.Math.Cos(System.Environment.TickCount / 250.0f),
                 1.0f,
                 (float)System.Math.Sin(Environment.TickCount / 250.0f));
}

対象

Light

© 2002 Microsoft Corporation. All rights reserved. Terms of use.