dim oRoot, oMat, oGrid, oPhong, oShader
NewScene ,false
' Create a grid
set oRoot = ActiveProject.ActiveScene.Root
set oGrid = oRoot.AddGeometry("Grid", "MeshSurface")
SelectObj "grid"
' Create a local material with a Phong surface shader
ApplyShader "Phong", oGrid, , , siLetLocalMaterialsOverlap
set oMat = oGrid.Material
set oPhong = oMat.Shaders(0)
' Apply two shaders, but with the Rock shader attached on two ports
SIApplyShaderToCnxPoint "Cell", oPhong & ".ambient"
SIApplyShaderToCnxPoint "Rock", oPhong & ".diffuse," & oPhong & ".specular"
' Enumerate the shaders of Phong: Note the rock shader only appears once even though connected twice.
LogMessage "root shader: " & oPhong.FullName
for each oShader in oPhong.Shaders
Logmessage "shader of Shaders: " & oShader.FullName
Next
|