本文整理汇总了C#中ColorValue类的典型用法代码示例。如果您正苦于以下问题:C# ColorValue类的具体用法?C# ColorValue怎么用?C# ColorValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColorValue类属于命名空间,在下文中一共展示了ColorValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainForm_Load
private void MainForm_Load(object sender, EventArgs e)
{
renderView.ShowWorkingGrid(false);
renderView.ExecuteCommand("ShadeWithEdgeMode");
renderView.ShowCoordinateAxis(false);
ColorValue clr = new ColorValue(33f / 255f, 40f / 255f, 48f / 255f, 1);
renderView.SetBackgroundColor(clr, clr, clr);
Renderer renderer = renderView.Renderer;
// Customize the Axis
ScreenWidget coodinateNode = new ScreenWidget();
AxesWidget axesNode = new AxesWidget();
axesNode.SetArrowText((int)EnumAxesDirection.Axes_Z, "");
coodinateNode.SetNode(axesNode);
coodinateNode.SetWidgetPosition(2);
renderer.SetCoordinateWidget(coodinateNode);
// Set the fixed Top View
renderer.SetStandardView(EnumStandardView.SV_Top);
renderer.SetViewType(EnumStandardView.SV_Top);
this.renderView.RequestDraw();
}
示例2: OnAttach
///////////////////////////////////////////
protected override void OnAttach()
{
base.OnAttach();
//create window
window = ControlDeclarationManager.Instance.CreateControl(
"Gui\\RegisterWindow.gui");
Controls.Add(window);
MouseCover = true;
BackColor = new ColorValue(0, 0, 0, .5f);
RealName = (EditBox)window.Controls["RealName"];
UserName = (EditBox)window.Controls["UserName"];
//Age = (EditBox)window.Controls["Age"];
//OfAge = (CheckBox)window.Controls["OfAge"];
Pass1 = (PasswordBox)window.Controls["Pass1"];
Pass2 = (PasswordBox)window.Controls["Pass2"];
Email = (EditBox)window.Controls["Email"];
((Button)window.Controls["Exit"]).Click += Exit_Click;
((Button)window.Controls["Register"]).Click += Register_Click;
((Button)window.Controls["Cancel"]).Click += Cancel_Click;
}
示例3: OnAttach
protected override void OnAttach()
{
base.OnAttach();
EControl window = ControlDeclarationManager.Instance.CreateControl( "Gui\\AntMenuWindow.gui" );
Controls.Add( window );
//( (EButton)window.Controls[ "Maps" ] ).Click += mapsButton_Click;
( (EButton)window.Controls[ "LoadSave" ] ).Click += loadSaveButton_Click;
( (EButton)window.Controls[ "Options" ] ).Click += optionsButton_Click;
( (EButton)window.Controls[ "PostEffects" ] ).Click += postEffectsButton_Click;
( (EButton)window.Controls[ "Debug" ] ).Click += debugButton_Click;
( (EButton)window.Controls[ "About" ] ).Click += aboutButton_Click;
( (EButton)window.Controls[ "ExitToMainMenu" ] ).Click += exitToMainMenuButton_Click;
( (EButton)window.Controls[ "Exit" ] ).Click += exitButton_Click;
( (EButton)window.Controls[ "Resume" ] ).Click += resumeButton_Click;
if( GameWindow.Instance == null )
window.Controls[ "ExitToMainMenu" ].Enable = false;
if( GameNetworkServer.Instance != null || GameNetworkClient.Instance != null )
{
//window.Controls[ "Maps" ].Enable = false;
window.Controls[ "LoadSave" ].Enable = false;
}
MouseCover = true;
BackColor = new ColorValue( 0, 0, 0, .5f );
}
示例4: configurarLuces
public void configurarLuces(MeshLightData mld)
{
Effect effect = mld.mesh.Effect;
ColorValue[] lightColors = new ColorValue[3];
Vector4[] pointLightPositions = new Vector4[3];
float[] pointLightIntensity = new float[3];
float[] pointLightAttenuation = new float[3];
float[] spotLightAngleCos = new float[3];
float[] spotLightExponent = new float[3];
Vector4[] spotLightDir = new Vector4[3];
for (int i = 0; i < 3; i++)
{
lightColors[i] = ColorValue.FromColor(mld.lights[i].color);
pointLightPositions[i] = TgcParserUtils.vector3ToVector4(mld.lights[i].pos);
spotLightDir[i] = TgcParserUtils.vector3ToVector4(mld.lights[i].direccion);
pointLightIntensity[i] = mld.lights[i].intencidad;
pointLightAttenuation[i] = mld.lights[i].atenuacion;
spotLightExponent[i] = mld.lights[i].exp;
spotLightAngleCos[i] = FastMath.ToRad(mld.lights[i].angleCos);
}
effect.SetValue("spotLightAngleCos", spotLightAngleCos);
effect.SetValue("spotLightExponent", spotLightExponent);
effect.SetValue("lightIntensity", pointLightIntensity);
effect.SetValue("lightAttenuation", pointLightAttenuation);
effect.SetValue("lightColor", lightColors);
effect.SetValue("spotLightDir", spotLightDir);
effect.SetValue("lightPosition", pointLightPositions);
}
示例5: Blend
public ColorValue[] States; // Modulate colors for all possible control states
#endregion Fields
#region Methods
/// <summary>Blend the colors together</summary>
public void Blend(ControlState state, float elapsedTime, float rate)
{
if ((States == null) || (States.Length == 0) )
return; // Nothing to do
ColorValue destColor = States[(int)state];
Current = ColorOperator.Lerp(Current, destColor, 1.0f - (float)Math.Pow(rate, 30 * elapsedTime) );
}
示例6: Popup2
public Popup2(RenderSystem rs, Texture tex, int x, int y, float duration, ColorValue modColor)
{
this.x = x;
this.y = y;
this.texture = tex;
this.duration = duration;
this.modColor = modColor;
}
示例7: StringBlock
/// <summary>Creates a new StringBlock</summary>
/// <param name="text">Text to render</param>
/// <param name="textBox">Text box to constrain text</param>
/// <param name="alignment">Font alignment</param>
/// <param name="size">Font size in pixels(max height of line)</param>
/// <param name="color">Color</param>
/// <param name="kerning">true to use kerning, false otherwise.</param>
public StringBlock(string text, RectangleF textRect, Align alignment,
float size, ColorValue color, bool kerning)
{
Text = text;
TextRect = textRect;
ViewportRect = textRect;
Alignment = alignment;
Size = size;
Color = color;
Kerning = kerning;
}
示例8: GetInterpolatedColour
/// <summary>
/// Gets the interpolated colour between two pixels from an image.
/// Interpolate a texture pixel by hand. (fx, fy) are in texture coordinates,
/// ranging [0-1] across the entire texture.
/// Smooth blending is only done on the x coordinate.
/// Wrapping is only supported on X as well.</summary>
public static ColorValue GetInterpolatedColour(float fx, float fy, Bitmap img, bool wrapX)
{
if (img == null)
return CaelumUtils.ColorWhite;
// Get the image width
int imgWidth = img.Width;
int imgHeight = img.Height;
// Calculate pixel y coord.
int py = Convert.ToInt32( MathFunctions.Floor(Math.Abs(fy)*(imgHeight - 1) ));
// Snap to py image bounds.
py = Math.Max(0, Math.Min(py, imgHeight - 1));
// Get the two closest pixels on x.
// px1 and px2 are the closest integer pixels to px.
float px = fx * (img.Width - 1);
int px1 = Convert.ToInt32( MathFunctions.Floor(px));
int px2 = Convert.ToInt32( Math.Ceiling(px));
if (wrapX)
{
// Wrap x coords. The funny addition ensures that it does
// "the right thing" for negative values.
px1 = (px1 % imgWidth + imgWidth) % imgWidth;
px2 = (px2 % imgWidth + imgWidth) % imgWidth;
}
else
{
px1 = Math.Max(0, Math.Min(px1, imgWidth - 1));
px2 = Math.Max(0, Math.Min(px2, imgWidth - 1));
}
float R, G, B;
// Gets (px1, py) pixel
Color col = img.GetPixel(px1, py);
R = col.R; G = col.G; B = col.B;
ColorValue c1 = new ColorValue(R / 255, G / 255, B / 255);
// Gets (px2, py) pixel
col = img.GetPixel(px2, py);
R = col.R; G = col.G; B = col.B;
ColorValue c2 = new ColorValue(R / 255, G / 255, B / 255);
// Blend the two pixels together.
// diff is the weight between pixel 1 and pixel 2.
float diff = px - px1;
ColorValue cf = c1 * (1 - diff) + c2 * diff;
return cf;
}
示例9: Initialize
public ColorValue Current; // Current color
/// <summary>Initialize the color blending</summary>
public void Initialize(ColorValue defaultColor, ColorValue disabledColor, ColorValue hiddenColor)
{
// Create the array
States = new ColorValue[(int)ControlState.LastState];
for(int i = 0; i < States.Length; i++)
{
States[i] = defaultColor;
}
// Store the data
States[(int)ControlState.Disabled] = disabledColor;
States[(int)ControlState.Hidden] = hiddenColor;
Current = hiddenColor;
}
示例10: Control
protected Control()
{
//txtHint = TextRenderingHint.ClearTypeGridFit;
modColor = ColorValue.White;
controls = new List<Control>();
//InputEngine = gameUI.InputEngine;
//InputEngine.KeyStateChanged += this._OnKeyStateChanged;
//InputEngine.MouseDown += this._OnMouseDown;
//InputEngine.MouseMove += this._OnMouseMove;
//InputEngine.MouseUp += this._OnMouseUp;
//InputEngine.MouseWheel += this._OnMouseWheel;
}
示例11: R_FR
public void R_FR()
{
TimeSpan ts = DateTime.Now - t_start;
double t = ts.TotalSeconds;
dev2.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.Blue, 1.0f, 0);
dev2.BeginScene();
System.Drawing.Color col = System.Drawing.Color.White;
Direct3D.Material mtrl = new Direct3D.Material();
mtrl.Diffuse = col;
mtrl.Ambient = col;
dev2.Material = mtrl;
Vector4 lightdir = new Vector4((float)Math.Cos(Environment.TickCount / 550.0f), 1.0f, (float)Math.Sin(Environment.TickCount / 250.0f), 0);
dev2.Transform.World = Matrix.RotationAxis(new Vector3((float)Math.Cos(t), 1, (float)Math.Sin(Environment.TickCount / 250.0f)), Environment.TickCount / 3000.0f);
dev2.Transform.View = Matrix.LookAtLH(new Vector3(0.0f, 4.0f, -5.0f), new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f));
dev2.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, 1.0f, 1.0f, 100.0f);
ColorValue WhiteColor = new ColorValue(1.0f, 1.0f, 1.0f, 1.0f);
ColorValue YellowColor = new ColorValue(1.0f, 1.0f, 0.0f, 1.0f);
eff.SetValue("projectionMatrix", dev2.Transform.Projection);
eff.SetValue("viewMatrix", dev2.Transform.View);
eff.SetValue("worldMatrix", dev2.Transform.World);
eff.SetValue("appTime", (float)t);
// eff.SetValue("g_MaterialDiffuseColor", WhiteColor);
// eff.SetValue("g_nNumLights", 1);
dev2.SetStreamSource(0, vb, 0);
dev2.VertexFormat = CustomVertex.PositionNormal.Format;
eff.Begin(0);
for (int p = 0; p < 4; p++)
{
eff.BeginPass(p);
dev2.DrawPrimitives(PrimitiveType.TriangleList, 0, usteps * vsteps * 2 );
eff.EndPass();
}
eff.End();
dev2.EndScene();
dev2.Present();
}
示例12: OnAttach
protected override void OnAttach()
{
base.OnAttach();
Control window = ControlDeclarationManager.Instance.CreateControl("Gui\\AboutWindow.gui");
Controls.Add(window);
window.Controls["Version"].Text = EngineVersionInformation.Version;
((Button)window.Controls["Quit"]).Click += delegate(Button sender)
{
SetShouldDetach();
};
BackColor = new ColorValue(0, 0, 0, .5f);
MouseCover = true;
}
示例13: AddCircle
public static void AddCircle(this GuiRenderer renderer, Vec2 center, ColorValue color, Vec2 radius, float startAngle = 0f, float endAngle = (float)Math.PI * 2f, float divisions = 16)
{
List<GuiRenderer.TriangleVertex> tris = new List<GuiRenderer.TriangleVertex>((int)(divisions * 3));
float inc = (float)Math.PI / divisions;
float cond = endAngle * (float)(1f - 1f / divisions);
float curAngle;
for (curAngle = startAngle; curAngle < cond; curAngle += inc)
{
tris.Add(new GuiRenderer.TriangleVertex(center, color));
tris.Add(CircleVertex(curAngle, center, radius, color));
tris.Add(CircleVertex(curAngle + inc, center, radius, color));
}
tris.Add(new GuiRenderer.TriangleVertex(center, color));
tris.Add(CircleVertex(curAngle, center, radius, color));
tris.Add(CircleVertex(endAngle, center, radius, color));
renderer.AddTriangles(tris);
}
示例14: OnAttach
///////////////////////////////////////////
protected override void OnAttach()
{
base.OnAttach();
//disable check for disconnection
GameEngineApp.Instance.Client_AllowCheckForDisconnection = false;
//register config fields
EngineApp.Instance.Config.RegisterClassParameters( GetType() );
//create window
window = ControlDeclarationManager.Instance.CreateControl(
"Gui\\MultiplayerLoginWindow.gui" );
Controls.Add( window );
MouseCover = true;
BackColor = new ColorValue( 0, 0, 0, .5f );
//initialize controls
buttonCreateServer = (EButton)window.Controls[ "CreateServer" ];
buttonCreateServer.Click += CreateServer_Click;
buttonConnect = (EButton)window.Controls[ "Connect" ];
buttonConnect.Click += Connect_Click;
( (EButton)window.Controls[ "Exit" ] ).Click += Exit_Click;
//generate user name
if( string.IsNullOrEmpty( userName ) )
{
EngineRandom random = new EngineRandom();
userName = "Rabbit" + random.Next( 1000 ).ToString( "D03" );
}
editBoxUserName = (EEditBox)window.Controls[ "UserName" ];
editBoxUserName.Text = userName;
editBoxUserName.TextChange += editBoxUserName_TextChange;
editBoxConnectTo = (EEditBox)window.Controls[ "ConnectTo" ];
editBoxConnectTo.Text = connectToAddress;
editBoxConnectTo.TextChange += editBoxConnectTo_TextChange;
SetInfo( "", false );
}
示例15: OnSetFaceColor
public override void OnSetFaceColor(ColorValue clr)
{
if (clr.ToRGBA() == faceStyle.GetColor().ToRGBA())
return;
FaceStyle fs = null;
if (!faceStyleDict.TryGetValue(clr.ToRGBA(), out fs))
{
fs = new FaceStyle();
fs.SetColor(clr);
faceStyleDict.Add(clr.ToRGBA(), fs);
}
faceStyle = fs;
fileSys.WriteLine(String.Format("{0} {1} {2}", clr.R, clr.G, clr.B));
fileSys.Flush();
}