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


C# Color.ToVector4方法代码示例

本文整理汇总了C#中Color.ToVector4方法的典型用法代码示例。如果您正苦于以下问题:C# Color.ToVector4方法的具体用法?C# Color.ToVector4怎么用?C# Color.ToVector4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Color的用法示例。


在下文中一共展示了Color.ToVector4方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectColorBox

 public SelectColorBox(TextBoxEnterEvent e, Color c)
     : base("", "", e, -1, Keys.Enter)
 {
     this.size = new Vector2(320, 256);
     Center();
     r = new ColorDial(this.position + new Vector2((SPACE / (BARS + 1)) * 1 + 0 * (this.size.X - SPACE) / BARS , 8), new Vector2((this.size.X - SPACE) / BARS, this.size.Y - 48), Color.Red, c.ToVector4().X);
     g = new ColorDial(this.position + new Vector2((SPACE / (BARS + 1)) * 2 + 1 * (this.size.X - SPACE) / BARS, 8), new Vector2((this.size.X - SPACE) / BARS, this.size.Y - 48), Color.Green, c.ToVector4().Y);
     b = new ColorDial(this.position + new Vector2((SPACE / (BARS + 1)) * 3 + 2 * (this.size.X - SPACE) / BARS, 8), new Vector2((this.size.X - SPACE) / BARS, this.size.Y - 48), Color.Blue, c.ToVector4().Z);
     a = new ColorDial(this.position + new Vector2((SPACE / (BARS + 1)) * 4 + 3 * (this.size.X - SPACE) / BARS, 8), new Vector2((this.size.X - SPACE) / BARS, this.size.Y - 48), Color.Gray, c.ToVector4().W);
 }
开发者ID:adamgryu,项目名称:NewBabbleEngine,代码行数:10,代码来源:SelectColorBox.cs

示例2: Triangle

		public Triangle( Vector3 p1, Vector3 p2, Vector3 p3, Color color ) {
			myColor = color.ToVector4();
			InitEffect();
			SetUpVertices( p1, p2, p3, color );
			SetUpIndices();
			Update();
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:7,代码来源:Triangle.cs

示例3: SetStates

 //public void BeginWire()
 //{
 //    graphics.RasterizerState = wire;
 //}
 void SetStates(Color color, Vector2 targetSize)
 {
     graphics.RasterizerState = wire;
     effectColor.SetValue(color.ToVector4());
     effectSize.SetValue(new Vector2(1f / targetSize.X, 1f / targetSize.Y));
     effect.CurrentTechnique.Passes[0].Apply();
 }
开发者ID:MasakiMuto,项目名称:MasaLibs,代码行数:11,代码来源:PrimitiveBatch.cs

示例4: MultiplyBlend

        public static Color MultiplyBlend(Color a, Color b)
        {
            Vector4 av = a.ToVector4();
            Vector4 bv = b.ToVector4();

            return new Color(av * bv);
        }
开发者ID:rodya-mirov,项目名称:Infinite-Tile-Engine-2D,代码行数:7,代码来源:Blending.cs

示例5: BlockVertex

 public BlockVertex(Vector3 position, HalfVector2 blockTextureCoordinate, HalfVector4 light, Color tint)
 {
     m_position = position;
     m_blockTextureCoordinate = blockTextureCoordinate;
     m_light = light;
     m_tint = new HalfVector4(tint.ToVector4());
 }
开发者ID:HaKDMoDz,项目名称:4DBlockEngine,代码行数:7,代码来源:BlockVertex.cs

示例6: Multiply

        public static Color Multiply(Color color1, Color color2)
        {
            Vector4 v1 = color1.ToVector4();
            Vector4 v2 = color2.ToVector4();

            return new Color(v1.X * v2.X, v1.Y * v2.Y, v1.Z * v2.Z, v1.W * v2.W);
        }
开发者ID:jaquadro,项目名称:MonoGdx,代码行数:7,代码来源:ColorExt.cs

示例7: initialize

        public void initialize( string name, Vector3 position, Vector3 direction, Color color, float scaleModifier = 1.0f, int nParticlesModifier = 0, float lifetimeModifier = 0.0f)
        {
            particles.Clear();
            data = ParticleManager.Instance.getBaseParticleSystemData(name);
            this.position = position;
            this.direction = direction;

            // modify the base data with the parameters
            if (nParticlesModifier != 0)
            {
                data.nParticles = nParticlesModifier;
            }
            if (lifetimeModifier != 0.0f)
            {
                data.systemLife = lifetimeModifier;
                data.particlesLife = lifetimeModifier;
            }

            data.size *= scaleModifier;
            data.sizeIni *= scaleModifier;
            data.sizeEnd *= scaleModifier;
            data.positionVarianceMin *= scaleModifier;
            data.positionVarianceMax *= scaleModifier;
            data.directionVarianceMin *= scaleModifier;
            data.directionVarianceMax *= scaleModifier;
            data.accelerationVarianceMin *= scaleModifier;
            data.accelerationVarianceMax *= scaleModifier;
            data.color = new Color(data.color.ToVector4() * color.ToVector4());

            // get an aproximate number of the simultaneous particles that will have the system
            float spawnRatio = data.particlesLife / (float)data.nParticles;
            particles.Capacity = data.nParticles;

            switch(data.type)
            {
                case ParticleSystemData.tParticleSystem.Burst:
                    for(int i=0; i<data.nParticles; i++)
                    {
                        Particle p = new Particle();
                        p.isDead = true;
                        initializeParticle(p);
                        particles.Add(p);
                    }
                    break;
                case ParticleSystemData.tParticleSystem.Fountain:
                    for(int i=0; i<data.nParticles; i++)
                    {
                        Particle p = new Particle();
                        // we want particles prepared to be spawned with the spawnRatio ratio, so we set'em all alive but invisible
                        p.life = 1.3f + spawnRatio * i;
                        p.isDead = false;
                        p.color *= 0;
                        particles.Add(p);
                    }
                    break;
                default:
                    break;
            }
        }
开发者ID:doanhtdpl,项目名称:naughty-invaders,代码行数:59,代码来源:ParticleSystem.cs

示例8: structVertex

 public structVertex(Vector4 CoordVertex, Vector2 CoordTex, Vector4 Normale, Color Couleur, Vector4 Tangent)
 {
     this.CoordTex = CoordTex;
     this.CoordVertex = CoordVertex;
     this.Normale = Normale;
     this.Couleur = Couleur.ToVector4();
     this.Tangent = Tangent;
 }
开发者ID:Arys02,项目名称:Underground,代码行数:8,代码来源:OBJLoader.cs

示例9: Spark

 public Spark(Texture2D Texture, int From, int To, float Time, Color color)
 {
     start = From;
     end = To;
     time = Time;
     parameter = 0.0f;
     Color = color.ToVector4();
 }
开发者ID:egdman,项目名称:proteins,代码行数:8,代码来源:GraphSystem.cs

示例10: GetColor

        public override Color GetColor(Player player, Color lightColor)
        {
            bool lighting = true;
            Color color = _colorProcessor(player, player.hairColor, ref lighting);
            if (lighting)
                return new Color(color.ToVector4() * lightColor.ToVector4());

            return color;
        }
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:9,代码来源:LegacyHairShaderData.cs

示例11: DrawText

        /// <summary>
        /// Drawn text using given font, position and color
        /// </summary>
        public void DrawText(FontType font, String text, Vector2 position, Color color, bool dropShadow)
        {
            if (mIsTextModeActive)
            {
                if (dropShadow)
                    mSpriteBatch.DrawString(Fonts[(int)font], text, position + mDropShadowOffset, new Color(color.ToVector4() * new Vector4(0, 0, 0, 1)));

                mSpriteBatch.DrawString(Fonts[(int)font], text, position, color);
            }
        }
开发者ID:Tengato,项目名称:Mechadrone1,代码行数:13,代码来源:FontManager.cs

示例12: GetColor

		public override Color GetColor(Player player, Color lightColor)
		{
			bool flag = true;
			Color result = this._colorProcessor(player, player.hairColor, ref flag);
			if (flag)
			{
				return new Color(result.ToVector4() * lightColor.ToVector4());
			}
			return result;
		}
开发者ID:thegamingboffin,项目名称:Ulterraria_Reborn_GitHub,代码行数:10,代码来源:LegacyHairShaderData.cs

示例13: Create

        public static Texture2D Create(GraphicsDevice graphicsDevice, int width = 1, int height = 1, Color color = new Color())
        {
            var texture = new Texture2D(graphicsDevice,
                                        width,
                                        height);

            var colors = new Color[width * height];
            for (var i = 0; i < colors.Length; i++) colors[i] = new Color(color.ToVector4());

            texture.SetData(colors);

            return texture;
        }
开发者ID:jaysan1292,项目名称:JdGameBase,代码行数:13,代码来源:ColorTexture.cs

示例14: AddLine

        //  Add 3d line into cache, so then we can draw many lines at once - by calling DrawLinesFromCache()
        public static void AddLine(Vector3 pointFrom, Vector3 pointTo, Color colorFrom, Color colorTo)
        {
            MyCommonDebugUtils.AssertDebug(IsFull(0) == false);

            if (m_linesCount + 2 >= MyDebugDrawCachedLinesConstants.MAX_LINES_IN_CACHE)
                return;

            m_verticesLine[m_linesCount * 2 + 0].Position = pointFrom;
            m_verticesLine[m_linesCount * 2 + 0].Color = colorFrom.ToVector4();
            m_verticesLine[m_linesCount * 2 + 1].Position = pointTo;
            m_verticesLine[m_linesCount * 2 + 1].Color = colorTo.ToVector4();
            m_linesCount++;
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:14,代码来源:MyDebugDrawCachedLines.cs

示例15: ColorMorph

        //int colormixer = NewImage(1, 1);
        Color ColorMorph(Color col1, Color col2, int step, int totalsteps)
        {
            float factor = step / (float)totalsteps;
            var vcol1 = col1.ToVector4();
            var vcol2 = col2.ToVector4();
            var result = vcol1 * (1-factor) + vcol2 * factor;
            result.W = 1;
            return new Color(result);

            //SetPixel(0, 0, col1, colormixer);
            //SetLucent(100 - (step * 100 / totalsteps));
            //SetPixel(0, 0, col2, colormixer);
            //SetLucent(0);
            //return GetPixel(0, 0, colormixer);
        }
开发者ID:zeromus,项目名称:carotengine,代码行数:16,代码来源:bgr.cs


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