Drawing3d documented Class Library

MNDevice Members

MNDevice overview

Public Static (Shared) Fields


Public Instance Constructors

MNDevice Constructor The constructor initializes the fields of the device

Public Instance Fields

ColorEnabled With this property you can lock color setting during the scene-painting. You can use it for example, if you are making a display list and want to set a color "outside" for all members from the display list.
DrawEnabled If DrawEnabled = false then the drawmethods doesn`t work. In combination with HitEnabled you can trick:
Draw an invisible, but catchable object, so you have an invisible hotspot.
MainDisplayList This Displaylist will be generated, when the navigating will be started. In the navigatemode it will be played.
MaxSelectCount In genaryl there are more than one object, which would be selected (If they differences only in the z-depth) MaxSelectCount determes the maximum of object which would be selected. Default is 20.
PenColorEnabled You can lock the PenColor-setting by the device.
Simulated Internal use

Public Instance Properties

Ambient Gets and sets the ambient part of the Material-property.
BackColor Retrieves and sets the color of the background.
Camera The Camera defines the lookout of the device You can get or set.
CatchDisplayListDirty Deutsch: Um ein Catchen mit guter Performance zu erreichen, wird eine Liste von umschließenden Rechtecken für jeden Zeichenbefehl erstellt. Im Fall, dass sich die Zeichnungsausgabe ändert, muss diese Liste neu erstellt werden. Durch Setzen von CatchDisplayListDirty auf den Wert true, wird erreicht,dass vor dem nächsten Catchvorgang die Liste neu erstellt wird.
CatchDistance With this value magnetism is controlled.
Objects that are closer 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.
Clockwise Gives the orientation of the painted regions. If you paint with "wrong"- Orientation and the Culling has the value true, nothing occurs on thescreen.
Culling Gets or sets the the cullingvalue of the graphic output. If Culling has the value true, the polygons, which has an other Orientation as is given by Clockwise will bee omitted. A Cullingvalue of true increases the performance, becaus only thes sides of an object will be draw, which looks to the observer.
CurrentHit If a hit happens, CurrentHit holds the first element if HitItemlist
Currentxyz Returns the 3-point, which is allocated by the cursor and magnetism to some objects, given in world coordinates
DCReservation If you set this property true, the Device crates at first a Device context DC and release this at the end. If you set this property false, the Device creates for a painting a device context and release them immediately.
Diffuse Gets and sets the diffuse part of the Material-property.
DisplayListCreatingState If you create a displaylist with getDisplayList this field has the value true, running the DrawNotify event )
Emisson Gets and sets the emission part of the Material-property.
EventServer The Eventsever handles all MouseEvents and Keyevents by distributing to it IEvents. See EventServer
Eye Returns the point of view.
EyeDistance This is the distance from the Eye to the projection plane. In case of orthogonal projection we have a fix EyeDistance of 30, otherwise the distance is given by WorldWidth/(2*Tan(FieldOfView));
FarClipping Sets or gets the far clipping distance. She is relative to the Eye. By default she is 50. This means an object, which is further away from the eye than 50, logical unit will be clipped.
FieldOfView Sets or gets the filed of view angle. If this is 0 the Projection is orthogonal. if the value is greather 0 the projection to tscreen is perspective.
FontName Sets or gets the name of the current font. A call to drawText uses this font.
FontSize Determines the size of the font in logical units.
See also drawText
FontStyle Gets or set a style for the current Font
Graphics Yo can use any graphics for the output Bitmap
HitEnabled If HitEnabled = true then the select procedure works, otherwise it is turned off. Default it is true. Also see HitItemlist
HitItemlist HitItemlist contains Hititems, which belongs to the selected drawing elements. This are elements, which lay in the near of the Point p, for which the method Select was called. See also HitItemList
Lighting Controls, whether the lighting is activated or not.
Lights Contains the D3DLights, which are used by the device
Material Sets and gets the Material.
ModelMatrix The ModelMatrix plays an important rule. If scene data are going to the device they would 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 positioned in the screen by expanding into the viewport. You see that the modelmatrix is a very powerful property.
Surface S = new Sphere(4);
// save the modelmatrix
Device.ModelMatrix = Device.ModelMatrix * Translation(new (5, 0, 0);
// this Sphere has the center at (5 /0 /0 ).
Device.ModelMatrix = Device.ModelMatrix * Translation(new (5, 0, 0);
// this Sphere has the center at (5 /0 /0 ).
// reset the Modelmatrix

Navigate If Navigate is true, you can navigate in the scene by pressed mousemoves.
NavigateAngles Gets or sets the three angles yaw, pitch and roll to the camera of the device.
NearClipping Sets or gets the nearclipping distance. It is relative to the Eye. By default, it is 1. This means that an object, which is closer to the Eye as 1 logical unit will be clipped.
OwnWndProc The device generates a own wndproc for the WinControl, if OwnWndProc is set to true. Default is true.
PaintFloatEnable If you have the situation, that only a part of the scene has changed and you dont want refresh the hole scene you can use the following concept:
1. Set PaintFloatEnable 2. Add a drawEvent to OnPaintFloatOnPaintFloat. 3. Every time, when the "small" scene has changed, call FastRefresh
Panning Sets or gets a Point which contains the x and y Panning of the screen.
PenColor With this color the lines of an object will be drawn. Also see PolygonMode
PenStyle Sets or gets the PenStyle, which that it will be drawn.
PenWidth Sets or gets the width of a pen.
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, whether the scene is drawn as line model or as fully rendered model. See PolygonMode
PositionPipe The items of this list are called whenever the position will be changed by a mouse event. You can use it to manipulate the Currentxyz Position
ProjectionBase Gets or sets the projection base 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 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);

RenderMode This property holds the RenderMode. He indicates the kind of drawing. If RenderMode = Nothing the device is not in a paint state. The RenderMode = Select is used to calculate the selection. See Select The RenderMode = MaxBox is used to calculate an environment box for an object. The RenderMode = MaxRect is used to calculate a rectangle for an object.
Root If you set this 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. Work
Shadow U can use this property to produce shadows.With ShadowKind you can set the used algoritm: TextureShadow or ShadowVolume.
ShadowKind If the property Shadow is true, one of the both algoritm are used: TextureShadow or ShadowVolume. TextureShadow is much faster then ShadowVolume. In the Shadowvolumealgorithm all the callculations are made in the CPU.
ShadowSetting You can get or set a ShadowSettings-object. ShadowSetting will be usend if Shadow is true and a Shadow will be painted.
Shininess Gets and sets the Shininess of the Material-property.
Specular Gets and sets the specular part of the Material-property.
SwapbuffersEnabled Sets or gets a value, which indicates, wheter the SwapBuffers - will be executed or not.
texture Sets and gets a Texture, which will be drawn.
TextureMatrix Gets and sets a transformation for a texture.
Timer Every device contains a Timer. See also OnTick and TimerEnable.
TimerEnable Gets or set the Timer.Enable-property
ToGlobal With this Matrix you are able to convert local coordinates to global coordinates. ToLocal
Translucent Gets and sets the Translucency of the Material-property.
ViewPort Set or gets the viewport of a device. As soon as it was setted, the method CheckViewPort is called. Addionally the event OnViewportChanged is fired. For example the viewport of a control is changed, if the size of the control is changed.
WinControl In general you use a Control to output the device drawings. It is possible to draw in a Bitmap or in a Graphics
Work This is an ActiveCtrl which is created by the Device. It is used as a Parent for ActiveCtrl Apart of this the Root will be drawn, if it is not null.
WorldHeight Gets the height of the window in logical units.
WorldLeftUp Gets the world coordinates of the left up point in the ViewPort .
WorldRightDown Gets the world coordinates of the right down point in the ViewPort .
WorldWidth Returns the width of the windows in logical units.
Zoomfactor Sets or gets the zoom factor 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

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
Changed Call this method, if the outlook of the device has been changed. Refresh invokes every time a Painting, but the method Changed() waits for example if all mousevents are called. So it is better for the performance to call Changed.
ClearScreen In the BeginPaint- Method ClearScreen is called. This method depends on the graphic engine and must be overridden?.
ClipPlane A call to this method hides all parts on the side of the Plane, which are on the other side of the planes normalvector. Id is an integer between 0 and 7.
Close Closes the device.
DeleteTexture Delete a Texture in a Device and gives its handle free.
DisableClipPlane Disable the Clippingplane, which was called by ClipPlane
DisplayListFree Removes a display list from the engine.
DisplayListPlay Draws a display list, which is created by getDisplayList
DoPaint DoPaint calls the paintmetod of the Root at first, then the paintmethod of the Work and finally the OnPaint-event.
drawCurveOverloaded. Draw a Curve
DrawEntity If you have an Entity with an overridden Drawing3d.Entity.Draw(MNDevice) or a filled Entity.OnDraw, you can call this method. It will call the drawmethods of the entity.
drawImageOverloaded. This primitive draw method draws an Image at a xyz-position relative to the projection base. The image is static, if you change the the ProjectionBase.
drawLine Draw a Line From A to B.
drawMesh Draws a Mesh.
drawPointOverloaded. Draws a point. The kind of drawing is described in pt. MNDevice.PointData
drawPolyCurve Draws an array of curve.
drawPolyLine Draws a Polyline. If PolygonMode = Fill, a filled area bounded by lines is drawn, but they shouldn`t have any cross points.
drawPolyPolyCurve This primitive draw method 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 that the entries are coherent curve arrays and additionally, there are no cross points. If this is done, the curve arrays, which lay in an other filled curve array is "drawn as hole". If it lays in a hole, the curvearray is filled drawn.
drawPolyPolyLineOverloaded. Draws a Polypolyline with Normals
drawSphere Draws a sphere at (0,0,0) with "Radius"
drawSurfaceOverloaded. Call the drawSurface-method with resolutions taken from the surface. See UResolution and VResolution.
drawText This primitive drawmethod writes a Text in a xyz-position.
drawTextureOverloaded. Draws a texture at a position.
drawTriangle Draws a triangle with Normals and texture, which is given by TexturePos
EndPaint The last call in the Paint-method is EndPaint. It fires the SwapBuffers-method
Equals (inherited from Object) 
FastRefresh Copies the Background to the to Drawbuffer and invokes the OnPaintFloat-method. At least a SwapBuffers-call moves the drawbuffer to the screen. "Background" means in that context: All paintings, which are made in a drawmethod. The "Foreground" is painted in a drawFlo
FromScrOverloaded. Calculates a Line from a Screen coordinate to the Camera.
getDisplayList Contructs a display list and returns that. You can draw this list with DisplayListPlay and destroy by DisplayListFree
GetGlyphOutLine Returns a Loca for the Curves of a Char.
GetHashCode (inherited from Object) 
GetMaxBoxOverloaded. Gets a envelopping box for all elements rendered by the device.
GetSmoothBase Retrieves a Base, which 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 put to the nearestpoint to the point closest to the the catch object. If you draw this base, it smooths around the object, which lays under the cursor.
GetTextExtent Gets an extending rectangle for a string, using the current Font
GetType (inherited from Object) 
LookAt Sets the camera of the device.
MakeCurrent If you have more devices this call makes it current
MouseUp The device gets the MouseUp-event from the WinControl.
MulMatrix By a call of MulMatrix the modelmatrix will be multiplied by a the transformation matrix. And so you can transform your drawings.
MulTextureMatrix By a call of MulTextureMatrix the TextureMatrix will be multiplied by a the transformation matrix. And so you can transform your drawings. Matrix, which transform the TexureMatrix.
Paint Paint calls the three methods BeginPaint, DoPaint and EndPaint. The Method is allways called, if WinControl should be painted.
PopMatrixOverloaded. To save the ModelMatrix for a short time you can push it with PushMatrix and restore with PopMatrix.
popTag Pops a tag, which was pushed with pushTag
PushMatrixOverloaded. 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 draw element the last tag is set into the HitItem. You can get it from the HitItemlistpopTag
Refresh Refreshes the device.
removeLight Removes a Light from the list Lights. Its the same as Lights.Remove(Light);
Resize If WinControl was resized, the method Resize is called.
Rotate Rotates the following drawings by a call to MulMatrix. Call before this PushMatrix and after the painting a PopMatrix
Select Clears the HitItemlist and searches the draw elements, which are close to the point p. This means, that the distance to p is less then CatchDistance The method calls the Paintmethod of the device with RenderMode = RenderMode.Select.
SetAntiAliasing Sets antialiasing.
setCulling The wirtual setter of the Culling-property
SetCurrentCursor If the defaultcursor is null then the currentcursor will be taken.
SetDefaultCursor Sets a defaultcursor.
SimulateMouseDown By a call to this method you can simulate a mousedownclick. See also SimulateMouseMove
SimulateMouseMove By a call to this method you can simulate a mousemove. See also SimulateMouseDown
SimulateMouseUp By a call to this method you can simulate a mousedownclick. See also SimulateMouseMove
SolidConvexOverloaded. This abstract method must be overridden by a derived instance. It draws the array xyzArray, which is assumed to be convex. The normals of the vertices are held by the array normals. They correspond to the vertices by its index. Also the texture coordinates, which are stored in TexturePos?. An other abstract draw method, which has to be overridden is LineStrip.
SwapBuffers In most cases a double-buffer-system is used and in EndPaint a call SwapBuffers fired. This call depends on the graphic engine. Therefore it has to be overridden.
ToScrOverloaded. Calculates the screen coordinates of a 3d-Point p.
ToString (inherited from Object) 
Translate Translates the following drawings by a call to MulMatrix. Call before this PushMatrix and after the painting a PopMatrix
UpDated If you make any modifications in the component, you should first call
..Change some things
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 any modifications in the component you should first call
..Change some things
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 it is 0 then Refresh is called. See UpDated

Public Instance Events

OnGraphicsPaint Event which is called by GraphicsPaint
OnKeyDown This event is called by KeyDown
OnKeyPress This event is called by KeyPress
OnKeyUp This event is called by KeyUp
OnMouseDown The event will be called by the MouseDown-method
OnMouseMove The event will be called by the MouseMove-method
OnMouseUp The event will be called by the MouseUp-method
OnPaint The Event OnPaint is called from DoPaint.
OnPaintFloat The paint event, that will be call by FastRefresh
OnTick This event is called from the Timer
OnViewportChanged If the ViewPort is changing, this event is called.

Protected Instance Methods

CheckViewPort The method sets the ViewPort to the ClientRectangle of the WinControl and refreshes the ProjectionMatrix
CopyFromSaveBuffer Copy the accumulation buffer to the rendercontext. Assumed is PaintFloatEnable.
CopyToSaveBuffer Copies the RenderContext to the accumulation buffer. Assumed is PaintFloatEnable.
CreateMaterial This method is called from the constructur. For example the OpenGlDevice overrides them, to implement OglMaterial
Disposed Overrides this method ans sets the WinControl-property to null.
getCulling The virtual getter of the property Culling
GetGraphics Getmethod of the property Graphics
getModelMatrix protected getMethod for the ModelMatrix-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
GraphicsPaint After painting in the "normal" device, a call to GraphicsPaint is done.
IsReady The method IsReady returns true, if the device is able to draw something. For example: if there is no Control or the graphic engine is not installed then IsReady is false.
KeyDown This method is called from the EventServer when a key is clicked down.
KeyPress This method is called from the EventServer, when a key is pressed.
KeyUp This method is called from the EventServer when a key goes up.
LineStrip This abstract method must be overridden by a derived instance. It draws lines over 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.
newLight This abstract method has to be overridden by an instance of MNDevice. She creates a Light and returns that.
SetClockWise Virtual settermethod of the Clockwise-property
setFontName Setmethod of FontName
SetLighting Setmethod of the Lighting-property
setModelMatrix protected SetMethod for the ModelMatrix-property.
setPencolor The protected settermethod of the property PenColor.
setPenStyle The setmethod of the property PenStyle
SetPenWidth Setmethod of the property PenWidth.
SetPolygonmode Setmethod of the property PolygonMode
setProjectionMatrix SetMethod of the ProjectionMatrix.
SetRoot The virtual settermethod of Root property.
setShadow The protected Settermethod for the Shadow-property.
setTexture Virtual setmethod of the property Texture
SetTextureMatrix Virtual setmethod of the property TextureMatrix
SetViewPort Setmethod of the property ViewPort"/>
SetWinControl Setmethod of the property WinControl
setZoomFactor Setmethod of the property Zoomfactor
SizeChanged If the size of the WinControl was changed, this method is called.
TimeEvent A protected method, which call OnTick,if is assigned.
UpDateMaterial UpDateMaterial set up the property of Material to the graphic engine and must be overridden.
ValidHandleCreated A valid handle has been created. This means that the WinControl is set and has a good Handle. In 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 any created things.

See Also

MNDevice Class | Drawing3d Namespace