~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to librib2/librib.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LIBRIB_H
 
2
#define LIBRIB_H
 
3
 
 
4
#include <iostream>
 
5
#include <string>
 
6
#include <stdio.h>
 
7
 
 
8
#include "ri.h"
 
9
 
 
10
namespace librib
 
11
{
 
12
 
 
13
/// Provides an abstract base class for objects that implement the Renderman Interface
 
14
class RendermanInterface
 
15
{
 
16
public:
 
17
    // The standard set of Renderman Interface types
 
18
    typedef bool RtBoolean;
 
19
    typedef int RtInt;
 
20
    typedef float RtFloat;
 
21
    typedef char* RtToken;
 
22
    typedef RtFloat RtColor[ 3 ];
 
23
    typedef RtFloat RtPoint[ 3 ];
 
24
    typedef RtFloat RtMatrix[ 4 ][ 4 ];
 
25
    typedef RtFloat RtBasis[ 4 ][ 4 ];
 
26
    typedef RtFloat RtBound[ 6 ];
 
27
    typedef char* RtString;
 
28
    typedef void* RtPointer;
 
29
    typedef void RtVoid;
 
30
    typedef RtFloat ( *RtFilterFunc ) ( RtFloat, RtFloat, RtFloat, RtFloat );
 
31
    typedef RtFloat ( *RtFloatFunc ) ();
 
32
    typedef RtVoid ( *RtFunc ) ();
 
33
    typedef RtVoid ( *RtErrorFunc ) ( RtInt code, RtInt severity, const RtToken message );
 
34
    typedef RtPointer RtObjectHandle;
 
35
    typedef RtPointer RtLightHandle;
 
36
 
 
37
    virtual     RtLightHandle RiAreaLightSourceV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
38
    virtual     RtVoid  RiAtmosphereV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
39
    virtual     RtVoid  RiAttributeBegin() = 0;
 
40
    virtual     RtVoid  RiAttributeEnd() = 0;
 
41
    virtual     RtVoid  RiAttributeV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
42
    virtual     RtVoid  RiBasis( RtBasis ubasis, RtInt ustep, RtBasis vbasis, RtInt vstep ) = 0;
 
43
    virtual     RtVoid  RiBegin( RtToken name ) = 0;
 
44
    virtual     RtFloat RiBesselFilter( RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth ) = 0;
 
45
    virtual RtVoid RiBlobbyV( RtInt nleaf, RtInt ncode, RtInt code[],
 
46
                              RtInt nflt, RtFloat flt[],
 
47
                              RtInt nstr, RtToken str[],
 
48
                              RtInt n, RtToken tokens[], RtPointer parms[] ) = 0;
 
49
    virtual     RtVoid  RiBound( RtBound bound ) = 0;
 
50
    virtual     RtFloat RiBoxFilter( RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth ) = 0;
 
51
    virtual     RtFloat RiCatmullRomFilter( RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth ) = 0;
 
52
    virtual     RtVoid  RiClipping( RtFloat cnear, RtFloat cfar ) = 0;
 
53
    virtual     RtVoid  RiColor( RtColor Cq ) = 0;
 
54
    virtual     RtVoid  RiColorSamples( RtInt N, RtFloat *nRGB, RtFloat *RGBn ) = 0;
 
55
    virtual     RtVoid  RiConcatTransform( RtMatrix transform ) = 0;
 
56
    virtual     RtVoid  RiConeV( RtFloat height, RtFloat radius, RtFloat thetamax, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
57
    virtual     RtVoid  RiCoordinateSystem( RtToken space ) = 0;
 
58
    virtual     RtVoid  RiCoordSysTransform( RtToken space ) = 0;
 
59
    virtual     RtVoid  RiCropWindow( RtFloat left, RtFloat right, RtFloat top, RtFloat bottom ) = 0;
 
60
    virtual     RtVoid  RiCylinderV( RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
61
    virtual     RtToken RiDeclare( RtString name, RtString declaration ) = 0;
 
62
    virtual     RtVoid  RiDeformationV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
63
    virtual     RtVoid  RiDepthOfField( RtFloat fstop, RtFloat focallength, RtFloat focaldistance ) = 0;
 
64
    virtual     RtVoid  RiDetail( RtBound bound ) = 0;
 
65
    virtual     RtVoid  RiDetailRange( RtFloat offlow, RtFloat onlow, RtFloat onhigh, RtFloat offhigh ) = 0;
 
66
    virtual     RtFloat RiDiskFilter( RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth ) = 0;
 
67
    virtual     RtVoid  RiDiskV( RtFloat height, RtFloat radius, RtFloat thetamax, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
68
    virtual     RtVoid  RiDisplacementV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
69
    virtual     RtVoid  RiDisplayV( RtToken name, RtToken type, RtToken mode, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
70
    virtual     RtVoid  RiEnd() = 0;
 
71
    virtual     RtVoid  RiErrorAbort( RtInt code, RtInt severity, RtString  message ) = 0;
 
72
    //  virtual RtVoid  RiErrorHandler(RtErrorFunc handler) = 0;
 
73
    virtual     RtVoid  RiErrorIgnore( RtInt code, RtInt severity, RtString message ) = 0;
 
74
    virtual     RtVoid  RiErrorPrint( RtInt code, RtInt severity, RtString message ) = 0;
 
75
    virtual     RtVoid  RiExposure( RtFloat gain, RtFloat gamma ) = 0;
 
76
    virtual     RtVoid  RiExteriorV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
77
    virtual     RtVoid  RiFormat( RtInt xresolution, RtInt yresolution, RtFloat pixelaspectratio ) = 0;
 
78
    virtual     RtVoid  RiFrameAspectRatio( RtFloat frameratio ) = 0;
 
79
    virtual     RtVoid  RiFrameBegin( RtInt number ) = 0;
 
80
    virtual     RtVoid  RiFrameEnd() = 0;
 
81
    virtual     RtFloat RiGaussianFilter( RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth ) = 0;
 
82
    virtual     RtVoid  RiGeneralPolygonV( RtInt nloops, RtInt nverts[], RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
83
    virtual     RtVoid  RiGeometricApproximation( RtToken type, RtFloat value ) = 0;
 
84
    virtual     RtVoid  RiGeometryV( RtToken type, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
85
    virtual     RtVoid  RiHiderV( RtToken type, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
86
    virtual     RtVoid  RiHyperboloidV( RtPoint point1, RtPoint point2, RtFloat thetamax, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
87
    virtual     RtVoid  RiIdentity() = 0;
 
88
    virtual     RtVoid  RiIlluminate( RtLightHandle light, RtBoolean onoff ) = 0;
 
89
    virtual     RtVoid  RiImagerV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
90
    virtual     RtVoid  RiInteriorV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
91
    virtual     RtLightHandle RiLightSourceV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
92
    virtual     RtVoid  RiMakeBumpV( RtString imagefile, RtString bumpfile, RtToken swrap, RtToken twrap, RtFilterFunc filterfunc, RtFloat swidth, RtFloat twidth, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
93
    virtual     RtVoid  RiMakeCubeFaceEnvironmentV( RtString px, RtString nx, RtString py, RtString ny, RtString pz, RtString nz, RtString reflfile, RtFloat fov, RtFilterFunc filterfunc, RtFloat swidth, RtFloat twidth, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
94
    virtual     RtVoid  RiMakeLatLongEnvironmentV( RtString imagefile, RtString reflfile, RtFilterFunc filterfunc, RtFloat swidth, RtFloat twidth, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
95
    virtual     RtVoid  RiMakeShadowV( RtString picfile, RtString shadowfile, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
96
    virtual     RtVoid  RiMakeTextureV( RtString imagefile, RtString texturefile, RtToken swrap, RtToken twrap, RtFilterFunc filterfunc, RtFloat swidth, RtFloat twidth, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
97
    virtual     RtVoid  RiMakeOcclusionV( RtInt npics, RtString *picfile, RtString shadowfile, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
98
    virtual     RtVoid  RiMatte( RtBoolean onoff ) = 0;
 
99
    virtual     RtVoid  RiMotionBeginV( RtInt N, RtFloat times[] ) = 0;
 
100
    virtual     RtVoid  RiMotionEnd() = 0;
 
101
    virtual     RtVoid  RiNuPatchV( RtInt nu, RtInt uorder, RtFloat uknot[], RtFloat umin, RtFloat umax, RtInt nv, RtInt vorder, RtFloat vknot[], RtFloat vmin, RtFloat vmax, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
102
    virtual     RtObjectHandle  RiObjectBegin() = 0;
 
103
    virtual     RtVoid  RiObjectEnd() = 0;
 
104
    virtual     RtVoid  RiObjectInstance( RtObjectHandle handle ) = 0;
 
105
    virtual     RtVoid  RiOpacity( RtColor Os ) = 0;
 
106
    virtual     RtVoid  RiOptionV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
107
    virtual     RtVoid  RiOrientation( RtToken orientation ) = 0;
 
108
    virtual     RtVoid  RiParaboloidV( RtFloat rmax, RtFloat zmin, RtFloat zmax, RtFloat thetamax, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
109
    virtual     RtVoid  RiPatchMeshV( RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
110
    virtual     RtVoid  RiPatchV( RtToken type, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
111
    virtual     RtVoid  RiPerspective( RtFloat fov ) = 0;
 
112
    virtual     RtVoid  RiPixelFilter( RtFilterFunc function, RtFloat xwidth, RtFloat ywidth ) = 0;
 
113
    virtual     RtVoid  RiPixelSamples( RtFloat xsamples, RtFloat ysamples ) = 0;
 
114
    virtual     RtVoid  RiPixelVariance( RtFloat variance ) = 0;
 
115
    virtual     RtVoid  RiCurvesV( RtToken type, RtInt ncurves, RtInt nvertices[], RtToken wrap,
 
116
                              RtInt n, RtToken tokens[], RtPointer values[] ) = 0;
 
117
    virtual     RtVoid  RiPointsV( RtInt vertices, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
118
    virtual     RtVoid  RiPointsGeneralPolygonsV( RtInt npolys, RtInt nloops[], RtInt nverts[], RtInt verts[], RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
119
    virtual     RtVoid  RiPointsPolygonsV( RtInt npolys, RtInt nverts[], RtInt verts[], RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
120
    virtual     RtVoid  RiPolygonV( RtInt nvertices, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
121
    virtual     RtVoid  RiProcedural( RtPointer data, RtBound bound, RtFunc refineproc, RtFunc freeproc ) = 0;
 
122
    virtual     RtVoid  RiProjectionV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
123
    virtual     RtVoid  RiQuantize( RtToken type, RtInt one, RtInt min, RtInt max, RtFloat ditheramplitude ) = 0;
 
124
    virtual     RtVoid  RiReadArchive( RtToken data, RtArchiveCallback callback ) = 0;
 
125
    virtual     RtVoid  RiRelativeDetail( RtFloat relativedetail ) = 0;
 
126
    virtual     RtVoid  RiReverseOrientation() = 0;
 
127
    virtual     RtVoid  RiRotate( RtFloat angle, RtFloat dx, RtFloat dy, RtFloat dz ) = 0;
 
128
    virtual     RtVoid  RiScale( RtFloat sx, RtFloat sy, RtFloat sz ) = 0;
 
129
    virtual     RtVoid  RiScreenWindow( RtFloat left, RtFloat right, RtFloat bottom, RtFloat top ) = 0;
 
130
    virtual     RtVoid  RiShadingInterpolation( RtToken type ) = 0;
 
131
    virtual     RtVoid  RiShadingRate( RtFloat size ) = 0;
 
132
    virtual     RtVoid  RiShutter( RtFloat opentime, RtFloat closetime ) = 0;
 
133
    virtual     RtVoid  RiSides( RtInt nsides ) = 0;
 
134
    virtual     RtFloat RiSincFilter( RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth ) = 0;
 
135
    virtual     RtVoid  RiSkew( RtFloat angle, RtFloat dx1, RtFloat dy1, RtFloat dz1, RtFloat dx2, RtFloat dy2, RtFloat dz2 ) = 0;
 
136
    virtual     RtVoid  RiSolidBegin( RtToken type ) = 0;
 
137
    virtual     RtVoid  RiSolidEnd() = 0;
 
138
    virtual     RtVoid  RiSphereV( RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
139
    virtual     RtVoid  RiSubdivisionMeshV( RtToken scheme, RtInt nfaces, RtInt nvertices[], RtInt vertices[], RtInt ntags, RtToken tags[], RtInt nargs[], RtInt intargs[], RtFloat floatargs[], RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
140
    virtual     RtVoid  RiSurfaceV( RtToken name, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
141
    virtual     RtVoid  RiTextureCoordinates( RtFloat s1, RtFloat t1, RtFloat s2, RtFloat t2, RtFloat s3, RtFloat t3, RtFloat s4, RtFloat t4 ) = 0;
 
142
    virtual     RtVoid  RiTorusV( RtFloat majorrad, RtFloat minorrad, RtFloat phimin, RtFloat phimax, RtFloat thetamax, RtInt count, RtToken tokens[], RtPointer values[] ) = 0;
 
143
    virtual     RtVoid  RiTransform( RtMatrix transform ) = 0;
 
144
    virtual     RtVoid  RiTransformBegin() = 0;
 
145
    virtual     RtVoid  RiTransformEnd() = 0;
 
146
    virtual     RtPoint* RiTransformPoints( RtToken fromspace, RtToken tospace, RtInt npoints, RtPoint points[] ) = 0;
 
147
    virtual     RtVoid  RiTranslate( RtFloat dx, RtFloat dy, RtFloat dz ) = 0;
 
148
    virtual     RtFloat RiTriangleFilter( RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth ) = 0;
 
149
    virtual     RtVoid  RiTrimCurve( RtInt nloops, RtInt ncurves[], RtInt order[], RtFloat knot[], RtFloat min[], RtFloat max[], RtInt n[], RtFloat u[], RtFloat v[], RtFloat w[] ) = 0;
 
150
    virtual     RtVoid  RiWorldBegin() = 0;
 
151
    virtual     RtVoid  RiWorldEnd() = 0;
 
152
 
 
153
    virtual RtFilterFunc        GetFilterFunction( RtToken type ) = 0;
 
154
    virtual RtBasis*    GetBasisMatrix( RtToken type ) = 0;
 
155
    virtual     RtFunc  GetProceduralFunction( RtToken type ) = 0;
 
156
};
 
157
 
 
158
 
 
159
/// Initializes the parser and callback object with a set of standard declarations
 
160
extern "C" {
 
161
 
 
162
    void StandardDeclarations( RendermanInterface& CallbackInterface );
 
163
 
 
164
    void CleanupDeclarations( RendermanInterface& CallbackInterface );
 
165
 
 
166
    /// Parses an input stream, using the supplied callback object and sending error data to the supplied output stream
 
167
    bool Parse( FILE *InputStream, const std::string StreamName, RendermanInterface& CallbackInterface, std::ostream& ErrorStream, RtArchiveCallback callback);
 
168
    /// Parse the stream held in decoder, does not close the stream
 
169
    class CqRibBinaryDecoder;
 
170
    bool ParseOpenStream( CqRibBinaryDecoder *decoder, const std::string StreamName, RendermanInterface& CallbackInterface, std::ostream& ErrorStream, RtArchiveCallback callback);
 
171
    /// Resets the state of the parser, clearing any symbol tables, etc.
 
172
    void ResetParser();
 
173
    //
 
174
    /// Setup the defaut setting for the archive searchpath, automatically updated when an appropriate RiOption is seen.
 
175
    void UpdateArchivePath( std::string strPath );
 
176
}
 
177
 
 
178
}
 
179
; // namespace librib
 
180
 
 
181
#endif // LIBRIB_H