本文整理汇总了C#中System.Color.ToVector4方法的典型用法代码示例。如果您正苦于以下问题:C# Color.ToVector4方法的具体用法?C# Color.ToVector4怎么用?C# Color.ToVector4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Color
的用法示例。
在下文中一共展示了Color.ToVector4方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeTransparent
public static void MakeTransparent(TextureContent texture, Color color)
{
foreach (BitmapContent bitmap in texture.Faces.SelectMany(chain => chain))
{
if (bitmap is PixelBitmapContent<Vector4>)
((PixelBitmapContent<Vector4>)bitmap).ReplaceColor(color.ToVector4(), Vector4.Zero);
else if (bitmap is PixelBitmapContent<Color>)
((PixelBitmapContent<Color>)bitmap).ReplaceColor(color, Color.Transparent);
}
}
示例2: DrawLine
public void DrawLine(Vector3D v0, Vector3D v1, Color color)
{
if (numVertices + 2 < maxSize)
{
lineData[numVertices].Position = v0 - MyRenderCamera.Position;
lineData[numVertices].Color = color.ToVector4();
lineData[numVertices + 1].Position = v1 - MyRenderCamera.Position;
lineData[numVertices + 1].Color = color.ToVector4();
numVertices += 2;
}
}
示例3: OnValueChange
private void OnValueChange(MyGuiControlSlider sender)
{
var humanPlayer = MySession.LocalHumanPlayer;
if (humanPlayer == null)
return;
UpdateLabels();
Color c = new Color();
c = (new Vector3(m_hueSlider.Value/360f, MathHelper.Clamp(m_saturationSlider.Value/100f + 0.8f,0f,1f), MathHelper.Clamp(m_valueSlider.Value/100f + 0.55f,0f,1f))).HSVtoColor();
m_colorPaletteControlsList[humanPlayer.SelectedBuildColorSlot].ColorMask = c.ToVector4();
humanPlayer.SelectedBuildColor = new Vector3((m_hueSlider.Value / 360f), (m_saturationSlider.Value / 100f), (m_valueSlider.Value / 100f));
}
示例4: OnValueChange
private void OnValueChange(MyGuiControlSlider sender)
{
UpdateLabels();
Color c = new Color();
c = (new Vector3(m_hueSlider.Value/360f, MathHelper.Clamp(m_saturationSlider.Value/100f + 0.8f,0f,1f), MathHelper.Clamp(m_valueSlider.Value/100f + 0.55f,0f,1f))).HSVtoColor();
m_colorPaletteControlsList[MyToolbar.m_currentColorMaskHSV].ColorMask = c.ToVector4();
MyToolbar.ColorMaskHSV = new Vector3((m_hueSlider.Value / 360f), (m_saturationSlider.Value / 100f), (m_valueSlider.Value / 100f));
}
示例5: DrawOnScreenLine
public void DrawOnScreenLine(Vector3 v0, Vector3 v1, Color color)
{
if (numOSVertices + 2 < maxSize)
{
onScreenLineData[numOSVertices].Position = v0;
onScreenLineData[numOSVertices].Color = color.ToVector4();
onScreenLineData[numOSVertices + 1].Position = v1;
onScreenLineData[numOSVertices + 1].Color = color.ToVector4();
numOSVertices += 2;
}
}
示例6: OnMyShadowCheckEnable
/*
public void OnMyShadowCheckEnable(MyGuiControlCheckbox sender)
{
foreach (MyPrefabLight prefabLight in m_prefabLights)
{
MyLight myLight = prefabLight.GetLight();
if (sender == m_spotLightShadowCheckbox)
{
myLight.ShadowsEnabled = sender.Checked;
}
prefabLight.OnWorldPositionChanged(this);
prefabLight.UpdateEffect();
}
OnComponentChange(null);
}
*/
void OnComponentChange(MyGuiControlSlider sender)
{
foreach (MyPrefabLight prefabLight in m_prefabLights)
{
MyLight light = prefabLight.GetLight();
Color tmpColor = new Color();
tmpColor.R = (byte)m_pointNormalLightColorSlider[0].GetValue();
tmpColor.G = (byte)m_pointNormalLightColorSlider[1].GetValue();
tmpColor.B = (byte)m_pointNormalLightColorSlider[2].GetValue();
light.Color = tmpColor.ToVector4();
tmpColor.R = (byte)m_specularLightColorSlider[0].GetValue();
tmpColor.G = (byte)m_specularLightColorSlider[1].GetValue();
tmpColor.B = (byte)m_specularLightColorSlider[2].GetValue();
light.SpecularColor = tmpColor.ToVector3();
light.Falloff = m_pointFallOffSlider.GetValue(); // allowed values 0.1f-5.0f
light.Range = m_pointRangeSlider.GetValue(); // allowed values 0.0f-MyLightsConstants.MAX_POINTLIGHT_RADIUS
light.Intensity = prefabLight.m_IntensityMax = m_pointIntensitySlider.GetValue(); // allowed values 0.0f-10.0f
light.PointLightOffset = m_pointOffsetSlider.GetValue();
tmpColor.R = (byte)m_spotNormalLightColorSlider[0].GetValue();
tmpColor.G = (byte)m_spotNormalLightColorSlider[1].GetValue();
tmpColor.B = (byte)m_spotNormalLightColorSlider[2].GetValue();
light.ReflectorColor = tmpColor.ToVector4();
light.ReflectorFalloff = m_spotFallOffSlider.GetValue(); // allowed values 0.1f-5.0f
light.ReflectorRange = m_spotRangeSlider.GetValue(); // allowed values 0.0f-MyLightsConstants.MAX_SPOTLIGHT_RANGE
light.ReflectorIntensity = prefabLight.ReflectorIntensityMax = m_spotIntensitySlider.GetValue(); // allowed values 0.0f-10.0f
light.ReflectorConeDegrees = m_spotAngleSlider.GetValue(); // allowed values 0.0f-MyLightsConstants.MAX_SPOTLIGHT_ANGLE
light.ShadowDistance = m_spotLightShadowDistance.GetValue();
prefabLight.FlashOffset = m_flashOffsetSlider.GetValue();
}
}
示例7: HUDMessage
/// <summary>
/// Data to transport for HUD Text Display
/// </summary>
/// <param name="messageid">Message id is automatically generated if set to 0. Resend a message with the same ID to overwrite previously sent messages</param>
/// <param name="timetolive">How many frames a message will live</param>
/// <param name="Origin">Vector 2D, middle of screen is (0,0) up is positive, down is negative, right is positive, left is negative. up to +1 and -1</param>
/// <param name="Scale">Scale multiplier for text, 0.5 is half as big. 2.0 twice as big.</param>
/// <param name="HideHud">Automatically hide this HUD element when player hides their HUD</param>
/// <param name="Shadowing">Enables text shadowing</param>
/// <param name="Shadowcolor">Specifies Text Shadow Color</param>
/// <param name="message">Message string that you want to send. <color=colorname> to change the color of the text. </param>
public HUDMessage(long messageid, int timetolive, Vector2D Origin, double Scale, bool HideHud, bool Shadowing, Color Shadowcolor, string message)
{
options = Options.None;
if (HideHud)
options |= Options.HideHud;
if (Shadowing)
options |= Options.Shadowing;
scale = Scale;
id = messageid;
ttl = timetolive;
shadowcolor = Shadowcolor.ToVector4();
origin = Origin;
this.message = message;
}
示例8: Draw
//Draw texture section
internal void Draw(Texture2D texture2D, Vector2 position, Nullable<Rectangle> source, Color color)
{
graphicsDevice.DrawQueue.EnqueueSprite(new DrawSpriteCall(texture2D, position, source, color.ToVector4(), Vector2.Zero, SpriteEffects.None));
}
示例9: AddDrawTriangle
public static void AddDrawTriangle(Vector3 vertex1, Vector3 vertex2, Vector3 vertex3, Color color)
{
m_moints.Add(new MyVertexFormatPositionColor(vertex1, color.ToVector4()));
m_moints.Add(new MyVertexFormatPositionColor(vertex2, color.ToVector4()));
m_moints.Add(new MyVertexFormatPositionColor(vertex3, color.ToVector4()));
}
示例10: DrawLine2D
public static void DrawLine2D(Vector2 pointFrom, Vector2 pointTo, Color colorFrom, Color colorTo)
{
Device graphicsDevice = MyMinerGame.Static.GraphicsDevice;
// Create the line vertices
m_verticesLine[0].Position = new Vector3(pointFrom, 0);
m_verticesLine[0].Color = colorFrom.ToVector4();
m_verticesLine[1].Position = new Vector3(pointTo, 0);
m_verticesLine[1].Color = colorTo.ToVector4();
var effect = (MyEffectModelsDiffuse)MyRender.GetEffect(MyEffects.ModelDiffuse);
effect.SetProjectionMatrix(Matrix.CreateOrthographicOffCenter(0.0F, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, 0.0F, 0.0F, -1.0F));
effect.SetViewMatrix(Matrix.Identity);
effect.SetWorldMatrix(Matrix.Identity);
effect.SetTechnique(MyEffectModelsDiffuse.Technique.PositionColor);
graphicsDevice.VertexDeclaration = MyVertexFormatPositionColor.VertexDeclaration;
// Draw the line
effect.Begin();
graphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, 0, 1, m_verticesLine);
effect.End();
}
示例11: DrawLine3D
public static void DrawLine3D(ref Vector3 pointFrom, ref Vector3 pointTo, ref Color colorFrom, ref Color colorTo)
{
Device graphicsDevice = MyMinerGame.Static.GraphicsDevice;
// Create the line vertices
m_verticesLine[0].Position = pointFrom;
m_verticesLine[0].Color = colorFrom.ToVector4();
m_verticesLine[1].Position = pointTo;
m_verticesLine[1].Color = colorTo.ToVector4();
var effect = (MyEffectModelsDiffuse)MyRender.GetEffect(MyEffects.ModelDiffuse);
effect.SetProjectionMatrix(Matrix.CreatePerspectiveFieldOfView(MyCamera.FovWithZoom, MyCamera.AspectRatio, 0.01f, 1000000));
effect.SetViewMatrix(MyCamera.ViewMatrix);
effect.SetWorldMatrix(Matrix.Identity);
effect.SetTechnique(MyEffectModelsDiffuse.Technique.PositionColor);
graphicsDevice.VertexDeclaration = MyVertexFormatPositionColor.VertexDeclaration;
// Draw the line
effect.Begin();
graphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, 0, 1, m_verticesLine);
effect.End();
}
示例12: SetAllColors
public void SetAllColors(Color newColor)
{
m_light.Color = newColor.ToVector4();
m_light.ReflectorColor = newColor.ToVector4();
m_light.SpecularColor = newColor.ToVector3();
}
示例13: DrawLine
public void DrawLine(Vector3 v0, Vector3 v1, Color color)
{
if (numVertices + 2 < maxSize)
{
lineData[numVertices].Position = v0;
lineData[numVertices].Color = color.ToVector4();
lineData[numVertices + 1].Position = v1;
lineData[numVertices + 1].Color = color.ToVector4();
numVertices += 2;
}
}
示例14: DrawLines
public void DrawLines(Vector3[] lineData, Color color)
{
// drawing in 3D requires you to define vertices of a certain type
// VertexPositionColor simply means a vertex with a position and color
MyVertexFormatPositionColor[] line = new MyVertexFormatPositionColor[lineData.Length];
for (int i = 0; i < lineData.Length; i++)
{
line[i] = new MyVertexFormatPositionColor(lineData[i], color.ToVector4());
}
var effect = (MyEffectModelsDiffuse)MyRender.GetEffect(MyEffects.ModelDiffuse);
// you have to set these parameters for the basic effect to be able to draw
// on the screen
effect.SetProjectionMatrix(MyCamera.ProjectionMatrix);
effect.SetViewMatrix(MyCamera.ViewMatrix);
// graphics card should use basic effect shader
effect.Begin();
// you have to tell the graphics card what kind of vertices it will be receiving
MinerWars.AppCode.App.MyMinerGame.Static.GraphicsDevice.VertexDeclaration = MyVertexFormatPositionColor.VertexDeclaration;
MinerWars.AppCode.App.MyMinerGame.Static.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, 0, lineData.Length, line);
effect.End();
}
示例15: DrawString
internal void DrawString(SpriteFont font, string value, Vector2 position, Color color)
{
graphicsDevice.DrawQueue.EnqueueString(new DrawStringCall(font, value, position, color.ToVector4()));
}