Initial compilation support with C++11 featureset enabled
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 9 Feb 2015 17:23:21 +0000 (22:23 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 13 Mar 2015 11:47:40 +0000 (16:47 +0500)
This commit makes some preliminary fixes and tweaks aimed to make blender
compilable with C++11 feature set. This includes:

- Build system attribute to enable C++11 featureset.

  It's for sure default OFF, but easy to enable to have a play around with
  it and make sure all the stuff is compilable before we go C++11 for real.

- Changes in Compositor to use non-named cl_int structure fields.

  This is because __STRICT_ANSI__ is defined by default by GCC and OpenCL
  does not use named fields in this case.

- Changes to TYPE_CHECK() related on lack of typeof() in C++11

  This uses decltype() instead with some trickery to make sure returned type
  is not a reference.

- Changes for auto_ptr in Freestyle

  This actually conditionally switches between auto_ptr and unique_ptr since
  auto_ptr is deprecated in C++11. Seems to be not strictly needed but still
  nice to be ready for such an update anyway/

This all based on changes form depsgraph_refactor branch apart from the weird
changes which were made in order to support MinGW compilation. Those parts of
change would need to be carefully reviewed again after official move to gcc49
in MinGW.

Tested on Linux with GCC-4.7 and Clang-3.5, other platforms are not tested and
likely needs some more tweaks.

Reviewers: campbellbarton, juicyfruit, mont29, lukastoenne, psy-fi, kjym3

Differential Revision: https://developer.blender.org/D1089

18 files changed:
CMakeLists.txt
SConstruct
build_files/scons/tools/btools.py
intern/cycles/util/util_types.h
source/blender/blenlib/BLI_compiler_compat.h
source/blender/compositor/intern/COM_OpenCLDevice.cpp
source/blender/freestyle/CMakeLists.txt
source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h
source/blender/freestyle/intern/view_map/AutoPtrHelper.h [new file with mode: 0644]
source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h
source/blender/freestyle/intern/view_map/GridDensityProvider.h
source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp
source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h
source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h
source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp

index 5df6d79959344551ccb6f10552933dc62b581709..8e54ddc92745687bca6712d361d8daf2355da5c6 100644 (file)
@@ -440,6 +440,10 @@ if(MSVC)
        set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
 endif()
 
+# Experimental support of C++11
+option(WITH_CPP11 "Build with C++11 standard enabled, for development use only!" OFF)
+mark_as_advanced(WITH_CPP11)
+
 # avoid using again
 option_defaults_clear()
 
@@ -2663,6 +2667,16 @@ if(WITH_PYTHON)
        endif()
 endif()
 
+if(WITH_CPP11)
+       if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+               set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+       elseif(MSVC12)
+               # Nothing special is needed, C++11 features are available by default.
+       else()
+               message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER_ID} is not supported for C++11 build yet")
+       endif()
+endif()
+
 # Include warnings first, so its possible to disable them with user defined flags
 # eg: -Wno-uninitialized
 set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
index 7305edfe036296098e323478d010c9d85ac32576..00a95b0114be0c2a4b38ea28e2d79c785b92e91e 100644 (file)
@@ -480,6 +480,13 @@ if env['WITH_BF_OPENMP'] == 1:
             else:
                 env.Append(CCFLAGS=['-fopenmp'])
 
+if env['WITH_BF_CPP11']:
+    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+        # Nothing special is needed, C++11 features are available by default.
+        pass
+    else:
+        env['CXXFLAGS'].append('-std=c++11')
+
 #check for additional debug libnames
 
 if env.has_key('BF_DEBUG_LIBS'):
index eb5036f99968a514da6003a038bb55daebd0f7bc..c5342d6f349853edfd45c9dd8e45a55dabec6c01 100644 (file)
@@ -198,7 +198,8 @@ def validate_arguments(args, bc):
             'C_WARN', 'CC_WARN', 'CXX_WARN',
             'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER', 'C_COMPILER_ID',
             'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET',
-            'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING'
+            'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING',
+            'WITH_BF_CPP11'
     ]
 
 
@@ -653,7 +654,9 @@ def read_opts(env, cfg, args):
         ('BF_LLVM_LIBPATH', 'LLVM library path', ''),
         ('BF_LLVM_LIB_STATIC', 'LLVM static library', ''),
 
-        ('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', '')
+        ('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', ''),
+
+        (BoolVariable('WITH_BF_CPP11', '"Build with C++11 standard enabled, for development use only!', False)),
     ) # end of opts.AddOptions()
 
     return localopts
index df61b6ead21728dc5b3de28e00515a33ae2a173c..187675e74bf0c93efd0529660d46370f572ef1a1 100644 (file)
@@ -481,18 +481,32 @@ enum InterpolationType {
 #  define UNLIKELY(x)     (x)
 #endif
 
+#if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1800))
+#  define HAS_CPP11_FEATURES
+#endif
+
+#if defined(__GNUC__) || defined(__clang__)
+#  if defined(HAS_CPP11_FEATURES)
+/* Some magic to be sure we don't have reference in the type. */
+template<typename T> static inline T decltype_helper(T x) { return x; }
+#    define TYPEOF(x) decltype(decltype_helper(x))
+#  else
+#    define TYPEOF(x) typeof(x)
+#  endif
+#endif
+
 /* Causes warning:
  * incompatible types when assigning to type 'Foo' from type 'Bar'
  * ... the compiler optimizes away the temp var */
 #ifdef __GNUC__
 #define CHECK_TYPE(var, type)  {  \
-       typeof(var) *__tmp;         \
+       TYPEOF(var) *__tmp;         \
        __tmp = (type *)NULL;         \
        (void)__tmp;                  \
 } (void)0
 
 #define CHECK_TYPE_PAIR(var_a, var_b)  {  \
-       typeof(var_a) *__tmp;                 \
+       TYPEOF(var_a) *__tmp;                 \
        __tmp = (typeof(var_b) *)NULL;        \
        (void)__tmp;                          \
 } (void)0
index 10c0752c9a718aa3b2496d207b14a30871f76554..876d2c459c5e69e666d37265cb600a0cce2869be 100644 (file)
 #  include <malloc.h>
 #endif
 
+#if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1800))
+#  define HAS_CPP11_FEATURES
+#endif
+
+#if (defined(__GNUC__) || defined(__clang__)) && defined(HAS_CPP11_FEATURES)
+extern "C++" {
+       /* Some magic to be sure we don't have reference in the type. */
+       template<typename T> static inline T decltype_helper(T x) { return x; }
+#  define typeof(x) decltype(decltype_helper(x))
+}
+#endif
+
 #endif  /* __BLI_COMPILER_COMPAT_H__ */
index 5960082c2fd68a122d19252627142788755a311b..1b7acc9daf6a4b190c9d1e5a20d20fc5bee386da 100644 (file)
@@ -180,7 +180,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo
 
        bool breaked = false;
        for (offsety = 0; offsety < height && (!breaked); offsety += localSize) {
-               offset.y = offsety;
+               offset.s[1] = offsety;
                if (offsety + localSize < height) {
                        size[1] = localSize;
                }
@@ -195,7 +195,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo
                        else {
                                size[0] = width - offsetx;
                        }
-                       offset.x = offsetx;
+                       offset.s[0] = offsetx;
 
                        error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
                        if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
index 7fbb219af085a01a31b14a96c1bd1d8cf82d61a8..c14a5c537345398e40d24c557ea46fc7466e8ef2 100644 (file)
@@ -491,6 +491,7 @@ set(SRC
        intern/system/TimeUtils.h
        intern/view_map/ArbitraryGridDensityProvider.cpp
        intern/view_map/ArbitraryGridDensityProvider.h
+       intern/view_map/AutoPtrHelper.h
        intern/view_map/AverageAreaGridDensityProvider.cpp
        intern/view_map/AverageAreaGridDensityProvider.h
        intern/view_map/BoxGrid.cpp
index 8bc7c0952a8eef8e7c9fdcc18c3e6031e9556f34..3243c4d1fb797e98e0e360653027c4a2a271c867 100644 (file)
@@ -100,22 +100,22 @@ ArbitraryGridDensityProviderFactory::ArbitraryGridDensityProviderFactory(unsigne
 
 ArbitraryGridDensityProviderFactory::~ArbitraryGridDensityProviderFactory() {}
 
-auto_ptr<GridDensityProvider> ArbitraryGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source,
-                                                                                          const real proscenium[4])
+AutoPtr<GridDensityProvider> ArbitraryGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source,
+                                                                                         const real proscenium[4])
 {
-       return auto_ptr<GridDensityProvider>(new ArbitraryGridDensityProvider(source, proscenium, numCells));
+       return AutoPtr<GridDensityProvider>(new ArbitraryGridDensityProvider(source, proscenium, numCells));
 }
 
-auto_ptr<GridDensityProvider>
+AutoPtr<GridDensityProvider>
 ArbitraryGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
                                                             const GridHelpers::Transform& transform)
 {
-       return auto_ptr<GridDensityProvider>(new ArbitraryGridDensityProvider(source, bbox, transform, numCells));
+       return AutoPtr<GridDensityProvider>(new ArbitraryGridDensityProvider(source, bbox, transform, numCells));
 }
 
-auto_ptr<GridDensityProvider> ArbitraryGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source)
+AutoPtr<GridDensityProvider> ArbitraryGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source)
 {
-       return auto_ptr<GridDensityProvider>(new ArbitraryGridDensityProvider(source, numCells));
+       return AutoPtr<GridDensityProvider>(new ArbitraryGridDensityProvider(source, numCells));
 }
 
 } /* namespace Freestyle */
index 652cb9b34b0b409b64c31854c43ecb104ca10f71..c7939d34da42731da77519af74ca955d5646fba1 100644 (file)
@@ -58,10 +58,10 @@ public:
        ArbitraryGridDensityProviderFactory(unsigned numCells);
        ~ArbitraryGridDensityProviderFactory();
 
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]);
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
-                                                            const GridHelpers::Transform& transform);
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
+                                                           const GridHelpers::Transform& transform);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source);
 
 protected:
        unsigned numCells;
diff --git a/source/blender/freestyle/intern/view_map/AutoPtrHelper.h b/source/blender/freestyle/intern/view_map/AutoPtrHelper.h
new file mode 100644 (file)
index 0000000..17a43c1
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __FREESTYLE_AUTOPTR_HELPER_H__
+#define __FREESTYLE_AUTOPTR_HELPER_H__
+
+/** \file blender/freestyle/intern/view_map/AutoPtrHelper.h
+ *  \ingroup freestyle
+ *  \brief Utility header for auto_ptr/unique_ptr selection
+ *  \author Sergey Sharybin
+ *  \date 2015-02-09
+ */
+
+#include <memory>
+
+namespace Freestyle {
+
+#if __cplusplus > 199711L
+template<typename T>
+class AutoPtr : public std::unique_ptr<T> {
+public:
+       AutoPtr() : std::unique_ptr<T>() {}
+       AutoPtr(T *ptr) : std::unique_ptr<T>(ptr) {}
+
+       /* TODO(sergey): Is there more clear way to do this? */
+       template<typename X>
+       AutoPtr(AutoPtr<X>& other) : std::unique_ptr<T>(other.get()) {
+               other.release();
+       }
+};
+#else
+template<typename T>
+class AutoPtr : public std::auto_ptr<T> {
+public:
+       AutoPtr() : std::auto_ptr<T>() {}
+       AutoPtr(T *ptr) : std::auto_ptr<T>(ptr) {}
+       AutoPtr(std::auto_ptr_ref<T> ref) : std::auto_ptr<T>(ref) {}
+};
+#endif
+
+}  /* namespace Freestyle */
+
+#endif  // __FREESTYLE_AUTOPTR_HELPER_H__
index 952b9752a3efe77cd3e2f38dd9e13b728b6ff9ee..b5e133ec44188bc1d737c703450eef25794e14a2 100644 (file)
@@ -121,22 +121,22 @@ AverageAreaGridDensityProviderFactory::AverageAreaGridDensityProviderFactory(rea
 
 AverageAreaGridDensityProviderFactory::~AverageAreaGridDensityProviderFactory() {}
 
-auto_ptr<GridDensityProvider>
+AutoPtr<GridDensityProvider>
 AverageAreaGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source, const real proscenium[4])
 {
-       return auto_ptr<GridDensityProvider>(new AverageAreaGridDensityProvider(source, proscenium, sizeFactor));
+       return AutoPtr<GridDensityProvider>(new AverageAreaGridDensityProvider(source, proscenium, sizeFactor));
 }
 
-auto_ptr<GridDensityProvider>
+AutoPtr<GridDensityProvider>
 AverageAreaGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
                                                               const GridHelpers::Transform& transform)
 {
-       return auto_ptr<GridDensityProvider>(new AverageAreaGridDensityProvider(source, bbox, transform, sizeFactor));
+       return AutoPtr<GridDensityProvider>(new AverageAreaGridDensityProvider(source, bbox, transform, sizeFactor));
 }
 
-auto_ptr<GridDensityProvider> AverageAreaGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source)
+AutoPtr<GridDensityProvider> AverageAreaGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source)
 {
-       return auto_ptr<GridDensityProvider>(new AverageAreaGridDensityProvider(source, sizeFactor));
+       return AutoPtr<GridDensityProvider>(new AverageAreaGridDensityProvider(source, sizeFactor));
 }
 
 } /* namespace Freestyle */
index d63557f5cdac8617101a0d22e069281f17b69f19..2c58cc32da9b0fec4a19e15f56ef8642b0bd7c87 100644 (file)
@@ -55,10 +55,10 @@ public:
        AverageAreaGridDensityProviderFactory(real sizeFactor);
        ~AverageAreaGridDensityProviderFactory();
 
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]);
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
-                                                            const GridHelpers::Transform& transform);
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
+                                                           const GridHelpers::Transform& transform);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source);
 
 protected:
        real sizeFactor;
index 272d64dd6de21e055b3396daf729309b749370d4..b49e74d640252bb1f3021afe1efc5faead86b13f 100644 (file)
@@ -32,6 +32,7 @@
 #include <algorithm>
 #include <memory>
 
+#include "AutoPtrHelper.h"
 #include "OccluderSource.h"
 
 #include "../geometry/BBox.h"
@@ -148,12 +149,12 @@ class GridDensityProviderFactory
 public:
        GridDensityProviderFactory() {}
 
-       virtual auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]) = 0;
+       virtual AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]) = 0;
 
-       virtual auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
-                                                                    const GridHelpers::Transform& transform) = 0;
+       virtual AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
+                                                                   const GridHelpers::Transform& transform) = 0;
 
-       virtual auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source) = 0;
+       virtual AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source) = 0;
 
        virtual ~GridDensityProviderFactory () {}
 
index 00f5cc90cc47a47b9a5360286c3159d2cc9438ff..18edc82b0964440ccc05df32f31a89c8809ad383 100644 (file)
@@ -36,45 +36,45 @@ HeuristicGridDensityProviderFactory::HeuristicGridDensityProviderFactory(real si
 
 HeuristicGridDensityProviderFactory::~HeuristicGridDensityProviderFactory() {}
 
-auto_ptr<GridDensityProvider>
+AutoPtr<GridDensityProvider>
 HeuristicGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source, const real proscenium[4])
 {
-       auto_ptr<AverageAreaGridDensityProvider> avg(new AverageAreaGridDensityProvider(source, proscenium, sizeFactor));
-       auto_ptr<Pow23GridDensityProvider> p23(new Pow23GridDensityProvider(source, proscenium, numFaces));
+       AutoPtr<AverageAreaGridDensityProvider> avg(new AverageAreaGridDensityProvider(source, proscenium, sizeFactor));
+       AutoPtr<Pow23GridDensityProvider> p23(new Pow23GridDensityProvider(source, proscenium, numFaces));
        if (avg->cellSize() > p23->cellSize()) {
-               return (auto_ptr<GridDensityProvider>) p23;
+               return (AutoPtr<GridDensityProvider>) p23;
        }
        else {
-               return (auto_ptr<GridDensityProvider>) avg;
+               return (AutoPtr<GridDensityProvider>) avg;
        }
 }
 
-auto_ptr<GridDensityProvider>
+AutoPtr<GridDensityProvider>
 HeuristicGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
                                                             const GridHelpers::Transform& transform)
 {
-       auto_ptr<AverageAreaGridDensityProvider> avg(new AverageAreaGridDensityProvider(source, bbox,
-                                                                                       transform, sizeFactor));
-       auto_ptr<Pow23GridDensityProvider> p23(new Pow23GridDensityProvider(source, bbox, transform, numFaces));
+       AutoPtr<AverageAreaGridDensityProvider> avg(new AverageAreaGridDensityProvider(source, bbox,
+                                                                                      transform, sizeFactor));
+       AutoPtr<Pow23GridDensityProvider> p23(new Pow23GridDensityProvider(source, bbox, transform, numFaces));
        if (avg->cellSize() > p23->cellSize()) {
-               return (auto_ptr<GridDensityProvider>) p23;
+               return (AutoPtr<GridDensityProvider>) p23;
        }
        else {
-               return (auto_ptr<GridDensityProvider>) avg;
+               return (AutoPtr<GridDensityProvider>) avg;
        }
 }
 
-auto_ptr<GridDensityProvider> HeuristicGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source)
+AutoPtr<GridDensityProvider> HeuristicGridDensityProviderFactory::newGridDensityProvider(OccluderSource& source)
 {
        real proscenium[4];
        GridDensityProvider::calculateOptimalProscenium(source, proscenium);
-       auto_ptr<AverageAreaGridDensityProvider> avg(new AverageAreaGridDensityProvider(source, proscenium, sizeFactor));
-       auto_ptr<Pow23GridDensityProvider> p23(new Pow23GridDensityProvider(source, proscenium, numFaces));
+       AutoPtr<AverageAreaGridDensityProvider> avg(new AverageAreaGridDensityProvider(source, proscenium, sizeFactor));
+       AutoPtr<Pow23GridDensityProvider> p23(new Pow23GridDensityProvider(source, proscenium, numFaces));
        if (avg->cellSize() > p23->cellSize()) {
-               return (auto_ptr<GridDensityProvider>) p23;
+               return (AutoPtr<GridDensityProvider>) p23;
        }
        else {
-               return (auto_ptr<GridDensityProvider>) avg;
+               return (AutoPtr<GridDensityProvider>) avg;
        }
 }
 
index 65f2af6df2fb4b4ab7869b18a97a413b88088d00..9414e4931f571336c1a9c538b7df6e6788ecd6ed 100644 (file)
@@ -42,10 +42,10 @@ public:
        HeuristicGridDensityProviderFactory(real sizeFactor, unsigned numFaces);
        ~HeuristicGridDensityProviderFactory();
 
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]);
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
-                                                            const GridHelpers::Transform& transform);
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
+                                                           const GridHelpers::Transform& transform);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source);
 
 protected:
        real sizeFactor;
index e3bb9b87ecc043f2f02712d8280f4c38c3a6294c..8dff079e0cffb3b7827ec1b3c1c9f3a91d69a328 100644 (file)
@@ -99,22 +99,22 @@ Pow23GridDensityProviderFactory::Pow23GridDensityProviderFactory(unsigned numFac
 
 Pow23GridDensityProviderFactory::~Pow23GridDensityProviderFactory () {}
 
-auto_ptr<GridDensityProvider>
+AutoPtr<GridDensityProvider>
 Pow23GridDensityProviderFactory::newGridDensityProvider(OccluderSource& source, const real proscenium[4])
 {
-       return auto_ptr<GridDensityProvider>(new Pow23GridDensityProvider(source, proscenium, numFaces));
+       return AutoPtr<GridDensityProvider>(new Pow23GridDensityProvider(source, proscenium, numFaces));
 }
 
-auto_ptr<GridDensityProvider>
+AutoPtr<GridDensityProvider>
 Pow23GridDensityProviderFactory::newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
                                                         const GridHelpers::Transform& transform)
 {
-       return auto_ptr<GridDensityProvider>(new Pow23GridDensityProvider(source, bbox, transform, numFaces));
+       return AutoPtr<GridDensityProvider>(new Pow23GridDensityProvider(source, bbox, transform, numFaces));
 }
 
-auto_ptr<GridDensityProvider> Pow23GridDensityProviderFactory::newGridDensityProvider(OccluderSource& source)
+AutoPtr<GridDensityProvider> Pow23GridDensityProviderFactory::newGridDensityProvider(OccluderSource& source)
 {
-       return auto_ptr<GridDensityProvider>(new Pow23GridDensityProvider(source, numFaces));
+       return AutoPtr<GridDensityProvider>(new Pow23GridDensityProvider(source, numFaces));
 }
 
 } /* namespace Freestyle */
index 7f646790ab65e3e5588ad42b0f25e75d0938c027..5dfa9cdfc870f925e6789d25cb863d0e87a7ae45 100644 (file)
@@ -58,10 +58,10 @@ public:
        Pow23GridDensityProviderFactory(unsigned numFaces);
        ~Pow23GridDensityProviderFactory();
 
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]);
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
-                                                            const GridHelpers::Transform& transform);
-       auto_ptr<GridDensityProvider> newGridDensityProvider(OccluderSource& source);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const real proscenium[4]);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source, const BBox<Vec3r>& bbox,
+                                                           const GridHelpers::Transform& transform);
+       AutoPtr<GridDensityProvider> newGridDensityProvider(OccluderSource& source);
 
 protected:
        unsigned numFaces;
index a0a1282219c887209d3035bbf40502b2130ee4d6..8adc2fa66fd8fb28876b98b081dc958ee0bd6094 100644 (file)
@@ -1300,8 +1300,8 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap)
 void ViewMapBuilder::ComputeCumulativeVisibility(ViewMap *ioViewMap, WingedEdge& we, const BBox<Vec3r>& bbox,
                                                  real epsilon, bool cull, GridDensityProviderFactory& factory)
 {
-       auto_ptr<GridHelpers::Transform> transform;
-       auto_ptr<OccluderSource> source;
+       AutoPtr<GridHelpers::Transform> transform;
+       AutoPtr<OccluderSource> source;
 
        if (_orthographicProjection) {
                transform.reset(new BoxGrid::Transform);
@@ -1317,7 +1317,7 @@ void ViewMapBuilder::ComputeCumulativeVisibility(ViewMap *ioViewMap, WingedEdge&
                source.reset(new OccluderSource(*transform, we));
        }
 
-       auto_ptr<GridDensityProvider> density(factory.newGridDensityProvider(*source, bbox, *transform));
+       AutoPtr<GridDensityProvider> density(factory.newGridDensityProvider(*source, bbox, *transform));
 
        if (_orthographicProjection) {
                BoxGrid grid(*source, *density, ioViewMap, _viewpoint, _EnableQI);
@@ -1332,8 +1332,8 @@ void ViewMapBuilder::ComputeCumulativeVisibility(ViewMap *ioViewMap, WingedEdge&
 void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, WingedEdge& we, const BBox<Vec3r>& bbox,
                                                real epsilon, bool cull, GridDensityProviderFactory& factory)
 {
-       auto_ptr<GridHelpers::Transform> transform;
-       auto_ptr<OccluderSource> source;
+       AutoPtr<GridHelpers::Transform> transform;
+       AutoPtr<OccluderSource> source;
 
        if (_orthographicProjection) {
                transform.reset(new BoxGrid::Transform);
@@ -1349,7 +1349,7 @@ void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, WingedEdge& w
                source.reset(new OccluderSource(*transform, we));
        }
 
-       auto_ptr<GridDensityProvider> density(factory.newGridDensityProvider(*source, bbox, *transform));
+       AutoPtr<GridDensityProvider> density(factory.newGridDensityProvider(*source, bbox, *transform));
 
        if (_orthographicProjection) {
                BoxGrid grid(*source, *density, ioViewMap, _viewpoint, _EnableQI);