Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
e68221c1
Commit
e68221c1
authored
21 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
Update gl2ps with new occlusion culling improvements from Shahzad.
parent
3a9fe4fe
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Graphics/gl2ps.cpp
+49
-18
49 additions, 18 deletions
Graphics/gl2ps.cpp
Graphics/gl2ps.h
+15
-13
15 additions, 13 deletions
Graphics/gl2ps.h
with
64 additions
and
31 deletions
Graphics/gl2ps.cpp
+
49
−
18
View file @
e68221c1
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* GL2PS, an OpenGL to PostScript Printing Library
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2003 Christophe Geuzaine
* Copyright (C) 1999-2003 Christophe Geuzaine
*
*
* $Id: gl2ps.cpp,v 1.6
6
2003-0
6-12 17:39:33
geuzaine Exp $
* $Id: gl2ps.cpp,v 1.6
7
2003-0
7-03 18:59:52
geuzaine Exp $
*
*
* E-mail: geuz@geuz.org
* E-mail: geuz@geuz.org
* URL: http://www.geuz.org/gl2ps/
* URL: http://www.geuz.org/gl2ps/
...
@@ -645,7 +645,7 @@ void gl2psBuildBspTree(GL2PSbsptree *tree, GL2PSlist *primitives){
...
@@ -645,7 +645,7 @@ void gl2psBuildBspTree(GL2PSbsptree *tree, GL2PSlist *primitives){
void
gl2psTraverseBspTree
(
GL2PSbsptree
*
tree
,
GL2PSxyz
eye
,
GLfloat
epsilon
,
void
gl2psTraverseBspTree
(
GL2PSbsptree
*
tree
,
GL2PSxyz
eye
,
GLfloat
epsilon
,
GLboolean
(
*
compare
)(
GLfloat
f1
,
GLfloat
f2
),
GLboolean
(
*
compare
)(
GLfloat
f1
,
GLfloat
f2
),
void
(
*
action
)(
void
*
data
,
void
*
dummy
)){
void
(
*
action
)(
void
*
data
,
void
*
dummy
)
,
int
inverse
){
GLfloat
result
;
GLfloat
result
;
if
(
!
tree
)
return
;
if
(
!
tree
)
return
;
...
@@ -653,18 +653,28 @@ void gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsilon,
...
@@ -653,18 +653,28 @@ void gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsilon,
result
=
gl2psComparePointPlane
(
eye
,
tree
->
plane
);
result
=
gl2psComparePointPlane
(
eye
,
tree
->
plane
);
if
(
compare
(
result
,
epsilon
)){
if
(
compare
(
result
,
epsilon
)){
gl2psTraverseBspTree
(
tree
->
back
,
eye
,
epsilon
,
compare
,
action
);
gl2psTraverseBspTree
(
tree
->
back
,
eye
,
epsilon
,
compare
,
action
,
inverse
);
gl2psListAction
(
tree
->
primitives
,
action
);
if
(
inverse
){
gl2psTraverseBspTree
(
tree
->
front
,
eye
,
epsilon
,
compare
,
action
);
gl2psListActionInverse
(
tree
->
primitives
,
action
);
}
else
{
gl2psListAction
(
tree
->
primitives
,
action
);
}
gl2psTraverseBspTree
(
tree
->
front
,
eye
,
epsilon
,
compare
,
action
,
inverse
);
}
}
else
if
(
compare
(
-
epsilon
,
result
)){
else
if
(
compare
(
-
epsilon
,
result
)){
gl2psTraverseBspTree
(
tree
->
front
,
eye
,
epsilon
,
compare
,
action
);
gl2psTraverseBspTree
(
tree
->
front
,
eye
,
epsilon
,
compare
,
action
,
inverse
);
gl2psListAction
(
tree
->
primitives
,
action
);
if
(
inverse
){
gl2psTraverseBspTree
(
tree
->
back
,
eye
,
epsilon
,
compare
,
action
);
gl2psListActionInverse
(
tree
->
primitives
,
action
);
}
else
{
gl2psListAction
(
tree
->
primitives
,
action
);
}
gl2psTraverseBspTree
(
tree
->
back
,
eye
,
epsilon
,
compare
,
action
,
inverse
);
}
}
else
{
else
{
gl2psTraverseBspTree
(
tree
->
front
,
eye
,
epsilon
,
compare
,
action
);
gl2psTraverseBspTree
(
tree
->
front
,
eye
,
epsilon
,
compare
,
action
,
inverse
);
gl2psTraverseBspTree
(
tree
->
back
,
eye
,
epsilon
,
compare
,
action
);
gl2psTraverseBspTree
(
tree
->
back
,
eye
,
epsilon
,
compare
,
action
,
inverse
);
}
}
}
}
...
@@ -943,7 +953,9 @@ GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree){
...
@@ -943,7 +953,9 @@ GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree){
}
}
if
(
*
tree
==
NULL
){
if
(
*
tree
==
NULL
){
gl2psAddPlanesInBspTreeImage
(
prim
,
tree
);
if
(
!
gl2ps
->
zerosurfacearea
){
gl2psAddPlanesInBspTreeImage
(
gl2ps
->
primitivetoadd
,
tree
);
}
return
1
;
return
1
;
}
}
else
{
else
{
...
@@ -966,8 +978,19 @@ GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree){
...
@@ -966,8 +978,19 @@ GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree){
gl2psFree
(
backprim
);
gl2psFree
(
backprim
);
return
ret
;
return
ret
;
case
GL2PS_COINCIDENT
:
case
GL2PS_COINCIDENT
:
if
(
prim
->
numverts
<
3
)
return
1
;
if
((
*
tree
)
->
back
!=
NULL
){
else
return
0
;
gl2ps
->
zerosurfacearea
=
1
;
ret
=
gl2psAddInBspImageTree
(
prim
,
&
(
*
tree
)
->
back
);
gl2ps
->
zerosurfacearea
=
0
;
if
(
ret
)
return
ret
;
}
if
((
*
tree
)
->
front
!=
NULL
){
gl2ps
->
zerosurfacearea
=
1
;
ret
=
gl2psAddInBspImageTree
(
prim
,
&
(
*
tree
)
->
front
);
gl2ps
->
zerosurfacearea
=
0
;
if
(
ret
)
return
ret
;
}
return
0
;
}
}
}
}
return
0
;
return
0
;
...
@@ -975,7 +998,7 @@ GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree){
...
@@ -975,7 +998,7 @@ GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree){
void
gl2psAddInImageTree
(
void
*
a
,
void
*
b
){
void
gl2psAddInImageTree
(
void
*
a
,
void
*
b
){
GL2PSprimitive
*
prim
=
*
(
GL2PSprimitive
**
)
a
;
GL2PSprimitive
*
prim
=
*
(
GL2PSprimitive
**
)
a
;
gl2ps
->
primitivetoadd
=
prim
;
if
(
!
gl2psAddInBspImageTree
(
prim
,
&
gl2ps
->
imagetree
)){
if
(
!
gl2psAddInBspImageTree
(
prim
,
&
gl2ps
->
imagetree
)){
prim
->
culled
=
1
;
prim
->
culled
=
1
;
}
}
...
@@ -1937,11 +1960,11 @@ GLint gl2psPrintPrimitives(void){
...
@@ -1937,11 +1960,11 @@ GLint gl2psPrintPrimitives(void){
if
(
gl2ps
->
boundary
)
gl2psBuildPolygonBoundary
(
root
);
if
(
gl2ps
->
boundary
)
gl2psBuildPolygonBoundary
(
root
);
if
(
gl2ps
->
options
&
GL2PS_OCCLUSION_CULL
){
if
(
gl2ps
->
options
&
GL2PS_OCCLUSION_CULL
){
gl2psTraverseBspTree
(
root
,
eye
,
-
(
float
)
GL2PS_EPSILON
,
gl2psLess
,
gl2psTraverseBspTree
(
root
,
eye
,
-
(
float
)
GL2PS_EPSILON
,
gl2psLess
,
gl2psAddInImageTree
);
gl2psAddInImageTree
,
1
);
gl2psFreeBspImageTree
(
&
gl2ps
->
imagetree
);
gl2psFreeBspImageTree
(
&
gl2ps
->
imagetree
);
}
}
gl2psTraverseBspTree
(
root
,
eye
,
(
float
)
GL2PS_EPSILON
,
gl2psGreater
,
gl2psTraverseBspTree
(
root
,
eye
,
(
float
)
GL2PS_EPSILON
,
gl2psGreater
,
pprim
);
pprim
,
0
);
gl2psFreeBspTree
(
&
root
);
gl2psFreeBspTree
(
&
root
);
/* reallocate the primitive list (it's been deleted by
/* reallocate the primitive list (it's been deleted by
gl2psBuildBspTree) in case there is another viewport */
gl2psBuildBspTree) in case there is another viewport */
...
@@ -1975,8 +1998,14 @@ GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
...
@@ -1975,8 +1998,14 @@ GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
gl2ps
->
filename
=
filename
;
gl2ps
->
filename
=
filename
;
gl2ps
->
sort
=
sort
;
gl2ps
->
sort
=
sort
;
gl2ps
->
options
=
options
;
gl2ps
->
options
=
options
;
for
(
i
=
0
;
i
<
4
;
i
++
){
gl2ps
->
viewport
[
i
]
=
viewport
[
i
];
if
(
gl2ps
->
options
&
GL2PS_USE_CURRENT_VIEWPORT
){
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
}
else
{
for
(
i
=
0
;
i
<
4
;
i
++
){
gl2ps
->
viewport
[
i
]
=
viewport
[
i
];
}
}
}
gl2ps
->
threshold
[
0
]
=
nr
?
1.
/
(
GLfloat
)
nr
:
0.032
;
gl2ps
->
threshold
[
0
]
=
nr
?
1.
/
(
GLfloat
)
nr
:
0.032
;
gl2ps
->
threshold
[
1
]
=
ng
?
1.
/
(
GLfloat
)
ng
:
0.017
;
gl2ps
->
threshold
[
1
]
=
ng
?
1.
/
(
GLfloat
)
ng
:
0.017
;
...
@@ -1988,6 +2017,8 @@ GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
...
@@ -1988,6 +2017,8 @@ GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
}
}
gl2ps
->
lastlinewidth
=
-
1.
;
gl2ps
->
lastlinewidth
=
-
1.
;
gl2ps
->
imagetree
=
NULL
;
gl2ps
->
imagetree
=
NULL
;
gl2ps
->
primitivetoadd
=
NULL
;
gl2ps
->
zerosurfacearea
=
0
;
if
(
gl2ps
->
colormode
==
GL_RGBA
){
if
(
gl2ps
->
colormode
==
GL_RGBA
){
gl2ps
->
colorsize
=
0
;
gl2ps
->
colorsize
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Graphics/gl2ps.h
+
15
−
13
View file @
e68221c1
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* GL2PS, an OpenGL to PostScript Printing Library
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2003 Christophe Geuzaine
* Copyright (C) 1999-2003 Christophe Geuzaine
*
*
* $Id: gl2ps.h,v 1.4
0
2003-0
6-12 17:39:33
geuzaine Exp $
* $Id: gl2ps.h,v 1.4
1
2003-0
7-03 18:59:52
geuzaine Exp $
*
*
* E-mail: geuz@geuz.org
* E-mail: geuz@geuz.org
* URL: http://www.geuz.org/gl2ps/
* URL: http://www.geuz.org/gl2ps/
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
#define GL2PS_MAJOR_VERSION 0
#define GL2PS_MAJOR_VERSION 0
#define GL2PS_MINOR_VERSION 9
#define GL2PS_MINOR_VERSION 9
#define GL2PS_PATCH_VERSION
1
#define GL2PS_PATCH_VERSION
2
#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
0.01 * GL2PS_MINOR_VERSION + \
0.01 * GL2PS_MINOR_VERSION + \
...
@@ -77,16 +77,17 @@
...
@@ -77,16 +77,17 @@
/* Options for gl2psBeginPage */
/* Options for gl2psBeginPage */
#define GL2PS_NONE 0
#define GL2PS_NONE 0
#define GL2PS_DRAW_BACKGROUND (1<<0)
#define GL2PS_DRAW_BACKGROUND (1<<0)
#define GL2PS_SIMPLE_LINE_OFFSET (1<<1)
#define GL2PS_SIMPLE_LINE_OFFSET (1<<1)
#define GL2PS_SILENT (1<<2)
#define GL2PS_SILENT (1<<2)
#define GL2PS_BEST_ROOT (1<<3)
#define GL2PS_BEST_ROOT (1<<3)
#define GL2PS_OCCLUSION_CULL (1<<4)
#define GL2PS_OCCLUSION_CULL (1<<4)
#define GL2PS_NO_TEXT (1<<5)
#define GL2PS_NO_TEXT (1<<5)
#define GL2PS_LANDSCAPE (1<<6)
#define GL2PS_LANDSCAPE (1<<6)
#define GL2PS_NO_PS3_SHADING (1<<7)
#define GL2PS_NO_PS3_SHADING (1<<7)
#define GL2PS_NO_PIXMAP (1<<8)
#define GL2PS_NO_PIXMAP (1<<8)
#define GL2PS_USE_CURRENT_VIEWPORT (1<<9)
/* Arguments for gl2psEnable/gl2psDisable */
/* Arguments for gl2psEnable/gl2psDisable */
...
@@ -197,7 +198,7 @@ typedef struct {
...
@@ -197,7 +198,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
GLint
format
,
sort
,
options
,
colorsize
,
colormode
,
buffersize
,
maxbestroot
;
GLint
format
,
sort
,
options
,
colorsize
,
colormode
,
buffersize
,
maxbestroot
;
const
char
*
title
,
*
producer
,
*
filename
;
const
char
*
title
,
*
producer
,
*
filename
;
GLboolean
boundary
;
GLboolean
boundary
,
zerosurfacearea
;
GLfloat
*
feedback
,
offset
[
2
];
GLfloat
*
feedback
,
offset
[
2
];
GLint
viewport
[
4
];
GLint
viewport
[
4
];
GL2PSrgba
*
colormap
,
lastrgba
,
threshold
;
GL2PSrgba
*
colormap
,
lastrgba
,
threshold
;
...
@@ -205,6 +206,7 @@ typedef struct {
...
@@ -205,6 +206,7 @@ typedef struct {
GL2PSlist
*
primitives
;
GL2PSlist
*
primitives
;
GL2PSbsptree2d
*
imagetree
;
GL2PSbsptree2d
*
imagetree
;
FILE
*
stream
;
FILE
*
stream
;
GL2PSprimitive
*
primitivetoadd
;
}
GL2PScontext
;
}
GL2PScontext
;
/* public functions */
/* public functions */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment