dir = @"D:\internet evaluation\3FO4L6FVKCQT\light_config.xml"
iesDir = @"D:\internet evaluation\Eval_Material_1\Eval_Material_1\iesprofile\14.IES"
iesAssetUser = AssetManager.getasset iesDir #Photometric
xmlDoc = dotNetObject "system.xml.xmlDocument"
xmlDoc.load dir
xmlroot = xmlDoc.DocumentElement
lightElements = xmlroot.childNodes
for i = 0 to lightElements.count-1 do(
local lightElement = lightElements.item i
if lightElement.getAttribute "Type" == "IESSpotLight" do(
local sPosition = lightElement.getAttribute "Position"
local sName = lightElement.getAttribute "Name"
local sEnergy = lightElement.getAttribute "Energy"
local sColor = lightElement.getAttribute "Color"
local mLight = VRayIES()
mLight.name = sName
mLight.intensity_value = sEnergy as float /16.0 * 5.0
local mPos = GetLightPos sPosition
mLight.pos = mPos
local mColor = GetLightColor sColor sEnergy
mLight.color = mColor
mLight.ies_file = iesAssetUser.getAssetID()
)
if lightElement.getAttribute "Type" == "SunLight" do(
print "SunLight"
)
)
fn GetLightPos Position =
(
local t = FilterString Position ","
return [t[1] as float,t[2] as float,t[3] as float]
)
fn GetLightColor sColor sEnergy =
(
local t = FilterString sColor ","
local r = t[1] as float / sEnergy as float * 255.0
local g = t[2] as float / sEnergy as float * 255.0
local b = t[3] as float / sEnergy as float * 255.0
return [r as integer,g as integer,b as integer]
)