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


C# Material.SetColour方法代码示例

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


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

示例1: CreateLandmark

        Entity CreateLandmark()
        {
            var landmarkGo = this.SceneGraph.CreateSceneObject("landmark");

            landmarkGo.Transform.LocalPosition = new Vector3(0f, 0f, 0f);
            landmarkGo.Transform.LocalScale = new Vector3(0.64f, 0.64f, 0.64f);

            var cowMesh = new TeapotPrimitive(this.Platform.Graphics);

            var mr = landmarkGo.AddTrait<MeshRendererTrait>();

            mr.Mesh = cowMesh.Mesh;

            var mat = new Material("Default", CommonDemoResources.PixelLitShader);

            mat.SetColour("MaterialColour", Rgba32.CornflowerBlue);

            mr.Material = mat;

            return landmarkGo;
        }
开发者ID:gitter-badger,项目名称:blimey,代码行数:21,代码来源:Scene_Shapes.cs

示例2: Start

        public override void Start()
        {
            CommonDemoResources.Create (Platform, Engine);

            var lines = Engine.Assets.Load <TextAsset> ("assets/airports.bba")
                .Text
                .Split ('\n')
                .ToList ();

            foreach (var line in lines)
            {
                string[] items = line.Split(',');

                if (items.Length == 11)
                {
                    airports.Add(new Airport(items));
                }
            }

            airports.Shuffle ();

            airports = airports.GetRange (0, 250);

            Console.WriteLine("num airports: " + airports.Count);

            this.Configuration.BackgroundColour = Rgba32.Red;

            returnScene = this;

            float radius = 1.5f;
            // create a sprite
            var sphereMesh = new SpherePrimitive(this.Platform.Graphics);

            var mat = new Material("Default",CommonDemoResources.VertexLitShader);
            mat.SetColour("MaterialColour", Rgba32.LightGrey);
            earthGo = this.SceneGraph.CreateSceneObject("earth");

            Entity camSo = SceneGraph.CreateSceneObject ("Scene 5 Camera");
            camSo.AddTrait<CameraTrait>();
            var lookatTrait = camSo.AddTrait<LookAtSubjectTrait>();
            lookatTrait.Subject = Transform.Origin;
            var orbitTrait = camSo.AddTrait<OrbitAroundSubjectTrait>();
            orbitTrait.CameraSubject = Transform.Origin;

            camSo.Transform.LocalPosition = new Vector3(10f,4f,10f);

            this.RuntimeConfiguration.SetRenderPassCameraTo("Debug", camSo);
            this.RuntimeConfiguration.SetRenderPassCameraTo("Default", camSo);

            earthGo.Transform.LocalScale = new Vector3(2 * radius, 2 * radius, 2 * radius);

            var mr = earthGo.AddTrait<MeshRendererTrait>();
            mr.Mesh = sphereMesh.Mesh;
            mr.Material = mat;

            //var mat2 = new Material("Default", CommonDemoResources.UnlitShader);
            //mat2.SetColour("MaterialColour", Rgba32.Blue);

            foreach (var airport in airports)
            {
                var so = this.SceneGraph.CreateSceneObject(airport.Iata);

                so.Transform.Parent = earthGo.Transform;

                var sodr = so.AddTrait<DebugRendererTrait>();
                //sodr.RenderPass = "Default";
                sodr.Colour = Rgba32.Blue;
                //var somr = so.AddTrait<MeshRenderer>();
                //somr.Mesh = sphereMesh;
                //somr.Material = mat2;

                var lat = airport.Latitude;
                var lon = airport.Longitude;

                Vector3 pos = new Vector3(
                    radius * Maths.Cos(Maths.ToRadians(lat)),
                    radius * Maths.Sin(Maths.ToRadians(lat)),
                    0f);

                Single t = Maths.ToRadians (lon);

                Matrix44 rot; Matrix44.CreateRotationY(ref t, out rot);

                Vector3 r; Vector3.Transform(ref pos, ref rot, out r);
                so.Transform.Position = r;
                so.Transform.LocalScale = new Vector3(0.015f, 0.015f, 0.015f);

            }

            this.Engine.InputEventSystem.Tap += this.OnTap;
        }
开发者ID:gitter-badger,项目名称:blimey,代码行数:91,代码来源:Scene_Airports.cs


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