public void CreateScene() { TextureUtil.CreateDynamicTextureAndMaterial( "OBDynamicTexture", "OBDynamicMaterial", _browserWidth, _browserHeight, out _texture, out _material); _panel = (OverlayElementContainer)OverlayManager.Instance.Elements.CreateElement("Panel", "Panels"); _panel.SetPosition(1, 1); _panel.SetDimensions(_browserWidth, _browserHeight); _panel.MaterialName = "OBDynamicMaterial"; _overlay = OverlayManager.Instance.Create("OverlayBrowser"); _overlay.AddElement(_panel); _overlay.Show(); Core.BrowserManager.BrowserRenderEvent += BrowserManager_BrowserRenderEvent; _browserId = Core.BrowserManager.CreateBrowser("http://www.google.com.au", _browserWidth, _browserHeight); }
public virtual void Start( RenderWindow window, ushort numGroupsInit, ushort numGroupsLoad, Real initProportion ) { mWindow = window; mNumGroupsInit = numGroupsInit; mNumGroupsLoad = numGroupsLoad; mInitProportion = initProportion; // We need to pre-initialise the 'Bootstrap' group so we can use // the basic contents in the loading screen ResourceGroupManager.Instance.InitializeResourceGroup( "Bootstrap" ); OverlayManager omgr = OverlayManager.Instance; mLoadOverlay = omgr.GetByName( "Core/LoadOverlay" ); if ( mLoadOverlay == null ) { throw new KeyNotFoundException( "Cannot find loading overlay" ); } mLoadOverlay.Show(); // Save links to the bar and to the loading text, for updates as we go mLoadingBarElement = omgr.Elements.GetElement( "Core/LoadPanel/Bar/Progress" ); mLoadingCommentElement = omgr.Elements.GetElement( "Core/LoadPanel/Comment" ); mLoadingDescriptionElement = omgr.Elements.GetElement( "Core/LoadPanel/Description" ); OverlayElement barContainer = omgr.Elements.GetElement( "Core/LoadPanel/Bar" ); mProgressBarMaxSize = barContainer.Width; mLoadingBarElement.Width = 0; // self is listener ResourceGroupManager.Instance.AddResourceGroupListener( this ); }
public override void CreateScene() { // Create dynamic texture ptex = TextureManager.Instance.CreateManual( "DynaTex", ResourceGroupManager.DefaultResourceGroupName, TextureType.TwoD, reactorExtent - 2, reactorExtent - 2, 0, PixelFormat.A8R8G8B8, TextureUsage.DynamicWriteOnly ); buffer = ptex.GetBuffer( 0, 0 ); // Set ambient light scene.AmbientLight = new ColorEx( 0.6F, 0.6F, 0.6F ); scene.SetSkyBox( true, "SkyBox/Space", 50 ); //mRoot->getRenderSystem()->clearFrameBuffer(FBT_COLOUR, ColourValue(255,255,255,0)); // Create a light Light l = scene.CreateLight( "MainLight" ); l.Diffuse = new ColorEx( 0.75F, 0.75F, 0.80F ); l.Specular = new ColorEx( 0.9F, 0.9F, 1F ); l.Position = new Vector3( -100, 80, 50 ); scene.RootSceneNode.AttachObject( l ); Entity planeEnt = scene.CreateEntity( "TexPlane1", PrefabEntity.Plane ); // Give the plane a texture planeEnt.MaterialName = "Examples/DynaTest"; SceneNode node = scene.RootSceneNode.CreateChildSceneNode( new Vector3( -100, -40, -100 ) ); node.AttachObject( planeEnt ); node.Scale = new Vector3( 3.0f, 3.0f, 3.0f ); // Create objects SceneNode blaNode = scene.RootSceneNode.CreateChildSceneNode( new Vector3( -200, 0, 50 ) ); Entity ent2 = scene.CreateEntity( "knot", "knot.mesh" ); ent2.MaterialName = "Examples/DynaTest4"; blaNode.AttachObject( ent2 ); blaNode = scene.RootSceneNode.CreateChildSceneNode( new Vector3( 200, -90, 50 ) ); ent2 = scene.CreateEntity( "knot2", "knot.mesh" ); ent2.MaterialName = "Examples/DynaTest2"; blaNode.AttachObject( ent2 ); blaNode = scene.RootSceneNode.CreateChildSceneNode( new Vector3( -110, 200, 50 ) ); // Cloaked fish ent2 = scene.CreateEntity( "knot3", "fish.mesh" ); ent2.MaterialName = "Examples/DynaTest3"; swim = ent2.GetAnimationState( "swim" ); swim.IsEnabled = true; blaNode.AttachObject( ent2 ); blaNode.Scale = new Vector3( 50.0f, 50.0f, 50.0f ); LogManager.Instance.Write( "HardwarePixelBuffer {0} {1} {2} ", buffer.Width, buffer.Height, buffer.Depth ); buffer.Lock( BufferLocking.Normal ); PixelBox pb = buffer.CurrentLock; LogManager.Instance.Write( "PixelBox {0} {1} {2} {3} {4} {5} {6}", pb.Width, pb.Height, pb.Depth, pb.RowPitch, pb.SlicePitch, pb.Data, pb.Format ); buffer.Unlock(); // show GUI overlay = OverlayManager.Instance.GetByName( "Example/DynTexOverlay" ); overlay.Show(); }
// Just override the mandatory create scene method public override void CreateScene() { RAND = new Random( 0 ); // najak: use a time-based seed GuiMgr = OverlayManager.Instance.Elements; scene.AmbientLight = new ColorEx( 0.75f, 0.75f, 0.75f ); // default Ambient Light // Customize Controls - speed up camera and slow down the input update rate this.camSpeed = 5.0f; inputInterval = inputTimer = 0.02f; // Create water mesh and entity, and attach to sceneNode waterMesh = new WaterMesh( "WaterMesh", PLANE_SIZE, CMPLX ); waterEntity = scene.CreateEntity( "WaterEntity", "WaterMesh" ); SceneNode waterNode = scene.RootSceneNode.CreateChildSceneNode(); waterNode.AttachObject( waterEntity ); // Add Ogre head, give it it's own node headNode = waterNode.CreateChildSceneNode(); Entity ent = scene.CreateEntity( "head", "ogrehead.mesh" ); headNode.AttachObject( ent ); // Create the camera node, set its position & attach camera camera.Yaw( -45f ); camera.Move( new Vector3( 1500f, 700f, PLANE_SIZE + 700f ) ); camera.LookAt( new Vector3( PLANE_SIZE / 2f, 300f, PLANE_SIZE / 2f ) ); camera.SetAutoTracking( false, headNode ); // Autotrack the head, but it isn't working right //scene.SetFog(FogMode.Exp, ColorEx.White, 0.000020f); // add Fog for fun, cuz we can // show overlay waterOverlay = OverlayManager.Instance.GetByName( "Example/WaterOverlay" ); waterOverlay.Show(); // Create Rain Emitter, but default Rain to OFF particleSystem = ParticleSystemManager.Instance.CreateSystem( "rain", "Examples/Water/Rain" ); particleEmitter = particleSystem.GetEmitter( 0 ); particleEmitter.EmissionRate = 0f; // Attach Rain Emitter to SceneNode, and place it 3000f above the water surface SceneNode rNode = scene.RootSceneNode.CreateChildSceneNode(); rNode.Translate( new Vector3( PLANE_SIZE / 2.0f, 3000, PLANE_SIZE / 2.0f ) ); rNode.AttachObject( particleSystem ); particleSystem.FastForward( 20 ); // Fastforward rain to make it look natural // It can't be set in .particle file, and we need it ;) //particleSystem.Origin = BillboardOrigin.BottomCenter; // Set Lighting lightNode = scene.RootSceneNode.CreateChildSceneNode(); lightSet = scene.CreateBillboardSet( "Lights", 20 ); lightSet.MaterialName = "Particles/Flare"; lightNode.AttachObject( lightSet ); SetLighting( "Ambient" ); // Add Lights - added by Najak to show lighted Water conditions - cool! #region STUBBED LIGHT ANIMATION // Create a new animation state to track this // TODO: Light Animation not working. //this.animState = scene.CreateAnimationState("WaterLight"); //this.animState.Time = 0f; //this.animState.IsEnabled = false; // set up spline animation of light node. Create random Spline Animation anim = scene.CreateAnimation( "WaterLight", 20 ); AnimationTrack track = anim.CreateNodeTrack( 0, this.lightNode ); TransformKeyFrame key = (TransformKeyFrame)track.CreateKeyFrame( 0 ); for ( int ff = 1; ff <= 19; ff++ ) { key = (TransformKeyFrame)track.CreateKeyFrame( ff ); Random rand = new Random( 0 ); Vector3 lpos = new Vector3( (float)rand.NextDouble() % (int)PLANE_SIZE, //- PLANE_SIZE/2, (float)rand.NextDouble() % 300 + 100, (float)rand.NextDouble() % (int)PLANE_SIZE ); //- PLANE_SIZE/2 key.Translate = lpos; } key = (TransformKeyFrame)track.CreateKeyFrame( 20 ); #endregion STUBBED LIGHT ANIMATION // Initialize the Materials/Demo UpdateMaterial(); UpdateInfoParamC(); UpdateInfoParamD(); UpdateInfoParamU(); UpdateInfoParamT(); UpdateInfoNormals(); UpdateInfoHeadDepth(); UpdateInfoSkyBox(); UpdateInfoHeadSpeed(); UpdateInfoLights(); UpdateInfoTracking(); // Init Head Animation: Load adds[] elements - Ogre head animation adds[ 0 ] = 0.3f; adds[ 1 ] = -1.6f; adds[ 2 ] = 1.1f; adds[ 3 ] = 0.5f; sines[ 0 ] = 0; sines[ 1 ] = 100; sines[ 2 ] = 200; sines[ 3 ] = 300; } // end CreateScene()