Object Hierarchy | Related C++ Class: TextureLayerPort
TextureLayerPort
v4.0
The TextureLayerPort is an object used to describe which
specific shader and material parameters a TextureLayer affects. Like shader
connections, they indicate what shader ports are being driven by
the layer.
The port has a few properties which describe how the layer affects
a single shading parameter, generally these are used to modify the
layer's settings in a port-specific way, for example by inverting
or scaling the overall effect. A layer may be set up to blend its
color by 50% with the layer beneath it. However, that layer's the
ambient port effect may only be 25% whereas the diffuse port
contribution could be set to 100%.
/* This example shows creation of texture layer ports, plus enumerating and removing them. */ oRoot = ActiveProject.ActiveScene.Root; oSph = oRoot.AddGeometry( "Torus", "MeshSurface" ); oMat = oSph.AddMaterial( "Phong" ); oPhong = oMat.Shaders(0); // 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" ) ); oPorts[2] = oLayer.AddTextureLayerPort( oPhong.parameters( "specular" ) ); Application.LogMessage( "Created " + oLayer.TextureLayerPorts.count + " ports." ); for ( i = 0; i < oLayer.TextureLayerPorts.count; i++ ) { oPort = oLayer.TextureLayerPorts(i); Application.LogMessage( (i+1) + ": " + oPort ); } oLayer.RemoveTextureLayerPort( oPorts[1] ); oLayer.RemoveTextureLayerPort( oLayer.fullname + "." + oPorts[2].name ); count = oLayer.TextureLayerPorts.count; Application.LogMessage( "Only " + count + " remain(s) after removal." ); for ( i = 0; i < count; i++ ) { Application.LogMessage( (i+1) + ": " + oLayer.TextureLayerPorts.item(i) ); } // This example should log something like: //INFO : "Created 3 ports." //INFO : "1: torus.Material.Phong.DirtLayer.ambient" //INFO : "2: torus.Material.Phong.DirtLayer.diffuse" //INFO : "3: torus.Material.Phong.DirtLayer.specular" //INFO : "Only 1 remain(s) after removal." //INFO : "1: torus.Material.Phong.DirtLayer.ambient" |