This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::Player Class

Interface for player handling. See also the UnigineScript analog.

To use this class, include the UniginePlayer.h file.

Unigine::Player Class

Members


static Ptr< Player > create (const NodePtr & node)

Player constructor.

Arguments

  • const NodePtr & node - Node smart pointer.

virtual Ptr< Player > getPlayer () const =0

Returns a player pointer.

Return value

The player pointer.

virtual void setViewportMask (int mask) const =0

Sets a viewport mask. Object surfaces, materials, decals, lights and GUI objects will be rendered into the viewport only if their viewport mask matches the player's one (one matching bit is enough).

Arguments

  • int mask - Viewport mask (integer, each bit of which is a mask).

virtual int getViewportMask () const =0

Returns the current viewport mask. Object surfaces, materials, decals, lights and GUI objects will be rendered into the viewport only if their viewport mask matches the player's one (one matching bit is enough).

Return value

Viewport mask (integer, each bit of which is a mask).

virtual void setReflectionMask (int mask) const =0

Sets a reflection mask for rendering reflections into the viewport. Reflections are rendered in the viewport if masks of reflective materials match this one.

Arguments

  • int mask - Reflection mask (integer, each bit of which is a mask).

virtual int getReflectionMask () const =0

Returns the current reflection mask used for rendering reflections into the viewport. Reflections are rendered in the viewport if masks of reflective materials match this one.

Return value

Reflection mask (integer, each bit of which is a mask).

virtual void setSourceMask (int mask) const =0

Sets a source mask that determines sound sources, which can be heard. For a sound source to be heard, its mask should match with this one in at least one bit. Plus, the volume of sound channel in which the sound plays (its number also depends on this mask) should not be equal to 0.

Arguments

  • int mask - Source mask (integer, each bit of which specifies a sound channel).

virtual int getSourceMask () const =0

Returns the source mask that determines sound sources, which can be heard. For a sound source to be heard, its mask should match with this one in at least one bit. Plus, the volume of sound channel in which the sound plays (its number also depends on this mask) should not be equal to 0.

Return value

Source mask (integer, each bit of which specifies a sound channel).

virtual void setReverbMask (int mask) const =0

Sets a reverb mask that determines reverberation zones, which can be heard. For sound to reverberate, at least one bit of this mask should match with a reverb mask of the sound source and a reverb mask of the reverberation zone. Masks of a sound source and reverberation zone can match with the player's one in different bits, not necessarily one.

Arguments

  • int mask - Reverb mask (integer, each bit of which is a mask for reverberating sound sources and reverberation zones).

virtual int getReverbMask () const =0

Returns the reverb mask that determines reverberation zones, which can be heard. For sound to reverberate, at least one bit of this mask should match with a reverb mask of the sound source and a reverb mask of the reverberation zone. Masks of a sound source and reverberation zone can match with the player's one in different bits, not necessarily one.

Return value

Reverb mask (integer, each bit of which is a mask for reverberating sound sources and reverberation zones).

virtual void setFov (float fov) const =0

Sets a field of view of the player. The default is 60 degrees.

Arguments

  • float fov - Field of view in degrees. The provided value will be saturated in the range [0; 180].

virtual float getFov () const =0

Returns the current field of view of the player. The default is 60 degrees.

Return value

Current field of view in degrees.

virtual void setZNear (float znear) const =0

Sets a distance to the near clipping plane of the player's viewing frustum. The default is 0.1 units.

Arguments

  • float znear - Distance to the near clipping plane in units. The minimum value is 0.

virtual float getZNear () const =0

Returns the distance to the near clipping plane of the player's viewing frustum. The default is 0.1 units.

Return value

Distance to the near clipping plane in units.

virtual void setZFar (float zfar) const =0

Sets a distance to the far clipping plane of the player's viewing frustum. The default is 10000 units.

Arguments

  • float zfar - Distance to the far clipping plane in units. The minimum value is 0.

virtual float getZFar () const =0

Returns the current distance to the far clipping plane of the player's viewing frustum. The default is 10000 units.

Return value

Distance to the far clipping plane in units.

virtual void setProjection (const mat4 & projection) const =0

Sets a projection matrix.

Arguments

  • const mat4 & projection - New projection matrix.

virtual mat4 getProjection () const =0

Returns the current projection matrix.

Return value

Current projection matrix.

virtual void setSProjection (const mat4 & sprojection) const =0

Sets a shader projection matrix.

Arguments

  • const mat4 & sprojection - New shader projection matrix.

virtual mat4 getSProjection () const =0

Returns the current shader projection matrix.

Return value

Current shader projection matrix.

virtual void setModelview (const UNIGINE_MAT4 & modelview) const =0

Sets a new modelview matrix.

Arguments

  • const UNIGINE_MAT4 & modelview - New modelview matrix.

virtual UNIGINE_MAT4 getModelview () const =0

Returns the current modelview matrix.

Return value

Current modelview matrix.

virtual UNIGINE_MAT4 getIModelview () const =0

Returns the current inverse modelview matrix.

Return value

Inverse modelview matrix.

virtual void setOldModelview (const UNIGINE_MAT4 & modelview) const =0

Sets the modelview matrix to be used as a previous frame matrix.

Arguments

  • const UNIGINE_MAT4 & modelview - Old modelview matrix.

virtual UNIGINE_MAT4 getOldModelview () const =0

Returns the modelview matrix of the player used in the previous frame.

Return value

Old modelview matrix.

virtual void setUp (const vec3 & up) const =0

Sets an up direction of the player's viewport (i.e. tilt of the player's viewport).

Arguments

  • const vec3 & up - New upward direction vector. The vector is normalized to 1.

virtual vec3 getUp () const =0

Returns the current up direction of the player's viewport (i.e. tilt of the player's viewport).

Return value

Upward direction vector.

virtual void setView (const vec3 & view) const =0

Sets the viewing orientation of the player. The result is the same as using phi and theta angles, but this function takes a vector as an argument.

Arguments

  • const vec3 & view - View direction vector.

virtual vec3 getView () const =0

Returns the current viewing orientation of the player. The result is the same as using phi and theta angles, but this function returns a vector.

Return value

View direction vector.

virtual void setOffset (const mat4 & offset) const =0

Sets an offset matrix for the player. This transformation is applied after the model-view transformation. It does not affect it or the position of the player. For example, the offset matrix can be used to set player's head position (in case the player turns his head) or to simulate camera shake from an explosion.

Arguments

  • const mat4 & offset - Offset matrix.

virtual mat4 getOffset () const =0

Returns the current offset matrix. This transformation is applied after the model-view transformation. It does not affect it or the position of the player. For example, the offset matrix can be used to set player's head position (in case the player turns his head) or to simulate camera shake from an explosion. The default value is mat4_identity (identity matrix).

Return value

Current offset matrix.

virtual void setVelocity (const vec3 & velocity) const =0

Sets a new velocity for the player. In case of PlayerActor, this function is valid only when the player is not simulated physically (setPhysical() is set to 0). If it is, moving PlayerActor is done via accessing its body.

Arguments

  • const vec3 & velocity - New velocity in units per second.

virtual vec3 getVelocity () const =0

Returns the current velocity of the player.

Return value

Velocity in units per second.

virtual void setPostMaterials (const char * materials) const =0

Sets postprocess materials that are applied after all other postprocess (such as HDR, DOF, etc.) are rendered.

Arguments

  • const char * materials - Comma-separated list of names of postprocess materials.

virtual const char * getPostMaterials () const =0

Returns names of postprocess materials applied after all other postprocess (such as HDR, DOF, etc.) are rendered.

Return value

Comma-separated list of names of postprocess materials.

virtual void setControlled (int controlled) const =0

Disables or enables the player controls.

Arguments

  • int controlled - 1 to disable the player controls (player stops responding to them), 0 to enable the controls.

virtual int isControlled () const =0

Returns a value indicating whether player controls are disabled (player does not respond to them) or enabled.

Return value

1 if player controls are disabled; otherwise, 0.

virtual void setControls (const ControlsPtr & controls) const =0

Sets a Controls smart pointer that will hold settings of input controls relevant to the player.

Arguments

  • const ControlsPtr & controls - Controls smart pointer used to handle input controls.

virtual ControlsPtr getControls () const =0

Returns a Controls smart pointer that holds settings of input controls relevant to the player.

Return value

Controls smart pointer used to handle input controls.

virtual void updateControls (float ifps) const =0

Gets the current player's parameters (impulse, direction, velocity etc) according to user input. After the input has been updated, flushTransform() should be called manually to apply it to the player.

Arguments

  • float ifps - Frame duration in seconds.

virtual void flushTransform () const =0

Forces to immediately set transformations to the player. This function should be called manually after user input has been updated via updateControls().
Last update: 2017-07-03
Build: ()