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


C# SceneNode.Translate方法代码示例

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


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

示例1: WallPlane1

        /// <summary>
        /// This method generates a plane in an Entity which will be used as a wall
        /// </summary>
        private void WallPlane1()
        {
            plane1 = new Plane(Vector3.UNIT_X, -0);
            MeshPtr wallMeshPtr = MeshManager.Singleton.CreatePlane("wall1",
                ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane1, wallWidth,
                wallHeight, wallXSegs, wallZSegs, true, 1, uTiles, vTiles,
                Vector3.UNIT_Z);

            wallEntity1 = mSceneMgr.CreateEntity("wall1");
            wallNode1 = mSceneMgr.CreateSceneNode();
            wallNode1.Translate(new Vector3(500, 000, 000));
            wallNode1.Yaw(bob);
            wallNode1.AttachObject(wallEntity1);
            mSceneMgr.RootSceneNode.AddChild(wallNode1);
            //wallEntity.SetMaterialName("Meteor");
        }
开发者ID:Bobbylon5,项目名称:Mogre14,代码行数:19,代码来源:Wall.cs

示例2: setupTapMotion

        protected void setupTapMotion()
        {
            float l_Wiimote1XPosition = -1 * mWidth / 32;
            float l_Wiimote2XPosition = 1 * mWidth / 32;

            float l_StartingYPosition = mHeight / 1.5f;
            float l_EndingYPosition = -1 * mHeight / 1.5f;

            float l_StartingZPosition = -1 * mWidth / 2;
            float l_EndingZPosition = mWidth / 2;

            mNode = mSceneManager.RootSceneNode.CreateChildSceneNode("WiimoteNode",
                new Vector3(0f, 0f, 0f));

            SceneNode l_WimmoteTapMotionNode = mNode.CreateChildSceneNode("WiimoteTapMotionNode",
                new Vector3(0f, 0f, 0f));

            SceneNode l_Wiimote1LineNode = l_WimmoteTapMotionNode.CreateChildSceneNode("Wiimote1LineNode",
                new Vector3(0f, 0f, 0f));
            drawLine(l_Wiimote1LineNode, "Wiimote1LineNode", new Vector3(0f, l_StartingYPosition, l_StartingZPosition),
                new Vector3(0f, l_EndingYPosition, l_EndingZPosition));
            SceneNode l_Wiimote1LineShoeNode = l_Wiimote1LineNode.CreateChildSceneNode("Wiimote1LineShoeNode", new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8));
            drawCircle(l_Wiimote1LineShoeNode, "WiimoteLine1Shoe");
            l_Wiimote1LineNode.Translate(l_Wiimote1XPosition, 0f, 0f);
            l_Wiimote1LineNode.Translate(0, 0f, 0f);

            SceneNode l_Wiimote2LineNode = l_WimmoteTapMotionNode.CreateChildSceneNode("Wiimote2LineNode",
                new Vector3(0f, 0f, 0f));
            drawLine(l_Wiimote2LineNode, "Wiimote2LineNode", new Vector3(0, l_StartingYPosition, l_StartingZPosition),
                new Vector3(0, l_EndingYPosition, l_EndingZPosition));
            SceneNode l_Wiimote2LineShoeNode = l_Wiimote2LineNode.CreateChildSceneNode("Wiimote2LineShoeNode", new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8));
            drawCircle(l_Wiimote2LineShoeNode, "WiimoteLine2Shoe");
            l_Wiimote2LineNode.Translate(l_Wiimote2XPosition, 0f, 0f);

            mWiimote1SceneNode = l_Wiimote1LineShoeNode.CreateChildSceneNode("Wiimote1SceneNode",
                new Vector3(0f, 0f, 0f));

            mWiimote2SceneNode = l_Wiimote2LineShoeNode.CreateChildSceneNode("Wiimote2SceneNode",
                new Vector3(0f, 0f, 0f));

            WiimoteOrgeControlCSVParser l_Parser = new WiimoteOrgeControlCSVParser();
            l_Parser.loadShapeData(mDynamicShapes);

            int l_ShapeIndex = 0;
            SceneNode l_SceneNode = null;

            Mogre.Degree l_ShoeYawAngle = new Mogre.Degree(90);
            Mogre.Degree l_ShoePitchAngle = new Mogre.Degree(-20);

            Mogre.Degree l_DegreeRollAngle = new Mogre.Degree(30);

            foreach (WiimoteOrgeControlShape l_Shape in mDynamicShapes)
            {
                l_ShapeIndex++;

                if (l_Shape.Foot.CompareTo(ProjectCommon.ProjectConstants.SHAPE_LEFT_FOOT) == 0)
                    l_SceneNode = mWiimote1SceneNode.CreateChildSceneNode("Wiimote1Node" + l_ShapeIndex, new Vector3(0,//l_Wiimote1XPosition,
                                                                                                                    l_StartingYPosition * l_Shape.Time,
                                                                                                                    l_StartingZPosition * l_Shape.Time));
                else
                    l_SceneNode = mWiimote2SceneNode.CreateChildSceneNode("Wiimote2Node" + l_ShapeIndex, new Vector3(0,//l_Wiimote2XPosition,
                                                                                                                    l_StartingYPosition * l_Shape.Time,
                                                                                                                    l_StartingZPosition * l_Shape.Time));
                l_SceneNode.Scale(2f, 2f, 2f);
                l_SceneNode.Yaw(l_ShoeYawAngle);
            //                l_SceneNode.Pitch(l_ShoePitchAngle);
            //                l_SceneNode.Roll(30);

                InitialShoeRollAngle = l_SceneNode.Orientation.Roll.ValueDegrees;
                InitialShoePitchAngle = l_SceneNode.Orientation.Pitch.ValueDegrees;

                mInitialShoeAxis = l_SceneNode.Orientation;
                mInitialShoeAxis.w = InitialShoeRollAngle;

                drawShoe(l_SceneNode, "Shoe" + l_ShapeIndex);

                //TODO : Need to get back movable text
                // create entity
            //                MovableText msg = new MovableText("txt001", l_Shape.Message, "BlueHighway", 6, new ColourValue(200, 50, 200));
            //                msg.SetTextAlignment(MovableText.HorizontalAlignment.H_CENTER, MovableText.VerticalAlignment.V_ABOVE);
            //                msg.AdditionalHeight = 8.0f;

                // attach to a SceneNode
            //                l_SceneNode.AttachObject(msg);

            }

            /*
            //            SceneNode l_TestShoeNode = mNode.CreateChildSceneNode("TestShoeNode",new Vector3(0f, 0f, 0f));
                        SceneNode l_TestShoeNode = SceneManager.RootSceneNode.CreateChildSceneNode("TestShoeNode",new Vector3(0f, 0f, 0f));

                        drawShoe(l_TestShoeNode,"TestShoe");
                        l_TestShoeNode.Scale(5f, 5f, 5f);
                        Mogre.Degree l_ShoeYawAngle = new Mogre.Degree(90);
                        l_TestShoeNode.Yaw(l_ShoeYawAngle.ValueRadians);
                        Mogre.Degree l_ShoePitchAngle = new Mogre.Degree(-20);
                        l_TestShoeNode.Pitch(l_ShoePitchAngle.ValueRadians);
                        */

            mNode.Translate(new Vector3(mWidth / 8, 0f, 0f));
//.........这里部分代码省略.........
开发者ID:sachindeshpande,项目名称:TRapperProject,代码行数:101,代码来源:MogreWrapperMain.cs

示例3: CreateScene

        // Just override the mandatory create scene method
        public override void CreateScene()
        {
            // Set ambient light
            sceneMgr.AmbientLight = new ColourValue(0.2f, 0.2f, 0.2f);
            // Skybox
            sceneMgr.SetSkyBox(true, "Examples/MorningSkyBox");

            // Create a light
            Light l = sceneMgr.CreateLight("MainLight");
            l.Type = Light.LightTypes.LT_DIRECTIONAL;
            Vector3 dir = new Vector3(0.5f, -1, 0);
            dir.Normalise();
            l.Direction = dir;
            l.DiffuseColour = new ColourValue(1.0f, 1.0f, 0.8f);
            l.SpecularColour= new ColourValue(1.0f, 1.0f, 1.0f);

            // Create a prefab plane
            mPlane = new MovablePlane(Vector3.UNIT_Y, 0);

            MeshManager.Singleton.CreatePlane("ReflectionPlane",
                                              ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                                              mPlane._getDerivedPlane(), 2000, 2000,
                                              1, 1, true, 1, 1, 1, Vector3.UNIT_Z);
            mPlaneEnt = sceneMgr.CreateEntity( "Plane", "ReflectionPlane" );

            // Create an entity from a model (will be loaded automatically)
            Entity knotEnt = sceneMgr.CreateEntity("Knot", "knot.mesh");

            // Create an entity from a model (will be loaded automatically)
            Entity ogreHead = sceneMgr.CreateEntity("Head", "ogrehead.mesh");

            knotEnt.SetMaterialName("Examples/TextureEffect2");

            // Attach the rtt entity to the root of the scene
            SceneNode rootNode = sceneMgr.RootSceneNode;
            mPlaneNode = rootNode.CreateChildSceneNode();

            // Attach both the plane entity, and the plane definition
            mPlaneNode.AttachObject(mPlaneEnt);
            mPlaneNode.AttachObject(mPlane);
            mPlaneNode.Translate(0, -10, 0);
            // Tilt it a little to make it interesting
            mPlaneNode.Roll(new Degree(5));

            rootNode.CreateChildSceneNode( "Head" ).AttachObject( ogreHead );

            TexturePtr texture = TextureManager.Singleton.CreateManual( "RttTex",
                                                                       ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                                                                       TextureType.TEX_TYPE_2D,
                                                                       512, 512, 0,
                                                                       PixelFormat.PF_R8G8B8,
                                                                       (int) TextureUsage.TU_RENDERTARGET );
            RenderTarget rttTex = texture.GetBuffer().GetRenderTarget();

                mReflectCam = sceneMgr.CreateCamera("ReflectCam");
                mReflectCam.NearClipDistance = camera.NearClipDistance;
                mReflectCam.FarClipDistance = camera.FarClipDistance;
                mReflectCam.AspectRatio =
                    (float)window.GetViewport(0).ActualWidth /
                    (float)window.GetViewport(0).ActualHeight;
                mReflectCam.FOVy = camera.FOVy;

                Viewport v = rttTex.AddViewport( mReflectCam );
                v.SetClearEveryFrame(true);
                v.BackgroundColour = ColourValue.Black;

                MaterialPtr mat = MaterialManager.Singleton.Create("RttMat",
                                                                   ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                TextureUnitState t = mat.GetTechnique(0).GetPass(0).CreateTextureUnitState("RustedMetal.jpg");
                t = mat.GetTechnique(0).GetPass(0).CreateTextureUnitState("RttTex");
                // Blend with base texture
                t.SetColourOperationEx(LayerBlendOperationEx.LBX_BLEND_MANUAL,
                                       LayerBlendSource.LBS_TEXTURE,
                                       LayerBlendSource.LBS_CURRENT,
                                       ColourValue.White,
                                       ColourValue.White, 0.25f);
                t.SetTextureAddressingMode(TextureUnitState.TextureAddressingMode.TAM_CLAMP);
                t.SetProjectiveTexturing(true, mReflectCam);
                rttTex.PostRenderTargetUpdate += postRenderTargetUpdate;
                rttTex.PreRenderTargetUpdate += preRenderTargetUpdate;

                // set up linked reflection
                mReflectCam.EnableReflection(mPlane);
                // Also clip
                mReflectCam.EnableCustomNearClipPlane(mPlane);

            // Give the plane a texture
            mPlaneEnt.SetMaterialName("RttMat");

            // Add a whole bunch of extra transparent entities
            Entity cloneEnt;
            for (int n = 0; n < 10; ++n)
            {
                // Create a new node under the root
                SceneNode node = sceneMgr.CreateSceneNode();
                // Random translate
                Vector3 nodePos;
                nodePos.x = Mogre.Math.SymmetricRandom() * 750.0f;
                nodePos.y = Mogre.Math.SymmetricRandom() * 100.0f + 25;
//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:mogresdk,代码行数:101,代码来源:RenderToTextureApplication.cs


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