mirror of https://github.com/CGAL/cgal
remove functions using the deprecated direct draw mode in ImageIO
This commit is contained in:
parent
b02e5c6b7c
commit
d5cd488b8b
|
|
@ -171,18 +171,6 @@ public:
|
||||||
vx,vy,vz,offset));
|
vx,vy,vz,offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
// implementation in src/CGAL_ImageIO/Image_3.cpp
|
|
||||||
void gl_draw(const float point_size,
|
|
||||||
const unsigned char r,
|
|
||||||
const unsigned char g,
|
|
||||||
const unsigned char b);
|
|
||||||
|
|
||||||
// implementation in src/CGAL_ImageIO/Image_3.cpp
|
|
||||||
void gl_draw_bbox(const float line_width,
|
|
||||||
const unsigned char red,
|
|
||||||
const unsigned char green,
|
|
||||||
const unsigned char blue);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <typename Image_word_type,
|
template <typename Image_word_type,
|
||||||
typename Target_type,
|
typename Target_type,
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
#define CGAL_INLINE_FUNCTION
|
#define CGAL_INLINE_FUNCTION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <CGAL/gl.h>
|
|
||||||
#include <CGAL/basic.h>
|
#include <CGAL/basic.h>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
@ -48,112 +47,6 @@ bool Image_3::private_read(_image* im)
|
||||||
return im != 0;
|
return im != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL_INLINE_FUNCTION
|
|
||||||
void Image_3::gl_draw(const float point_size,
|
|
||||||
const unsigned char r,
|
|
||||||
const unsigned char g,
|
|
||||||
const unsigned char b)
|
|
||||||
{
|
|
||||||
if(image_ptr.get() == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
glPointSize(point_size);
|
|
||||||
glColor3ub(r,g,b);
|
|
||||||
glBegin(GL_POINTS);
|
|
||||||
unsigned char *pData = (unsigned char*)image_ptr->data;
|
|
||||||
unsigned int xy = image_ptr->xdim * image_ptr->ydim;
|
|
||||||
for(unsigned int i=0;i<image_ptr->xdim;i+=5)
|
|
||||||
for(unsigned int j=0;j<image_ptr->ydim;j+=5)
|
|
||||||
for(unsigned int k=0;k<image_ptr->zdim;k+=5)
|
|
||||||
{
|
|
||||||
unsigned char value = pData[xy*k + j*image_ptr->xdim + i];
|
|
||||||
if(value > 0)
|
|
||||||
{
|
|
||||||
double x = image_ptr->vx * i;
|
|
||||||
double y = image_ptr->vy * j;
|
|
||||||
double z = image_ptr->vz * k;
|
|
||||||
glVertex3d(x,y,z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
} // end Image_3::gl_draw
|
|
||||||
|
|
||||||
|
|
||||||
CGAL_INLINE_FUNCTION
|
|
||||||
void Image_3::gl_draw_bbox(const float line_width,
|
|
||||||
const unsigned char red,
|
|
||||||
const unsigned char green,
|
|
||||||
const unsigned char blue)
|
|
||||||
{
|
|
||||||
if(!image_ptr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
glLineWidth(line_width);
|
|
||||||
glColor3ub(red,green,blue);
|
|
||||||
glBegin(GL_LINES);
|
|
||||||
|
|
||||||
struct Point {
|
|
||||||
double x_;
|
|
||||||
double y_;
|
|
||||||
double z_;
|
|
||||||
Point(double x, double y, double z) : x_(x), y_(y), z_(z) {};
|
|
||||||
|
|
||||||
double x() const { return x_; }
|
|
||||||
double y() const { return y_; }
|
|
||||||
double z() const { return z_; }
|
|
||||||
};
|
|
||||||
|
|
||||||
const double xmax = (image_ptr->xdim - 1.0)*(image_ptr->vx);
|
|
||||||
const double ymax = (image_ptr->ydim - 1.0)*(image_ptr->vy);
|
|
||||||
const double zmax = (image_ptr->zdim - 1.0)*(image_ptr->vz);
|
|
||||||
|
|
||||||
Point a(0.0, 0.0, 0.0);
|
|
||||||
Point b(0.0, ymax, 0.0);
|
|
||||||
Point c(0.0, ymax, zmax);
|
|
||||||
Point d(0.0, 0.0, zmax);
|
|
||||||
Point e(xmax, 0.0, 0.0);
|
|
||||||
Point f(xmax, ymax, 0.0);
|
|
||||||
Point g(xmax, ymax, zmax);
|
|
||||||
Point h(xmax, 0.0, zmax);
|
|
||||||
|
|
||||||
glVertex3d(a.x(),a.y(),a.z());
|
|
||||||
glVertex3d(b.x(),b.y(),b.z());
|
|
||||||
|
|
||||||
glVertex3d(b.x(),b.y(),b.z());
|
|
||||||
glVertex3d(c.x(),c.y(),c.z());
|
|
||||||
|
|
||||||
glVertex3d(c.x(),c.y(),c.z());
|
|
||||||
glVertex3d(d.x(),d.y(),d.z());
|
|
||||||
|
|
||||||
glVertex3d(d.x(),d.y(),d.z());
|
|
||||||
glVertex3d(a.x(),a.y(),a.z());
|
|
||||||
|
|
||||||
glVertex3d(e.x(),e.y(),e.z());
|
|
||||||
glVertex3d(f.x(),f.y(),f.z());
|
|
||||||
|
|
||||||
glVertex3d(f.x(),f.y(),f.z());
|
|
||||||
glVertex3d(g.x(),g.y(),g.z());
|
|
||||||
|
|
||||||
glVertex3d(g.x(),g.y(),g.z());
|
|
||||||
glVertex3d(h.x(),h.y(),h.z());
|
|
||||||
|
|
||||||
glVertex3d(h.x(),h.y(),h.z());
|
|
||||||
glVertex3d(e.x(),e.y(),e.z());
|
|
||||||
|
|
||||||
glVertex3d(a.x(),a.y(),a.z());
|
|
||||||
glVertex3d(e.x(),e.y(),e.z());
|
|
||||||
|
|
||||||
glVertex3d(d.x(),d.y(),d.z());
|
|
||||||
glVertex3d(h.x(),h.y(),h.z());
|
|
||||||
|
|
||||||
glVertex3d(c.x(),c.y(),c.z());
|
|
||||||
glVertex3d(g.x(),g.y(),g.z());
|
|
||||||
|
|
||||||
glVertex3d(b.x(),b.y(),b.z());
|
|
||||||
glVertex3d(f.x(),f.y(),f.z());
|
|
||||||
|
|
||||||
glEnd();
|
|
||||||
} // end Image_3::gl_draw_bbox
|
|
||||||
|
|
||||||
} // end namespace CGAL
|
} // end namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,41 @@
|
||||||
message("Configuring libCGAL_ImageIO")
|
message("Configuring libCGAL_ImageIO")
|
||||||
|
|
||||||
find_package( OpenGL )
|
|
||||||
find_package( ZLIB )
|
find_package( ZLIB )
|
||||||
|
|
||||||
|
if(ZLIB_FOUND)
|
||||||
|
get_dependency_version(ZLIB)
|
||||||
|
cache_set(CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} )
|
||||||
|
cache_set(CGAL_ImageIO_3RD_PARTY_LIBRARIES ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} ${ZLIB_LIBRARY} )
|
||||||
|
cache_set(CGAL_ImageIO_3RD_PARTY_DEFINITIONS "-DCGAL_USE_ZLIB")
|
||||||
|
cache_set(CGAL_ImageIO_USE_ZLIB "ON")
|
||||||
|
endif(ZLIB_FOUND)
|
||||||
|
|
||||||
if(OPENGL_FOUND)
|
set( CGAL_ImageIO_BASENAME CGAL_ImageIO)
|
||||||
message( STATUS "OpenGL include: ${OPENGL_INCLUDE_DIR}" )
|
|
||||||
message( STATUS "OpenGL libraries: ${OPENGL_LIBRARIES}" )
|
|
||||||
|
|
||||||
cache_set(CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR} )
|
|
||||||
cache_set(CGAL_ImageIO_3RD_PARTY_LIBRARIES ${OPENGL_LIBRARIES} )
|
|
||||||
|
|
||||||
if(ZLIB_FOUND)
|
if(COMMAND add_config_flag)
|
||||||
get_dependency_version(ZLIB)
|
set( CGAL_HAS_IMAGEIO TRUE )
|
||||||
cache_set(CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} )
|
add_config_flag( CGAL_HAS_IMAGEIO )
|
||||||
cache_set(CGAL_ImageIO_3RD_PARTY_LIBRARIES ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} ${ZLIB_LIBRARY} )
|
endif()
|
||||||
cache_set(CGAL_ImageIO_3RD_PARTY_DEFINITIONS "-DCGAL_USE_ZLIB")
|
|
||||||
cache_set(CGAL_ImageIO_USE_ZLIB "ON")
|
|
||||||
endif(ZLIB_FOUND)
|
|
||||||
|
|
||||||
set( CGAL_ImageIO_BASENAME CGAL_ImageIO)
|
use_essential_libs()
|
||||||
|
|
||||||
if(COMMAND add_config_flag)
|
|
||||||
set( CGAL_HAS_IMAGEIO TRUE )
|
|
||||||
add_config_flag( CGAL_HAS_IMAGEIO )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
use_essential_libs()
|
include_directories( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} .)
|
||||||
|
|
||||||
include_directories( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_ImageIO_3RD_PARTY_INCLUDE_DIRS} .)
|
link_directories ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
|
||||||
|
|
||||||
link_directories ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
|
collect_cgal_library( CGAL_ImageIO "")
|
||||||
|
|
||||||
|
add_dependencies( CGAL_ImageIO CGAL )
|
||||||
|
|
||||||
|
add_definitions( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_ImageIO_3RD_PARTY_DEFINITIONS} )
|
||||||
|
|
||||||
|
# CGAL_ImageIO only depends on CGAL in DEBUG, but we still link it
|
||||||
|
# in both build types.
|
||||||
|
target_link_libraries( CGAL_ImageIO CGAL ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} )
|
||||||
|
|
||||||
collect_cgal_library( CGAL_ImageIO "")
|
|
||||||
|
|
||||||
add_dependencies( CGAL_ImageIO CGAL )
|
|
||||||
|
|
||||||
add_definitions( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_ImageIO_3RD_PARTY_DEFINITIONS} )
|
|
||||||
|
|
||||||
# CGAL_ImageIO only depends on CGAL in DEBUG, but we still link it
|
|
||||||
# in both build types.
|
|
||||||
target_link_libraries( CGAL_ImageIO CGAL ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} )
|
|
||||||
|
|
||||||
message("libCGAL_ImageIO is configured")
|
message("libCGAL_ImageIO is configured")
|
||||||
|
|
||||||
else(OPENGL_FOUND)
|
|
||||||
message( STATUS "libCGAL_ImageIO needs OpenGL, cannot be configured.")
|
|
||||||
endif(OPENGL_FOUND)
|
|
||||||
|
|
||||||
if(NOT ZLIB_FOUND)
|
if(NOT ZLIB_FOUND)
|
||||||
message( STATUS "NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.")
|
message( STATUS "NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.")
|
||||||
|
|
|
||||||
|
|
@ -1099,6 +1099,62 @@ void Volume::display_surface_mesher_result()
|
||||||
save_image_settings(fileinfo.absoluteFilePath());
|
save_image_settings(fileinfo.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Volume::gl_draw_image_bbox(const float line_width,
|
||||||
|
const unsigned char red,
|
||||||
|
const unsigned char green,
|
||||||
|
const unsigned char blue)
|
||||||
|
{
|
||||||
|
const _image* image_ptr = m_image.image();
|
||||||
|
if(image_ptr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
glLineWidth(line_width);
|
||||||
|
glColor3ub(red,green,blue);
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
|
||||||
|
const double xmax = (image_ptr->xdim - 1.0)*(image_ptr->vx);
|
||||||
|
const double ymax = (image_ptr->ydim - 1.0)*(image_ptr->vy);
|
||||||
|
const double zmax = (image_ptr->zdim - 1.0)*(image_ptr->vz);
|
||||||
|
|
||||||
|
glVertex3d(0.0,0.0,0.0);
|
||||||
|
glVertex3d(0.0,ymax,0.0);
|
||||||
|
|
||||||
|
glVertex3d(0.0,ymax,0.0);
|
||||||
|
glVertex3d(0.0,ymax,zmax);
|
||||||
|
|
||||||
|
glVertex3d(0.0,ymax,zmax);
|
||||||
|
glVertex3d(0.0,0.0,zmax);
|
||||||
|
|
||||||
|
glVertex3d(0.0,0.0,zmax);
|
||||||
|
glVertex3d(0.0,0.0,0.0);
|
||||||
|
|
||||||
|
glVertex3d(xmax,0.0,0.0);
|
||||||
|
glVertex3d(xmax,ymax,0.0);
|
||||||
|
|
||||||
|
glVertex3d(xmax,ymax,0.0);
|
||||||
|
glVertex3d(xmax,ymax,zmax);
|
||||||
|
|
||||||
|
glVertex3d(xmax,ymax,zmax);
|
||||||
|
glVertex3d(xmax,0.0,zmax);
|
||||||
|
|
||||||
|
glVertex3d(xmax,0.0,zmax);
|
||||||
|
glVertex3d(xmax,0.0,0.0);
|
||||||
|
|
||||||
|
glVertex3d(0.0,0.0,0.0);
|
||||||
|
glVertex3d(xmax,0.0,0.0);
|
||||||
|
|
||||||
|
glVertex3d(0.0,0.0,zmax);
|
||||||
|
glVertex3d(xmax,0.0,zmax);
|
||||||
|
|
||||||
|
glVertex3d(0.0,ymax,zmax);
|
||||||
|
glVertex3d(xmax,ymax,zmax);
|
||||||
|
|
||||||
|
glVertex3d(0.0,ymax,0.0);
|
||||||
|
glVertex3d(xmax,ymax,0.0);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
void Volume::draw()
|
void Volume::draw()
|
||||||
{
|
{
|
||||||
float ambient[] = { 0.25f,
|
float ambient[] = { 0.25f,
|
||||||
|
|
@ -1181,7 +1237,7 @@ void Volume::draw()
|
||||||
|
|
||||||
if(show_bbox) {
|
if(show_bbox) {
|
||||||
::glDisable(GL_LIGHTING);
|
::glDisable(GL_LIGHTING);
|
||||||
m_image.gl_draw_bbox(3.0f,0,0,0);
|
gl_draw_image_bbox(3.0f,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_view_mc && m_draw_triangulation)
|
if(!m_view_mc && m_draw_triangulation)
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,10 @@ void display_marchin_cube();
|
||||||
private:
|
private:
|
||||||
template <typename Iterator>
|
template <typename Iterator>
|
||||||
void gl_draw_surface(Iterator begin, Iterator end, const QTreeWidgetItem* = 0);
|
void gl_draw_surface(Iterator begin, Iterator end, const QTreeWidgetItem* = 0);
|
||||||
|
void gl_draw_image_bbox(const float line_width,
|
||||||
|
const unsigned char red,
|
||||||
|
const unsigned char green,
|
||||||
|
const unsigned char blue);
|
||||||
|
|
||||||
template <typename PointsOutputIterator,
|
template <typename PointsOutputIterator,
|
||||||
typename DomainsOutputIterator,
|
typename DomainsOutputIterator,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue