Graphics subsystem. Manages the application window, rendering state and GPU resources.
More...
|
| Graphics (Context *context) |
| Construct.
|
|
| ~Graphics () override |
| Destruct. Release the Direct3D11 device and close the window.
|
|
void | SetExternalWindow (void *window) |
| Set external window handle. Only effective before setting the initial screen mode.
|
|
void | SetWindowTitle (const String &windowTitle) |
|
void | SetWindowIcon (Image *windowIcon) |
|
void | SetWindowPosition (const IntVector2 &position) |
|
void | SetWindowPosition (int x, int y) |
| Set window position. Sets initial position if window is not created yet.
|
|
bool | SetScreenMode (int width, int height, const ScreenModeParams ¶ms, bool maximize=false) |
|
bool | SetScreenMode (int width, int height) |
|
bool | SetWindowModes (const WindowModeParams &windowMode, const WindowModeParams &secondaryWindowMode, bool maximize=false) |
|
bool | SetDefaultWindowModes (int width, int height, const ScreenModeParams ¶ms) |
| Set default window modes. Return true if successful.
|
|
bool | SetMode (int width, int height, bool fullscreen, bool borderless, bool resizable, bool highDPI, bool vsync, bool tripleBuffer, int multiSample, int monitor, int refreshRate) |
| Set default window modes. Deprecated. Return true if successful.
|
|
bool | SetMode (int width, int height) |
| Set screen resolution only. Deprecated. Return true if successful.
|
|
void | SetSRGB (bool enable) |
|
void | SetDither (bool enable) |
|
void | SetFlushGPU (bool enable) |
|
void | SetForceGL2 (bool enable) |
| Set forced use of OpenGL 2 even if OpenGL 3 is available. Must be called before setting the screen mode for the first time. Default false. No effect on Direct3D9 & 11.
|
|
void | SetOrientations (const String &orientations) |
|
bool | ToggleFullscreen () |
| Toggle between full screen and windowed mode. Return true if successful.
|
|
void | Close () |
| Close the window.
|
|
bool | TakeScreenShot (Image &destImage) |
| Take a screenshot. Return true if successful.
|
|
bool | BeginFrame () |
| Begin frame rendering. Return true if device available and can render.
|
|
void | EndFrame () |
| End frame rendering and swap buffers.
|
|
void | Clear (ClearTargetFlags flags, const Color &color=Color(0.0f, 0.0f, 0.0f, 0.0f), float depth=1.0f, unsigned stencil=0) |
| Clear any or all of rendertarget, depth buffer and stencil buffer. More...
|
|
bool | ResolveToTexture (Texture2D *destination, const IntRect &viewport) |
| Resolve multisampled backbuffer to a texture rendertarget. The texture's size should match the viewport size.
|
|
bool | ResolveToTexture (Texture2D *texture) |
| Resolve a multisampled texture on itself.
|
|
bool | ResolveToTexture (TextureCube *texture) |
| Resolve a multisampled cube texture on itself.
|
|
void | Draw (PrimitiveType type, unsigned vertexStart, unsigned vertexCount) |
| Draw non-indexed geometry.
|
|
void | Draw (PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount) |
| Draw indexed geometry.
|
|
void | Draw (PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned baseVertexIndex, unsigned minVertex, unsigned vertexCount) |
| Draw indexed geometry with vertex index offset.
|
|
void | DrawInstanced (PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount, unsigned instanceCount) |
| Draw indexed, instanced geometry. An instancing vertex buffer must be set.
|
|
void | DrawInstanced (PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned baseVertexIndex, unsigned minVertex, unsigned vertexCount, unsigned instanceCount) |
| Draw indexed, instanced geometry with vertex index offset.
|
|
void | SetVertexBuffer (VertexBuffer *buffer) |
| Set vertex buffer.
|
|
bool | SetVertexBuffers (const PODVector< VertexBuffer * > &buffers, unsigned instanceOffset=0) |
|
bool | SetVertexBuffers (const Vector< SharedPtr< VertexBuffer > > &buffers, unsigned instanceOffset=0) |
| Set multiple vertex buffers.
|
|
void | SetIndexBuffer (IndexBuffer *buffer) |
| Set index buffer.
|
|
void | SetShaders (ShaderVariation *vs, ShaderVariation *ps) |
| Set shaders.
|
|
void | SetShaderParameter (StringHash param, const float *data, unsigned count) |
| Set shader float constants.
|
|
void | SetShaderParameter (StringHash param, float value) |
| Set shader float constant.
|
|
void | SetShaderParameter (StringHash param, int value) |
| Set shader integer constant.
|
|
void | SetShaderParameter (StringHash param, bool value) |
| Set shader boolean constant.
|
|
void | SetShaderParameter (StringHash param, const Color &color) |
| Set shader color constant.
|
|
void | SetShaderParameter (StringHash param, const Vector2 &vector) |
| Set shader 2D vector constant.
|
|
void | SetShaderParameter (StringHash param, const Matrix3 &matrix) |
| Set shader 3x3 matrix constant.
|
|
void | SetShaderParameter (StringHash param, const Vector3 &vector) |
| Set shader 3D vector constant.
|
|
void | SetShaderParameter (StringHash param, const Matrix4 &matrix) |
| Set shader 4x4 matrix constant.
|
|
void | SetShaderParameter (StringHash param, const Vector4 &vector) |
| Set shader 4D vector constant.
|
|
void | SetShaderParameter (StringHash param, const Matrix3x4 &matrix) |
| Set shader 3x4 matrix constant.
|
|
void | SetShaderParameter (StringHash param, const Variant &value) |
| Set shader constant from a variant. Supported variant types: bool, float, vector2, vector3, vector4, color.
|
|
bool | NeedParameterUpdate (ShaderParameterGroup group, const void *source) |
| Check whether a shader parameter group needs update. Does not actually check whether parameters exist in the shaders.
|
|
bool | HasShaderParameter (StringHash param) |
| Check whether a shader parameter exists on the currently set shaders.
|
|
bool | HasTextureUnit (TextureUnit unit) |
| Check whether the current vertex or pixel shader uses a texture unit.
|
|
void | ClearParameterSource (ShaderParameterGroup group) |
| Clear remembered shader parameter source group.
|
|
void | ClearParameterSources () |
| Clear remembered shader parameter sources.
|
|
void | ClearTransformSources () |
| Clear remembered transform shader parameter sources.
|
|
void | SetTexture (unsigned index, Texture *texture) |
| Set texture.
|
|
void | SetTextureForUpdate (Texture *texture) |
|
void | SetTextureParametersDirty () |
|
void | SetDefaultTextureFilterMode (TextureFilterMode mode) |
| Set default texture filtering mode. Called by Renderer before rendering.
|
|
void | SetDefaultTextureAnisotropy (unsigned level) |
| Set default texture anisotropy level. Called by Renderer before rendering.
|
|
void | ResetRenderTargets () |
| Reset all rendertargets, depth-stencil surface and viewport.
|
|
void | ResetRenderTarget (unsigned index) |
| Reset specific rendertarget.
|
|
void | ResetDepthStencil () |
| Reset depth-stencil surface.
|
|
void | SetRenderTarget (unsigned index, RenderSurface *renderTarget) |
| Set rendertarget.
|
|
void | SetRenderTarget (unsigned index, Texture2D *texture) |
| Set rendertarget.
|
|
void | SetDepthStencil (RenderSurface *depthStencil) |
| Set depth-stencil surface.
|
|
void | SetDepthStencil (Texture2D *texture) |
| Set depth-stencil surface.
|
|
void | SetViewport (const IntRect &rect) |
| Set viewport.
|
|
void | SetBlendMode (BlendMode mode, bool alphaToCoverage=false) |
| Set blending and alpha-to-coverage modes. Alpha-to-coverage is not supported on Direct3D9.
|
|
void | SetColorWrite (bool enable) |
| Set color write on/off.
|
|
void | SetCullMode (CullMode mode) |
| Set hardware culling mode.
|
|
void | SetDepthBias (float constantBias, float slopeScaledBias) |
| Set depth bias.
|
|
void | SetDepthTest (CompareMode mode) |
| Set depth compare.
|
|
void | SetDepthWrite (bool enable) |
| Set depth write on/off.
|
|
void | SetFillMode (FillMode mode) |
| Set polygon fill mode.
|
|
void | SetLineAntiAlias (bool enable) |
| Set line antialiasing on/off.
|
|
void | SetScissorTest (bool enable, const Rect &rect=Rect::FULL, bool borderInclusive=true) |
| Set scissor test.
|
|
void | SetScissorTest (bool enable, const IntRect &rect) |
| Set scissor test.
|
|
void | SetStencilTest (bool enable, CompareMode mode=CMP_ALWAYS, StencilOp pass=OP_KEEP, StencilOp fail=OP_KEEP, StencilOp zFail=OP_KEEP, unsigned stencilRef=0, unsigned compareMask=M_MAX_UNSIGNED, unsigned writeMask=M_MAX_UNSIGNED) |
| Set stencil test.
|
|
void | SetClipPlane (bool enable, const Plane &clipPlane=Plane::UP, const Matrix3x4 &view=Matrix3x4::IDENTITY, const Matrix4 &projection=Matrix4::IDENTITY) |
| Set a custom clipping plane. The plane is specified in world space, but is dependent on the view and projection matrices.
|
|
void | BeginDumpShaders (const String &fileName) |
| Begin dumping shader variation names to an XML file for precaching.
|
|
void | EndDumpShaders () |
| End dumping shader variations names.
|
|
void | PrecacheShaders (Deserializer &source) |
| Precache shader variations from an XML file generated with BeginDumpShaders().
|
|
void | SetShaderCacheDir (const String &path) |
|
bool | IsInitialized () const |
|
GraphicsImpl * | GetImpl () const |
| Return graphics implementation, which holds the actual API-specific resources.
|
|
void * | GetExternalWindow () const |
| Return OS-specific external window handle. Null if not in use.
|
|
SDL_Window * | GetWindow () const |
| Return SDL window.
|
|
const String & | GetWindowTitle () const |
|
const String & | GetApiName () const |
|
IntVector2 | GetWindowPosition () const |
|
int | GetWidth () const |
|
int | GetHeight () const |
|
const ScreenModeParams & | GetScreenModeParams () const |
| Return screen mode parameters.
|
|
int | GetMultiSample () const |
|
IntVector2 | GetSize () const |
|
bool | GetFullscreen () const |
|
bool | GetBorderless () const |
|
bool | GetResizable () const |
|
bool | GetHighDPI () const |
| Return whether window is high DPI.
|
|
bool | GetVSync () const |
|
int | GetRefreshRate () const |
| Return refresh rate when using vsync in fullscreen.
|
|
int | GetMonitor () const |
| Return the current monitor index. Effective on in fullscreen.
|
|
bool | GetTripleBuffer () const |
|
bool | GetSRGB () const |
|
bool | GetDither () const |
|
bool | GetFlushGPU () const |
|
bool | GetForceGL2 () const |
| Return whether OpenGL 2 use is forced. Effective only on OpenGL.
|
|
const String & | GetOrientations () const |
|
bool | IsDeviceLost () const |
|
unsigned | GetNumPrimitives () const |
|
unsigned | GetNumBatches () const |
|
unsigned | GetDummyColorFormat () const |
| Return dummy color texture format for shadow maps. Is "NULL" (consume no video memory) if supported.
|
|
unsigned | GetShadowMapFormat () const |
| Return shadow map depth texture format, or 0 if not supported.
|
|
unsigned | GetHiresShadowMapFormat () const |
| Return 24-bit shadow map depth texture format, or 0 if not supported.
|
|
bool | GetInstancingSupport () const |
|
bool | GetLightPrepassSupport () const |
|
bool | GetDeferredSupport () const |
|
bool | GetAnisotropySupport () const |
| Return whether anisotropic texture filtering is supported.
|
|
bool | GetHardwareShadowSupport () const |
|
bool | GetReadableDepthSupport () const |
|
bool | GetSRGBSupport () const |
|
bool | GetSRGBWriteSupport () const |
|
PODVector< IntVector3 > | GetResolutions (int monitor) const |
|
unsigned | FindBestResolutionIndex (int monitor, int width, int height, int refreshRate) const |
| Return index of the best resolution for requested width, height and refresh rate.
|
|
PODVector< int > | GetMultiSampleLevels () const |
|
IntVector2 | GetDesktopResolution (int monitor) const |
|
int | GetMonitorCount () const |
|
int | GetCurrentMonitor () const |
|
bool | GetMaximized () const |
|
Vector3 | GetDisplayDPI (int monitor=0) const |
|
unsigned | GetFormat (CompressedFormat format) const |
| Return hardware format for a compressed image format, or 0 if unsupported.
|
|
ShaderVariation * | GetShader (ShaderType type, const String &name, const String &defines=String::EMPTY) const |
| Return a shader variation by name and defines.
|
|
ShaderVariation * | GetShader (ShaderType type, const char *name, const char *defines) const |
| Return a shader variation by name and defines.
|
|
VertexBuffer * | GetVertexBuffer (unsigned index) const |
| Return current vertex buffer by index.
|
|
IndexBuffer * | GetIndexBuffer () const |
| Return current index buffer.
|
|
ShaderVariation * | GetVertexShader () const |
| Return current vertex shader.
|
|
ShaderVariation * | GetPixelShader () const |
| Return current pixel shader.
|
|
ShaderProgram * | GetShaderProgram () const |
|
TextureUnit | GetTextureUnit (const String &name) |
| Return texture unit index by name.
|
|
const String & | GetTextureUnitName (TextureUnit unit) |
| Return texture unit name by index.
|
|
Texture * | GetTexture (unsigned index) const |
| Return current texture by texture unit index.
|
|
TextureFilterMode | GetDefaultTextureFilterMode () const |
| Return default texture filtering mode.
|
|
unsigned | GetDefaultTextureAnisotropy () const |
| Return default texture max. anisotropy level.
|
|
RenderSurface * | GetRenderTarget (unsigned index) const |
| Return current rendertarget by index.
|
|
RenderSurface * | GetDepthStencil () const |
| Return current depth-stencil surface.
|
|
IntRect | GetViewport () const |
| Return the viewport coordinates.
|
|
BlendMode | GetBlendMode () const |
| Return blending mode.
|
|
bool | GetAlphaToCoverage () const |
| Return whether alpha-to-coverage is enabled.
|
|
bool | GetColorWrite () const |
| Return whether color write is enabled.
|
|
CullMode | GetCullMode () const |
| Return hardware culling mode.
|
|
float | GetDepthConstantBias () const |
| Return depth constant bias.
|
|
float | GetDepthSlopeScaledBias () const |
| Return depth slope scaled bias.
|
|
CompareMode | GetDepthTest () const |
| Return depth compare mode.
|
|
bool | GetDepthWrite () const |
| Return whether depth write is enabled.
|
|
FillMode | GetFillMode () const |
| Return polygon fill mode.
|
|
bool | GetLineAntiAlias () const |
| Return whether line antialiasing is enabled.
|
|
bool | GetStencilTest () const |
| Return whether stencil test is enabled.
|
|
bool | GetScissorTest () const |
| Return whether scissor test is enabled.
|
|
const IntRect & | GetScissorRect () const |
| Return scissor rectangle coordinates.
|
|
CompareMode | GetStencilTestMode () const |
| Return stencil compare mode.
|
|
StencilOp | GetStencilPass () const |
| Return stencil operation to do if stencil test passes.
|
|
StencilOp | GetStencilFail () const |
| Return stencil operation to do if stencil test fails.
|
|
StencilOp | GetStencilZFail () const |
| Return stencil operation to do if depth compare fails.
|
|
unsigned | GetStencilRef () const |
| Return stencil reference value.
|
|
unsigned | GetStencilCompareMask () const |
| Return stencil compare bitmask.
|
|
unsigned | GetStencilWriteMask () const |
| Return stencil write bitmask.
|
|
bool | GetUseClipPlane () const |
| Return whether a custom clipping plane is in use.
|
|
const String & | GetShaderCacheDir () const |
|
IntVector2 | GetRenderTargetDimensions () const |
| Return current rendertarget width and height.
|
|
void | OnWindowResized () |
| Window was resized through user interaction. Called by Input subsystem.
|
|
void | OnWindowMoved () |
| Window was moved through user interaction. Called by Input subsystem.
|
|
void | Restore () |
|
void | Maximize () |
| Maximize the window.
|
|
void | Minimize () |
| Minimize the window.
|
|
void | Raise () const |
| Raises window if it was minimized.
|
|
void | AddGPUObject (GPUObject *object) |
| Add a GPU object to keep track of. Called by GPUObject.
|
|
void | RemoveGPUObject (GPUObject *object) |
| Remove a GPU object. Called by GPUObject.
|
|
void * | ReserveScratchBuffer (unsigned size) |
| Reserve a CPU-side scratch buffer.
|
|
void | FreeScratchBuffer (void *buffer) |
| Free a CPU-side scratch buffer.
|
|
void | CleanupScratchBuffers () |
| Clean up too large scratch buffers.
|
|
void | CleanupShaderPrograms (ShaderVariation *variation) |
| Clean up shader parameters when a shader variation is released or destroyed.
|
|
void | CleanupRenderSurface (RenderSurface *surface) |
|
ConstantBuffer * | GetOrCreateConstantBuffer (ShaderType type, unsigned index, unsigned size) |
|
void | MarkFBODirty () |
|
void | SetVBO (unsigned object) |
|
void | SetUBO (unsigned object) |
|
| Object (Context *context) |
| Construct.
|
|
| ~Object () override |
| Destruct. Clean up self from event sender & receiver structures.
|
|
virtual StringHash | GetType () const =0 |
|
virtual const String & | GetTypeName () const =0 |
|
virtual const TypeInfo * | GetTypeInfo () const =0 |
| Return type info.
|
|
virtual void | OnEvent (Object *sender, StringHash eventType, VariantMap &eventData) |
| Handle event.
|
|
bool | IsInstanceOf (StringHash type) const |
| Check current instance is type of specified type.
|
|
bool | IsInstanceOf (const TypeInfo *typeInfo) const |
| Check current instance is type of specified type.
|
|
template<typename T > |
bool | IsInstanceOf () const |
| Check current instance is type of specified class.
|
|
template<typename T > |
T * | Cast () |
| Cast the object to specified most derived class.
|
|
template<typename T > |
const T * | Cast () const |
| Cast the object to specified most derived class.
|
|
void | SubscribeToEvent (StringHash eventType, EventHandler *handler) |
| Subscribe to an event that can be sent by any sender.
|
|
void | SubscribeToEvent (Object *sender, StringHash eventType, EventHandler *handler) |
| Subscribe to a specific sender's event.
|
|
void | SubscribeToEvent (StringHash eventType, const std::function< void(StringHash, VariantMap &)> &function, void *userData=nullptr) |
| Subscribe to an event that can be sent by any sender.
|
|
void | SubscribeToEvent (Object *sender, StringHash eventType, const std::function< void(StringHash, VariantMap &)> &function, void *userData=nullptr) |
| Subscribe to a specific sender's event.
|
|
void | UnsubscribeFromEvent (StringHash eventType) |
| Unsubscribe from an event.
|
|
void | UnsubscribeFromEvent (Object *sender, StringHash eventType) |
| Unsubscribe from a specific sender's event.
|
|
void | UnsubscribeFromEvents (Object *sender) |
| Unsubscribe from a specific sender's events.
|
|
void | UnsubscribeFromAllEvents () |
| Unsubscribe from all events.
|
|
void | UnsubscribeFromAllEventsExcept (const PODVector< StringHash > &exceptions, bool onlyUserData) |
| Unsubscribe from all events except those listed, and optionally only those with userdata (script registered events).
|
|
void | SendEvent (StringHash eventType) |
| Send event to all subscribers.
|
|
void | SendEvent (StringHash eventType, VariantMap &eventData) |
| Send event with parameters to all subscribers.
|
|
VariantMap & | GetEventDataMap () const |
| Return a preallocated map for event data. Used for optimization to avoid constant re-allocation of event data maps.
|
|
template<typename... Args> |
void | SendEvent (StringHash eventType, Args... args) |
| Send event with variadic parameter pairs to all subscribers. The parameter pairs is a list of paramID and paramValue separated by comma, one pair after another.
|
|
Context * | GetContext () const |
| Return execution context.
|
|
const Variant & | GetGlobalVar (StringHash key) const |
|
const VariantMap & | GetGlobalVars () const |
|
void | SetGlobalVar (StringHash key, const Variant &value) |
|
Object * | GetSubsystem (StringHash type) const |
| Return subsystem by type.
|
|
Object * | GetEventSender () const |
| Return active event sender. Null outside event handling.
|
|
EventHandler * | GetEventHandler () const |
| Return active event handler. Null outside event handling.
|
|
bool | HasSubscribedToEvent (StringHash eventType) const |
| Return whether has subscribed to an event without specific sender.
|
|
bool | HasSubscribedToEvent (Object *sender, StringHash eventType) const |
| Return whether has subscribed to a specific sender's event.
|
|
bool | HasEventHandlers () const |
| Return whether has subscribed to any event.
|
|
template<class T > |
T * | GetSubsystem () const |
| Template version of returning a subsystem.
|
|
const String & | GetCategory () const |
|
void | SetBlockEvents (bool block) |
| Block object from sending and receiving events.
|
|
bool | GetBlockEvents () const |
| Return sending and receiving events blocking status.
|
|
| RefCounted () |
| Construct. Allocate the reference count structure and set an initial self weak reference.
|
|
virtual | ~RefCounted () |
| Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
|
|
| RefCounted (const RefCounted &rhs)=delete |
| Prevent copy construction.
|
|
RefCounted & | operator= (const RefCounted &rhs)=delete |
| Prevent assignment.
|
|
void | AddRef () |
|
void | ReleaseRef () |
|
int | Refs () const |
|
int | WeakRefs () const |
|
RefCount * | RefCountPtr () |
| Return pointer to the reference count structure.
|
|