NGL  6.5
The NCCA Graphics Library
ngl::RibExport Class Reference

simple rib export class, attempts to auto tab the rib file etc. needs lots of work to make it complete!! More...

#include <RibExport.h>

+ Collaboration diagram for ngl::RibExport:

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...
 

Detailed Description

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

Author
Jonathan Macey
Version
1.2
Date
24/11/04
Todo:
add code for exporting basic Rib geometry patches etc.

Definition at line 41 of file RibExport.h.

Constructor & Destructor Documentation

ngl::RibExport::RibExport ( const std::string _fileName,
bool  _oneShot = false 
)

ctor passing in the name of the rib file to open

Parameters
[in]_fileNamethe 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.

Member Function Documentation

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().

+ Here is the call graph for this function:

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().

+ Here is the call graph for this function:

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

Parameters
[in]_sTextthe text to write

Definition at line 64 of file RibExport.cpp.

References m_ribFile.

void ngl::RibExport::Cone ( const Real  _height,
const Real  _radius,
const Real  _sweep 
)

write an RiCone to the stream

Parameters
[in]_heightthe height of the cone
[in]_radiusthe radius of the cone
[in]_sweepthe sweep of the cone

Definition at line 208 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

void ngl::RibExport::Cylinder ( const Real  _radius,
const Real  _zMin,
const Real  _zMax,
const Real  _sweep 
)

write an RiCylinder

Parameters
[in]_radiusthe radius of the Cylinder
[in]_zMinthe min z sweep
[in]_zMaxthe max z sweep
[in]_sweephow much of the sphere to draw

Definition at line 201 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

void ngl::RibExport::Disk ( const Real  _height,
const Real  _radius,
const Real  _sweep 
)

draw an RiDisk to the stream

Parameters
[in]_heightthe height of the disk
[in]_radiusthe radius of the disk
[in]_sweepthe sweep of the disk

Definition at line 229 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

std::fstream& ngl::RibExport::getStream ( )
inline

a method to get the rib stream

Definition at line 183 of file RibExport.h.

void ngl::RibExport::Hyperboloid ( const Real  _p1,
const Real  _p2,
const Real  _sweep 
)

draw a hyperboloid to the stream

Parameters
[in]_p1the first point of the hyperboloid sweep
[in]_p2the 2nd point of the hyperboloid sweep
[in]_sweepthe sweep of the hyperboloid

Definition at line 222 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

bool ngl::RibExport::isOpen ( )
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.

+ Here is the call graph for this function:

void ngl::RibExport::Paraboloid ( const Real  _topRad,
const Real  _zMin,
const Real  _zMax,
const Real  _sweep 
)

write an RiParaboloid to the stream

Parameters
[in]_topRadthe top radius of the paraboloid
[in]_zMinthe min z sweep
[in]_zMaxthe max z sweep
[in]_sweepthe sweep of the paraboloid

Definition at line 215 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

void ngl::RibExport::Rotate ( const Real  _angle,
const Real  _x,
const Real  _y,
const Real  _z 
)

write an RiRotate

Parameters
[in]_anglethe angle to rotate around the axis specified
[in]_xthe x axis value
[in]_ythe y axis value
[in]_zthe z axis value

Definition at line 180 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

void ngl::RibExport::Scale ( const Real  _x,
const Real  _y,
const Real  _z 
)

write an RiScale

Parameters
[in]_xthe x scale value
[in]_ythe y scale value
[in]_zthe z scale value

Definition at line 187 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

void ngl::RibExport::Sphere ( const Real  _radius,
const Real  _zMin,
const Real  _zMax,
const Real  _sweep 
)

write an RiSphere

Parameters
[in]_radiusthe radius of the sphere
[in]_zMinthe min z sweep
[in]_zMaxthe max z sweep
[in]_sweephow much of the sphere to draw

Definition at line 194 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

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

Parameters
[in]_majorthe major radius of the torus
[in]_minorthe minor radius of the torus
[in]_phiMinthe min value of the radial sweep
[in]_phiMaxthe max value of the radial sweep
[in]_sweepthe sweep of the torus

Definition at line 236 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

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().

+ Here is the call graph for this function:

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().

+ Here is the call graph for this function:

void ngl::RibExport::Translate ( const Real  _x,
const Real  _y,
const Real  _z 
)

write an RiTranslate to file

Parameters
[in]_xthe x translate value
[in]_ythe y translate value
[in]_zthe z translate value

Definition at line 173 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

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().

+ Here is the call graph for this function:

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().

+ Here is the call graph for this function:

void ngl::RibExport::writeTabs ( )

method to auto write tabs

Definition at line 102 of file RibExport.cpp.

References m_ribFile, and m_tabs.

+ Here is the caller graph for this function:

void ngl::RibExport::writeToFile ( std::string  _string)

Write text to rib file.

Parameters
[in]_stringthe string to write

Definition at line 165 of file RibExport.cpp.

References m_ribFile, and writeTabs().

+ Here is the call graph for this function:

Member Data Documentation

int ngl::RibExport::m_attribCount
protected

count calls to AttributeBegin to ensure matching

Definition at line 193 of file RibExport.h.

int ngl::RibExport::m_frameNumber
protected

Hold the frame number for calls to Frame.

Definition at line 205 of file RibExport.h.

bool ngl::RibExport::m_isOpen
protected

if the stream is open

Definition at line 217 of file RibExport.h.

bool ngl::RibExport::m_oneShot
protected

we can use this once or multiple times

Definition at line 221 of file RibExport.h.

std::fstream ngl::RibExport::m_ribFile
protected

the RibFile stream opened in the ctor

Definition at line 189 of file RibExport.h.

std::string ngl::RibExport::m_ribFileName
protected

The name of the RibFile.

Definition at line 209 of file RibExport.h.

int ngl::RibExport::m_tabs
protected

the current tab level for auto tabing of rib file

Definition at line 213 of file RibExport.h.

int ngl::RibExport::m_transformCount
protected

count calls to TransformBegin to ensure matching

Definition at line 197 of file RibExport.h.

int ngl::RibExport::m_worldCount
protected

count calls to WorldBegin to ensure matching

Definition at line 201 of file RibExport.h.


The documentation for this class was generated from the following files: