/* $Id: gl2ps.c,v 1.1.1.1 2006/04/03 23:59:24 CVS Exp $ */
/*
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of either:
*
* a) the GNU Library General Public License as published by the Free
* Software Foundation, either version 2 of the License, or (at your
* option) any later version; or
*
* b) the GL2PS License as published by Christophe Geuzaine, either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
* the GNU Library General Public License or the GL2PS License for
* more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library in the file named "COPYING.LGPL";
* if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
* Cambridge, MA 02139, USA.
*
* You should have received a copy of the GL2PS License with this
* library in the file named "COPYING.GL2PS"; if not, I will be glad
* to provide one.
*
* Contributors:
* Michael Sweet <mike@easysw.com>
* Marc Ume <marc.ume@digitalgraphics.be>
* Jean-Francois Remacle <remacle@gce.ucl.ac.be>
* Bart Kaptein <B.L.Kaptein@lumc.nl>
* Quy Nguyen-Dai <quy@nguyendai.org>
* Sam Buss <sbuss@ucsd.edu>
* Shane Hill <Shane.Hill@dsto.defence.gov.au>
* Romain Boman <r_boman@yahoo.fr>
* Rouben Rostamian <rostamian@umbc.edu>
* Diego Santa Cruz <Diego.SantaCruz@epfl.ch>
* Shahzad Muzaffar <Shahzad.Muzaffar@cern.ch>
* Lassi Tuura <lassi.tuura@cern.ch>
* Guy Barrand <barrand@lal.in2p3.fr>
* Prabhu Ramachandran <prabhu@aero.iitm.ernet.in>
* Micha Bieber <bieber@traits.de>
*
* For the latest info about gl2ps, see http://www.geuz.org/gl2ps/.
* Please report all bugs and problems to <gl2ps@geuz.org>.
*/
#if !defined(WIN32) || defined(__CYGWIN__)
#pragma implementation
#endif // WIN32
#include <math.h>
#include <string.h>
#include <sys/types.h>
#include <stdarg.h>
#include <time.h>
#include <float.h>
#include "gl2ps.h"
/*********************************************************************
*
* Private definitions, data structures and prototypes
*
*********************************************************************/
/* Magic numbers (assuming that the order of magnitude of window
coordinates is 10^3) */
#define GL2PS_EPSILON 5.0e-3F
#define GL2PS_ZSCALE 1000.0F
#define GL2PS_ZOFFSET 1.0F
#define GL2PS_ZOFFSET_LARGE 20.0F
#define GL2PS_ZERO(arg) (fabs(arg) < 1.e-20)
/* Primitive types */
#define GL2PS_NOTYPE -1
#define GL2PS_TEXT 1
#define GL2PS_POINT 2
#define GL2PS_LINE 3
#define GL2PS_QUADRANGLE 4
#define GL2PS_TRIANGLE 5
#define GL2PS_PIXMAP 6
#define GL2PS_IMAGEMAP 7
#define GL2PS_IMAGEMAP_WRITTEN 8
#define GL2PS_IMAGEMAP_VISIBLE 9
/* BSP tree primitive comparison */
#define GL2PS_COINCIDENT 1
#define GL2PS_IN_FRONT_OF 2
#define GL2PS_IN_BACK_OF 3
#define GL2PS_SPANNING 4
/* 2D BSP tree primitive comparison */
#define GL2PS_POINT_COINCIDENT 0
#define GL2PS_POINT_INFRONT 1
#define GL2PS_POINT_BACK 2
/* Pass through options */
#define GL2PS_BEGIN_POLYGON_OFFSET_FILL 1
#define GL2PS_END_POLYGON_OFFSET_FILL 2
#define GL2PS_BEGIN_POLYGON_BOUNDARY 3
#define GL2PS_END_POLYGON_BOUNDARY 4
#define GL2PS_BEGIN_LINE_STIPPLE 5
#define GL2PS_END_LINE_STIPPLE 6
#define GL2PS_SET_POINT_SIZE 7
#define GL2PS_SET_LINE_WIDTH 8
#define GL2PS_BEGIN_BLEND 9
#define GL2PS_END_BLEND 10
#define GL2PS_SRC_BLEND 11
#define GL2PS_DST_BLEND 12
#define GL2PS_DRAW_IMAGEMAP_TOKEN 13
typedef enum {
T_UNDEFINED = -1,
T_CONST_COLOR = 1,
T_VAR_COLOR = 1<<1,
T_ALPHA_1 = 1<<2,
T_ALPHA_LESS_1 = 1<<3,
T_VAR_ALPHA = 1<<4
} GL2PS_TRIANGLE_PROPERTY;
typedef GLfloat GL2PSxyz[3];
typedef GLfloat GL2PSplane[4];
typedef struct _GL2PSbsptree2d GL2PSbsptree2d;
struct _GL2PSbsptree2d {
GL2PSplane plane;
GL2PSbsptree2d *front, *back;
};
typedef struct {
GLint nmax, size, incr, n;
char *array;
} GL2PSlist;
typedef struct _GL2PSbsptree GL2PSbsptree;
struct _GL2PSbsptree {
GL2PSplane plane;
GL2PSlist *primitives;
GL2PSbsptree *front, *back;
};
typedef struct {
GL2PSxyz xyz;
GL2PSrgba rgba;
} GL2PSvertex;
typedef struct {
GL2PSvertex vertex[3];
int prop;
} GL2PStriangle;
typedef struct {
GLshort fontsize;
char *str, *fontname;
GLint alignment;
GLfloat angle;
} GL2PSstring;
/* FIXME: in the case of an image map, "type" indicates if this image
map has already been written to the PostScript file or not, and
"format" indicates if this image map is visible or not */
typedef struct {
GLsizei width, height;
GLenum format, type;
GLfloat *pixels;
} GL2PSimage;
typedef struct _GL2PSimagemap GL2PSimagemap;
struct _GL2PSimagemap {
GL2PSimage *image;
GL2PSimagemap *next;
};
typedef struct {
GLshort type, numverts;
GLushort pattern;
char boundary, offset, culled;
GLint factor;
GLfloat width;
GL2PSvertex *verts;
union {
GL2PSstring *text;
GL2PSimage *image;
} data;
} GL2PSprimitive;
typedef struct {
#ifdef GL2PS_HAVE_ZLIB
Bytef *dest, *src, *start;
uLongf destLen, srcLen;
#else
int dummy;
#endif
} GL2PScompress;
typedef struct{
GL2PSlist* ptrlist;
int gsno, fontno, imno, shno, maskshno, trgroupno;
int gsobjno, fontobjno, imobjno, shobjno, maskshobjno, trgroupobjno;
} GL2PSpdfgroup;
typedef struct {
/* General */
GLint format, sort, options, colorsize, colormode, buffersize;
char *title, *producer, *filename;
GLboolean boundary, blending;
GLfloat *feedback, offset[2], lastlinewidth;
GLint viewport[4], blendfunc[2], lastfactor;
GL2PSrgba *colormap, lastrgba, threshold;
GLushort lastpattern;
GL2PSlist *primitives;
FILE *stream;
GL2PScompress *compress;
/* BSP-specific */
GLint maxbestroot;
/* Occlusion culling-specific */
GLboolean zerosurfacearea;
GL2PSbsptree2d *imagetree;
GL2PSprimitive *primitivetoadd;
/* PDF-specific */
int streamlength;
GL2PSlist *pdfprimlist, *pdfgrouplist;
int *xreflist;
int objects_stack; /* available objects */
int extgs_stack; /* graphics state object number */
int font_stack; /* font object number */
int im_stack; /* image object number */
int trgroupobjects_stack; /* xobject numbers */
int shader_stack; /* shader object numbers */
int mshader_stack; /* mask shader object numbers */
/* for image map list */
GL2PSimagemap *imagemap_head;
GL2PSimagemap *imagemap_tail;
} GL2PScontext;
/* The gl2ps context. gl2ps is not thread safe (we should create a
local GL2PScontext during gl2psBeginPage) */
static GL2PScontext *gl2ps = NULL;
/* Need to forward declare this one */
static GLint gl2psPrintPrimitives(void);
/*********************************************************************
*
* Utility routines
*
*********************************************************************/
static void gl2psMsg(GLint level, char *fmt, ...)
{
va_list args;
if(!(gl2ps->options & GL2PS_SILENT)){
switch(level){
case GL2PS_INFO : fprintf(stderr, "GL2PS info: "); break;
case GL2PS_WARNING : fprintf(stderr, "GL2PS warning: "); break;
case GL2PS_ERROR : fprintf(stderr, "GL2PS error: "); break;
}
va_start(args, fmt);
vfprintf(stderr, fmt, args
没有合适的资源?快使用搜索试试~ 我知道了~
Marching Cubes 二义性
共38个文件
csg:9个
h:6个
cpp:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 167 浏览量
2022-04-21
23:54:55
上传
评论
收藏 3.92MB ZIP 举报
温馨提示
在MC(Marching Cubes)算法中,考虑了二义性的问题,是一个很好的程序(MC (Marching Cubes) algorithm, consider the ambiguity problem, it is a good program)
资源推荐
资源详情
资源评论
收起资源包目录
marching_cubes_jgt.zip (38个子文件)
marching_cubes_jgt
二义性marching_cubes_jgt
arc.csg 40B
MarchingCubes.dsp 4KB
car.csg 264B
MarchingCubes.vcproj 6KB
MarchingCubes.sln 2KB
gl2ps.h 5KB
LookUpTableTest.vcproj.WWW-C6EE5ED92D2.Administrator.user 1KB
fparser.cpp 90KB
MarchingCubes.suo 26KB
MarchingCubes.cpp 40KB
sphere_torii.csg 56B
cube_sphere.csg 48B
LookUpTableTest.dsp 3KB
MarchingCubesGLUI.dsp 4KB
balls_annulus.csg 136B
bottle.csg 73B
gl2ps.c 156KB
MarchingCubes.vcproj.WWW-C6EE5ED92D2.Administrator.user 1KB
MarchingCubes.h 13KB
Doxyfile 9KB
README 4KB
csg.h 6KB
mainGLUI.cpp 41KB
LookUpTable.h 155KB
ply.c 93KB
main.cpp 4KB
MarchingCubesGLUI.vcproj.WWW-C6EE5ED92D2.Administrator.user 1KB
MarchingCubes.ncb 13.19MB
Makefile 4KB
balls.csg 80B
spheres_cylinder.csg 56B
drilled.csg 240B
fparser.h 5KB
ply.h 9KB
LookUpTableTest.cpp 55KB
MarchingCubes.dsw 969B
MarchingCubesGLUI.vcproj 7KB
LookUpTableTest.vcproj 5KB
共 38 条
- 1
资源评论
- 清小姜2022-06-07用户下载后在一定时间内未进行评价,系统默认好评。
wouderw
- 粉丝: 268
- 资源: 2960
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功