@@ -54025,6 +54025,7 @@ namespace cimg_library {
5402554025 \param specular_lightness Amount of specular light.
5402654026 \param specular_shininess Shininess of the object
5402754027 \param g_opacity Global opacity of the object.
54028+ \param is_multithreaded_rendering Tells if mesh rendering is done with multiple threads
5402854029 **/
5402954030 template<typename tp, typename tf, typename tc, typename to>
5403054031 CImg<T>& draw_object3d(const float x0, const float y0, const float z0,
@@ -54034,10 +54035,11 @@ namespace cimg_library {
5403454035 const bool is_double_sided=false, const float focale=700,
5403554036 const float lightx=0, const float lighty=0, const float lightz=-5e8,
5403654037 const float specular_lightness=0.2f, const float specular_shininess=0.1f,
54037- const float g_opacity=1) {
54038+ const float g_opacity=1, const bool is_multithreaded_rendering=false ) {
5403854039 return draw_object3d(x0,y0,z0,vertices,primitives,colors,opacities,render_type,
5403954040 is_double_sided,focale,lightx,lighty,lightz,
54040- specular_lightness,specular_shininess,g_opacity,CImg<floatT>::empty());
54041+ specular_lightness,specular_shininess,g_opacity,CImg<floatT>::empty(),
54042+ is_multithreaded_rendering);
5404154043 }
5404254044
5404354045 //! Draw a 3D object \simplification.
@@ -54049,10 +54051,12 @@ namespace cimg_library {
5404954051 const bool is_double_sided, const float focale,
5405054052 const float lightx, const float lighty, const float lightz,
5405154053 const float specular_lightness, const float specular_shininess,
54052- const float g_opacity, CImg<tz>& zbuffer) {
54054+ const float g_opacity, CImg<tz>& zbuffer,
54055+ const bool is_multithreaded_rendering=false) {
5405354056 return _draw_object3d(zbuffer,x0,y0,z0,vertices,primitives,colors,opacities,
5405454057 render_type,is_double_sided,focale,lightx,lighty,lightz,
54055- specular_lightness,specular_shininess,g_opacity,1);
54058+ specular_lightness,specular_shininess,g_opacity,1,
54059+ is_multithreaded_rendering);
5405654060 }
5405754061
5405854062 //! Draw a 3D object \simplification.
@@ -54064,10 +54068,11 @@ namespace cimg_library {
5406454068 const bool is_double_sided=false, const float focale=700,
5406554069 const float lightx=0, const float lighty=0, const float lightz=-5e8,
5406654070 const float specular_lightness=0.2f, const float specular_shininess=0.1f,
54067- const float g_opacity=1) {
54071+ const float g_opacity=1, const bool is_multithreaded_rendering=false ) {
5406854072 return draw_object3d(x0,y0,z0,vertices,primitives,colors,opacities,render_type,
5406954073 is_double_sided,focale,lightx,lighty,lightz,
54070- specular_lightness,specular_shininess,g_opacity,CImg<floatT>::empty());
54074+ specular_lightness,specular_shininess,g_opacity,CImg<floatT>::empty(),
54075+ is_multithreaded_rendering);
5407154076 }
5407254077
5407354078 //! Draw a 3D object \simplification.
@@ -54079,10 +54084,12 @@ namespace cimg_library {
5407954084 const bool is_double_sided, const float focale,
5408054085 const float lightx, const float lighty, const float lightz,
5408154086 const float specular_lightness, const float specular_shininess,
54082- const float g_opacity, CImg<tz>& zbuffer) {
54087+ const float g_opacity, CImg<tz>& zbuffer,
54088+ const bool is_multithreaded_rendering=false) {
5408354089 return _draw_object3d(zbuffer,x0,y0,z0,vertices,primitives,colors,opacities,
5408454090 render_type,is_double_sided,focale,lightx,lighty,lightz,
54085- specular_lightness,specular_shininess,g_opacity,1);
54091+ specular_lightness,specular_shininess,g_opacity,1,
54092+ is_multithreaded_rendering);
5408654093 }
5408754094
5408854095 //! Draw a 3D object \simplification.
@@ -54094,10 +54101,11 @@ namespace cimg_library {
5409454101 const bool is_double_sided=false, const float focale=700,
5409554102 const float lightx=0, const float lighty=0, const float lightz=-5e8,
5409654103 const float specular_lightness=0.2f, const float specular_shininess=0.1f,
54097- const float g_opacity=1) {
54104+ const float g_opacity=1, const bool is_multithreaded_rendering=false ) {
5409854105 return draw_object3d(x0,y0,z0,vertices,primitives,colors,CImg<floatT>::const_empty(),
5409954106 render_type,is_double_sided,focale,lightx,lighty,lightz,
54100- specular_lightness,specular_shininess,g_opacity,CImg<floatT>::empty());
54107+ specular_lightness,specular_shininess,g_opacity,CImg<floatT>::empty(),
54108+ is_multithreaded_rendering);
5410154109 }
5410254110
5410354111 //! Draw a 3D object \simplification.
@@ -54109,10 +54117,12 @@ namespace cimg_library {
5410954117 const bool is_double_sided, const float focale,
5411054118 const float lightx, const float lighty, const float lightz,
5411154119 const float specular_lightness, const float specular_shininess,
54112- const float g_opacity, CImg<tz>& zbuffer) {
54120+ const float g_opacity, CImg<tz>& zbuffer,
54121+ const bool is_multithreaded_rendering=false) {
5411354122 return draw_object3d(x0,y0,z0,vertices,primitives,colors,CImg<floatT>::const_empty(),
5411454123 render_type,is_double_sided,focale,lightx,lighty,lightz,
54115- specular_lightness,specular_shininess,g_opacity,zbuffer);
54124+ specular_lightness,specular_shininess,g_opacity,zbuffer,
54125+ is_multithreaded_rendering);
5411654126 }
5411754127
5411854128 template<typename t, typename to>
@@ -54150,7 +54160,8 @@ namespace cimg_library {
5415054160 const bool is_double_sided, const float focale,
5415154161 const float lightx, const float lighty, const float lightz,
5415254162 const float specular_lightness, const float specular_shininess,
54153- const float g_opacity, const float sprite_scale) {
54163+ const float g_opacity, const float sprite_scale,
54164+ const bool is_multithreaded_rendering) {
5415454165 typedef typename to::value_type _to;
5415554166 if (is_empty() || !vertices || !primitives) return *this;
5415654167 CImg<char> error_message(1024);
@@ -54573,9 +54584,10 @@ namespace cimg_library {
5457354584
5457454585 // Draw visible primitives.
5457554586 const CImg<tc> default_color(1,_spectrum,1,1,(tc)200);
54576- CImg<_to> _opacity;
54577-
54587+ cimg_pragma_openmp(parallel for cimg_openmp_if(is_multithreaded_rendering &&
54588+ nb_visibles>=cimg_openmp_sizefactor*256))
5457854589 for (unsigned int l = 0; l<nb_visibles; ++l) {
54590+ CImg<_to> _opacity;
5457954591 const unsigned int n_primitive = visibles(permutations(l));
5458054592 const CImg<tf>& primitive = primitives[n_primitive];
5458154593 const CImg<tc>
@@ -60464,9 +60476,12 @@ namespace cimg_library {
6046460476 else visu._draw_object3d(render_with_zbuffer?zbuffer.fill(0):CImg<floatT>::empty(),
6046560477 Xoff + visu._width/2.f,Yoff + visu._height/2.f,Zoff,
6046660478 rotated_vertices,reverse_primitives?reverse_primitives:primitives,
60467- colors,opacities,clicked?nrender_motion:nrender_static,_is_double_sided==1,focale,
60479+ colors,opacities,
60480+ clicked?nrender_motion:nrender_static,
60481+ _is_double_sided==1,focale,
6046860482 width()/2.f + light_x,height()/2.f + light_y,light_z + Zoff,
60469- specular_lightness,specular_shininess,1,sprite_scale);
60483+ specular_lightness,specular_shininess,1,sprite_scale,
60484+ clicked);
6047060485 // Draw axes.
6047160486 if (ndisplay_axes) {
6047260487 const float
@@ -62360,7 +62375,12 @@ namespace cimg_library {
6236062375 COMPRESSION_NONE, COMPRESSION_ADOBE_DEFLATE, COMPRESSION_CCITT_T4, COMPRESSION_CCITT_T6,
6236162376 COMPRESSION_CCITTFAX3, COMPRESSION_CCITTFAX4, COMPRESSION_CCITTRLE, COMPRESSION_CCITTRLEW,
6236262377 COMPRESSION_DCS, COMPRESSION_DEFLATE, COMPRESSION_IT8BL, COMPRESSION_IT8CTPAD, COMPRESSION_IT8LW,
62363- COMPRESSION_IT8MP, COMPRESSION_JBIG, COMPRESSION_JP2000, COMPRESSION_JPEG, COMPRESSION_JXL,
62378+ COMPRESSION_IT8MP, COMPRESSION_JBIG, COMPRESSION_JP2000, COMPRESSION_JPEG,
62379+ #ifdef COMPRESSION_JXL
62380+ COMPRESSION_JXL,
62381+ #else
62382+ COMPRESSION_NONE,
62383+ #endif
6236462384 COMPRESSION_LERC, COMPRESSION_LZMA, COMPRESSION_LZW, COMPRESSION_NEXT, COMPRESSION_OJPEG,
6236562385 COMPRESSION_PACKBITS, COMPRESSION_PIXARFILM, COMPRESSION_PIXARLOG, COMPRESSION_SGILOG,
6236662386 COMPRESSION_SGILOG24, COMPRESSION_T43, COMPRESSION_T85, COMPRESSION_THUNDERSCAN, COMPRESSION_WEBP,
0 commit comments