TextureLayer.AddTextureLayerPort

導入

v4.0

詳細

テクスチャレイヤに TextureLayerPort オブジェクト(シェーダ接続)を追加します。これらは、レイヤの制御対象のシェーダ ポートを示します。

レイヤに、現在レイヤが属していないコンテナのポートが追加された場合は、これらのコンテナにレイヤが追加されます(レイヤの順序関係を維持するために、スタック内の適切な位置に追加されます)。たとえば、レンダツリーに Phong と Lambert の両方のシェーダがあるとします。Phong にはすでにレイヤ"Dirt"がありますが、このレイヤは Lambert と共有されていません。ターゲットの"Lambert.diffuse"に対して TextureLayer.AddTextureLayerPort が呼び出されると、そのシェーダに対してShader.AddSharedTextureLayerを明示的に呼び出さなくても、Lambert の下のレイヤリストにレイヤ"Dirt"が追加されます。

C#構文

TextureLayerPort TextureLayer.AddTextureLayerPort( Object in_varParam );

スクリプト構文

oReturn = TextureLayer.AddTextureLayerPort( Target );

戻り値

TextureLayerPort

パラメータ

パラメータ タイプ 説明
Target ParameterまたはString テクスチャレイヤポート接続(このレイヤで制御されるポート接続)が追加されるターゲット(シェーダまたはマテリアルのポートである必要があります)のパラメータ。注:現在レイヤがネストされていない(有効な)コンテナにターゲットが指定された場合は、そのコンテナにレイヤが追加されます。

1. JScript の例

// This example shows creation of texture layer

// ports, plus enumerating them.

oRoot = ActiveProject.ActiveScene.Root;

oSph = oRoot.AddGeometry( "Sphere", "MeshSurface" );

oMat = oSph.AddMaterial( "Phong" );

oPhong = oMat.Shaders(0);

oParam = oPhong.parameters( "specular" );

oFractal = oParam.ConnectFromPreset( "Fractal", siTextureShaderFamily );

// Add a layer at the end.

oLayer = oPhong.CreateTextureLayer( "DirtLayer" );

// Add some texture layer port connections on this layer.

oPorts = new Array(3);

oPorts[0] = oLayer.AddTextureLayerPort( oPhong.parameters( "ambient" ) );

oPorts[1] = oLayer.AddTextureLayerPort( oPhong.parameters( "diffuse" ) );

// The next line shows adding a port which is on a container that the layer

// is currently not part of -- it will be added to that container.

oPorts[2] = oLayer.AddTextureLayerPort( oFractal.parameters( "color1" ) );

Application.LogMessage( "Created " + oLayer.TextureLayerPorts.count + " ports." );

for ( i = 0; i < oLayer.TextureLayerPorts.count; i++ )

{

	oPort = oLayer.TextureLayerPorts(i);

	Application.LogMessage( (i+1) + ": " + oPort );

}

// This example should log something like:

//INFO : "Created 3 ports."

//INFO : "1: sphere.Material.Phong.DirtLayer.ambient"

//INFO : "2: sphere.Material.Phong.DirtLayer.diffuse"

//INFO : "3: sphere.Material.Phong.DirtLayer.color1"

2. VBScript の例

' This example shows creation of texture layer

' ports, plus enumerating them.

set oRoot = ActiveProject.ActiveScene.Root

set oSph = oRoot.AddGeometry( "Sphere", "MeshSurface" )

set oMat = oSph.AddMaterial( "Phong" )

set oPhong = oMat.Shaders(0)

set oParam = oPhong.parameters( "specular" )

set oFractal = oParam.ConnectFromPreset( "Fractal", siTextureShaderFamily )

' Add a layer at the end.

set oLayer = oPhong.CreateTextureLayer( "DirtLayer" )

' Add some texture layer port connections on this layer.

dim oPorts(2)

set oPorts(0) = oLayer.AddTextureLayerPort( oPhong.parameters( "ambient" ) )

set oPorts(1) = oLayer.AddTextureLayerPort( oPhong.parameters( "diffuse" ) )

' The next line shows adding a port which is on a container that the layer

' is currently not part of -- it will be added to that container.

set oPorts(2) = oLayer.AddTextureLayerPort( oFractal.parameters( "color1" ) )

logmessage "Created " & oLayer.TextureLayerPorts.count & " ports."

i = 1

for each oPort in oLayer.TextureLayerPorts

	logmessage i & ": " & oPort

	i = i + 1

next

' This example should log something like:

'INFO : "Created 3 ports."

'INFO : "1: sphere.Material.Phong.DirtLayer.ambient"

'INFO : "2: sphere.Material.Phong.DirtLayer.diffuse"

'INFO : "3: sphere.Material.Phong.DirtLayer.color1"

関連項目

AddTextureLayerPorts TextureLayer.TextureLayerPorts TextureLayer.RemoveTextureLayerPort