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
a4655580
Commit
a4655580
authored
18 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
871c6739
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Graphics/Mesh.cpp
+20
-16
20 additions, 16 deletions
Graphics/Mesh.cpp
Parser/OpenFile.cpp
+12
-14
12 additions, 14 deletions
Parser/OpenFile.cpp
with
32 additions
and
30 deletions
Graphics/Mesh.cpp
+
20
−
16
View file @
a4655580
// $Id: Mesh.cpp,v 1.16
4
2006-08-15 0
5
:1
9:28
geuzaine Exp $
// $Id: Mesh.cpp,v 1.16
5
2006-08-15 0
6
:1
6:43
geuzaine Exp $
//
//
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -78,6 +78,8 @@ static void drawArrays(VertexArray *va, GLint type, bool useColorArray,
...
@@ -78,6 +78,8 @@ static void drawArrays(VertexArray *va, GLint type, bool useColorArray,
bool
useNormalArray
,
bool
usePolygonOffset
,
bool
useNormalArray
,
bool
usePolygonOffset
,
unsigned
int
uniformColor
,
bool
drawOutline
=
false
)
unsigned
int
uniformColor
,
bool
drawOutline
=
false
)
{
{
if
(
!
va
)
return
;
glVertexPointer
(
3
,
GL_FLOAT
,
0
,
va
->
vertices
->
array
);
glVertexPointer
(
3
,
GL_FLOAT
,
0
,
va
->
vertices
->
array
);
glColorPointer
(
4
,
GL_UNSIGNED_BYTE
,
0
,
va
->
colors
->
array
);
glColorPointer
(
4
,
GL_UNSIGNED_BYTE
,
0
,
va
->
colors
->
array
);
glNormalPointer
(
GL_FLOAT
,
0
,
va
->
normals
->
array
);
glNormalPointer
(
GL_FLOAT
,
0
,
va
->
normals
->
array
);
...
@@ -257,16 +259,9 @@ class initMeshGFace {
...
@@ -257,16 +259,9 @@ class initMeshGFace {
// glDrawElements() instead of glDrawArrays().
// glDrawElements() instead of glDrawArrays().
// 2) we can use tc to stripe the triangles to create strips
// 2) we can use tc to stripe the triangles to create strips
if
(
f
->
meshRep
->
va_lines
)
delete
f
->
meshRep
->
va_lines
;
f
->
meshRep
->
va_lines
=
new
VertexArray
(
2
,
f
->
meshRep
->
edges
.
size
());
if
(
f
->
meshRep
->
va_triangles
)
delete
f
->
meshRep
->
va_triangles
;
f
->
meshRep
->
va_triangles
=
new
VertexArray
(
3
,
f
->
triangles
.
size
());
if
(
f
->
meshRep
->
va_quads
)
delete
f
->
meshRep
->
va_quads
;
f
->
meshRep
->
va_quads
=
new
VertexArray
(
4
,
f
->
quadrangles
.
size
());
if
(
useEdges
&&
CTX
.
mesh
.
surfaces_edges
){
if
(
useEdges
&&
CTX
.
mesh
.
surfaces_edges
){
if
(
f
->
meshRep
->
va_lines
)
delete
f
->
meshRep
->
va_lines
;
f
->
meshRep
->
va_lines
=
new
VertexArray
(
2
,
f
->
meshRep
->
edges
.
size
());
std
::
set
<
MEdge
>::
const_iterator
it
=
f
->
meshRep
->
edges
.
begin
();
std
::
set
<
MEdge
>::
const_iterator
it
=
f
->
meshRep
->
edges
.
begin
();
for
(;
it
!=
f
->
meshRep
->
edges
.
end
();
++
it
){
for
(;
it
!=
f
->
meshRep
->
edges
.
end
();
++
it
){
for
(
int
i
=
0
;
i
<
2
;
i
++
){
for
(
int
i
=
0
;
i
<
2
;
i
++
){
...
@@ -283,8 +278,13 @@ class initMeshGFace {
...
@@ -283,8 +278,13 @@ class initMeshGFace {
}
}
if
(
CTX
.
mesh
.
surfaces_faces
||
(
!
useEdges
&&
CTX
.
mesh
.
surfaces_edges
)){
if
(
CTX
.
mesh
.
surfaces_faces
||
(
!
useEdges
&&
CTX
.
mesh
.
surfaces_edges
)){
if
(
f
->
meshRep
->
va_triangles
)
delete
f
->
meshRep
->
va_triangles
;
f
->
meshRep
->
va_triangles
=
new
VertexArray
(
3
,
f
->
triangles
.
size
());
_addInArray
(
f
,
f
->
meshRep
->
va_triangles
,
f
->
triangles
);
_addInArray
(
f
,
f
->
meshRep
->
va_triangles
,
f
->
triangles
);
_addInArray
(
f
,
f
->
meshRep
->
va_triangles
,
f
->
quadrangles
);
if
(
f
->
meshRep
->
va_quads
)
delete
f
->
meshRep
->
va_quads
;
f
->
meshRep
->
va_quads
=
new
VertexArray
(
4
,
f
->
quadrangles
.
size
());
_addInArray
(
f
,
f
->
meshRep
->
va_quads
,
f
->
quadrangles
);
}
}
}
}
};
};
...
@@ -437,20 +437,24 @@ void Draw_Mesh()
...
@@ -437,20 +437,24 @@ void Draw_Mesh()
if
(
!
CTX
.
threads_lock
){
if
(
!
CTX
.
threads_lock
){
CTX
.
threads_lock
=
1
;
CTX
.
threads_lock
=
1
;
int
stat
=
GMODEL
->
getMeshStatus
();
if
(
CTX
.
mesh
.
changed
)
{
if
(
CTX
.
mesh
.
changed
)
{
if
(
CTX
.
mesh
.
smooth_normals
){
if
(
stat
>
1
&&
CTX
.
mesh
.
smooth_normals
){
if
(
GMODEL
->
normals
)
delete
GMODEL
->
normals
;
if
(
GMODEL
->
normals
)
delete
GMODEL
->
normals
;
GMODEL
->
normals
=
new
smooth_normals
(
CTX
.
mesh
.
angle_smooth_normals
);
GMODEL
->
normals
=
new
smooth_normals
(
CTX
.
mesh
.
angle_smooth_normals
);
std
::
for_each
(
GMODEL
->
firstFace
(),
GMODEL
->
lastFace
(),
initSmoothNormalsGFace
());
std
::
for_each
(
GMODEL
->
firstFace
(),
GMODEL
->
lastFace
(),
initSmoothNormalsGFace
());
}
}
std
::
for_each
(
GMODEL
->
firstFace
(),
GMODEL
->
lastFace
(),
initMeshGFace
());
if
(
stat
>
1
)
std
::
for_each
(
GMODEL
->
firstRegion
(),
GMODEL
->
lastRegion
(),
initMeshGRegion
());
std
::
for_each
(
GMODEL
->
firstFace
(),
GMODEL
->
lastFace
(),
initMeshGFace
());
if
(
stat
>
2
)
std
::
for_each
(
GMODEL
->
firstRegion
(),
GMODEL
->
lastRegion
(),
initMeshGRegion
());
}
}
if
(
CTX
.
mesh
.
surfaces_faces
||
CTX
.
mesh
.
surfaces_edges
)
if
(
stat
>
1
&&
(
CTX
.
mesh
.
surfaces_faces
||
CTX
.
mesh
.
surfaces_edges
)
)
std
::
for_each
(
GMODEL
->
firstFace
(),
GMODEL
->
lastFace
(),
drawMeshGFace
());
std
::
for_each
(
GMODEL
->
firstFace
(),
GMODEL
->
lastFace
(),
drawMeshGFace
());
if
(
CTX
.
mesh
.
volumes_faces
||
CTX
.
mesh
.
volumes_edges
)
if
(
stat
>
2
&&
(
CTX
.
mesh
.
volumes_faces
||
CTX
.
mesh
.
volumes_edges
)
)
std
::
for_each
(
GMODEL
->
firstRegion
(),
GMODEL
->
lastRegion
(),
drawMeshGRegion
());
std
::
for_each
(
GMODEL
->
firstRegion
(),
GMODEL
->
lastRegion
(),
drawMeshGRegion
());
CTX
.
mesh
.
changed
=
0
;
CTX
.
mesh
.
changed
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Parser/OpenFile.cpp
+
12
−
14
View file @
a4655580
// $Id: OpenFile.cpp,v 1.11
1
2006-08-15 0
4
:1
5:19
geuzaine Exp $
// $Id: OpenFile.cpp,v 1.11
2
2006-08-15 0
6
:1
6:43
geuzaine Exp $
//
//
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -248,12 +248,16 @@ int MergeProblem(char *name, int warn_if_missing)
...
@@ -248,12 +248,16 @@ int MergeProblem(char *name, int warn_if_missing)
{
{
// added 'b' for pure Windows programs, since some of these files
// added 'b' for pure Windows programs, since some of these files
// contain binary data
// contain binary data
FILE
*
fp
;
FILE
*
fp
=
fopen
(
name
,
"rb"
)
;
if
(
!
(
fp
=
fopen
(
name
,
"rb"
))
){
if
(
!
fp
){
if
(
warn_if_missing
)
Msg
(
WARNING
,
"Unable to open file '%s'"
,
name
);
if
(
warn_if_missing
)
Msg
(
WARNING
,
"Unable to open file '%s'"
,
name
);
return
0
;
return
0
;
}
}
char
header
[
256
];
fgets
(
header
,
sizeof
(
header
),
fp
);
fclose
(
fp
);
Msg
(
STATUS2
,
"Reading '%s'"
,
name
);
Msg
(
STATUS2
,
"Reading '%s'"
,
name
);
char
ext
[
256
],
base
[
256
];
char
ext
[
256
],
base
[
256
];
...
@@ -266,7 +270,6 @@ int MergeProblem(char *name, int warn_if_missing)
...
@@ -266,7 +270,6 @@ int MergeProblem(char *name, int warn_if_missing)
// terms of gzFile, but until then, this is better than nothing
// terms of gzFile, but until then, this is better than nothing
if
(
fl_choice
(
"File '%s' is in gzip format.
\n\n
Do you want to uncompress it?"
,
if
(
fl_choice
(
"File '%s' is in gzip format.
\n\n
Do you want to uncompress it?"
,
"Cancel"
,
"Uncompress"
,
NULL
,
name
)){
"Cancel"
,
"Uncompress"
,
NULL
,
name
)){
fclose
(
fp
);
char
tmp
[
256
];
char
tmp
[
256
];
sprintf
(
tmp
,
"gunzip -c %s > %s"
,
name
,
base
);
sprintf
(
tmp
,
"gunzip -c %s > %s"
,
name
,
base
);
SystemCall
(
tmp
);
SystemCall
(
tmp
);
...
@@ -308,17 +311,13 @@ int MergeProblem(char *name, int warn_if_missing)
...
@@ -308,17 +311,13 @@ int MergeProblem(char *name, int warn_if_missing)
#endif
#endif
#endif
#endif
else
{
else
{
fpos_t
position
;
if
(
!
strncmp
(
header
,
"$PTS"
,
4
)
||
!
strncmp
(
header
,
"$NO"
,
3
)
||
fgetpos
(
fp
,
&
position
);
!
strncmp
(
header
,
"$PARA"
,
5
)
||
!
strncmp
(
header
,
"$ELM"
,
4
)
||
char
tmp
[
256
];
!
strncmp
(
header
,
"$MeshFormat"
,
11
))
{
fgets
(
tmp
,
sizeof
(
tmp
),
fp
);
fsetpos
(
fp
,
&
position
);
if
(
!
strncmp
(
tmp
,
"$PTS"
,
4
)
||
!
strncmp
(
tmp
,
"$NO"
,
3
)
||
!
strncmp
(
tmp
,
"$PARA"
,
5
)
||
!
strncmp
(
tmp
,
"$ELM"
,
4
)
||
!
strncmp
(
tmp
,
"$MeshFormat"
,
11
))
{
status
=
GMODEL
->
readMSH
(
name
);
status
=
GMODEL
->
readMSH
(
name
);
}
}
else
if
(
!
strncmp
(
tmp
,
"$PostFormat"
,
11
)
||
!
strncmp
(
tmp
,
"$View"
,
5
))
{
else
if
(
!
strncmp
(
header
,
"$PostFormat"
,
11
)
||
!
strncmp
(
header
,
"$View"
,
5
))
{
status
=
ReadView
(
name
);
status
=
ReadView
(
name
);
}
}
else
{
else
{
...
@@ -329,7 +328,6 @@ int MergeProblem(char *name, int warn_if_missing)
...
@@ -329,7 +328,6 @@ int MergeProblem(char *name, int warn_if_missing)
SetBoundingBox
();
SetBoundingBox
();
CTX
.
mesh
.
changed
=
1
;
CTX
.
mesh
.
changed
=
1
;
Msg
(
STATUS2
,
"Read '%s'"
,
name
);
Msg
(
STATUS2
,
"Read '%s'"
,
name
);
fclose
(
fp
);
return
status
;
return
status
;
}
}
...
...
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