v4.0
shader
テクスチャ レイヤ ポート(シェーダ接続)をテクスチャ レイヤに追加します。 これらは、レイヤの制御対象のシェーダ ポートを示します。 レイヤに、現在所属していないコンテナからのポートが新しく追加された場合、そのポートはコンテナに追加されます(順序の依存関係に応じてスタック内の該当する場所に追加されます)。
oReturn = AddTextureLayerPorts( [InputObj], [InputObjs] ); |
新しく作成されたポートを XSICollection として戻します。
| パラメータ | タイプ | 詳細 |
|---|---|---|
| InputObj | 文字列またはオブジェクト | 新しいポート接続の追加先となるレイヤ。 |
| InputObjs | 文字列 | テクスチャ レイヤ ポート接続の追加先となるターゲット(シェーダまたはマテリアルのポート)のリスト (すなわち、特定のレイヤによって制御されるターゲット)。
ターゲットが現在レイヤをネストしていない(有効な)コンテナで指定された場合は、そのコンテナにレイヤが追加されます(AddTextureLayer コマンドを参照)。
デフォルト値: 現在選択されている値 |
'
' This example creates two shaders in a simple render tree, and applies
' texture layers to one of them. Then it adds port connections to that
' layer, indicating what shader ports the layer should affect.
' In particular, it builds the following stack of layers.
'
' Phong
' A
' B
'
option explicit
dim oSph, oPhong, oMat, oLyr(1), oPorts, oPort
' Build our shaders (a Phong and a Fractal), which will be the "texture
' layer containers" that will each be able to hold a stack of layers.
NewScene , False
set oSph = CreatePrim( "Sphere", "MeshSurface" )
set oPhong = SIApplyShader( "Phong", oSph )
' Now create and add all the layers, as indicated above.
' Add 'A' and 'B' to the Phong at the end.
set oLyr(0) = AddTextureLayer( , oPhong, "A", True )
set oLyr(1) = AddTextureLayer( , oPhong, "B", True )
'
' Now start adding port connections, indicating what these layers will
' affect.
' Start by making layer 'A' affect ambient and diffuse on the Phong.
set oPorts = AddTextureLayerPorts( oLyr(0), oPhong & ".ambient," & oPhong & ".diffuse" )
for each oPort in oPorts
logmessage "Created port: " & oPort
next
' Now let's add some ports on the 'B' layer, which affect the Phong's
' diffuse and specular, but also affect the material's environment. We
' have not added the layer explicitly to the material texture layer
' container, so it will be done implicitly by this command.
set oMat = oPhong(0).parent
set oPorts = AddTextureLayerPorts( oLyr(1), _
oPhong & ".specular," & _
oPhong & ".diffuse," & _
oMat & ".environment" )
for each oPort in oPorts
logmessage "Created port: " & oPort
next
PrintTextureLayersAndPortsInContainer oPhong
PrintTextureLayersAndPortsInContainer oMat
sub PrintTextureLayersAndPortsInContainer( in_cont )
dim oLayerStack, oLayer, oPortList, oPort, oStr
oStr = "Texture Layers in Container: " & in_cont & vbCrLf
set oLayerStack = EnumElements( in_cont & ".TextureLayers" )
for each oLayer in oLayerStack
oStr = oStr & " " & oLayer.name & " -- has ports:" & vbCrLf
set oPortList = EnumElements( in_cont & ".TextureLayers." & oLayer.name & ".ports" )
for each oPort in oPortList
oStr = oStr & " " & oPort.name & vbCrLf
next
next
logmessage oStr
end sub
'
' The output from the example should look something like this:
'
'INFO : "Created port: sphere.Material.Phong.A.ports.ambient"
'INFO : "Created port: sphere.Material.Phong.A.ports.diffuse"
'INFO : "Created port: sphere.Material.Phong.B.ports.specular"
'INFO : "Created port: sphere.Material.Phong.B.ports.diffuse"
'INFO : "Created port: sphere.Material.Phong.B.ports.environment"
'INFO : "Texture Layers in Container: sphere.Material.Phong
' A -- has ports:
' ambient
' diffuse
' B -- has ports:
' specular
' diffuse
' Environment
'
'INFO : "Texture Layers in Container: sphere.Material
' B -- has ports:
' specular
' diffuse
' Environment
'
|