Framework
From Leadwerks Developer Wiki
A framework is a collection of worlds, buffers, shaders, and rendering code. The Framework class can be used to easily render complex effects in any combination. The framework command set was originally implemented as a separate library of open-source code. You can view documentation and download the old version here.
Contents |
Introduction
Framework is a set of commands of Leadwerks Engine to handle advanced rendering techniques. It allows many post-processing effects to be combined without interfering with one another.
Features
Easy straight forward setup and managing for these effects:
- Distance fog
- Skyboxes
- HDR / Iris adjustment
- Bloom
- Antialias
- Near and far depth-of-field (DOF)
- Volumetric light scattering (God rays)
- Screen-space ambient occlusion (SSAO)
- Transparency and refraction.
- Water with reflection, refraction, physics, and full-screen underwater effects.
Members
The following members are accessible in BlitzMax and Lua. Members should be treated as read-only:
Framework Members
- background:TLayer
- main:TLayer
- transparency:TLayer
- renderer:TRenderer
- listener:TListener
Layer Members
- world:TWorld
- camera:TCamera
General Commands
CreateFramework
- C: TFramework CreateFramework( void )
- C++: void Framework::Create()
- BlitzMax: CreateFramework:TFramework()
- Lua: CreateFramework()
- Creates a new Framework object. A graphics window must be opened before the Framework is created.
- [Examples]
FreeFramework
- C: void FreeFramework( TFramework framework )
- C++: void Framework::Free()
- BlitzMax: FreeFramework( framework:TFramework )
- Lua: FreeFramework( framework )
- Frees a Framework object.
- [Examples]
RenderFramework
- C: void RenderFramework( void )
- C++: void Framework::Render()
- BlitzMax: RenderFramework()
- Lua: RenderFramework()
- Performs all rendering.
- [Examples]
UpdateFramework
- C: void UpdateFramework( void )
- C++: void Framework::Update()
- BlitzMax: UpdateFramework()
- Lua: UpdateFramework()
- Updates timing, behavior, and physics.
- [Examples]
ResetFramework
- C: void ResetFramework( void )
- C++: void Framework::Reset()
- BlitzMax: ResetFramework()
- Lua: ResetFramework()
- Resets the framework, and deletes all entities.
- [Examples]
GetFrameworkListener
- C: TListener GetFrameworkListener( void )
- C++: Listener Framework::listener
- Returns the listener entity associated with the framework object.
- [Examples]
SetStats
- C: void SetStats( int mode )
- C++: void Framework::SetStats( int mode )
- BlitzMax: SetStats( mode:Int )
- Lua: SetStats( mode )
- Sets the statistics mode.
- 0 - No statistics
- 1 - Show frame rate
- 2 - Full statistics
- [Examples]
SetZoom
- C: void SetZoom( flt zoom )
- C++: void Framewerk::SetZoom( flt zoom )
- BlitzMax: SetZoom( zoom:Float )
- Lua: SetZoom( zoom )
- Sets the camera zoom level for the Framework object.
- [Examples]
SetBackgroundMode
- C: void SetBackgroundMode( int mode )
- C++: void Framewerk::SetBackgroundMode( int mode )
- BlitzMax: SetBackgroundMode( mode:Int )
- Lua: SetBackgroundMode( mode )
- Sets the background mode.
- 0 - none (no color clearing)
- 1 - solid color
- [Examples]
SetBackgroundColor
- C: void SetBackgroundColor( TVec4 &color )
- C++: void Framework::renderer::SetBackgroundColor( TVec4 &color )
- BlitzMax: SetBackgroundColor( color:TVec4 )
- Lua: SetBackgroundColor( color )
- Sets the background color. This will only be used if the background mode is set to one.
- [Examples]
SetSkybox
- C: void SetSkybox( TMaterial material )
- C++: void Framework::renderer::SetSkybox( Material& material )
- BlitzMax: SetSkybox( material:TMaterial )
- Lua: SetSkybox( material )
- Sets the skybox material. If the material is Null, no skybox will be used. A skybox should be used together with background mode zero.
- [Examples]
Effects Commands
SetAntialias
- C: void SetAntialias( int mode )
- C++: void Framework::renderer::SetAntialias( int mode )
- BlitzMax: SetAntialias( mode:Int )
- framework.renderer.SetAntiAlias( mode:Int )
- Lua: SetAntialias( mode )
- framework.renderer.SetAntiAlias( mode )
- Sets the antialias mode.
- [Examples]
SetSSAO
- C: void SetSSAO( int mode )
- C++: void Framework::renderer::SetSSAO( int mode )
- BlitzMax: SetSSAO( mode:Int )
- Lua: SetSSAO( mode )
- Sets the SSAO mode.
- 0 - Disabled
- 1 - Enabled
- [Examples]
SetGodRays
- C: void SetGodRays( int mode )
- C++: void Framework::renderer::SetGodRays( int mode )
- BlitzMax: SetGodRays( mode:Int )
- Lua: SetGodRays( mode )
- Sets the mode for the volumetric light scattering effect. This effect will only be displayed if a directional light is present.
- 0 - Disabled
- 1 - Enabled
- [Examples]
SetHDR
- C: void SetHDR( int mode )
- C++: void Framework::renderer::SetHDR( int mode )
- BlitzMax: SetHDR( mode:Int )
- Lua: SetHDR( mode )
- Sets the mode for HDR and the iris adjustment effect.
- 0 - Disabled
- 1 - Enabled
- [Examples]
SetSaturation
- C: void SetSaturation( flt saturation )
- C++: void Framework::renderer::SetSaturation( flt saturation )
- BlitzMax: SetSaturation( saturation:Float )
- Lua: SetSaturation( saturation )
- Sets the renderer saturation level.
- [Examples]
SetBrightness
- C: void SetBrightness( flt brightness )
- C++: void Framework::renderer::SetBrightness( flt brightness )
- BlitzMax: SetBrightness( brightness:Float )
- Lua: SetBrightness( brightness )
- Sets the renderer brightness level.
- [Examples]
SetContrast
- C: void SetContrast( flt contrast )
- C++: void Framework::renderer::SetContrast( flt contrast )
- BlitzMax: SetContrast( contrast:Float )
- Lua: SetContrast( contrast )
- Sets the renderer contrast level.
- [Examples]
SetBloom
- C: void SetBloom( int mode )
- C++: void Framework::renderer::SetBloom( int mode )
- BlitzMax: SetBloom( mode:Int )
- Lua: SetBloom( mode )
- Sets the mode for the bloom effect.
- 0 - Disabled
- 1 - Enabled
- [Examples]
Distance Fog Commands
SetDistanceFog
- C: void SetDistanceFog( int mode )
- C++: void Framework::renderer::SetDistanceFog( int mode )
- BlitzMax: SetDistanceFog( mode:Int )
- Lua: SetDistanceFog( mode )
- Sets the mode for the distance fog effect.
- 0 - Disabled
- 1 - Enabled
- [Examples]
SetDistanceFogColor
- C: void SetDistanceFogColor( TVec4 &color )
- C++: void Framework::renderer::SetDistanceFogColor( TVec4 &color )
- BlitzMax: SetDistanceFogColor( color:TVec4 )
- Lua: SetDistanceFogColor( color )
- Sets the color of the distance fog.
- [Examples]
SetDistanceFogAngle
- C: void SetDistanceFogAngle( flt beginangle, flt endangle )
- C++: void Framework::renderer::SetDistanceFogAngle( flt beginangle, flt endangle )
- BlitzMax: SetDistanceFogAngle( beginangle:Float, endangle:Float )
- Lua: SetDistanceFogAngle( beginangle, endangle)
- Sets the angle of the distance fog effect in the background. The begin angle is the angle at which the fog starts fading on the horizon. The end angle is where the fog will be completely faded out. This can be used to control how high on the horizon the distance fog effect appears.
- [Examples]
SetDistanceFogRange
- C: void SetDistanceFogRange( flt beginrange, flt endrange )
- C++: void Framework::renderer::SetDistanceFogRange( flt beginrange, flt endrange )
- BlitzMax: SetDistanceFogRange( beginrange:Float, endrange:Float )
- Lua: SetDistanceFogRange( beginrange, endrange )
- Sets the range of the distance fog effect in the background. The begin range is the distance at which the fog starts appearing. The end range is where the fog will appear at maximum strength.
- [Examples]
Depth of Field Commands
The depth of field effect is made of two separate effects which can be controlled independently, for near and far DOF.
SetNearDOF
- C: void SetNearDOF( int mode )
- C++: void Framework::renderer::SetNearDOF( int mode )
- BlitzMax: SetNearDOF( mode:Int )
- Lua: SetNearDOF( mode )
- Sets the mode for the near depth of field effect.
- 0 - Disabled
- 1 - Enabled
- [Examples]
SetNearDOFStrength
- C: void SetNearDOFStrength( flt strength )
- C++: void Framework::renderer::SetNearDOFStrength( flt strength )
- BlitzMax: SetNearDOFStrength( strength:Float )
- Lua: SetNearDOFStrength( strength )
- Sets the strength of the near depth of field effect. The strength parameter should be a number between zero and one.
- [Examples]
SetNearDOFRange
- C: void SetNearDOFRange( flt beginrange, flt endrange )
- C++: void Framework::renderer::SetNearDOFRange( flt beginrange, flt endrange )
- BlitzMax: SetNearDOFRange( beginrange:Float, endrange:Float )
- Lua: SetNearDOFRange( beginrange, endrange )
- Sets the range of the near depth of field effect. The begin range is the distance at which the effect starts appearing. The end range is where the effect will appear at maximum strength.
- [Examples]
SetFarDOF
- C: void SetFarDOF( int mode )
- C++: void Framework::renderer::SetFarDOF( int mode )
- BlitzMax: SetFarDOF( mode:Int )
- Lua: SetFarDOF( mode )
- Sets the mode for the far depth of field effect.
- 0 - Disabled
- 1 - Enabled
- [Examples]
SetFarDOFStrength
- C: void SetFarDOFStrength( flt strength )
- C++: void Framework::renderer::SetFarDOFStrength( flt strength )
- BlitzMax: SetFarDOFStrength( strength:Float )
- Lua: SetFarDOFStrength( strength )
- Sets the strength of the far depth of field effect. The strength parameter should be a number between zero and one.
- [Examples]
SetFarDOFRange
- C: void SetFarDOFRange( flt beginrange, flt endrange )
- C++: void Framework::renderer::SetFarDOFRange( flt beginrange, flt endrange )
- BlitzMax: SetFarDOFRange( beginrange:Float, endrange:Float )
- Lua: SetFarDOFRange( beginrange, endrange )
- Sets the range of the far depth of field effect. The begin range is the distance at which the effect starts appearing. The end range is where the effect will appear at maximum strength.
- [Examples]
Water Commands
SetWater
- C: void SetWater( int mode )
- C++: void Framework::renderer::SetWater( int mode )
- BlitzMax: SetWater( mode:Int )
- Lua: SetWater( mode )
- Sets the water mode. When water is enabled, an infinite plane of liquid will appear and affect buoyant objects.
- 0 - Disabled
- 1 - Enabled
- [Examples]
SetWaterAmplitude
- C: void SetWaterAmplitude( flt amplitude )
- C++: void Framework::renderer::SetWaterAmplitude( flt amplitude )
- BlitzMax: SetWaterAmplitude( amplitude:Float )
- Lua: SetWaterAmplitude( amplitude )
- Sets the water's wave amplitude. Higher amplitudes make the water more calm. Lower amplitudes make more ripples to the water.
- [Examples]
SetReflectionElements
- C: void SetReflectionElements( int mode )
- C++: void Framework::renderer::SetReflectionElements( int mode )
- BlitzMax: SetReflectionElements( mode:Int )
- Lua: SetReflectionElements( mode )
- Sets the components which should be renderered in the water reflection. The default value is ENTITY_TERRAIN, so only terrain is rendered. Settings this to ENTITY_RENDERABLE renders everything, but causes also the heaviest GPU load. See RenderWorld for a list of all renderable components.
- [Examples]
SetWaterVisibility
- C: void SetWaterVisibility( flt beginrange, flt endrange )
- C++: void Framework::renderer::SetWaterVisibility( flt beginrange, flt endrange )
- BlitzMax: SetWaterVisibility( beginrange:Float, endrange:Float )
- Lua: SetWaterVisibility( beginrange, endrange )
- Sets the water visibility range.
- [Examples]
SetWaterSoftness
- C: void SetWaterSoftness( flt softness )
- C++: void Framework::renderer::SetWaterSoftness( flt softness )
- BlitzMax: SetWaterSoftness( softness:Float )
- Lua: SetWaterSoftness( softness )
- Sets the water softness. Water softness is the alpha transparency of the water.
- [Examples]
SetWaterColor
- C: void SetWaterColor( TVec4 &color, TVec4 &submersioncolor )
- C++: void Framework::renderer::SetWaterColor( TVec4 &color, TVec4 &submersioncolor )
- BlitzMax: SetWaterColor( color:TVec4, submersioncolor:TVec4 )
- Lua: SetWaterColor( color, submersioncolor )
- Sets the water surface and underwater fog ("submersion") color.
- [Examples]
SetWaterHeight
- C: void SetWaterHeight( flt height )
- C++: void Framework::renderer::SetWaterHeight( flt height )
- BlitzMax: SetWaterHeight( height:Float )
- Lua: SetWaterHeight( height )
- Sets the water height in meters.
- [Examples]
SetWaterWaveSpeed
- C: SetWaterWaveSpeed( flt speed )
- C++: void Framework::renderer::SetWaterWaveSpeed( flt speed )
- BlitzMax: SetWaterWaveSpeed( speed:Float )
- Lua: SetWaterWaveSpeed( speed )
- Sets the water wave speed.
- [Examples]
Layer Commands
GetFrameworkLayer
- C: GetFrameworkLayer( int index )
- C++: Layer& Framewerk::GetLayer( int index )
- or Layer Framewerk::background
- or Layer Framewerk::main
- or Layer Framewerk::transparency
- Gets a Layer. The main Layer contains the World which contains the entities of the application, and the Camera of the application. The background Layer contains the World which contains the Skybox, and may also contain entities of a 3D background World. The transparency Layer contains the World which contains transparent entities like water, windows, smoke particle and heat haze materials.
- mode:
- -1 - background layer
- 0 - main layer
- 1 - transparency layer
- [Examples]
GetLayerCamera
- C: GetLayerCamera( TLayer layer )
- C++: Camera& Layer::GetCamera()
- Gets the camera of the Layer.
- [Examples]
GetLayerWorld
- C: GetLayerWorld( TLayer layer )
- C++: World& Layer::GetWorld()
- Gets the world of the Layer.
- [Examples]
