Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenInventorSceneHandler.cc,v 1.54 2008/04/04 13:40:04 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4OpenInventorSceneHandler.cc,v 1.55 2009/02/18 14:21:38 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// Jeff Kallenbach 01 Aug 1996
@@ -45,7 +45,6 @@
#include <Inventor/nodes/SoMaterial.h>
#include <Inventor/nodes/SoLineSet.h>
#include <Inventor/nodes/SoCube.h>
#include <Inventor/nodes/SoSphere.h>
#include <Inventor/nodes/SoFont.h>
#include <Inventor/nodes/SoText2.h>
#include <Inventor/nodes/SoFaceSet.h>
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4OpenInventorViewer.cc,v 1.59 2007/04/03 13:35:48 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4OpenInventorViewer.cc,v 1.60 2009/02/16 15:31:05 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
#ifdef G4VIS_BUILD_OI_DRIVER
@@ -479,9 +479,10 @@ void G4OpenInventorViewer::WritePostScript(const G4String& aFile) {
if(!fGL2PSAction) return;
fGL2PSAction->setFileName(aFile.c_str());
G4cout << "Produce " << aFile << "..." << G4endl;
fGL2PSAction->enableFileWriting();
ViewerRender();
fGL2PSAction->disableFileWriting();
if (fGL2PSAction->enableFileWriting()) {
ViewerRender();
fGL2PSAction->disableFileWriting();
}
}
void G4OpenInventorViewer::WritePixmapPostScript(const G4String& aFile) {
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenInventorWin.cc,v 1.6 2006/06/29 21:22:20 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4OpenInventorWin.cc,v 1.7 2009/09/18 12:48:43 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// OpenInventor graphics system factory.
@@ -52,7 +52,8 @@ void G4OpenInventorWin::Initialize ()
SetInteractorManager (G4Win32::getInstance());
GetInteractorManager () -> RemoveDispatcher((G4DispatchFunction)G4Win32::dispatchWin32Event);
GetInteractorManager () -> AddDispatcher((G4DispatchFunction)SoWin::dispatchEvent);
// GetInteractorManager () -> AddDispatcher((G4DispatchFunction)SoWin::dispatchEvent);
HWND toplevel = (HWND)GetInteractorManager()->GetMainInteractor();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenInventorWinViewer.cc,v 1.25 2006/06/29 21:22:22 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4OpenInventorWinViewer.cc,v 1.26 2009/09/18 12:48:43 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
/*
* jck : 05 Feb 1997 : Initial Implementation
@@ -64,7 +64,6 @@ public:
}
};
#define SIZE 600
// File :
#define ID_FILE_POSTSCRIPT 1
#define ID_FILE_PIXMAP_POSTSCRIPT 2
@@ -97,8 +96,16 @@ G4OpenInventorWinViewer::G4OpenInventorWinViewer(
{
G4cout << "Window name: " << fName << G4endl;
}
void G4OpenInventorWinViewer::Initialise() {
G4String wName = fName;
int width = 600;
int height = 600;
HWND parent = (HWND)fInteractorManager->GetParentInteractor ();
if(!parent) {
//Create a shell window :
@@ -121,7 +128,10 @@ G4OpenInventorWinViewer::G4OpenInventorWinViewer(
::RegisterClass(&wc);
done = TRUE;
}
width = fVP.GetWindowSizeHintX();
height = fVP.GetWindowSizeHintX();
HMENU menuBar = CreateMenu();
{HMENU casc = CreatePopupMenu();
@@ -156,7 +166,7 @@ G4OpenInventorWinViewer::G4OpenInventorWinViewer(
WS_OVERLAPPEDWINDOW |
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT,
SIZE,SIZE,
width,height,
0,menuBar,::GetModuleHandle(0),0);
// Retreive window and client sizez :
RECT wrect,crect;
@@ -166,8 +176,8 @@ G4OpenInventorWinViewer::G4OpenInventorWinViewer(
int wh = wrect.bottom-wrect.top;
int cw = crect.right-crect.left;
int ch = crect.bottom-crect.top;
// Compell client rect to be SIZE SIZE :
MoveWindow((HWND)fShell,wrect.left,wrect.top,SIZE+ww-cw,SIZE+wh-ch,TRUE);
// Compell client rect to be width height :
MoveWindow((HWND)fShell,wrect.left,wrect.top,width+ww-cw,height+wh-ch,TRUE);
::SetWindowLong((HWND)fShell,GWL_USERDATA,LONG(this));
::SetWindowText((HWND)fShell,shellName.c_str());
parent = fShell;
@@ -183,7 +193,7 @@ G4OpenInventorWinViewer::G4OpenInventorWinViewer(
fGL2PSAction = new SoGL2PSAction(vpRegion);
fViewer->setGLRenderAction(fGL2PSAction);
fViewer->setSize(SbVec2s(SIZE,SIZE));
fViewer->setSize(SbVec2s(width,height));
fViewer->setSceneGraph(fSoSelection);
fViewer->viewAll();
fViewer->saveHomePosition();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenInventorXtViewer.cc,v 1.24 2006/06/29 21:22:26 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4OpenInventorXtViewer.cc,v 1.25 2009/09/18 12:48:43 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
/*
* jck 05 Feb 1997 - Initial Implementation
@@ -75,17 +75,35 @@ G4OpenInventorXtViewer::G4OpenInventorXtViewer(
,fHelpText(0)
{
G4cout << "Window name: " << fName << G4endl;
}
void G4OpenInventorXtViewer::Initialise() {
G4String wName = fName;
#define SIZE 600
Widget parent = (Widget)fInteractorManager->GetParentInteractor ();
int width = 600;
int height = 600;
if(!parent) {
// Check if user has specified an X-Windows-type geometry string...
char s[32];
sprintf(s,"%dx%d",SIZE,SIZE);
G4String sgeometry = fVP.GetXGeometryString();
if(sgeometry.empty()) sgeometry = s;
if(sgeometry.empty()) {
G4cout << "ERROR: Geometry string \""
<< sgeometry
<< "\" is empty. Using \"600x600\"."
<< G4endl;
width = 600;
height = 600;
sprintf(s,"%dx%d",width,height);
sgeometry = s;
} else {
width = fVP.GetWindowSizeHintX();
height = fVP.GetWindowSizeHintX();
}
//Create a shell window :
G4String shellName = wName;
@@ -166,7 +184,7 @@ G4OpenInventorXtViewer::G4OpenInventorXtViewer(
fViewer = new SoXtExaminerViewer(parent,wName.c_str(),TRUE);
}
fViewer->setSize(SbVec2s(SIZE,SIZE));
fViewer->setSize(SbVec2s(width,height));
// Have a GL2PS render action :
const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
@@ -1,123 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef Geant4_gl2ps_h
#define Geant4_gl2ps_h
// gl2ps-0.73.
// The gl2ps code is prefixed by Geant4_ in order
// to avoid clashes with other gl2ps code that may come at link
// time from other channels.
#define gl2psBeginPage Geant4_gl2psBeginPage
#define gl2psEndPage Geant4_gl2psEndPage
#define gl2psText Geant4_gl2psText
#define gl2psEnable Geant4_gl2psEnable
#define gl2psDisable Geant4_gl2psDisable
#define gl2psPointSize Geant4_gl2psPointSize
#define gl2psLineWidth Geant4_gl2psLineWidth
#define gl2psNumShadeColors Geant4_gl2psNumShadeColors
#define gl2psDrawPixels Geant4_gl2psDrawPixels
#define gl2psBeginViewport Geant4_gl2psBeginViewport
#define gl2psEndViewport Geant4_gl2psEndViewport
#define gl2psMsg Geant4_gl2psMsg
#define gl2psMalloc Geant4_gl2psMalloc
#define gl2psRealloc Geant4_gl2psRealloc
#define gl2psFree Geant4_gl2psFree
#define gl2psListRealloc Geant4_gl2psListRealloc
#define gl2psListCreate Geant4_gl2psListCreate
#define gl2psListDelete Geant4_gl2psListDelete
#define gl2psListAdd Geant4_gl2psListAdd
#define gl2psListNbr Geant4_gl2psListNbr
#define gl2psListPointer Geant4_gl2psListPointer
#define gl2psListSort Geant4_gl2psListSort
#define gl2psListAction Geant4_gl2psListAction
#define gl2psListActionInverse Geant4_gl2psListActionInverse
#define gl2psComparePointPlane Geant4_gl2psComparePointPlane
#define gl2psPsca Geant4_gl2psPsca
#define gl2psPvec Geant4_gl2psPvec
#define gl2psNorm Geant4_gl2psNorm
#define gl2psGetNormal Geant4_gl2psGetNormal
#define gl2psGetPlane Geant4_gl2psGetPlane
#define gl2psCutEdge Geant4_gl2psCutEdge
#define gl2psCreateSplitPrimitive Geant4_gl2psCreateSplitPrimitive
#define gl2psAddIndex Geant4_gl2psAddIndex
#define gl2psGetIndex Geant4_gl2psGetIndex
#define gl2psTestSplitPrimitive Geant4_gl2psTestSplitPrimitive
#define gl2psSplitPrimitive Geant4_gl2psSplitPrimitive
#define gl2psDivideQuad Geant4_gl2psDivideQuad
#define gl2psCompareDepth Geant4_gl2psCompareDepth
#define gl2psTrianglesFirst Geant4_gl2psTrianglesFirst
#define gl2psFindRoot Geant4_gl2psFindRoot
#define gl2psFreePrimitive Geant4_gl2psFreePrimitive
#define gl2psAddPrimitiveInList Geant4_gl2psAddPrimitiveInList
#define gl2psFreeBspTree Geant4_gl2psFreeBspTree
#define gl2psGreater Geant4_gl2psGreater
#define gl2psLess Geant4_gl2psLess
#define gl2psBuildBspTree Geant4_gl2psBuildBspTree
#define gl2psTraverseBspTree Geant4_gl2psTraverseBspTree
#define gl2psGetPlaneFromPoints Geant4_gl2psGetPlaneFromPoints
#define gl2psFreeBspImageTree Geant4_gl2psFreeBspImageTree
#define gl2psCheckPoint Geant4_gl2psCheckPoint
#define gl2psAddPlanesInBspTreeImage Geant4_gl2psAddPlanesInBspTreeImage
#define gl2psCheckPrimitive Geant4_gl2psCheckPrimitive
#define gl2psCreateSplitPrimitive2D Geant4_gl2psCreateSplitPrimitive2D
#define gl2psSplitPrimitive2D Geant4_gl2psSplitPrimitive2D
#define gl2psAddInImageTree Geant4_gl2psAddInImageTree
#define gl2psAddInImage Geant4_gl2psAddInImage
#define gl2psAddBoundaryInList Geant4_gl2psAddBoundaryInList
#define gl2psBuildPolygonBoundary Geant4_gl2psBuildPolygonBoundary
#define gl2psAddPolyPrimitive Geant4_gl2psAddPolyPrimitive
#define gl2psGetVertex Geant4_gl2psGetVertex
#define gl2psParseFeedbackBuffer Geant4_gl2psParseFeedbackBuffer
#define gl2psSameColor Geant4_gl2psSameColor
#define gl2psVertsSameColor Geant4_gl2psVertsSameColor
#define gl2psPrintPostScriptHeader Geant4_gl2psPrintPostScriptHeader
#define gl2psPrintPostScriptColor Geant4_gl2psPrintPostScriptColor
#define gl2psResetPostScriptColor Geant4_gl2psResetPostScriptColor
#define gl2psPrintPostScriptPrimitive Geant4_gl2psPrintPostScriptPrimitive
#define gl2psPrintPostScriptFooter Geant4_gl2psPrintPostScriptFooter
#define gl2psPrintTeXHeader Geant4_gl2psPrintTeXHeader
#define gl2psPrintTeXPrimitive Geant4_gl2psPrintTeXPrimitive
#define gl2psPrintTeXFooter Geant4_gl2psPrintTeXFooter
#define gl2psPrintPostScriptBeginViewport Geant4_gl2psPrintPostScriptBeginViewport
#define gl2psPrintPostScriptEndViewport Geant4_gl2psPrintPostScriptEndViewport
#define gl2psWriteByte Geant4_gl2psWriteByte
#define gl2psGetRGB Geant4_gl2psGetRGB
#define gl2psPrintPostScriptPixmap Geant4_gl2psPrintPostScriptPixmap
#define gl2psListReset Geant4_gl2psListReset
#define gl2psAddInBspImageTree Geant4_gl2psAddInBspImageTree
#define gl2psPrintPrimitives Geant4_gl2psPrintPrimitives
#define gl2psPrintTeXBeginViewport Geant4_gl2psPrintTeXBeginViewport
#define gl2psPrintTeXEndViewport Geant4_gl2psPrintTeXEndViewport
#define gl2ps Geant4_gl2ps
#include "gl2ps.h"
#endif
@@ -57,40 +57,32 @@ SoGL2PSAction::SoGL2PSAction(
const SbViewportRegion& aViewPortRegion
)
:SoGLRenderAction(aViewPortRegion)
,fFileName("out.ps")
,fFile(0)
,G4OpenGL2PSAction()
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
setFileName("out.ps");
SO_ACTION_CONSTRUCTOR(SoGL2PSAction);
}
//////////////////////////////////////////////////////////////////////////////
void SoGL2PSAction::setFileName(
const char* aFileName
bool SoGL2PSAction::enableFileWriting(
)
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
fFileName = aFileName;
}
//////////////////////////////////////////////////////////////////////////////
void SoGL2PSAction::enableFileWriting(
)
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
fFile = ::fopen(fFileName.getString(),"w");
fFile = ::fopen(fFileName,"w");
if(!fFile) {
SoDebugError::post("SoGL2PSAction::enableFileWriting",
"Cannot open file %s",fFileName.getString());
return;
"Cannot open file %s",fFileName);
return false;
}
#ifdef __COIN__
#else //SGI
const SbViewportRegion& vpr = getViewportRegion();
SoViewportRegionElement::set(getState(),vpr);
gl2psBegin();
G4gl2psBegin();
#endif
return true;
}
//////////////////////////////////////////////////////////////////////////////
void SoGL2PSAction::disableFileWriting(
@@ -105,16 +97,9 @@ void SoGL2PSAction::disableFileWriting(
::fclose(fFile);
fFile = 0;
}
//////////////////////////////////////////////////////////////////////////////
SbBool SoGL2PSAction::fileWritingEnabled(
) const
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
return (fFile?TRUE:FALSE);
}
//////////////////////////////////////////////////////////////////////////////
SbBool SoGL2PSAction::addBitmap(
bool SoGL2PSAction::addBitmap(
int aWidth
,int aHeight
,float aXorig
@@ -125,10 +110,10 @@ SbBool SoGL2PSAction::addBitmap(
/////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
if(!fFile) return FALSE;
if(!fFile) return false;
GLboolean valid;
glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID,&valid);
if(valid==GL_FALSE) return FALSE;
if(!valid) return false;
float pos[4];
glGetFloatv(GL_CURRENT_RASTER_POSITION,pos);
int xoff = -(int)(aXmove + aXorig);
@@ -143,33 +128,13 @@ SbBool SoGL2PSAction::addBitmap(
if(x+w>(vp[0]+vp[2])) w = vp[0]+vp[2]-x;
if(y+h>(vp[1]+vp[3])) h = vp[1]+vp[3]-y;
int s = 3 * w * h;
if(s<=0) return FALSE;
if(s<=0) return false;
float* image = (float*)::malloc(s * sizeof(float));
if(!image) return FALSE;
if(!image) return false;
glReadPixels(x,y,w,h,GL_RGB,GL_FLOAT,image);
GLint status = gl2psDrawPixels(w,h,xoff,yoff,GL_RGB,GL_FLOAT,image);
::free(image);
return (status!=GL2PS_SUCCESS ? FALSE : TRUE);
}
//////////////////////////////////////////////////////////////////////////////
void SoGL2PSAction::beginViewport(
)
/////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
if(!fFile) return;
GLint vp[4];
glGetIntegerv(GL_VIEWPORT,vp);
gl2psBeginViewport(vp);
}
//////////////////////////////////////////////////////////////////////////////
void SoGL2PSAction::endViewport(
)
/////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
if(!fFile) return;
gl2psEndViewport();
return (status!=GL2PS_SUCCESS ? false : true);
}
//////////////////////////////////////////////////////////////////////////////
void SoGL2PSAction::beginTraversal(
@@ -182,47 +147,17 @@ void SoGL2PSAction::beginTraversal(
#ifdef __COIN__
const SbViewportRegion& vpr = getViewportRegion();
SoViewportRegionElement::set(getState(),vpr);
gl2psBegin();
G4gl2psBegin();
traverse(aNode);
gl2psEndPage();
gl2psEndPage();
#else //SGI
// Should have already do G4gl2psBegin() before
SoGLRenderAction::beginTraversal(aNode);
// Should do gl2psEndPage() after
#endif
} else {
SoGLRenderAction::beginTraversal(aNode);
}
}
//////////////////////////////////////////////////////////////////////////////
void SoGL2PSAction::gl2psBegin(
)
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
if(!fFile) return;
int options = GL2PS_OCCLUSION_CULL |
GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND;
int sort = GL2PS_BSP_SORT;
//int sort = GL2PS_SIMPLE_SORT;
const SbViewportRegion& vpr = getViewportRegion();
SoViewportRegionElement::set(getState(),vpr);
const SbVec2s& win = vpr.getWindowSize();
GLint vp[4];
vp[0] = 0;
vp[1] = 0;
vp[2] = win[0];
vp[3] = win[1];
int bufsize = 0;
gl2psBeginPage("title","HEPVis::SoGL2PSAction",
vp,
GL2PS_EPS,
sort,
options,
GL_RGBA,0, NULL,0,0,0,
bufsize,
fFile,fFileName.getString());
}
#endif
File diff suppressed because it is too large Load Diff
@@ -1,258 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2003 Christophe Geuzaine
*
* $Id: gl2ps.h,v 1.5 2006/06/29 21:23:11 gunter Exp $
*
* E-mail: geuz@geuz.org
* URL: http://www.geuz.org/gl2ps/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of 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.
*
* This library 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 the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __GL2PS_H__
#define __GL2PS_H__
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
/* To generate a Windows dll, you have to define GL2PSDLL at compile
time */
#ifdef WIN32
# include <windows.h>
# ifdef GL2PSDLL
# ifdef GL2PSDLL_EXPORTS
# define GL2PSDLL_API __declspec(dllexport)
# else
# define GL2PSDLL_API __declspec(dllimport)
# endif
# else
# define GL2PSDLL_API
# endif
#else
# define GL2PSDLL_API
#endif
#ifdef __APPLE__
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif
#define GL2PS_VERSION 0.8
#define GL2PS_NONE 0
/* Output file format */
#define GL2PS_PS 1
#define GL2PS_EPS 2
#define GL2PS_TEX 3
/* Sorting algorithms */
#define GL2PS_NO_SORT 1
#define GL2PS_SIMPLE_SORT 2
#define GL2PS_BSP_SORT 3
/* Options for gl2psBeginPage */
#define GL2PS_DRAW_BACKGROUND (1<<0)
#define GL2PS_SIMPLE_LINE_OFFSET (1<<1)
#define GL2PS_SILENT (1<<2)
#define GL2PS_BEST_ROOT (1<<3)
#define GL2PS_OCCLUSION_CULL (1<<4)
#define GL2PS_NO_TEXT (1<<5)
#define GL2PS_LANDSCAPE (1<<6)
#define GL2PS_NO_PS3_SHADING (1<<7)
#define GL2PS_NO_PIXMAP (1<<8)
/* Arguments for gl2psEnable/gl2psDisable */
#define GL2PS_POLYGON_OFFSET_FILL 1
#define GL2PS_POLYGON_BOUNDARY 2
#define GL2PS_LINE_STIPPLE 3
/* Magic numbers */
#define GL2PS_EPSILON 5.e-3
#define GL2PS_DEPTH_FACT 1000.0
#define GL2PS_SIMPLE_OFFSET 0.05
#define GL2PS_SIMPLE_OFFSET_LARGE 1.0
#define GL2PS_ZERO(arg) (std::fabs(arg)<1.e-20)
/*#define GL2PS_ZERO(arg) ((arg)==0.0)*/
/* Message levels and error codes */
#define GL2PS_SUCCESS 0
#define GL2PS_INFO 1
#define GL2PS_WARNING 2
#define GL2PS_ERROR 3
#define GL2PS_NO_FEEDBACK 4
#define GL2PS_OVERFLOW 5
#define GL2PS_UNINITIALIZED 6
/* Primitive types */
#define GL2PS_TEXT 1
#define GL2PS_POINT 2
#define GL2PS_LINE 3
#define GL2PS_QUADRANGLE 4
#define GL2PS_TRIANGLE 5
#define GL2PS_PIXMAP 6
/* 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
typedef GLfloat GL2PSrgba[4];
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 {
GLshort fontsize;
char *str, *fontname;
} GL2PSstring;
typedef struct {
GLsizei width, height;
GLenum format, type;
GLfloat *pixels;
} GL2PSimage;
typedef struct {
GLshort type, numverts;
char boundary, dash, culled;
GLfloat width, depth;
GL2PSvertex *verts;
GL2PSstring *text;
GL2PSimage *image;
} GL2PSprimitive;
typedef struct {
GLint format, sort, options, colorsize, colormode, buffersize, maxbestroot;
const char *title, *producer, *filename;
GLboolean shade, boundary;
GLfloat *feedback, offset[2];
GLint viewport[4];
GL2PSrgba *colormap, lastrgba, threshold;
float lastlinewidth;
GL2PSlist *primitives;
GL2PSbsptree2d *imagetree;
FILE *stream;
} GL2PScontext;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
GLint viewport[4], GLint format, GLint sort,
GLint options, GLint colormode,
GLint colorsize, GL2PSrgba *colormap,
GLint nr, GLint ng, GLint nb, GLint buffersize,
FILE *stream, const char *filename);
GL2PSDLL_API GLint gl2psEndPage(void);
GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
GL2PSDLL_API GLint gl2psEndViewport(void);
GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize);
GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
GLint xorig, GLint yorig,
GLenum format, GLenum type, const void *pixels);
GL2PSDLL_API GLint gl2psEnable(GLint mode);
GL2PSDLL_API GLint gl2psDisable(GLint mode);
GL2PSDLL_API GLint gl2psPointSize(GLfloat value);
GL2PSDLL_API GLint gl2psLineWidth(GLfloat value);
#ifdef __cplusplus
}
#endif
#endif /* __GL2PS_H__ */