![]() |
An open-source, flexible 3D physical simulation framework
|
NodeData is a struct to exchange node information between the GUI and the simulation. More...
#include <NodeData.h>
Public Member Functions | |
void | init (const std::string &name=std::string(), const utils::Vector &position=utils::Vector::Zero(), const utils::Quaternion &orientation=utils::Quaternion::Identity()) |
initialization is not done in the constructor directly to keep backwards compatibility with the NEW_NODE_STRUCT macro. More... | |
NodeData (const std::string &name=std::string(), const utils::Vector &position=utils::Vector::Zero(), const utils::Quaternion &orientation=utils::Quaternion::Identity()) | |
default constructor that takes name, position and orientation arguments More... | |
void | initPrimitive (NodeType type, const utils::Vector &extents, sReal mass) |
initialize the nodestruct for a primitive type More... | |
bool | fromConfigMap (configmaps::ConfigMap *config, std::string filenamePrefix, LoadCenter *loadCenter=0) |
void | toConfigMap (configmaps::ConfigMap *config, bool skipFilenamePrefix=false, bool exportDefault=false) |
void | getFilesToSave (std::vector< std::string > *fileList) |
Static Public Member Functions | |
static const char * | toString (const NodeType &type) |
static NodeType | typeFromString (const std::string &str) |
Public Attributes | |
std::string | name |
The name of the node. More... | |
std::string | origName |
The original object name; needed for importing objects from files (like wavefront object files). More... | |
std::string | filename |
The filename of the node to load the visual representation from. More... | |
int | groupID |
Several nodes can be grouped by setting the same groupID . More... | |
unsigned long | index |
The unique index of the node. More... | |
NodeType | physicMode |
This value holds the physical representation of a node. More... | |
utils::Vector | pos |
The position of the node. More... | |
utils::Vector | pivot |
The pivot point is set automatically by importing objects. More... | |
utils::Quaternion | rot |
This quaternion describes the orientation of the node. More... | |
bool | movable |
This boolean variable defines if the physical representation is fixed in the world or if it's a movable body. More... | |
bool | noPhysical |
This boolean variable defines if the node have a physical representation or if it's only part of the visualisation. More... | |
sReal | density |
Physical density of the node. More... | |
sReal | mass |
Physical mass of the node. More... | |
utils::Vector | ext |
The size of the node. More... | |
snmesh | mesh |
The mesh struct stores the poly information for a physical representation of a mesh. More... | |
MaterialData | material |
The material struct defines the visual material of the node. More... | |
std::map< ShaderType, std::string > | shaderSources |
Allows to explicitly set shader stages. More... | |
unsigned long | relative_id |
Currently the position of a node can be set relative to the position of the node with the id equal to the value of relative_id. More... | |
terrainStruct * | terrain |
If the physicMode is set to NODE_TYPE_TERRAIN, this pointer stores all information to create a physical representation of a height map. More... | |
utils::Vector | visual_offset_pos |
The visual representation of a node can have a different position as the physical representation. More... | |
utils::Quaternion | visual_offset_rot |
In the same way as the visual_offset_pos, this quaternion can be used to differentiate the orientation of the visual representation from the physical one. More... | |
utils::Vector | visual_size |
This vector is used to define the size of the bounding box of the visual representation of a node. More... | |
utils::Vector | visual_scale |
This vector is used to scale the bounding box of the visual representation of a node. More... | |
contact_params | c_params |
The contact params define the physical contact properties of the node. More... | |
bool | inertia_set |
Generally the inertia of the physical body is calculated by the physicMode and the mass of a node. More... | |
sReal | inertia [3][3] |
If the boolean NodeData::inertia_set is true , this array is used to define the inertia of the physical body of this node. More... | |
sReal | linear_damping |
This value defines a scalar that is multiplied to the linear velocity of the body in every timestep if the value is unequal 0.0. More... | |
sReal | angular_damping |
This value defines a scalar that is multiplied to the angular velocity of the body in every timestep if the value is unequal 0.0. More... | |
sReal | angular_treshold |
sReal | angular_low |
int | shadow_id |
bool | isShadowCaster |
bool | isShadowReceiver |
NodeId | graphicsID1 |
NodeId | graphicsID2 |
configmaps::ConfigMap | map |
If the data is created from a ConfigMap map the original map is stored here. More... | |
NodeData is a struct to exchange node information between the GUI and the simulation.
Example:
The following example code defines a box with a size of 1x1x1 meter, a density of 1 (default) and a mass of 0.5, and a position at (0.0, 0.0, 1.0).
Definition at line 52 of file NodeData.h.
|
inlineexplicit |
default constructor that takes name, position and orientation arguments
Definition at line 103 of file NodeData.h.
bool mars::interfaces::NodeData::fromConfigMap | ( | configmaps::ConfigMap * | config, |
std::string | filenamePrefix, | ||
LoadCenter * | loadCenter = 0 |
||
) |
Definition at line 98 of file NodeData.cpp.
void mars::interfaces::NodeData::getFilesToSave | ( | std::vector< std::string > * | fileList | ) |
Definition at line 375 of file NodeData.cpp.
|
inline |
initialization is not done in the constructor directly to keep backwards compatibility with the NEW_NODE_STRUCT macro.
Definition at line 58 of file NodeData.h.
|
inline |
initialize the nodestruct for a primitive type
only updates the fields relevant to the primitive type, and leaves the rest as it is.
type | the type of node (e.g. box, sphere, etc) |
extents | extents of the object |
mass | the mass of the object |
Definition at line 123 of file NodeData.h.
void mars::interfaces::NodeData::toConfigMap | ( | configmaps::ConfigMap * | config, |
bool | skipFilenamePrefix = false , |
||
bool | exportDefault = false |
||
) |
Definition at line 284 of file NodeData.cpp.
|
static |
Definition at line 71 of file NodeData.cpp.
|
static |
Definition at line 81 of file NodeData.cpp.
sReal mars::interfaces::NodeData::angular_damping |
This value defines a scalar that is multiplied to the angular velocity of the body in every timestep if the value is unequal 0.0.
Default value: 0.0
Definition at line 372 of file NodeData.h.
sReal mars::interfaces::NodeData::angular_low |
Definition at line 374 of file NodeData.h.
sReal mars::interfaces::NodeData::angular_treshold |
Definition at line 373 of file NodeData.h.
contact_params mars::interfaces::NodeData::c_params |
The contact params define the physical contact properties of the node.
The default created contact parameters can be used for a standard stable contact behaviour of the simulation. See contact_params for detailed information.
Default value: see contact_params
Definition at line 338 of file NodeData.h.
sReal mars::interfaces::NodeData::density |
utils::Vector mars::interfaces::NodeData::ext |
The size of the node.
The ext vector is interpreted depending of the physicMode of the node:
Default value: (0.0, 0.0, 0.0)
Definition at line 247 of file NodeData.h.
std::string mars::interfaces::NodeData::filename |
The filename of the node to load the visual representation from.
If no file is used the filename have to be set to PRIMITIVE
and the origName have to be a number indicating the type of primitive to visualize.
Default value: "PRIMITIVE"
Definition at line 159 of file NodeData.h.
NodeId mars::interfaces::NodeData::graphicsID1 |
Definition at line 379 of file NodeData.h.
NodeId mars::interfaces::NodeData::graphicsID2 |
Definition at line 379 of file NodeData.h.
int mars::interfaces::NodeData::groupID |
Several nodes can be grouped by setting the same groupID
.
If the node is not in a group the id have to be 0.
Default value: 0
Definition at line 166 of file NodeData.h.
unsigned long mars::interfaces::NodeData::index |
The unique index of the node.
This value is set by the simulation while adding a new node.
Default value: 0
Definition at line 172 of file NodeData.h.
sReal mars::interfaces::NodeData::inertia[3][3] |
If the boolean NodeData::inertia_set is true
, this array is used to define the inertia of the physical body of this node.
Default value: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
Definition at line 358 of file NodeData.h.
bool mars::interfaces::NodeData::inertia_set |
Generally the inertia of the physical body is calculated by the physicMode and the mass of a node.
In case of a mesh the inertia is calculated for a box with the size given by NodeData::extent. If this boolean is set to true
, the inertia array (NodeData::inertia) is used instead.
Default value: false
Definition at line 347 of file NodeData.h.
bool mars::interfaces::NodeData::isShadowCaster |
Definition at line 377 of file NodeData.h.
bool mars::interfaces::NodeData::isShadowReceiver |
Definition at line 378 of file NodeData.h.
sReal mars::interfaces::NodeData::linear_damping |
This value defines a scalar that is multiplied to the linear velocity of the body in every timestep if the value is unequal 0.0.
Default value: 0.0
Definition at line 365 of file NodeData.h.
configmaps::ConfigMap mars::interfaces::NodeData::map |
If the data is created from a ConfigMap map the original map is stored here.
Definition at line 384 of file NodeData.h.
sReal mars::interfaces::NodeData::mass |
Physical mass of the node.
This value is ignored as long as the above density is not 0.0.
Default value: 0.0
Definition at line 231 of file NodeData.h.
MaterialData mars::interfaces::NodeData::material |
The material struct defines the visual material of the node.
Default value: see maerialStruct
Definition at line 262 of file NodeData.h.
snmesh mars::interfaces::NodeData::mesh |
The mesh struct stores the poly information for a physical representation of a mesh.
This struct is automatically derived from the visual node by the simulation if the physicMode is set to NODE_TYPE_MESH.
Default value: see snmesh
Definition at line 255 of file NodeData.h.
bool mars::interfaces::NodeData::movable |
This boolean variable defines if the physical representation is fixed in the world or if it's a movable body.
Default value: false
Definition at line 212 of file NodeData.h.
std::string mars::interfaces::NodeData::name |
bool mars::interfaces::NodeData::noPhysical |
This boolean variable defines if the node have a physical representation or if it's only part of the visualisation.
If the value is true
no physical representation will be created for the node.
Default value: false
Definition at line 220 of file NodeData.h.
std::string mars::interfaces::NodeData::origName |
The original object name; needed for importing objects from files (like wavefront object files).
This string stores also the type of a primitive if the node don't have have a file to load the visual representation from.
Default value: ""
Definition at line 151 of file NodeData.h.
NodeType mars::interfaces::NodeData::physicMode |
This value holds the physical representation of a node.
Valid values are:
Default value: NODE_TYPE_UNDEFINED
Definition at line 186 of file NodeData.h.
utils::Vector mars::interfaces::NodeData::pivot |
The pivot point is set automatically by importing objects.
Default value: (0.0, 0.0, 0.0)
Definition at line 198 of file NodeData.h.
utils::Vector mars::interfaces::NodeData::pos |
unsigned long mars::interfaces::NodeData::relative_id |
Currently the position of a node can be set relative to the position of the node with the id equal to the value of relative_id.
If the node has its own position the value of relative_id have to be 0.
Default value: 0
Definition at line 288 of file NodeData.h.
utils::Quaternion mars::interfaces::NodeData::rot |
This quaternion describes the orientation of the node.
Default value: (0.0, 0.0, 0.0, 1.0)
Definition at line 205 of file NodeData.h.
std::map<ShaderType, std::string> mars::interfaces::NodeData::shaderSources |
Allows to explicitly set shader stages.
Shaders are programs running on the GPU, written in GLSL. OpenGL uses a rendering pipeline, some pipeline stages are programmable. OpenGL<3.0 provides a fixed function pipeline with some bloated, all containing, shader stages. With this list you have some influence on the programmable part of the pipeline.
If the map is empty, all shaders will be generated. If there is a item with ShaderType=SHADER_TYPE_FFP in the map, fixed function pipeline will be used. Else each item in the list defines a shader stage.
Default value: empty list
Definition at line 280 of file NodeData.h.
int mars::interfaces::NodeData::shadow_id |
Definition at line 375 of file NodeData.h.
terrainStruct* mars::interfaces::NodeData::terrain |
If the physicMode is set to NODE_TYPE_TERRAIN, this pointer stores all information to create a physical representation of a height map.
Default value: 0
Definition at line 297 of file NodeData.h.
utils::Vector mars::interfaces::NodeData::visual_offset_pos |
The visual representation of a node can have a different position as the physical representation.
This vector defines a relative direction and distance to the physical position of the node.
Default value: (0.0, 0.0, 0.0)
Definition at line 305 of file NodeData.h.
utils::Quaternion mars::interfaces::NodeData::visual_offset_rot |
In the same way as the visual_offset_pos, this quaternion can be used to differentiate the orientation of the visual representation from the physical one.
Default value: (0.0, 0.0, 0.0, 1.0)
Definition at line 313 of file NodeData.h.
utils::Vector mars::interfaces::NodeData::visual_scale |
This vector is used to scale the bounding box of the visual representation of a node.
Default value: (1.0, 1.0, 1.0)
Definition at line 329 of file NodeData.h.
utils::Vector mars::interfaces::NodeData::visual_size |
This vector is used to define the size of the bounding box of the visual representation of a node.
The visual object is scaled to fit into it's bounding box and can be set independently of the physical extent. If the vector is zero the original size of the loaded mesh is used.
Default value: (0.0, 0.0, 0.0)
Definition at line 322 of file NodeData.h.