using System;
using System.Collections.Generic;
namespace OpenMetaverse
{
///
/// Operation to apply when applying color to texture
///
public enum VisualColorOperation
{
Add,
Blend,
Multiply
}
///
/// Information needed to translate visual param value to RGBA color
///
public struct VisualColorParam
{
public VisualColorOperation Operation;
public Color4[] Colors;
///
/// Construct VisualColorParam
///
/// Operation to apply when applying color to texture
/// Colors
public VisualColorParam(VisualColorOperation operation, Color4[] colors)
{
Operation = operation;
Colors = colors;
}
}
///
/// Represents alpha blending and bump infor for a visual parameter
/// such as sleive length
///
public struct VisualAlphaParam
{
/// Stregth of the alpha to apply
public float Domain;
/// File containing the alpha channel
public string TGAFile;
/// Skip blending if parameter value is 0
public bool SkipIfZero;
/// Use miltiply insted of alpha blending
public bool MultiplyBlend;
///
/// Create new alhpa information for a visual param
///
/// Stregth of the alpha to apply
/// File containing the alpha channel
/// Skip blending if parameter value is 0
/// Use miltiply insted of alpha blending
public VisualAlphaParam(float domain, string tgaFile, bool skipIfZero, bool multiplyBlend)
{
Domain = domain;
TGAFile = tgaFile;
SkipIfZero = skipIfZero;
MultiplyBlend = multiplyBlend;
}
}
///
/// A single visual characteristic of an avatar mesh, such as eyebrow height
///
public struct VisualParam
{
/// Index of this visual param
public int ParamID;
/// Internal name
public string Name;
/// Group ID this parameter belongs to
public int Group;
/// Name of the wearable this parameter belongs to
public string Wearable;
/// Displayable label of this characteristic
public string Label;
/// Displayable label for the minimum value of this characteristic
public string LabelMin;
/// Displayable label for the maximum value of this characteristic
public string LabelMax;
/// Default value
public float DefaultValue;
/// Minimum value
public float MinValue;
/// Maximum value
public float MaxValue;
/// Is this param used for creation of bump layer?
public bool IsBumpAttribute;
/// Alpha blending/bump info
public VisualAlphaParam? AlphaParams;
/// Color information
public VisualColorParam? ColorParams;
/// Array of param IDs that are drivers for this parameter
public int[] Drivers;
///
/// Set all the values through the constructor
///
/// Index of this visual param
/// Internal name
///
///
/// Displayable label of this characteristic
/// Displayable label for the minimum value of this characteristic
/// Displayable label for the maximum value of this characteristic
/// Default value
/// Minimum value
/// Maximum value
/// Is this param used for creation of bump layer?
/// Array of param IDs that are drivers for this parameter
/// Alpha blending/bump info
/// Color information
public VisualParam(int paramID, string name, int group, string wearable, string label, string labelMin, string labelMax, float def, float min, float max, bool isBumpAttribute, int[] drivers, VisualAlphaParam? alpha, VisualColorParam? colorParams)
{
ParamID = paramID;
Name = name;
Group = group;
Wearable = wearable;
Label = label;
LabelMin = labelMin;
LabelMax = labelMax;
DefaultValue = def;
MaxValue = max;
MinValue = min;
IsBumpAttribute = isBumpAttribute;
Drivers = drivers;
AlphaParams = alpha;
ColorParams = colorParams;
}
}
///
/// Holds the Params array of all the avatar appearance parameters
///
public static class VisualParams
{
public static SortedList Params = new SortedList();
public static VisualParam Find(string name, string wearable)
{
foreach (KeyValuePair param in Params)
if (param.Value.Name == name && param.Value.Wearable == wearable)
return param.Value;
return new VisualParam();
}
static VisualParams()
{