PolygonSet (クラス)
public PolygonSet {inherits LightableSceneObject}
パッケージ: CURL.GRAPHICS.SCENE
直接継承しているサブクラス: ParticleSystemSceneObject, MaxGeomSceneObject

オプションの光の照射、テクスチャ マッピングおよび各頂点色を使用して、複数の面、線、または点を描画するオブジェクト

次の例では、PolygonSet を使用して赤、緑、青および黄の頂点色で単純な四面体を描画しています。四面体をクリックすると、それが回転します。


例: PolygonSet を使用した四面体の描画
{import * from CURL.GRAPHICS.SCENE}

{value
    || The scene that holds the tetrahedron.
    let scene:Scene = 
        {Scene
            camera = 
                {Camera
                    position = {Distance3d -1in, -1in, .5in},
                    direction = {Direction3d 1, 1, -.5},
                    up-vector = {Direction3d 0, 0, 1},
                    field-of-view = 70degrees,
                    near-clipping-plane = .1in,
                    far-clipping-plane = 5in,
                    projection = Projection.perspective
                }
        }
    
    || The vertices of the PolygonSet.
    let vertices:{Array-of FloatDistance3d} = 
        {new {Array-of FloatDistance3d},
            {Distance3d -.5in, -.5in, -.5in} asa FloatDistance3d,
            {Distance3d .5in, -.5in, -.5in} asa FloatDistance3d,
            {Distance3d 0in, .5in, -.5in} asa FloatDistance3d,
            {Distance3d 0in, 0in, .5in} asa FloatDistance3d,
            {Distance3d -.5in, -.5in, -.5in} asa FloatDistance3d,
            {Distance3d .5in, -.5in, -.5in} asa FloatDistance3d
        }
    
    || The colors of the vertices of the PolygonSet.
    let colors:{Array-of Pixel} = 
        {new {Array-of Pixel},
            {{Palette.get-red}.to-Pixel},
            {{Palette.get-green}.to-Pixel},
            {{Palette.get-blue}.to-Pixel},
            {{Palette.get-yellow}.to-Pixel},
            {{Palette.get-red}.to-Pixel},
            {{Palette.get-green}.to-Pixel}
        }
    
    || Create the PolygonSet and add it to the scene.
    let polygonset:PolygonSet = 
        {PolygonSet
            vertices = vertices,
            colors = colors,
            primitive-type = PrimitiveType.triangle-strip,
            {on event:PointerPressSceneEvent at p:PolygonSet do
                {p.rotate {Direction3d 0, 0, 1}, 10deg}
            }
        }
    
    {scene.add-object polygonset}
    
    || SceneGraphic displays the scene on the page.
    {SceneGraphic 
        width = 5in, 
        height = 5in, 
        background = {FillPattern.get-black},
        scene
    }
}

コンストラクタ
default:新規の PolygonSet を作成します。
コンストラクタ public {PolygonSet.default
vertices:{Array-of FloatDistance3d} = {new {Array-of FloatDistance3d}},
texture-coords:#{Array-of FloatFraction2d} = null,
normals:#{Array-of FloatDirection3d} = null,
colors:#{Array-of Pixel} = null,
faces:#{Array-of #{Array-of int}} = null,
primitive-type:PrimitiveType = PrimitiveType.triangles,
fill-pattern:FillPattern = {FillPattern.get-white},
line-width:Distance = 1pt,
point-size:Distance = 1pt,
shade-model:Shading = Shading.smooth,
lighting-enabled?:bool = false,
ambient-color:Color = {Palette.get-white},
diffuse-color:Color = {Palette.get-white},
specular-color:Color = {Palette.get-white},
shininess:double = 10,
transformation:Transformation3d = {Transformation3d},
visible?:bool = true,
name:#String = null,
opaque-to-intersection?:bool = true,
...
}

プロパティ
colors:PolygonSet の頂点色。
アクセサ public PolygonSet.colors:#{Array-of Pixel}
セッター public PolygonSet.colors:#{Array-of Pixel}
diffuse-color:PolygonSet の拡散色。
アクセサ public PolygonSet.diffuse-color:Color
セッター public LightableSceneObject.diffuse-color:Color
faces:PolygonSet の面。これらは頂点配列のインデックスになります。これが null の場合は、PolygonSet.primitive-type を使用して面の連結度を指定します。1 次元配列を列、2 次元配列を行として想定すると、各行は面を定義します。列内の各要素は頂点配列のインデックスになります。
アクセサ public PolygonSet.faces:#{Array-of #{Array-of int}}
セッター public PolygonSet.faces:#{Array-of #{Array-of int}}
fill-pattern:PolygonSet の色またはテクスチャ。
アクセサ public PolygonSet.fill-pattern:FillPattern
セッター public PolygonSet.fill-pattern:FillPattern
line-width:PolygonSet の線の幅。
アクセサ public PolygonSet.line-width:Distance
セッター public PolygonSet.line-width:Distance
normals:PolygonSet のノーマル。
アクセサ public PolygonSet.normals:#{Array-of FloatDirection3d}
セッター public PolygonSet.normals:#{Array-of FloatDirection3d}
point-size:PolygonSet の点のサイズ。
アクセサ public PolygonSet.point-size:Distance
セッター public PolygonSet.point-size:Distance
primitive-type:PolygonSetPrimitiveType。これは PolygonSet.faces が null の場合に、使用されます。
アクセサ public PolygonSet.primitive-type:PrimitiveType
セッター public PolygonSet.primitive-type:PrimitiveType
shade-model:PolygonSet のシェード モデル。
アクセサ public PolygonSet.shade-model:Shading
セッター public PolygonSet.shade-model:Shading
texture-coords:PolygonSet のテクスチャ座標。
アクセサ public PolygonSet.texture-coords:#{Array-of FloatFraction2d}
セッター public PolygonSet.texture-coords:#{Array-of FloatFraction2d}
vertices:PolygonSet の頂点。
アクセサ public PolygonSet.vertices:{Array-of FloatDistance3d}
セッター public PolygonSet.vertices:{Array-of FloatDistance3d}
プロパティ 継承 LightableSceneObject: ambient-color, lighting-enabled?, shininess, specular-color
プロパティ 継承 SceneObject: bounding-box-caching-enabled?, bounding-box-or-object-visible?, cached-bounding-box-dirty?, controller, local-bounding-box-color, local-bounding-box-line-width, local-bounding-box-visible?, name, opaque-to-intersection?, parent, parent-bounding-box-color, parent-bounding-box-line-width, parent-bounding-box-visible?, scene, transformation, visible?, world-bounding-box-color, world-bounding-box-line-width, world-bounding-box-visible?, world-position, world-transformation
プロパティ 継承 EventTarget: event-handlers

メソッド
get-local-bounding-box:SceneObject の軸平行である 3 次元のローカル境界。SceneObject のサブクラスにこのメソッドをオーバーライドする必要があります。
public {PolygonSet.get-local-bounding-box
check-visibility?:bool = false
}:(min-xyz:Distance3d, max-xyz:Distance3d, valid-bounds?:bool)
paint:Renderer3d を使用して self を描画します。
public {PolygonSet.paint
renderer:Renderer3d,
viewport-width:Distance,
viewport-height:Distance
}:void
メソッド 継承 SceneObject: get-cached-local-bounding-box, get-parent-bounding-box, get-transformed-bounding-box, get-world-bounding-box, intersect-box, intersect-line, intersect-line-segment, intersect-ray, intersect-sphere, ndc-point-to-ray, point-to-ndc-point, point-to-viewport-point, pre-paint, rotate, scale, set-orientation-and-position, translate, viewport-point-to-ray
メソッド 継承 EventTarget: accepts-event-class?, add-event-handler, event-handler-present?, handle-event, remove-event-handler, verify-event
メソッド 継承 BasicEventTarget: enqueue-event
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize



コンストラクタ詳細
default (コンストラクタ)
public {PolygonSet.default
vertices:{Array-of FloatDistance3d} = {new {Array-of FloatDistance3d}},
texture-coords:#{Array-of FloatFraction2d} = null,
normals:#{Array-of FloatDirection3d} = null,
colors:#{Array-of Pixel} = null,
faces:#{Array-of #{Array-of int}} = null,
primitive-type:PrimitiveType = PrimitiveType.triangles,
fill-pattern:FillPattern = {FillPattern.get-white},
line-width:Distance = 1pt,
point-size:Distance = 1pt,
shade-model:Shading = Shading.smooth,
lighting-enabled?:bool = false,
ambient-color:Color = {Palette.get-white},
diffuse-color:Color = {Palette.get-white},
specular-color:Color = {Palette.get-white},
shininess:double = 10,
transformation:Transformation3d = {Transformation3d},
visible?:bool = true,
name:#String = null,
opaque-to-intersection?:bool = true,
...
}

新規の PolygonSet を作成します。

PolygonSet.verticesPolygonSet.texture-coordsPolygonSet.normalsPolygonSet.colorsPolygonSet.facesPolygonSet.primitive-typePolygonSet.fill-patternPolygonSet.line-widthPolygonSet.point-sizePolygonSet.shade-modelLightableSceneObject.lighting-enabled?LightableSceneObject.ambient-colorLightableSceneObject.diffuse-colorLightableSceneObject.specular-color および LightableSceneObject.shininess については、各アクセッサの説明を参照してください。
transformation: PolygonSet の初期の Transformation3d。既定値は実体の変換になります。
visible?: PolygonSet が可視かどうかを指定するブール値。既定値は true になります。
name: PolygonSet の名前を表す String。既定値は null になります。
opaque-to-intersection?: PolygonSet により他のオブジェクトが交点イベントを受け取るのを終了させるかどうかを指定する bool。既定値は true になります。(詳細については SceneObject.opaque-to-intersection? を参照してください)。
...:
各残余引数は、新規に作成されたオブジェクトの EventTarget.add-event-handler メソッドに送信される EventHandler にする必要があります。
変換に関連する残余引数の詳細については、SceneObject.default を参照してください。



プロパティ詳細
colors (アクセサ)
アクセサ public PolygonSet.colors:#{Array-of Pixel}
セッター public PolygonSet.colors:#{Array-of Pixel}

PolygonSet の頂点色。



diffuse-color (アクセサ)
アクセサ public PolygonSet.diffuse-color:Color
セッター public LightableSceneObject.diffuse-color:Color

PolygonSet の拡散色。

注意事項

このプロパティは光源の照射が有効な場合にのみ使用されます。

PolygonSet.colors が設定されると、diffuse-color は無視されます。


faces (アクセサ)
アクセサ public PolygonSet.faces:#{Array-of #{Array-of int}}
セッター public PolygonSet.faces:#{Array-of #{Array-of int}}

PolygonSet の面。これらは頂点配列のインデックスになります。これが null の場合は、PolygonSet.primitive-type を使用して面の連結度を指定します。1 次元配列を列、2 次元配列を行として想定すると、各行は面を定義します。列内の各要素は頂点配列のインデックスになります。



fill-pattern (アクセサ)
アクセサ public PolygonSet.fill-pattern:FillPattern
セッター public PolygonSet.fill-pattern:FillPattern

PolygonSet の色またはテクスチャ。



line-width (アクセサ)
アクセサ public PolygonSet.line-width:Distance
セッター public PolygonSet.line-width:Distance

PolygonSet の線の幅。



normals (アクセサ)
アクセサ public PolygonSet.normals:#{Array-of FloatDirection3d}
セッター public PolygonSet.normals:#{Array-of FloatDirection3d}

PolygonSet のノーマル。



point-size (アクセサ)
アクセサ public PolygonSet.point-size:Distance
セッター public PolygonSet.point-size:Distance

PolygonSet の点のサイズ。



primitive-type (アクセサ)
アクセサ public PolygonSet.primitive-type:PrimitiveType
セッター public PolygonSet.primitive-type:PrimitiveType

PolygonSetPrimitiveType。これは PolygonSet.faces が null の場合に、使用されます。



shade-model (アクセサ)
アクセサ public PolygonSet.shade-model:Shading
セッター public PolygonSet.shade-model:Shading

PolygonSet のシェード モデル。



texture-coords (アクセサ)
アクセサ public PolygonSet.texture-coords:#{Array-of FloatFraction2d}
セッター public PolygonSet.texture-coords:#{Array-of FloatFraction2d}

PolygonSet のテクスチャ座標。



vertices (アクセサ)
アクセサ public PolygonSet.vertices:{Array-of FloatDistance3d}
セッター public PolygonSet.vertices:{Array-of FloatDistance3d}

PolygonSet の頂点。






メソッド詳細
get-local-bounding-box (メソッド)
public {PolygonSet.get-local-bounding-box
check-visibility?:bool = false
}:(min-xyz:Distance3d, max-xyz:Distance3d, valid-bounds?:bool)

SceneObject の軸平行である 3 次元のローカル境界。SceneObject のサブクラスにこのメソッドをオーバーライドする必要があります。

check-visibility?: このメソッドの呼び出し時にオブジェクトの可視性またはその境界ボックスがチェックされるかどうかを指定する boolcheck-visibility?trueSceneObject が不可視である場合は、返される境界は無効になります。既定値は false になります。

戻り値

min-xyz, max-xyz :境界ボックスを示す 2 つの Distance3d
valid-bounds? :返された境界が有効であるかどうかを示す bool

オーバーライド

SceneObject が不可視である場合は SceneObject の可視性を常時チェックし、無効な境界を返す必要があります。(SceneObject.bounding-box-or-object-visible? を参照してください)。


paint (メソッド)
public {PolygonSet.paint
renderer:Renderer3d,
viewport-width:Distance,
viewport-height:Distance
}:void

Renderer3d を使用して self を描画します。

注意事項

このメソッドを使用して SceneObject の変換を修正することはできません。それを修正するには、SceneObject.pre-paint を使用する必要があります。