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


C# SceneNode.CreateChildSceneNode方法代码示例

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


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

示例1: MultiLights

        public MultiLights(SceneManager pSceneManager, SceneNode pCamNode, MovingObject pPlayerShip, Int32 pNumberOfLights)
        {
            oldCamLightColor = CamLightColor = new ColorEx(0.13f, 0.1f, 0.05f);
            PlayerLightColor = ColorEx.White;
            camLights = new List<Light>(pNumberOfLights);

            innerLights = (Int32)Math.Round(pNumberOfLights / 3.0f, MidpointRounding.AwayFromZero);
            outerLights = pNumberOfLights - innerLights;

            // create the playership's light.
            playerLight = pSceneManager.CreateLight("playerSpotLight");
            playerLight.Type = LightType.Spotlight;
            playerLight.Diffuse = PlayerLightColor;
            playerLight.Specular = ColorEx.White;
            playerLight.SetSpotlightRange(0.0f, 120.0f);
            playerLight.Direction = Vector3.NegativeUnitZ;

            playerLightNode = pPlayerShip.Node.CreateChildSceneNode();
            playerLightNode.AttachObject(playerLight);
            playerLightNode.Position = new Vector3(0, 0, 0);
            playerLightNode.SetDirection(new Vector3(1, 0, 0), TransformSpace.Local);

            // create the camera spotlights around the camera's direction.
            camInnerLightNode = pCamNode.CreateChildSceneNode();
            camInnerLightNode.Position = new Vector3(0, 0, 0);
            camOuterLightNode = pCamNode.CreateChildSceneNode();
            camOuterLightNode.Position = new Vector3(0, 0, 0);

            for (var i = 0; i < innerLights; i++)
            {
                var light = pSceneManager.CreateLight("camInnerLight " + (i + 1));
                light.Type = LightType.Spotlight;
                light.Diffuse = CamLightColor;
                light.Specular = ColorEx.White;
                light.SetSpotlightRange(0.0f, 25.0f);
                light.Direction = Quaternion.FromAngleAxis(360.0 * i / innerLights * Constants.DegreesToRadians, Vector3.UnitZ) *
                    Quaternion.FromAngleAxis(10.0 * Constants.DegreesToRadians, Vector3.UnitX) *
                    Vector3.NegativeUnitZ;

                camLights.Add(light);
                camInnerLightNode.AttachObject(light);
            }
            for (var i = 0; i < outerLights; i++)
            {
                var light = pSceneManager.CreateLight("camOuterLight " + (i + 1));
                light.Type = LightType.Spotlight;
                light.Diffuse = CamLightColor;
                light.Specular = ColorEx.White;
                light.SetSpotlightRange(0.0f, 25.0f);
                light.Direction = Quaternion.FromAngleAxis(360.0 * i / outerLights * Constants.DegreesToRadians, Vector3.UnitZ) *
                    Quaternion.FromAngleAxis(20.0 * Constants.DegreesToRadians, Vector3.UnitX) *
                    Vector3.NegativeUnitZ;

                camLights.Add(light);
                camOuterLightNode.AttachObject(light);
            }
        }
开发者ID:jonathandlo,项目名称:Evolution_War,代码行数:57,代码来源:MultiLights.cs

示例2: CreateScene

        protected override void CreateScene()
        {
            // set some ambient light
            scene.AmbientLight = ColorEx.Gray;

            // create an entity to have follow the path
            Entity ogreHead = scene.CreateEntity("OgreHead", "ogrehead.mesh");

            // create a scene node for the entity and attach the entity
            SceneNode headNode = scene.RootSceneNode.CreateChildSceneNode();
            headNode.AttachObject(ogreHead);

            //             // create a cool glowing green particle system
            //             ParticleSystem greenyNimbus = ParticleSystemManager.Instance.CreateSystem("GreenyNimbus", "ParticleSystems/GreenyNimbus");
            //             scene.RootSceneNode.CreateChildSceneNode().AttachObject(greenyNimbus);
            ParticleSystem fireworks = ParticleSystemManager.Instance.CreateSystem("Fireworks", "Examples/Fireworks");
            scene.RootSceneNode.CreateChildSceneNode().AttachObject(fireworks);

            // shared node for the 2 fountains
            fountainNode = scene.RootSceneNode.CreateChildSceneNode();

            // create the first fountain
            ParticleSystem fountain1 = ParticleSystemManager.Instance.CreateSystem("Fountain1", "Examples/PurpleFountain");
            SceneNode node = fountainNode.CreateChildSceneNode();
            node.Translate(new Vector3(200, -100, 0));
            node.Rotate(Vector3.UnitZ, 20);
            node.AttachObject(fountain1);

            // create the second fountain
            ParticleSystem fountain2 = ParticleSystemManager.Instance.CreateSystem("Fountain2", "Examples/PurpleFountain");
            node = fountainNode.CreateChildSceneNode();
            node.Translate(new Vector3(-200, -100, 0));
            node.Rotate(Vector3.UnitZ, -20);
            node.AttachObject(fountain2);

            // create a rainstorm
            ParticleSystem rain = ParticleSystemManager.Instance.CreateSystem("Rain", "Examples/Rain");
            scene.RootSceneNode.CreateChildSceneNode(new Vector3(0, 1000, 0), Quaternion.Identity).AttachObject(rain);
            rain.FastForward(5.0f);

            // Aureola around Ogre perpendicular to the ground
            ParticleSystem pSys5 = ParticleSystemManager.Instance.CreateSystem("Aureola",
                "Examples/Aureola");
            scene.RootSceneNode.CreateChildSceneNode().AttachObject(pSys5);

            // Set nonvisible timeout
            ParticleSystem.DefaultNonVisibleUpdateTimeout = 5;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:48,代码来源:ParticleFX.cs

示例3: SetupContent

		/// <summary>
		/// 
		/// </summary>
		protected override void SetupContent()
		{

			SceneManager.SetSkyBox( true, "Examples/EveningSkyBox", 5000 );

			// dim orange ambient and two bright orange lights to match the skybox
			SceneManager.AmbientLight = new ColorEx( 0.3f, 0.2f, 0.0f );
			Light light = SceneManager.CreateLight( "Light1" );
			light.Position = new Vector3( 2000, 1000, -1000 );
			light.Diffuse = new ColorEx( 1.0f, 0.5f, 0.0f );
			light = SceneManager.CreateLight( "Light2" );
			light.Position = new Vector3( 2000, 1000, 1000 );
			light.Diffuse = new ColorEx( 1.0f, 0.5f, 0.0f );

			_pivot = SceneManager.RootSceneNode.CreateChildSceneNode(); // create a pivot node

			// create a child node and attach ogre head and some smoke to it
			SceneNode headNode = _pivot.CreateChildSceneNode( new Vector3( 100, 0, 0 ) );
			headNode.AttachObject(  SceneManager.CreateEntity( "Head", "ogrehead.mesh" ) );
			headNode.AttachObject( ParticleSystemManager.Instance.CreateSystem( "Smoke", "Examples/Smoke" ) );

			Camera.Position = new Vector3( 0.0f, 30.0f, 350.0f );

			base.SetupContent();
		}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:28,代码来源:SmokeSample.cs

示例4: CreateScene

		public override void CreateScene()
		{
			if ( !Root.Instance.RenderSystem.Capabilities.HasCapability( Capabilities.VertexPrograms ) ||
				!Root.Instance.RenderSystem.Capabilities.HasCapability( Capabilities.FragmentPrograms ) )
			{

				throw new Exception( "Your hardware does not support vertex and fragment programs, so you cannot run this demo." );
			}

			// create a simple default point light
			Light light = scene.CreateLight( "MainLight" );
			light.Position = new Vector3( 20, 80, 50 );

			rotNode = scene.RootSceneNode.CreateChildSceneNode();
			rotNode.CreateChildSceneNode( new Vector3( 20, 40, 50 ), Quaternion.Identity ).AttachObject( light );

			Entity entity = scene.CreateEntity( "Head", "ogrehead.mesh" );

			camera.Position = new Vector3( 20, 0, 100 );
			camera.LookAt( Vector3.Zero );

			// eyes
			SubEntity subEnt = entity.GetSubEntity( 0 );
			subEnt.MaterialName = "Examples/CelShading";
			subEnt.SetCustomParameter( CustomShininess, new Vector4( 35.0f, 0.0f, 0.0f, 0.0f ) );
			subEnt.SetCustomParameter( CustomDiffuse, new Vector4( 1.0f, 0.3f, 0.3f, 1.0f ) );
			subEnt.SetCustomParameter( CustomSpecular, new Vector4( 1.0f, 0.6f, 0.6f, 1.0f ) );

			// skin
			subEnt = entity.GetSubEntity( 1 );
			subEnt.MaterialName = "Examples/CelShading";
			subEnt.SetCustomParameter( CustomShininess, new Vector4( 10.0f, 0.0f, 0.0f, 0.0f ) );
			subEnt.SetCustomParameter( CustomDiffuse, new Vector4( 0.0f, 0.5f, 0.0f, 1.0f ) );
			subEnt.SetCustomParameter( CustomSpecular, new Vector4( 0.3f, 0.5f, 0.3f, 1.0f ) );

			// earring
			subEnt = entity.GetSubEntity( 2 );
			subEnt.MaterialName = "Examples/CelShading";
			subEnt.SetCustomParameter( CustomShininess, new Vector4( 25.0f, 0.0f, 0.0f, 0.0f ) );
			subEnt.SetCustomParameter( CustomDiffuse, new Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
			subEnt.SetCustomParameter( CustomSpecular, new Vector4( 1.0f, 1.0f, 0.7f, 1.0f ) );

			// teeth
			subEnt = entity.GetSubEntity( 3 );
			subEnt.MaterialName = "Examples/CelShading";
			subEnt.SetCustomParameter( CustomShininess, new Vector4( 20.0f, 0.0f, 0.0f, 0.0f ) );
			subEnt.SetCustomParameter( CustomDiffuse, new Vector4( 1.0f, 1.0f, 0.7f, 1.0f ) );
			subEnt.SetCustomParameter( CustomSpecular, new Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );

			// add entity to the root scene node
			scene.RootSceneNode.CreateChildSceneNode().AttachObject( entity );

			window.GetViewport( 0 ).BackgroundColor = ColorEx.White;
		}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:54,代码来源:CelShading.cs

示例5: WaterPlane

        public WaterPlane(float height, String name, SceneNode parentSceneNode)
        {
            this.height = height;
            this.name = name;

            // create a scene node
            if (parentSceneNode == null)
            {
                parentSceneNode = TerrainManager.Instance.RootSceneNode;
            }
            waterSceneNode = parentSceneNode.CreateChildSceneNode(name);

            // set up material
            material = TerrainManager.Instance.WaterMaterial;

            CastShadows = false;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:17,代码来源:WaterPlane.cs

示例6: SetupCamera

		/// <summary>
		/// 
		/// </summary>
		/// <param name="camera"></param>
		private void SetupCamera( Camera cam )
		{
			// create a pivot at roughly the character's shoulder
			cameraPivot = cam.SceneManager.RootSceneNode.CreateChildSceneNode();
			// this is where the camera should be soon, and it spins around the pivot
			cameraGoal = cameraPivot.CreateChildSceneNode( new Vector3( 0, 0, 15 ) );
			// this is where the camera actually is
			cameraNode = cam.SceneManager.RootSceneNode.CreateChildSceneNode();
			cameraNode.Position = cameraPivot.Position + cameraGoal.Position;

			cameraPivot.SetFixedYawAxis( true );
			cameraGoal.SetFixedYawAxis( true );
			cameraNode.SetFixedYawAxis( true );

			// our model is quite small, so reduce the clipping planes
			cam.Near = 0.1f;
			cam.Far = 100;
			cameraNode.AttachObject( cam );
			pivotPitch = 0;
		}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:24,代码来源:SinbadCharacterController.cs

示例7: Load

        /** Loads the landscape using parameters in the given in the constructor. */
        public void Load( ref SceneNode RootNode )
        {
            if ( isPreLoaded == false )
            {
                return;
            }

            if ( isLoaded == true )
            {
                return;
            }

            Texture.TextureManager.Instance.Load(tableX, tableZ);
            //create a root landscape node.
            pageNode = RootNode.CreateChildSceneNode( "Page." +  tableX.ToString() + "." + tableZ.ToString()  );
            // Set node position
            pageNode.Position = new Vector3( (float)iniX , 0.0f, (float)iniZ );

            tiles = new Tiles();
            for (long  i = 0; i < numTiles; i++ )
            {
                tiles.Add( new TileRow() );

                for (long  j = 0; j < numTiles; j++ )
                {
                    //Debug.WriteLine(String.Format("Page[{0},{1}][{2},{3}]",tableX,tableZ,i,j));

                    Tile.Tile tile = TileManager.Instance.GetTile();
                    if ( tile != null )
                    {
                        tiles[ i ].Add( tile );
                        tile.Init(ref pageNode,(int) tableX, (int)tableZ,(int) i, (int)j );
                    }
                    else
                    {
                        string err = "Error: Invalid Tile: Make sure the default TileManager size is set to WorldWidth * WorldHeight * 4. Try increasing MaxNumTiles in the configuration file.";
                        throw new ApplicationException(err);
                    }
                }
            }

            for (long  j = 0; j < numTiles; j++ )
            {
                for (long  i = 0; i < numTiles; i++ )
                {
                    if ( j != numTiles - 1 )
                    {
                        tiles[ i ][ j ].SetNeighbor( Neighbor.South, tiles[ i ][ j + 1 ] );
                        tiles[ i ][ j + 1 ].SetNeighbor( Neighbor.North, tiles[ i ][ j ] );
                    }
                    if ( i != numTiles - 1 )
                    {
                        tiles[ i ][ j ].SetNeighbor( Neighbor.East, tiles[ i + 1 ][ j ] );
                        tiles[ i + 1 ][ j ].SetNeighbor( Neighbor.West, tiles[ i ][ j ] );
                    }
                }
            }

            LinkTileNeighbors();
            pageNode.NeedUpdate();
            isLoaded = true;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:63,代码来源:Page.cs

示例8: Initialize

        /// <summary>
        /// Initialize the world manager
        /// </summary>
        public void Initialize(SceneManager sceneManager, ITerrainGenerator gen, ILODSpec clientLodSpec, SceneNode root)
        {
            Debug.Assert(!initialized, "Attempt to initialize already initialized TerrainManager");
            scene = sceneManager;
            terrainGenerator = gen;
            terrainGenerator.TerrainChanged += TerrainGenerator_OnTerrainChanged;
            lodSpec = clientLodSpec ?? defaultLODSpec;

            pageSize = lodSpec.PageSize;
            visPageRadius = lodSpec.VisiblePageRadius;
            pageArraySize = (visPageRadius * 2) + 1;

            // Compute the size of a "subPage", which is the same as the smalles tile size.
            // We assume that the page containing the camera will have the smallest sized tiles.
            subPageSize = pageSize / TilesPerPage(0);

            minMetersPerSample = lodSpec.MetersPerSample(Vector3.Zero, 0, 0);
            maxMetersPerSample = lodSpec.MetersPerSample(Vector3.Zero, visPageRadius, visPageRadius * pageSize / subPageSize);

            rootSceneNode = root;
            worldRootSceneNode = rootSceneNode.CreateChildSceneNode("TerrainRoot");
            oceanSceneNode = rootSceneNode.CreateChildSceneNode("OceanNode");

            terrainMaterialConfig = new AutoSplatConfig();

            terrainDecalManager = new TerrainDecalManager(pageArraySize);

            shadowConfig = new ShadowConfig(scene);

            oceanConfig = new OceanConfig();
            oceanConfig.ConfigChange += OceanConfigChanged;
            ocean = new OceanPage(oceanConfig);

            oceanSceneNode.AttachObject(ocean);
            //ocean.ShowBoundingBox = true;
            showOcean = true;

            detailVeg = new DetailVeg(65, rootSceneNode);

            // allocate the page array
            pages = new Page[pageArraySize, pageArraySize];

            InitPages();

            heightFieldsCreated = false;

            boundaries = new List<Boundary>();
            roads = new Roads();

            SpeedTreeWrapper.SetDropToBillboard(true);

            // make sure variables based on camera location are up to date
            CameraLocation = cameraLocation;

            // set up material used by water boundaries
            waterMaterial = MaterialManager.Instance.GetByName("MVSMWater");
            if (waterMaterial != null)
                waterMaterial.Load();

            initialized = true;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:64,代码来源:TerrainManager.cs


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