Commit 8b177f1e authored by Edward Vigmond's avatar Edward Vigmond

Isosurfaces are now properly shaded. They are not yet smooth between elements...

Isosurfaces are now properly shaded. They are not yet smooth between elements but, instead, have facet shading.
Axes now drawn at center of model.
Clipping planes now drawn at center of model.
parent cdc71298
# Doxyfile 1.7.3
# Doxyfile 1.7.5.1
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
......@@ -22,8 +22,9 @@
DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
# The PROJECT_NAME tag is a single word (or sequence of words) that should
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = Meshalyzer
......@@ -33,8 +34,8 @@ PROJECT_NAME = Meshalyzer
PROJECT_NUMBER = 1
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
# a quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF =
......@@ -276,6 +277,22 @@ DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
# unions are shown inside the group in which they are included (e.g. using
# @ingroup) instead of on a separate page (for HTML and Man pages) or
# section (for LaTeX and RTF).
INLINE_GROUPED_CLASSES = NO
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
# unions with only public data fields will be shown inline in the documentation
# of the scope in which they are defined (i.e. file, namespace, or group
# documentation), provided this scope is documented. If set to NO (the default),
# structs, classes, and unions are shown on a separate page (for HTML and Man
# pages) or section (for LaTeX and RTF).
INLINE_SIMPLE_STRUCTS = NO
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
# is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
......@@ -451,10 +468,10 @@ SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
# do proper type resolution of all parameters of a function it will reject a
# match between the prototype and the implementation of a member function even
# if there is only one candidate or it is obvious which candidate to choose
# match between the prototype and the implementation of a member function even
# if there is only one candidate or it is obvious which candidate to choose
# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
# will still accept a match between prototype and implementation in such cases.
......@@ -542,6 +559,15 @@ FILE_VERSION_FILTER =
LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files
# containing the references data. This must be a list of .bib files. The
# .bib extension is automatically appended if omitted. Using this command
# requires the bibtex tool to be installed. See also
# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
# of the bibliography can be controlled using LATEX_BIB_STYLE.
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
......@@ -630,7 +656,8 @@ RECURSIVE = NO
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
# subdirectory from a directory tree whose root is specified with the INPUT tag.
# Note that relative paths are relative to directory from which doxygen is run.
EXCLUDE =
......@@ -817,7 +844,14 @@ HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
# standard header. Note that when using a custom header you are responsible
# for the proper inclusion of any scripts and style sheets that doxygen
# needs, which is dependent on the configuration options used.
# It is adviced to generate a default header using "doxygen -w html
# header.html footer.html stylesheet.css YourConfigFile" and then modify
# that header. Note that the header is subject to change so you typically
# have to redo this when upgrading to a newer version of doxygen or when
# changing the value of configuration settings such as GENERATE_TREEVIEW!
HTML_HEADER =
......@@ -836,6 +870,15 @@ HTML_FOOTER =
HTML_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
# that these files will be copied to the base HTML output directory. Use the
# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
# files. In the HTML_STYLESHEET file, use the file name only. Also note that
# the files will be copied as-is; there are no commands or markers available.
HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
# Doxygen will adjust the colors in the stylesheet and background images
# according to this color. Hue is specified as an angle on a colorwheel,
......@@ -1038,10 +1081,10 @@ ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
# This tag can be used to set the number of enum values (range [0,1..20])
# that doxygen will group on one line in the generated HTML documentation.
# Note that a value of 0 will completely suppress the enum values from
# appearing in the overview section.
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
# (range [0,1..20]) that doxygen will group on one line in the generated HTML
# documentation. Note that a value of 0 will completely suppress the enum
# values from appearing in the overview section.
ENUM_VALUES_PER_LINE = 4
......@@ -1100,13 +1143,18 @@ USE_MATHJAX = NO
# HTML output directory using the MATHJAX_RELPATH option. The destination
# directory should contain the MathJax.js script. For instance, if the mathjax
# directory is located at the same level as the HTML output directory, then
# MATHJAX_RELPATH should be ../mathjax. The default value points to the
# MATHJAX_RELPATH should be ../mathjax. The default value points to the
# mathjax.org site, so you can quickly see the result without installing
# MathJax, but it is strongly recommended to install a local copy of MathJax
# before deployment.
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
# names that should be enabled during MathJax rendering.
MATHJAX_EXTENSIONS =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
# for the HTML output. The underlying search engine uses javascript
# and DHTML and should work on any modern browser. Note that when using
......@@ -1180,6 +1228,13 @@ EXTRA_PACKAGES =
LATEX_HEADER =
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
# the generated latex document. The footer should contain everything after
# the last chapter. If it is left blank doxygen will generate a
# standard footer. Notice: only use this tag if you know what you are doing!
LATEX_FOOTER =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
# contain links (just like the HTML output) instead of page references
......@@ -1213,6 +1268,12 @@ LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
# http://en.wikipedia.org/wiki/BibTeX for more info.
LATEX_BIB_STYLE = plain
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
......@@ -1387,7 +1448,7 @@ MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
# pointed to by INCLUDE_PATH will be searched when a #include is found.
SEARCH_INCLUDES = YES
......@@ -1417,7 +1478,7 @@ PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition that
# Use the PREDEFINED tag if you want to use a different macro definition that
# overrules the definition found in the source code.
EXPAND_AS_DEFINED =
......@@ -1514,13 +1575,12 @@ HAVE_DOT = YES
DOT_NUM_THREADS = 0
# By default doxygen will write a font called Helvetica to the output
# directory and reference it in all dot files that doxygen generates.
# When you want a differently looking font you can specify the font name
# using DOT_FONTNAME. You need to make sure dot is able to find the font,
# which can be done by putting it in a standard location or by setting the
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font.
# By default doxygen will use the Helvetica font for all dot files that
# doxygen generates. When you want a differently looking font you can specify
# the font name using DOT_FONTNAME. You need to make sure dot is able to find
# the font, which can be done by putting it in a standard location or by setting
# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
# directory containing the font.
DOT_FONTNAME = Helvetica
......@@ -1529,10 +1589,9 @@ DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the output directory to look for the
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
# different font using DOT_FONTNAME you can set the path where dot
# can find it using this tag.
# By default doxygen will tell dot to use the Helvetica font.
# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
# set the path where dot can find it.
DOT_FONTPATH =
......@@ -1594,7 +1653,7 @@ CALL_GRAPH = YES
# the time of a run. So in most cases it will be better to enable caller
# graphs for selected functions only using the \callergraph command.
CALLER_GRAPH = NO
CALLER_GRAPH = YES
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will generate a graphical hierarchy of all classes instead of a textual one.
......@@ -1609,11 +1668,22 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. Possible values are png, svg, gif or svg.
# If left blank png will be used.
# generated by dot. Possible values are svg, png, jpg, or gif.
# If left blank png will be used. If you choose svg you need to set
# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
# visible in IE 9+ (other browsers do not have this requirement).
DOT_IMAGE_FORMAT = png
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning.
# Note that this requires a modern browser other than Internet Explorer.
# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
# visible. Older versions of IE do not have SVG support.
INTERACTIVE_SVG = YES
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
......
......@@ -315,7 +315,7 @@ VolElement::planecut( char *pd, GLfloat* cp,
* \param p1 vertex 1
* \param dat1 data on p1
* \param val data between dat0 and dat1
* \param pint location of val (computed)
* \param pint[out] location of val
*
* \return relative weight of node 0
*/
......@@ -367,8 +367,7 @@ MultiPoint ** MultiPoint::isosurf( DATA_TYPE *dat, DATA_TYPE val, int &npoly,
int poly_start = 1; // first polygon defined after \#polygons
// do not continue if number of polygons are zero
if (npoly == 0)
{
if (!npoly) {
return NULL;
}
......@@ -411,24 +410,32 @@ MultiPoint ** MultiPoint::isosurf( DATA_TYPE *dat, DATA_TYPE val, int &npoly,
break;
}
isoele[n]->define( simple_index );
if( poly[poly_start]>2 ) { // it is a surface element
SurfaceElement *se = dynamic_cast<SurfaceElement*>(isoele[n]);
se->compute_normals(0,0);
// determine the vertex normal
GLfloat *ptnrml = new GLfloat[3*poly[poly_start]];
for( int i=0; i<poly[poly_start]; i++ ) {
int pindex = poly_start+1+i*2;
int n0 = _node[poly[pindex]];
int n1 = _node[poly[pindex+1]];
// fix a up from n0 to 0 and n1 to 1
// note: need to fix up the normalization algorithm.
normalize(sub( pts->pt(0), pts->pt(1), ptnrml+i*3 ));
memcpy( ptnrml+3*i, se->nrml(), 3*sizeof(GLfloat) );
}
// make sure the normal points the correct way
int n0 = _node[poly[poly_start+1]];
int n1 = _node[poly[poly_start+2]];
GLfloat norm[3];
sub( _pt->pt(n0), _pt->pt(n1), norm );
if( dat[n0]>val )
scale( norm, -1 );
if( dot( norm, se->nrml() ) < 0 )
for( int ni=0; ni<poly[poly_start]; ni++ )
scale( ptnrml+ni*3, -1 );
se->vertnorm( ptnrml );
}poly_start += npts*2+1;
}
poly_start += npts*2+1;
}
return isoele;
}
......
......@@ -161,6 +161,7 @@ class SurfaceElement : public MultiPoint
virtual void compute_normals( int, int )=0;
const void nrml( GLfloat *n ){ _nrml=n; };
inline const GLfloat* nrml( int a=0 ) {return _nrml==NULL?NULL:_nrml+3*a; }
inline const GLfloat* ptnrml( int a=0 ) {return _ptnrml==NULL?NULL:_ptnrml+3*a; }
virtual void draw( int, GLfloat*, float=1 )=0;
virtual void draw( int, int, GLfloat*, Colourscale*, DATA_TYPE*,
int stride, dataOpac* dopac, const GLfloat * )=0;
......
......@@ -16,6 +16,7 @@ IsoSurface::IsoSurface(Model* m, DATA_TYPE *dat, double v,
vector<bool>&member, int t)
:_vertnorm(NULL),_vert(NULL),_val(v),_tm(t)
{
#pragma omp parallel for schedule(dynamic,100)
for( int i=0; i<m->numVol(); i++ ) {
if( member[i] ) {
int npoly;
......@@ -24,6 +25,7 @@ IsoSurface::IsoSurface(Model* m, DATA_TYPE *dat, double v,
if (lpoly != NULL){
for( int j=0; j<npoly; j++ )
{
#pragma omp critical
polygon.push_back(static_cast<SurfaceElement*>(lpoly[j]));
}
delete[] lpoly;
......@@ -32,7 +34,7 @@ IsoSurface::IsoSurface(Model* m, DATA_TYPE *dat, double v,
}
// determine the vertex normals for all the polygons
determine_vert_norms(m->pt);
//determine_vert_norms(m->pt);
}
IsoSurface::~IsoSurface()
......@@ -41,13 +43,14 @@ IsoSurface::~IsoSurface()
delete polygon[i]->pt();
delete polygon[i];
}
delete _vertnorm;
}
void IsoSurface::draw()
{
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
for( int i=0; i<polygon.size(); i++ ) {
polygon[i]->draw(0, 0, colour, NULL, NULL, 1, NULL, _vertnorm );
polygon[i]->draw(0, 0, colour, NULL, NULL, 1, NULL, polygon[i]->ptnrml() );
}
}
......@@ -63,26 +66,29 @@ void IsoSurface::draw()
void IsoSurface::determine_vert_norms(PPoint& pt)
{
vector<bool> has_norm(pt.num()); // if elements attached to node
GLfloat *tvn = (GLfloat *)calloc(pt.num()*3,sizeof(GLfloat));
GLfloat *tvn = new GLfloat[pt.num()*3];
memset( tvn, 0, pt.num()*3*sizeof(GLfloat) );
const GLfloat* n;
for ( int i = 0; i < polygon.size(); i++ )
{
#pragma omp parallel for
for ( int i = 0; i < polygon.size(); i++ ) {
const GLfloat* n;
if ( (n=polygon[i]->nrml(0)) == NULL ) continue;
const int *pnt = polygon[i]->obj();
for ( int j=0; j<polygon[i]->ptsPerObj(); j++ ) {
for ( int k=0; k<3; k++ ) tvn[3*pnt[j]+k] += n[k];
for ( int k=0; k<3; k++ )
#pragma omp atomic
tvn[3*pnt[j]+k] += n[k];
has_norm[pnt[j]] = true;
}
}
// count \# nodes in surface
int numvert = 0;
#pragma omp parallel for
for ( int i=0; i<pt.num(); i++ ) {
if ( has_norm[i] ) normalize(tvn+i*3);
numvert++;
if ( has_norm[i] ) {
normalize(tvn+i*3);
#pragma omp atomic
numvert++;
}
}
_vert = (int *)realloc(_vert, sizeof(int)*(numvert+1));
......@@ -97,5 +103,5 @@ void IsoSurface::determine_vert_norms(PPoint& pt)
}
_vert[numvert] = -1;
delete[] tvn;
free(tvn);
}
......@@ -13,17 +13,17 @@ class IsoSurface {
GLfloat *color(){ return colour; }
double isoval(){ return _val; }
void color(const GLfloat *c){memmove(colour,c, 4*sizeof(GLfloat));}
int tm() const { return _tm; }
int tm() const { return _tm; }
private: //
void determine_vert_norms(PPoint& pt);
void determine_vert_norms(PPoint& pt);
private: // member variables
vector<SurfaceElement*> polygon;
GLfloat* _vertnorm; //!<vertex normals
int* _vert; //!< vertices for which normals are computed
GLfloat colour[4];
double _val; // value
int _tm; // time when surface calculated
vector<SurfaceElement*> polygon;
GLfloat* _vertnorm; //!< vertex normals
int* _vert; //!< vertices for which normals are computed
GLfloat colour[4]; //!< color of surface
double _val; //!< data value of surface
int _tm; //!< time when surface calculated
};
#endif
......
......@@ -4,7 +4,7 @@ HDF5API_ROOT := ./hdf5api
FLTK_INC := $(shell fltk-config --use-gl --cxxflags)
FLTK_LD_FLAGS := $(shell fltk-config --use-images --use-gl --ldflags)
COMMON_INC := -I. -O0 -g -DOBJ_CLASS -D_REENTRANT -MMD -DNOMINMAX
COMMON_INC := -I. -O0 -g -DOBJ_CLASS -D_REENTRANT -MMD -DNOMINMAX -fopenmp
ifdef HDF5
LIB_CH5 := (HDF5_ROOT)/lib/libch5.a
......@@ -18,7 +18,7 @@ endif
COMMON_LIBS = -lpng -lpthread -lm -lz $(LIB_HDF5)
LIBS = -L$(HDF5API_ROOT)/lib $(FLTK_LD_FLAGS) $(COMMON_LIBS)
LDFLAGS =
LDFLAGS = -fopenmp
CXXFLAGS = -I$(HDF5API_ROOT)/src $(FLTK_INC) $(COMMON_INC)
CPPFLAGS = $(CFLAGS) -g
......
......@@ -455,7 +455,7 @@ void TBmeshWin :: draw()
for (int i=0;i<NUM_CP;i++)
if (cplane->on(i)&&cplane->visible(i)) draw_clip_plane(i);
if ( contwin->draw_axes->value() ) draw_axes();
if ( contwin->draw_axes->value() ) draw_axes( model->pt.offset() );
glDepthMask(GL_TRUE);
gl2psEnable(GL2PS_BLEND);
......@@ -484,8 +484,6 @@ void TBmeshWin::draw_iso_surfaces()
bool dirty = isosurfwin->issDirty();
glPushAttrib(GL_ALL_ATTRIB_BITS);
glEnable(GL_BLEND);
glDepthMask(GL_FALSE);
for ( int s=0; s<model->_numReg; s++ ) {
RRegion *reg = model->region(s);
......@@ -497,10 +495,12 @@ void TBmeshWin::draw_iso_surfaces()
reg->_iso0 = new IsoSurface( model, data, isosurfwin->isoval0->value(),
reg->ele_membership(), tm );
reg->_iso0->color( isosurfwin->issColor(0) );
translucency( reg->_iso0->color()[3]<OPAQUE_LIMIT );
reg->_iso0->draw();
}
glDepthMask(GL_TRUE);
glPopAttrib();
}
......@@ -613,7 +613,7 @@ void TBmeshWin::draw_vertices(RRegion* reg)
// draw_axes
void TBmeshWin::draw_axes()
void TBmeshWin::draw_axes(const GLfloat *offset)
{
glPushAttrib(GL_ALL_ATTRIB_BITS);
glDisable(GL_LIGHTING);
......@@ -636,7 +636,8 @@ void TBmeshWin::draw_axes()
float angle = -acos( axis.Dot( zaxis ))*180./M_PI;
V3f rotvect = axis.Cross(zaxis);
org *= trackball.GetScale();
//glTranslatef( org.X(), org.Y(), org.Z() );
//imps_list.txtglTranslatef( org.X(), org.Y(), org.Z() );
glTranslatef( offset[0], offset[1], offset[2] );
glPushMatrix(); // save the translation but not rotation
glRotatef( angle, rotvect.X(), rotvect.Y(), rotvect.Z() );
glColor3f( 0., 0., 1. );
......@@ -1551,8 +1552,8 @@ void TBmeshWin::draw_clip_plane( int cp )
glColor4fv( planeColor);
const GLfloat *poff = model->pt_offset();
for ( int i=0; i<4; i++ ) {
vert[v0] = 2*(2*(!i||i==3)-1)*model->maxdim()+poff[0];
vert[v1] = 2*(2*(i>1)-1)*model->maxdim()+poff[1];
vert[v0] = 2*(2*(!i||i==3)-1)*model->maxdim()+poff[v0];
vert[v1] = 2*(2*(i>1)-1)*model->maxdim()+poff[v1];
vert[vf] = -(x[v0]*vert[v0]+x[v1]*vert[v1]+x[3])/x[vf];
glVertex3fv( vert );
}
......
......@@ -166,7 +166,7 @@ class TBmeshWin:public Fl_Gl_Tb_Window
void draw_cables(RRegion *);
void draw_cnnx(RRegion *);
void draw_vertices(RRegion *);
void draw_axes();
void draw_axes(const GLfloat *);
void draw_clip_plane( int cp );
void draw_cut_planes( RRegion * );
void draw_iso_surfaces( );
......
......@@ -47,7 +47,7 @@ void Triangle::draw( int p0, int p1, GLfloat *colour, Colourscale* cs,
for ( int i=3*p0; i<=3*p1; i+=3*stride ) {
if ( !_pt->vis(_node[i]) || !_pt->vis(_node[i+1]) || !_pt->vis(_node[i+2]) )
continue;
for ( int j=0; j<3; j++ )
{
if (data)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment