Added color and alpha blending/bump information to VisualParams (towards LIBOMV-658)
git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3047 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -1,8 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace libsecondlife
|
||||
namespace OpenMetaverse
|
||||
{
|
||||
/// <summary>
|
||||
/// Operation to apply when applying color to texture
|
||||
/// </summary>
|
||||
public enum VisualColorOperation
|
||||
{
|
||||
None,
|
||||
Blend,
|
||||
Multiply
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Information needed to translate visual param value to RGBA color
|
||||
/// </summary>
|
||||
public struct VisualColorParam
|
||||
{
|
||||
public VisualColorOperation Operation;
|
||||
public System.Drawing.Color[] Colors;
|
||||
|
||||
/// <summary>
|
||||
/// Construct VisualColorParam
|
||||
/// </summary>
|
||||
/// <param name="operation">Operation to apply when applying color to texture</param>
|
||||
/// <param name="colors">Colors</param>
|
||||
public VisualColorParam(VisualColorOperation operation, System.Drawing.Color[] colors)
|
||||
{
|
||||
Operation = operation;
|
||||
Colors = colors;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents alpha blending and bump infor for a visual parameter
|
||||
/// such as sleive length
|
||||
/// </summary>
|
||||
public struct VisualAlphaParam
|
||||
{
|
||||
/// <summary>Stregth of the alpha to apply</summary>
|
||||
public float Domain;
|
||||
|
||||
/// <summary>File containing the alpha channel</summary>
|
||||
public string TGAFile;
|
||||
|
||||
/// <summary>Skip blending if parameter value is 0</summary>
|
||||
public bool SkipIfZero;
|
||||
|
||||
/// <summary>Use miltiply insted of alpha blending</summary>
|
||||
public bool MultiplyBlend;
|
||||
|
||||
/// <summary>
|
||||
/// Create new alhpa information for a visual param
|
||||
/// </summary>
|
||||
/// <param name="domain">Stregth of the alpha to apply</param>
|
||||
/// <param name="tgaFile">File containing the alpha channel</param>
|
||||
/// <param name="skipIfZero">Skip blending if parameter value is 0</param>
|
||||
/// <param name="multiplyBlend">Use miltiply insted of alpha blending</param>
|
||||
public VisualAlphaParam(float domain, string tgaFile, bool skipIfZero, bool multiplyBlend)
|
||||
{
|
||||
Domain = domain;
|
||||
TGAFile = tgaFile;
|
||||
SkipIfZero = skipIfZero;
|
||||
MultiplyBlend = multiplyBlend;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// A single visual characteristic of an avatar mesh, such as eyebrow height
|
||||
/// </summary>
|
||||
@@ -28,7 +91,10 @@ namespace libsecondlife
|
||||
public float MinValue;
|
||||
/// <summary>Maximum value</summary>
|
||||
public float MaxValue;
|
||||
|
||||
/// <summary>Alpha blending/bump info</summary>
|
||||
public VisualAlphaParam? AlphaParams;
|
||||
/// <summary>Color information</summary>
|
||||
public VisualColorParam? ColorParams;
|
||||
/// <summary>
|
||||
/// Set all the values through the constructor
|
||||
/// </summary>
|
||||
@@ -42,7 +108,7 @@ namespace libsecondlife
|
||||
/// <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)
|
||||
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)
|
||||
{
|
||||
ParamID = paramID;
|
||||
Name = name;
|
||||
@@ -54,6 +120,8 @@ namespace libsecondlife
|
||||
DefaultValue = def;
|
||||
MaxValue = max;
|
||||
MinValue = min;
|
||||
AlphaParams = alpha;
|
||||
ColorParams = colorParams;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +130,8 @@ namespace libsecondlife
|
||||
/// </summary>
|
||||
public static class VisualParams
|
||||
{
|
||||
public static SortedList<int, VisualParam> Params = new SortedList<int, VisualParam>();
|
||||
|
||||
public static VisualParam Find(string name, string wearable)
|
||||
{
|
||||
foreach (KeyValuePair<int, VisualParam> param in Params)
|
||||
@@ -71,7 +141,5 @@ namespace libsecondlife
|
||||
return new VisualParam();
|
||||
}
|
||||
|
||||
public static SortedList<int, VisualParam> Params = new SortedList<int, VisualParam>();
|
||||
|
||||
static VisualParams()
|
||||
{
|
||||
Reference in New Issue
Block a user