当前位置: 首页>>代码示例>>C#>>正文


C# Color.ToVector4方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:greenboxal,项目名称:greenbox3d,代码行数:10,代码来源:TextureHelpers.cs

示例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;
     }
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:11,代码来源:MyLineBatch.cs

示例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));
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:12,代码来源:MyGuiScreenColorPicker.cs

示例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));
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:8,代码来源:MyGuiScreenColorPicker.cs

示例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;
     }
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:11,代码来源:MyLineBatch.cs

示例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();
            }
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:52,代码来源:MyGuiControlEditLights.cs

示例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. &lt;color=colorname&gt; 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;
 }
开发者ID:ZEvangile,项目名称:SE-HungerMod,代码行数:25,代码来源:HUDApi.cs

示例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));
        }
开发者ID:NotYours180,项目名称:UnityXNA,代码行数:5,代码来源:SpriteBatch.cs

示例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())); 
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:6,代码来源:MyDebugDraw.cs

示例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();
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:24,代码来源:MyDebugDraw.cs

示例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();                
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:23,代码来源:MyDebugDraw.cs

示例12: SetAllColors

 public void SetAllColors(Color newColor)
 {
     m_light.Color = newColor.ToVector4();
     m_light.ReflectorColor = newColor.ToVector4();
     m_light.SpecularColor = newColor.ToVector3();
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:6,代码来源:MyPrefabLight.cs

示例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;
     }
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:11,代码来源:MyLineBatch.cs

示例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();
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:27,代码来源:MyLineBatch.cs

示例15: DrawString

 internal void DrawString(SpriteFont font, string value, Vector2 position, Color color)
 {
     graphicsDevice.DrawQueue.EnqueueString(new DrawStringCall(font, value, position, color.ToVector4()));
 }
开发者ID:NotYours180,项目名称:UnityXNA,代码行数:4,代码来源:SpriteBatch.cs


注:本文中的System.Color.ToVector4方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。