A collection of billboards (faces which are always facing the camera) with the same (default) dimensions, material and which are fairly close proximity to each other.
Billboards are rectangles made up of 2 tris which are always facing the camera. They are typically used for special effects like particles. This class collects together a set of billboards with the same (default) dimensions, material and relative locality in order to process them more efficiently. The entire set of billboards will be culled as a whole (by default, although this can be changed if you want a large set of billboards which are spread out and you want them culled individually), individual Billboards have locations which are relative to the set (which itself derives it's position from the SceneNode it is attached to since it is a SceneObject), they will be rendered as a single rendering operation, and some calculations will be sped up by the fact that they use the same dimensions so some workings can be reused.

A BillboardSet can be created using the SceneManager.CreateBillboardSet method. They can also be used internally by other classes to create effects.

Inheritance: Axiom.Core.MovableObject, IRenderable
コード例 #1
0
        public BillboardParticleRenderer()
        {
            billboardSet = new BillboardSet("", 0, true);
            billboardSet.SetBillboardsInWorldSpace(true);

            // TODO: Is this the right way to do this?
            RegisterParsers();
        }
コード例 #2
0
ファイル: SceneManager.cs プロジェクト: mono-soc-2011/axiom
		/// <summary>
		///		Removes the specified BillboardSet from the scene.
		/// </summary>
		/// <remarks>
		///		This method removes a previously added BillboardSet from the scene.
		/// </remarks>
        /// <param name="billboardSet">Reference to the BillboardSet to remove.</param>
		public virtual void RemoveBillboardSet( BillboardSet billboardSet )
		{
			this.DestroyMovableObject( billboardSet );
		}
コード例 #3
0
ファイル: Billboard.cs プロジェクト: WolfgangSt/axiom
		/// <summary>
		///		Internal method for notifying a billboard of it's owner.
		/// </summary>
		/// <param name="owner"></param>
		internal void NotifyOwner( BillboardSet owner )
		{
			ParentSet = owner;
		}
コード例 #4
0
ファイル: Billboard.cs プロジェクト: WolfgangSt/axiom
		/// <summary>
		///
		/// </summary>
		/// <param name="position"></param>
		/// <param name="owner"></param>
		/// <param name="color"></param>
		public Billboard( Vector3 position, BillboardSet owner, ColorEx color )
		{
			this.Color = color;
			this.Position = position;
			this.ParentSet = owner;
		}
コード例 #5
0
ファイル: Billboard.cs プロジェクト: WolfgangSt/axiom
		/// <summary>
		///
		/// </summary>
		/// <param name="position"></param>
		/// <param name="owner"></param>
		public Billboard( Vector3 position, BillboardSet owner )
		{
			this.Position = position;
			this.ParentSet = owner;
			this.Color = ColorEx.White;
		}
コード例 #6
0
ファイル: Water.cs プロジェクト: WolfgangSt/axiom
		// 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()
コード例 #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="disposeManagedResources"></param>
        protected override void dispose(bool disposeManagedResources)
        {
            if (!this.IsDisposed)
            {
                if (disposeManagedResources)
                {
                    if (this.billboardSet != null)
                    {
                        if (!this.billboardSet.IsDisposed)
                            this.billboardSet.Dispose();

                        this.billboardSet = null;
                    }

                    this.attribParsers.Clear();

                }
            }

            base.dispose(disposeManagedResources);
        }
コード例 #8
0
 /// <summary>
 ///		Removes the specified BillboardSet from the scene.
 /// </summary>
 /// <remarks>
 ///		This method removes a previously added BillboardSet from the scene.
 /// </remarks>
 /// <param name="billboardSet">Reference to the BillboardSet to remove.</param>
 public virtual void RemoveBillboardSet(BillboardSet billboardSet)
 {
     ExtractMovableObject(billboardSet);
 }
コード例 #9
0
        /// <summary>
        ///		Creates a billboard set which can be uses for particles, sprites, etc.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="poolSize"></param>
        /// <returns></returns>
        public virtual BillboardSet CreateBillboardSet(string name, int poolSize)
        {
            if (GetMovableObjectMap("BillboardSet").ContainsKey(name)) {
                throw new AxiomException(string.Format("An object with the name '{0}' already exists in the scene.", name));
            }

            BillboardSet billboardSet = new BillboardSet(name, poolSize);

            // add it to our local list
            GetMovableObjectMap("BillboardSet")[name] = billboardSet;

            return billboardSet;
        }
コード例 #10
0
		public BillboardParticleRenderer()
			: base()
		{
			this.billboardSet = new BillboardSet( string.Empty, 0, true );
			this.billboardSet.SetBillboardsInWorldSpace( true );
		}
コード例 #11
0
ファイル: ShaderSample.cs プロジェクト: ryan-bunker/axiom3d
		public ShaderSample()
		{
			this.layeredBlendingEntity = null;
			Metadata[ "Title" ] = "Shader System";
			Metadata[ "Description" ] = "Demonstrate the capabilities of the RT Shader System component." +
			                            "1. Fixed Function Pipeline emulation." +
			                            "2. On the fly shader generation based on existing material." +
			                            "3. On the fly shader synchronization with scene state (Lights, Fog)." +
			                            "4. Built in lighting models: Per vertex, Per pixel, Normal map tangent and object space." +
			                            "5. Pluggable custom shaders extensions." +
			                            "6. Built in material script parsing that includes extended attributes." +
			                            "7. Built in material script serialization.";
			Metadata[ "Thumbnail" ] = "thumb_shadersystem.png";
			Metadata[ "Category" ] = "Lighting";
			Metadata[ "Help" ] = "F2 Toggle Shader System globally. " +
			                     "F3 Toggles Global Lighting Model. " +
			                     "Modify target model attributes and scene settings and observe the generated shaders count. " +
			                     "Press the export button in order to export current target model material. " +
			                     "The model above the target will import this material next time the sample reloads. " +
			                     "Right click on object to see the shaders it currently uses. ";
			this.pointLightNode = null;
			this.reflectionMapFactory = null;
			this.instancedViewportsEnable = false;
			this.instancedViewportsSubRenderState = null;
			this.instancedViewportsFactory = null;
			this.bbsFlare = null;
			this.addedLotsOfModels = false;
			this.numberOfModelsAdded = 0;
		}
コード例 #12
0
ファイル: ShaderSample.cs プロジェクト: ryan-bunker/axiom3d
		private void CreateDirectionalLight()
		{
			Light light;
			Vector3 dir;

			light = SceneManager.CreateLight( DirectionalLightName );
			light.Type = LightType.Directional;
			light.CastShadows = true;
			dir = new Vector3( 0.5f, -1.0f, 0.3f );
			dir.Normalize();
			light.Direction = dir;
			light.Diffuse = new ColorEx( 0.65f, 0.15f, 0.15f );
			light.Specular = new ColorEx( 0.5f, 0.5f, 0.5f );

			//Create pivot node
			this.directionalLightNode = SceneManager.RootSceneNode.CreateChildSceneNode();

			//Create billboard set
			this.bbsFlare = SceneManager.CreateBillboardSet();
			this.bbsFlare.MaterialName = "Examples/Flare3";
			this.bbsFlare.CreateBillboard( -dir*500 ).Color = light.Diffuse;
			this.bbsFlare.CastShadows = false;

			this.directionalLightNode.AttachObject( this.bbsFlare );
			this.directionalLightNode.AttachObject( light );
		}