Axiom.Samples.MousePicking.SelectionRectangle.SelectionRectangle C# (CSharp) Метод

SelectionRectangle() публичный Метод

There are two ways to create your own mesh within Axiom. The first way is to subclass the SimpleRenderable object and provide it with the vertex and index buffers directly. This is the most direct way to create one, but it's also the most cryptic. The Generating A Mesh code snippet shows an example of this. To make things easier, Axiom provides a much nicer interface called ManualObject, which allows you to use some simple functions to define a mesh instead of writing raw data to the buffer objects. Instead of dropping the position, color, and so on into a buffer, you simply call the "position" and "colour" functions. In this tutorial we need to create a white rectangle to display when we are dragging the mouse to select objects. There really isn't a class in Axiom we could use to display a 2D rectangle. We will have to come up with a way of doing it on our own. We could use an Overlay and resize it to display the selection rectangle, but the problem with doing it this way is that the image you use for the selection rectangle could get stretched out of shape and look awkward. Instead, we will generate a very simple 2D mesh to act as our selection rectangle.
public SelectionRectangle ( string name ) : System
name string
Результат System
		public SelectionRectangle( string name )
			: base( name )
		{
			/*
			 * When we create the selection rectangle, we have to create it such that it will render in 2D.
			 * We also have to be sure that it will render when Ogre's Overlays render so that it sits on top of all other 
			 * objects on screen. 
			 * 
			 * Doing this is actually very easy.
			 */
			RenderQueueGroup = RenderQueueGroupID.Overlay;
			UseIdentityProjection = true;
			UseIdentityView = true;
			QueryFlags = 0;
			/*
			 * The first function sets the render queue for the object to be the Overlay queue. 
			 * The next two functions sets the projection and view matrices to be the identity.
			 * Projection and view matrices are used by many rendering systems (such as OpenGL and DirectX) to define where 
			 * objects go in the world. 
			 * Since Axiom abstracts this away for us, we won't go into any detail about what these matrices actually 
			 * are or what they do. Instead what you need to know is that if you set the projection and view matrix 
			 * to be the identity, as we have here, we will basically create a 2D object. 
			 * When defining this object, the coordinate system changes a bit. 
			 * We no longer deal with the Z axis (if you are asked for the Z axis, set the value to -1). 
			 * Instead we have a new coordinate system with X and Y running from -1 to 1 inclusive. Lastly,
			 * we will set the query flags for the object to be 0, which will prevent prevent the selection rectangle 
			 * from being included in the query results.
			 */
		}