private SEAObject3D AppendLight(Scene scene, Node node, Light light, SEAObject3D parent)
{
int sIndex = GetIndexByTag(node);
if (sIndex != -1) return (SEAObject3D)Writer.Objects[sIndex];
SEALight seaLight = null;
if (light.LightType == LightSourceType.Point)
{
SEAPointLight pLight = new SEAPointLight(GetValidString(objects, node.Name));
pLight.multiplier = 1;
pLight.color = ToInteger( light.ColorDiffuse );
pLight.position = ToPositionArray( node.Transform );
seaLight = pLight;
}
else if (light.LightType == LightSourceType.Directional || light.LightType == LightSourceType.Spot)
{
SEADirectionalLight dLight = new SEADirectionalLight(GetValidString(objects, node.Name));
dLight.multiplier = 1;
dLight.color = ToInteger( light.ColorDiffuse );
dLight.transform = To3x4Array( node.Transform );
seaLight = dLight;
}
if (seaLight != null)
{
seaLight.parent = parent != null ? GetIndex(parent) : -1;
seaLight.tag = node;
objects.Add(seaLight);
Writer.AddObject(seaLight);
}
return seaLight;
}