C# Class Axiom.Samples.MousePicking.SelectionRectangle

Inheritance: ManualObject
Datei anzeigen Open project: WolfgangSt/axiom Class Usage Examples

Public Methods

Method Description
SelectionRectangle ( string name ) : System

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.

SetCorners ( Axiom.Math topLeft, Axiom.Math bottomRight ) : void

SetCorners ( float left, float top, float right, float bottom ) : void

Sets the corners of the SelectionRectangle. Every parameter should be in the range [0, 1] representing a percentage of the screen the SelectionRectangle should take up.

Method Details

SelectionRectangle() public method

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
return System

SetCorners() public method

public SetCorners ( Axiom.Math topLeft, Axiom.Math bottomRight ) : void
topLeft Axiom.Math
bottomRight Axiom.Math
return void

SetCorners() public method

Sets the corners of the SelectionRectangle. Every parameter should be in the range [0, 1] representing a percentage of the screen the SelectionRectangle should take up.
public SetCorners ( float left, float top, float right, float bottom ) : void
left float
top float
right float
bottom float
return void