Added support for decoding alpha masks and color params for textures using visual params (towards LIBOMV-658)
git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3048 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -9,7 +9,7 @@ namespace VisualParamGenerator
|
||||
{
|
||||
class VisualParamGenerator
|
||||
{
|
||||
public static readonly System.Globalization.CultureInfo EnUsCulture =
|
||||
public static readonly System.Globalization.CultureInfo EnUsCulture =
|
||||
new System.Globalization.CultureInfo("en-us");
|
||||
|
||||
static void Main(string[] args)
|
||||
@@ -111,6 +111,17 @@ namespace VisualParamGenerator
|
||||
{
|
||||
int id = Int32.Parse(node.Attributes["id"].Value);
|
||||
|
||||
string bumpAttrib = "false";
|
||||
|
||||
if (node.ParentNode.Name == "layer")
|
||||
{
|
||||
if (node.ParentNode.Attributes["render_pass"] != null && node.ParentNode.Attributes["render_pass"].Value == "bump")
|
||||
{
|
||||
bumpAttrib = "true";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (node.HasChildNodes)
|
||||
{
|
||||
for (int nodeNr = 0; nodeNr < node.ChildNodes.Count; nodeNr++)
|
||||
@@ -209,7 +220,7 @@ namespace VisualParamGenerator
|
||||
if (node.Attributes["label_max"] != null)
|
||||
label_max = "\"" + node.Attributes["label_max"].Value + "\"";
|
||||
|
||||
float min = Single.Parse(node.Attributes["value_min"].Value,
|
||||
float min = Single.Parse(node.Attributes["value_min"].Value,
|
||||
System.Globalization.NumberStyles.Float, EnUsCulture.NumberFormat);
|
||||
float max = Single.Parse(node.Attributes["value_max"].Value,
|
||||
System.Globalization.NumberStyles.Float, EnUsCulture.NumberFormat);
|
||||
@@ -221,9 +232,36 @@ namespace VisualParamGenerator
|
||||
else
|
||||
def = min;
|
||||
|
||||
string drivers = "null";
|
||||
if (node.HasChildNodes)
|
||||
{
|
||||
for (int nodeNr = 0; nodeNr < node.ChildNodes.Count; nodeNr++)
|
||||
{
|
||||
XmlNode cnode = node.ChildNodes[nodeNr];
|
||||
|
||||
if (cnode.Name == "param_driver" && cnode.HasChildNodes)
|
||||
{
|
||||
List<string> driverIDs = new List<string>();
|
||||
foreach (XmlNode dnode in cnode.ChildNodes)
|
||||
{
|
||||
if (dnode.Name == "driven" && dnode.Attributes["id"] != null)
|
||||
{
|
||||
driverIDs.Add(dnode.Attributes["id"].Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (driverIDs.Count > 0)
|
||||
{
|
||||
drivers = string.Format("new int[] {{ {0} }}", string.Join(", ", driverIDs.ToArray()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IDs.Add(id,
|
||||
String.Format(" Params[{0}] = new VisualParam({0}, \"{1}\", {2}, {3}, {4}, {5}, {6}, {7}f, {8}f, {9}f, ",
|
||||
id, name, group, wearable, label, label_min, label_max, def, min, max));
|
||||
String.Format(" Params[{0}] = new VisualParam({0}, \"{1}\", {2}, {3}, {4}, {5}, {6}, {7}f, {8}f, {9}f, {10}, {11}, ",
|
||||
id, name, group, wearable, label, label_min, label_max, def, min, max, bumpAttrib, drivers));
|
||||
|
||||
if (group == 0)
|
||||
++count;
|
||||
@@ -245,7 +283,7 @@ namespace VisualParamGenerator
|
||||
foreach (KeyValuePair<int, string> line in IDs)
|
||||
{
|
||||
output.Write(line.Value);
|
||||
|
||||
|
||||
if (Alphas.ContainsKey(line.Key))
|
||||
{
|
||||
output.Write(Alphas[line.Key] + ", ");
|
||||
|
||||
@@ -91,10 +91,14 @@ namespace OpenMetaverse
|
||||
public float MinValue;
|
||||
/// <summary>Maximum value</summary>
|
||||
public float MaxValue;
|
||||
/// <summary>Is this param used for creation of bump layer?</summary>
|
||||
public bool IsBumpAttribute;
|
||||
/// <summary>Alpha blending/bump info</summary>
|
||||
public VisualAlphaParam? AlphaParams;
|
||||
/// <summary>Color information</summary>
|
||||
public VisualColorParam? ColorParams;
|
||||
/// <summary>Array of param IDs that are drivers for this parameter</summary>
|
||||
public int[] Drivers;
|
||||
/// <summary>
|
||||
/// Set all the values through the constructor
|
||||
/// </summary>
|
||||
@@ -108,7 +112,11 @@ namespace OpenMetaverse
|
||||
/// <param name="def">Default value</param>
|
||||
/// <param name="min">Minimum value</param>
|
||||
/// <param name="max">Maximum value</param>
|
||||
public VisualParam(int paramID, string name, int group, string wearable, string label, string labelMin, string labelMax, float def, float min, float max, VisualAlphaParam? alpha, VisualColorParam? colorParams)
|
||||
/// <param name="isBumpAttribute">Is this param used for creation of bump layer?</param>
|
||||
/// <param name="drivers">Array of param IDs that are drivers for this parameter</param>
|
||||
/// <param name="alpha">Alpha blending/bump info</param>
|
||||
/// <param name="colorParams">Color information</param>
|
||||
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;
|
||||
@@ -120,6 +128,8 @@ namespace OpenMetaverse
|
||||
DefaultValue = def;
|
||||
MaxValue = max;
|
||||
MinValue = min;
|
||||
IsBumpAttribute = isBumpAttribute;
|
||||
Drivers = drivers;
|
||||
AlphaParams = alpha;
|
||||
ColorParams = colorParams;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user