SilverLining
Public Member Functions | List of all members
SilverLining::ThreadCameraStreamData Class Reference

This class is the main interface to thread safe rendering with SilverLining. More...

#include <ThreadCameraStreamData.h>

Inheritance diagram for SilverLining::ThreadCameraStreamData:
Inheritance graph
[legend]
Collaboration diagram for SilverLining::ThreadCameraStreamData:
Collaboration graph
[legend]

Public Member Functions

 ThreadCameraStreamData (bool rightHanded, double unitScale, bool deferred)
 constructor More...
 
virtual ~ThreadCameraStreamData ()
 destructor
 
const CameraGetCamera (void) const
 These are the only public methods you need to use to render multiple views using multiple threads with/without command lists. More...
 
CameraGetCamera (void)
 get the associated camera (non-const)
 
int Initialize (int rendererType, bool rightHanded, void *environment, bool avoidStalls)
 Initialize the ThreadCameraStreamData (call first) More...
 
void Initialize (const Atmosphere &atmosphere)
 Initialize the ThreadCameraStreamData for a given Atmosphere object (call 2nd) More...
 
bool IsInitialized (void) const
 Whether initialized.
 
void ExecuteStream (void)
 Execute the command list for this object. More...
 
void SetUserData (const void *userPointer, TcsUserData *userData)
 !!!!Do Not Use!!!! !!!!Internal methods!!!! These should not be used by application developers!! More...
 
TcsUserDataGetUserData (const void *userPointer)
 get a user pointer and the user data associated with it, if it exists null otherwise
 
bool UserDataExists (const void *userPointer) const
 whether user data exists for a user pointer
 
void EraseUserData (const void *userPointer)
 erase user data associated with this layer (just erases the entry)
 
void SetCloudLayerTcsUserData (const CloudLayer *cloudLayer, TcsUserData *userData)
 These are named variations of the 3 functions above. More...
 
TcsUserDataGetCloudLayerTcsUserData (const CloudLayer *cloudLayer)
 get the name with userDataName as the key
 
bool CloudLayerTcsUserDataExists (const CloudLayer *cloudLayer)
 exists?
 
void EraseCloudLayerTcsUserData (const CloudLayer *cloudLayer)
 erase user data associated with this layer (just erases the entry)
 
Renderer * GetRenderer (void)
 internal. do not use directly
 
const Renderer * GetRenderer (void) const
 internal. do not use directly
 
const BillboardRenderingParameters * GetBillboardRenderingParams (void) const
 internal. Do not use directly. Get the parameters, const version
 
BillboardRenderingParameters * GetBillboardRenderingParams (void)
 internal. Do not use directly. Get the parameters, non-const version
 
const MetaballRenderingParameters * GetMetaballRenderingParams (void) const
 internal. Do not use directly. Get the parameters, const version
 
MetaballRenderingParameters * GetMetaballRenderingParams (void)
 internal. Do not use directly. Get the parameters, non-const version
 
const BillboardRenderer * GetBillboardRenderer (void) const
 internal. Do not use directly. Get the billboard renderer, const version
 
BillboardRenderer * GetBillboardRenderer (void)
 internal. Do not use directly. Get the billboard renderer, non-const version
 
const CloudRenderingParameters * GetCloudRenderingParams (void) const
 internal. Do not use directly. Get the parameters, const version
 
CloudRenderingParameters * GetCloudRenderingParams (void)
 internal. Do not use directly. Get the parameters, non-const version
 
const CumulusCloudRenderingParameters * GetCumulusCloudRenderingParams (void) const
 internal. Do not use directly. Get the parameters, const version
 
CumulusCloudRenderingParameters * GetCumulusCloudRenderingParams (void)
 internal. Do not use directly. Get the parameters, non-const version
 
const LuminanceMapper * GetLuminanceMappper (void) const
 internal. Do not use directly. Get the parameters, const version
 
LuminanceMapper * GetLuminanceMappper (void)
 internal. Do not use directly. Get the parameters, non-const version
 
bool GetIsDrawingEnvMap () const
 internal. Do not use directly. Whether drawing env map currently
 
void SetIsDrawingEnvMap (bool val)
 internal. Do not use directly. Set drawing env map to true/false
 
bool GetIsDrawingShadowMap () const
 internal. Do not use directly. Whether drawing shadow map currently
 
void SetIsDrawingShadowMap (bool val)
 internal. Do not use directly. Set drawing shadow map to true/false
 
bool GetSortByScreenDepth (void) const
 internal. Do not use directly. Get sort screen depth
 
void SetSortByScreenDepth (bool val)
 internal. Do not use directly. Set sort screen depth More...
 
const BillboardShader * GetBillboardShader (void) const
 internal. do not use!
 
const BillboardShader * GetBillboardShaderInstanced (void) const
 internal. do not use!
 
void ReloadShaders (void)
 internal. do not use!
 
void Shutdown (void)
 internal. do not use!
 
void DeviceLost (void)
 internal. do not use!
 
void DeviceReset (void)
 internal. do not use!
 
void FrameStarted ()
 internal. do not use!
 
void SetContext ()
 internal. do not use!
 
void ReloadBillboardShader (void)
 internal. do not use!
 
const SkyShaders * GetSkyShaders (bool simpleShader) const
 internal. do not use!
 
void ReloadSkyShaders (void)
 internal. do not use!
 
const StratocumulusShaders * GetStratocumulusShaders (void) const
 internal. do not use!
 
void ReloadStratocumulusShaders (void)
 internal. do not use!
 
const FlareShader * GetFlareShader (void) const
 internal. do not use!
 
const CirrusShader * GetCirrusShader (void) const
 internal. do not use!
 
void ReloadCirrusShader (void)
 internal. do not use!
 
const StratusShader * GetStratusShader (void) const
 internal. do not use!
 
void ReloadStratusShader (void)
 internal. do not use!
 
const StarShader * GetStarShader (void) const
 internal. do not use!
 
void ReloadStarShader (void)
 internal. do not use!
 
const GlareShader * GetGlareShader (void) const
 internal. do not use!
 
GlareShader * GetGlareShader (void)
 internal. do not use!
 
const AtmosphereFromSpaceShader * GetAtmosphereFromSpaceShader (bool doShadow) const
 internal. do not use!
 
bool GetDeferred (void) const
 get whether internal stream/context is a deferred stream call before initialize!
 
CrepuscularRays * GetCrepuscularRays (void)
 internal. do not use!
 
const CrepuscularRays * GetCrepuscularRays (void) const
 internal. do not use!
 
Sky * GetSky (void)
 internal. do not use!
 
const Sky * GetSky (void) const
 internal. do not use!
 
LensFlare * GetLensFlare (void)
 internal. do not use!
 
const LensFlare * GetLensFlare (void) const
 internal. do not use!
 
bool GetIsDrawingSky (void) const
 internal. do not use!
 
bool GetIsDrawingObjects (void) const
 internal. do not use!
 
void SetIsDrawingSky (bool val)
 internal. do not use!
 
void SetIsDrawingObjects (bool val)
 internal. do not use!
 
void SetForceImmediate (bool val)
 internal. do not use!
 
bool GetForceImmediate (void) const
 internal. do not use!
 
const PrecipitationShaders * GetPrecipitationShaders (void) const
 internal. do not use!
 
PrecipitationShaders * GetPrecipitationShaders (void)
 internal. do not use!
 
void SetUpAndRightVector (const Vector3 &upVector, const Vector3 &rightVector)
 Helper function to set up the up and right vector on the Camera of this tcs data.
 
const PrecipitationManager * GetPrecipitationManager (void) const
 internal. do not use!
 
PrecipitationManager * GetPrecipitationManager (void)
 internal. do not use!
 
void InitializePrecipitationManager (const Atmosphere &atmosphere)
 internal. do not use!
 
bool GetPrecipitationEnabled (void) const
 internal. do not use!
 
const ShadowMap * GetOrCreateShadowMap (const Atmosphere &atmosphere) const
 internal. do not use!
 
ShadowMap * GetOrCreateShadowMap (const Atmosphere &atmosphere)
 internal. do not use!
 
const ShadowMap * GetShadowMapObject (void) const
 internal. do not use!
 
int GetShadowMapDim () const
 internal. do not use!
 
void DeleteShadowMap (void)
 internal. do not use!
 
void DeleteEnvironmentMaps (void)
 internal. do not use!
 
const MetaballTextureManager * GetMetaballTextureManager (void) const
 internal. do not use!
 
void setCreateTextures (bool create)
 internal. do not use!
 
bool GetEnvironmentMap (EnvironmentMap *&environmentMap, Atmosphere &atmosphere, void *&texture, int facesToRender=6, bool floatingPoint=false, CameraHandle cameraID=0, bool drawClouds=true, bool drawSunAndMoon=true, bool geocentricMode=false)
 internal. do not use!
 
bool DrawIndirect () const
 internal. do not use!
 

Detailed Description

This class is the main interface to thread safe rendering with SilverLining.

The class represents the concept of thread local storage: https://en.wikipedia.org/wiki/Thread-local_storage

The 'thread' part of the name represents each separate thread (and hence each instance of this class) that we wish to render from in a thread safe fashion.

The 'camera' part of the name represents each view(e.g. window/offscreen view) that you wish to render from in a thread safe fashion in the corresponding thread.

This typically also corresponds to an OpenGL context (you can share OpenGL contexts or not) or an immediate/deferred DirectX context.

The 'stream' part of the name represents the command stream (OpenGL/Vulkan) or the immediate/deferred context commands (DX 11, 11.1) being generated for a given thread, view.

As an example, to render 3 views (one main view, and 2 offscreen views).

Below are then the steps you follow to render everything in a thread safe fashion:

A few notes:

So make sure to pass the pointer to the object of the thread/camera(view)/stream in question in the same order/position/context of which thread/camera(view)/stream is in question.

Multi-Threading:

Deferred Rendering:

!!NOTE!!

Constructor & Destructor Documentation

◆ ThreadCameraStreamData()

SilverLining::ThreadCameraStreamData::ThreadCameraStreamData ( bool  rightHanded,
double  unitScale,
bool  deferred 
)

constructor

Parameters
rightHandedSet this the same as the initialized Atmosphere.
See also
Atmosphere::Initialize()
Parameters
unitScaleSet this the same as the initialized Atmosphere.
See also
Atmosphere::GetUnitScale(), Atmosphere::SetWorldUnits()
Parameters
deferredSet whether this tcsData uses deferred rendering.

Member Function Documentation

◆ ExecuteStream()

void SilverLining::ThreadCameraStreamData::ExecuteStream ( void  )

Execute the command list for this object.

See documentation above on 'deferred rendering'.

◆ GetCamera()

const Camera* SilverLining::ThreadCameraStreamData::GetCamera ( void  ) const

These are the only public methods you need to use to render multiple views using multiple threads with/without command lists.

get the associated camera

◆ Initialize() [1/2]

int SilverLining::ThreadCameraStreamData::Initialize ( int  rendererType,
bool  rightHanded,
void *  environment,
bool  avoidStalls 
)

Initialize the ThreadCameraStreamData (call first)

Parameters
rendererTypeThe renderer type. The same as the type passed in to Atmosphere::Initialize
rightHandedright handed or left handed system. The same as the type passed in to Atmosphere
environmentThe same value as the one passed in to Atmosphere::Initialize
avoidStallsIf you with to do any combination of multi-threaded rendering and deferred you need to set this config option on the Atmosphere: atmosphere->SetConfigOption("avoid-opengl-stalls", "yes"); and pass the same value (true)

◆ Initialize() [2/2]

void SilverLining::ThreadCameraStreamData::Initialize ( const Atmosphere atmosphere)

Initialize the ThreadCameraStreamData for a given Atmosphere object (call 2nd)

Parameters
environmentThe atmosphere against which this tcsData is being initialized

◆ SetCloudLayerTcsUserData()

void SilverLining::ThreadCameraStreamData::SetCloudLayerTcsUserData ( const CloudLayer cloudLayer,
TcsUserData userData 
)

These are named variations of the 3 functions above.

set the name with userDataName as the key

◆ SetSortByScreenDepth()

void SilverLining::ThreadCameraStreamData::SetSortByScreenDepth ( bool  val)

internal. Do not use directly. Set sort screen depth

Set whether objects should be sorted by screen depth or distance from the view

◆ SetUserData()

void SilverLining::ThreadCameraStreamData::SetUserData ( const void *  userPointer,
TcsUserData userData 
)

!!!!Do Not Use!!!! !!!!Internal methods!!!! These should not be used by application developers!!

set a user pointer and the user data associated with it


The documentation for this class was generated from the following file: