NGL
6.5
The NCCA Graphics Library
|
simple rib export class, attempts to auto tab the rib file etc. needs lots of work to make it complete!! More...
#include <RibExport.h>
Public Member Functions | |
void | writeTabs () |
method to auto write tabs More... | |
RibExport (const std::string &_fileName, bool _oneShot=false) | |
ctor passing in the name of the rib file to open More... | |
~RibExport () | |
destructor More... | |
void | comment (const std::string &_sText) |
write a comment to the rib stream More... | |
void | open () |
open a rib file for writing More... | |
void | close () |
Close the rib file. More... | |
void | WorldBegin () |
write world begin and auto tab More... | |
void | WorldEnd () |
write world begin and un tab More... | |
void | AttributeBegin () |
write attribute begin and tab in More... | |
void | AttributeEnd () |
write attribute end and un tab More... | |
void | TransformBegin () |
write transform begin and tab in More... | |
void | TransformEnd () |
write transform end and un tab More... | |
void | writeToFile (std::string _string) |
Write text to rib file. More... | |
void | Translate (const Real _x, const Real _y, const Real _z) |
write an RiTranslate to file More... | |
void | Rotate (const Real _angle, const Real _x, const Real _y, const Real _z) |
write an RiRotate More... | |
void | Scale (const Real _x, const Real _y, const Real _z) |
write an RiScale More... | |
void | Sphere (const Real _radius, const Real _zMin, const Real _zMax, const Real _sweep) |
write an RiSphere More... | |
void | Cylinder (const Real _radius, const Real _zMin, const Real _zMax, const Real _sweep) |
write an RiCylinder More... | |
void | Cone (const Real _height, const Real _radius, const Real _sweep) |
write an RiCone to the stream More... | |
void | Paraboloid (const Real _topRad, const Real _zMin, const Real _zMax, const Real _sweep) |
write an RiParaboloid to the stream More... | |
void | Hyperboloid (const Real _p1, const Real _p2, const Real _sweep) |
draw a hyperboloid to the stream More... | |
void | Disk (const Real _height, const Real _radius, const Real _sweep) |
draw an RiDisk to the stream More... | |
void | Torus (const Real _major, const Real _minor, const Real _phiMin, const Real _phiMax, const Real _sweep) |
draw an RiTorus to the stream More... | |
bool | isOpen () |
method to see if stream is open More... | |
std::fstream & | getStream () |
a method to get the rib stream More... | |
Protected Attributes | |
std::fstream | m_ribFile |
the RibFile stream opened in the ctor More... | |
int | m_attribCount |
count calls to AttributeBegin to ensure matching More... | |
int | m_transformCount |
count calls to TransformBegin to ensure matching More... | |
int | m_worldCount |
count calls to WorldBegin to ensure matching More... | |
int | m_frameNumber |
Hold the frame number for calls to Frame. More... | |
std::string | m_ribFileName |
The name of the RibFile. More... | |
int | m_tabs |
the current tab level for auto tabing of rib file More... | |
bool | m_isOpen |
if the stream is open More... | |
bool | m_oneShot |
we can use this once or multiple times More... | |
simple rib export class, attempts to auto tab the rib file etc. needs lots of work to make it complete!!
allows for OpenGL programs to export to Rib files, very much work in progress, note I don't use the coding standard in the method names so it better matches the Rib file format / python rules
Definition at line 41 of file RibExport.h.
ngl::RibExport::RibExport | ( | const std::string & | _fileName, |
bool | _oneShot = false |
||
) |
ctor passing in the name of the rib file to open
[in] | _fileName | the rib file to open |
Definition at line 27 of file RibExport.cpp.
References m_attribCount, m_frameNumber, m_isOpen, m_oneShot, m_ribFileName, m_tabs, m_transformCount, and m_worldCount.
ngl::RibExport::~RibExport | ( | ) |
destructor
Definition at line 40 of file RibExport.cpp.
References m_attribCount, m_isOpen, m_ribFile, m_transformCount, and m_worldCount.
void ngl::RibExport::AttributeBegin | ( | ) |
write attribute begin and tab in
Definition at line 111 of file RibExport.cpp.
References m_attribCount, m_ribFile, m_tabs, and writeTabs().
void ngl::RibExport::AttributeEnd | ( | ) |
write attribute end and un tab
Definition at line 120 of file RibExport.cpp.
References m_attribCount, m_ribFile, m_tabs, and writeTabs().
void ngl::RibExport::close | ( | ) |
Close the rib file.
Definition at line 95 of file RibExport.cpp.
References m_frameNumber, and m_ribFile.
void ngl::RibExport::comment | ( | const std::string & | _sText | ) |
write a comment to the rib stream
[in] | _sText | the text to write |
Definition at line 64 of file RibExport.cpp.
References m_ribFile.
write an RiCone to the stream
[in] | _height | the height of the cone |
[in] | _radius | the radius of the cone |
[in] | _sweep | the sweep of the cone |
Definition at line 208 of file RibExport.cpp.
References m_ribFile, and writeTabs().
void ngl::RibExport::Cylinder | ( | const Real | _radius, |
const Real | _zMin, | ||
const Real | _zMax, | ||
const Real | _sweep | ||
) |
write an RiCylinder
[in] | _radius | the radius of the Cylinder |
[in] | _zMin | the min z sweep |
[in] | _zMax | the max z sweep |
[in] | _sweep | how much of the sphere to draw |
Definition at line 201 of file RibExport.cpp.
References m_ribFile, and writeTabs().
draw an RiDisk to the stream
[in] | _height | the height of the disk |
[in] | _radius | the radius of the disk |
[in] | _sweep | the sweep of the disk |
Definition at line 229 of file RibExport.cpp.
References m_ribFile, and writeTabs().
|
inline |
a method to get the rib stream
Definition at line 183 of file RibExport.h.
draw a hyperboloid to the stream
[in] | _p1 | the first point of the hyperboloid sweep |
[in] | _p2 | the 2nd point of the hyperboloid sweep |
[in] | _sweep | the sweep of the hyperboloid |
Definition at line 222 of file RibExport.cpp.
References m_ribFile, and writeTabs().
|
inline |
method to see if stream is open
Definition at line 179 of file RibExport.h.
void ngl::RibExport::open | ( | ) |
open a rib file for writing
Definition at line 74 of file RibExport.cpp.
References fmt::format(), m_frameNumber, m_isOpen, m_oneShot, m_ribFile, and m_ribFileName.
void ngl::RibExport::Paraboloid | ( | const Real | _topRad, |
const Real | _zMin, | ||
const Real | _zMax, | ||
const Real | _sweep | ||
) |
write an RiParaboloid to the stream
[in] | _topRad | the top radius of the paraboloid |
[in] | _zMin | the min z sweep |
[in] | _zMax | the max z sweep |
[in] | _sweep | the sweep of the paraboloid |
Definition at line 215 of file RibExport.cpp.
References m_ribFile, and writeTabs().
write an RiRotate
[in] | _angle | the angle to rotate around the axis specified |
[in] | _x | the x axis value |
[in] | _y | the y axis value |
[in] | _z | the z axis value |
Definition at line 180 of file RibExport.cpp.
References m_ribFile, and writeTabs().
write an RiScale
[in] | _x | the x scale value |
[in] | _y | the y scale value |
[in] | _z | the z scale value |
Definition at line 187 of file RibExport.cpp.
References m_ribFile, and writeTabs().
void ngl::RibExport::Sphere | ( | const Real | _radius, |
const Real | _zMin, | ||
const Real | _zMax, | ||
const Real | _sweep | ||
) |
write an RiSphere
[in] | _radius | the radius of the sphere |
[in] | _zMin | the min z sweep |
[in] | _zMax | the max z sweep |
[in] | _sweep | how much of the sphere to draw |
Definition at line 194 of file RibExport.cpp.
References m_ribFile, and writeTabs().
void ngl::RibExport::Torus | ( | const Real | _major, |
const Real | _minor, | ||
const Real | _phiMin, | ||
const Real | _phiMax, | ||
const Real | _sweep | ||
) |
draw an RiTorus to the stream
[in] | _major | the major radius of the torus |
[in] | _minor | the minor radius of the torus |
[in] | _phiMin | the min value of the radial sweep |
[in] | _phiMax | the max value of the radial sweep |
[in] | _sweep | the sweep of the torus |
Definition at line 236 of file RibExport.cpp.
References m_ribFile, and writeTabs().
void ngl::RibExport::TransformBegin | ( | ) |
write transform begin and tab in
Definition at line 129 of file RibExport.cpp.
References m_ribFile, m_tabs, m_transformCount, and writeTabs().
void ngl::RibExport::TransformEnd | ( | ) |
write transform end and un tab
Definition at line 138 of file RibExport.cpp.
References m_ribFile, m_tabs, m_transformCount, and writeTabs().
write an RiTranslate to file
[in] | _x | the x translate value |
[in] | _y | the y translate value |
[in] | _z | the z translate value |
Definition at line 173 of file RibExport.cpp.
References m_ribFile, and writeTabs().
void ngl::RibExport::WorldBegin | ( | ) |
write world begin and auto tab
Definition at line 147 of file RibExport.cpp.
References m_ribFile, m_tabs, m_worldCount, and writeTabs().
void ngl::RibExport::WorldEnd | ( | ) |
write world begin and un tab
Definition at line 156 of file RibExport.cpp.
References m_ribFile, m_tabs, m_worldCount, and writeTabs().
void ngl::RibExport::writeTabs | ( | ) |
method to auto write tabs
Definition at line 102 of file RibExport.cpp.
References m_ribFile, and m_tabs.
void ngl::RibExport::writeToFile | ( | std::string | _string | ) |
Write text to rib file.
[in] | _string | the string to write |
Definition at line 165 of file RibExport.cpp.
References m_ribFile, and writeTabs().
|
protected |
count calls to AttributeBegin to ensure matching
Definition at line 193 of file RibExport.h.
|
protected |
Hold the frame number for calls to Frame.
Definition at line 205 of file RibExport.h.
|
protected |
if the stream is open
Definition at line 217 of file RibExport.h.
|
protected |
we can use this once or multiple times
Definition at line 221 of file RibExport.h.
|
protected |
the RibFile stream opened in the ctor
Definition at line 189 of file RibExport.h.
|
protected |
The name of the RibFile.
Definition at line 209 of file RibExport.h.
|
protected |
the current tab level for auto tabing of rib file
Definition at line 213 of file RibExport.h.
|
protected |
count calls to TransformBegin to ensure matching
Definition at line 197 of file RibExport.h.
|
protected |
count calls to WorldBegin to ensure matching
Definition at line 201 of file RibExport.h.