/*
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2011 C. Geuzaine
*
* 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.
*
* For the latest info about gl2ps and a full list of contributors,
* see http://www.geuz.org/gl2ps/.
*
* Please report all bugs and problems to <gl2ps@geuz.org>.
*/
#include "gl2ps.h"
#include <math.h>
#include <string.h>
#include <sys/types.h>
#include <stdarg.h>
#include <time.h>
#include <float.h>
#if defined(GL2PS_HAVE_ZLIB)
#include <zlib.h>
#endif
#if defined(GL2PS_HAVE_LIBPNG)
#include <png.h>
#endif
/*********************************************************************
*
* 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 5.0e-2F
#define GL2PS_ZOFFSET_LARGE 20.0F
#define GL2PS_ZERO(arg) (fabs(arg) < 1.e-20)
/* Primitive types */
#define GL2PS_NO_TYPE -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
#define GL2PS_SPECIAL 10
/* 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
/* Internal feedback buffer pass-through tokens */
#define GL2PS_BEGIN_OFFSET_TOKEN 1
#define GL2PS_END_OFFSET_TOKEN 2
#define GL2PS_BEGIN_BOUNDARY_TOKEN 3
#define GL2PS_END_BOUNDARY_TOKEN 4
#define GL2PS_BEGIN_STIPPLE_TOKEN 5
#define GL2PS_END_STIPPLE_TOKEN 6
#define GL2PS_POINT_SIZE_TOKEN 7
#define GL2PS_LINE_WIDTH_TOKEN 8
#define GL2PS_BEGIN_BLEND_TOKEN 9
#define GL2PS_END_BLEND_TOKEN 10
#define GL2PS_SRC_BLEND_TOKEN 11
#define GL2PS_DST_BLEND_TOKEN 12
#define GL2PS_IMAGEMAP_TOKEN 13
#define GL2PS_DRAW_PIXELS_TOKEN 14
#define GL2PS_TEXT_TOKEN 15
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;
/* Note: for a 'special' string, 'alignment' holds the format
(PostScript, PDF, etc.) of the special string */
GLint alignment;
GLfloat angle;
} GL2PSstring;
typedef struct {
GLsizei width, height;
/* Note: for an imagemap, 'type' indicates if it has already been
written to the file or not, and 'format' indicates if it is
visible or not */
GLenum format, type;
GLfloat zoom_x, zoom_y;
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 {
#if defined(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, bgcolor;
GLushort lastpattern;
GL2PSvertex lastvertex;
GL2PSlist *primitives, *auxprimitives;
FILE *stream;
GL2PScompress *compress;
GLboolean header;
/* 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;
typedef struct {
void (*printHeader)(void);
void (*printFooter)(void);
void (*beginViewport)(GLint viewport[4]);
GLint (*endViewport)(void);
void (*printPrimitive)(void *data);
void (*printFinalPrimitive)(void);
const char *file_extension;
const char *description;
} GL2PSbackend;
/* 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, const 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);
va_end(args);
fprintf(stderr, "\n");
}
/* if(level == GL2PS_ERROR) exit(1); */
}
static void *gl2psMalloc(size_t size)
{
void *ptr;
if(!size) return NULL;
ptr = malloc(size);
if(!ptr){
gl2psMsg(GL2PS_ERROR, "Couldn't allocate requested memory");
return NULL;
}
return ptr;
}
static void *gl2psRealloc(void *ptr, size_t size)
{
void *orig = ptr;
没有合适的资源?快使用搜索试试~ 我知道了~
xcrysden-1.5.53.tar.gz_vasp 能带_xcrysden_xcrysden tar_xcrysden后处理
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 49 浏览量
2022-09-21
17:17:06
上传
评论
收藏 2.19MB GZ 举报
温馨提示
共565个文件
tcl:134个
c:96个
gif:71个
一块用来解决vasp中能带处理的软件,其功能很强大,使用简单
资源推荐
资源详情
资源评论
收起资源包目录
xcrysden-1.5.53.tar.gz_vasp 能带_xcrysden_xcrysden tar_xcrysden后处理 (565个子文件)
xcrysden.1 6KB
pwo2xsf.1 2KB
unitconv.1 2KB
pwi2xsf.1 2KB
ptable.1 1021B
pw.10132 1KB
AUTHORS 310B
pwo2xsf_anim.awk 5KB
pwo2xsf_opt.awk 4KB
pwo2xsf_neb.awk 3KB
getOV.awk 623B
ginp.awk 436B
in1.awk 244B
ANIM.axsf 79KB
ANIMsymb.axsf 78KB
ZnS_variable-cell.axsf 6KB
xcrysden.bat 325B
ZnS_molsurf.xcrysden.bck 49KB
plot_all_MO.sh.bck 28KB
dotV.bmp 121B
dot1x3V.bmp 111B
dot1x3H.bmp 99B
dotH.bmp 91B
BWidget:LICENSE 763B
gl2ps.c 179KB
togl.c 121KB
xcIsoSurf.c 84KB
xcAppInit.c 76KB
xcGLparam.c 73KB
xcDisplayFunc.c 71KB
readstrf.c 52KB
xcSelect.c 46KB
xcBz.c 46KB
polygonise.c 42KB
xcDisplayFunc2.c 42KB
lighting.c 36KB
xcMolSurf.c 32KB
loadValues.c 29KB
xcIsoSpaceSel.c 20KB
crySurf.c 19KB
isorender.c 19KB
colorplane.c 19KB
crySurfArgs.c 17KB
cryClip.c 17KB
readisodata.c 15KB
cryDispFunc.c 15KB
xcFont.c 15KB
lcasif.c 14KB
xcTogl.c 13KB
xcTclsh.c 13KB
xcAtomAdd.c 12KB
gridNormals.c 12KB
xcIsoDataGrid.c 12KB
xcballstick.c 12KB
xcColorScheme.c 11KB
MarchCubes.c 11KB
xsf2xsf.c 11KB
vectors.c 10KB
datagrid.c 10KB
polygonise_auxil.c 10KB
fs.c 10KB
auxilproc.c 10KB
sgiRasterFont.c 10KB
xcReadXSF.c 9KB
splineInt.c 9KB
3D.c 9KB
togl_ppm.c 9KB
xcHBonds.c 8KB
xcSuperCell.c 8KB
xcWigner.c 8KB
lcasi.c 8KB
shank_Hinv.c 8KB
cryDispFuncMultiFS.c 8KB
xcviewport.c 7KB
isoInterpolate.c 7KB
memory.c 7KB
writeXSF.c 7KB
hbonds.c 6KB
linear.c 6KB
xcForces.c 6KB
gl2psPrintTogl.c 6KB
hpsort.c 6KB
xcLabels.c 6KB
detnsplit.c 6KB
isoline.c 5KB
isoMalloc.c 5KB
shank3d.c 5KB
realTimeMovie.c 5KB
sgiAux.c 5KB
remakestr.c 5KB
voronoi.c 5KB
isoline_old.c 5KB
mxmymz.c 4KB
sInfo.c 4KB
forces.c 3KB
xcPrimitives.c 3KB
setOpenGLState.c 3KB
paraSize.c 3KB
trash.c 3KB
shank_util.c 3KB
共 565 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
小波思基
- 粉丝: 74
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功