44 std::cerr <<
"Warning Mismatched AttributeBegin / AttributeEnd block" << std::endl;
48 std::cerr <<
"Warning Mismatched TransformBegin / TransformEnd block" << std::endl;
52 std::cerr <<
"Warning Mismatched WorldBegin / WorldEnd block" << std::endl;
67 m_ribFile <<
"\n#======================================================\n";
69 m_ribFile <<
"#======================================================\n";
85 m_ribFile.open(fName.c_str(), std::ios::out);
88 std::cerr <<
"problems Opening File" << std::endl;
90 m_ribFile <<
"# Rib file generated using RibExporter" << std::endl;
104 for (
int i = 0; i <
m_tabs; ++i)
114 m_ribFile <<
"AttributeBegin " << std::endl;
124 m_ribFile <<
"AttributeEnd " << std::endl;
132 m_ribFile <<
"TransformBegin " << std::endl;
142 m_ribFile <<
"TransformEnd " << std::endl;
176 m_ribFile <<
"Translate " << _x <<
" " << _y <<
" " << _z << std::endl;
183 m_ribFile <<
"Rotate " << _angle <<
" " << _x <<
" " << _y <<
" " << _z << std::endl;
190 m_ribFile <<
"Scale " << _x <<
" " << _y <<
" " << _z << std::endl;
197 m_ribFile <<
"Sphere " << _radius <<
" " << _zMin <<
" " << _zMax <<
" " << _sweep << std::endl;
204 m_ribFile <<
"Cylinder " << _radius <<
" " << _zMin <<
" " << _zMax <<
" " << _sweep << std::endl;
211 m_ribFile <<
"Cone " << _height <<
" " << _radius <<
" " << _sweep << std::endl;
218 m_ribFile <<
"Paraboloid " << _topRad <<
" " << _zMin <<
" " << _zMax <<
" " << _sweep << std::endl;
225 m_ribFile <<
"Hyperboloid " << _p1 <<
" " << _p2 <<
" " << _sweep << std::endl;
232 m_ribFile <<
"Disk " << _height <<
" " << _radius <<
" " << _sweep << std::endl;
239 m_ribFile <<
"Torus " << _major <<
" " << _minor <<
" " << _phiMin <<
" " << _phiMax <<
" " << _sweep << std::endl;
int m_tabs
the current tab level for auto tabing of rib file
void comment(const std::string &_sText)
write a comment to the rib stream
void writeToFile(std::string _string)
Write text to rib file.
void AttributeBegin()
write attribute begin and tab in
int m_frameNumber
Hold the frame number for calls to Frame.
int m_worldCount
count calls to WorldBegin to ensure matching
std::string format(CStringRef format_str, ArgList args)
void Disk(const Real _height, const Real _radius, const Real _sweep)
draw an RiDisk to the stream
bool m_isOpen
if the stream is open
implementation files for RibExport class
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
std::fstream m_ribFile
the RibFile stream opened in the ctor
void Paraboloid(const Real _topRad, const Real _zMin, const Real _zMax, const Real _sweep)
write an RiParaboloid to the stream
void Cone(const Real _height, const Real _radius, const Real _sweep)
write an RiCone to the stream
void close()
Close the rib file.
void Torus(const Real _major, const Real _minor, const Real _phiMin, const Real _phiMax, const Real _sweep)
draw an RiTorus to the stream
void open()
open a rib file for writing
void WorldBegin()
write world begin and auto tab
std::string m_ribFileName
The name of the RibFile.
bool m_oneShot
we can use this once or multiple times
void Translate(const Real _x, const Real _y, const Real _z)
write an RiTranslate to file
void Rotate(const Real _angle, const Real _x, const Real _y, const Real _z)
write an RiRotate
void Sphere(const Real _radius, const Real _zMin, const Real _zMax, const Real _sweep)
write an RiSphere
int m_transformCount
count calls to TransformBegin to ensure matching
a simple rib exporter function
void TransformBegin()
write transform begin and tab in
RibExport(const std::string &_fileName, bool _oneShot=false)
ctor passing in the name of the rib file to open
void writeTabs()
method to auto write tabs
void AttributeEnd()
write attribute end and un tab
void WorldEnd()
write world begin and un tab
void Cylinder(const Real _radius, const Real _zMin, const Real _zMax, const Real _sweep)
write an RiCylinder
void Scale(const Real _x, const Real _y, const Real _z)
write an RiScale
void TransformEnd()
write transform end and un tab
void Hyperboloid(const Real _p1, const Real _p2, const Real _sweep)
draw a hyperboloid to the stream
GLsizei const GLchar *const * string
int m_attribCount
count calls to AttributeBegin to ensure matching