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;
 }
Beispiel #2
0
        void setupLighting()
        {
            /****/
            // Set ambient light
            mSceneManager.SetAmbientLight(Converter.GetColor(0.2f, 0.2f, 0.2f));
            // Point light, movable, reddish
            mLight = mSceneManager.CreateLight("Light2");
            mLight.SetDiffuseColour(mMinLightColour);
            mLight.SetSpecularColour(1.0f, 1.0f, 1.0f);
            mLight.SetAttenuation(8000.0f, 1.0f, 0.0005f, 0.0f);

            // Create light node
            mLightNode = mSceneManager.GetRootSceneNode().CreateChildSceneNode("MovingLightNode");
            mLightNode.AttachObject(mLight);
            // create billboard set
            BillboardSet bbs = mSceneManager.CreateBillboardSet("lightbbs", 1);

            bbs.SetMaterialName("Examples/Flare");
            Billboard bb = bbs.CreateBillboard(0, 0, 0, mMinLightColour);

            // attach
            mLightNode.AttachObject(bbs);



            // create controller, after this is will get updated on its own
            mWFCF   = new WaveformControllerFunction(WaveformType.Sine, 0.0f, 0.5f);
            mCFFPtr = new ControllerFunctionFloatPtr(mWFCF);

            mLightWibbler = new LightWibbler(mLight, bb, mMinLightColour, mMaxLightColour, mMinFlareSize, mMaxFlareSize);
            mCVFPtr       = new ControllerValueFloatPtr(mLightWibbler.mCVFH);

            ControllerManager contMgr = ControllerManager.GetSingleton();

            mLightCtlFlt = contMgr.CreateController(contMgr.GetFrameTimeSource(), mCVFPtr, mCFFPtr);

            mLightNode.SetPosition(new Vector3(300, 250, -300));


            // Create a track for the light
            Animation anim = mSceneManager.CreateAnimation("LightTrack", 20.0f);

            // Spline it for nice curves
            anim.SetInterpolationMode(Animation.InterpolationMode.Spline);
            // Create a track to animate the camera's node
            NodeAnimationTrack track = anim.CreateNodeTrack(0, mLightNode);
            // Setup keyframes
            TransformKeyFrame key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(0.0f)).Handle, false);              // A startposition

            key.SetTranslate(new Vector3(300.0f, 550.0f, -300.0f));

            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(2.0f)).Handle, false);             //B
            key.SetTranslate(new Vector3(150.0f, 600.0f, -250.0f));
            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(4.0f)).Handle, false);             //C
            key.SetTranslate(new Vector3(-150.0f, 650.0f, -100.0f));
            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(6.0f)).Handle, false);             //D
            key.SetTranslate(new Vector3(-400.0f, 500.0f, -200.0f));
            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(8.0f)).Handle, false);             //E
            key.SetTranslate(new Vector3(-200.0f, 500.0f, -400.0f));
            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(10.0f)).Handle, false);            //F
            key.SetTranslate(new Vector3(-100.0f, 450.0f, -200.0f));
            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(12.0f)).Handle, false);            //G
            key.SetTranslate(new Vector3(-100.0f, 400.0f, 180.0f));
            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(14.0f)).Handle, false);            //H
            key.SetTranslate(new Vector3(0.0f, 250.0f, 600.0f));
            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(16.0f)).Handle, false);            //I
            key.SetTranslate(new Vector3(100.0f, 650.0f, 100.0f));
            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(18.0f)).Handle, false);            //J
            key.SetTranslate(new Vector3(250.0f, 600.0f, 0.0f));
            key = new TransformKeyFrame(KeyFrame.getCPtr(track.CreateKeyFrame(20.0f)).Handle, false);            //K == A
            key.SetTranslate(new Vector3(300.0f, 550.0f, -300.0f));
            // Create a new animation state to track this
            mAnimState = mSceneManager.CreateAnimationState("LightTrack");
            mAnimState.SetEnabled(true);
            /****/
        }
Beispiel #3
0
        private void SetupLighting()
        {
            scene.AmbientLight = new ColorEx(0.2f, 0.2f, 0.2f);
            Light = scene.CreateLight("Light2");
            Light.DiffuseColour = MinLightColour;
            Light.SetAttenuation(8000, 1, 0.0005f, 0);
            Light.SpecularColour = new ColorEx(1, 1, 1);

            LightNode = scene.RootSceneNode.CreateChildSceneNode("MovingLightNode");
            LightNode.AttachObject(Light);
            //create billboard set

            BillboardSet bbs = scene.CreateBillboardSet("lightbbs", 1);

            bbs.SetMaterialName("Examples/Flare");
            Billboard bb = bbs.CreateBillboard(new Vector3(0, 0, 0), MinLightColour);

            LightNode.AttachObject(bbs);

            mLightController = new LightGrassWibbler(Light, bb, MinLightColour, this.MaxLightColour, MinFlareSize, MaxFlareSize);

            // create controller, after this is will get updated on its own
            //WaveformControllerFunction func = new WaveformControllerFunction(WaveformType.Sine, 0.0f, 0.5f);

            //ControllerManager.Instance.CreateController(val, func);

            LightNode.Position = new Vector3(300, 250, -300);

            Animation anim = scene.CreateAnimation("LightTrack", 20);

            //Spline it for nce curves
            anim.SetInterpolationMode(Animation.InterpolationMode.IM_SPLINE);// = Mogre.Animation.InterpolationMode.IM_SPLINE;
            //create a srtack to animte the camera's node
            NodeAnimationTrack track = anim.CreateNodeTrack(0, LightNode);
            //setup keyframes
            TransformKeyFrame key = track.CreateNodeKeyFrame(0);

            key.Translate = new Vector3(300, 550, -300);
            key           = track.CreateNodeKeyFrame(2);  //B
            key.Translate = new Vector3(150, 600, -250);
            key           = track.CreateNodeKeyFrame(4);  //C
            key.Translate = new Vector3(-150, 650, -100);
            key           = track.CreateNodeKeyFrame(6);  //D
            key.Translate = new Vector3(-400, 500, -200);
            key           = track.CreateNodeKeyFrame(8);  //E
            key.Translate = new Vector3(-200, 500, -400);
            key           = track.CreateNodeKeyFrame(10); //F
            key.Translate = new Vector3(-100, 450, -200);
            key           = track.CreateNodeKeyFrame(12); //G
            key.Translate = new Vector3(-100, 400, 180);
            key           = track.CreateNodeKeyFrame(14); //H
            key.Translate = new Vector3(0, 250, 600);
            key           = track.CreateNodeKeyFrame(16); //I
            key.Translate = new Vector3(100, 650, 100);
            key           = track.CreateNodeKeyFrame(18); //J
            key.Translate = new Vector3(250, 600, 0);
            key           = track.CreateNodeKeyFrame(20); //K == A
            key.Translate = new Vector3(300, 550, -300);
            // Create a new animation state to track this

            AnimState         = scene.CreateAnimationState("LightTrack");
            AnimState.Enabled = true;
        }