Eidolon
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
RenderTypes.h File Reference
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cerrno>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <limits>
#include <stdexcept>
#include <unistd.h>
#include <pthread.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
Include dependency graph for RenderTypes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  triple< F, S, T >
 
class  quadruple< F, S, T, U >
 
class  TimingObject
 This type is used with the TIMING and TIMINGBLOCK macros to time routine calls and code blocks, printing a time delta value to stdout. More...
 
class  Mutex
 Simple mutex type allowing locking and attempted locking with timeout. More...
 
class  Mutex::Locker
 
class  color
 Represents a Red-Green-Blue-Alpha color with float channels. Note the lack of virtual members implies no vtable pointer. More...
 
class  vec3
 The all-important 3-space vector type. Note the lack of virtual members implies no vtable pointer. More...
 
class  mat4
 
class  rotator
 
class  IndexException
 
class  MemException
 
class  RenderException
 
class  ValueException
 
class  MetaType
 This base type provides facilities for maintaining name-value metadata pairs. More...
 
struct  AddOp< R, LH, RH >
 
struct  SubOp< R, LH, RH >
 
struct  DivOp< R, LH, RH >
 
struct  MulOp< R, LH, RH >
 
struct  SwapEndian< T >
 
struct  SwapEndian< real >
 
struct  SwapEndian< indexval >
 
struct  SwapEndian< vec3 >
 
struct  SwapEndian< color >
 
class  Matrix< T >
 
class  DataSet
 
class  Texture
 Represents a texture loaded into memory and available to the graphis hardware. More...
 
class  GPUProgram
 Represents a GPU program (vertex/fragment/geometry shader) More...
 
class  PositionQueue< T >
 
class  ControlCurve< T >
 
class  Vec3Curve
 
class  Spectrum
 
class  Material
 
class  Light
 
class  VertexBuffer
 
class  IndexBuffer
 An IndexBuffer is used by Figure objects to read in the topologies for the figures to render, and can also be subtyped in Python. More...
 
class  CallbackVertexBuffer< Ctx >
 
class  CallbackIndexBuffer< Ctx >
 See CallbackVertexBuffer, the same concept applies here with a buffer accepting functions defined in Cython to adapt Python code. More...
 
class  MatrixVertexBuffer
 
class  MatrixIndexBuffer
 Implementation of a IndexBuffer which uses matrices for storage, like MatrixVertexBuffer. More...
 
class  Ray
 Represents a ray emanating from a point and moving in a direction. It provides methods for doing intersection tests. More...
 
class  transform
 
class  Image
 Image objects represented loaded image files. These are used to access image data in code rather than load it into the renderer. More...
 
class  Camera
 
class  Figure
 
class  BBSetFigure
 This subtype of Figure represents a set of billboards, squares with textures in space which are oriented relative to the camera. More...
 
class  TextureVolumeFigure
 
class  GlyphFigure
 
class  RibbonFigure
 
class  TextFigure
 
class  Config
 
class  RenderScene
 
class  RenderAdapter
 
struct  StrConvert< T >
 Partial templates for converting strings to primitives/vec3. More...
 
struct  StrConvert< real >
 
struct  StrConvert< indexval >
 
struct  ParseLine< T >
 Partial templates for converting a line of text into a list of primitives/vec3. More...
 
struct  ParseLine< vec3 >
 vec3 specific case to handle turning 3 parsed values into 1 object More...
 

Namespaces

 RenderTypes
 

Macros

#define MAXSHMNAMLEN   NAME_MAX
 
#define DLLEXPORT
 
#define PLATFORM_ID   "Linux"
 
#define dPI   3.141592653589793238462
 
#define fPI   3.141592f
 
#define fEPSILON   1.0e-10f
 
#define dEPSILON   1.0e-10
 
#define _HASH(h, v, s)   (((h)<<(s)|((h)>>((sizeof(h)<<3)-(s))))^(v))
 
#define DBGOUT(c)   do { std::cout << c << std::endl; std::cout.flush(); } while(0)
 
#define SAFE_DELETE(p)   do { if((p)!=NULL){ delete (p); (p)=NULL; } } while(0)
 
#define TIMING   TimingObject __functimer(__FUNCTION__)
 
#define TIMINGBLOCK(label)   for(TimingObject __blockobj(label);__blockobj.loopOnce();)
 
#define MutexType   pthread_mutex_t
 
#define trylock_mutex(m)   (pthread_mutex_trylock(m)==0)
 
#define lock_mutex   pthread_mutex_lock
 
#define unlock_mutex   pthread_mutex_unlock
 
#define destroy_mutex   pthread_mutex_destroy
 
#define critical(m)   for(Mutex::Locker __locker__=Mutex::Locker(m);__locker__.loopOnce();)
 
#define trylock(m, timeout)   for(Mutex::Locker __locker__=Mutex::Locker(m,timeout);__locker__.loopOnce();)
 
#define CHECK_NULL(val)   checkNull("val",(const void*)val,__FILE__,__LINE__)
 

Typedefs

typedef unsigned long _WId
 
typedef int i32
 
typedef long long i64
 
typedef unsigned char u8
 
typedef unsigned int u32
 
typedef unsigned long long u64
 
typedef u32 sval
 
typedef double real
 
typedef u32 rgba
 
typedef u32 indexval
 
typedef std::pair< indexval, indexval > indexpair
 
typedef std::pair< real, real > realpair
 
typedef triple< real, real, real > realtriple
 
typedef std::pair< indexval, realtriple > indextriple
 
typedef triple< sval, sval, real > intersect
 
typedef Matrix< real > RealMatrix
 
typedef Matrix< vec3 > Vec3Matrix
 
typedef Matrix< indexval > IndexMatrix
 
typedef Matrix< color > ColorMatrix
 

Enumerations

enum  FigureType {
  FT_LINELIST = 0, FT_POINTLIST = 1, FT_TRILIST = 2, FT_TRISTRIP = 3,
  FT_BB_POINT = 4, FT_BB_FIXED_PAR = 5, FT_BB_FIXED_PERP = 6, FT_GLYPH = 7,
  FT_RIBBON = 8, FT_TEXVOLUME = 9, FT_TEXT = 10
}
 Defines the figure types which the Figure class and subclasses are capable of representing. More...
 
enum  BlendMode {
  BM_ALPHA, BM_COLOR, BM_ADD, BM_MOD,
  BM_REPLACE
}
 
enum  TextureFormat {
  TF_RGB24, TF_RGBA32, TF_ARGB32, TF_LUM8,
  TF_LUM16, TF_ALPHA8, TF_ALPHALUM8, TF_UNKNOWN
}
 
enum  ProgramType { PT_VERTEX =0, PT_FRAGMENT =1, PT_GEOMETRY =2 }
 
enum  HAlignType { H_LEFT, H_RIGHT, H_CENTER }
 
enum  VAlignType { V_TOP, V_BOTTOM, V_CENTER }
 

Functions

template<typename T >
_min (const T &a, const T &b)
 
template<typename T >
_max (const T &a, const T &b)
 
template<typename T >
clamp (const T &val, const T &minval, const T &maxval)
 
template<typename T >
lerpXi (const T &val, const T &minv, const T &maxv)
 
template<typename V , typename T >
lerp (const V &val, const T &v1, const T &v2)
 
template<typename T >
int compT (const T &t1, const T &t2)
 
template<typename T >
int compV (const void *t1, const void *t2)
 
template<typename T >
int sortTupleFirstCB (const void *v1, const void *v2)
 
template<typename T >
int sortTupleSecondCB (const void *v1, const void *v2)
 
template<typename T >
int sortTupleThirdCB (const void *v1, const void *v2)
 
template<typename T >
int sortTupleFourthCB (const void *v1, const void *v2)
 
bool equalsEpsilon (real v1, real v2)
 Returns true if `v1' and `v2' are within 'dEPSILON' of one another. More...
 
bool isNan (real v)
 Returns true if `v' is NaN. More...
 
real frand ()
 
real fround (real r)
 
std::string getPIDStr ()
 
std::string getPPIDStr ()
 
bool isParentProc ()
 
template<typename T >
swapEndianN (T t)
 
template<typename T >
swapEndian32 (T t)
 
template<typename T >
swapEndian64 (T t)
 
template<typename T >
void bswap (T &a, T &b)
 
void initSharedDir (const std::string &path)
 
std::string getSharedDir ()
 
void addShared (const std::string &name)
 
void unlinkShared (const std::string &name)
 
void checkNull (const std::string valuename, const void *val, const char *file=NULL, int line=-1) throw (ValueException)
 
void readBinaryFileToBuff (const char *filename, size_t offset, void *dest, size_t len) throw (MemException)
 Using mmap, copy the contents from file `filename' into `dest' starting `offset' bytes from the beginning. More...
 
void storeBufftoBinaryFile (const char *filename, void *src, size_t len, int *header, size_t headerlen) throw (MemException)
 Using mmap, copy the contents of `header' and then `src' into file `filename'. More...
 
RenderAdapter * getRenderAdapter (Config *config) throw (RenderException)
 
template<typename T , typename V >
void setMatrixMinMax (Matrix< T > *mat, const V &minv, const V &maxv)
 
template<typename T >
void readTextFileMatrix (const std::string &filename, sval numHeaders, Matrix< T > *mat)
 Reads the text file into the given matrix, ignoring the header of integers and using the dimensions of `mat' to determine line width. More...
 
template<typename T >
void convertStreamToRealMatrix (const T *stream, RealMatrix *mat)
 Fill a given RealMatrix with data from the given byte stream which contains values of various types. More...
 
void convertUByteStreamToRealMatrix (const char *stream, RealMatrix *mat)
 
void convertUShortStreamToRealMatrix (const char *stream, RealMatrix *mat)
 
void convertByteStreamToRealMatrix (const char *stream, RealMatrix *mat)
 
void convertShortStreamToRealMatrix (const char *stream, RealMatrix *mat)
 
void convertUIntStreamToRealMatrix (const char *stream, RealMatrix *mat)
 
void convertIntStreamToRealMatrix (const char *stream, RealMatrix *mat)
 
void convertFloatStreamToRealMatrix (const char *stream, RealMatrix *mat)
 
void convertRealStreamToRealMatrix (const char *stream, RealMatrix *mat)
 
std::pair< vec3, vec3 > calculateBoundBox (const Vec3Matrix *mat)
 
realtriple calculateTriPlaneSlice (const vec3 &planept, const vec3 &planenorm, const vec3 &a, const vec3 &b, const vec3 &c)
 
real calculateLinePlaneSlice (const vec3 &planept, const vec3 &planenorm, const vec3 &a, const vec3 &b)
 
void calculateTetValueIntersects (real val, real a, real b, real c, real d, real *results)
 
sval calculateHexValueIntersects (real val, const real *vals, intersect *results)
 
void basis_Tet1NL (real xi0, real xi1, real xi2, real *coeffs)
 Linear Nodal Lagrange tetrahedron basis function, fills in `coeffs' for the given xi value, `coeffs' must be 4 long. More...
 
void basis_Hex1NL (real xi0, real xi1, real xi2, real *coeffs)
 Linear Nodal Lagrange hexahedron basis function, fills in `coeffs' for the given xi value, `coeffs' must be 8 long. More...
 
real basis_n_NURBS (sval ctrlpt, sval degree, real xi, const RealMatrix *knots)
 
void basis_NURBS_default (real u, real v, real w, sval ul, sval vl, sval wl, sval udegree, sval vdegree, sval wdegree, real *coeffs)
 
void catmullRomSpline (real t, real *coeffs)
 Produces the 4 coefficients for a Catmull-Rom spline in [value 1, value 2, derivative 1, derivative 2] orderings in `coeffs'. More...
 
real mat4Det (real a, real b, real c, real d, real e, real f, real g, real h, real i, real j, real k, real l, real m, real n, real o, real p)
 
bool pointInTet (vec3 pt, vec3 n1, vec3 n2, vec3 n3, vec3 n4)
 Returns true if `pt' is in the tet (n1,n2,n3,n4). More...
 
bool pointInHex (vec3 pt, vec3 n1, vec3 n2, vec3 n3, vec3 n4, vec3 n5, vec3 n6, vec3 n7, vec3 n8)
 Returns true if `pt' is in the hex defined by (n1-n8) More...
 
float calculateTetVolume (vec3 a, vec3 b, vec3 c, vec3 d)
 Returns the volume of the linear tetrahedron defined by (a,b,c,d), the volume will be negative for an inverted tet. More...
 
vec3 pointSearchLinTet (vec3 pt, vec3 n1, vec3 n2, vec3 n3, vec3 n4)
 
vec3 pointSearchLinHex (vec3 pt, vec3 n1, vec3 n2, vec3 n3, vec3 n4, vec3 n5, vec3 n6, vec3 n7, vec3 n8)
 
template<typename T >
void cubicInterpMatrices (real t, const Matrix< T > *v1, const Matrix< T > *v2, const Matrix< T > *m1, const Matrix< T > *m2, const Matrix< T > *result)
 
template<typename T >
quadruple< int, int, int, int > calculateBoundSquare (const Matrix< T > *const mat, const T &threshold)
 Returns the bounding box (minx,miny,maxx,maxy) in matrix coordinates containing all values in `mat' greater than `threshold'. More...
 
template<typename T >
sval countValuesInRange (const Matrix< T > *mat, const T &minv, const T &maxv)
 
template<typename T >
std::vector< vec3 > findBoundaryPoints (const Matrix< T > *mat, const T &threshold)
 
template<typename T >
sumMatrix (const Matrix< T > *mat)
 
template<typename T >
std::pair< T, T > minmaxMatrix (const Matrix< T > *mat) throw (ValueException)
 
template<typename T >
bilerpMatrix (const Matrix< T > *mat, real x, real y) throw (ValueException)
 
template<typename T >
trilerpMatrices (const Matrix< T > *mat1, const Matrix< T > *mat2, vec3 v1, vec3 v2) throw (ValueException)
 
vec3 getPlaneXi (const vec3 &pos, const vec3 &planepos, const rotator &orientinv, const vec3 &dimvec)
 
void interpolateImageStack (const std::vector< RealMatrix *> &stack, const transform &stacktransinv, RealMatrix *out, const transform &outtrans)
 
real getImageStackValue (const std::vector< RealMatrix *> &stack, const vec3 &pos)
 
void calculateImageHistogram (const RealMatrix *img, RealMatrix *hist, i32 minv)
 
vec3 * calculateTriNorms (vec3 *nodes, sval numnodes, indexval *inds, sval numinds)
 

Variables

static const char * platformID =PLATFORM_ID
 
static const char * parentPIDVar ="PARENTPID"
 
static const char * RenderParamGroup ="RenderParam"
 
static const real realInf =std::numeric_limits<real>::infinity()
 

Macro Definition Documentation

◆ _HASH

#define _HASH (   h,
  v,
 
)    (((h)<<(s)|((h)>>((sizeof(h)<<3)-(s))))^(v))

◆ CHECK_NULL

#define CHECK_NULL (   val)    checkNull("val",(const void*)val,__FILE__,__LINE__)

◆ critical

#define critical (   m)    for(Mutex::Locker __locker__=Mutex::Locker(m);__locker__.loopOnce();)

◆ DBGOUT

#define DBGOUT (   c)    do { std::cout << c << std::endl; std::cout.flush(); } while(0)

◆ dEPSILON

#define dEPSILON   1.0e-10

◆ destroy_mutex

#define destroy_mutex   pthread_mutex_destroy

◆ DLLEXPORT

#define DLLEXPORT

◆ dPI

#define dPI   3.141592653589793238462

◆ fEPSILON

#define fEPSILON   1.0e-10f

◆ fPI

#define fPI   3.141592f

◆ lock_mutex

#define lock_mutex   pthread_mutex_lock

◆ MAXSHMNAMLEN

#define MAXSHMNAMLEN   NAME_MAX

◆ MutexType

#define MutexType   pthread_mutex_t

◆ PLATFORM_ID

#define PLATFORM_ID   "Linux"

◆ SAFE_DELETE

#define SAFE_DELETE (   p)    do { if((p)!=NULL){ delete (p); (p)=NULL; } } while(0)

◆ TIMING

#define TIMING   TimingObject __functimer(__FUNCTION__)

◆ TIMINGBLOCK

#define TIMINGBLOCK (   label)    for(TimingObject __blockobj(label);__blockobj.loopOnce();)

◆ trylock

#define trylock (   m,
  timeout 
)    for(Mutex::Locker __locker__=Mutex::Locker(m,timeout);__locker__.loopOnce();)

◆ trylock_mutex

#define trylock_mutex (   m)    (pthread_mutex_trylock(m)==0)

◆ unlock_mutex

#define unlock_mutex   pthread_mutex_unlock

Typedef Documentation

◆ _WId

typedef unsigned long _WId