public override void Dispose()
        {
            mLog.Dispose();
            mLog = null;

            base.Dispose();
        }
Exemple #2
0
        /// <summary>
        /// Disposes
        /// </summary>
        public override void Dispose()
        {
            mLightNode  = null;
            mLight      = null;
            mpObjsNode  = null;
            mStaticGeom = null;
            mAnimState  = null;

            mSceneManager.ClearScene();

            mLightWibbler.Dispose();
            mLightWibbler = null;
            //ControllerManager contMgr = ControllerManager.GetSingleton();
            //contMgr.DestroyController( mLightCtlFlt );
            mLightCtlFlt = null;
            mWFCF        = null;
            mCFFPtr      = null;
            mCVFPtr      = null;

            mLog.Dispose();
            mLog = null;

            //GC.Collect();
            base.Dispose();
        }
Exemple #3
0
        public override void Dispose()
        {
            if (myLine != null)
            {
                myLine.Dispose();
            }
            myLine = null;

            if (mBBC != null)
            {
                mBBC.Dispose();
            }
            mBBC = null;

            if (mLog != null)
            {
                mLog.Dispose();
            }
            mLog = null;

            //force collect befor root gets Dispose
            GC.Collect();

            base.Dispose();
        }
Exemple #4
0
        public override void Dispose()
        {
            foreach (CeguiDotNet.Imageset imgset in mDebugRTTImageSets)
            {
                CeguiDotNet.ImagesetManager.getSingleton().destroyImageset(imgset);
            }
            mDebugRTTImageSets.Clear();
            mDebugRTTImageSets = null;


            mMainNode = null;
            mSpinny   = null;
            mhvListener.Dispose();
            mhvListener = null;
            mhdrListener.Dispose();
            mhdrListener = null;
            mCompositorSelectorViewManager = null;


            mGuiAvg            = null;
            mGuiCurr           = null;
            mGuiBest           = null;
            mGuiWorst          = null;
            mGuiTris           = null;
            mGuiDbg            = null;
            mGuiRoot           = null;
            mDebugRTTListbox   = null;
            mDebugRTTImageSets = null;



            if (WindowManager.Instance != null)
            {
                WindowManager.Instance.destroyAllWindows();
            }
            if (mGuiSystem != null)
            {
                mGuiSystem.Dispose();
            }
            mGuiSystem = null;
            if (mGuiRenderer != null)
            {
                mGuiRenderer.Dispose();
            }
            mGuiRenderer = null;

            if (mLog != null)
            {
                mLog.Dispose();
            }
            mLog = null;

            base.Dispose();
        }
Exemple #5
0
        protected override void CreateScene()
        {
            mLog = LogManager.Singleton.createLog("DemoGAPyramid.log", false, true);
            mLog.LogMessage(string.Format("DemoGAPyramid log {0}", System.DateTime.Now));

            base.CreateScene();

            create4LineDebugOverLay();
            Show4LineDebugOverLay();

            Entity pyra_ent = mSceneManager.CreateEntity("Pyramid_entity", "pyramid.mesh");

            pyra_ent.SetCastShadows(true);

            SceneNode pyra_node = mSceneManager.GetRootSceneNode().CreateChildSceneNode("Pyramid_node");

            pyra_node.AttachObject(pyra_ent);
        }
Exemple #6
0
        public override void Dispose()
        {
            mRay.Dispose();
            mRay = null;

            mRaySceneQuery.Dispose();
            mRaySceneQuery = null;

            /*if (myLine != null)
             * {
             *      SceneNode n = mSceneManager.GetSceneNode("Line1");
             *      if (n!= null)
             *              n.DetachObject(myLine);
             *      myLine.Dispose();
             * }*/
            myLine.Dispose();
            myLine = null;

            mLog.Dispose();
            mLog = null;

            base.Dispose();
        }
Exemple #7
0
        protected override void CreateScene()
        {
            mMoveScale = 400.0f;

            mLog = LogManager.Singleton.createLog("DemoFireworks.log", false, true);
            mLog.LogMessage(string.Format("DemoFireworks log {0}", System.DateTime.Now));

            mLog.LogMessage("CreateScene point setup envirenment");
            mSceneManager.SetAmbientLight(Converter.GetColor(0.15f, 0.15f, 0.15f));
            mSceneManager.SetSkyBox(true, "skybox/Starfield", 1000.0f);

            mLog.LogMessage("CreateScene point setup mainlight");
            /*******/
            Light l = mSceneManager.CreateLight("MainLight");

            l.SetPosition(0.0f, 50.0f, 0.0f);
            l.SetSpecularColour(0.25f, 0.25f, 0.25f);
            l.SetDiffuseColour(0.25f, 0.25f, 0.25f);
            l.SetCastShadows(false);
            /*******/

            mLog.LogMessage("CreateScene point setup groundplane");
            Plane plane = new Plane(new Vector3(0, 1, 0), 0);

            MeshManager.GetSingleton().CreatePlane("GroundPlane", "General", plane,
                                                   150000, 150000, 10, 10, true, 1, 100, 100, Vector3.UnitZ);
            Entity pPlaneEnt = mSceneManager.CreateEntity("Ground", "GroundPlane");

            pPlaneEnt.SetMaterialName("Examples/GrassFloor");
            pPlaneEnt.SetCastShadows(false);
            mSceneManager.GetRootSceneNode().CreateChildSceneNode().AttachObject(pPlaneEnt);


            /*******/
            mLog.LogMessage("CreateScene point setup sky clouds");
            plane = new Plane(new Vector3(0, -1, 0), -4000);
            MeshManager.GetSingleton().CreatePlane("CloudsPlaneBottom", "General", plane,
                                                   150000, 150000, 10, 10, true, 1, 1, 1, Vector3.UnitZ);
            pPlaneEnt = mSceneManager.CreateEntity("CloudsBottom", "CloudsPlaneBottom");
            pPlaneEnt.SetMaterialName("firworks/clouds01/512");
            pPlaneEnt.SetCastShadows(false);
            mSceneManager.GetRootSceneNode().CreateChildSceneNode().AttachObject(pPlaneEnt);

            plane = new Plane(new Vector3(0, 1, 0), 4000);
            MeshManager.GetSingleton().CreatePlane("CloudsPlaneTop", "General", plane,
                                                   150000, 150000, 10, 10, true, 1, 1, 1, Vector3.UnitZ);
            pPlaneEnt = mSceneManager.CreateEntity("CloudsTop", "CloudsPlaneTop");
            pPlaneEnt.SetMaterialName("firworks/clouds01/512");
            pPlaneEnt.SetCastShadows(false);
            SceneNode pNode = mSceneManager.GetRootSceneNode().CreateChildSceneNode();

            pNode.AttachObject(pPlaneEnt);
            pNode.Yaw(180.0f);
            /*******/

            // -1014 x -1363
            /*******/
            mLog.LogMessage("CreateScene point setup default fountains");
            string    strName = this.GetFWName();
            cfirework fw      = new cfirework(strName, cfirework.FWType.Fountain01, mSceneManager);

            fw.mNode.SetPosition(-50.0f, 1.0f, 0.0f);
            fw.mTimeToLive = 0;
            fw.mMoveable   = false;
            mALFireworks.Add(fw);

            strName = this.GetFWName();
            fw      = new cfirework(strName, cfirework.FWType.Fountain01, mSceneManager);
            fw.mNode.SetPosition(50.0f, 1.0f, 0.0f);
            fw.mTimeToLive = 0;
            fw.mMoveable   = false;
            mALFireworks.Add(fw);
            /******/
            mtimeNext = OgreDotNet.OgreMath.RangeRandom(0.0f, 2.0f);

            mLog.LogMessage("CreateScene point setup camera");
            mCamera.SetPosition(0.0f, 400.0f, 3000.0f);
            mCamera._lookAt(0.0f, 5.0f, 0.0f);

            mLog.LogMessage("CreateScene point call create4LineDebugOverLay");
            create4LineDebugOverLay();
            Show4LineDebugOverLay();
        }
        protected override void CreateScene()
        {
            mLog = LogManager.Singleton.createLog("RSQTest.log", false, true);
            mLog.LogMessage(string.Format("RSQTest log {0}", System.DateTime.Now));

            create4LineDebugOverLay();
            Show4LineDebugOverLay();

            //setup RenderTargetListenerDirector
            mRTListener = new RenderTargetListenerDirector();
            mRTListener.SubscribeEvents();
            mRTListener.evtPreRenderTargetUpdate  += new RenderTargetListenerDirector.RTLD_Delegate_RenderTargetUpdate(event_PreRenderTargetUpdate);
            mRTListener.evtPostRenderTargetUpdate += new RenderTargetListenerDirector.RTLD_Delegate_RenderTargetUpdate(event_PostRenderTargetUpdate);

            mSceneManager.SetAmbientLight(Converter.GetColor(0.2f, 0.2f, 0.2f));

            mSceneManager.SetSkyBox(true, "Examples/MorningSkyBox");

            // Create a light
            Light l = mSceneManager.CreateLight("MainLight");

            l.SetLightType(OgreDotNet.Light.LightTypes.Directional);
            Math3D.Vector3 dir = new Vector3(0.5f, -1.0f, 0.0f);
            dir.Normalize();
            l.SetDirection(dir);
            l.SetDiffuseColour(1.0f, 1.0f, 0.8f);
            l.SetSpecularColour(1.0f, 1.0f, 1.0f);

            // Create a prefab plane
            mPlane        = new MovablePlane("ReflectPlane");
            mPlane.D      = 0;
            mPlane.Normal = OgreVector3.FromVector3(Math3D.Vector3.UnitY);
            MeshManager.GetSingleton().CreatePlane("ReflectionPlane", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                                                   mPlane, 2000, 2000, 1, 1, true, 1, 1, 1, Vector3.UnitZ);
            mPlaneEnt = mSceneManager.CreateEntity("Plane", "ReflectionPlane");

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

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

            knotEnt.SetMaterialName("Examples/TextureEffect2");

            // Attach the rtt entity to the root of the scene
            SceneNode rootNode = mSceneManager.GetRootSceneNode();

            mPlaneNode = rootNode.CreateChildSceneNode();

            // Attach both the plane entity, and the plane definition
            mPlaneNode.AttachObject(mPlaneEnt);

            //multi Inheritence problem, use the static Get*From function to convert
            MovableObject mo = MovableObject.GetMovableObjectFrom(mPlane);

            mPlaneNode.AttachObject(mo);

            mPlaneNode.Translate(0.0f, -10.0f, 0.0f);

            // Tilt it a little to make it interesting
            //mPlaneNode.Roll( new Radian( new Degree( 5.0f)) );
            mPlaneNode.Roll(5.0f);

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


            RenderTexture rttTex = mRoot.GetRenderSystem().CreateRenderTexture("RttTex", 512, 512,
                                                                               TextureType.TEX_TYPE_2D, PixelFormat.PF_R8G8B8);

            {            //new scope for some reason
                mReflectCam = mSceneManager.CreateCamera("ReflectCam");
                mReflectCam.SetNearClipDistance(mCamera.GetNearClipDistance());
                mReflectCam.SetFarClipDistance(mCamera.GetFarClipDistance());
                mReflectCam.SetAspectRatio(
                    (float)mRenderWindow.GetViewport(0).ActualWidth /
                    (float)mRenderWindow.GetViewport(0).ActualHeight);

                Viewport v = rttTex.AddViewport(mReflectCam);
                v.ClearEveryFrame = true;
                v.BackgroundColor = System.Drawing.Color.Black;                 //Converter.ToColor( ColourValue.Black );

                ResourcePtr resPtr = MaterialManager.Instance.Create("RttMat",
                                                                     ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);

                MaterialPtr mat = new MaterialPtr(ResourcePtr.getCPtr(resPtr).Handle, false);

                TextureUnitState t = mat.Get().GetTechnique(0).getPass(0).createTextureUnitState("RustedMetal.jpg");
                t = mat.Get().GetTechnique(0).getPass(0).createTextureUnitState("RttTex");
                // Blend with base texture
                t.setColourOperationEx(LayerBlendOperationEx.LBX_BLEND_MANUAL, LayerBlendSource.LBS_TEXTURE,
                                       LayerBlendSource.LBS_CURRENT, Color.White,
                                       Color.White, 0.25f);
                t.SetTextureAddressingMode(TextureUnitState.TextureAddressingMode.TAM_CLAMP);
                t.setProjectiveTexturing(true, mReflectCam);
                rttTex.AddListener(mRTListener);

                // 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 = mSceneManager.CreateSceneNode();
                // Random translate
                Vector3 nodePos;
                nodePos.x = OgreMath.SymmetricRandom() * 750.0f;
                nodePos.y = OgreMath.SymmetricRandom() * 100.0f + 25.0f;
                nodePos.z = OgreMath.SymmetricRandom() * 750.0f;
                node.SetPosition(nodePos);
                rootNode.AddChild(node);
                // Clone knot
                string cloneName = string.Format("Knot{0}", n);
                cloneEnt = knotEnt.Clone(cloneName);
                // Attach to new node
                node.AttachObject(cloneEnt);
            }


            mCamera.SetPosition(new Vector3(-50.0f, 100.0f, 500.0f));
            mCamera.LookAt = new Vector3(0, 0, 0);
        }
Exemple #9
0
        protected override void CreateScene()
        {
            RenderSystemCapabilities caps = mRoot.RenderSystem.GetCapabilities();

            if ((!caps.hasCapability(Capabilities.VertexProgram)) ||
                (!caps.hasCapability(Capabilities.FragmentProgram)))
            {
                throw new Exception("Your card does not support vertex and fragment programs (or you selected D3D7), so cannot run this demo. Sorry!\n cCelShading.CreateScene");
            }

            mLog = LogManager.Singleton.createLog("DemoCelShading.log", false, true);
            mLog.LogMessage(string.Format("DemoCelShading log {0}", System.DateTime.Now));

            create4LineDebugOverLay();
            Show4LineDebugOverLay();

            // Create a point light
            Light l = mSceneManager.CreateLight("MainLight");

            // Accept default settings: point light, white diffuse, just set position
            // Add light to the scene node
            rotNode = mSceneManager.GetRootSceneNode().CreateChildSceneNode();
            rotNode.CreateChildSceneNode(new Vector3(20.0f, 40.0f, 50.0f)).AttachObject(l);

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

            mCamera.SetPosition(20.0f, 0.0f, 100.0f);
            mCamera.LookAt = new Vector3(0.0f, 0.0f, 0.0f);


            // Set common material, but define custom parameters to change colours
            // See Example-Advanced.material for how these are finally bound to GPU parameters
            SubEntity sub;

            // eyes
            sub = ent.GetSubEntity(0);
            sub.setMaterialName("Examples/CelShading");
            sub.GetAsRenderable().setCustomParameter(CUSTOM_SHININESS, new Vector4(35.0f, 0.0f, 0.0f, 0.0f));
            sub.GetAsRenderable().setCustomParameter(CUSTOM_DIFFUSE, new Vector4(1.0f, 0.3f, 0.3f, 1.0f));
            sub.GetAsRenderable().setCustomParameter(CUSTOM_SPECULAR, new Vector4(1.0f, 0.6f, 0.6f, 1.0f));
            // skin
            sub = ent.GetSubEntity(1);
            sub.setMaterialName("Examples/CelShading");
            sub.GetAsRenderable().setCustomParameter(CUSTOM_SHININESS, new Vector4(10.0f, 0.0f, 0.0f, 0.0f));
            sub.GetAsRenderable().setCustomParameter(CUSTOM_DIFFUSE, new Vector4(0.0f, 0.5f, 0.0f, 1.0f));
            sub.GetAsRenderable().setCustomParameter(CUSTOM_SPECULAR, new Vector4(0.3f, 0.5f, 0.3f, 1.0f));
            // earring
            sub = ent.GetSubEntity(2);
            sub.setMaterialName("Examples/CelShading");
            sub.GetAsRenderable().setCustomParameter(CUSTOM_SHININESS, new Vector4(25.0f, 0.0f, 0.0f, 0.0f));
            sub.GetAsRenderable().setCustomParameter(CUSTOM_DIFFUSE, new Vector4(1.0f, 1.0f, 0.0f, 1.0f));
            sub.GetAsRenderable().setCustomParameter(CUSTOM_SPECULAR, new Vector4(1.0f, 1.0f, 0.7f, 1.0f));
            // teeth
            sub = ent.GetSubEntity(3);
            sub.setMaterialName("Examples/CelShading");
            sub.GetAsRenderable().setCustomParameter(CUSTOM_SHININESS, new Vector4(20.0f, 0.0f, 0.0f, 0.0f));
            sub.GetAsRenderable().setCustomParameter(CUSTOM_DIFFUSE, new Vector4(1.0f, 1.0f, 0.7f, 1.0f));
            sub.GetAsRenderable().setCustomParameter(CUSTOM_SPECULAR, new Vector4(1.0f, 1.0f, 1.0f, 1.0f));

            // Add entity to the root scene node
            mSceneManager.GetRootSceneNode().CreateChildSceneNode().AttachObject(ent);

            mRenderWindow.GetViewport(0).SetBackgroundColour(Color.White);
        }
Exemple #10
0
        protected override void CreateScene()
        {
            mSceneManager.SetSkyBox(true, "Examples/CloudyNoonSkyBox");

            mLog = LogManager.Singleton.createLog("DemoCustomObjects.log", false, true);
            mLog.LogMessage(string.Format("DemoCustomObjects log {0}", System.DateTime.Now));

            create4LineDebugOverLay();
            Show4LineDebugOverLay();

            Entity    e;
            SceneNode n;


            Plane plane = new Plane();

            plane.Normal.x = 0;
            plane.Normal.y = 1;
            plane.Normal.z = 0;
            plane.D        = 0;
            MeshManager.GetSingleton().CreatePlane("Myplane", "General", plane,
                                                   14500, 14500, 10, 10, true, 1, 50, 50, Vector3.UnitZ);
            e = mSceneManager.CreateEntity("plane", "Myplane");
            e.SetMaterialName("Examples/GrassFloor");
            e.SetCastShadows(false);
            n = mSceneManager.GetRootSceneNode().CreateChildSceneNode("Myplane");
            n.AttachObject(e);


            //##MyLine3D test
            mLog.LogMessage("test line 0");
            myLine = new myLine3D();
            mLog.LogMessage("test line 1");
            myLine.addPoint(new Vector3(0.0f, 9.6f, 0.0f));
            myLine.addPoint(new Vector3(160.0f, 9.6f, 0.0f));
            myLine.addPoint(new Vector3(160.0f, 9.6f, 160.0f));
            myLine.addPoint(new Vector3(0.0f, 9.6f, 160.0f));
            myLine.addPoint(new Vector3(0.0f, 9.6f, 0.0f));
            mLog.LogMessage("test line 2");
            myLine.drawLines();

            mLog.LogMessage("test line 3");
            n = mSceneManager.GetRootSceneNode().CreateChildSceneNode("Line1");
            mLog.LogMessage("test line 4");
            n.AttachObject(myLine);
            mLog.LogMessage("test line 5");
            n.SetPosition(0.0f, 200.0f, 0.0f);
            //##

            /***/
            //## bill board chain
            mLog.LogMessage("test BBC 1");
            mBBC = new DemoCustomObjects.myBillBoardChain(mCamera, 1000);
            mBBC.setMaterial("DemoCustomObjects/smoketrail");
            for (int i = 0; i < 500; i++)
            {
                myBillBoardChainElement ce = new myBillBoardChainElement(
                    new Vector3((float)Math.Sin((double)i / 100.0 * 2.0 * Math.PI),
                                (float)Math.Cos((double)i / 100.0 * 2.0 * Math.PI),
                                (float)i / 100.0f),
                    0.1f,
                    (float)i / 10.0f,
                    Converter.GetColor(1.0f, 1.0f, 1.0f));
                mBBC.addChainElement(ce);
            }
            mBBC.updateBoundingBox();
            // Add it to the scene
            n = mSceneManager.GetRootSceneNode().CreateChildSceneNode("BBC");
            n.AttachObject(mBBC);
            n.SetPosition(0.0f, 100.0f, 0.0f);
            n.SetScale(50.0f, 50.0f, 50.0f);
            mLog.LogMessage("test BBC 2");
            //##
            /***/


            mCamera.Move(new Vector3(0, 300, 600));
            mCamera.LookAt = new Vector3(0, 0, -600);

            SetDebugCaption(2, "keys: Y updates and adds a new point");
            SetDebugCaption(3, "     U updates and deletes the new point");
        }
Exemple #11
0
        protected override void CreateScene()
        {
            mLog = LogManager.Singleton.createLog("DemoGrass.log", false, true);
            mLog.LogMessage(string.Format("DemoGrass log {0}", System.DateTime.Now));

            //Init waveGrass varibles
            xinc     = OgreMath.PI * 0.4f;
            zinc     = OgreMath.PI * 0.55f;
            xpos     = OgreMath.RangeRandom(-OgreDotNet.OgreMath.PI, OgreDotNet.OgreMath.PI);
            zpos     = OgreMath.RangeRandom(-OgreDotNet.OgreMath.PI, OgreDotNet.OgreMath.PI);
            xxoffset = new Math3D.Vector4(0.0f, 0.0f, 0.0f, 0.0f);


            mSceneManager.SetSkyBox(true, "Examples/SpaceSkyBox");

            setupLighting();
            mSceneManager.AmbientLightColor = Color.FromArgb(125, 125, 125, 125);


            //create a ground plain
            mLog.LogMessage("Point 1");
            Plane plane = new Plane();

            plane.Normal.x = 0;
            plane.Normal.y = 1;
            plane.Normal.z = 0;
            plane.D        = 0;
            MeshManager.GetSingleton().CreatePlane("Myplane", "General", plane,
                                                   14500, 14500, 10, 10, true, 1, 50, 50, Vector3.UnitZ);
            Entity pPlaneEnt = mSceneManager.CreateEntity("plane", "Myplane");

            pPlaneEnt.SetMaterialName("Examples/GrassFloor");
            pPlaneEnt.SetCastShadows(false);
            mSceneManager.GetRootSceneNode().CreateChildSceneNode().AttachObject(pPlaneEnt);


            //create the grass mesh
            mLog.LogMessage("Point 2");
            createGrassMesh2();
            Entity e = null;

            e = mSceneManager.CreateEntity("1", GRASS_MESH_NAME);


            //close the the grass mesh in a region
            StaticGeometry s = mSceneManager.CreateStaticGeometry("bing");

            s.setRegionDimensions(new Vector3(1000, 1000, 1000));
            // Set the region origin so the centre is at 0 world
            s.setOrigin(new Vector3(-500, 500, -500));
            mLog.LogMessage("Point 3");
            for (int x = -1950; x < 1950; x += 150)                     //1950
            {
                for (int z = -1950; z < 1950; z += 150)
                {
                    Vector3 pos;
                    pos.x = x + OgreMath.RangeRandom(-25, 25);
                    pos.y = 0;
                    pos.z = z + OgreMath.RangeRandom(-25, 25);
                    Quaternion orientation = Quaternion.FromAngleAxis(
                        new Degree(OgreMath.RangeRandom(0, 359)).ValueDegrees(), Vector3.UnitY);
                    Vector3 scale = new Vector3(1, OgreMath.RangeRandom(0.85f, 1.15f), 1);
                    s.addEntity(e, pos, orientation, scale);
                }
            }
            mLog.LogMessage("Point 4");
            s.build();
            mStaticGeom = s;
            //mStaticGeom.dump("Grass.SG.Dump.txt");



            //Put an Ogre head in the middle
            mLog.LogMessage("Point 5");
            OgreDotNet.MeshPtr m = MeshManager.GetSingleton().Load("ogrehead.mesh", "General");
            Mesh   mm = m.Get();
            UInt16 src = 0, dest = 0;

            if (!mm.SuggestTangentVectorBuildParams(ref src, ref dest))
            {
                mLog.LogMessage("got from SuggestTangentVectorBuildParams src=" + src + " dest=" + dest);
                mm.BuildTangentVectors(src, dest);
            }
            e = mSceneManager.CreateEntity("head", "ogrehead.mesh");
            e.SetMaterialName("Examples/OffsetMapping/Specular");
            SceneNode headNode = mSceneManager.GetRootSceneNode().CreateChildSceneNode();

            headNode.AttachObject(e);
            headNode.SetScale(7, 7, 7);
            headNode.SetPosition(0, 200, 0);
            e.SetNormaliseNormals(true);


            mLog.LogMessage("Point 6");
            //setup camera position
            mCamera.Move(new Vector3(0, 350, 800));
            mCamera.LookAt = new Vector3(0, 200, 0);
            mLog.LogMessage("Point end");
        }
Exemple #12
0
/*** test ***/

        protected override void CreateScene()
        {
            mSceneManager.SetSkyBox(true, "Examples/CloudyNoonSkyBox");

            mLog = LogManager.Singleton.createLog("RSQTest.log", false, true);
            mLog.LogMessage(string.Format("RSQTest log {0}", System.DateTime.Now));

            create4LineDebugOverLay();
            Show4LineDebugOverLay();

            Entity    e;
            SceneNode n;
            Plane     plane = new Plane();

            plane.Normal.x = 0.0f;
            plane.Normal.y = 1.0f;
            plane.Normal.z = 0.0f;
            plane.D        = 0.0f;
            MeshManager.GetSingleton().CreatePlane("Myplane01", "General", plane,
                                                   250.0f, 500.0f, 10, 10, true, 1, 5.0f, 5.0f, Vector3.UnitZ);
            e = mSceneManager.CreateEntity("plane01", "Myplane01");
            e.SetMaterialName("Examples/GrassFloor");
            e.SetCastShadows(false);
            n = mSceneManager.GetRootSceneNode().CreateChildSceneNode();
            n.SetPosition(-125.0f, 10.0f, 0.0f);
            n.Pitch(new Radian(new Degree(5.0f)));
            n.AttachObject(e);

            plane.Normal.x = 0.0f;
            plane.Normal.y = 1.0f;
            plane.Normal.z = 0.0f;
            plane.D        = 0.0f;
            MeshManager.GetSingleton().CreatePlane("Myplane02", "General", plane,
                                                   250.0f, 500.0f, 10, 10, true, 1, 5.0f, 5.0f, Vector3.UnitZ);
            e = mSceneManager.CreateEntity("plane02", "Myplane02");
            e.SetMaterialName("Examples/GrassFloor");
            e.SetCastShadows(false);
            n = mSceneManager.GetRootSceneNode().CreateChildSceneNode();
            n.SetPosition(125.0f, 10.0f, 0.0f);
            n.AttachObject(e);

            for (int x = 0; x < 4; x++)
            {
                string sname = string.Format("head{0}", x);
                e = mSceneManager.CreateEntity(sname, "ogrehead.mesh");
                n = mSceneManager.GetRootSceneNode().CreateChildSceneNode(sname);
                n.AttachObject(e);
                float px = (x % 2 == 0? -100.0f: 100.0f);
                float pz = ((x <= 1)? -100.0f: 100.0f);
                float py = (x % 2 == 0? 50.0f : 30.0f);
                n.SetPosition(px, py, pz);
            }

            mRay           = new OgreDotNet.Ray(Vector3.Zero, Vector3.NegativeUnitY);
            mRaySceneQuery = mSceneManager.CreateRayQuery(mRay);

            mCamera.Move(new Vector3(0, 300, 600));
            mCamera.LookAt = new Vector3(0, 0, 0);

/*** test ***/
            myLine = new Line3D();
            myLine.addPoint(new Vector3(0.0f, 9.6f, 0.0f));
            myLine.addPoint(new Vector3(160.0f, 9.6f, 0.0f));
            myLine.addPoint(new Vector3(160.0f, 9.6f, 160.0f));
            myLine.addPoint(new Vector3(0.0f, 9.6f, 160.0f));
            myLine.addPoint(new Vector3(0.0f, 9.6f, 0.0f));
            myLine.drawLines();

            SceneNode myNode = mSceneManager.GetRootSceneNode().CreateChildSceneNode("Line1");

            myNode.AttachObject(myLine);
            myNode.SetPosition(0.0f, 200.0f, 0.0f);
/*** test ***/
        }
Exemple #13
0
        protected override void CreateScene()
        {
            mLog = LogManager.Singleton.createLog("DemoCompositor.log", false, true);
            mLog.LogMessage(string.Format("DemoCompositor log {0}", System.DateTime.Now));
            this.DebugOverlayVisible = false;

            mSceneManager.SetShadowTechnique(ShadowTechnique.ShadowTypeTextureModulative);
            mSceneManager.SetShadowFarDistance(1000.0f);

            // setup GUI system
            mGuiRenderer = new OgreCEGUIRenderer(mRenderWindow,
                                                 (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY,
                                                 false, 3000, mSceneManager);
            mGuiRenderer.Initialise();                  //tell the CeguiNet proxy class the IntPtr to the CPP object

            // load scheme and set up defaults
            mGuiSystem = new GuiSystem(mGuiRenderer, (CeguiDotNet.ScriptModule)null,
                                       (CeguiDotNet.ResourceProvider)null, "CompositorDemoCegui.config");

            mGuiSystem.SetDefaultMouseCursor("TaharezLook", "MouseArrow");

            OgreDotNet.MovableObject.setDefaultVisibilityFlags(0x00000001);



            // Set ambient light
            mSceneManager.SetAmbientLight(Converter.GetColor(0.3f, 0.3f, 0.2f));

            Light   l   = mSceneManager.CreateLight("Light2");
            Vector3 dir = new Vector3(-1.0f, -1.0f, 0.0f);

            dir.Normalize();
            l.Type      = Light.LightTypes.Directional;
            l.Direction = dir;
            l.SetDiffuseColour(1.0f, 1.0f, 0.8f);
            l.SetSpecularColour(1.0f, 1.0f, 1.0f);


            Entity pEnt;

            // House
            pEnt = mSceneManager.CreateEntity("1", "tudorhouse.mesh");
            SceneNode n1 = mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(350.0f, 450.0f, -200.0f));

            n1.AttachObject(pEnt);

            pEnt = mSceneManager.CreateEntity("2", "tudorhouse.mesh");
            SceneNode n2 = mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(-350.0f, 450.0f, -200.0f));

            n2.AttachObject(pEnt);

            pEnt    = mSceneManager.CreateEntity("3", "knot.mesh");
            mSpinny = mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(0.0f, 0.0f, 300.0f));
            mSpinny.AttachObject(pEnt);
            pEnt.SetMaterialName("Examples/MorningCubeMap");

            mSceneManager.SetSkyBox(true, "Examples/MorningSkyBox");


            Plane plane = new Plane();

            plane.Normal = OgreVector3.FromVector3(Math3D.Vector3.UnitY);
            plane.D      = 100.0f;
            MeshPtr m = MeshManager.Instance.CreatePlane("Myplane",
                                                         ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane,
                                                         1500.0f, 1500.0f, 10, 10, true, 1, 5.0f, 5.0f, Vector3.UnitZ);
            Entity pPlaneEnt = mSceneManager.CreateEntity("plane", "Myplane");

            pPlaneEnt.SetMaterialName("Examples/Rockwall");
            pPlaneEnt.SetCastShadows(false);
            mSceneManager.GetRootSceneNode().CreateChildSceneNode().AttachObject(pPlaneEnt);
            m.SetNull();
            m = null;

            mCamera.SetPosition(-400.0f, 50.0f, 900.0f);
            mCamera.LookAt = new Vector3(0.0f, 80.0f, 0.0f);

            connectMainEventHandlers();

            /// Create a couple of hard coded postfilter effects as an example of how to do it
            /// but the preferred method is to use compositor scripts.
            createEffects();
        }