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


C# Material.SetTexture方法代码示例

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


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

示例1: OceanWaterTile

        public OceanWaterTile(RenderSystem rs, OceanWaterDataManager manager, int @long, int lat)
            : base(false)
        {
            renderSystem = rs;

            PlanetEarth.TileCoord2CoordNew(@long, lat, out tileCol, out tileLat);

            material = new Material(rs);

            FileLocation fl = FileSystem.Instance.Locate("WaterNormal.tex", GameFileLocs.Nature);
            ResourceHandle<Texture> map = TextureManager.Instance.CreateInstance(fl);
            material.SetTexture(1, map);

            fl = FileSystem.Instance.Locate("WaterDudv.tex", GameFileLocs.Nature);
            map = TextureManager.Instance.CreateInstance(fl);
            material.SetTexture(0, map);

            material.SetEffect(EffectManager.Instance.GetModelEffect(WaterEffectFactory.Name));
            material.IsTransparent = true;
            material.ZWriteEnabled = false;
            material.ZEnabled = true;
            material.CullMode = CullMode.CounterClockwise;
            material.PriorityHint = RenderPriority.Third;

            data0 = manager.GetData(Lod0Size, tileLat);
            //data1 = manager.GetData(Lod1Size, tileLat);


            float radtc = MathEx.Degree2Radian(tileCol);
            float radtl = MathEx.Degree2Radian(tileLat);
            float rad5 = PlanetEarth.DefaultTileSpan * 0.5f;

            BoundingSphere.Center = PlanetEarth.GetPosition(radtc + rad5, radtl - rad5);
            BoundingSphere.Radius = PlanetEarth.GetTileHeight(rad5 * 2);

            Transformation = Matrix.RotationY(radtc);
        }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:37,代码来源:OceanWaterTile.cs

示例2: Start

        public override void Start()
        {
            this.Configuration.BackgroundColour = Rgba32.DarkSlateGrey;
            //var goBoardMesh = new CubePrimitive (this.Platform.Graphics).Mesh;

            MeshAsset mushMeshAsset0 = this.Engine.Assets.Load<MeshAsset> ("assets/big_mushroom.bba");
            vb0 = Platform.Graphics.CreateVertexBuffer (mushMeshAsset0.VertexDeclaration, mushMeshAsset0.VertexData.Length);
            ib0 = Platform.Graphics.CreateIndexBuffer (mushMeshAsset0.IndexData.Length);
            vb0.SetDataEx (mushMeshAsset0.VertexData);
            ib0.SetData (mushMeshAsset0.IndexData);
            var mushMesh0 = new Mesh (vb0, ib0);

            MeshAsset mushMeshAsset1 = this.Engine.Assets.Load<MeshAsset> ("assets/small_mushroom_1.bba");
            vb1 = Platform.Graphics.CreateVertexBuffer (mushMeshAsset1.VertexDeclaration, mushMeshAsset1.VertexData.Length);
            ib1 = Platform.Graphics.CreateIndexBuffer (mushMeshAsset1.IndexData.Length);
            vb1.SetDataEx (mushMeshAsset1.VertexData);
            ib1.SetData (mushMeshAsset1.IndexData);
            var mushMesh1 = new Mesh (vb1, ib1);

            MeshAsset mushMeshAsset2 = this.Engine.Assets.Load<MeshAsset> ("assets/small_mushroom_2.bba");
            vb2 = Platform.Graphics.CreateVertexBuffer (mushMeshAsset2.VertexDeclaration, mushMeshAsset2.VertexData.Length);
            ib2 = Platform.Graphics.CreateIndexBuffer (mushMeshAsset2.IndexData.Length);
            vb2.SetDataEx (mushMeshAsset2.VertexData);
            ib2.SetData (mushMeshAsset2.IndexData);
            var mushMesh2 = new Mesh (vb2, ib2);

            // set up the debug renderer
            ShaderAsset unlitShaderAsset = this.Engine.Assets.Load<ShaderAsset> ("assets/pixel_lit.bba");
            shader = this.Platform.Graphics.CreateShader (unlitShaderAsset);
            TextureAsset woodTexAsset = this.Engine.Assets.Load <TextureAsset> ("assets/toadstool_diffuse.bba");
            woodTex = this.Platform.Graphics.CreateTexture (woodTexAsset);

            mush0 = SceneGraph.CreateSceneObject ("mush0");
            mush0.Transform.LocalPosition = new Vector3 (0f, 0f, 0f);
            mush0.Transform.LocalScale = new Vector3 (1f, 1f, 1f);

            mush1 = SceneGraph.CreateSceneObject ("mush1");
            mush1.Transform.LocalPosition = new Vector3 (0.8f, 0f, 0.8f);
            mush1.Transform.LocalScale = new Vector3 (1f, 1f, 1f);

            mush2 = SceneGraph.CreateSceneObject ("mush2");
            mush2.Transform.LocalPosition = new Vector3 (0.5f, 0f, 0f);
            mush2.Transform.LocalScale = new Vector3 (1f, 1f, 1f);

            var mat = new Material ("Default", shader);
            mat.SetTexture ("TextureSampler", woodTex);

            MeshRendererTrait meshRendererTrait0 = mush0.AddTrait<MeshRendererTrait> ();
            meshRendererTrait0.Material = mat;
            meshRendererTrait0.Mesh = mushMesh0;
            meshRendererTrait0.CullMode = CullMode.None;

            MeshRendererTrait meshRendererTrait1 = mush1.AddTrait<MeshRendererTrait> ();
            meshRendererTrait1.Material = mat;
            meshRendererTrait1.Mesh = mushMesh1;
            meshRendererTrait1.CullMode = CullMode.None;

            MeshRendererTrait meshRendererTrait2 = mush2.AddTrait<MeshRendererTrait> ();
            meshRendererTrait2.Material = mat;
            meshRendererTrait2.Mesh = mushMesh2;
            meshRendererTrait2.CullMode = CullMode.None;

            returnScene = this;

            var t = SceneGraph.CreateSceneObject ("T");
            t.Transform.LocalPosition = new Vector3 (0, 1f, 0);
            Entity camSo = SceneGraph.CreateSceneObject ("Scene X Camera");
            camSo.AddTrait<CameraTrait>();
            var lookatTrait = camSo.AddTrait<LookAtSubjectTrait>();
            lookatTrait.Subject = t.Transform;
            var orbitTrait = camSo.AddTrait<OrbitAroundSubjectTrait>();
            orbitTrait.CameraSubject = Transform.Origin;

            camSo.Transform.LocalPosition = new Vector3(6f,3f,6f);

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

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

示例3: CreateScene


//.........这里部分代码省略.........
                    Rotator rotator = new Rotator();
                    boxNode.AddComponent(rotator);
                    rotator.SetRotationSpeed(new Vector3(10.0f, 20.0f, 30.0f));
                }

                // Create a camera for the render-to-texture scene. Simply leave it at the world origin and let it observe the scene
                rttCameraNode = rttScene.CreateChild("Camera");
                Camera camera = rttCameraNode.CreateComponent<Camera>();
                camera.FarClip = 100.0f;

                // Create a point light to the camera scene node
                Light light = rttCameraNode.CreateComponent<Light>();
                light.LightType = LightType.Point;
                light.Range = 30.0f;
            }

            {
                // Create the scene in which we move around

                scene = new Scene();

                // Create octree, use also default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
                scene.CreateComponent<Octree>();

                // Create a Zone component for ambient lighting & fog control
                Node zoneNode = scene.CreateChild("Zone");
                Zone zone = zoneNode.CreateComponent<Zone>();
                zone.SetBoundingBox(new BoundingBox(-1000.0f, 1000.0f));
                zone.AmbientColor = new Color(0.1f, 0.1f, 0.1f);
                zone.FogStart = 100.0f;
                zone.FogEnd = 300.0f;

                // Create a directional light without shadows
                Node lightNode = scene.CreateChild("DirectionalLight");
                lightNode.SetDirection(new Vector3(0.5f, -1.0f, 0.5f));
                Light light = lightNode.CreateComponent<Light>();
                light.LightType = LightType.Directional;
                light.Color = new Color(0.2f, 0.2f, 0.2f);
                light.SpecularIntensity = 1.0f;

                // Create a "floor" consisting of several tiles
                for (int y = -5; y <= 5; ++y)
                {
                    for (int x = -5; x <= 5; ++x)
                    {
                        Node floorNode = scene.CreateChild("FloorTile");
                        floorNode.Position = new Vector3(x*20.5f, -0.5f, y*20.5f);
                        floorNode.Scale = new Vector3(20.0f, 1.0f, 20.0f);
                        StaticModel floorObject = floorNode.CreateComponent<StaticModel>();
                        floorObject.Model = cache.GetModel("Models/Box.mdl");
                        floorObject.SetMaterial(cache.GetMaterial("Materials/Stone.xml"));
                    }
                }

                // Create a "screen" like object for viewing the second scene. Construct it from two StaticModels, a box for the frame
                // and a plane for the actual view
                {
                    Node boxNode = scene.CreateChild("ScreenBox");
                    boxNode.Position = new Vector3(0.0f, 10.0f, 0.0f);
                    boxNode.Scale = new Vector3(21.0f, 16.0f, 0.5f);
                    StaticModel boxObject = boxNode.CreateComponent<StaticModel>();
                    boxObject.Model = cache.GetModel("Models/Box.mdl");
                    boxObject.SetMaterial(cache.GetMaterial("Materials/Stone.xml"));

                    Node screenNode = scene.CreateChild("Screen");
                    screenNode.Position = new Vector3(0.0f, 10.0f, -0.27f);
                    screenNode.Rotation = new Quaternion(-90.0f, 0.0f, 0.0f);
                    screenNode.Scale = new Vector3(20.0f, 0.0f, 15.0f);
                    StaticModel screenObject = screenNode.CreateComponent<StaticModel>();
                    screenObject.Model = cache.GetModel("Models/Plane.mdl");

                    // Create a renderable texture (1024x768, RGB format), enable bilinear filtering on it
                    Texture2D renderTexture = new Texture2D();
                    renderTexture.SetSize(1024, 768, Graphics.RGBFormat, TextureUsage.Rendertarget);
                    renderTexture.FilterMode = TextureFilterMode.Bilinear;

                    // Create a new material from scratch, use the diffuse unlit technique, assign the render texture
                    // as its diffuse texture, then assign the material to the screen plane object
                    Material renderMaterial = new Material();
                    renderMaterial.SetTechnique(0, cache.GetTechnique("Techniques/DiffUnlit.xml"), 0, 0);
                    renderMaterial.SetTexture(TextureUnit.Diffuse, renderTexture);
                    screenObject.SetMaterial(renderMaterial);

                    // Get the texture's RenderSurface object (exists when the texture has been created in rendertarget mode)
                    // and define the viewport for rendering the second scene, similarly as how backbuffer viewports are defined
                    // to the Renderer subsystem. By default the texture viewport will be updated when the texture is visible
                    // in the main view
                    RenderSurface surface = renderTexture.RenderSurface;
                    Viewport rttViewport = new Viewport(Context, rttScene, rttCameraNode.GetComponent<Camera>(), null);
                    surface.SetViewport(0, rttViewport);
                }

                // Create the camera. Limit far clip distance to match the fog
                CameraNode = scene.CreateChild("Camera");
                var camera = CameraNode.CreateComponent<Camera>();
                camera.FarClip = 300.0f;
                // Set an initial position for the camera scene node above the plane
                CameraNode.Position = new Vector3(0.0f, 7.0f, -30.0f);
            }
        }
开发者ID:ZENG-Yuhao,项目名称:Xamarin-CrossPlatform,代码行数:101,代码来源:RenderToTexture.cs

示例4: SetupFootprintPrefab

        private static void SetupFootprintPrefab()
        {
            footprintPrefab = new GameObject ("KerbalEVAFootprint");
            footprintPrefab.layer = GameLayers.LocalSpace;
            footprintPrefab.SetActive (false);

            var mf = footprintPrefab.AddComponent<MeshFilter> ();
            var mr = footprintPrefab.AddComponent<MeshRenderer> ();

            mf.mesh = new Quad (0.15f, 0.3f, true);

            var material = new Material (Shaders.Footprint);
            var footprintMask = new Texture2D (4, 4);
            footprintMask.LoadImage (Textures.KerbalEVAFootprintMask);
            material.SetTexture ("_MainTex", footprintMask);
            material.SetFloat ("_Opacity", 0.8f);
            material.SetColor ("_Color", Color.black);
            mr.material = material;
            mr.castShadows = false;

            footprintPrefab.AddComponent<KerbalEVAFootprint> ();

            Utils.Log ("Footprint prefab created");
        }
开发者ID:HappyFaceIndustries,项目名称:KopernicusExpansion,代码行数:24,代码来源:EVAFootprintsLoader.cs

示例5: Main

		static void Main(string[] args)
		{
			device = IrrlichtDevice.CreateDevice(DriverType.OpenGL, new Dimension2Di(1024, 768), 32, false, true);
			device.OnEvent += new IrrlichtDevice.EventHandler(device_OnEvent);
			device.SetWindowCaption("Minesweeper - Irrlicht Engine");

			VideoDriver driver = device.VideoDriver;
			SceneManager scene = device.SceneManager;
			GUIEnvironment gui = device.GUIEnvironment;

			device.FileSystem.AddFileArchive("../../media/minesweeper.media.files");
			game = new Game(device);

			// set up camera

			camera = scene.AddCameraSceneNode(); // Maya(null, -500, 50, 200);
			setupCameraPositionAndTarget();

			// set up background

			Mesh m = scene.GetMesh("back.obj");
			scene.MeshManipulator.Scale(m, new Vector3Df(80));
			scene.MeshManipulator.FlipSurfaces(m);
			scene.MeshManipulator.RecalculateNormals(m);
			scene.MeshManipulator.SetVertexColors(m, new Color(80, 80, 80));

			Material t = new Material();
			t.Type = MaterialType.Reflection2Layer;
			t.Lighting = false;
			t.SetTexture(0, device.VideoDriver.GetTexture("TEXTURE-ref.jpg"));
			t.SetTexture(1, device.VideoDriver.GetTexture("TEXTURE-ref.jpg"));

			MeshSceneNode n = scene.AddMeshSceneNode(m, null, 7777);
			n.SetMaterial(0, t);
			n.Position = game.CenterOfTheBoard;

			SceneNodeAnimator a = scene.CreateRotationAnimator(new Vector3Df(0.07f, 0.01f, 0.05f));
			n.AddAnimator(a);
			a.Drop();

			// set up light

			light = scene.AddLightSceneNode(null, game.CenterOfTheBoard, new Colorf(1, 1, 1), 200);

			m = scene.AddVolumeLightMesh("lvol1", 32, 32, new Color(5, 5, 5));
			scene.MeshManipulator.Scale(m, new Vector3Df(15, 30, 15));
			n = scene.AddMeshSceneNode(m, light);
			n.Position = new Vector3Df(0, -10, 0);
			n.Rotation = new Vector3Df(180, 0, 0);
			n.SetMaterialType(MaterialType.TransparentAddColor);

			m = scene.AddVolumeLightMesh("lvol2", 32, 32, new Color(5, 5, 5));
			scene.MeshManipulator.Scale(m, new Vector3Df(15, 30, 15));
			n = scene.AddMeshSceneNode(m, light);
			n.Position = new Vector3Df(0, -10, 0);
			n.SetMaterialType(MaterialType.TransparentAddColor);

			// add gui hint

			text = gui.AddStaticText(TextStart, new Recti(10, 10, 200, 40));
			text.OverrideColor = Color.OpaqueYellow;

			// main loop

			while (device.Run())
			{
				driver.BeginScene();
				scene.DrawAll();
				gui.DrawAll();

				if (optionFPS)
					gui.BuiltInFont.Draw(driver.FPS + " FPS", driver.ScreenSize.Width - 50, 10, Color.OpaqueWhite);

				driver.EndScene();
			}

			device.Drop();
		}
开发者ID:Download,项目名称:Irrlicht-Lime,代码行数:78,代码来源:Program.cs

示例6: Start

        public void Start()
        {
            // Create an example triangle object.
            _triangleVertices = new List<Vertex>(6)
            {
                new Vertex(new Vector3(-0.25f, 0.25f, 0.0f), Colour.White, new Vector2(0.0f, 0.0f)),
                new Vertex(new Vector3(0.25f, -0.25f, 0.0f), Colour.White, new Vector2(1.0f, 64.0f)),
                new Vertex(new Vector3(-0.25f, -0.25f, 0.0f), Colour.White, new Vector2(0.0f, 64.0f)),

                new Vertex(new Vector3(-0.25f, 0.25f, 0.0f), Colour.White, new Vector2(0.0f, 0.0f)),
                new Vertex(new Vector3(0.25f, 0.25f, 0.0f), Colour.White, new Vector2(1.0f, 0.0f)),
                new Vertex(new Vector3(0.25f, -0.25f, 0.0f), Colour.White, new Vector2(1.0f, 64.0f))
            };

            _vertexBuffer = ResourceFactory.CreateVertexBufferInstance();
            _vertexBuffer.SetVertices(_triangleVertices);

            _pTexture = ResourceFactory.CreateTexture();
            _pTexture.Load(Helpers.GetRelativePath("Textures\\font.dds"));

            _pMaterial = ResourceFactory.CreateMaterial();
            _pMaterial.SetTexture(_pTexture);
            _pMaterial.LoadVertexShader(Helpers.GetRelativePath("Shaders\\DiffuseTexture.hlsl"), "VSMain", "vs_5_1");
            _pMaterial.LoadPixelShader(Helpers.GetRelativePath("Shaders\\DiffuseTexture.hlsl"), "PSMain", "ps_5_1");
            _pMaterial.Finalise(false);

            _pTriangle = new RenderObject("triangle");
            _pTriangle.SetVertexBuffer(_vertexBuffer);
            _pTriangle.SetMaterial(_pMaterial);

            // Create an example triangle object.
            _vertices2 = new List<Vertex>(4)
            {
                new Vertex(new Vector3(-0.25f, 0.25f, 0.0f), Colour.White, new Vector2(0.0f, 0.0f)),
                new Vertex(new Vector3(0.25f, -0.25f, 0.0f), Colour.White, new Vector2(1.0f, 1.0f)),
                new Vertex(new Vector3(0.25f, 0.25f, 0.0f), Colour.White, new Vector2(1.0f, 0.0f)),
                new Vertex(new Vector3(-0.25f, -0.25f, 0.0f), Colour.White, new Vector2(0.0f, 1.0f))
            };

            _indices = new List<int>(6)
            {
                1, 0, 2,
                0, 1, 3
            };

            _vertexBuffer2 = ResourceFactory.CreateVertexBufferInstance();
            _vertexBuffer2.SetVertices(_vertices2);

            _indexBuffer = ResourceFactory.CreateIndexBufferInstance();
            _indexBuffer.SetIndices(_indices);

            _pTexture2 = ResourceFactory.CreateTexture();
            _pTexture2.Load(Helpers.GetRelativePath("Textures\\test2.png"));

            _pMaterial2 = ResourceFactory.CreateMaterial();
            _pMaterial2.SetTexture(_pTexture2);
            _pMaterial2.LoadVertexShader(Helpers.GetRelativePath("Shaders\\DiffuseTexture.hlsl"), "VSMain", "vs_5_1");
            _pMaterial2.LoadPixelShader(Helpers.GetRelativePath("Shaders\\DiffuseTexture.hlsl"), "PSMain", "ps_5_1");
            _pMaterial2.Finalise(false);

            _pTriangle2 = new RenderObject("triangle2");
            _pTriangle2.SetIndexBuffer(_indexBuffer);
            _pTriangle2.SetVertexBuffer(_vertexBuffer2);
            _pTriangle2.SetMaterial(_pMaterial2);

            _pFont = FontManager.LoadFont("Myriad", Helpers.GetRelativePath("Textures\\myriad.dds"), Helpers.GetRelativePath("Textures\\myriad.txt"));
            _pText = new Text("text", _pFont);
            _pText.SetText("test");
            _pText.SetColour(Colour.Yellow);
            _pText.Transform.Position = new Vector3(0.0f, 0.0f, 0.0f);
            _pText2 = new Text("text2", _pFont);
            _pText2.SetText("Hello world!");
            _pText2.Transform.Position = new Vector3(0.0f, 20.0f, 0.0f);
            _pText2.EnableWorldSpace(true);
        }
开发者ID:JJJohan,项目名称:DX12Engine,代码行数:75,代码来源:App.cs

示例7: loadCellMesh

		void loadCellMesh()
		{
			MeshManipulator s = m_device.SceneManager.MeshManipulator;
			VideoDriver d = m_device.VideoDriver;

			m_meshCell = m_device.SceneManager.GetMesh("cell.obj");
			s.FlipSurfaces(m_meshCell); // i don't know why, but somehow this one OBJ exported by Blender has flipped faces when opened by Irrlicht
			fitMesh(m_meshCell);

			s.SetVertexColors(m_meshCell, Color.OpaqueWhite);
			s.MakePlanarTextureMapping(m_meshCell, 0.10f);
			
			Material m = new Material();
			m.Type = MaterialType.Reflection2Layer;
			m.SetTexture(0, d.GetTexture("TEXTURE-unk.jpg"));
			m.SetTexture(1, d.GetTexture("TEXTURE-ref.jpg"));
			m_meshCell.MeshBuffers[0].SetMaterial(m);

			s.Transform(m_meshCell, new Matrix(new Vector3Df(0), new Vector3Df(0, -90, 180)));
			s.RecalculateNormals(m_meshCell);
		}
开发者ID:Download,项目名称:Irrlicht-Lime,代码行数:21,代码来源:Game.cs

示例8: GetCreateMaterial

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hId">imageHandle</param>
        /// <returns>Material Handler</returns>
        ResourceHandle<Material> GetCreateMaterial(ResourceHandle<Image> imageHandle)
        {
            var hId = imageHandle.Id;
            if (!materials.ContainsKey(hId))
            {
                var mat = new Material("GwenGui");
                mat.SetBackfaceCulling(false);
                mat.SetBlending(BlendSource.SourceAlpha, BlendDestination.InverseSourceAlpha);

                if (hId==0)
                {
                    mat.SetShader("VertexColor");
                }
                else
                {
                    mat.SetShader("TexColor");
                    mat.SetTexture(0, imageHandle);
                    mat.GetTextureUnit(0).SetWrapMode(TextureWrapMode.Clamp);
                }

                materials.Add(hId, ResourceHandle<Material>.Create(mat));
            }
            return materials[hId];
        }
开发者ID:tritao,项目名称:flood,代码行数:29,代码来源:RendererPort.cs

示例9: Start

        public override void Start()
        {
            this.Configuration.BackgroundColour = Rgba32.DarkSlateGrey;

            MeshAsset meshAsset = this.Engine.Assets.Load<MeshAsset> ("assets/darius.bba");
            vb = Platform.Graphics.CreateVertexBuffer (meshAsset.VertexDeclaration, meshAsset.VertexData.Length);
            ib = Platform.Graphics.CreateIndexBuffer (meshAsset.IndexData.Length);
            vb.SetDataEx (meshAsset.VertexData);
            ib.SetData (meshAsset.IndexData);
            var mushMesh0 = new Mesh (vb, ib);

            // set up the debug renderer
            ShaderAsset unlitShaderAsset = this.Engine.Assets.Load<ShaderAsset> ("assets/vertex_lit.bba");
            shader = this.Platform.Graphics.CreateShader (unlitShaderAsset);
            TextureAsset texAsset = this.Engine.Assets.Load <TextureAsset> ("assets/darius_tex.bba");
            tex = this.Platform.Graphics.CreateTexture (texAsset);

            entity = SceneGraph.CreateSceneObject ("entity");
            entity.Transform.LocalPosition = new Vector3 (0f, 0f, 0f);
            entity.Transform.LocalScale = new Vector3 (0.1f, 0.1f, 0.1f);

            var mat = new Material ("Default", shader);
            mat.SetTexture ("TextureSampler", tex);

            MeshRendererTrait meshRendererTrait0 = entity.AddTrait<MeshRendererTrait> ();
            meshRendererTrait0.Material = mat;
            meshRendererTrait0.Mesh = mushMesh0;
            meshRendererTrait0.CullMode = CullMode.None;

            returnScene = this;

            var t = SceneGraph.CreateSceneObject ("T");
            t.Transform.LocalPosition = new Vector3 (0, 2.3f, 0);
            Entity camSo = SceneGraph.CreateSceneObject ("Scene X Camera");
            camSo.AddTrait<CameraTrait> ();
            var lookatTrait = camSo.AddTrait<LookAtSubjectTrait> ();
            lookatTrait.Subject = t.Transform;
            var orbitTrait = camSo.AddTrait<OrbitAroundSubjectTrait> ();
            orbitTrait.CameraSubject = Transform.Origin;

            camSo.Transform.LocalPosition = new Vector3 (-7f,3f,1f);

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

            this.Engine.InputEventSystem.Tap += this.OnTap;
        }
开发者ID:dreamsxin,项目名称:engine-1,代码行数:47,代码来源:Scene_Darius.cs


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