tools to create 3D scence and export them in different More...
#include <aurostd_xparser.h>
Classes | |
struct | ConvexFacets |
Scene object settings for facets. More... | |
struct | Material |
Storage object for material settings. More... | |
struct | OpenCylinder |
Scene object settings for cylinders. More... | |
struct | Sphere |
Scene object settings for spheres. More... | |
struct | storage_object |
Helper to store different scene objects (utalizing shared pointers) More... | |
Public Types | |
enum class | animation_format { GIF , WEBM , MP4 } |
Public Member Functions | |
x3DWriter () | |
class constractor | |
x3DWriter (const x3DWriter &x3w) | |
class copy constructor | |
~x3DWriter () | |
default class de-constructor | |
x3DWriter & | operator= (const x3DWriter &x3w) |
assignment operator | |
void | clear () |
reconstruct / clear | |
void | prepareSceneLattice (const xmatrix< double > &lattice) |
prepare a scene to show a lattice by setting the center and a view collection | |
void | addMaterial (const std::string &name, const xvector< double > &color) |
add a new basic Material | |
void | addMaterial (const Material &newMaterial) |
add a new Material | |
std::vector< std::string > | addColorSpreadMaterial (uint count) |
create a set of materials using the turbo colormap | |
template<class Container> | |
std::map< std::string, std::string > | addNamedColorSpreadMaterial (const Container &names) |
void | addSphere (const xvector< double > ¢er, double radius, const std::string &material="bm_black") |
add a Sphere to the scene | |
void | addSpheres (const std::vector< xvector< double > > ¢er, double radius, const std::string &material="bm_black") |
add a set of Sphere with a list of center and constant radius and materials | |
void | addOpenCylinder (const xvector< double > &base, const xvector< double > &apex, double radius, const std::string &material="bm_grey") |
add a OpenCylinder to the scene | |
void | addConvexFacets (const std::vector< xvector< double > > &vertexes, const std::vector< std::vector< uint > > &facets, const std::string &material="bm_grey_glass", const xvector< double > &shift={0, 0, 0}) |
void | addConvexFacets (const std::vector< xvector< double > > &vertexes, const std::vector< std::vector< uint > > &facets, const xvector< double > &shift) |
void | addLatticeBox (const xmatrix< double > &lattice, double radius, const std::string &material="bm_black", bool axis=false) |
add a box forming a unit cell to the scene | |
void | joinFacets (std::vector< xvector< double > > &vertexes, std::vector< std::vector< uint > > &facets, const std::vector< xvector< double > > &new_vertexes, const std::vector< std::vector< uint > > &new_facets) const |
combine overlapping vertexes and facets | |
void | animate (float duration, const std::filesystem::path &out_folder, uint fps=30, bool lr=true) |
prepare an animation | |
std::string | toHTML () |
save scene as x3d and embed it in a html file | |
std::string | toX3D (bool include_xml=true, bool replace_material=false) |
save scene as x3d (xml) | |
std::string | toTachyon () |
save scene for the tachyon renderer use tachyon to render the generated file | |
Public Attributes | |
xvector< double > | scene_center |
center of the scene (should be set before adding objects to the scene) | |
double | join_threshold = 1E-5 |
threshould to join vertexes when using joinFacets | |
double | tachyon_camera_theta = 0.0 |
tachyon camera angle theta | rotation around 1 0 0 | |
double | tachyon_camera_phi = 0.0 |
tachyon camera angle phi | rotation around 0 0 1 | |
int | tachyon_lattice_views_idx = -1 |
active lattice view (-1 default tachyon viewpoint is used) | |
bool | tachyon_camera_orthographic = false |
animation_format | ani_type = animation_format::GIF |
animation type (default GIF) | |
std::vector< std::pair< std::string, std::string > > | meta |
meta data like title, description, reference (link back to auid) | |
Private Types | |
enum class | object_types { MATERIAL , SPHERE , FACET , OPEN_CYLINDER } |
Private Member Functions | |
void | copy (const x3DWriter &x3w) |
create a copy of x3DWriter | |
void | tachyon_calculate_camera () |
calculate the camera position (used fot tachyon) | |
Static Private Member Functions | |
static std::string | x3d_material (const std::shared_ptr< x3DWriter::Material > &material) |
Private Attributes | |
std::vector< storage_object > | objects |
storage for scene objects | |
double | max_distance = 0.0 |
maximum distance of scene object from the scene center (for camera position calculation) | |
double | tachyon_zoom = 2.0 |
zoom value for rendering the camera rendering with tachyon | |
const double | tachyon_camera_angle = 45.0 |
lense angle for the camera rendering with tachyon | |
xvector< double > | tachyon_camera_position |
camera position for tachyon | |
std::vector< std::pair< xvector< double >, xvector< double > > > | tachyon_lattice_views |
collection of camera views based on prepareSceneLattice | |
const float | turbo_cmap [256][3] |
rgb values of the turbo colormap | |
tools to create 3D scence and export them in different
Basic usage
Definition at line 64 of file aurostd_xparser.h.
|
strongprivate |
Enumerator | |
---|---|
MATERIAL | |
SPHERE | |
FACET | |
OPEN_CYLINDER |
Definition at line 66 of file aurostd_xparser.h.
|
strong |
Enumerator | |
---|---|
GIF | |
WEBM | |
MP4 |
Definition at line 389 of file aurostd_xparser.h.
aurostd::x3DWriter::x3DWriter | ( | ) |
class constractor
Definition at line 676 of file aurostd_xparser.cpp.
aurostd::x3DWriter::x3DWriter | ( | const x3DWriter & | x3w | ) |
class copy constructor
Definition at line 702 of file aurostd_xparser.cpp.
|
default |
default class de-constructor
|
private |
create a copy of x3DWriter
Definition at line 662 of file aurostd_xparser.cpp.
|
private |
calculate the camera position (used fot tachyon)
Definition at line 1050 of file aurostd_xparser.cpp.
|
staticprivate |
convert a material to x3d
Definition at line 1039 of file aurostd_xparser.cpp.
assignment operator
Definition at line 710 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::clear | ( | ) |
reconstruct / clear
Definition at line 657 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::prepareSceneLattice | ( | const xmatrix< double > & | lattice | ) |
prepare a scene to show a lattice by setting the center and a view collection
Definition at line 719 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::addMaterial | ( | const std::string & | name, |
const xvector< double > & | color ) |
add a new basic Material
name | name to reference the Material |
color | as R,G,B xvector |
Definition at line 859 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::addMaterial | ( | const Material & | newMaterial | ) |
vector< std::string > aurostd::x3DWriter::addColorSpreadMaterial | ( | uint | count | ) |
create a set of materials using the turbo colormap
count | number of materials to create |
the materials will be named "auto_cs_{idx}"
Definition at line 880 of file aurostd_xparser.cpp.
template std::map< std::string, std::string > aurostd::x3DWriter::addNamedColorSpreadMaterial | ( | const Container & | names | ) |
Definition at line 893 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::addSphere | ( | const xvector< double > & | center, |
double | radius, | ||
const std::string & | material = "bm_black" ) |
add a Sphere to the scene
Definition at line 734 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::addSpheres | ( | const std::vector< xvector< double > > & | center, |
double | radius, | ||
const std::string & | material = "bm_black" ) |
add a set of Sphere with a list of center and constant radius and materials
Definition at line 747 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::addOpenCylinder | ( | const xvector< double > & | base, |
const xvector< double > & | apex, | ||
double | radius, | ||
const std::string & | material = "bm_grey" ) |
add a OpenCylinder to the scene
base | start point |
apex | end point |
radius | cylinder radius |
material | cylinder material |
Definition at line 801 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::addConvexFacets | ( | const std::vector< xvector< double > > & | vertexes, |
const std::vector< std::vector< uint > > & | facets, | ||
const std::string & | material = "bm_grey_glass", | ||
const xvector< double > & | shift = {0, 0, 0} ) |
void aurostd::x3DWriter::addConvexFacets | ( | const std::vector< xvector< double > > & | vertexes, |
const std::vector< std::vector< uint > > & | facets, | ||
const xvector< double > & | shift ) |
void aurostd::x3DWriter::addLatticeBox | ( | const xmatrix< double > & | lattice, |
double | radius, | ||
const std::string & | material = "bm_black", | ||
bool | axis = false ) |
add a box forming a unit cell to the scene
lattice | 3x3 matrix like xstructure.lattice |
radius | radius of the cylinders forming the box |
material | box material |
Definition at line 757 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::joinFacets | ( | std::vector< xvector< double > > & | vertexes, |
std::vector< std::vector< uint > > & | facets, | ||
const std::vector< xvector< double > > & | new_vertexes, | ||
const std::vector< std::vector< uint > > & | new_facets ) const |
combine overlapping vertexes and facets
vertexes | originial vertexes positions |
facets | list of vertex indexes forming the facets |
new_vertexes | updated vertexes positions |
new_facets | updated list of vertex indexes forming the facets |
Definition at line 907 of file aurostd_xparser.cpp.
void aurostd::x3DWriter::animate | ( | float | duration, |
const std::filesystem::path & | out_folder, | ||
uint | fps = 30, | ||
bool | lr = true ) |
prepare an animation
duration | animation time in second |
out_folder | folder to store the generated files |
fps | frames per second |
lr | move left to right |
In the out_folder a render.sh script that will create a file with the stem _Animation; for rendering ffmpeg and tachyon is needed
Definition at line 993 of file aurostd_xparser.cpp.
std::string aurostd::x3DWriter::toHTML | ( | ) |
save scene as x3d and embed it in a html file
Definition at line 1249 of file aurostd_xparser.cpp.
std::string aurostd::x3DWriter::toX3D | ( | bool | include_xml = true, |
bool | replace_material = false ) |
save scene as x3d (xml)
include_xml | create as stand alone xml |
replace_material | switch if Materials are exported |
Definition at line 1152 of file aurostd_xparser.cpp.
std::string aurostd::x3DWriter::toTachyon | ( | ) |
save scene for the tachyon renderer use tachyon to render the generated file
Definition at line 1065 of file aurostd_xparser.cpp.
|
private |
storage for scene objects
Definition at line 74 of file aurostd_xparser.h.
|
private |
maximum distance of scene object from the scene center (for camera position calculation)
Definition at line 114 of file aurostd_xparser.h.
|
private |
zoom value for rendering the camera rendering with tachyon
Definition at line 115 of file aurostd_xparser.h.
|
private |
lense angle for the camera rendering with tachyon
Definition at line 116 of file aurostd_xparser.h.
|
private |
camera position for tachyon
Definition at line 117 of file aurostd_xparser.h.
|
private |
collection of camera views based on prepareSceneLattice
Definition at line 118 of file aurostd_xparser.h.
|
private |
rgb values of the turbo colormap
Definition at line 122 of file aurostd_xparser.h.
xvector<double> aurostd::x3DWriter::scene_center |
center of the scene (should be set before adding objects to the scene)
Definition at line 382 of file aurostd_xparser.h.
double aurostd::x3DWriter::join_threshold = 1E-5 |
threshould to join vertexes when using joinFacets
Definition at line 383 of file aurostd_xparser.h.
double aurostd::x3DWriter::tachyon_camera_theta = 0.0 |
tachyon camera angle theta | rotation around 1 0 0
Definition at line 384 of file aurostd_xparser.h.
double aurostd::x3DWriter::tachyon_camera_phi = 0.0 |
tachyon camera angle phi | rotation around 0 0 1
Definition at line 385 of file aurostd_xparser.h.
int aurostd::x3DWriter::tachyon_lattice_views_idx = -1 |
active lattice view (-1 default tachyon viewpoint is used)
Definition at line 386 of file aurostd_xparser.h.
bool aurostd::x3DWriter::tachyon_camera_orthographic = false |
Definition at line 387 of file aurostd_xparser.h.
animation_format aurostd::x3DWriter::ani_type = animation_format::GIF |
animation type (default GIF)
Definition at line 390 of file aurostd_xparser.h.
std::vector<std::pair<std::string, std::string> > aurostd::x3DWriter::meta |
meta data like title, description, reference (link back to auid)
Definition at line 391 of file aurostd_xparser.h.