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


C# SceneNode.AttachObject方法代码示例

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


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

示例1: CreateScene

        protected override void CreateScene()
        {
            viewport.BackgroundColor = ColorEx.White;

            scene.AmbientLight = new ColorEx(0.5f, 0.5f, 0.5f);

            Light light = scene.CreateLight("MainLight");
            light.Position = new Vector3(20, 80, 50);
            light.Diffuse = ColorEx.Blue;

            scene.LoadWorldGeometry("Terrain.xml");

            scene.SetFog(FogMode.Exp2, ColorEx.White, .008f, 0, 250);

            // water plane setup
            Plane waterPlane = new Plane(Vector3.UnitY, 1.5f);

            MeshManager.Instance.CreatePlane(
                "WaterPlane",
                waterPlane,
                2800, 2800,
                20, 20,
                true, 1,
                10, 10,
                Vector3.UnitZ);

            Entity waterEntity  = scene.CreateEntity("Water", "WaterPlane");
            waterEntity.MaterialName = "Terrain/WaterPlane";

            waterNode = scene.RootSceneNode.CreateChildSceneNode("WaterNode");
            waterNode.AttachObject(waterEntity);
            waterNode.Translate(new Vector3(1000, 0, 1000));
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:33,代码来源:Terrain.cs

示例2: 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

示例3: CreateScene

		public void CreateScene()
		{
			_entity = _root.SceneManager.CreateEntity("BasicCube", PrefabEntity.Cube);
			_entity.MaterialName = "Examples/TestImage";
			
			_sceneNode = Root.Instance.SceneManager.RootSceneNode.CreateChildSceneNode();
			_sceneNode.Position = new Vector3(150, 0, -300);
			_sceneNode.AttachObject(_entity);
			_sceneNode.Yaw(45);
		}
开发者ID:Azerothian,项目名称:Illisian.Niva,代码行数:10,代码来源:BasicCube.cs

示例4: CreateScene

		public override void CreateScene()
		{
			scene.AmbientLight = new ColorEx( .4f, .4f, .4f );

			Light light = scene.CreateLight( "MainLight" );
			light.Position = new Vector3( 50, 80, 0 );

			Entity head = scene.CreateEntity( "OgreHead", "ogrehead.mesh" );
			entityList.Add( head );
			scene.RootSceneNode.CreateChildSceneNode().AttachObject( head );

			Entity box = scene.CreateEntity( "Box1", "cube.mesh" );
			entityList.Add( box );
			scene.RootSceneNode.CreateChildSceneNode( new Vector3( -100, 0, 0 ), Quaternion.Identity ).AttachObject( box );

			box = scene.CreateEntity( "Box2", "cube.mesh" );
			entityList.Add( box );
			scene.RootSceneNode.CreateChildSceneNode( new Vector3( 100, 0, -300 ), Quaternion.Identity ).AttachObject( box );

			box = scene.CreateEntity( "Box3", "cube.mesh" );
			entityList.Add( box );
			scene.RootSceneNode.CreateChildSceneNode( new Vector3( -200, 100, -200 ), Quaternion.Identity ).AttachObject( box );

			frustum = new Frustum( "PlayFrustum" );
			frustum.Near = 10;
			frustum.Far = 300;

			// create a node for the frustum and attach it
			frustumNode = scene.RootSceneNode.CreateChildSceneNode( new Vector3( 0, 0, 200 ), Quaternion.Identity );

			// set the camera in a convenient position
			camera.Position = new Vector3( 0, 759, 680 );
			camera.LookAt( Vector3.Zero );

			frustumNode.AttachObject( frustum );
			frustumNode.AttachObject( camera2 );
		}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:37,代码来源:FrustumCulling.cs

示例5: CreateScene

		public override void CreateScene()
		{
			// set some ambient light
			scene.AmbientLight = new ColorEx( 1.0f, 0.2f, 0.2f, 0.2f );

			// create a skydome
			scene.SetSkyDome( true, "Examples/CloudySky", 5, 8 );

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

			// create a plane for the plane mesh
			Plane plane = new Plane();
			plane.Normal = Vector3.UnitY;
			plane.D = 200;

			// create a plane mesh
			MeshManager.Instance.CreatePlane( "FloorPlane", ResourceGroupManager.DefaultResourceGroupName, plane, 200000, 200000, 20, 20, true, 1, 50, 50, Vector3.UnitZ );

			// create an entity to reference this mesh
			Entity planeEntity = scene.CreateEntity( "Floor", "FloorPlane" );
			planeEntity.MaterialName = "Examples/RustySteel";
			scene.RootSceneNode.CreateChildSceneNode().AttachObject( planeEntity );

			// 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
			headNode = scene.RootSceneNode.CreateChildSceneNode( "OgreHeadNode", Vector3.Zero, Quaternion.Identity );
			headNode.AttachObject( ogreHead );

			// make sure the camera tracks this node
			camera.SetAutoTracking( true, headNode, Vector3.Zero );

			// create a scene node to attach the camera to
			SceneNode cameraNode = scene.RootSceneNode.CreateChildSceneNode( "CameraNode" );
			cameraNode.AttachObject( camera );

			// turn on some fog
			scene.SetFog( FogMode.Exp, ColorEx.White, 0.0002f );
		}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:42,代码来源:MousePicking.cs

示例6: Forest

        public Forest(int seed, String name, SceneNode parentSceneNode)
        {
            this.seed = seed;
            this.name = name;

            // create a scene node
            if (parentSceneNode == null)
            {
                parentSceneNode = TerrainManager.Instance.RootSceneNode;
            }
            this.parentSceneNode = parentSceneNode;
            parentSceneNode.AttachObject(this);

            box = AxisAlignedBox.Null;

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

示例7: CreateScene

		public override void CreateScene()
		{
			// Register Compositor Logics
			CompositorManager.Instance.RegisterCompositorLogic( "HDR", new HdrLogic() );

			scene.ShadowTechnique = ShadowTechnique.TextureModulative;
			scene.ShadowFarDistance = 1000;

			scene.AmbientLight = new ColorEx( 0.3f, 0.3f, 0.2f );

			Light light = scene.CreateLight( "Light2" );
			Vector3 dir = new Vector3( -1, -1, 0 );
			dir.Normalize();
			light.Type = LightType.Directional;
			light.Direction = dir;
			light.Diffuse = new ColorEx( 1.0f, 1.0f, 0.8f );
			light.Specular = new ColorEx( 1.0f, 1.0f, 1.0f );

			Entity entity;

			// House
			entity = scene.CreateEntity( "1", "tudorhouse.mesh" );
			SceneNode n1 = scene.RootSceneNode.CreateChildSceneNode( new Vector3( 350, 450, -200 ) );
			n1.AttachObject( entity );

			entity = scene.CreateEntity( "2", "tudorhouse.mesh" );
			SceneNode n2 = scene.RootSceneNode.CreateChildSceneNode( new Vector3( -350, 450, -200 ) );
			n2.AttachObject( entity );

			entity = scene.CreateEntity( "3", "knot.mesh" );
			_spinny = scene.RootSceneNode.CreateChildSceneNode( new Vector3( 0, 0, 300 ) );
			_spinny.AttachObject( entity );
			entity.MaterialName = "Examples/MorningCubeMap";

			scene.SetSkyBox( true, "Examples/MorningSkyBox", 50 );

			Plane plane = new Plane();
			plane.Normal = Vector3.UnitY;
			plane.D = 100;
			MeshManager.Instance.CreatePlane( "Myplane", ResourceGroupManager.DefaultResourceGroupName, plane, 1500, 1500, 10, 10, true, 1, 5, 5, Vector3.UnitZ );
			Entity planeEntity = scene.CreateEntity( "plane", "Myplane" );
			planeEntity.MaterialName = "Examples/Rockwall";
			planeEntity.CastShadows = false;
			scene.RootSceneNode.CreateChildSceneNode().AttachObject( planeEntity );

			camera.Position = new Vector3( -400, 50, 900 );
			camera.LookAt( new Vector3( 0, 80, 0 ) );

			/// Create a couple of hard coded postfilter effects as an example of how to do it
			/// but the preferred method is to use compositor scripts.
			_createEffects();

			foreach ( string name in _compositorList )
			{
				CompositorManager.Instance.AddCompositor( this.window.GetViewport( 0 ), name );
			}

			//CompositorManager.Instance.SetCompositorEnabled(this.window.GetViewport(0),
			//                                                 _compositorList[_compositorList.Length - 2],
			//                                                 true);
			CompositorManager.Instance.SetCompositorEnabled( this.window.GetViewport( 0 ),
															 _compositorList[ 0 ],
															 true );
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:64,代码来源:Compositor.cs

示例8: CreateScene

		public void CreateScene()
		{

			//ManualObject manual = _root.SceneManager.CreateManualObject("TEST");
			
			
			_entity = _root.SceneManager.CreateEntity("CubeBrowser", PrefabEntity.Cube);
			
			_sceneNode = Root.Instance.SceneManager.RootSceneNode.CreateChildSceneNode();
			_sceneNode.AttachObject(_entity);
			//_sceneNode.Yaw(45);
			_sceneNode.Position = new Vector3(0, 0, -300);
			_sceneNode.Scale = new Vector3(5, 4, 4);
			TextureUtil.CreateDynamicTextureAndMaterial(
				"CBDynamicTexture",
				"CBDynamicMaterial",
				_browserWidth,
				_browserHeight,
				out _texture,
				out _material);

			_entity.MaterialName = "CBDynamicMaterial";


			Core.BrowserManager.BrowserRenderEvent += new BrowserRenderEventHandler(BrowserManager_BrowserRenderEvent);
			_browserId = Core.BrowserManager.CreateBrowser("http://www.google.com.au", _browserWidth, _browserHeight);

			CreateOverlay();
		}
开发者ID:Azerothian,项目名称:Illisian.Niva,代码行数:29,代码来源:CubeBrowser.cs

示例9: AddToScene

        public void AddToScene(Vector3 position, Vector3 scale, Quaternion rotation)
        {
            string uniqueName = WorldEditor.GetUniqueName(name, type);
            if (!String.Equals(type, "Drag"))
            {
                this.uniName = uniqueName;
                nameDictionary.Add(uniqueName, parent);
            }
            entity = scene.CreateEntity(uniqueName, this.MeshName);
            entity.CastShadows = castShadows;
            node = scene.RootSceneNode.CreateChildSceneNode(position);
            node.ScaleFactor = scale;
            node.Orientation = rotation;
            node.AttachObject(entity);

            ValidateSubMeshList();

            AddCollisionObject();

            //subMeshCollection.Changed += new SubMeshChangeEventHandler(subMeshCollection_Changed);
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:21,代码来源:DisplayObject.cs

示例10: SetupBody

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sceneMgr"></param>
		private void SetupBody( SceneManager sceneMgr )
		{
			// create main model
			bodyNode = sceneMgr.RootSceneNode.CreateChildSceneNode( Vector3.UnitY * CharHeight );
			bodyEnt = sceneMgr.CreateEntity( "SinbadBody", "Sinbad.mesh" );
			bodyNode.AttachObject( bodyEnt );

			// create swords and attach to sheath
			sword1 = sceneMgr.CreateEntity( "SinbadSword1", "Sword.mesh" );
			sword2 = sceneMgr.CreateEntity( "SinbadSword2", "Sword.mesh" );
			bodyEnt.AttachObjectToBone( "Sheath.L", sword1 );
			bodyEnt.AttachObjectToBone( "Sheath.R", sword2 );

			// create a couple of ribbon trails for the swords, just for fun
			NamedParameterList paras = new NamedParameterList();
			paras[ "numberOfChains" ] = "2";
			paras[ "maxElements" ] = "80";
			swordTrail = (RibbonTrail)sceneMgr.CreateMovableObject( "SinbadRibbon", "RibbonTrail", paras );
			swordTrail.MaterialName = "Examples/LightRibbonTrail";
			swordTrail.TrailLength = 20;
			swordTrail.IsVisible = false;
			sceneMgr.RootSceneNode.AttachObject( swordTrail );

			for ( int i = 0; i < 2; i++ )
			{
				swordTrail.SetInitialColor( i, new ColorEx( 1, 0.8f, 0 ) );
				swordTrail.SetColorChange( i, new ColorEx( 0.75f, 0.25f, 0.25f, 0.25f ) );
				swordTrail.SetWidthChange( i, 1 );
				swordTrail.SetInitialWidth( i, 0.5f );
			}

			keyDirection = Vector3.Zero;
			verticalVelocity = 0;

		}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:39,代码来源:SinbadCharacterController.cs

示例11: CreateScene

        protected override void CreateScene()
        {
            scene.AmbientLight = ColorEx.Black;

            // create scene node
            mainNode = scene.RootSceneNode.CreateChildSceneNode();

            // Load the meshes with non-default HBU options
            for(int mn = 0; mn < entityMeshes.Length; mn++) {
                Mesh mesh = MeshManager.Instance.Load(entityMeshes[mn],
                    BufferUsage.DynamicWriteOnly,
                    BufferUsage.StaticWriteOnly,
                    true, true, 1); //so we can still read it

                // Build tangent vectors, all our meshes use only 1 texture coordset
                short srcIdx, destIdx;

                if (!mesh.SuggestTangentVectorBuildParams(out srcIdx, out destIdx)) {
                    mesh.BuildTangentVectors(srcIdx, destIdx);
                }

                // Create entity
                entities[mn] = scene.CreateEntity("Ent" + mn.ToString(), entityMeshes[mn]);

                // Attach to child of root node
                mainNode.AttachObject(entities[mn]);

                // Make invisible, except for index 0
                if (mn == 0) {
                    entities[mn].MaterialName = materialNames[currentMaterial];
                }
                else {
                    entities[mn].IsVisible = false;
                }
            }

            for (int i = 0; i < NUM_LIGHTS; i++) {
                lightPivots[i] = scene.RootSceneNode.CreateChildSceneNode();
                lightPivots[i].Rotate(lightRotationAxes[i], lightRotationAngles[i]);

                // Create a light, use default parameters
                lights[i] = scene.CreateLight("Light" + i.ToString());
                lights[i].Position = lightPositions[i];
                lights[i].Diffuse = diffuseLightColors[i];
                lights[i].Specular = specularLightColors[i];
                lights[i].IsVisible = lightState[i];

                // Attach light
                lightPivots[i].AttachObject(lights[i]);

                // Create billboard for light
                lightFlareSets[i] = scene.CreateBillboardSet("Flare" + i.ToString());
                lightFlareSets[i].MaterialName = "Particles/Flare";
                lightPivots[i].AttachObject(lightFlareSets[i]);
                lightFlares[i] = lightFlareSets[i].CreateBillboard(lightPositions[i]);
                lightFlares[i].Color = diffuseLightColors[i];
                lightFlareSets[i].IsVisible = lightState[i];
            }
            // move the camera a bit right and make it look at the knot
            camera.MoveRelative(new Vector3(50, 0, 20));
            camera.LookAt(new Vector3(0, 0, 0));
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:62,代码来源:Dot3Bump.cs

示例12: Init

        public void Init( ref SceneNode ParentSceneNode, int tableX, int tableZ, int tileX, int tileZ )
        {
            init = true;

            Vector3 ParentPos = ParentSceneNode.DerivedPosition;

            info.PageX = tableX;
            info.PageZ = tableZ;
            info.TileX = tileX;
            info.TileZ = tileZ;
            // Calculate the offset from the parent for this tile

            Vector3 scale = Options.Instance.Scale;
            float endx = Options.Instance.TileSize * scale.x;
            float endz = Options.Instance.TileSize * scale.z;
            info.PosX = info.TileX * endx;
            info.PosZ = info.TileZ * endz;

            name = String.Format("tile[{0},{1}][{2},{3}]",info.PageX, info.PageZ, info.TileX, info.TileZ);
            tileSceneNode = (SceneNode)ParentSceneNode.CreateChild( name );

            // figure out scene node position within parent
            tileSceneNode.Position = new Vector3( info.PosX, 0, info.PosZ );

            tileSceneNode.AttachObject( this );

            float MaxHeight = Data2DManager.Instance.GetMaxHeight(info.PageX, info.PageZ);

            bounds.SetExtents( new Vector3(0,0,0) , new Vector3((float)( endx ), MaxHeight, (float)( endz )) );

            //Change Zone of this page
            boundsExt.SetExtents( new Vector3( - endx * 0.5f, - MaxHeight * 0.5f, - endz * 0.5f) , new Vector3(endx * 1.5f, MaxHeight * 1.5f , endz * 1.5f));

            //Change Zone of this page

            this.worldAABB.SetExtents( new Vector3(info.PosX + ParentPos.x ,0, info.PosZ + ParentPos.z), new Vector3((float)( info.PosX + ParentPos.x + endx), MaxHeight, (float)( info.PosZ + ParentPos.z + endz) ));
            //this.worldBounds.SetExtents( new Vector3(info.PosX + ParentPos.x ,0, info.PosZ + ParentPos.z), new Vector3((float)( info.PosX + ParentPos.x + endx), MaxHeight, (float)( info.PosZ + ParentPos.z + endz) ));

            for ( long i = 0; i < 4; i++ )
            {
                neighbors[ i ] = null;
            }
            //force update in scene node
            //tileSceneNode.update( true, true );
            tileSceneNode.NeedUpdate();
            loaded = false;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:47,代码来源:Tile.cs

示例13: NameWidget

 public NameWidget(SceneNode node, string name)
     : base(name)
 {
     this.node = node;
     textBillboard = new TextBillboardSet("NameBar/" + name);
     node.AttachObject(textBillboard);
     Renderer tmp = GuiSystem.Instance.Renderer;
     Debug.Assert(tmp is MultiverseRenderer, "Not using multiverse renderer");
     renderer = (MultiverseRenderer)tmp;
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:10,代码来源:NameManager.cs

示例14: CreateScene

        protected override void CreateScene()
        {
            // initialise the SoundManager by setting the RenderWindow
            SoundManager.Instance.SetRenderWindow(this.window, this.camera);
               	int back_id = SoundManager.Instance.PreLoadSound("background.wav", Sound.SIMPLE_SOUND);

               	// set some ambient light
            scene.AmbientLight = new ColorEx(1.0f, 0.2f, 0.2f, 0.2f);

            // create a skydome
            scene.SetSkyDome(true, "Examples/CloudySky", 5, 8);

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

            // create a plane for the plane mesh
            Plane plane = new Plane();
            plane.Normal = Vector3.UnitY;
            plane.D = 200;

            // create a plane mesh
            MeshManager.Instance.CreatePlane("FloorPlane", plane, 200000, 200000, 20, 20, true, 1, 50, 50, Vector3.UnitZ);

            // create an entity to reference this mesh
            Entity planeEntity = scene.CreateEntity("Floor", "FloorPlane");
            planeEntity.MaterialName = "Examples/RustySteel";
            scene.RootSceneNode.CreateChildSceneNode().AttachObject(planeEntity);

            // 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
            headNode = scene.RootSceneNode.CreateChildSceneNode("OgreHeadNode", Vector3.Zero, Quaternion.Identity);
            headNode.AttachObject(ogreHead);

            // make sure the camera tracks this node
            //camera.SetAutoTracking(true, headNode, Vector3.Zero);

            // create a scene node to attach the camera to
            SceneNode cameraNode = scene.RootSceneNode.CreateChildSceneNode("CameraNode");
            cameraNode.AttachObject(camera);

            /////////////////////////- AGE Sound Library Settings -//////////////////////////
            SoundManager.Instance.RolloffFactor = 0.01f; // we're working on a large scale
               	growl = SoundManager.Instance.LoadSound("growl.ogg", Sound.THREED_SOUND);

            Sound back = SoundManager.Instance.GetSound( back_id );

            // load a simple sound
            //Sound back = SoundManager.Instance.LoadSound("background.wav", Sound.SIMPLE_SOUND);
            // set the volume low
            back.Volume = -2000;
            // play the simple sound in a loop
            back.Play(true);

            // load a 3D sound
             // attach the sound to the head
               	headNode.AttachObject(growl);
            // set the sound's properties
            growl.ConeAngles = new int[]{120, 120};
            growl.ConeDirection = Vector3.UnitZ;
              		//growl.MaxDistance = 5000;
            growl.OutsideVolume = -10000;
            // play the 3D sound in a loop
            growl.Play(true);

            ////////////////////////////////////////////////////////////////////////////////

            // create new animation
            Animation animation = scene.CreateAnimation("OgreHeadAnimation", 10.0f);

            // nice smooth animation
            animation.InterpolationMode = InterpolationMode.Spline;

            // create the main animation track
            AnimationTrack track = animation.CreateTrack(0, cameraNode);

            // create a few keyframes to move the camera around
            KeyFrame frame = track.CreateKeyFrame(0.0f);

            frame = track.CreateKeyFrame(2.5f);
            frame.Translate = new Vector3(500, 500, -1000);

            frame = track.CreateKeyFrame(5.0f);
            frame.Translate = new Vector3(-1500, 1000, -600);

            frame = track.CreateKeyFrame(7.5f);
            frame.Translate = new Vector3(0, -100, 0);

            frame = track.CreateKeyFrame(10.0f);
            frame.Translate = Vector3.Zero;

            // create a new animation state to control the animation
            animationState = scene.CreateAnimationState("OgreHeadAnimation");

            // enable the animation
            animationState.IsEnabled = true;

            // turn on some fog
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:agex-svn,代码行数:101,代码来源:AGESdemo.cs

示例15: AddToScene

        private void AddToScene()
        {
            string sceneName = WorldEditor.GetUniqueName(name, "Particle System");
            particleSystem = ParticleSystemManager.Instance.CreateSystem(sceneName, particleSystemName);
            particleSystem.ScaleVelocity(velocityScale);

            baseHeight = particleSystem.DefaultHeight;
            baseWidth = particleSystem.DefaultWidth;

            ParticleScale = particleScale;

            if (attached)
            {
                Axiom.Animating.AttachmentPoint attachmentPoint = displayObject.GetAttachmentPoint(attachmentPointName);
                if (attachmentPoint == null)
                {
                    attachmentPoint = new Axiom.Animating.AttachmentPoint(attachmentPointName, null, Quaternion.Identity, Vector3.Zero);
                }
                if (attachmentPoint.ParentBone != null)
                {
                    tagPoint = displayObject.Entity.AttachObjectToBone(attachmentPoint.ParentBone, particleSystem, attachmentPoint.Orientation, attachmentPoint.Position);
                    node = null;
                }
                else
                {
                    node = scene.CreateSceneNode();
                    node.Position = attachmentPoint.Position;
                    node.Orientation = attachmentPoint.Orientation;
                    displayObject.SceneNode.AddChild(node);
                    node.AttachObject(particleSystem);
                }

            }
            else
            {
                node = scene.RootSceneNode.CreateChildSceneNode();
                node.AttachObject(particleSystem);

                node.Position = position;
                node.ScaleFactor = scale;
                node.Orientation = Quaternion.FromAngleAxis(rotation.y * MathUtil.RADIANS_PER_DEGREE, Vector3.UnitY);
            }
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:43,代码来源:DisplayParticleSystem.cs


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