NAP
Public Member Functions | List of all members
ParameterBlendComponentInstance Class Reference

#include <parameterblendcomponent.h>

Public Member Functions

 ParameterBlendComponentInstance (EntityInstance &entity, Component &resource)
 
 ~ParameterBlendComponentInstance ()
 
virtual bool init (utility::ErrorState &errorState) override
 
virtual void update (double deltaTime) override
 
bool enabled () const
 
void enable (bool value)
 
bool isBlending () const
 
float getBlendValue ()
 
int getIndex () const
 
const std::vector< std::string > & getPresets () const
 
bool reload (nap::utility::ErrorState &error)
 
bool hasPresets () const
 
- Public Member Functions inherited from ComponentInstance
 ComponentInstance (EntityInstance &entity, Component &resource)
 
nap::EntityInstancegetEntityInstance () const
 
nap::ComponentgetComponent () const
 
template<typename T >
T * getComponent () const
 
virtual bool init (utility::ErrorState &errorState)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Description

Runtime part of the parameter blend component. Smoothly blends a set of parameters over time towards a given preset. The parameters that are blended are defined by the 'BlendGroup' of the resource. The preset index controls the preset to sample the parameters from.

A blender needs to be available for every parameter that is blended. The system issues a warning on initialization when there is no blender available for a specific parameter. By default float, double, vec2, vec3 and color parameters are supported. If a preset does not contain a specific parameter a warning is issued.

Inheritance diagram for ParameterBlendComponentInstance:
[legend]
Collaboration diagram for ParameterBlendComponentInstance:
[legend]

Constructor & Destructor Documentation

◆ ParameterBlendComponentInstance()

◆ ~ParameterBlendComponentInstance()

Member Function Documentation

◆ enable()

void enable ( bool  value)

Turns blending on / off.

Parameters
valueif blending is turned on

◆ enabled()

bool enabled ( ) const

Returns if blending is enabled. Preset changes without blending enabled have no effect.

Returns
if blending is enabled.

◆ getBlendValue()

float getBlendValue ( )
Returns
current blend value from 0 - 1

◆ getIndex()

int getIndex ( ) const
Returns
current preset index

◆ getPresets()

const std::vector<std::string>& getPresets ( ) const
Returns
the names of all the presets that can be blended.

◆ hasPresets()

bool hasPresets ( ) const
Returns
if there are any presets to blend

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initializes the component. All presets associated with the 'RootGroup' of the 'BlendGroup' are sourced from disk. A blender is created for every parameter and stored for future use on update.

Parameters
errorStatecontains the error message if initialization fails.
Returns
if initialization succeeded.

Reimplemented from ComponentInstance.

◆ isBlending()

bool isBlending ( ) const
Returns
if the component is currently blending.

◆ reload()

bool reload ( nap::utility::ErrorState error)

Reloads all the presets from disk.

Parameters
errorcontains the error if reloading fails.
Returns
if reloading the presets succeeded.

◆ update()

virtual void update ( double  deltaTime)
overridevirtual

Blends the parameter values.

Parameters
deltaTimetime in between frames in seconds.

Reimplemented from ComponentInstance.