Class AgentVis

Class Documentation

class AgentVis

This provides an interface for managing the render options for all agents of a specific type State() can be called to specialise options for agents within a specific state TODO: Block everything non-const from being called whilst VIS is active

Public Functions

explicit AgentVis(CUDAAgent &agent, const std::shared_ptr<AutoPalette> &autopalette = nullptr)

Note

Agent states only receive colors from the autopalette when AgentVis::State() is called for each state

Note

By default, all states share the same color from the autopalette

Parameters
  • agent – The CUDAAgent this class is configuring the visualisation for

  • autopalette – Automatic source of colors for individual agent states

AgentStateVis &State(const std::string &state_name)

Returns the configuration handler for the named state On first use for each state this will assign the state a color from the AutoPalette if available Clear the autopalette first if you wish for it to use the default color

void setXVariable(const std::string &var_name)

Set the name of the variable representing the agents x/y/z location coordinates

Note

unnecessary if the variables are named “x”, “y”, “z” respectively

Parameters

var_name – Name of the agent variable

void setYVariable(const std::string &var_name)
void setZVariable(const std::string &var_name)
void setForwardXVariable(const std::string &var_name)

Set the name of the variable representing the agents x/y/z direction vector components Single axis rotation only requires x/z components Double axis rotation requires all 3 components Triple axis rotation requires all 3 components and additionally all 3 Up components

See

setYawVariable(const std::string&)

See

setPitchVariable(const std::string&)

Note

setForwardXVariable() and setForwardZVariable() are an alternate to providing a yaw angle, setting either of these will erase yaw if bound

Note

setForwardYVariable() is an alternate to providing a pitch angle, setting this will erase pitch if bound

Note

Forward is a synonym for Direction

Parameters

var_name – Name of the agent variable

void setForwardYVariable(const std::string &var_name)
void setForwardZVariable(const std::string &var_name)
void setUpXVariable(const std::string &var_name)

Set the name of the variable representing the agents x/y/z UP vector This should be 90 degrees perpendicular to the direction vector

See

setRollVariable(const std::string&)

Note

setUpXVariable(), setUpYVariable() and setUpZVariable() are an alternate to providing a roll angle, setting any of these will erase roll if bound

Parameters

var_name – Name of the agent variable

void setUpYVariable(const std::string &var_name)
void setUpZVariable(const std::string &var_name)
void setYawVariable(const std::string &var_name)

Set the name of the variable representing the agents yaw rotation angle (radians)

See

setForwardXVariable(const std::string&)

See

setForwardZVariable(const std::string&)

Note

This is an alternate to providing a direction vector, setting this will erase forward x/z if bound

Note

Heading is a synonym for Yaw

Parameters

var_name – Name of the agent variable

void setPitchVariable(const std::string &var_name)

Set the name of the variable representing the agents pitch rotation angle (radians)

See

setForwardYVariable(const std::string&)

Note

This is an alternate to providing a direction vector, setting this will erase forward y if bound

Parameters

var_name – Name of the agent variable

void setRollVariable(const std::string &var_name)

Set the name of the variable representing the agents yaw rotation angle (radians)

See

setUpXVariable(const std::string&)

See

setUpYVariable(const std::string&)

See

setUpZVariable(const std::string&)

Note

This is an alternate to providing an UP vector, setting this will erase up x/y/z if bound

Note

Bank is a synonym for Roll

Parameters

var_name – Name of the agent variable

void setUniformScaleVariable(const std::string &var_name)

Set the name of the variable representing the agents uniform scale multiplier

The scale multiplier is multiplied by the model scale

See

setScaleXVariable(const std::string&)

See

setScaleYVariable(const std::string&)

See

setScaleZVariable(const std::string&)

See

setModelScale(float)

See

setModelScale(float, float, float)

Note

This is an alternate to providing individual scale components, setting this will erase scale x/y/z if bound

Parameters

var_name – Name of the agent variable

void setScaleXVariable(const std::string &var_name)

Set the name of the variable representing the agents x/y/z scale multiplier components It is not necessary to set all 3 components if only 1 or 2 are required. Unset values will be treated as a 1.0 multiplier

The scale multiplier is multiplied by the model scale

See

setUniformScaleVariable(const std::string&)

See

setModelScale(float)

See

setModelScale(float, float, float)

Note

This is an alternate to providing a single uniform scale multiplier, setting this will erase uniform scale if bound

Parameters

var_name – Name of the agent variable

void setScaleYVariable(const std::string &var_name)
void setScaleZVariable(const std::string &var_name)
void clearXVariable()

Clears the agent’s x/y/z location variable bindings

See

setXVariable(conCst std::string &)

See

setYVariable(conCst std::string &)

See

setZVariable(conCst std::string &)

void clearYVariable()
void clearZVariable()
void clearForwardXVariable()

Clears the agent’s x/y/z forward variable bindings

See

setForwardXVariable(const std::string &)

See

setForwardYVariable(const std::string &)

See

setForwardZVariable(const std::string &)

void clearForwardYVariable()
void clearForwardZVariable()
void clearUpXVariable()

Clears the agent’s x/y/z UP variable bindings

See

setUpXVariable(const std::string &)

See

setUpYVariable(const std::string &)

See

setUpZVariable(const std::string &)

void clearUpYVariable()
void clearUpZVariable()
void clearYawVariable()

Clears the agent’s yaw angle variable bindings

See

setYawVariable(const std::string &)

void clearPitchVariable()

Clears the agent’s pitch angle variable bindings

See

setPitchVariable(const std::string &)

void clearRollVariable()

Clears the agent’s roll angle variable bindings

See

setRollVariable(const std::string &)

void clearUniformScaleVariable()

Clears the agent’s uniform scale multiplier variable bindings

See

setUniformScaleVariable(const std::string &)

void clearScaleXVariable()

Clears the agent’s x/y/z scale multiplier variable bindings

See

setScaleXVariable(const std::string &)

See

setScaleYVariable(const std::string &)

See

setScaleZVariable(const std::string &)

void clearScaleYVariable()
void clearScaleZVariable()
std::string getXVariable() const

Returns the variable used for the agent’s x/y/z location coordinates

std::string getYVariable() const
std::string getZVariable() const
std::string getForwardXVariable() const

Returns the variable used for the agent’s x/y/z forward vector components

std::string getForwardYVariable() const
std::string getForwardZVariable() const
std::string getUpXVariable() const

Returns the variable used for the agent’s x/y/z up vector components

std::string getUpYVariable() const
std::string getUpZVariable() const
std::string getYawVariable() const

Returns the variable used for the agent’s yaw angle

std::string getPitchVariable() const

Returns the variable used for the agent’s pitch angle

std::string getRollVariable() const

Returns the variable used for the agent’s roll angle

std::string getUniformScaleVariable() const

Returns the variable used for the agent’s uniform scaling multiplier

std::string getScaleXVariable() const

Returns the variable used for the agent’s x/y/z scale multiplier components

std::string getScaleYVariable() const
std::string getScaleZVariable() const
void setModel(const std::string &modelPath, const std::string &texturePath = "")

Use a model from file

Parameters
  • modelPath – The path to the model’s file (must be .obj)

  • texturePath – Optional path to the texture used by the model

void setModel(const Stock::Models::Model &model)

Use a stock model

Parameters

model – Model from the libraries internal resources

void setModelScale(float xLen, float yLen, float zLen)

Scale each dimension of the model to the corresponding world scales

Note

Y is considered the vertical axis

Parameters
  • xLen – World scale of the model’s on the x axis

  • yLen – World scale of the model’s on the y axis

  • zLen – World scale of the model’s on the z axis

void setModelScale(float maxLen)

Uniformly scale model so that max dimension equals this

Parameters

maxLen – World scale of the model’s relative to the axis which it is largest

void setAutoPalette(const Palette &ap)

Set the auto-palette used to assign agent-state’s colors

Note

The color is assigned the first time State() is called, otherwise agents use the default color

void setColor(const ColorFunction &cf)

Set a custom color function

Note

Disables the auto-palette

void clearColor()

Disable custom color and/or auto-palette, e.g. if you’re using a textured model