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));
|
||||
}
|
||||
|
||||
// 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:
|
||||
template <typename Image_word_type,
|
||||
typename Target_type,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#define CGAL_INLINE_FUNCTION
|
||||
#endif
|
||||
|
||||
#include <CGAL/gl.h>
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -48,112 +47,6 @@ bool Image_3::private_read(_image* im)
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,52 +1,41 @@
|
|||
message("Configuring libCGAL_ImageIO")
|
||||
|
||||
find_package( OpenGL )
|
||||
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)
|
||||
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} )
|
||||
set( CGAL_ImageIO_BASENAME CGAL_ImageIO)
|
||||
|
||||
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(COMMAND add_config_flag)
|
||||
set( CGAL_HAS_IMAGEIO TRUE )
|
||||
add_config_flag( CGAL_HAS_IMAGEIO )
|
||||
endif()
|
||||
|
||||
set( CGAL_ImageIO_BASENAME CGAL_ImageIO)
|
||||
|
||||
if(COMMAND add_config_flag)
|
||||
set( CGAL_HAS_IMAGEIO TRUE )
|
||||
add_config_flag( CGAL_HAS_IMAGEIO )
|
||||
endif()
|
||||
use_essential_libs()
|
||||
|
||||
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")
|
||||
|
||||
else(OPENGL_FOUND)
|
||||
message( STATUS "libCGAL_ImageIO needs OpenGL, cannot be configured.")
|
||||
endif(OPENGL_FOUND)
|
||||
|
||||
|
||||
if(NOT ZLIB_FOUND)
|
||||
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());
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
float ambient[] = { 0.25f,
|
||||
|
|
@ -1181,7 +1237,7 @@ void Volume::draw()
|
|||
|
||||
if(show_bbox) {
|
||||
::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)
|
||||
|
|
|
|||
|
|
@ -165,6 +165,10 @@ void display_marchin_cube();
|
|||
private:
|
||||
template <typename Iterator>
|
||||
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,
|
||||
typename DomainsOutputIterator,
|
||||
|
|
|
|||
Loading…
Reference in New Issue