Description
Class for post processing implementation that generates scripts for POVray.
The script can be used in POVray to render photo-realistic animations.
#include <ChPovRay.h>
Public Types | |
enum | ContactSymbol { VECTOR_SCALELENGTH = 0, VECTOR_SCALERADIUS, VECTOR_NOSCALE, SPHERE_SCALERADIUS, SPHERE_NOSCALE } |
Modes for displaying contacts. | |
Public Member Functions | |
ChPovRay (ChSystem *system) | |
void | Add (std::shared_ptr< ChPhysicsItem > item) |
Add a ChPhysicsItem object to the list of objects to render. More... | |
void | Remove (std::shared_ptr< ChPhysicsItem > item) |
Remove a ChPhysicsItem object from the list of objects to render. | |
void | AddAll () |
Add all ChPhysicsItem objects in the system to the list of objects to render. | |
void | RemoveAll () |
Remove all ChPhysicsItem objects that were previously added. | |
void | SetCustomCommands (std::shared_ptr< ChPhysicsItem > item, const std::string &commands) |
Attach custom POV-Ray commands to the given physics item. More... | |
void | SetBasePath (const std::string &mpath) |
Set the path where all files (.ini, .pov, .assets etc) will be saved. More... | |
void | SetTemplateFile (const std::string &filename) |
Set the filename of the template for the script generation. More... | |
void | SetOutputScriptFile (const std::string &filename) |
Set the filename of the output POV-Ray script. More... | |
void | SetPictureFilebase (const std::string &filename) |
Set the filename of the .bmp files generated by POV. More... | |
void | SetOutputDataFilebase (const std::string &filename) |
Set the filename of the output data generated by the function ExportData(), es: "state"; when the user will execute POV and run the .ini file generated by ExportScript(), the .ini script will call the .pov script that will load these data files. More... | |
void | SetPictureSize (unsigned int width, unsigned int height) |
Set the picture width and height - will write this in the output .ini file. | |
void | SetAntialiasing (bool active, unsigned int depth, double treshold) |
Set antialiasing - will write this in the output .ini file. | |
void | SetCamera (ChVector<> location, ChVector<> aim, double angle, bool ortho=false) |
Set the default camera position and aim point - will write this in the output .pov file. | |
void | SetLight (ChVector<> location, ChColor color, bool cast_shadow) |
Set the default light position and color - will write this in the output .pov file. | |
void | SetBackground (ChColor color) |
Set the background color - will write this in the output .pov file. | |
void | SetAmbientLight (ChColor color) |
Set the ambient light - will write this in the output .pov file. | |
void | SetShowCOGs (bool show, double msize=0.04) |
Turn on/off the display of the COG (center of mass) of rigid bodies. More... | |
void | SetShowFrames (bool show, double msize=0.05) |
Turn on/off the display of the reference coordsystems of rigid bodies. More... | |
void | SetShowLinks (bool show, double msize=0.04) |
Turn on/off the display of the reference coordsystems for ChLinkMate constraints. More... | |
void | SetShowContacts (bool show, ContactSymbol mode, double scale, double width, double max_size, bool do_colormap, double colormap_start, double colormap_end) |
Turn on/off the display of contacts, using spheres or arrows (see eChContactSymbol modes). More... | |
void | SetWireframeThickness (const double wft) |
Set thickness for wireframe mode of meshes. More... | |
double | GetWireframeThickness () const |
void | SetCustomPOVcommandsScript (const std::string &text) |
Set a string (a text block) of custom POV commands that you can optionally append to the POV script file, for example adding other POV lights, materials, etc. More... | |
const std::string & | GetCustomPOVcommandsScript () const |
void | SetCustomPOVcommandsData (const std::string &text) |
Set a string (a text block) of custom POV commands that you can optionally append to the POV script files that are load at each timestep, e.g., state0001.pov, state0002.pov, for example adding other POV lights, materials, etc. | |
const std::string & | GetCustomPOVcommandsData () const |
void | SetFramenumber (unsigned int fn) |
When ExportData() is called, it saves .dat files in incremental way, starting from zero: data0000.dat, data0001.dat etc., but you can override the formatted number by first calling SetFramenumber(). | |
void | ExportScript () |
Export the script that will be used by POV to process all the exported data and render the complete animation. More... | |
virtual void | ExportScript (const std::string &filename) override |
As ExportScript(), but overrides the filename. | |
void | ExportData () |
This function is used at each timestep to export data formatted in a way that it can be load with the POV scripts generated by ExportScript(). More... | |
virtual void | ExportData (const std::string &filename) override |
As ExportData(), but overrides the automatically generated filename. | |
void | SetUseSingleAssetFile (bool use) |
Set if the assets for the entre scenes at all timesteps must be appended into one single large file "rendering_frames.pov.assets". More... | |
Public Member Functions inherited from chrono::postprocess::ChPostProcessBase | |
ChPostProcessBase (ChSystem *system) | |
virtual void | SetSystem (ChSystem *system) |
virtual ChSystem * | GetSystem () |
Additional Inherited Members | |
Protected Attributes inherited from chrono::postprocess::ChPostProcessBase | |
ChSystem * | mSystem |
Member Function Documentation
◆ Add()
void chrono::postprocess::ChPovRay::Add | ( | std::shared_ptr< ChPhysicsItem > | item | ) |
Add a ChPhysicsItem object to the list of objects to render.
An item is added to the list only if it has a visual model.
◆ ExportData()
void chrono::postprocess::ChPovRay::ExportData | ( | ) |
This function is used at each timestep to export data formatted in a way that it can be load with the POV scripts generated by ExportScript().
The generated filename must be set at the beginning of the animation via SetOutputDataFilebase(), and then a number is automatically appended and incremented at each ExportData(), e.g. state0001.dat, state0002.dat, The user should call this function in the while() loop of the simulation, once per frame.
◆ ExportScript()
|
inline |
Export the script that will be used by POV to process all the exported data and render the complete animation.
It contains the definition of geometric shapes, lights, etc. and a POV-Ray function that moves meshes in the position specified by data files saved at each step.
◆ SetBasePath()
|
inline |
Set the path where all files (.ini, .pov, .assets etc) will be saved.
The path can be absolute, or relative to the .exe current path. Note that the directory must be already existing. At the execution of ExportScript() it will create files & directiories like base_path render_frames.pov.ini render_frames.pov render_frames.pov.assets anim picture0000.bmp .... output state0000.pov state0000.dat ....
◆ SetCustomCommands()
void chrono::postprocess::ChPovRay::SetCustomCommands | ( | std::shared_ptr< ChPhysicsItem > | item, |
const std::string & | commands | ||
) |
Attach custom POV-Ray commands to the given physics item.
The provided string will be inserted as-is in the POV-Ray union{} corresponding to the physics item. Only one commands string can be attached to any physics item; a call to this function replaces any existing commands.
◆ SetCustomPOVcommandsScript()
|
inline |
Set a string (a text block) of custom POV commands that you can optionally append to the POV script file, for example adding other POV lights, materials, etc.
What you put in this string will be put at the end of the generated POV script, just before loading the data.
◆ SetOutputDataFilebase()
|
inline |
Set the filename of the output data generated by the function ExportData(), es: "state"; when the user will execute POV and run the .ini file generated by ExportScript(), the .ini script will call the .pov script that will load these data files.
It should NOT contain the .dat suffix because ExportData() will append the frame number (es. state0001.dat, state0002.dat, ...). If not set, it defaults to "state".
◆ SetOutputScriptFile()
|
inline |
Set the filename of the output POV-Ray script.
If not set, it defaults to "render_frames.pov".
◆ SetPictureFilebase()
|
inline |
Set the filename of the .bmp files generated by POV.
It should NOT contain the .bmp suffix because POV will append the frame number (es. pic0001.bmp, pic0002.bmp, ...). If not set, it defaults to "pic".
◆ SetShowCOGs()
void chrono::postprocess::ChPovRay::SetShowCOGs | ( | bool | show, |
double | msize = 0.04 |
||
) |
Turn on/off the display of the COG (center of mass) of rigid bodies.
If setting true, you can also set the size of the symbol, in meters.
◆ SetShowContacts()
void chrono::postprocess::ChPovRay::SetShowContacts | ( | bool | show, |
ContactSymbol | mode, | ||
double | scale, | ||
double | width, | ||
double | max_size, | ||
bool | do_colormap, | ||
double | colormap_start, | ||
double | colormap_end | ||
) |
Turn on/off the display of contacts, using spheres or arrows (see eChContactSymbol modes).
The size of the arrow or of the sphere depends on force strength multiplied by 'scale'. Use 'max_size' to limit size of arrows if too long, or spheres if too large (they will be signaled by white color) Use 'width' for the radius of the arrow. If in 'SYMBOL_VECTOR_SCALERADIUS' mode, the length of the vector is always max_size.
◆ SetShowFrames()
void chrono::postprocess::ChPovRay::SetShowFrames | ( | bool | show, |
double | msize = 0.05 |
||
) |
Turn on/off the display of the reference coordsystems of rigid bodies.
If setting true, you can also set the size of the symbol, in meters.
◆ SetShowLinks()
void chrono::postprocess::ChPovRay::SetShowLinks | ( | bool | show, |
double | msize = 0.04 |
||
) |
Turn on/off the display of the reference coordsystems for ChLinkMate constraints.
If setting true, you can also set the size of the symbol, in meters.
◆ SetTemplateFile()
|
inline |
Set the filename of the template for the script generation.
If not set, it uses the default template in the Chrono data directory.
◆ SetUseSingleAssetFile()
|
inline |
Set if the assets for the entre scenes at all timesteps must be appended into one single large file "rendering_frames.pov.assets".
If not, assets will be written inside each state0001.dat, state0002.dat, etc files; this would waste more disk space but would be a bit faster in POV parsing and would allow assets whose settings change during time (ex time-changing colors)
◆ SetWireframeThickness()
|
inline |
Set thickness for wireframe mode of meshes.
If a ChTriangleMeshShape asset was set as SetWireframe(true), it will be rendered in POVray as a cage of thin cylinders. This setting sets how thick the tubes.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono_postprocess/ChPovRay.h
- /builds/uwsbel/chrono/src/chrono_postprocess/ChPovRay.cpp