nGfxServer2 Class Reference
#include <ngfxserver2.h>
Inheritance diagram for nGfxServer2:

Detailed Description
New generation gfx server, completely vertex and pixel shader based.See also nGfxServer2 Script Interface
(C) 2002 RadonLabs GmbH
Definition at line 50 of file ngfxserver2.h.
Public Types | |
| enum | TransformType { Model = 0, View, Projection, InvModel, InvView, ModelView, InvModelView, ModelViewProjection, ViewProjection, Texture0, Texture1, Texture2, Texture3, Light, ModelLight, InvModelLight, ShadowProjection, NumTransformTypes } |
| transform types More... | |
| enum | LightingType { Off = 0, FFP, Shader } |
| lighting types More... | |
| enum | BufferType { NoBuffer = 0, ColorBuffer = (1<<0), DepthBuffer = (1<<1), StencilBuffer = (1<<2), AllBuffers = (ColorBuffer | DepthBuffer | StencilBuffer) } |
| buffer types More... | |
| enum | PrimitiveType { PointList, LineList, LineStrip, TriangleList, TriangleStrip, TriangleFan } |
| primitive types More... | |
| enum | IndexType { Index16, Index32 } |
| index types More... | |
| enum | ShapeType { Box = 0, Cylinder, Sphere, Torus, Teapot, NumShapeTypes } |
| shape types More... | |
| enum | FeatureSet { DX7 = 0, DX8, DX8SB, DX9, DX9FLT, NumFeatureSets, InvalidFeatureSet } |
| feature sets (from worst to best) More... | |
| enum | CursorVisibility { None, System, Custom, Gui } |
| the visible mouse cursor type More... | |
| enum | { MaxVertexStreams = 16, MaxTextureStages = 4, MaxTransformStackDepth = 4, MaxRenderTargets = 4, MaxLights = 8 } |
| enum | DeviceIdentifier { GenericDevice, Intel_82865G, SiS_630, SiS_741 } |
| list of devices that are known to cause bugs More... | |
| enum | Hint { MvpOnly = (1<<0), CountStats = (1<<1) } |
Public Member Functions | |
| nGfxServer2 () | |
| constructor | |
| virtual | ~nGfxServer2 () |
| destructor | |
| virtual nMesh2 * | NewMesh (const nString &rsrcName) |
| create a shared mesh object | |
| virtual nMeshArray * | NewMeshArray (const nString &rsrcName) |
| create a new mesh array object | |
| virtual nTexture2 * | NewTexture (const nString &rsrcName) |
| create a shared texture object | |
| virtual nShader2 * | NewShader (const nString &rsrcName) |
| create a shared shader object | |
| virtual nFont2 * | NewFont (const nString &rsrcName, const nFontDesc &fontDesc) |
| create a font object | |
| virtual nTexture2 * | NewRenderTarget (const nString &rsrcName, int width, int height, nTexture2::Format format, int usageFlags) |
| create a render target object | |
| virtual nInstanceStream * | NewInstanceStream (const nString &rsrcName) |
| create a new instance stream object | |
| virtual nOcclusionQuery * | NewOcclusionQuery () |
| create a new occlusion query object | |
| virtual void | SetDisplayMode (const nDisplayMode2 &mode) |
| set display mode | |
| virtual const nDisplayMode2 & | GetDisplayMode () const |
| get display mode | |
| virtual void | SetWindowTitle (const char *title) |
| set the window title | |
| void | SetFontScale (float s) |
| set global scale factor for fonts | |
| float | GetFontScale () const |
| get global scale factor for fonts | |
| void | SetMinFontHeight (int s) |
| set minimum font height | |
| int | GetMinFontHeight () const |
| get minimum font height | |
| virtual void | SetCamera (nCamera2 &cam) |
| set the current camera description | |
| void | SetFeatureSetOverride (FeatureSet f) |
| override the feature set | |
| virtual FeatureSet | GetFeatureSet () |
| get the best supported feature set | |
| virtual bool | AreVertexShadersEmulated () |
| return true if vertex shader run in software emulation | |
| nCamera2 & | GetCamera () |
| get the current camera description | |
| virtual void | SetViewport (nViewport &vp) |
| set the viewport | |
| virtual nViewport & | GetViewport () |
| get the viewport | |
| virtual bool | OpenDisplay () |
| open the display | |
| virtual void | CloseDisplay () |
| close the display | |
| virtual bool | Trigger () |
| trigger the window system message pump | |
| virtual int | GetNumStencilBits () const |
| returns the number of available stencil bits | |
| virtual int | GetNumDepthBits () const |
| returns the number of available z bits | |
| virtual void | SetScissorRect (const rectangle &rect) |
| set scissor rect | |
| const rectangle & | GetScissorRect () const |
| get scissor rect | |
| virtual void | SetClipPlanes (const nArray< plane > &planes) |
| set or clear user defined clip planes in clip space | |
| const nArray< plane > & | GetClipPlanes () const |
| get user defined clip planes | |
| void | SetHint (Hint hint, bool enable) |
| set or delete a render hint | |
| bool | GetHint (Hint hint) const |
| get a render hint | |
| virtual void | SetRenderTarget (int index, nTexture2 *tex) |
| set a new render target texture | |
| nTexture2 * | GetRenderTarget (int index) const |
| get the current render target | |
| virtual bool | BeginFrame () |
| start rendering the current frame | |
| virtual bool | BeginScene () |
| start rendering to current render target | |
| virtual void | EndScene () |
| finish rendering to current render target | |
| virtual void | PresentScene () |
| present the contents of the back buffer | |
| virtual void | EndFrame () |
| end rendering the current frame | |
| bool | InBeginScene () const |
| Between BeginScene/EndScene? | |
| virtual void | Clear (int bufferTypes, float red, float green, float blue, float alpha, float z, int stencil) |
| clear buffers | |
| void | SetLightingType (LightingType t) |
| set lighting type | |
| LightingType | GetLightingType () const |
| get lighting type | |
| virtual void | ClearLights () |
| reset the light array | |
| virtual void | ClearPointLights () |
| remove all point lights | |
| virtual void | ClearLight (int index) |
| remove a light | |
| virtual int | AddLight (const nLight &light) |
| set a light | |
| const nArray< nLight > & | GetLightArray () const |
| access to light array | |
| virtual void | SetMesh (nMesh2 *vbMesh, nMesh2 *ibMesh) |
| set current vertex and index buffer mesh | |
| nMesh2 * | GetMesh () const |
| get current mesh | |
| virtual void | SetMeshArray (nMeshArray *meshArray) |
| set current mesh array (for multiple streams) | |
| nMeshArray * | GetMeshArray () const |
| get current mesh array | |
| virtual void | SetShader (nShader2 *shader) |
| set current shader | |
| nShader2 * | GetShader () const |
| get current shader | |
| virtual void | SetFont (nFont2 *font) |
| set current font | |
| nFont2 * | GetFont () const |
| get current font | |
| void | SetInstanceStream (nInstanceStream *stream) |
| set current instance stream, a valid instance stream triggers instance rendering | |
| nInstanceStream * | GetInstanceStream () const |
| get current instance stream | |
| virtual void | SetTransform (TransformType type, const matrix44 &matrix) |
| set transform | |
| const matrix44 & | GetTransform (TransformType type) const |
| get transform | |
| void | PushTransform (TransformType type, const matrix44 &matrix) |
| push transform | |
| const matrix44 & | PopTransform (TransformType type) |
| pop transform | |
| void | SetVertexRange (int firstVertex, int numVertices) |
| set vertex range to render from current mesh | |
| void | SetIndexRange (int firstIndex, int numIndices) |
| set index range to render from current mesh | |
| virtual void | DrawIndexed (PrimitiveType primType) |
| draw the current mesh with indexed primitives | |
| virtual void | Draw (PrimitiveType primType) |
| draw the current mesh with non-indexed primitives | |
| virtual void | DrawIndexedNS (PrimitiveType primType) |
| render indexed primitives without applying shader state (NS == No Shader) | |
| virtual void | DrawNS (PrimitiveType primType) |
| render non-indexed primitives without applying shader state (NS == No Shader) | |
| virtual void | DrawText (const nString &text, const vector4 &color, const rectangle &rect, uint flags, bool immediate=true) |
| draw text (immediately, or "when the time is right") | |
| virtual vector2 | GetTextExtent (const nString &text) |
| get text extents | |
| void | BreakLines (const nString &text, const rectangle &rect, nString &outString) |
| insert newline chars to break the text manual in lines - must be public because the ticker needs to break lines. | |
| virtual void | Text (const nString &text, const vector4 &color, float xPos, float yPos) |
| add text to the text buffer (OLD STYLE) | |
| virtual void | DrawTextBuffer () |
| draw the text buffer (OLD STYLE) | |
| virtual void | SetMouseCursor (const nMouseCursor &cursor) |
| set mouse cursor image and hotspot | |
| virtual const nMouseCursor & | GetMouseCursor () const |
| get mouse cursor image | |
| virtual void | SetCursorVisibility (CursorVisibility type) |
| show/hide the mouse cursor | |
| virtual CursorVisibility | GetCursorVisibility () const |
| get mouse cursor display status | |
| virtual void | EnterDialogBoxMode () |
| enter dialog box mode (display mode must have DialogBoxMode enabled!) | |
| virtual void | LeaveDialogBoxMode () |
| leave dialog box mode | |
| bool | InDialogBoxMode () const |
| return true if currently in dialog box mode | |
| virtual bool | SaveScreenshot (const char *filename, nTexture2::FileFormat fileFormat) |
| save a screen shot | |
| DeviceIdentifier | GetDeviceIdentifier () const |
| get the device identifier | |
| line3 | ComputeWorldMouseRay (const vector2 &mousePos, float length) |
| compute a mouse ray in world space | |
| void | SetGamma (float g) |
| set gamma value. | |
| void | SetBrightness (float b) |
| set brightness value. | |
| void | SetContrast (float c) |
| set contrast value. | |
| float | GetGamma () const |
| get gamma value. | |
| float | GetBrightness () const |
| get brightness value. | |
| float | GetContrast () const |
| get contrast value. | |
| virtual void | AdjustGamma () |
| adjust gamma. | |
| virtual void | RestoreGamma () |
| restore gamma. | |
| virtual void | SetSkipMsgLoop (bool skip) |
| skip message loop in trigger | |
| virtual void | BeginShapes () |
| begin shape rendering (for debug visualizations) | |
| virtual void | DrawShape (ShapeType type, const matrix44 &model, const vector4 &color) |
| draw a shape with the given model matrix with given color | |
| virtual void | DrawShapeNS (ShapeType type, const matrix44 &model) |
| draw a shape without shader management | |
| virtual void | DrawShapePrimitives (PrimitiveType type, int numPrimitives, const vector3 *vertexList, int vertexWidth, const matrix44 &model, const vector4 &color) |
| draw direct primitives | |
| virtual void | DrawShapeIndexedPrimitives (PrimitiveType type, int numPrimitives, const vector3 *vertexList, int numVertices, int vertexWidth, void *indices, IndexType indexType, const matrix44 &model, const vector4 &color) |
| draw direct indexed primitives (slow, use for debug visual visualization only!) | |
| virtual void | EndShapes () |
| end shape rendering | |
| virtual void | BeginLines () |
| begin rendering lines | |
| virtual void | DrawLines3d (const vector3 *vertexList, int numVertices, const vector4 &color) |
| draw 3d lines, using the current transforms | |
| virtual void | DrawLines2d (const vector2 *vertexList, int numVertices, const vector4 &color) |
| draw 2d lines in screen space | |
| virtual void | EndLines () |
| finish line rendering | |
Static Public Member Functions | |
| static nGfxServer2 * | Instance () |
| get instance pointer | |
| static FeatureSet | StringToFeatureSet (const char *str) |
| convert feature set string to enum | |
| static const char * | FeatureSetToString (FeatureSet f) |
| convert feature set enum to string | |
| static const vector4 | GetShadowLightIndexVector (int shadowLightIndex, float value) |
| get a vector4 of an int shadowLightIndex to set as shader parameter | |
Public Attributes | |
| CursorVisibility | cursorVisibility |
| note: this stuff is public because WinProcs may need to access it | |
Protected Attributes | |
| bool | displayOpen |
| bool | inBeginFrame |
| bool | inBeginScene |
| bool | inBeginLines |
| bool | inBeginShapes |
| nAutoRef< nResourceServer > | refResource |
| nCamera2 | camera |
| nViewport | viewport |
| nFixedArray< nRef< nTexture2 > > | refRenderTargets |
| nRef< nMesh2 > | refVbMesh |
| nRef< nMesh2 > | refIbMesh |
| nRef< nMeshArray > | refMeshArray |
| nRef< nFont2 > | refFont |
| nRef< nShader2 > | refShader |
| nRef< nInstanceStream > | refInstanceStream |
| nMouseCursor | curMouseCursor |
| int | vertexRangeFirst |
| int | vertexRangeNum |
| int | indexRangeFirst |
| int | indexRangeNum |
| FeatureSet | featureSetOverride |
| matrix44 | transform [NumTransformTypes] |
| int | transformTopOfStack [NumTransformTypes] |
| matrix44 | transformStack [NumTransformTypes][MaxTransformStackDepth] |
| bool | cursorDirty |
| bool | inDialogBoxMode |
| nArray< nLight > | lightArray |
| float | gamma |
| float | brightness |
| float | contrast |
| float | fontScale |
| int | fontMinHeight |
| DeviceIdentifier | deviceIdentifier |
| LightingType | lightingType |
| rectangle | scissorRect |
| uint | hints |
| nArray< plane > | clipPlanes |
Member Enumeration Documentation
|
|
transform types
Definition at line 54 of file ngfxserver2.h. |
|
|
lighting types
Definition at line 78 of file ngfxserver2.h. |
|
|
buffer types
Definition at line 86 of file ngfxserver2.h. |
|
|
primitive types
Definition at line 96 of file ngfxserver2.h. |
|
|
index types
Definition at line 107 of file ngfxserver2.h. |
|
|
shape types
Definition at line 114 of file ngfxserver2.h. |
|
|
feature sets (from worst to best)
Definition at line 126 of file ngfxserver2.h. |
|
|
the visible mouse cursor type
Definition at line 139 of file ngfxserver2.h. |
|
|
Reimplemented from nRoot. Definition at line 147 of file ngfxserver2.h. |
|
|
list of devices that are known to cause bugs
Definition at line 157 of file ngfxserver2.h. |
|
|
Definition at line 165 of file ngfxserver2.h. |
Constructor & Destructor Documentation
|
|
constructor
Definition at line 19 of file ngfxserver2_main.cc. |
|
|
destructor
Definition at line 58 of file ngfxserver2_main.cc. |
Member Function Documentation
|
|
get instance pointer
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 471 of file ngfxserver2.h. |
|
|
create a shared mesh object Create a new static mesh object.
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 72 of file ngfxserver2_main.cc. |
|
|
create a new mesh array object Create a new static mesh array object.
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 84 of file ngfxserver2_main.cc. |
|
|
create a shared texture object Create a new shared texture object.
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 97 of file ngfxserver2_main.cc. |
|
|
create a shared shader object Create a new shared shader object
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 110 of file ngfxserver2_main.cc. |
|
||||||||||||
|
create a font object Create a new shared font object.
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 124 of file ngfxserver2_main.cc. |
|
||||||||||||||||||||||||
|
create a render target object Create a new render target object.
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 165 of file ngfxserver2_main.cc. |
|
|
create a new instance stream object Create a new shared instance stream object.
Definition at line 137 of file ngfxserver2_main.cc. |
|
|
create a new occlusion query object Create a new occlusion query object.
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 149 of file ngfxserver2_main.cc. |
|
|
set display mode Set the preferred display mode. This must be called outside OpenDisplay()/CloseDisplay(). Reimplemented in nD3D9Server, and nGLServer2. Definition at line 180 of file ngfxserver2_main.cc. |
|
|
get display mode
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 189 of file ngfxserver2_main.cc. |
|
|
set the window title Set the window title.
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 203 of file ngfxserver2_main.cc. |
|
|
set global scale factor for fonts
Definition at line 523 of file ngfxserver2.h. |
|
|
get global scale factor for fonts
Definition at line 533 of file ngfxserver2.h. |
|
|
set minimum font height
Definition at line 503 of file ngfxserver2.h. |
|
|
get minimum font height
Definition at line 513 of file ngfxserver2.h. |
|
|
set the current camera description Set the current camera. Subclasses should adjust their projection matrix accordingly when this method is called.
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 216 of file ngfxserver2_main.cc. |
|
|
override the feature set
Definition at line 600 of file ngfxserver2.h. |
|
|
get the best supported feature set Return the supported feature set. Reimplemented in nD3D9Server, and nGLServer2. Definition at line 727 of file ngfxserver2_main.cc. |
|
|
return true if vertex shader run in software emulation Returns true when vertex shaders run in emulation. This is needed by mesh handling classes when running in the Fixed Function pipeline code path. The method must be overwritten in subclasses. Reimplemented in nD3D9Server, and nGLServer2. Definition at line 955 of file ngfxserver2_main.cc. |
|
|
get the current camera description Get the current camera object. Definition at line 612 of file ngfxserver2.h. |
|
|
set the viewport Set the current viewport. Subclasses should adjust the device accordingly. Reimplemented in nD3D9Server, and nGLServer2. Definition at line 228 of file ngfxserver2_main.cc. |
|
|
get the viewport Get the current viewport. Definition at line 590 of file ngfxserver2.h. |
|
|
open the display Open the display.
Reimplemented in nD3D9Server, and nGLServer2. Definition at line 240 of file ngfxserver2_main.cc. |
|
|
close the display Close the display. 23-Aug-04 kims added calling RestoreGamma(). Reimplemented in nD3D9Server, and nGLServer2. Definition at line 258 of file ngfxserver2_main.cc. |
|
|
trigger the window system message pump Trigger the windows system message pump. Return false if application should be closed |