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


C# SceneNode.AddChild方法代码示例

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


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

示例1: CameraControlSystem

        public CameraControlSystem(SceneManager sceneManager, string name, SceneNode customCameraSceneNode, bool reCalcOnTargetMoving = true)
        {
            _sceneMgr = sceneManager;
            _name = name;
            _targetNode = null;
            _targetNodeListener = null;
            _recalcOnTargetMoving = reCalcOnTargetMoving;
            _currentCameraMode = null;

            _cameraNode = _sceneMgr.RootSceneNode.CreateChildSceneNode(_name + "SceneNode");
            _isOwnCamera = false;
            _cameraNode.AddChild(customCameraSceneNode);

            _cameraModes = new Dictionary<string, CameraMode>();
        }
开发者ID:andyhebear,项目名称:Mccs,代码行数:15,代码来源:CameraControlSystem.cs

示例2: CreateThings

        /// <summary>
        /// create a bunch of crap
        /// </summary>
        void CreateThings()
        {
            // a directional light to cast shadows
            /*directionalLight = sceneMgr.CreateLight("sun");
            directionalLight.Type = Light.LightTypes.LT_DIRECTIONAL;
            directionalLight.Direction = new Vector3(0.5f, -1, -0.2f);
            directionalLight.Direction.Normalise();
            directionalLight.DiffuseColour = ColourValue.Red;
            directionalLight.SpecularColour = ColourValue.Red;
            directionalLight.Position = new Vector3(0, 10, 0);
            directionalLight.CastShadows = true;*/

            directionalLight2 = sceneMgr.CreateLight("sun2");
            directionalLight2.Type = Light.LightTypes.LT_DIRECTIONAL;
            directionalLight2.Direction = new Vector3(-0.1f, -1, 0.1f);
            directionalLight2.Direction.Normalise();
            directionalLight2.DiffuseColour = new ColourValue(1f, 1f, 1f);
            directionalLight2.SpecularColour = new ColourValue(1f, 1f, 1f);
            directionalLight2.Position = new Vector3(0, 10, 0);
            directionalLight2.CastShadows = true;

            // and a point light
            /*pointLight = sceneMgr.CreateLight("pointLight");
            pointLight.Type = Light.LightTypes.LT_POINT;
            pointLight.Position = new Vector3(-3, 10, 3);
            pointLight.DiffuseColour = ColourValue.Blue;
            pointLight.SpecularColour = ColourValue.Blue;
            pointLight.CastShadows = true;

            // and a spotlight
            spotLight = sceneMgr.CreateLight("spotLight");
            spotLight.Type = Light.LightTypes.LT_SPOTLIGHT;
            spotLight.DiffuseColour = ColourValue.Green;
            spotLight.SpecularColour = ColourValue.Green;
            spotLight.Direction = new Vector3(-1, -1, 0);
            spotLight.Position = new Vector3(10, 10, 0);
            spotLight.SetSpotlightRange(new Degree(35), new Degree(50));
            spotLight.CastShadows = true;*/

            // a plane for the shadows to be cast on
            Plane plane = new Plane(Vector3.UNIT_Y, 0);
            MeshManager.Singleton.CreatePlane("ground", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane,
                100, 100, 10, 10, true, 1, 10, 10, Vector3.UNIT_Z);
            Entity groundEnt = sceneMgr.CreateEntity("GroundEntity", "ground");
            sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(groundEnt);
            groundEnt.SetMaterialName("brick");
            groundEnt.CastShadows = false;

            // and then some boxes that will cast the shadows
            /*rotatingNode = CreateBox(new Vector3(0, 4, 0), "redbrick");
            CreateBox(new Vector3(2, 1.1f, 2), "bluebrick");
            CreateBox(new Vector3(-1, 2, -3), "yellowbrick");*/

            rotatingNode = CreateNode(new Vector3(0, 0, 0), "BgPonyBody.mesh", "BgPony");

            SceneNode wingsNode = CreateNode(new Vector3(0, 0.3848f, 0.0808f), "BgPonyWings.mesh", "BgPonyWings");
            wingsNode.ParentSceneNode.RemoveChild(wingsNode);
            rotatingNode.AddChild(wingsNode);

            SceneNode hornNode = CreateNode(new Vector3(0, 0.721f, 0.325f), "BgPonyHorn.mesh", "BgPonyHorn");
            hornNode.ParentSceneNode.RemoveChild(hornNode);
            rotatingNode.AddChild(hornNode);

            SceneNode eyeNode = CreateNode(new Vector3(0, 0.601f, 0.305f), "BgPonyEyes.mesh", "BgPonyEyes");
            eyeNode.ParentSceneNode.RemoveChild(eyeNode);
            rotatingNode.AddChild(eyeNode);

            SceneNode hairNode = CreateNode(new Vector3(0, 0.765f, 0.229f), "BgPonyHair1.mesh", "BgPonyHair_2Colours");
            hairNode.ParentSceneNode.RemoveChild(hairNode);
            rotatingNode.AddChild(hairNode);

            SceneNode maneNode = CreateNode(new Vector3(0, 0.7256f, 0.1058f), "BgPonyMane1.mesh", "BgPonyHair_2Colours");
            maneNode.ParentSceneNode.RemoveChild(maneNode);
            rotatingNode.AddChild(maneNode);

            SceneNode tailNode = CreateNode(new Vector3(0, 0.4536f, -0.0782f), "BgPonyTail1.mesh", "BgPonyHair_2Colours");
            tailNode.ParentSceneNode.RemoveChild(tailNode);
            rotatingNode.AddChild(tailNode);

            MaterialPtr mat = MaterialManager.Singleton.GetByName("BgPony");
            var ps = mat.GetTechnique(0).GetPass(0).GetFragmentProgramParameters();
            ps.SetNamedConstant("BodyColour", new ColourValue(1, 0, 0));
            mat.GetTechnique(0).GetPass(0).SetFragmentProgramParameters(ps);

            //mat.Reload();

            //(rotatingNode.GetAttachedObject(0) as Entity).SetMaterial(mat);
        }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:91,代码来源:Program.cs

示例3: Load

        /// <summary>
        /// This method loads the mesh and attaches it to a node and to the schenegraph
        /// </summary>
        private void Load()
        {
            robotEntity = mSceneMgr.CreateEntity("robot.mesh");
            robotNode = mSceneMgr.CreateSceneNode();
            robotNode.AttachObject(robotEntity);
            //mSceneMgr.RootSceneNode.AddChild(robotNode);

            controlNode = mSceneMgr.CreateSceneNode();
            controlNode.AddChild(robotNode);
            mSceneMgr.RootSceneNode.AddChild(controlNode);

            float radius = 50;
            controlNode.Position += radius * Vector3.UNIT_Y;
            robotNode.Position -= radius * Vector3.UNIT_Y;

            physObj = new PhysObj(radius, "Robot", 0.1f, 0.2f, 0.5f);
            physObj.SceneNode = controlNode;
            physObj.Position = controlNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
开发者ID:Bobbylon5,项目名称:Mogre14,代码行数:25,代码来源:Robot.cs


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