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


C# Color.ToVector3方法代码示例

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


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

示例1: Draw

        public void Draw(Matrix world, Matrix view, Matrix projection, Color newcolor, float scale, float hoveringHeight)
        {
            // Set BasicEffect parameters.
            Matrix worldMatrix = Matrix.CreateScale(scale) *
                Matrix.CreateRotationX((float)(Math.PI)) *
                Matrix.CreateTranslation(new Vector3(0, 0, hoveringHeight)) *
                world;

            basicEffect.World = worldMatrix;
            basicEffect.View = view;
            basicEffect.Projection = projection;
            basicEffect.DiffuseColor = newcolor.ToVector3();
            // basicEffect.VertexColorEnabled = true;

            //basicEffect.Alpha = color.A / 255.0f;
            basicEffect.EmissiveColor = newcolor.ToVector3();

            GraphicsDevice device = basicEffect.GraphicsDevice;
            device.DepthStencilState = DepthStencilState.Default;
            device.BlendState = BlendState.AlphaBlend;

            // Draw the model, using BasicEffect.

            foreach (ModelMesh mesh in ship.Meshes)
            {
                mesh.Draw();
            }
        }
开发者ID:cclay,项目名称:spaceconquest,代码行数:28,代码来源:ShipModel.cs

示例2: Draw

        public static void Draw(Matrix world, Matrix view, Matrix projection, Color newcolor, float scale)
        {
            // Set BasicEffect parameters.
            basicEffect.World =  Matrix.CreateRotationZ((float) (Math.PI))  * Matrix.CreateScale(2.0f) * world;
            basicEffect.View = view;
            basicEffect.Projection = projection;
            basicEffect.DiffuseColor = newcolor.ToVector3();
            //basicEffect.VertexColorEnabled = true;

            basicEffect.Alpha = newcolor.A / 255.0f;
            basicEffect.EmissiveColor = newcolor.ToVector3();
            //basicEffect.EmissiveColor = new Color(100,100,0).ToVector3();
            basicEffect.SpecularColor = new Color(255, 255, 0).ToVector3();
            basicEffect.SpecularPower = 10f;
            //basicEffect.Texture = Texture2D.FromStream(Game1.device, new FileStream(@"Content\suntexture.png", FileMode.Open));
            // basicEffect.TextureEnabled = true;

            GraphicsDevice device = basicEffect.GraphicsDevice;
            device.DepthStencilState = DepthStencilState.Default;
            device.BlendState = BlendState.AlphaBlend;

            // Draw the model, using BasicEffect.
            Matrix translationMatrix = Matrix.CreateRotationY((float)(Math.PI / 2.0f));
            foreach (ModelMesh mesh in beam.Meshes)
            {
                mesh.Draw();
            }
        }
开发者ID:cclay,项目名称:spaceconquest,代码行数:28,代码来源:ProtonBeamModel.cs

示例3: AddFace

        public int AddFace(Face.Facing facing, float x, float y, float z, Vector3 size, ref Color color)
        {
            if (color == Color.Black) Console.WriteLine("Black detected.");
                for (int i = 0; i < buffers.Count; i++)
                {
                    if (!buffers[i].Full)
                    {
                        //int k = buffers[i].AddFace(Face.getFace(facing, new Vector3(x, y, z), size, color.ToVector3()));
                        int k = buffers[i].AddFace(Face.getInstancedFace(facing, new Vector3(x, y, z), size, color.ToVector3()));

                        if (k > -1)
                            return (i * Size) + k;

                        return -1;
                    }
                }

                buffers.Add(new BatchBuffer(Size));

                int j = buffers[buffers.Count - 1].AddFace(Face.getInstancedFace(facing, new Vector3(x, y, z), size, color.ToVector3()));

                if (j > -1)
                    return ((buffers.Count - 1) * Size) + j;

                return -1;
        }
开发者ID:asarudick,项目名称:Soapvox,代码行数:26,代码来源:InstancedFaceBatcher.cs

示例4: AnnotateAvoidNeighbor

		public void AnnotateAvoidNeighbor(IVehicle threat, Vector3 ourFuture, Vector3 threatFuture)
		{
			Color green = new Color((byte)(255.0f * 0.15f), (byte)(255.0f * 0.6f), 0);

            annotation.Line(Position, ourFuture, green.ToVector3().FromXna());
            annotation.Line(threat.Position, threatFuture, green.ToVector3().FromXna());
            annotation.Line(ourFuture, threatFuture, Color.Red.ToVector3().FromXna());
            annotation.CircleXZ(Radius, ourFuture, green.ToVector3().FromXna(), 12);
            annotation.CircleXZ(Radius, threatFuture, green.ToVector3().FromXna(), 12);
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:10,代码来源:Pedestrian.cs

示例5: ButtonRow

 /// <summary>
 /// Button Row Constructor
 /// </summary>
 /// <param name="name">Control Name</param>
 /// <param name="position">Control Position</param>
 /// <param name="width">Control Width</param>
 /// <param name="titles">Button Titles</param>
 /// <param name="backColor">Backcolor</param>
 /// <param name="foreColor">Forecolor</param>
 public ButtonRow(string name, Vector2 position, float width, string[] titles, Color backColor, Color foreColor)
     : base(name)
 {
     this.Position = position;
     this.size = new Vector2(width, 0f);
     this.titles = titles;
     this.BackColor = backColor;
     this.highlight = new Color(backColor.ToVector3() * 0.9f);
     this.dimColor = new Color(backColor.ToVector3() * 0.85f);
     this.ForeColor = foreColor;
 }
开发者ID:liwq-net,项目名称:xWinFormsLib,代码行数:20,代码来源:ButtonRow.cs

示例6: NightSettings

 public static void NightSettings()
 {
     SunPosition = new Vector3(0, -0.4f, -0.6f); //The moon in this case.
     SunColor = new Vector3(0.05f, 0.15f, 0.2f);
     SkyColor = new Color(0.06f, 0.06f, 0.15f);
     FogColor = SkyColor.ToVector3();
 }
开发者ID:Aryn,项目名称:Mobile-Fortress,代码行数:7,代码来源:Weather.cs

示例7: ActDye

 public ActDye(Color TargetColor, float Time, bool isSolid = true, bool isRelative = false)
     : base(isSolid)
 {
     this.targetColor = TargetColor.ToVector3();
     this.frames = (int)(Time * Tool.GetFPS());
     this.isRelative = isRelative;
 }
开发者ID:TiaraGames,项目名称:TiaraFramework,代码行数:7,代码来源:ActDye.cs

示例8: DaySettings

 public static void DaySettings()
 {
     SunPosition = new Vector3(0,-0.8f,-0.2f);
     SunColor = new Vector3(.8f, .8f, .8f);
     SkyColor = new Color(0, 0.8f, 1);
     FogColor = SkyColor.ToVector3();
 }
开发者ID:Aryn,项目名称:Mobile-Fortress,代码行数:7,代码来源:Weather.cs

示例9: DrawCube

        public static void DrawCube(Matrix W, Matrix V, Matrix P, Color color)
        {
            foreach (ModelMesh mesh in cube.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    // fontos a sorrend !!
                    // ha a forgatást a mozgatás után végeznénk el akkor is a (0, 0, 0) pont körül forgatna de mivel az már
                    //	nem a középpontja ezért teljesen más eredményt kapnánk
                    // ha előbb skáláznánk aztán mozgatnánk akkor a skálázás arányának megfelelően kéne változtatni
                    //	a mozgatást is
                    // a forgatást a skálázás után kell elvégezni valószinüleg..mármint hogy ne legyen semmi féle szétnyúlás
                    //	ami valószinüleg nem kívánt

                    basicEffect.EnableDefaultLighting();

                    basicEffect.DiffuseColor = color.ToVector3();

                    basicEffect.World = W;

                    basicEffect.View = V;
                    basicEffect.Projection = P;

                    part.Effect = basicEffect;
                }

                mesh.Draw();
            }
        }
开发者ID:matyicsapo,项目名称:MultiVerse,代码行数:29,代码来源:Utils3D.cs

示例10: Draw

        public void Draw(Matrix world, Matrix view, Matrix projection, Color color)
        {
            // Set BasicEffect parameters.
            basicEffect.World = world;
            basicEffect.View = view;
            basicEffect.Projection = projection;
            basicEffect.DiffuseColor = color.ToVector3();
            basicEffect.Alpha = color.A / 255.0f;

            GraphicsDevice device = basicEffect.GraphicsDevice;
            device.DepthStencilState = DepthStencilState.Default;

            if (color.A < 255)
            {
                // Set renderstates for alpha blended rendering.
                device.BlendState = BlendState.AlphaBlend;
            }
            else
            {
                // Set renderstates for opaque rendering.
                device.BlendState = BlendState.Opaque;
            }

            // Draw the model, using BasicEffect.
            Draw(basicEffect);
        }
开发者ID:HRuivo,项目名称:SolarSystemXNA,代码行数:26,代码来源:GeometricPrimitive.cs

示例11: Render

        public static void Render(BoundingSphere sphere,
                                  GraphicsDevice graphicsDevice,
                                  Matrix view,
                                  Matrix projection,
                                  Color color,
                                  Guid id)
        {
            var subscription = Subscriptions[id];

            graphicsDevice.SetVertexBuffer(subscription.VertexBuffer);
            subscription.BasicEffect.World = Matrix.CreateScale(sphere.Radius)*
                                                   Matrix.CreateTranslation(sphere.Center);
            subscription.BasicEffect.View = view;
            subscription.BasicEffect.Projection = projection;
            subscription.BasicEffect.DiffuseColor = color.ToVector3();

            foreach (var pass in subscription.BasicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                graphicsDevice.DrawPrimitives(PrimitiveType.LineStrip, 0, SphereResolution);
                graphicsDevice.DrawPrimitives(PrimitiveType.LineStrip,
                                              SphereResolution + 1,
                                              SphereResolution);
                graphicsDevice.DrawPrimitives(PrimitiveType.LineStrip,
                                              (SphereResolution + 1)*2,
                                              SphereResolution);
            }
        }
开发者ID:naighes,项目名称:AsteroidChallenge,代码行数:28,代码来源:BoundingSphereRenderer.cs

示例12: ShouldConvertToVector3

 public void ShouldConvertToVector3()
 {
     var color = new Color(0.1f, 0.2f, 0.3f);
     var vector = color.ToVector3();
     Assert.AreEqual(vector.X, color.R);
     Assert.AreEqual(vector.Y, color.G);
     Assert.AreEqual(vector.Z, color.B);
 }
开发者ID:remy22,项目名称:TriEngine,代码行数:8,代码来源:ColorTests.cs

示例13: LambertPointLightMaterial

 public LambertPointLightMaterial(Color ambientColor, Color lightColor, Vector3 lightPosition, float attenuation, float falloff)
 {
     AmbientLightColor = ambientColor.ToVector3();
     LightColor = lightColor.ToVector3();
     LightPosition = lightPosition;
     LightAttenuation = attenuation;
     LightFalloff = falloff;
 }
开发者ID:reubencummins,项目名称:3dgraphicsengine,代码行数:8,代码来源:PointLight.cs

示例14: Label

 public Label( string name, Vector2 position, string text, Color color, float scale )//, Font font)
 {
     this.Type = ControlType.Label;
     this.name = name;
     this.position = position;
     this.text = text;
     this.scale = scale;
     this.color = new Color( new Vector4( color.ToVector3(), 1f ) );
 }
开发者ID:ingex0,项目名称:smarttank,代码行数:9,代码来源:Label.cs

示例15: Draw

        public static void Draw(this BoundingBox boundingBox, RenderContext renderContext, Color color)
        {
            if (_basicEffect == null)
                _basicEffect = new BasicEffect(renderContext.GraphicsDevice);

            var lineList = new VertexPositionColor[8];
            var lineListIndices = new short[24];

            var index = 0;
            var min = boundingBox.Min;
            var max = boundingBox.Max;

            var boundingCorners = boundingBox.GetCorners();

            for (var i = 0; i < 8; ++i)
                lineList[i] = new VertexPositionColor(boundingCorners[i], color);

            index = 0;
            lineListIndices[index] = 0;
            lineListIndices[++index] = 1;
            lineListIndices[++index] = 1;
            lineListIndices[++index] = 2;
            lineListIndices[++index] = 2;
            lineListIndices[++index] = 3;
            lineListIndices[++index] = 3;
            lineListIndices[++index] = 0;

            lineListIndices[++index] = 4;
            lineListIndices[++index] = 5;
            lineListIndices[++index] = 5;
            lineListIndices[++index] = 6;
            lineListIndices[++index] = 6;
            lineListIndices[++index] = 7;
            lineListIndices[++index] = 7;
            lineListIndices[++index] = 4;

            lineListIndices[++index] = 0;
            lineListIndices[++index] = 4;
            lineListIndices[++index] = 1;
            lineListIndices[++index] = 5;
            lineListIndices[++index] = 2;
            lineListIndices[++index] = 6;
            lineListIndices[++index] = 3;
            lineListIndices[++index] = 7;

            _basicEffect.Projection = renderContext.Camera.Projection;
            _basicEffect.View = renderContext.Camera.View;
            _basicEffect.DiffuseColor = color.ToVector3();

            foreach (var pass in _basicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                renderContext.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.LineList, lineList, 0, lineList.Length, lineListIndices, 0, 12);
            }
        }
开发者ID:ETdoFresh,项目名称:BuildingYourFirstMobileGame,代码行数:55,代码来源:Extensions.cs


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