Photon Quantum 3.0.0

Classes | Public Member Functions | Public Attributes | Properties | List of all members
Quantum.Core.FrameContext Class Reference

The FrameContext is shared between individual transient FrameBase instances. More...

Inheritance diagram for Quantum.Core.FrameContext:
Quantum.FrameContextUser

Classes

struct  Args
 The FrameContext creating arguments. More...
 

Public Member Functions

 FrameContext (Args args)
 Create a new instance of the FrameContext using the . More...
 
AcquireEvent< T > (int id)
 Creates a new event object from the pool. More...
 
virtual void Dispose ()
 Dispose internal subsystems and free allocated memory. More...
 
Boolean InPredictionArea (DeterministicFrame frame, FPVector2 position)
 
virtual Boolean InPredictionArea (DeterministicFrame frame, FPVector3 position)
 This method determines if a position is inside the prediction area. More...
 
bool IsLocalPlayer (PlayerRef player)
 Don't use this in the simulation that affect the state because it is different on each client and will lead to desyncs. More...
 
void OnFrameSimulationBegin (FrameBase f)
 Forwards frame simulation begin event to internal subsystems. More...
 
void OnFrameSimulationEnd ()
 Forwards frame simulation end event to internal subsystems. More...
 
void OnGameStart (DeterministicFrame f)
 Callback required to start the heap tracking. More...
 
void OnSimulationBegin ()
 Forwards simulation begin event to internal subsystems. More...
 
void OnSimulationEnd ()
 Forwards simulation end event to internal subsystems. More...
 
void ReleaseEvent (EventBase evnt)
 Release an event object and return it to the pool More...
 
void SetPredictionArea (FPVector3 center, FP radius)
 Sets the prediction area. Entities outside this area are culled from predicted frames. More...
 
void * TempAllocate (int size, int alignment=8)
 Allocates memory that is released during OnFrameSimulationEnd. More...
 
void * TempAllocateAndClear (int size, int alignment=8)
 .
 

Public Attributes

AssetDB AssetDB => new AssetDB(_resourceManager)
 Obsolete. Use ResourceManager instead. More...
 
PhysicsCommon.Config PhysicsConfig => _physicsConfig
 Access the global physics configuration. More...
 

Properties

Native.Allocator Allocator [get]
 Access the native allocator. More...
 
IAssetSerializer AssetSerializer [get]
 Access the the asset serializer. More...
 
DeterministicCommandSerializer CommandSerializer [get]
 Access the command serializer. More...
 
FrameBase.Culling Culling [get]
 Access the culling subsystem. More...
 
EventList Events [get]
 Access the current stored events. More...
 
IHeapAllocationTracker HeapTracker [get]
 Access the heap tracker. More...
 
HeapTrackingMode HeapTrackingMode [get]
 Return the heap tracking mode that the FrameContext was created with. More...
 
bool IsServer [get]
 Returns true if the FrameContext was started with Args.IsServer enabled. More...
 
Physics2D.PhysicsEngine2D Physics2D [get]
 Access the 2D physics API. More...
 
Physics3D.PhysicsEngine3D Physics3D [get]
 Access the 3D physics API. More...
 
FPVector3 PredictionAreaCenter [get]
 Return the current prediction culling circle area center. More...
 
FP PredictionAreaRadius [get]
 Return the current prediction culling circle area radius. More...
 
Profiling.ProfilerContext ProfilerContext [get]
 Access the profiler context. More...
 
IResourceManager ResourceManager [get]
 Access the resource manager. More...
 
FrameSerializer SharedChecksumSerializer [get]
 Access the shared checksum serializer. More...
 
TaskContext TaskContext [get]
 Access the task context. More...
 
bool UseSharedChecksumSerializer [get]
 Returns true is Args.UseSharedChecksumSerialized was set. More...
 

Detailed Description

The FrameContext is shared between individual transient FrameBase instances.

It controls systems like Quantum events, profilers, tasks, culling and subsystems for physics and navigation allocating reused memory.

Constructor & Destructor Documentation

◆ FrameContext()

Quantum.Core.FrameContext.FrameContext ( Args  args)
inline

Create a new instance of the FrameContext using the .

Member Function Documentation

◆ IsLocalPlayer()

bool Quantum.Core.FrameContext.IsLocalPlayer ( PlayerRef  player)
inline

Don't use this in the simulation that affect the state because it is different on each client and will lead to desyncs.

Parameters
playerPlayer ref
Returns
true if the player is controlled by the local simulation.

◆ OnGameStart()

void Quantum.Core.FrameContext.OnGameStart ( DeterministicFrame  f)
inline

Callback required to start the heap tracking.

◆ OnSimulationBegin()

void Quantum.Core.FrameContext.OnSimulationBegin ( )
inline

Forwards simulation begin event to internal subsystems.

◆ OnSimulationEnd()

void Quantum.Core.FrameContext.OnSimulationEnd ( )
inline

Forwards simulation end event to internal subsystems.

◆ OnFrameSimulationBegin()

void Quantum.Core.FrameContext.OnFrameSimulationBegin ( FrameBase  f)
inline

Forwards frame simulation begin event to internal subsystems.

◆ OnFrameSimulationEnd()

void Quantum.Core.FrameContext.OnFrameSimulationEnd ( )
inline

Forwards frame simulation end event to internal subsystems.

◆ TempAllocate()

void* Quantum.Core.FrameContext.TempAllocate ( int  size,
int  alignment = 8 
)
inline

Allocates memory that is released during OnFrameSimulationEnd.

Parameters
sizeThe memory size in bytes.
alignmentThe expected memory alignment.
Returns
Allocated memory.

◆ Dispose()

virtual void Quantum.Core.FrameContext.Dispose ( )
inlinevirtual

Dispose internal subsystems and free allocated memory.

Reimplemented in Quantum.FrameContextUser.

◆ AcquireEvent< T >()

T Quantum.Core.FrameContext.AcquireEvent< T > ( int  id)
inline

Creates a new event object from the pool.

Template Parameters
TThe event type.
Parameters
idThe event id.
Returns
New or reused event object.
Type Constraints
T :EventBase 
T :new() 

◆ ReleaseEvent()

void Quantum.Core.FrameContext.ReleaseEvent ( EventBase  evnt)
inline

Release an event object and return it to the pool

Parameters
evntEvent to release.

◆ SetPredictionArea()

void Quantum.Core.FrameContext.SetPredictionArea ( FPVector3  center,
FP  radius 
)
inline

Sets the prediction area. Entities outside this area are culled from predicted frames.

Parameters
centerThe center of the area of interest circle.
radiusThe radius of the area if ínterest circle.

◆ InPredictionArea()

virtual Boolean Quantum.Core.FrameContext.InPredictionArea ( DeterministicFrame  frame,
FPVector3  position 
)
inlinevirtual

This method determines if a position is inside the prediction area.

This method can be overwritten to support custom shapes.

Parameters
frameThe current frame.
positionThe position to check.
Returns
true if the position is inside the prediction area.

Member Data Documentation

◆ AssetDB

AssetDB Quantum.Core.FrameContext.AssetDB => new AssetDB(_resourceManager)

Obsolete. Use ResourceManager instead.

◆ PhysicsConfig

PhysicsCommon.Config Quantum.Core.FrameContext.PhysicsConfig => _physicsConfig

Access the global physics configuration.

Property Documentation

◆ Physics2D

Physics2D.PhysicsEngine2D Quantum.Core.FrameContext.Physics2D
get

Access the 2D physics API.

◆ Physics3D

Physics3D.PhysicsEngine3D Quantum.Core.FrameContext.Physics3D
get

Access the 3D physics API.

◆ Allocator

Native.Allocator Quantum.Core.FrameContext.Allocator
get

Access the native allocator.

◆ TaskContext

TaskContext Quantum.Core.FrameContext.TaskContext
get

Access the task context.

◆ ProfilerContext

Profiling.ProfilerContext Quantum.Core.FrameContext.ProfilerContext
get

Access the profiler context.

◆ Events

EventList Quantum.Core.FrameContext.Events
get

Access the current stored events.

◆ Culling

FrameBase.Culling Quantum.Core.FrameContext.Culling
get

Access the culling subsystem.

◆ CommandSerializer

DeterministicCommandSerializer Quantum.Core.FrameContext.CommandSerializer
get

Access the command serializer.

◆ AssetSerializer

IAssetSerializer Quantum.Core.FrameContext.AssetSerializer
get

Access the the asset serializer.

◆ ResourceManager

IResourceManager Quantum.Core.FrameContext.ResourceManager
get

Access the resource manager.

◆ UseSharedChecksumSerializer

bool Quantum.Core.FrameContext.UseSharedChecksumSerializer
get

Returns true is Args.UseSharedChecksumSerialized was set.

◆ SharedChecksumSerializer

FrameSerializer Quantum.Core.FrameContext.SharedChecksumSerializer
get

Access the shared checksum serializer.

◆ HeapTrackingMode

HeapTrackingMode Quantum.Core.FrameContext.HeapTrackingMode
get

Return the heap tracking mode that the FrameContext was created with.

◆ HeapTracker

IHeapAllocationTracker Quantum.Core.FrameContext.HeapTracker
get

Access the heap tracker.

◆ IsServer

bool Quantum.Core.FrameContext.IsServer
get

Returns true if the FrameContext was started with Args.IsServer enabled.

◆ PredictionAreaCenter

FPVector3 Quantum.Core.FrameContext.PredictionAreaCenter
get

Return the current prediction culling circle area center.

◆ PredictionAreaRadius

FP Quantum.Core.FrameContext.PredictionAreaRadius
get

Return the current prediction culling circle area radius.