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


C# SceneNode.AttachObject方法代码示例

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


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

示例1: CreateScene

        public override void CreateScene()
        {
            // Set ambient light and fog
            sceneMgr.AmbientLight = new ColourValue(0, 0, 0);
            sceneMgr.SetFog(FogMode.FOG_LINEAR, skyColor, 0, 150, 300);

            // Create sun-light
            Light light = sceneMgr.CreateLight("Sun");
            light.Type = Light.LightTypes.LT_POINT;
            light.Position = new Vector3(150, 100, 150);

            sceneMgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_STENCIL_MODULATIVE;
		    sceneMgr.ShadowFarDistance = 100;
		    sceneMgr.ShadowColour = new ColourValue(0.7f, 0.7f, 0.7f);
		    sceneMgr.SetShadowTextureSize(512);

            // Ground
            Plane ground = new Plane(Vector3.UNIT_Y, 1);
            MeshManager.Singleton.CreatePlane("groundPlane", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                ground, 500, 500, 20, 20, true, 1, 1, 1, Vector3.UNIT_Z);

            Entity groundEnt = sceneMgr.CreateEntity("groundPlaneEntity", "groundPlane");
            groundEnt.CastShadows = true;
            groundEnt.SetMaterialName("BoxMaterial/Ground");

            planeNode = sceneMgr.RootSceneNode.CreateChildSceneNode();
            planeNode.AttachObject(groundEnt);

            physics = new Physics(sceneMgr);
        }
开发者ID:raiker,项目名称:BulletSharp,代码行数:30,代码来源:BasicDemo.cs

示例2: CameraControlSystem

        private float _timeSinceLastFrameLastUpdate; // Time value passed to the last call of the method "Update"

        #endregion Fields

        #region Constructors

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

            _cameraNode = _sceneMgr.RootSceneNode.CreateChildSceneNode(_name + "SceneNode");

            if (camera == null) {
                _camera = _sceneMgr.CreateCamera(_name);
                _isOwnCamera = true;
            } else {
                _camera = camera;
                _isOwnCamera = false;
            }

            //Reset to default parameters
            _camera.Position = Vector3.ZERO;
            _camera.Orientation = Quaternion.IDENTITY;

            // ... and attach the Ogre camera to the camera node
            _cameraNode.AttachObject(_camera);

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

示例3: MovableText

        public MovableText(string name, SceneManager sceneMgr, SceneNode node, Size size)
        {
            this.texture = TextureManager.Singleton.CreateManual(
                name + "Texture",
                ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                TextureType.TEX_TYPE_2D,
                (uint)size.Width,
                (uint)size.Height,
                0,
                PixelFormat.PF_A8R8G8B8);

            this.material = MaterialManager.Singleton.Create(name + "Material", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
            this.material.GetTechnique(0).GetPass(0).CreateTextureUnitState(this.texture.Name);
            this.material.SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA);
            this.material.SetDepthCheckEnabled(false);

            this.billboardSet = sceneMgr.CreateBillboardSet();
            this.billboardSet.SetMaterialName(this.material.Name);
            this.billboardSet.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY;

            this.billboard = this.billboardSet.CreateBillboard(Vector3.ZERO);
            this.billboard.SetDimensions(size.Width, size.Height);
            this.billboard.Colour = ColourValue.ZERO;

            node.AttachObject(this.billboardSet);
            this.sceneMgr = sceneMgr;
            this.size = size;
        }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:28,代码来源:TextExample.cs

示例4: WayPoint

        public WayPoint()
        {
            _Orientation = Quaternion.IDENTITY;
            _DisplayNameOffset = new Vector3(0, 0.2f, 0);

            Entity = Engine.Singleton.SceneManager.CreateEntity("Spawn.mesh");
            Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
            Node.AttachObject(Entity);

            ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
                Node,
                Quaternion.IDENTITY,
                0.1f,
                Engine.Singleton.GetUniqueBodyId());

            Vector3 inertia, offset;
            collision.CalculateInertialMatrix(out inertia, out offset);

            Inertia = inertia;

            Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
            Body.AttachNode(Node);
            Body.SetMassMatrix(0, inertia * 0);

            Body.ForceCallback += BodyForceCallback;

            Body.UserData = this;
            Body.MaterialGroupID = Engine.Singleton.MaterialManager.WaypointMaterialID;
            //Body.MaterialGroupID = Engine.Singleton.MaterialManager.CharacterMaterialID;

            collision.Dispose();
        }
开发者ID:janPierdolnikParda,项目名称:RPG,代码行数:32,代码来源:WayPoint.cs

示例5: CreateScene

        public override void CreateScene()
        {
            TexturePtr mTexture = TextureManager.Singleton.CreateManual("RenderArea",
                                      ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, TextureType.TEX_TYPE_2D,
                                      512, 512, 0, PixelFormat.PF_R8G8B8, (int)TextureUsage.TU_RENDERTARGET);
            rttTex = mTexture.GetBuffer().GetRenderTarget();
            rttTex.IsAutoUpdated = false;
            {
                // Create the camera
                Camera camera2 = sceneMgr.CreateCamera("PlayerCam2");

                camera2.Position = new Vector3(0, 0, 3);
                camera2.LookAt(new Vector3(0.0f, 0.0f, 0.0f));
                camera2.NearClipDistance = 1;

                Viewport v = rttTex.AddViewport(camera2);

                MaterialPtr mat = MaterialManager.Singleton.GetByName("CgTutorials/RenderToTexture_Material");
                mat.GetTechnique(0).GetPass(0).GetTextureUnitState(0).SetTextureName("RenderArea");
                v.BackgroundColour = new ColourValue(0.0f, 0.3f, 0.2f, 0.0f);
                //v.SetClearEveryFrame(false);
                //v.OverlaysEnabled = false;
                rttTex.PreRenderTargetUpdate += new RenderTargetListener.PreRenderTargetUpdateHandler(RenderArea_PreRenderTargetUpdate);
                rttTex.PostRenderTargetUpdate += new RenderTargetListener.PostRenderTargetUpdateHandler(RenderArea_PostRenderTargetUpdate);
            }

            node1 = base.sceneMgr.RootSceneNode.CreateChildSceneNode("TutorialRender2TexNode1");
            node2 = base.sceneMgr.RootSceneNode.CreateChildSceneNode("TutorialRender2TexNode2");

            manualObj1 = sceneMgr.CreateManualObject("TutorialRender2TexObject1");
            manualObj2 = sceneMgr.CreateManualObject("TutorialRender2TexObject2");

            node1.AttachObject(DrawTriangle1(manualObj1));
            node2.AttachObject(DrawTriangle2(manualObj2));
        }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:35,代码来源:RenderToTexture.cs

示例6: SetGraphicsMesh

 public void SetGraphicsMesh(String meshFile)
 {
     m_GraphicsNode =
         Core.Singleton.m_SceneManager.RootSceneNode.CreateChildSceneNode();
     m_GraphicsEntity = Core.Singleton.m_SceneManager.CreateEntity(meshFile);
     m_GraphicsNode.AttachObject(m_GraphicsEntity);
     m_GraphicsEntity.CastShadows = false;
 }
开发者ID:Marchew,项目名称:Tachycardia,代码行数:8,代码来源:Map.cs

示例7: Load

        /// <summary>
        /// This metod loads a quad in an entity and attaches it to the scenegraph
        /// </summary>
        public void Load()
        {
            Quad();

            manualObjEntity = mSceneMgr.CreateEntity("Quad_Endtity", "Quad");    // Creates a new entity which contains the geometry
            manualObjNode = mSceneMgr.CreateSceneNode("Quad_Node");              // Creates a new node for the scene graph
            manualObjNode.AttachObject(manualObjEntity);                         // Attaches the entity (geometry) to the node
            mSceneMgr.RootSceneNode.AddChild(manualObjNode);                     // Adds the node as child of the root of the scene graph
        }
开发者ID:Bobbylon5,项目名称:Mogre14,代码行数:12,代码来源:ManualObjectExample.cs

示例8: SmoothFreeCamera

        public SmoothFreeCamera(string name)
            : base(name)
        {
            TargetNode = LKernel.GetG<SceneManager>().RootSceneNode.CreateChildSceneNode();
            TargetNode.SetFixedYawAxis(true);

            CameraNode.DetachObject(Camera);
            TargetNode.AttachObject(Camera);
        }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:9,代码来源:SmoothFreeCamera.cs

示例9: ForceBall

        public ForceBall(SceneManager sceneManager, MogreNewt.World physicsWorld, float tempSize, int own)
        {
            MogreNewt.ConvexCollision col;
            Mogre.Vector3 offset;
            Mogre.Vector3 inertia;

            unique++;

            // Create the visible mesh (no physics)
            ent = sceneManager.CreateEntity("forceball" + unique, "Sph.mesh");
            sn = sceneManager.RootSceneNode.CreateChildSceneNode();
            sn.AttachObject(ent);
            Console.WriteLine("end ball create");
            size = tempSize;

            sn.SetScale(size, size, size);

            // Create the collision hull
            col = new MogreNewt.CollisionPrimitives.ConvexHull(physicsWorld, sn);
            col.calculateInertialMatrix(out inertia, out offset);

            // Create the physics body. This body is what you manipulate. The graphical Ogre scenenode is automatically synced with the physics body
            body = new MogreNewt.Body(physicsWorld, col);
            col.Dispose();

            //body.setPositionOrientation(new Vector3(0, 10, 0), Quaternion.IDENTITY);

            body.attachToNode(sn);
            body.setContinuousCollisionMode(1);
            body.setMassMatrix(mass, mass * inertia);
            body.IsGravityEnabled = true;
            body.setUserData(this);

            trail = sceneManager.CreateParticleSystem("awesome" + StringConverter.ToString(unique), "Char/Smoke");
            trail.CastShadows = true;
            trail.GetEmitter(0).EmissionRate = 100;
            sn.AttachObject(trail);

            Console.WriteLine("player stuff");

            owner = own;
            Player tempP = (Player)Program.p1;
            colour = tempP.cv;
        }
开发者ID:CharcoalStyles,项目名称:3DRL,代码行数:44,代码来源:Force+ball.cs

示例10: BillboardSystem

 public BillboardSystem(SceneManager sceneManager, SceneNode worldNode, string materialName, Mogre.BillboardType type, Vector2 defaultDimension, float defaultTimeToLive)
 {
     BillboardSet = sceneManager.CreateBillboardSet();
     BillboardSet.SetMaterialName(materialName);
     BillboardSet.SetBillboardsInWorldSpace(true);
     BillboardSet.BillboardType = type;
     worldNode.AttachObject(BillboardSet);
     this.DefaultDimension = defaultDimension;
     this.DefaultTimeToLive = defaultTimeToLive;
 }
开发者ID:nigelchanyk,项目名称:Archetype,代码行数:10,代码来源:BillboardSystem.cs

示例11: TargetPointer

        /// <summary>
        /// Initializes TargetPointer (gets unused name and creates SceneNode and Entity).
        /// Also stores a reference to targeted object.
        /// </summary>
        /// <param name="gameObject">The targeted object.</param>
        public TargetPointer(IGameObject gameObject)
        {
            this.gameObject = gameObject;
            this.position = gameObject.GetProperty<Vector3>(PropertyEnum.Position);
            string name = Game.IGameObjectCreator.GetUnusedName(typeName);
            entity = Game.SceneManager.CreateEntity(name, mesh);

            node = Game.SceneManager.RootSceneNode.CreateChildSceneNode(name + "Node", position.Value + liftingConst);
            node.Pitch(new Degree(180));
            node.AttachObject(entity);
        }
开发者ID:vavrekmichal,项目名称:Strategy,代码行数:16,代码来源:TargetPointer.cs

示例12: UniqueParticleSystem

        public UniqueParticleSystem(SceneManager sceneManager, SceneNode worldNode, string templateName)
        {
            ParticleSystem = sceneManager.CreateParticleSystem("UniqueParticleSystem" + Guid.NewGuid().ToString(), templateName);
            ReferenceEmitters = ParticleSystem.GetParticleEmitterEnumerable().ToArray();
            foreach (ParticleEmitter emitter in ReferenceEmitters)
                emitter.Enabled = false;
            ParticleQuotaPerEmitter = ParticleSystem.ParticleQuota;

            SceneNode = worldNode.CreateChildSceneNode();
            SceneNode.AttachObject(ParticleSystem);
        }
开发者ID:nigelchanyk,项目名称:Archetype,代码行数:11,代码来源:UniqueParticleSystem.cs

示例13: Barrel

 public Barrel(string meshName, Vector3 v, float mass)
 {
     m_Entity = Core.Singleton.SceneManager.CreateEntity(meshName);
     m_Node = Core.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
     m_Node.AttachObject(m_Entity);
     m_Node.Scale(0.1f, 0.1f, 0.1f);
     m_Node.Scale(new Vector3(0.3f, 0.3f, 0.3f));
     // m_Node.Rotate(new Mogre.Quaternion(new Mogre.Radian(1.57f), new Mogre.Vector3(0f, 0f, 1f) ));
     m_Node.SetPosition(v.x, v.y, v.z);
     SetPhysics(m_Entity, m_Node, mass);
 }
开发者ID:secred,项目名称:Tachycardia,代码行数:11,代码来源:Barrel.cs

示例14: Elevator

 public Elevator(string meshName, float mass, Vector3 v, bool flaga)
 {
     //tworzy grafike playera i podczepia mu kontroler, obsluguje animacje i uaktualnia kontroler
     m_HeadOffset = new Vector3(0, 0.1f, 0);
     //headoffset powinien byc chyba zmienny dla croucha itp
     m_Entity = Core.Singleton.SceneManager.CreateEntity(meshName);
     m_Node = Core.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
     m_Node.AttachObject(m_Entity);
     m_Node.Rotate(new Mogre.Quaternion(new Mogre.Radian(Mogre.Math.RadiansToDegrees(20)), new Mogre.Vector3(0f, 1f, 0f)));
     m_Node.SetPosition(v.x, v.y, v.z);
     SetPhysics(m_Entity, m_Node, mass);
 }
开发者ID:secred,项目名称:Tachycardia,代码行数:12,代码来源:Elevator.cs

示例15: Stone

 public Stone(ref SceneManager mSceneMgr, Vector3 position)
 {
     name = count.ToString();
     ent = mSceneMgr.CreateEntity("stone"+name, "ogrehead.mesh");
     ent.CastShadows = true;
     isCarried = false;
     node = mSceneMgr.RootSceneNode.CreateChildSceneNode("stoneNode"+name);
     node.AttachObject(ent);
     node.Position = position;
     node.Scale(0.35f, 0.35f, 0.35f);
     count++;
 }
开发者ID:scauglog,项目名称:sma_mogre,代码行数:12,代码来源:Stone.cs


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