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


C# SceneNode.CreateChildSceneNode方法代码示例

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


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

示例1: CreateScene

        // Just override the mandatory create scene method
        public override void CreateScene()
        {
            // Set ambient light
            sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);

            Entity ent = sceneMgr.CreateEntity("head", "ogrehead.mesh");

            // Add entity to the root scene node
            sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);

            // Green nimbus around Ogre
            //mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(
            //        mSceneMgr->createParticleSystem("Nimbus", "Examples/GreenyNimbus"));

            // Create some nice fireworks

            sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(
                sceneMgr.CreateParticleSystem("Fireworks", "Examples/Fireworks"));

            // Create shared node for 2 fountains
            mFountainNode = sceneMgr.RootSceneNode.CreateChildSceneNode();

            // fountain 1
            ParticleSystem pSys2 = sceneMgr.CreateParticleSystem("fountain1",
                                                                 "Examples/PurpleFountain");
            // Point the fountain at an angle
            SceneNode fNode = mFountainNode.CreateChildSceneNode();
            fNode.Translate(200,-100,0);
            fNode.Rotate(Vector3.UNIT_Z, new Degree(20));
            fNode.AttachObject(pSys2);

            // fountain 2
            ParticleSystem pSys3 = sceneMgr.CreateParticleSystem("fountain2",
                                                                 "Examples/PurpleFountain");
            // Point the fountain at an angle
            fNode = mFountainNode.CreateChildSceneNode();
            fNode.Translate(-200,-100,0);
            fNode.Rotate(Vector3.UNIT_Z, new Degree(-20));
            fNode.AttachObject(pSys3);

            // Create a rainstorm
            ParticleSystem pSys4 = sceneMgr.CreateParticleSystem("rain",
                                                                 "Examples/Rain");
            SceneNode rNode = sceneMgr.RootSceneNode.CreateChildSceneNode();
            rNode.Translate(0,1000,0);
            rNode.AttachObject(pSys4);
            // Fast-forward the rain so it looks more natural
            pSys4.FastForward(5);

            // Aureola around Ogre perpendicular to the ground
            ParticleSystem pSys5 = sceneMgr.CreateParticleSystem("Aureola",
                                                                 "Examples/Aureola");
            sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(pSys5);

            // Set nonvisible timeout
            ParticleSystem.DefaultNonVisibleUpdateTimeout = 5;
        }
开发者ID:andyhebear,项目名称:mogresdk,代码行数:58,代码来源:ParticleApplication.cs

示例2: FirstPersonModel

 public FirstPersonModel(Character character, SceneNode eyeNode)
     : base(character)
 {
     this.EyeNode = eyeNode;
     WeaponSceneNode = EyeNode.CreateChildSceneNode();
     WeaponCenterNode = WeaponSceneNode.CreateChildSceneNode();
 }
开发者ID:nigelchanyk,项目名称:Archetype,代码行数:7,代码来源:FirstPersonModel.cs

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

示例4: ThirdPersonModel

        public ThirdPersonModel(Character character, SceneNode characterNode, string[] bodyEntityNames)
            : base(character)
        {
            BodyEntities = bodyEntityNames.Select(name => Character.World.Scene.CreateEntity(name)).ToArray();
            BodyNode = characterNode.CreateChildSceneNode();
            BodyNode.Yaw(MathHelper.Pi);

            WeaponSceneNode = BodyNode.CreateChildSceneNode();
            WeaponCenterNode = WeaponSceneNode.CreateChildSceneNode();

            foreach (Entity bodyEntity in BodyEntities)
            {
                BodyNode.AttachObject(bodyEntity);
                // To play multiple animations that does not affect each other,
                // blending mode cannot be average.
                if (bodyEntity.HasSkeleton)
                    bodyEntity.Skeleton.BlendMode = SkeletonAnimationBlendMode.ANIMBLEND_CUMULATIVE;
            }
            WeaponCenterNode.Yaw(MathHelper.Pi);
        }
开发者ID:nigelchanyk,项目名称:Archetype,代码行数:20,代码来源:ThirdPersonModel.cs

示例5: Player

        public Player(Vector3 oPos, Quaternion oOrent)
        {
            unique++;
            //create a scene node, off the root scene node
            sn = Program.Instance.sceneManager.RootSceneNode.CreateChildSceneNode();
            //Load the mesh into the entity
            ent = Program.Instance.sceneManager.CreateEntity("playa" + unique, "PC_01.mesh");
            //Attach the Entity to the scene node
            sn.AttachObject(ent);

            l = Program.Instance.sceneManager.CreateLight("Sun");
            l.DiffuseColour = new ColourValue(0.9f, 0.6f, 0.2f);
            light_node = sn.CreateChildSceneNode();
            light_node.AttachObject(l);
            light_node.Position = new Vector3(0, 0, -55);

            sn.Orientation = new Quaternion(new Degree(90), Vector3.UNIT_X);

            position = new Vector2(0, 0);

            isPlayer = true;
        }
开发者ID:CharcoalStyles,项目名称:3DRL,代码行数:22,代码来源:Player.cs

示例6: processNode

        protected void processNode(XmlElement XMLNode, SceneNode pParent)
        {
            // Construct the node's name
            String name = m_sPrependNode + getAttrib(XMLNode, "name");

            // Create the scene node
            SceneNode pNode;
            if (name.Length == 0)
            {
                // Let Ogre choose the name
                if (pParent != null)
                    pNode = pParent.CreateChildSceneNode();
                else
                    pNode = mAttachNode.CreateChildSceneNode();
            }
            else
            {
                // Provide the name
                if (pParent != null)
                    pNode = pParent.CreateChildSceneNode(name);
                else
                    pNode = mAttachNode.CreateChildSceneNode(name);
            }

            // Process other attributes
            XmlElement pElement;

            // Process position (?)
            pElement = (XmlElement)XMLNode.SelectSingleNode("position");
            if (pElement != null)
            {
                pNode.Position = parseVector3(pElement);
                pNode.SetInitialState();
            }

            // Process quaternion (?)
            pElement = (XmlElement)XMLNode.SelectSingleNode("quaternion");
            if (pElement != null)
            {
                pNode.Orientation = parseQuaternion(pElement);
                pNode.SetInitialState();
            }

            // Process rotation (?)
            pElement = (XmlElement)XMLNode.SelectSingleNode("rotation");
            if (pElement != null)
            {
                pNode.Orientation = parseRotation(pElement);
                pNode.SetInitialState();
            }

            // Process scale (?)
            pElement = (XmlElement)XMLNode.SelectSingleNode("scale");
            if (pElement != null)
            {
                pNode.SetScale(parseVector3(pElement));
                pNode.SetInitialState();
            }

            // Process entity (*)
            pElement = (XmlElement)XMLNode.SelectSingleNode("entity");
            if (pElement != null)
            {
                processEntity(pElement, pNode);
            }

            // Process light (*)
            pElement = (XmlElement)XMLNode.SelectSingleNode("light");
            if (pElement != null)
            {
                processLight(pElement, pNode);
            }

            // Process plane (*)
            pElement = (XmlElement)XMLNode.SelectSingleNode("plane");
            while (pElement != null)
            {
                processPlane(pElement, pNode);
                pElement = (XmlElement)pElement.NextSibling;
            }

            // Process camera (*)
            pElement = (XmlElement)XMLNode.SelectSingleNode("camera");
            if (pElement != null)
            {
                processCamera(pElement, pNode);
            }

            // Process userDataReference (?)
            pElement = (XmlElement)XMLNode.SelectSingleNode("userData");
            if (pElement != null)
                processUserDataReference(pElement, pNode);

            // Process childnodes
            pElement = (XmlElement)XMLNode.SelectSingleNode("node");
            while (pElement != null)
            {
                processNode(pElement, pNode);
                pElement = (XmlElement)pElement.NextSibling;
            }
//.........这里部分代码省略.........
开发者ID:MSylvia,项目名称:mspriterenderer,代码行数:101,代码来源:DotSceneLoader.cs

示例7: drawCircle

 private void drawCircle(SceneNode p_Node, string name)
 {
     SceneNode l_ShoeTargetNode = p_Node.CreateChildSceneNode(p_Node.Name + name, new Vector3(0f, 0f, 0f));
     Entity l_Entity = mSceneManager.CreateEntity(name, SceneManager.PrefabType.PT_SPHERE);
     l_Entity.SetMaterialName("Examples/Fish");
     l_ShoeTargetNode.AttachObject(l_Entity);
     l_ShoeTargetNode.Scale(0.1f, 0.1f, 0.1f);
 }
开发者ID:sachindeshpande,项目名称:TRapperProject,代码行数:8,代码来源:MogreWrapperMain.cs

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

示例9: Init

        public void Init(String handle)
        {
            try
            {
                // Create root object
                mRoot = new Root();

                // Define Resources
                ConfigFile cf = new ConfigFile();
                cf.Load("./resources.cfg", "\t:=", true);
                ConfigFile.SectionIterator seci = cf.GetSectionIterator();
                String secName, typeName, archName;

                while (seci.MoveNext())
                {
                    secName = seci.CurrentKey;
                    ConfigFile.SettingsMultiMap settings = seci.Current;
                    foreach (KeyValuePair<string, string> pair in settings)
                    {
                        typeName = pair.Key;
                        archName = pair.Value;
                        ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
                    }
                }

                //Load the resources from resources.cfg and selected tab (_ConfigurationPaths)
                //LoadResourceLocations(_ConfigurationPaths);

                //example of manual add: _FileSystemPaths.Add("../../Media/models");
                foreach (string foo in _ConfigurationPaths)
                {
                    AddResourceLocation(foo);
                }

                // Setup RenderSystem
                mRSys = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
                //mRSys = mRoot.GetRenderSystemByName("OpenGL Rendering Subsystem");

                // or use "OpenGL Rendering Subsystem"
                mRoot.RenderSystem = mRSys;

                mRSys.SetConfigOption("Full Screen", "No");
                mRSys.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");

                // Create Render Window
                mRoot.Initialise(false, "Main Ogre Window");
                NameValuePairList misc = new NameValuePairList();
                misc["externalWindowHandle"] = handle;
                misc["FSAA"] = "4";
                // misc["VSync"] = "True"; //not sure how to enable vsync to remove those warnings in Ogre.log
                mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);

                // Init resources
                MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_ANISOTROPIC);
                TextureManager.Singleton.DefaultNumMipmaps = 5;
                ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

                // Create a Simple Scene
                //SceneNode node = null;
                // mMgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC, "SceneManager");
                mMgr = mRoot.CreateSceneManager(SceneType.ST_EXTERIOR_CLOSE, "SceneManager");

                mMgr.AmbientLight = new ColourValue(0.8f, 0.8f, 0.8f);

                mCamera = mMgr.CreateCamera("Camera");
                mWindow.AddViewport(mCamera);

                mCamera.AutoAspectRatio = true;
                mCamera.Viewport.SetClearEveryFrame(false);

                //Entity ent = mMgr.CreateEntity(displayMesh, displayMesh);

                //ent.SetMaterialName(displayMaterial);
                //node = mMgr.RootSceneNode.CreateChildSceneNode(displayMesh + "node");
                //node.AttachObject(ent);

                mCamera.Position = new Vector3(0, 0, 0);
                //mCamera.Position = new Vector3(0, 0, -400);
                mCamera.LookAt(0, 0, 1);

                //Create a single point light source
                Light light2 = mMgr.CreateLight("MainLight");
                light2.Position = new Vector3(0, 10, -25);
                light2.Type = Light.LightTypes.LT_POINT;
                light2.SetDiffuseColour(1.0f, 1.0f, 1.0f);
                light2.SetSpecularColour(0.1f, 0.1f, 0.1f);

                mWindow.WindowMovedOrResized();

                IsInitialized = true;

                // Create the camera's top node (which will only handle position).
                cameraNode = mMgr.RootSceneNode.CreateChildSceneNode();
                cameraNode.Position = new Vector3(0, 0, 0);

                //cameraNode = mMgr->getRootSceneNode()->createChildSceneNode();
                //cameraNode->setPosition(0, 0, 500);

                // Create the camera's yaw node as a child of camera's top node.
                cameraYawNode = cameraNode.CreateChildSceneNode();
//.........这里部分代码省略.........
开发者ID:zinick,项目名称:Ogre3D-Level-Editor,代码行数:101,代码来源:OgreForm.cs

示例10: processNode

        protected void processNode(XmlElement XMLNode, SceneNode pParent)
        {
            // Construct the node's name
            String name = m_sPrependNode + getAttrib(XMLNode, "name");

            // Create the scene node
            SceneNode pNode;
            if (name.Length == 0)
            {
                // Let Ogre choose the name
                if (pParent != null)
                    pNode = pParent.CreateChildSceneNode();
                else
                    pNode = mAttachNode.CreateChildSceneNode();
            }
            else
            {
                // Provide the name
                if (pParent != null)
                    pNode = pParent.CreateChildSceneNode(name);
                else
                    pNode = mAttachNode.CreateChildSceneNode(name);
            }

            // Process other attributes
            XmlElement pElement;

            // Process position (?)
            pElement = (XmlElement)XMLNode.SelectSingleNode("position");
            if (pElement != null)
            {
                pNode.Position = parseVector3(pElement);
                pNode.SetInitialState();
            }

            // Process quaternion (?)
            pElement = (XmlElement)XMLNode.SelectSingleNode("quaternion");
            if (pElement != null)
            {
                pNode.Orientation = parseQuaternion(pElement);
                pNode.SetInitialState();
            }

            // Process rotation (?)
            pElement = (XmlElement)XMLNode.SelectSingleNode("rotation");
            if (pElement != null)
            {
                pNode.Orientation = parseRotation(pElement);
                pNode.SetInitialState();
            }

            // Process scale (?)
            pElement = (XmlElement)XMLNode.SelectSingleNode("scale");
            if (pElement != null)
            {
                pNode.SetScale(parseVector3(pElement));
                pNode.SetInitialState();
            }

            // Process entity (*)
            pElement = (XmlElement)XMLNode.SelectSingleNode("entity");
            if (pElement != null)
            {
                processEntity(pElement, pNode);
            }

            // Process light (*)
            pElement = (XmlElement)XMLNode.SelectSingleNode("light");
            if (pElement != null)
            {
                processLight(pElement, pNode);
            }

            // Process plane (*)
            pElement = (XmlElement)XMLNode.SelectSingleNode("plane");
            while (pElement != null)
            {
                processPlane(pElement, pNode);
                pElement = (XmlElement)pElement.NextSibling;
            }

            //process particle (*)
            pElement = (XmlElement)XMLNode.SelectSingleNode("particleSystem");
            if (pElement != null)
                processParticleSystem(pElement, pNode);

            // Process camera (*)
            pElement = (XmlElement)XMLNode.SelectSingleNode("camera");
            if (pElement != null)
            {
                processCamera(pElement, pNode);
            }

            // Process childnodes
            pElement = (XmlElement)XMLNode.SelectSingleNode("node");
            while (pElement != null)
            {
                processNode(pElement, pNode);
                pElement = (XmlElement)pElement.NextSibling;
            }
//.........这里部分代码省略.........
开发者ID:secred,项目名称:Tachycardia,代码行数:101,代码来源:DotSceneLoader.cs

示例11: StaticBillboardSet

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mgr"></param>
        /// <param name="rootSceneNode"></param>
        /// <param name="method"></param>
        public StaticBillboardSet(SceneManager mgr, SceneNode rootSceneNode, BillboardMethod method)
        {
            mSceneMgr = mgr;
            mRenderMethod = method;
            mVisible = true;
            mFadeEnabled = false;
            mBBOrigin = BillboardOrigin.Center;

            //Fall back to Compatible if vertex shaders are not available
            if (mRenderMethod == BillboardMethod.Accelerated)
            {
                RenderSystemCapabilities caps = Root.Singleton.RenderSystem.Capabilities;
                if (!caps.HasCapability(Capabilities.VertexPrograms))
                    mRenderMethod = BillboardMethod.Compatible;
            }

            mNode = rootSceneNode.CreateChildSceneNode();
            mEntityName = GetUniqueID("SBSEntity");

            if (mRenderMethod == BillboardMethod.Accelerated)
            {
                //Accelerated billboard method
                mEntity = null;
                mUFactor = 1.0f;
                mVFactor = 1.0f;

                //Load vertex shader to align billboards to face the camera (if not loaded already)
                if (++mSelfInstances == 1)
                {
                    //First shader, simple camera-alignment
                    HighLevelGpuProgram vertexShader =
                        (HighLevelGpuProgram)HighLevelGpuProgramManager.Instance.GetByName("Sprite_vp");
                    if (vertexShader == null)
                    {
                        string vertexProg = string.Empty;

                        vertexProg =
                            "void Sprite_vp(	\n" +
                            "	float4 position : POSITION,	\n" +
                            "	float3 normal   : NORMAL,	\n" +
                            "	float4 color	: COLOR,	\n" +
                            "	float2 uv       : TEXCOORD0,	\n" +
                            "	out float4 oPosition : POSITION,	\n" +
                            "	out float2 oUv       : TEXCOORD0,	\n" +
                            "	out float4 oColor    : COLOR, \n" +
                            "	out float4 oFog      : FOG,	\n" +
                            "	uniform float4x4 worldViewProj,	\n" +
                            "	uniform float    uScroll, \n" +
                            "	uniform float    vScroll, \n" +
                            "	uniform float4   preRotatedQuad[4] )	\n" +
                            "{	\n" +
                            //Face the camera
                            "	float4 vCenter = float4( position.x, position.y, position.z, 1.0f );	\n" +
                            "	float4 vScale = float4( normal.x, normal.y, normal.x, 1.0f );	\n" +
                            "	oPosition = mul( worldViewProj, vCenter + (preRotatedQuad[normal.z] * vScale) );  \n" +

                            //Color
                            "	oColor = color;   \n" +

                            //UV Scroll
                            "	oUv = uv;	\n" +
                            "	oUv.x += uScroll; \n" +
                            "	oUv.y += vScroll; \n" +

                            //Fog
                            "	oFog.x = oPosition.z; \n" +
                            "}";

                        vertexShader = HighLevelGpuProgramManager.Instance.CreateProgram(
                            "Sprite_vp",
                            ResourceGroupManager.DefaultResourceGroupName,
                            "cg", GpuProgramType.Vertex);

                        vertexShader.Source = vertexProg;
                        vertexShader.SetParam("profiles", "vs_1_1 arbvp1");
                        vertexShader.SetParam("entry_point", "Sprite_vp");
                        vertexShader.Load();
                    }

                    //Second shader, camera alignment and distance based fading
                    HighLevelGpuProgram vertexShader2 =
                        (HighLevelGpuProgram)HighLevelGpuProgramManager.Instance.GetByName("SpriteFade_vp");
                    if (vertexShader2 == null)
                    {
                        string vertexProg2 = string.Empty;

                        vertexProg2 =
                            "void SpriteFade_vp(	\n" +
                            "	float4 position : POSITION,	\n" +
                            "	float3 normal   : NORMAL,	\n" +
                            "	float4 color	: COLOR,	\n" +
                            "	float2 uv       : TEXCOORD0,	\n" +
                            "	out float4 oPosition : POSITION,	\n" +
                            "	out float2 oUv       : TEXCOORD0,	\n" +
//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:mogrelibrarys,代码行数:101,代码来源:StaticBillboardSet.cs

示例12: point3d

        public SceneNode point3d(string name, int id, float x, float y, float z, SceneNode node, SceneManager sceneMgr)
        {
            Entity ent;
            if (node == null)//point of reference 0,0,0
            {
                ManualObject aux = sceneMgr.CreateManualObject();
                //ent = sceneMgr.CreateEntity(name + id, this.getNameEntities());
                node = sceneMgr.RootSceneNode.CreateChildSceneNode(name + id + "Node", new Vector3(y, z, x));
                node.AttachObject(aux);
                return node;
            }
            else//create new point
            {
                float xAux = x;
                float yAux = y;

                SceneNode nodeAux;

                ent = sceneMgr.CreateEntity(name + id, getNameEntities());
                nodeAux = node.CreateChildSceneNode(name + "Node_" + id, new Vector3(yAux, z, xAux));

                nodeAux.AttachObject(ent);
                return nodeAux;
            }
        }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:25,代码来源:BuildGeomFilter.cs

示例13: SimNode

 public SimNode(SceneNode root, SceneNode node)
 {
     SceneNode = root.CreateChildSceneNode();
     SceneNode.AddChild(node);
 }
开发者ID:crescent,项目名称:SubmarineSim3D,代码行数:5,代码来源:SimNode.cs


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