An NDoc Documented Class Library

MNDevice Members

MNDevice overview

Public Static Fields

LoadedFonts 

Public Static Methods

GetOutLineOverloaded. The method retrieves a Loca, which holds the curves of a character in the fontstyle, given by the parameter 'Font'. CellIncx gets the distance to a following next character.
...
double CellIncX;
Font F = new Font(FontName, 30);
// set attributes
Font.Style = System.Drawing.FontStyle.Bold; // for example
Loca L = GetOutLine( F , 'S', out CellIncX);
device.DrawPolyPolyCurve(L); // draws the character to the device

ReleaseDCOverloaded.  

Public Instance Constructors

MNDevice Constructor The constructor initialized the fields of the device

Public Instance Fields

ColorEnabled 
DrawEnabled If DrawEnabled = false then the drawmethods don't works. In combination with HitEnabled you can trick:
Draw an invisible, but catchenabled object, so you have an invisible hotspot.
GenerateNames (inherited from MNComponent) If GenerateNames is true then a MNName willbe generated if the parent is set to a component with has no name. With GenerateNames is guarantized, the every member of a tree ( except the root ) has a unique name and there is a fullpath, with that the element can be identified.

Public Instance Properties

BackColor Retrieves and sets the color of the background
Bitmap 
CatchDistance With this value the magnetism is controlled.
Objects, who are nearer as Catchdistance will be added to the HitItemlist.
It is the distance in screen coordinate. By default the value is 5 pixels.
CatchDistanceF Converts the value CatchDistance in world distance.
ClickedPosCount 
Count (inherited from MNComponent) Returns the count of children
CurrentHit If a hit happens then CurrentHit holds the first element if HitItemlist
Currentxyz Returns the 3-point, which is allocated by the mousepointer and magnetism to some objects
DesignMode 
EventServer 
Eye Returns the point of view.
EyeDistance This is the distance from the Eye to the projectionplane. In case of orthogonal projection we have a fix EyeDistance of 30, else the distance is given by WorldWidth/(2*Tan(FieldOfView));
FarClipping Sets or gets the farrclipping distance. She is relative to the Eye. By default she is 50. This means an ob ject, which is farer from the eye than 50 logical unit wil be clipped.
FieldOfView Sets the angle of the FieldOfView in degree.
An angle of zero indicates that we have a orthogonal projection
An angle different to zero indicates that we have a perspective projection. A good angle for that is ~ 20°
FontName Sets or gets the name of the current font. A call to drawText uses this font.
FontSize Determes the size of the font in logical units.
See also drawText
Graphics 
HitEnabled If HitEnabled = true then the selectmechanism works, else it is turned off. Default it is true. See also HitItemlist
HitItemlist HitItemlist contains Hititems, which belong to selected drawing elements. This are elements, who lay in the near of the Point p, for which the method Select was called. See also HitItemList
Item (inherited from MNComponent) The default indexer retieves and sets MNComponents
Lighting Controls, whether the lighting is on or not.
Lights Contains the lights, who are used from the device
Material Sets and gets the Material.
MNName (inherited from MNComponent) Name of the component.
ModelMatrix The ModelMatrix plays an important rule. If scene data are going to the device the they wold be transformed first by the modelmatrix and then by the ProjectionMatrix. After this two transformations the data are laying in a cube, which is bounded by (-1, -1, -1) and (1, 1, 1). In the last step the points are posiionned in the screen by expand into the viewport. You see, that the modelmatrix is a very powerful property.
Surface S = new Sphere(4);
Device.DrawSurface(S);
// save the modelmatrix
Device.PushMatrix()
Device.ModelMatrix = Device.ModelMatrix * Translation(new (5, 0, 0);
// this Sphere has the center at (5 /0 /0 ).
Device.DrawSurface(S);
Device.ModelMatrix = Device.ModelMatrix * Translation(new (5, 0, 0);
// this Sphere has the center at (5 /0 /0 ).
Device.DrawSurface(S);
// reset the Modelmatrix
Device.PopMatrix()

Name 
Navigate If Navigate is true then you can navigate in the scene by pressed mousemoves.
NearClipping Sets or gets the nearclipping distance. She is relative to the Eye. By default she is 1. This means an object, which is nearer to the Eye as 1 logical unit will be clipped.
Parent (inherited from MNComponent) Sets or gets the parent of the component and looks for the correct and unique name.
See also GenerateNames, setParent
PenColor With this color the lines of an object will be drawn. See also PolygonMode
PenStyle 
PenWidth 
PixelsPerUnit Set and gets the number of pixels per logical unit. Default is 30. A larger value makes a scene bigger.
PolygonMode The PolygonMode indicates wether the scene is drawn: as line model or as full rendered model. See PolygonMode
ProjectionBase Gets or sets the projectionbase in which the scene will be projected. You can also transform the
...
// rotate the projectionbase around her x-axis
Base P = Device.ProjectionBase;
P = P.mul(Math.Matrix.Rotation(P.Basex, Math.PI/6)); 
Device.ProjectionBase = P

...

ProjectionMatrix Contains the information about the projection of 3D-Data to the screen The matrix will be influenced by setting the FieldOfView. But you can set this directly for example:
// initialize ProjectionMatrix by a frustum 
ProjectionMatrix = Math.Matrix.Frustum(-10, 10, -10, 10, 2, 50);
// or 
ProjectionMatrix = Matrix.Orthogonal(left,right,bottom,top,-20,20);

ProjectionPoint 
RenderMode This property holds the RenderMode. He indicates the kind of drawing. If RenderMode = Nothing the the device is not in a paintstate. The RenderMode = Select is used to calculate the selection. See Select The RenderMode = MaxBox is used to calculate an environmentbox for an object. The RenderMode = MaxRect is used to calculate an Rectangle for an object.
Root If you set tis property to a Entity, the the Entity will be drawn with all its children. Apart of this the ActriveCtrl Work will be drawn by the device.
Tag (inherited from MNComponent) 
texture Sets and gets a Texture, who will be drawn.
TextureMatrix Get and sets a transformation for a texture.
ViewMatrix 
ViewPort 
WinControl 
Work This is an ActiveCtrl which is created by the Device. It is used as Parent for ActiveCtrl Apart of this the Root will be drawn if it is not null.
WorldHeight Get the height of the window in logical units
WorldLeftUp 
WorldRightDown 
WorldWidth Returns the width of the windows in logical untits.
Zoomfactor Sets or gets the zoomfactor of the scene. By default it is 1. If you want to play the scene with 200% the set Zoofactor to 2;

Public Instance Methods

addChild (inherited from MNComponent) Adds an elment in the list.
addLight With this method, you can add a Light.
BeginPaint The first call in the Paint-method is BeginPaint. It clears the Background by ClearScreen and sets the ProjectionBase
ChildByName (inherited from MNComponent) Retrieves the index of child by a name.
ChildByPathName (inherited from MNComponent) You can get a MNComponent by setting a fullpath relative to the given MNComponent. Separated are the names by "/".
MNComponent root = new MNComponent();
MNComponent a = new MNComponent();
MNComponent b = new MNComponent();
MNComponent c = new MNComponent();
a.MNName = "Frank";
b.MNName = "Joe";
c.MNName = "Sam";
c.Parent = b;
b.Parent = a;
a.Parent = root;
MNComponent d = root.ChildByPathName("Frank/Joe/Sam");
// d is then the component c

ClearScreen In the BeginPaint-Method ClearScreen is called. This method depends on the graphicengine and must be overriddeb.
ClickedPos 
Close 
DisplayListFree 
DisplayListPlay 
Dispose (inherited from MNComponent) 
drawCurve Draw a Curve
drawImage This primitive drawmethod draws an Image at a xyz-position.
drawLine Draw a Line From A to B.
drawPointOverloaded.  
drawPolyCurve Draws an array of curve.
drawPolyLine Draws a Polyline. if PolygonMode = Fill, then a filled area bounded by lines is drawn, but shold they have not crosspoints
drawPolyPolyCurve This primitive drawmethod draws a Loca. In case of PolygonMode = line, simple curves are drawn. If PolygonMode = Fill, then a filled area bounded by curves is drawn. The Loca must have the property, thats the entries are coherently curvearrays and additionally there are no crosspoints. if this is done then curvearrays, which lays in an other filled curvearray is "drawn as hole". If in lays in a hole then the curvearray is filled drawn.
drawPolyPolyLine This primitive drawmethod draws a PolyPolyline. In case of PolygonMode = line, simple lines are drawn. If PolygonMode = Fill, then a filled area bounded by lines is drawn. The Loxyz must have the property, thats the entries are coherently xyzarrays and additionally there are no crosspoints. If this is done, then xyzarrays, which lays in an other filled xyzarray are "drawn as hole". If it lays in a hole then the xyzarray is filled drawn.
drawSurfaceOverloaded. This call draw a Surface. Further you can set the resolutions of the u and v parameters.
drawText This primitive drawmethod writes a Text a xyz-position.
drawTriangle Draws a triangle with Normals and texture, who is given by TexturePos
Equals (inherited from Object) 
FromScrOverloaded. Calculates a LineType in worldcoordinates, which is prjected to the screenpoint p. ToScr
fullPath (inherited from MNComponent) Gives the full path of the component over all ancestors until a null-parent occurs. This parent often called the root. The separator of the names is "/".
getDisplayList 
GetEnumerator (inherited from MNComponent) Returns the Enumerator of an intern ArrayList
GetHashCode (inherited from Object) 
getPath (inherited from MNComponent) 
getRoot (inherited from MNComponent) 
GetService 
GetSmoothBase Retrieves a Base, who lies on the catched object. The direction of the x-axes is given by the direction of a catched Direction, the z-axis is the normal of a catched Normal. The BaseOrigin is puted to the nearestpoint of the catch object. If you draw this base, she smooths aound the objet, who layes under the cursor.
GetTextExtent 
GetType (inherited from Object) 
InsertChild (inherited from MNComponent) 
MoveTO (inherited from MNComponent) 
MulMatrix By a call of MulMatrix the modelmatrix will be multiplied by a the transformationmatrix. On this way you can transform your drawings.
Paint Paint calls the tree method BeginPaint, DoPaint and EndPaint. The Method is allways called, when the WinControl should be painted.
PopMatrix To save the ModelMatrix for a short time you can push them with PushMatrix and restore with PopMatrix.
popTag Pops a tag, which was pushed with pushTag
PushMatrix To save the ModelMatrix for a short time you can push them with PushMatrix and restore with PopMatrix
pushTag Pushes a Tag to a Tag-stack. If the mouse hits a drawelement the last tag is set into the HitItem. You can get it from the HitItemlist
Refresh Refreshes the device
RemoveChild (inherited from MNComponent) 
removeLight Removes a Light from the list Lights. Its the same as Lights.Remove(Light);
Select Clears the HitItemlist and searches those draw elements, who lay in the near to the point p. Near means, that the distance to p is less then CatchDistance The method calls the Paintmethod of the device with RenderMode = RenderMode.Select.
SetCurrentCursor 
SetDefaultCursor 
SimulateMouseDown 
SimulateMouseMove 
SwapBuffers In most cases a doublebuffersystem is used and in EndPaint a call SwapBuffers fired. This call is depending on the graphicengine. Therefore it must be overridden.
ToScrOverloaded. Calulates the screencoordinates of a 3d-Point p.
ToString (inherited from Object) 
UpDate (inherited from MNComponent) This protected method is called, if some changes are made. Some times on should inform other components about this changes to obtain a consisting system.
UpDated If you make some changing in the component you should call first
UpDating()
..Change some things
UpDated()
In this case the method Refresh will be called only one time. Internal a counter will be incremented for UpDating and decremented by UpDated. If he is 0 then Refresh is called. See UpDating
UpDating If you make some changing in the component you should call first
UpDating()
..Change some things
UpDated()
In this case the method Refresh will be called only one time. Internal a counter will be incremented for UpDating and decremented by UpDated. If he is 0 then Refresh is called. See UpDated

Public Instance Events

OnKeyDown 
OnKeyPress 
OnKeyUp 
OnMouseDown The event will be call by the MouseDown-method
OnMouseMove The event will be call by the MouseMove-method
OnMouseUp The event will be call by the MouseUp-method
OnPaint The Event OnPaint is called from DoPaint.
OnUpdate (inherited from MNComponent) 
OnUpdating (inherited from MNComponent) 

Protected Instance Methods

CheckViewPort The method sets the ViewPort to the ClientRectangle of the WinControl and refreshes the ProjectionMatrix
DoPaint DoPaint calls at first the paintmetod of the Root, the the paintmethod of the Work and finally the OnPaint-event.
EndPaint The last call in the Paint-method is EndPaint. It fire the SwapBuffers-method
Finalize The Destructor sets the WinControl null.
GetDC 
GetGraphics 
getModelMatrix protected getMethod for the ModelMatrix-property.
getProjectionBase protected getmethod of the ProjectionBase-property.
getProjectionMatrix GetMethod of the ProjectionMatrix.
GetTextureMatrix Virtual getmethod of the property TextureMatrix
getWorldHeight Getmethod of the WorldHeight-property
getWorldWidth GetMethod of the property WorldWidth
IsReady The method IsReady returns true, if the device is able to draw something. For example : if there is no Control or the graphicengine is not installed then IsReady is false.
KeyDown 
KeyPress 
KeyUp 
LineStrip This abstract method must be overridden by a derived instance. She draws lines through the points given by the xyzArray. An other abstract draw method, which must be overridden is SolidConvex.
MemberwiseClone (inherited from Object) 
MouseDown The device gets the MouseDown - event from the WinControl.
MouseMove The device gets the MouseMove - event from the WinControl.
MouseUp The device gets the MouseUp - event from the WinControl.
newLight This abstract method must be overridden by an instance of MNDevice. She creates a Light and returns that.
ReleaseDCOverloaded.  
Resize 
SetBitmap 
setFontName 
SetGraphics 
SetLighting Setmethod of the Lighting-property
setModelMatrix protected SetMethod for the ModelMatrix-property.
setParent (inherited from MNComponent) Virtual set-Method of the property Parent.
setPenStyle 
SetPenWidth 
setProjectionBase protected setmethod of the ProjectionBase-property.
setProjectionMatrix SetMethod of the ProjectionMatrix.
setTexture Virtual setmethod of the property Texture
SetTextureMatrix Virtual setmethod of the property TextureMatrix
SetViewPort 
SetWinControl 
setZoomFactor Setmethod of the property Zoomfactor
SizeChanged If the size of the WinControl was changed then this method is called.
SolidConvex This abstract method must be overridden by a derived instance. She draws the array xyzArray, which is assumed convex. The Normal of the vertices are holded by the array normals. They correspond to to vertices by its index. Also the Texture coordinates, which are stored in TexturePos. An other abstract draw method, which must be overridden is LineStrip.
UpDateMaterial UpDateMaterial set up the property of Material to the graphic engin and must bee overridden.
ValidHandleCreated A valid handle was been created. This meens, that the WinControl is set and has a good Handle. In the method the method CheckViewPort and UpDateMaterial is fired.
ValidHandleDestroyed If the Handle of the WinControl is destructed or WinControl is set to null the ValidHandleDestructed will be called. This is a good moment to reset some created things.

See Also

MNDevice Class | Minais.Drawing3d Namespace