File: optout.cpp

package info (click to toggle)
povray 1%3A3.6.1-6
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 31,052 kB
  • ctags: 20,305
  • sloc: ansic: 110,032; cpp: 86,573; sh: 13,595; pascal: 5,942; asm: 2,994; makefile: 1,747; ada: 1,637
file content (333 lines) | stat: -rw-r--r-- 10,507 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
/****************************************************************************
 *                  optout.cpp
 *
 * This module contains functions for credit, usage and options.
 *
 * from Persistence of Vision(tm) Ray Tracer version 3.6.
 * Copyright 1991-2003 Persistence of Vision Team
 * Copyright 2003-2004 Persistence of Vision Raytracer Pty. Ltd.
 *---------------------------------------------------------------------------
 * NOTICE: This source code file is provided so that users may experiment
 * with enhancements to POV-Ray and to port the software to platforms other
 * than those supported by the POV-Ray developers. There are strict rules
 * regarding how you are permitted to use this file. These rules are contained
 * in the distribution and derivative versions licenses which should have been
 * provided with this file.
 *
 * These licences may be found online, linked from the end-user license
 * agreement that is located at http://www.povray.org/povlegal.html
 *---------------------------------------------------------------------------
 * This program is based on the popular DKB raytracer version 2.12.
 * DKBTrace was originally written by David K. Buck.
 * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
 *---------------------------------------------------------------------------
 * $File: //depot/povray/3.6-release/source/optout.cpp $
 * $Revision: #3 $
 * $Change: 3032 $
 * $DateTime: 2004/08/02 18:43:41 $
 * $Author: chrisc $
 * $Log$
 *****************************************************************************/

#include <ctype.h>
#include <time.h>
#include <stdarg.h>
#include <algorithm>
#include "frame.h"
#include "vector.h"
#include "atmosph.h"
#include "bezier.h"
#include "blob.h"
#include "bbox.h"
#include "cones.h"
#include "csg.h"
#include "discs.h"
#include "fractal.h"
#include "hfield.h"
#include "lathe.h"
#include "lighting.h"
#include "mesh.h"
#include "polysolv.h"
#include "objects.h"
#include "parse.h"
#include "point.h"
#include "poly.h"
#include "polygon.h"
#include "octree.h"
#include "quadrics.h"
#include "pgm.h"
#include "ppm.h"
#include "prism.h"
#include "radiosit.h"
#include "render.h"
#include "sor.h"
#include "spheres.h"
#include "super.h"
#include "targa.h"
#include "texture.h"
#include "torus.h"
#include "triangle.h"
#include "truetype.h"
#include "userio.h"
#include "userdisp.h"
#include "lbuffer.h"
#include "vbuffer.h"
#include "povray.h"
#include "optout.h"
#include "povmsgid.h"
#include "isosurf.h"

#ifndef DONT_SHOW_IMAGE_LIB_VERSIONS
// these are needed for copyright notices and version numbers
#include "zlib.h"
#include "png.h"
#include "jversion.h"

// Including tiffio.h causes the Windows compile to break. As all we need is the
// version function, we just declare it here.
//#define __STDC__
//#include "tiffio.h"

extern "C" const char* TIFFGetVersion(void);
#endif

BEGIN_POV_NAMESPACE

/*****************************************************************************
* Local preprocessor defines
******************************************************************************/


/*****************************************************************************
* Local typedefs
******************************************************************************/


/*****************************************************************************
* Local variables
******************************************************************************/


/*****************************************************************************
* Local preprocessor defines
******************************************************************************/


/*****************************************************************************
* Global variables
******************************************************************************/

const char *Primary_Developers[] =
{
	"Chris Cason",
	"Thorsten Froehlich",
	"Nathan Kopp",
	"Ron Parker",
	NULL
};

const char *Contributing_Authors[] =
{
	"Steve Anger",
	"Eric Barish",
	"Dieter Bayer",
	"Steve A. Bennett",
	"David K. Buck",
	"Nicolas Calimet",
	"Aaron A. Collins",
	"Chris Dailey",
	"Steve Demlow",
	"Andreas Dilger",
	"Alexander Enzmann",
	"Dan Farmer",
	"Mark Gordon",
	"Christoph Hormann",
	"Mike Hough",
	"Chris Huff",
	"Kari Kivisalo",
	"Lutz Kretzschmar",
	"Jochen Lippert",
	"Pascal Massimino",
	"Jim McElhiney",
	"Douglas Muir",
	"Juha Nieminen",
	"Bill Pulver",
    "Eduard Schwan",
	"Wlodzimierz Skiba",
	"Robert Skinner",
	"Yvo Smellenbergh",
	"Zsolt Szalavari",
	"Scott Taylor",
	"Massimo Valentini",
	"Timothy Wegner",
	"Drew Wells",
	"Chris Young",
	NULL   // NULL flags the end of the list 
};

const INTERSECTION_STATS_INFO intersection_stats[kPOVList_Stat_Last] =
{
	{ kPOVList_Stat_RBezierTest,		Ray_RBezier_Tests, Ray_RBezier_Tests_Succeeded,
	  "Bezier Patch" },
	{ kPOVList_Stat_BicubicTest,		Ray_Bicubic_Tests, Ray_Bicubic_Tests_Succeeded,
	  "Bicubic Patch" },
	{ kPOVList_Stat_BlobTest,			Ray_Blob_Tests, Ray_Blob_Tests_Succeeded,
	  "Blob" },
	{ kPOVList_Stat_BlobCpTest,			Blob_Element_Tests, Blob_Element_Tests_Succeeded,
	  "Blob Component" },
	{ kPOVList_Stat_BlobBdTest,			Blob_Bound_Tests, Blob_Bound_Tests_Succeeded,
	  "Blob Bound" },
	{ kPOVList_Stat_BoxTest,			Ray_Box_Tests, Ray_Box_Tests_Succeeded,
	  "Box" },
	{ kPOVList_Stat_ConeCylTest,		Ray_Cone_Tests, Ray_Cone_Tests_Succeeded,
	  "Cone/Cylinder" },
	{ kPOVList_Stat_CSGIntersectTest,	Ray_CSG_Intersection_Tests, Ray_CSG_Intersection_Tests_Succeeded,
	  "CSG Intersection" },
	{ kPOVList_Stat_CSGMergeTest,		Ray_CSG_Merge_Tests, Ray_CSG_Merge_Tests_Succeeded,
	  "CSG Merge" },
	{ kPOVList_Stat_CSGUnionTest,		Ray_CSG_Union_Tests, Ray_CSG_Union_Tests_Succeeded,
	  "CSG Union" },
	{ kPOVList_Stat_DiscTest,			Ray_Disc_Tests, Ray_Disc_Tests_Succeeded,
	  "Disc" },
	{ kPOVList_Stat_FractalTest,		Ray_Fractal_Tests, Ray_Fractal_Tests_Succeeded,
	  "Fractal" },
	{ kPOVList_Stat_HFTest,				Ray_HField_Tests, Ray_HField_Tests_Succeeded,
	  "Height Field" },
	{ kPOVList_Stat_HFBoxTest,			Ray_HField_Box_Tests, Ray_HField_Box_Tests_Succeeded,
	  "Height Field Box" },
	{ kPOVList_Stat_HFTriangleTest,		Ray_HField_Triangle_Tests, Ray_HField_Triangle_Tests_Succeeded,
	  "Height Field Triangle" },
	{ kPOVList_Stat_HFBlockTest,		Ray_HField_Block_Tests, Ray_HField_Block_Tests_Succeeded,
	  "Height Field Block" },
	{ kPOVList_Stat_HFCellTest,			Ray_HField_Cell_Tests, Ray_HField_Cell_Tests_Succeeded,
	  "Height Field Cell" },
	{ kPOVList_Stat_IsosurfaceTest,		Ray_IsoSurface_Tests, Ray_IsoSurface_Tests_Succeeded,
	  "Isosurface" },
	{ kPOVList_Stat_IsosurfaceBdTest,	Ray_IsoSurface_Bound_Tests, Ray_IsoSurface_Bound_Tests_Succeeded,
	  "Isosurface Container" },
	{ kPOVList_Stat_IsosurfaceCacheTest,Ray_IsoSurface_Cache, Ray_IsoSurface_Cache_Succeeded,
	  "Isosurface Cache" },
	{ kPOVList_Stat_LatheTest,			Ray_Lathe_Tests, Ray_Lathe_Tests_Succeeded,
	  "Lathe" },
	{ kPOVList_Stat_LatheBdTest,		Lathe_Bound_Tests, Lathe_Bound_Tests_Succeeded,
	  "Lathe Bound" },
	{ kPOVList_Stat_MeshTest,			Ray_Mesh_Tests, Ray_Mesh_Tests_Succeeded,
	  "Mesh" },
	{ kPOVList_Stat_PlaneTest,			Ray_Plane_Tests, Ray_Plane_Tests_Succeeded,
	  "Plane" },
	{ kPOVList_Stat_PolygonTest,		Ray_Polygon_Tests, Ray_Polygon_Tests_Succeeded,
	  "Polygon" },
	{ kPOVList_Stat_PrismTest,			Ray_Prism_Tests, Ray_Prism_Tests_Succeeded,
	  "Prism" },
	{ kPOVList_Stat_PrismBdTest,		Prism_Bound_Tests, Prism_Bound_Tests_Succeeded,
	  "Prism Bound" },
	{ kPOVList_Stat_ParametricTest,		Ray_Parametric_Tests, Ray_Parametric_Tests_Succeeded,
	  "Parametric" },
	{ kPOVList_Stat_ParametricBoxTest,	Ray_Par_Bound_Tests, Ray_Par_Bound_Tests_Succeeded,
	  "Parametric Bound" },
	{ kPOVList_Stat_QuardicTest,		Ray_Quadric_Tests, Ray_Quadric_Tests_Succeeded,
	  "Quadric" },
	{ kPOVList_Stat_QuadPolyTest,		Ray_Poly_Tests, Ray_Poly_Tests_Succeeded,
	  "Quartic/Poly" },
	{ kPOVList_Stat_SphereTest,			Ray_Sphere_Tests, Ray_Sphere_Tests_Succeeded,
	  "Sphere" },
	{ kPOVList_Stat_SphereSweepTest,	Ray_Sphere_Sweep_Tests, Ray_Sphere_Sweep_Tests_Succeeded,
	  "Sphere Sweep" },
	{ kPOVList_Stat_SuperellipsTest,	Ray_Superellipsoid_Tests, Ray_Superellipsoid_Tests_Succeeded,
	  "Superellipsoid" },
	{ kPOVList_Stat_SORTest,			Ray_Sor_Tests, Ray_Sor_Tests_Succeeded,
	  "Surface of Revolution" },
	{ kPOVList_Stat_SORBdTest,			Sor_Bound_Tests, Sor_Bound_Tests_Succeeded,
	  "Surface of Rev. Bound" },
	{ kPOVList_Stat_TorusTest,			Ray_Torus_Tests, Ray_Torus_Tests_Succeeded,
	  "Torus" },
	{ kPOVList_Stat_TorusBdTest,		Torus_Bound_Tests, Torus_Bound_Tests_Succeeded,
	  "Torus Bound" },
	{ kPOVList_Stat_TriangleTest,		Ray_Triangle_Tests, Ray_Triangle_Tests_Succeeded,
	  "Triangle" },
	{ kPOVList_Stat_TTFontTest,			Ray_TTF_Tests, Ray_TTF_Tests_Succeeded,
	  "True Type Font" },
	{ kPOVList_Stat_BoundObjectTest,	Bounding_Region_Tests, Bounding_Region_Tests_Succeeded,
	  "Bounding Object" },
	{ kPOVList_Stat_ClipObjectTest,		Clipping_Region_Tests, Clipping_Region_Tests_Succeeded,
	  "Clipping Object" },
	{ kPOVList_Stat_BoundingBoxTest,	nChecked, nEnqueued,
	  "Bounding Box" },
	{ kPOVList_Stat_LightBufferTest,	LBuffer_Tests, LBuffer_Tests_Succeeded,
	  "Light Buffer" },
	{ kPOVList_Stat_VistaBufferTest,	VBuffer_Tests, VBuffer_Tests_Succeeded,
	  "Vista Buffer" },
	{ kPOVList_Stat_Last, MaxStat, MaxStat, NULL }
};

/*****************************************************************************
* Static functions
******************************************************************************/

const char *Extract_Version(const char *str);
char *GetOptionSwitchString(POVMSObjectPtr msg, POVMSType key);


/*****************************************************************************
*
* FUNCTION
*
*   ExtractVersion
*
* INPUT
*   
* OUTPUT
*   
* RETURNS
*   
* AUTHOR
*
*   POV-Ray Team
*   
* DESCRIPTION
*
*   -
*
* CHANGES
*
*   -
*
******************************************************************************/

char LibVersionStringBuffer[20]; // GLOBAL VARIABLE

const char *Extract_Version(const char *str)
{
	int pos = 0;

	for(; *str != 0; str++)
	{
		if(isdigit(*str))
		{
			while(((isalnum(*str)) || (*str == '.')) && (pos < 10))
			{
				LibVersionStringBuffer[pos] = *str;
				str++;
				pos++;
			}
			break;
		}
	}

	LibVersionStringBuffer[pos] = 0;

	return LibVersionStringBuffer;
}

char *GetOptionSwitchString(POVMSObjectPtr msg, POVMSType key)
{
	POVMSBool b = false;

	(void)POVMSUtil_GetBool(msg, key, &b);
	if(b == true)
		return ".On ";

	return ".Off";
}

END_POV_NAMESPACE