Merging r58756 through r58777 from trunk into soc-2013-depsgraph_mt
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 31 Jul 2013 20:49:39 +0000 (20:49 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 31 Jul 2013 20:49:39 +0000 (20:49 +0000)
25 files changed:
extern/libmv/libmv-capi.cc
extern/libmv/libmv-capi.h
extern/libmv/libmv-capi_stub.cc
intern/cycles/kernel/kernel_displace.h
intern/cycles/kernel/kernel_emission.h
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/kernel_shader.h
intern/cycles/kernel/kernel_types.h
intern/cycles/kernel/osl/osl_services.cpp
intern/cycles/kernel/osl/osl_services.h
intern/cycles/kernel/shaders/node_light_path.osl
intern/cycles/kernel/svm/svm_light_path.h
intern/cycles/kernel/svm/svm_types.h
intern/cycles/render/nodes.cpp
source/blender/blenkernel/intern/tracking.c
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/render/render_opengl.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/nodes/intern/node_common.c
source/blender/nodes/intern/node_exec.c
source/blender/nodes/shader/nodes/node_shader_light_path.c
source/blender/render/intern/source/convertblender.c
source/blender/windowmanager/intern/wm_event_system.c

index 563919e1d7b9cc677357c2ae44e2b7e1f57c07c1..990b40df90a47ded14054863afe810306eefedf8 100644 (file)
@@ -62,7 +62,7 @@
 #  define snprintf _snprintf
 #endif
 
-typedef struct libmv_Reconstruction {
+struct libmv_Reconstruction {
        libmv::EuclideanReconstruction reconstruction;
 
        /* used for per-track average error calculation after reconstruction */
@@ -70,12 +70,12 @@ typedef struct libmv_Reconstruction {
        libmv::CameraIntrinsics intrinsics;
 
        double error;
-} libmv_Reconstruction;
+};
 
-typedef struct libmv_Features {
+struct libmv_Features {
        int count, margin;
        libmv::Feature *features;
-} libmv_Features;
+};
 
 /* ************ Logging ************ */
 
@@ -197,30 +197,30 @@ static void saveImage(const char *prefix, libmv::FloatImage image, int x0, int y
        int x, y;
        png_bytep *row_pointers;
 
-       row_pointers= (png_bytep*)malloc(sizeof(png_bytep)*image.Height());
+       row_pointers = (png_bytep *) malloc(sizeof(png_bytep) * image.Height());
 
        for (y = 0; y < image.Height(); y++) {
-               row_pointers[y]= (png_bytep)malloc(sizeof(png_byte)*4*image.Width());
+               row_pointers[y] = (png_bytep) malloc(sizeof(png_byte) * 4 * image.Width());
 
                for (x = 0; x < image.Width(); x++) {
                        if (x0 == x && image.Height() - y0 - 1 == y) {
-                               row_pointers[y][x*4+0]= 255;
-                               row_pointers[y][x*4+1]= 0;
-                               row_pointers[y][x*4+2]= 0;
-                               row_pointers[y][x*4+3]= 255;
+                               row_pointers[y][x * 4 + 0] = 255;
+                               row_pointers[y][x * 4 + 1] = 0;
+                               row_pointers[y][x * 4 + 2] = 0;
+                               row_pointers[y][x * 4 + 3] = 255;
                        }
                        else {
                                float pixel = image(image.Height() - y - 1, x, 0);
-                               row_pointers[y][x*4+0]= pixel*255;
-                               row_pointers[y][x*4+1]= pixel*255;
-                               row_pointers[y][x*4+2]= pixel*255;
-                               row_pointers[y][x*4+3]= 255;
+                               row_pointers[y][x * 4 + 0] = pixel * 255;
+                               row_pointers[y][x * 4 + 1] = pixel * 255;
+                               row_pointers[y][x * 4 + 2] = pixel * 255;
+                               row_pointers[y][x * 4 + 3] = 255;
                        }
                }
        }
 
        {
-               static int a= 0;
+               static int a = 0;
                char buf[128];
                snprintf(buf, sizeof(buf), "%s_%02d.png", prefix, ++a);
                savePNGImage(row_pointers, image.Width(), image.Height(), 8, PNG_COLOR_TYPE_RGBA, buf);
@@ -237,17 +237,17 @@ static void saveBytesImage(const char *prefix, unsigned char *data, int width, i
        int x, y;
        png_bytep *row_pointers;
 
-       row_pointers= (png_bytep*)malloc(sizeof(png_bytep)*height);
+       row_pointers = (png_bytep *) malloc(sizeof(png_bytep) * height);
 
        for (y = 0; y < height; y++) {
-               row_pointers[y]= (png_bytep)malloc(sizeof(png_byte)*4*width);
+               row_pointers[y] = (png_bytep) malloc(sizeof(png_byte) * 4 * width);
 
                for (x = 0; x < width; x++) {
-                       char pixel = data[width*y+x];
-                       row_pointers[y][x*4+0]= pixel;
-                       row_pointers[y][x*4+1]= pixel;
-                       row_pointers[y][x*4+2]= pixel;
-                       row_pointers[y][x*4+3]= 255;
+                       char pixel = data[width * y + x];
+                       row_pointers[y][x * 4 + 0] = pixel;
+                       row_pointers[y][x * 4 + 1] = pixel;
+                       row_pointers[y][x * 4 + 2] = pixel;
+                       row_pointers[y][x * 4 + 3] = 255;
                }
        }
 
@@ -267,12 +267,12 @@ static void saveBytesImage(const char *prefix, unsigned char *data, int width, i
 
 /* ************ Planar tracker ************ */
 
-/* TrackRegion (new planar tracker) */
-int libmv_trackRegion(const struct libmv_trackRegionOptions *options,
+/* TrackRegion */
+int libmv_trackRegion(const libmv_TrackRegionOptions *options,
                       const float *image1, int image1_width, int image1_height,
                       const float *image2, int image2_width, int image2_height,
                       const double *x1, const double *y1,
-                      struct libmv_trackRegionResult *result,
+                      libmv_TrackRegionResult *result,
                       double *x2, double *y2)
 {
        double xx1[5], yy1[5];
@@ -292,7 +292,7 @@ int libmv_trackRegion(const struct libmv_trackRegionOptions *options,
 
        switch (options->motion_model) {
 #define LIBMV_CONVERT(the_model) \
-    case libmv::TrackRegionOptions::the_model: \
+       case libmv::TrackRegionOptions::the_model: \
                track_region_options.mode = libmv::TrackRegionOptions::the_model; \
                break;
                LIBMV_CONVERT(TRANSLATION)
@@ -384,29 +384,28 @@ void libmv_samplePlanarPatch(const float *image, int width, int height,
 
 /* ************ Tracks ************ */
 
-libmv_Tracks *libmv_tracksNew(void)
+struct libmv_Tracks *libmv_tracksNew(void)
 {
        libmv::Tracks *libmv_tracks = new libmv::Tracks();
 
-       return (libmv_Tracks *)libmv_tracks;
+       return (struct libmv_Tracks *)libmv_tracks;
 }
 
-void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, double x, double y)
+void libmv_tracksDestroy(struct libmv_Tracks *libmv_tracks)
 {
-       ((libmv::Tracks*)libmv_tracks)->Insert(image, track, x, y);
+       delete (libmv::Tracks*) libmv_tracks;
 }
 
-void libmv_tracksDestroy(libmv_Tracks *libmv_tracks)
+void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, double x, double y)
 {
-       delete (libmv::Tracks*)libmv_tracks;
+       ((libmv::Tracks*) libmv_tracks)->Insert(image, track, x, y);
 }
 
-/* ************ Reconstruction solver ************ */
+/* ************ Reconstruction ************ */
 
 class ReconstructUpdateCallback : public libmv::ProgressUpdateCallback {
 public:
-       ReconstructUpdateCallback(reconstruct_progress_update_cb progress_update_callback,
-                       void *callback_customdata)
+       ReconstructUpdateCallback(reconstruct_progress_update_cb progress_update_callback, void *callback_customdata)
        {
                progress_update_callback_ = progress_update_callback;
                callback_customdata_ = callback_customdata;
@@ -414,7 +413,7 @@ public:
 
        void invoke(double progress, const char *message)
        {
-               if(progress_update_callback_) {
+               if (progress_update_callback_) {
                        progress_update_callback_(callback_customdata_, progress, message);
                }
        }
@@ -456,7 +455,7 @@ static void libmv_solveRefineIntrinsics(const libmv::Tracks &tracks,
                                               intrinsics);
 }
 
-static void cameraIntrinsicsFromOptions(const libmv_cameraIntrinsicsOptions *camera_intrinsics_options,
+static void cameraIntrinsicsFromOptions(const libmv_CameraIntrinsicsOptions *camera_intrinsics_options,
                                         libmv::CameraIntrinsics *camera_intrinsics)
 {
        camera_intrinsics->SetFocalLength(camera_intrinsics_options->focal_length,
@@ -486,7 +485,7 @@ static libmv::Tracks getNormalizedTracks(const libmv::Tracks &tracks, const libm
 }
 
 static void finishReconstruction(const libmv::Tracks &tracks, const libmv::CameraIntrinsics &camera_intrinsics,
-                                 libmv_Reconstruction *libmv_reconstruction,
+                                 struct libmv_Reconstruction *libmv_reconstruction,
                                  reconstruct_progress_update_cb progress_update_callback,
                                  void *callback_customdata)
 {
@@ -571,13 +570,13 @@ static bool selectTwoKeyframesBasedOnGRICAndVariance(
        return true;
 }
 
-libmv_Reconstruction *libmv_solveReconstruction(const libmv_Tracks *libmv_tracks,
-                       const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
-                       libmv_reconstructionOptions *libmv_reconstruction_options,
-                       reconstruct_progress_update_cb progress_update_callback,
-                       void *callback_customdata)
+struct libmv_Reconstruction *libmv_solveReconstruction(const struct libmv_Tracks *libmv_tracks,
+               const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+               libmv_ReconstructionOptions *libmv_reconstruction_options,
+               reconstruct_progress_update_cb progress_update_callback,
+               void *callback_customdata)
 {
-       libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction();
+       struct libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction();
 
        libmv::Tracks &tracks = *((libmv::Tracks *) libmv_tracks);
        libmv::EuclideanReconstruction &reconstruction = libmv_reconstruction->reconstruction;
@@ -650,16 +649,16 @@ libmv_Reconstruction *libmv_solveReconstruction(const libmv_Tracks *libmv_tracks
        finishReconstruction(tracks, camera_intrinsics, libmv_reconstruction,
                             progress_update_callback, callback_customdata);
 
-       return (libmv_Reconstruction *)libmv_reconstruction;
+       return (struct libmv_Reconstruction *)libmv_reconstruction;
 }
 
-struct libmv_Reconstruction *libmv_solveModal(const libmv_Tracks *libmv_tracks,
-                       const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
-                       const libmv_reconstructionOptions *libmv_reconstruction_options,
-                       reconstruct_progress_update_cb progress_update_callback,
-                       void *callback_customdata)
+struct libmv_Reconstruction *libmv_solveModal(const struct libmv_Tracks *libmv_tracks,
+               const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+               const libmv_ReconstructionOptions *libmv_reconstruction_options,
+               reconstruct_progress_update_cb progress_update_callback,
+               void *callback_customdata)
 {
-       libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction();
+       struct libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction();
 
        libmv::Tracks &tracks = *((libmv::Tracks *) libmv_tracks);
        libmv::EuclideanReconstruction &reconstruction = libmv_reconstruction->reconstruction;
@@ -697,15 +696,20 @@ struct libmv_Reconstruction *libmv_solveModal(const libmv_Tracks *libmv_tracks,
        finishReconstruction(tracks, camera_intrinsics, libmv_reconstruction,
                             progress_update_callback, callback_customdata);
 
-       return (libmv_Reconstruction *)libmv_reconstruction;
+       return (struct libmv_Reconstruction *)libmv_reconstruction;
+}
+
+void libmv_reconstructionDestroy(struct libmv_Reconstruction *libmv_reconstruction)
+{
+       delete libmv_reconstruction;
 }
 
-int libmv_reporojectionPointForTrack(const libmv_Reconstruction *libmv_reconstruction, int track, double pos[3])
+int libmv_reprojectionPointForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3])
 {
        const libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction;
        const libmv::EuclideanPoint *point = reconstruction->PointForTrack(track);
 
-       if(point) {
+       if (point) {
                pos[0] = point->X[0];
                pos[1] = point->X[2];
                pos[2] = point->X[1];
@@ -732,7 +736,7 @@ static libmv::Marker ProjectMarker(const libmv::EuclideanPoint &point,
        return reprojected_marker;
 }
 
-double libmv_reporojectionErrorForTrack(const libmv_Reconstruction *libmv_reconstruction, int track)
+double libmv_reprojectionErrorForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track)
 {
        const libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction;
        const libmv::CameraIntrinsics *intrinsics = &libmv_reconstruction->intrinsics;
@@ -755,13 +759,13 @@ double libmv_reporojectionErrorForTrack(const libmv_Reconstruction *libmv_recons
                double ex = reprojected_marker.x - markers[i].x;
                double ey = reprojected_marker.y - markers[i].y;
 
-               total_error += sqrt(ex*ex + ey*ey);
+               total_error += sqrt(ex * ex + ey * ey);
        }
 
        return total_error / num_reprojected;
 }
 
-double libmv_reporojectionErrorForImage(const libmv_Reconstruction *libmv_reconstruction, int image)
+double libmv_reprojectionErrorForImage(const struct libmv_Reconstruction *libmv_reconstruction, int image)
 {
        const libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction;
        const libmv::CameraIntrinsics *intrinsics = &libmv_reconstruction->intrinsics;
@@ -786,19 +790,19 @@ double libmv_reporojectionErrorForImage(const libmv_Reconstruction *libmv_recons
                double ex = reprojected_marker.x - markers[i].x;
                double ey = reprojected_marker.y - markers[i].y;
 
-               total_error += sqrt(ex*ex + ey*ey);
+               total_error += sqrt(ex * ex + ey * ey);
        }
 
        return total_error / num_reprojected;
 }
 
-int libmv_reporojectionCameraForImage(const libmv_Reconstruction *libmv_reconstruction,
+int libmv_reprojectionCameraForImage(const struct libmv_Reconstruction *libmv_reconstruction,
                                       int image, double mat[4][4])
 {
        const libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction;
        const libmv::EuclideanCamera *camera = reconstruction->CameraForImage(image);
 
-       if(camera) {
+       if (camera) {
                for (int j = 0; j < 3; ++j) {
                        for (int k = 0; k < 3; ++k) {
                                int l = k;
@@ -809,7 +813,7 @@ int libmv_reporojectionCameraForImage(const libmv_Reconstruction *libmv_reconstr
                                if (j == 2) mat[j][l] = -camera->R(j,k);
                                else mat[j][l] = camera->R(j,k);
                        }
-                       mat[j][3]= 0.0;
+                       mat[j][3] = 0.0;
                }
 
                libmv::Vec3 optical_center = -camera->R.transpose() * camera->t;
@@ -818,7 +822,7 @@ int libmv_reporojectionCameraForImage(const libmv_Reconstruction *libmv_reconstr
                mat[3][1] = optical_center(2);
                mat[3][2] = optical_center(1);
 
-               mat[3][3]= 1.0;
+               mat[3][3] = 1.0;
 
                return 1;
        }
@@ -826,17 +830,17 @@ int libmv_reporojectionCameraForImage(const libmv_Reconstruction *libmv_reconstr
        return 0;
 }
 
-double libmv_reprojectionError(const libmv_Reconstruction *libmv_reconstruction)
+double libmv_reprojectionError(const struct libmv_Reconstruction *libmv_reconstruction)
 {
        return libmv_reconstruction->error;
 }
 
-void libmv_destroyReconstruction(libmv_Reconstruction *libmv_reconstruction)
+struct libmv_CameraIntrinsics *libmv_reconstructionExtractIntrinsics(struct libmv_Reconstruction *libmv_reconstruction)
 {
-       delete libmv_reconstruction;
+       return (struct libmv_CameraIntrinsics *)&libmv_reconstruction->intrinsics;
 }
 
-/* ************ feature detector ************ */
+/* ************ Feature detector ************ */
 
 struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char *data,
                                                 int width, int height, int stride,
@@ -844,24 +848,24 @@ struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char *data,
 {
        libmv::Feature *features = NULL;
        std::vector<libmv::Feature> v;
-       libmv_Features *libmv_features = new libmv_Features();
-       int i= 0, count;
+       struct libmv_Features *libmv_features = new libmv_Features();
+       int i = 0, count;
 
-       if(margin) {
-               data += margin*stride+margin;
-               width -= 2*margin;
-               height -= 2*margin;
+       if (margin) {
+               data += margin * stride+margin;
+               width -= 2 * margin;
+               height -= 2 * margin;
        }
 
        v = libmv::DetectFAST(data, width, height, stride, min_trackness, min_distance);
 
        count = v.size();
 
-       if(count) {
-               features= new libmv::Feature[count];
+       if (count) {
+               features = new libmv::Feature[count];
 
                for(std::vector<libmv::Feature>::iterator it = v.begin(); it != v.end(); it++) {
-                       features[i++]= *it;
+                       features[i++] = *it;
                }
        }
 
@@ -869,7 +873,7 @@ struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char *data,
        libmv_features->count = count;
        libmv_features->margin = margin;
 
-       return (libmv_Features *)libmv_features;
+       return (struct libmv_Features *)libmv_features;
 }
 
 struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char *data,
@@ -877,13 +881,13 @@ struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char *data,
                                                    int margin, int count, int min_distance)
 {
        libmv::Feature *features = NULL;
-       libmv_Features *libmv_features = new libmv_Features;
+       struct libmv_Features *libmv_features = new libmv_Features;
 
-       if(count) {
-               if(margin) {
-                       data += margin*stride+margin;
-                       width -= 2*margin;
-                       height -= 2*margin;
+       if (count) {
+               if (margin) {
+                       data += margin * stride+margin;
+                       width -= 2 * margin;
+                       height -= 2 * margin;
                }
 
                features = new libmv::Feature[count];
@@ -897,14 +901,22 @@ struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char *data,
        return libmv_features;
 }
 
-int libmv_countFeatures(const libmv_Features *libmv_features)
+void libmv_featuresDestroy(struct libmv_Features *libmv_features)
+{
+       if (libmv_features->features)
+               delete [] libmv_features->features;
+
+       delete libmv_features;
+}
+
+int libmv_countFeatures(const struct libmv_Features *libmv_features)
 {
        return libmv_features->count;
 }
 
-void libmv_getFeature(const libmv_Features *libmv_features, int number, double *x, double *y, double *score, double *size)
+void libmv_getFeature(const struct libmv_Features *libmv_features, int number, double *x, double *y, double *score, double *size)
 {
-       libmv::Feature feature= libmv_features->features[number];
+       libmv::Feature feature = libmv_features->features[number];
 
        *x = feature.x + libmv_features->margin;
        *y = feature.y + libmv_features->margin;
@@ -912,29 +924,16 @@ void libmv_getFeature(const libmv_Features *libmv_features, int number, double *
        *size = feature.size;
 }
 
-void libmv_destroyFeatures(libmv_Features *libmv_features)
-{
-       if(libmv_features->features)
-               delete [] libmv_features->features;
+/* ************ Camera intrinsics ************ */
 
-       delete libmv_features;
-}
-
-/* ************ camera intrinsics ************ */
-
-struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics(libmv_Reconstruction *libmv_Reconstruction)
-{
-       return (struct libmv_CameraIntrinsics *)&libmv_Reconstruction->intrinsics;
-}
-
-struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNewEmpty(void)
+struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNewEmpty(void)
 {
        libmv::CameraIntrinsics *camera_intrinsics = new libmv::CameraIntrinsics();
 
        return (struct libmv_CameraIntrinsics *) camera_intrinsics;
 }
 
-struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options)
+struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNew(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options)
 {
        libmv::CameraIntrinsics *camera_intrinsics = new libmv::CameraIntrinsics();
 
@@ -943,23 +942,23 @@ struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(const libmv_cameraIntri
        return (struct libmv_CameraIntrinsics *) camera_intrinsics;
 }
 
-struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(const libmv_CameraIntrinsics *libmvIntrinsics)
+struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsCopy(const libmv_CameraIntrinsics *libmvIntrinsics)
 {
        libmv::CameraIntrinsics *orig_intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics;
-       libmv::CameraIntrinsics *new_intrinsics= new libmv::CameraIntrinsics(*orig_intrinsics);
+       libmv::CameraIntrinsics *new_intrinsics = new libmv::CameraIntrinsics(*orig_intrinsics);
 
        return (struct libmv_CameraIntrinsics *) new_intrinsics;
 }
 
-void libmv_CameraIntrinsicsDestroy(struct libmv_CameraIntrinsics *libmvIntrinsics)
+void libmv_cameraIntrinsicsDestroy(struct libmv_CameraIntrinsics *libmvIntrinsics)
 {
        libmv::CameraIntrinsics *intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics;
 
        delete intrinsics;
 }
 
-void libmv_CameraIntrinsicsUpdate(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
-                                  libmv_CameraIntrinsics *libmv_intrinsics)
+void libmv_cameraIntrinsicsUpdate(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+                                  struct libmv_CameraIntrinsics *libmv_intrinsics)
 {
        libmv::CameraIntrinsics *camera_intrinsics = (libmv::CameraIntrinsics *) libmv_intrinsics;
 
@@ -997,15 +996,16 @@ void libmv_CameraIntrinsicsUpdate(const libmv_cameraIntrinsicsOptions *libmv_cam
        }
 }
 
-void libmv_CameraIntrinsicsSetThreads(libmv_CameraIntrinsics *libmv_intrinsics, int threads)
+void libmv_cameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics *libmv_intrinsics, int threads)
 {
        libmv::CameraIntrinsics *camera_intrinsics = (libmv::CameraIntrinsics *) libmv_intrinsics;
 
        camera_intrinsics->SetThreads(threads);
 }
 
-void libmv_CameraIntrinsicsExtract(const libmv_CameraIntrinsics *libmv_intrinsics, double *focal_length,
-                       double *principal_x, double *principal_y, double *k1, double *k2, double *k3, int *width, int *height)
+void libmv_cameraIntrinsicsExtract(const struct libmv_CameraIntrinsics *libmv_intrinsics, double *focal_length,
+                                   double *principal_x, double *principal_y, double *k1, double *k2, double *k3,
+                                   int *width, int *height)
 {
        libmv::CameraIntrinsics *camera_intrinsics = (libmv::CameraIntrinsics *) libmv_intrinsics;
 
@@ -1016,40 +1016,42 @@ void libmv_CameraIntrinsicsExtract(const libmv_CameraIntrinsics *libmv_intrinsic
        *k2 = camera_intrinsics->k2();
 }
 
-void libmv_CameraIntrinsicsUndistortByte(const libmv_CameraIntrinsics *libmv_intrinsics,
-                       unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels)
+void libmv_cameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics,
+                                         unsigned char *src, unsigned char *dst, int width, int height,
+                                         float overscan, int channels)
 {
        libmv::CameraIntrinsics *camera_intrinsics = (libmv::CameraIntrinsics *) libmv_intrinsics;
 
        camera_intrinsics->Undistort(src, dst, width, height, overscan, channels);
 }
 
-void libmv_CameraIntrinsicsUndistortFloat(const libmv_CameraIntrinsics *libmvIntrinsics,
-                       float *src, float *dst, int width, int height, float overscan, int channels)
+void libmv_cameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics *libmvIntrinsics,
+                                          float *src, float *dst, int width, int height,
+                                          float overscan, int channels)
 {
        libmv::CameraIntrinsics *intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics;
 
        intrinsics->Undistort(src, dst, width, height, overscan, channels);
 }
 
-void libmv_CameraIntrinsicsDistortByte(const libmv_CameraIntrinsics *libmvIntrinsics,
-                       unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels)
+void libmv_cameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmvIntrinsics,
+                                       unsigned char *src, unsigned char *dst, int width, int height,
+                                       float overscan, int channels)
 {
        libmv::CameraIntrinsics *intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics;
        intrinsics->Distort(src, dst, width, height, overscan, channels);
 }
 
-void libmv_CameraIntrinsicsDistortFloat(const libmv_CameraIntrinsics *libmvIntrinsics,
-                       float *src, float *dst, int width, int height, float overscan, int channels)
+void libmv_cameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmvIntrinsics,
+                                        float *src, float *dst, int width, int height,
+                                        float overscan, int channels)
 {
        libmv::CameraIntrinsics *intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics;
 
        intrinsics->Distort(src, dst, width, height, overscan, channels);
 }
 
-/* ************ utils ************ */
-
-void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+void libmv_cameraIntrinsicsApply(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
                                  double x, double y, double *x1, double *y1)
 {
        libmv::CameraIntrinsics camera_intrinsics;
@@ -1063,7 +1065,7 @@ void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_came
        }
 }
 
-void libmv_InvertCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+void libmv_cameraIntrinsicsInvert(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
                                   double x, double y, double *x1, double *y1)
 {
        libmv::CameraIntrinsics camera_intrinsics;
index beac3e85468206c8863b19c971ee190bd5ad3254..7c91881fe71638c0fc539ca12d7ddaedc9f4ace7 100644 (file)
@@ -41,8 +41,8 @@ void libmv_initLogging(const char *argv0);
 void libmv_startDebugLogging(void);
 void libmv_setLoggingVerbosity(int verbosity);
 
-/* TrackRegion (new planar tracker) */
-struct libmv_trackRegionOptions {
+/* Planar tracker */
+typedef struct libmv_TrackRegionOptions {
        int motion_model;
        int num_iterations;
        int use_brute;
@@ -50,21 +50,20 @@ struct libmv_trackRegionOptions {
        double minimum_correlation;
        double sigma;
        float *image1_mask;
-};
+} libmv_TrackRegionOptions;
 
-struct libmv_trackRegionResult {
+typedef struct libmv_TrackRegionResult {
        int termination;
        const char *termination_reason;
        double correlation;
-};
+} libmv_TrackRegionResult;
 
-int libmv_trackRegion(const struct libmv_trackRegionOptions *options,
+int libmv_trackRegion(const libmv_TrackRegionOptions *options,
                       const float *image1, int image1_width, int image1_height,
                       const float *image2, int image2_width, int image2_height,
                       const double *x1, const double *y1,
-                      struct libmv_trackRegionResult *result,
+                      libmv_TrackRegionResult *result,
                       double *x2, double *y2);
-
 void libmv_samplePlanarPatch(const float *image, int width, int height,
                              int channels, const double *xs, const double *ys,
                              int num_samples_x, int num_samples_y,
@@ -73,25 +72,24 @@ void libmv_samplePlanarPatch(const float *image, int width, int height,
 
 /* Tracks */
 struct libmv_Tracks *libmv_tracksNew(void);
-void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, double x, double y);
 void libmv_tracksDestroy(struct libmv_Tracks *libmv_tracks);
+void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, double x, double y);
 
-/* Reconstruction solver */
-
+/* Reconstruction */
 #define LIBMV_REFINE_FOCAL_LENGTH          (1 << 0)
 #define LIBMV_REFINE_PRINCIPAL_POINT       (1 << 1)
 #define LIBMV_REFINE_RADIAL_DISTORTION_K1  (1 << 2)
 #define LIBMV_REFINE_RADIAL_DISTORTION_K2  (1 << 4)
 
-typedef struct libmv_cameraIntrinsicsOptions {
+typedef struct libmv_CameraIntrinsicsOptions {
        double focal_length;
        double principal_point_x, principal_point_y;
        double k1, k2, k3;
        double p1, p2;
        int image_width, image_height;
-} libmv_cameraIntrinsicsOptions;
+} libmv_CameraIntrinsicsOptions;
 
-typedef struct libmv_reconstructionOptions {
+typedef struct libmv_ReconstructionOptions {
        int select_keyframes;
        int keyframe1, keyframe2;
 
@@ -99,72 +97,67 @@ typedef struct libmv_reconstructionOptions {
 
        double success_threshold;
        int use_fallback_reconstruction;
-} libmv_reconstructionOptions;
+} libmv_ReconstructionOptions;
 
 typedef void (*reconstruct_progress_update_cb) (void *customdata, double progress, const char *message);
 
 struct libmv_Reconstruction *libmv_solveReconstruction(const struct libmv_Tracks *libmv_tracks,
-                       const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
-                       libmv_reconstructionOptions *libmv_reconstruction_options,
-                       reconstruct_progress_update_cb progress_update_callback,
-                       void *callback_customdata);
+               const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+               libmv_ReconstructionOptions *libmv_reconstruction_options,
+               reconstruct_progress_update_cb progress_update_callback,
+               void *callback_customdata);
 struct libmv_Reconstruction *libmv_solveModal(const struct libmv_Tracks *libmv_tracks,
-                       const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
-                       const libmv_reconstructionOptions *libmv_reconstruction_options,
-                       reconstruct_progress_update_cb progress_update_callback,
-                       void *callback_customdata);
-int libmv_reporojectionPointForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]);
-double libmv_reporojectionErrorForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track);
-double libmv_reporojectionErrorForImage(const struct libmv_Reconstruction *libmv_reconstruction, int image);
-int libmv_reporojectionCameraForImage(const struct libmv_Reconstruction *libmv_reconstruction, int image, double mat[4][4]);
+               const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+               const libmv_ReconstructionOptions *libmv_reconstruction_options,
+               reconstruct_progress_update_cb progress_update_callback,
+               void *callback_customdata);
+void libmv_reconstructionDestroy(struct libmv_Reconstruction *libmv_reconstruction);
+int libmv_reprojectionPointForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]);
+double libmv_reprojectionErrorForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track);
+double libmv_reprojectionErrorForImage(const struct libmv_Reconstruction *libmv_reconstruction, int image);
+int libmv_reprojectionCameraForImage(const struct libmv_Reconstruction *libmv_reconstruction,
+                                     int image, double mat[4][4]);
 double libmv_reprojectionError(const struct libmv_Reconstruction *libmv_reconstruction);
-void libmv_destroyReconstruction(struct libmv_Reconstruction *libmv_reconstruction);
+struct libmv_CameraIntrinsics *libmv_reconstructionExtractIntrinsics(struct libmv_Reconstruction *libmv_Reconstruction);
 
-/* feature detector */
+/* Feature detector */
 struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char *data, int width, int height, int stride,
-                       int margin, int min_trackness, int min_distance);
+                                                int margin, int min_trackness, int min_distance);
 struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char *data, int width, int height, int stride,
-                       int margin, int count, int min_distance);
+                                                   int margin, int count, int min_distance);
+void libmv_featuresDestroy(struct libmv_Features *libmv_features);
 int libmv_countFeatures(const struct libmv_Features *libmv_features);
-void libmv_getFeature(const struct libmv_Features *libmv_features, int number, double *x, double *y, double *score, double *size);
-void libmv_destroyFeatures(struct libmv_Features *libmv_features);
-
-/* camera intrinsics */
-struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics(struct libmv_Reconstruction *libmv_Reconstruction);
-
-struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNewEmpty(void);
-
-struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options);
-
-struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(const struct libmv_CameraIntrinsics *libmv_intrinsics);
-
-void libmv_CameraIntrinsicsDestroy(struct libmv_CameraIntrinsics *libmv_intrinsics);
-
-void libmv_CameraIntrinsicsUpdate(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+void libmv_getFeature(const struct libmv_Features *libmv_features, int number, double *x, double *y, double *score,
+                      double *size);
+
+/* Camera intrinsics */
+struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNewEmpty(void);
+struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNew(
+               const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options);
+struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsCopy(const struct libmv_CameraIntrinsics *libmv_intrinsics);
+void libmv_cameraIntrinsicsDestroy(struct libmv_CameraIntrinsics *libmv_intrinsics);
+void libmv_cameraIntrinsicsUpdate(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
                                   struct libmv_CameraIntrinsics *libmv_intrinsics);
-
-void libmv_CameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics *libmv_intrinsics, int threads);
-
-void libmv_CameraIntrinsicsExtract(const struct libmv_CameraIntrinsics *libmv_intrinsics, double *focal_length,
-                       double *principal_x, double *principal_y, double *k1, double *k2, double *k3, int *width, int *height);
-
-void libmv_CameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics,
-                       unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels);
-
-void libmv_CameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics *libmv_intrinsics,
-                       float *src, float *dst, int width, int height, float overscan, int channels);
-
-void libmv_CameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics,
-                       unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels);
-
-void libmv_CameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmv_intrinsics,
-                       float *src, float *dst, int width, int height, float overscan, int channels);
-
-/* utils */
-void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
-                       double x, double y, double *x1, double *y1);
-void libmv_InvertCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
-                       double x, double y, double *x1, double *y1);
+void libmv_cameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics *libmv_intrinsics, int threads);
+void libmv_cameraIntrinsicsExtract(const struct libmv_CameraIntrinsics *libmv_intrinsics, double *focal_length,
+                                   double *principal_x, double *principal_y, double *k1, double *k2, double *k3,
+                                   int *width, int *height);
+void libmv_cameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics,
+                                         unsigned char *src, unsigned char *dst, int width, int height,
+                                         float overscan, int channels);
+void libmv_cameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics *libmv_intrinsics,
+                                          float *src, float *dst, int width, int height,
+                                          float overscan, int channels);
+void libmv_cameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics,
+                                       unsigned char *src, unsigned char *dst, int width, int height,
+                                       float overscan, int channels);
+void libmv_cameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmv_intrinsics,
+                                        float *src, float *dst, int width, int height,
+                                        float overscan, int channels);
+void libmv_cameraIntrinsicsApply(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+                                 double x, double y, double *x1, double *y1);
+void libmv_cameraIntrinsicsInvert(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+                                  double x, double y, double *x1, double *y1);
 
 #ifdef __cplusplus
 }
index 4bc2b18081a1fe400483d0b95be20cfe60bf6972..36977eb58bab11f64b21260448ce41bc9b1da60c 100644 (file)
@@ -48,11 +48,11 @@ void libmv_setLoggingVerbosity(int /*verbosity*/)
 /* ************ Planar tracker ************ */
 
 /* TrackRegion (new planar tracker) */
-int libmv_trackRegion(const struct libmv_trackRegionOptions * /*options*/,
+int libmv_trackRegion(const libmv_TrackRegionOptions * /*options*/,
                       const float * /*image1*/, int /*image1_width*/, int /*image1_height*/,
                       const float * /*image2*/, int /*image2_width*/, int /*image2_height*/,
                       const double *x1, const double *y1,
-                      struct libmv_trackRegionResult *result,
+                      libmv_TrackRegionResult *result,
                       double *x2, double *y2)
 {
        /* Convert to doubles for the libmv api. The four corners and the center. */
@@ -79,7 +79,8 @@ void libmv_samplePlanarPatch(const float *image, int width, int height,
 
 /* ************ Tracks ************ */
 
-libmv_Tracks *libmv_tracksNew(void) {
+struct libmv_Tracks *libmv_tracksNew(void)
+{
        return NULL;
 }
 
@@ -88,73 +89,72 @@ void libmv_tracksInsert(struct libmv_Tracks * /*libmv_tracks*/, int /*image*/,
 {
 }
 
-void libmv_tracksDestroy(libmv_Tracks * /*libmv_tracks*/)
+void libmv_tracksDestroy(struct libmv_Tracks * /*libmv_tracks*/)
 {
 }
 
 /* ************ Reconstruction solver ************ */
 
-libmv_Reconstruction *libmv_solveReconstruction(const libmv_Tracks * /*libmv_tracks*/,
-                       const libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
-                       libmv_reconstructionOptions * /*libmv_reconstruction_options*/,
-                       reconstruct_progress_update_cb /*progress_update_callback*/,
-                       void * /*callback_customdata*/)
+struct libmv_Reconstruction *libmv_solveReconstruction(const struct libmv_Tracks * /*libmv_tracks*/,
+               const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
+               libmv_ReconstructionOptions * /*libmv_reconstruction_options*/,
+               reconstruct_progress_update_cb /*progress_update_callback*/,
+               void * /*callback_customdata*/)
 {
        return NULL;
 }
 
 struct libmv_Reconstruction *libmv_solveModal(const struct libmv_Tracks * /*libmv_tracks*/,
-                       const libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
-                       const libmv_reconstructionOptions * /*libmv_reconstruction_options*/,
-                       reconstruct_progress_update_cb /*progress_update_callback*/,
-                       void * /*callback_customdata*/)
+               const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
+               const libmv_ReconstructionOptions * /*libmv_reconstruction_options*/,
+               reconstruct_progress_update_cb /*progress_update_callback*/,
+               void * /*callback_customdata*/)
 {
        return NULL;
 }
 
-int libmv_reporojectionPointForTrack(const libmv_Reconstruction * /*libmv_reconstruction*/,
+int libmv_reprojectionPointForTrack(const struct libmv_Reconstruction * /*libmv_reconstruction*/,
                                      int /*track*/, double /*pos*/[3])
 {
        return 0;
 }
 
-double libmv_reporojectionErrorForTrack(const libmv_Reconstruction * /*libmv_reconstruction*/, int /*track*/)
+double libmv_reprojectionErrorForTrack(const struct libmv_Reconstruction * /*libmv_reconstruction*/, int /*track*/)
 {
        return 0.0;
 }
 
-double libmv_reporojectionErrorForImage(const libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/)
+double libmv_reprojectionErrorForImage(const struct libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/)
 {
        return 0.0;
 }
 
-int libmv_reporojectionCameraForImage(const libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/,
+int libmv_reprojectionCameraForImage(const struct libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/,
                                       double /*mat*/[4][4])
 {
        return 0;
 }
 
-double libmv_reprojectionError(const libmv_Reconstruction * /*libmv_reconstruction*/)
+double libmv_reprojectionError(const struct libmv_Reconstruction * /*libmv_reconstruction*/)
 {
        return 0.0;
 }
 
-void libmv_destroyReconstruction(libmv_Reconstruction * /*libmv_reconstruction*/)
+void libmv_reconstructionDestroy(struct libmv_Reconstruction * /*libmv_reconstruction*/)
 {
 }
 
 /* ************ feature detector ************ */
 
-struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char * /*data*/,
-                       int /*width*/, int /*height*/, int /*stride*/,
-                       int /*margin*/, int /*min_trackness*/, int /*min_distance*/)
+struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char * /*data*/, int /*width*/, int /*height*/,
+                                                int /*stride*/, int /*margin*/, int /*min_trackness*/,
+                                                int /*min_distance*/)
 {
        return NULL;
 }
 
-struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char * /*data*/,
-                       int /*width*/, int /*height*/, int /*stride*/,
-                       int /*margin*/, int /*count*/, int /*min_distance*/)
+struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char * /*data*/, int /*width*/, int /*height*/,
+                                                   int /*stride*/, int /*margin*/, int /*count*/, int /*min_distance*/)
 {
        return NULL;
 }
@@ -173,49 +173,50 @@ void libmv_getFeature(const struct libmv_Features * /*libmv_features*/, int /*nu
        *size = 0.0;
 }
 
-void libmv_destroyFeatures(struct libmv_Features * /*libmv_features*/)
+void libmv_featuresDestroy(struct libmv_Features * /*libmv_features*/)
 {
 }
 
 /* ************ camera intrinsics ************ */
 
-struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics(
-                       struct libmv_Reconstruction * /*libmv_Reconstruction*/)
+struct libmv_CameraIntrinsics *libmv_reconstructionExtractIntrinsics(
+               struct libmv_Reconstruction * /*libmv_reconstruction*/)
 {
        return NULL;
 }
 
-struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNewEmpty(void)
+struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNewEmpty(void)
 {
        return NULL;
 }
 
-struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(const libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/)
+struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNew(
+               const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/)
 {
        return NULL;
 }
 
-struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(const struct libmv_CameraIntrinsics * /*libmvIntrinsics*/)
+struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsCopy(const libmv_CameraIntrinsics * /*libmvIntrinsics*/)
 {
        return NULL;
 }
 
-void libmv_CameraIntrinsicsDestroy(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/)
+void libmv_cameraIntrinsicsDestroy(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/)
 {
 }
 
-void libmv_CameraIntrinsicsUpdate(const libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
-                                  libmv_CameraIntrinsics * /*libmv_intrinsics*/)
+void libmv_cameraIntrinsicsUpdate(const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
+                                  struct libmv_CameraIntrinsics * /*libmv_intrinsics*/)
 {
 }
 
-void libmv_CameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, int /*threads*/)
+void libmv_cameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, int /*threads*/)
 {
 }
 
-void libmv_CameraIntrinsicsExtract(const struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, double * focal_length,
-                       double * principal_x, double *principal_y, double *k1, double *k2, double *k3,
-                       int *width, int *height)
+void libmv_cameraIntrinsicsExtract(const struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, double * focal_length,
+                                   double * principal_x, double *principal_y, double *k1, double *k2, double *k3,
+                                   int *width, int *height)
 {
        *focal_length = 1.0;
        *principal_x = 0.0;
@@ -226,33 +227,35 @@ void libmv_CameraIntrinsicsExtract(const struct libmv_CameraIntrinsics * /*libmv
        *height = 0.0;
 }
 
-void libmv_CameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics * /*libmv_intrinsics*/,
-                       unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels)
+void libmv_cameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics * /*libmv_intrinsics*/,
+                                         unsigned char *src, unsigned char *dst, int width, int height,
+                                         float overscan, int channels)
 {
        memcpy(dst, src, channels * width * height * sizeof(unsigned char));
 }
 
-void libmv_CameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics * /*libmvIntrinsics*/,
-                       float *src, float *dst, int width, int height, float overscan, int channels)
+void libmv_cameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics * /*libmvIntrinsics*/,
+                                          float *src, float *dst, int width, int height, float overscan, int channels)
 {
        memcpy(dst, src, channels * width * height * sizeof(float));
 }
 
-void libmv_CameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmvIntrinsics,
-                       unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels)
+void libmv_cameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmvIntrinsics,
+                                       unsigned char *src, unsigned char *dst, int width, int height,
+                                       float overscan, int channels)
 {
        memcpy(dst, src, channels * width * height * sizeof(unsigned char));
 }
 
-void libmv_CameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmvIntrinsics,
-                       float *src, float *dst, int width, int height, float overscan, int channels)
+void libmv_cameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmvIntrinsics,
+                                        float *src, float *dst, int width, int height, float overscan, int channels)
 {
        memcpy(dst, src, channels * width * height * sizeof(float));
 }
 
 /* ************ utils ************ */
 
-void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+void libmv_cameraIntrinsicsApply(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
                                  double x, double y, double *x1, double *y1)
 {
        double focal_length = libmv_camera_intrinsics_options->focal_length;
@@ -263,7 +266,7 @@ void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_came
        *y1 = y * focal_length + principal_y;
 }
 
-void libmv_InvertCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+void libmv_cameraIntrinsicsInvert(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options,
                                   double x, double y, double *x1, double *y1)
 {
        double focal_length = libmv_camera_intrinsics_options->focal_length;
index ae2e35e8d93be2d1e75dd3d06844576578455866..b4ece1610beee096528a887d8feb6f7fa4e95f29 100644 (file)
@@ -57,7 +57,7 @@ __device void kernel_shader_evaluate(KernelGlobals *kg, __global uint4 *input, _
 #endif
 
                /* setup shader data */
-               shader_setup_from_background(kg, &sd, &ray);
+               shader_setup_from_background(kg, &sd, &ray, 0);
 
                /* evaluate */
                int flag = 0; /* we can't know which type of BSDF this is for */
index 77dc59d2691fe4fed592e19141fe4007ad35f043..a6bd3ed2850dc53a4ab31965a95ab496c1a913ee 100644 (file)
@@ -21,7 +21,7 @@ CCL_NAMESPACE_BEGIN
 /* Direction Emission */
 
 __device_noinline float3 direct_emissive_eval(KernelGlobals *kg, float rando,
-       LightSample *ls, float u, float v, float3 I, differential3 dI, float t, float time)
+       LightSample *ls, float u, float v, float3 I, differential3 dI, float t, float time, int bounce)
 {
        /* setup shading at emitter */
        ShaderData sd;
@@ -41,7 +41,7 @@ __device_noinline float3 direct_emissive_eval(KernelGlobals *kg, float rando,
 #ifdef __CAMERA_MOTION__
                ray.time = time;
 #endif
-               shader_setup_from_background(kg, &sd, &ray);
+               shader_setup_from_background(kg, &sd, &ray, bounce+1);
                eval = shader_eval_background(kg, &sd, 0, SHADER_CONTEXT_EMISSION);
        }
        else
@@ -49,10 +49,10 @@ __device_noinline float3 direct_emissive_eval(KernelGlobals *kg, float rando,
        {
 #ifdef __HAIR__
                if(ls->type == LIGHT_STRAND)
-                       shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, t, time, ls->prim);
+                       shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, t, time, bounce+1, ls->prim);
                else
 #endif
-                       shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, t, time, ~0);
+                       shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, t, time, bounce+1, ~0);
 
                ls->Ng = sd.Ng;
 
@@ -74,7 +74,7 @@ __device_noinline float3 direct_emissive_eval(KernelGlobals *kg, float rando,
 
 __device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
        float randt, float rando, float randu, float randv, Ray *ray, BsdfEval *eval,
-       bool *is_lamp)
+       bool *is_lamp, int bounce)
 {
        LightSample ls;
 
@@ -97,7 +97,7 @@ __device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int li
        differential3 dD = differential3_zero();
 
        /* evaluate closure */
-       float3 light_eval = direct_emissive_eval(kg, rando, &ls, randu, randv, -ls.D, dD, ls.t, sd->time);
+       float3 light_eval = direct_emissive_eval(kg, rando, &ls, randu, randv, -ls.D, dD, ls.t, sd->time, bounce);
 
        if(is_zero(light_eval))
                return false;
@@ -185,7 +185,7 @@ __device_noinline float3 indirect_primitive_emission(KernelGlobals *kg, ShaderDa
 
 /* Indirect Lamp Emission */
 
-__device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf, float randt, float3 *emission)
+__device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf, float randt, float3 *emission, int bounce)
 {
        LightSample ls;
        int lamp = lamp_light_eval_sample(kg, randt);
@@ -209,7 +209,7 @@ __device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int p
        /* todo: missing texture coordinates */
        float u = 0.0f;
        float v = 0.0f;
-       float3 L = direct_emissive_eval(kg, 0.0f, &ls, u, v, -ray->D, ray->dD, ls.t, ray->time);
+       float3 L = direct_emissive_eval(kg, 0.0f, &ls, u, v, -ray->D, ray->dD, ls.t, ray->time, bounce);
 
        if(!(path_flag & PATH_RAY_MIS_SKIP)) {
                /* multiple importance sampling, get regular light pdf,
@@ -224,7 +224,7 @@ __device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int p
 
 /* Indirect Background */
 
-__device_noinline float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf)
+__device_noinline float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf, int bounce)
 {
 #ifdef __BACKGROUND__
        int shader = kernel_data.background.shader;
@@ -240,7 +240,7 @@ __device_noinline float3 indirect_background(KernelGlobals *kg, Ray *ray, int pa
 
        /* evaluate background closure */
        ShaderData sd;
-       shader_setup_from_background(kg, &sd, ray);
+       shader_setup_from_background(kg, &sd, ray, bounce+1);
 
        float3 L = shader_eval_background(kg, &sd, path_flag, SHADER_CONTEXT_EMISSION);
 
index 0ef255786fa66c534e39ae0258b8dab68abc5701..40ecb1be91b99bf7feb3f9e9648da5265b6b33de 100644 (file)
@@ -215,7 +215,7 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra
                                        return true;
 
                                ShaderData sd;
-                               shader_setup_from_ray(kg, &sd, &isect, ray);
+                               shader_setup_from_ray(kg, &sd, &isect, ray, state->bounce+1);
                                shader_eval_surface(kg, &sd, 0.0f, PATH_RAY_SHADOW, SHADER_CONTEXT_SHADOW);
 
                                throughput *= shader_bsdf_transparency(kg, &sd);
@@ -300,7 +300,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
                        float light_t = path_rng_1D(kg, rng, sample, num_samples, rng_offset + PRNG_LIGHT);
                        float3 emission;
 
-                       if(indirect_lamp_emission(kg, &light_ray, state.flag, ray_pdf, light_t, &emission))
+                       if(indirect_lamp_emission(kg, &light_ray, state.flag, ray_pdf, light_t, &emission, state.bounce))
                                path_radiance_accum_emission(&L, throughput, emission, state.bounce);
                }
 #endif
@@ -318,7 +318,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
 
 #ifdef __BACKGROUND__
                        /* sample background shader */
-                       float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf);
+                       float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf, state.bounce);
                        path_radiance_accum_background(&L, throughput, L_background, state.bounce);
 #endif
 
@@ -327,7 +327,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
 
                /* setup shading */
                ShaderData sd;
-               shader_setup_from_ray(kg, &sd, &isect, &ray);
+               shader_setup_from_ray(kg, &sd, &isect, &ray, state.bounce);
                float rbsdf = path_rng_1D(kg, rng, sample, num_samples, rng_offset + PRNG_BSDF);
                shader_eval_surface(kg, &sd, rbsdf, state.flag, SHADER_CONTEXT_MAIN);
 
@@ -464,7 +464,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
                                light_ray.time = sd.time;
 #endif
 
-                               if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp)) {
+                               if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp, state.bounce)) {
                                        /* trace shadow ray */
                                        float3 shadow;
 
@@ -575,7 +575,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
                        float light_t = path_rng_1D(kg, rng, sample, num_total_samples, rng_offset + PRNG_LIGHT);
                        float3 emission;
 
-                       if(indirect_lamp_emission(kg, &light_ray, state.flag, ray_pdf, light_t, &emission))
+                       if(indirect_lamp_emission(kg, &light_ray, state.flag, ray_pdf, light_t, &emission, state.bounce))
                                path_radiance_accum_emission(L, throughput, emission, state.bounce);
                }
 #endif
@@ -583,7 +583,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
                if(!hit) {
 #ifdef __BACKGROUND__
                        /* sample background shader */
-                       float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf);
+                       float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf, state.bounce);
                        path_radiance_accum_background(L, throughput, L_background, state.bounce);
 #endif
 
@@ -592,7 +592,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
 
                /* setup shading */
                ShaderData sd;
-               shader_setup_from_ray(kg, &sd, &isect, &ray);
+               shader_setup_from_ray(kg, &sd, &isect, &ray, state.bounce);
                float rbsdf = path_rng_1D(kg, rng, sample, num_total_samples, rng_offset + PRNG_BSDF);
                shader_eval_surface(kg, &sd, rbsdf, state.flag, SHADER_CONTEXT_INDIRECT);
                shader_merge_closures(kg, &sd);
@@ -706,7 +706,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
 #endif
 
                                /* sample random light */
-                               if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp)) {
+                               if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp, state.bounce)) {
                                        /* trace shadow ray */
                                        float3 shadow;
 
@@ -838,7 +838,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R
                                float light_u, light_v;
                                path_rng_2D(kg, &lamp_rng, sample*num_samples + j, aa_samples*num_samples, rng_offset + PRNG_LIGHT_U, &light_u, &light_v);
 
-                               if(direct_emission(kg, sd, i, 0.0f, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp)) {
+                               if(direct_emission(kg, sd, i, 0.0f, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp, state.bounce)) {
                                        /* trace shadow ray */
                                        float3 shadow;
 
@@ -867,7 +867,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R
                                if(kernel_data.integrator.num_all_lights)
                                        light_t = 0.5f*light_t;
 
-                               if(direct_emission(kg, sd, -1, light_t, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp)) {
+                               if(direct_emission(kg, sd, -1, light_t, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp, state.bounce)) {
                                        /* trace shadow ray */
                                        float3 shadow;
 
@@ -1013,7 +1013,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 
 #ifdef __BACKGROUND__
                        /* sample background shader */
-                       float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf);
+                       float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf, state.bounce);
                        path_radiance_accum_background(&L, throughput, L_background, state.bounce);
 #endif
 
@@ -1022,7 +1022,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 
                /* setup shading */
                ShaderData sd;
-               shader_setup_from_ray(kg, &sd, &isect, &ray);
+               shader_setup_from_ray(kg, &sd, &isect, &ray, state.bounce);
                shader_eval_surface(kg, &sd, 0.0f, state.flag, SHADER_CONTEXT_MAIN);
                shader_merge_closures(kg, &sd);
 
index 039981a031a4c0ecf4fcbd94d9d450ee23b756c1..b902230a9b90585c20e2851deca5f6c5fb4080f3 100644 (file)
@@ -64,7 +64,7 @@ __device_noinline
 __device
 #endif
 void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
-       const Intersection *isect, const Ray *ray)
+       const Intersection *isect, const Ray *ray, int bounce)
 {
 #ifdef __INSTANCING__
        sd->object = (isect->object == ~0)? kernel_tex_fetch(__prim_object, isect->prim): isect->object;
@@ -80,6 +80,7 @@ void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
 
        sd->prim = kernel_tex_fetch(__prim_index, isect->prim);
        sd->ray_length = isect->t;
+       sd->ray_depth = bounce;
 
 #ifdef __HAIR__
        if(kernel_tex_fetch(__prim_segment, isect->prim) != ~0) {
@@ -277,7 +278,7 @@ __device
 #endif
 void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
        const float3 P, const float3 Ng, const float3 I,
-       int shader, int object, int prim, float u, float v, float t, float time, int segment)
+       int shader, int object, int prim, float u, float v, float t, float time, int bounce, int segment)
 {
        /* vectors */
        sd->P = P;
@@ -300,6 +301,7 @@ void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
        sd->v = v;
 #endif
        sd->ray_length = t;
+       sd->ray_depth = bounce;
 
        /* detect instancing, for non-instanced the object index is -object-1 */
 #ifdef __INSTANCING__
@@ -408,12 +410,12 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
 
        /* watch out: no instance transform currently */
 
-       shader_setup_from_sample(kg, sd, P, Ng, I, shader, object, prim, u, v, 0.0f, TIME_INVALID, ~0);
+       shader_setup_from_sample(kg, sd, P, Ng, I, shader, object, prim, u, v, 0.0f, TIME_INVALID, 0, ~0);
 }
 
 /* ShaderData setup from ray into background */
 
-__device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData *sd, const Ray *ray)
+__device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData *sd, const Ray *ray, int bounce)
 {
        /* vectors */
        sd->P = ray->D;
@@ -426,6 +428,7 @@ __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData
        sd->time = ray->time;
 #endif
        sd->ray_length = 0.0f;
+       sd->ray_depth = bounce;
 
 #ifdef __INSTANCING__
        sd->object = ~0;
index 38ababa96bdbb4c5e45f67ab99c1722e21dad188..733eb665860e21c812e4883b4a98f089e593e0b0 100644 (file)
@@ -540,6 +540,9 @@ typedef struct ShaderData {
        
        /* length of the ray being shaded */
        float ray_length;
+       
+       /* ray bounce depth */
+       int ray_depth;
 
 #ifdef __RAY_DIFFERENTIALS__
        /* differential of P. these are orthogonal to Ng, not N */
index e1e43b117e71e623e7e28a30f85cfb9dbd04c6a0..f3b79da88944709407c2da458d769476fffc06d9 100644 (file)
@@ -84,6 +84,7 @@ ustring OSLRenderServices::u_curve_thickness("geom:curve_thickness");
 ustring OSLRenderServices::u_curve_tangent_normal("geom:curve_tangent_normal");
 #endif
 ustring OSLRenderServices::u_path_ray_length("path:ray_length");
+ustring OSLRenderServices::u_path_ray_depth("path:ray_depth");
 ustring OSLRenderServices::u_trace("trace");
 ustring OSLRenderServices::u_hit("hit");
 ustring OSLRenderServices::u_hitdist("hitdist");
@@ -660,6 +661,11 @@ bool OSLRenderServices::get_background_attribute(KernelGlobals *kg, ShaderData *
                float f = sd->ray_length;
                return set_attribute_float(f, type, derivatives, val);
        }
+       else if (name == u_path_ray_depth) {
+               /* Ray Depth */
+               int f = sd->ray_depth;
+               return set_attribute_int(f, type, derivatives, val);
+       }
        else if (name == u_ndc) {
                /* NDC coordinates with special exception for otho */
                OSLThreadData *tdata = kg->osl_tdata;
@@ -919,7 +925,10 @@ bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, ustring source, ustri
 
                                if(!tracedata->setup) {
                                        /* lazy shader data setup */
-                                       shader_setup_from_ray(kg, sd, &tracedata->isect, &tracedata->ray);
+                                       ShaderData *original_sd = (ShaderData *)(sg->renderstate);
+                                       int bounce = original_sd->ray_depth + 1;
+
+                                       shader_setup_from_ray(kg, sd, &tracedata->isect, &tracedata->ray, bounce);
                                        tracedata->setup = true;
                                }
 
index ca18c85a1671c742876acb9b27410e328afed4e2..5ec4673ef3799850a53f972b484e111fa665b909 100644 (file)
@@ -135,6 +135,7 @@ public:
        static ustring u_curve_thickness;
        static ustring u_curve_tangent_normal;
        static ustring u_path_ray_length;
+       static ustring u_path_ray_depth;
        static ustring u_trace;
        static ustring u_hit;
        static ustring u_hitdist;
index 9e3f6c7b4a985c6dd14d41e367c1260046c658f9..ed3c6969970a5bd918e370753f6f4f44f8d3447c 100644 (file)
@@ -26,7 +26,8 @@ shader node_light_path(
        output float IsSingularRay = 0.0,
        output float IsReflectionRay = 0.0,
        output float IsTransmissionRay = 0.0,
-       output float RayLength = 0.0)
+       output float RayLength = 0.0,
+       output float RayDepth = 0.0)
 {
        IsCameraRay = raytype("camera");
        IsShadowRay = raytype("shadow");
@@ -37,5 +38,9 @@ shader node_light_path(
        IsTransmissionRay = raytype("refraction");
 
        getattribute("path:ray_length", RayLength);
+
+       int ray_depth;
+       getattribute("path:ray_depth", ray_depth);
+       RayDepth = (float)ray_depth;
 }
 
index b29dc9cbd45c436e8e3c287b40386a1e623fc875..0f16ef838942890a0ef15f8fda82ec7d0a79eb0a 100644 (file)
@@ -34,6 +34,7 @@ __device void svm_node_light_path(ShaderData *sd, float *stack, uint type, uint
                case NODE_LP_transmission: info = (path_flag & PATH_RAY_TRANSMIT)? 1.0f: 0.0f; break;
                case NODE_LP_backfacing: info = (sd->flag & SD_BACKFACING)? 1.0f: 0.0f; break;
                case NODE_LP_ray_length: info = sd->ray_length; break;
+               case NODE_LP_ray_depth: info = (float)sd->ray_depth; break;
        }
 
        stack_store_float(stack, out_offset, info);
index e5b3e2b972f4773de09cdb8ad2fd788811d943b1..85719265292da62a935407705128592ab2c5a64b 100644 (file)
@@ -153,7 +153,8 @@ typedef enum NodeLightPath {
        NODE_LP_reflection,
        NODE_LP_transmission,
        NODE_LP_backfacing,
-       NODE_LP_ray_length
+       NODE_LP_ray_length,
+       NODE_LP_ray_depth
 } NodeLightPath;
 
 typedef enum NodeLightFalloff {
index 029b948332af8e42ec762b0e00c123778e1b6507..bd254c8e0d13f3d1eecfbcd8fe6b5ae4232ac664 100644 (file)
@@ -2064,6 +2064,7 @@ LightPathNode::LightPathNode()
        add_output("Is Reflection Ray", SHADER_SOCKET_FLOAT);
        add_output("Is Transmission Ray", SHADER_SOCKET_FLOAT);
        add_output("Ray Length", SHADER_SOCKET_FLOAT);
+       add_output("Ray Depth", SHADER_SOCKET_FLOAT);
 }
 
 void LightPathNode::compile(SVMCompiler& compiler)
@@ -2118,6 +2119,12 @@ void LightPathNode::compile(SVMCompiler& compiler)
                compiler.stack_assign(out);
                compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_length, out->stack_offset);
        }
+       
+       out = output("Ray Depth");
+       if(!out->links.empty()) {
+               compiler.stack_assign(out);
+               compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_depth, out->stack_offset);
+       }
 
 }
 
index 2c561dd447264ae9a9a7a4e581493b1b9cacc1ee..12c2967afcfa4fde1121c78d31e59c8ffdc35f17 100644 (file)
@@ -1534,7 +1534,7 @@ void BKE_tracking_camera_get_reconstructed_interpolate(MovieTracking *tracking,
 
 /*********************** Distortion/Undistortion *************************/
 
-static void cameraIntrinscisOptionsFromTracking(libmv_cameraIntrinsicsOptions *camera_intrinsics_options,
+static void cameraIntrinscisOptionsFromTracking(libmv_CameraIntrinsicsOptions *camera_intrinsics_options,
                                                 MovieTracking *tracking, int calibration_width, int calibration_height)
 {
        MovieTrackingCamera *camera = &tracking->camera;
@@ -1559,7 +1559,7 @@ MovieDistortion *BKE_tracking_distortion_new(void)
 
        distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
 
-       distortion->intrinsics = libmv_CameraIntrinsicsNewEmpty();
+       distortion->intrinsics = libmv_cameraIntrinsicsNewEmpty();
 
        return distortion;
 }
@@ -1567,17 +1567,17 @@ MovieDistortion *BKE_tracking_distortion_new(void)
 void BKE_tracking_distortion_update(MovieDistortion *distortion, MovieTracking *tracking,
                                     int calibration_width, int calibration_height)
 {
-       libmv_cameraIntrinsicsOptions camera_intrinsics_options;
+       libmv_CameraIntrinsicsOptions camera_intrinsics_options;
 
        cameraIntrinscisOptionsFromTracking(&camera_intrinsics_options, tracking,
                                            calibration_width, calibration_height);
 
-       libmv_CameraIntrinsicsUpdate(&camera_intrinsics_options, distortion->intrinsics);
+       libmv_cameraIntrinsicsUpdate(&camera_intrinsics_options, distortion->intrinsics);
 }
 
 void BKE_tracking_distortion_set_threads(MovieDistortion *distortion, int threads)
 {
-       libmv_CameraIntrinsicsSetThreads(distortion->intrinsics, threads);
+       libmv_cameraIntrinsicsSetThreads(distortion->intrinsics, threads);
 }
 
 MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion)
@@ -1586,7 +1586,7 @@ MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion)
 
        new_distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
 
-       new_distortion->intrinsics = libmv_CameraIntrinsicsCopy(distortion->intrinsics);
+       new_distortion->intrinsics = libmv_cameraIntrinsicsCopy(distortion->intrinsics);
 
        return new_distortion;
 }
@@ -1602,12 +1602,12 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
 
        if (ibuf->rect_float) {
                if (undistort) {
-                       libmv_CameraIntrinsicsUndistortFloat(distortion->intrinsics,
+                       libmv_cameraIntrinsicsUndistortFloat(distortion->intrinsics,
                                                             ibuf->rect_float, resibuf->rect_float,
                                                             ibuf->x, ibuf->y, overscan, ibuf->channels);
                }
                else {
-                       libmv_CameraIntrinsicsDistortFloat(distortion->intrinsics,
+                       libmv_cameraIntrinsicsDistortFloat(distortion->intrinsics,
                                                           ibuf->rect_float, resibuf->rect_float,
                                                           ibuf->x, ibuf->y, overscan, ibuf->channels);
                }
@@ -1617,12 +1617,12 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
        }
        else {
                if (undistort) {
-                       libmv_CameraIntrinsicsUndistortByte(distortion->intrinsics,
+                       libmv_cameraIntrinsicsUndistortByte(distortion->intrinsics,
                                                            (unsigned char *)ibuf->rect, (unsigned char *)resibuf->rect,
                                                            ibuf->x, ibuf->y, overscan, ibuf->channels);
                }
                else {
-                       libmv_CameraIntrinsicsDistortByte(distortion->intrinsics,
+                       libmv_cameraIntrinsicsDistortByte(distortion->intrinsics,
                                                          (unsigned char *)ibuf->rect, (unsigned char *)resibuf->rect,
                                                          ibuf->x, ibuf->y, overscan, ibuf->channels);
                }
@@ -1633,7 +1633,7 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
 
 void BKE_tracking_distortion_free(MovieDistortion *distortion)
 {
-       libmv_CameraIntrinsicsDestroy(distortion->intrinsics);
+       libmv_cameraIntrinsicsDestroy(distortion->intrinsics);
 
        MEM_freeN(distortion);
 }
@@ -1642,7 +1642,7 @@ void BKE_tracking_distort_v2(MovieTracking *tracking, const float co[2], float r
 {
        MovieTrackingCamera *camera = &tracking->camera;
 
-       libmv_cameraIntrinsicsOptions camera_intrinsics_options;
+       libmv_CameraIntrinsicsOptions camera_intrinsics_options;
        double x, y;
        float aspy = 1.0f / tracking->camera.pixel_aspect;
 
@@ -1652,7 +1652,7 @@ void BKE_tracking_distort_v2(MovieTracking *tracking, const float co[2], float r
        x = (co[0] - camera->principal[0]) / camera->focal;
        y = (co[1] - camera->principal[1] * aspy) / camera->focal;
 
-       libmv_ApplyCameraIntrinsics(&camera_intrinsics_options, x, y, &x, &y);
+       libmv_cameraIntrinsicsApply(&camera_intrinsics_options, x, y, &x, &y);
 
        /* result is in image coords already */
        r_co[0] = x;
@@ -1663,13 +1663,13 @@ void BKE_tracking_undistort_v2(MovieTracking *tracking, const float co[2], float
 {
        MovieTrackingCamera *camera = &tracking->camera;
 
-       libmv_cameraIntrinsicsOptions camera_intrinsics_options;
+       libmv_CameraIntrinsicsOptions camera_intrinsics_options;
        double x = co[0], y = co[1];
        float aspy = 1.0f / tracking->camera.pixel_aspect;
 
        cameraIntrinscisOptionsFromTracking(&camera_intrinsics_options, tracking, 0, 0);
 
-       libmv_InvertCameraIntrinsics(&camera_intrinsics_options, x, y, &x, &y);
+       libmv_cameraIntrinsicsInvert(&camera_intrinsics_options, x, y, &x, &y);
 
        r_co[0] = (float)x * camera->focal + camera->principal[0];
        r_co[1] = (float)y * camera->focal + camera->principal[1] * aspy;
@@ -2529,7 +2529,7 @@ static bool track_context_update_reference(MovieTrackingContext *context, TrackC
 
 /* Fill in libmv tracker options structure with settings need to be used to perform track. */
 static void tracking_configure_tracker(MovieTrackingTrack *track, float *mask,
-                                       struct libmv_trackRegionOptions *options)
+                                       libmv_TrackRegionOptions *options)
 {
        options->motion_model = track->motion_model;
 
@@ -2654,8 +2654,8 @@ static bool configure_and_run_tracker(ImBuf *destination_ibuf, MovieTrackingTrac
        double src_pixel_x[5], src_pixel_y[5];
 
        /* Settings for the tracker */
-       struct libmv_trackRegionOptions options = {0};
-       struct libmv_trackRegionResult result;
+       libmv_TrackRegionOptions options = {0};
+       libmv_TrackRegionResult result;
 
        float *patch_new;
 
@@ -2930,17 +2930,17 @@ static struct libmv_Tracks *libmv_tracks_new(ListBase *tracksbase, int width, in
 }
 
 /* Retrieve refined camera intrinsics from libmv to blender. */
-static void reconstruct_retrieve_libmv_intrinscis(MovieReconstructContext *context, MovieTracking *tracking)
+static void reconstruct_retrieve_libmv_intrinsics(MovieReconstructContext *context, MovieTracking *tracking)
 {
        struct libmv_Reconstruction *libmv_reconstruction = context->reconstruction;
-       struct libmv_CameraIntrinsics *libmv_intrinsics = libmv_ReconstructionExtractIntrinsics(libmv_reconstruction);
+       struct libmv_CameraIntrinsics *libmv_intrinsics = libmv_reconstructionExtractIntrinsics(libmv_reconstruction);
 
        float aspy = 1.0f / tracking->camera.pixel_aspect;
 
        double focal_length, principal_x, principal_y, k1, k2, k3;
        int width, height;
 
-       libmv_CameraIntrinsicsExtract(libmv_intrinsics, &focal_length, &principal_x, &principal_y,
+       libmv_cameraIntrinsicsExtract(libmv_intrinsics, &focal_length, &principal_x, &principal_y,
                                      &k1, &k2, &k3, &width, &height);
 
        tracking->camera.focal = focal_length;
@@ -2987,13 +2987,13 @@ static int reconstruct_retrieve_libmv_tracks(MovieReconstructContext *context, M
        while (track) {
                double pos[3];
 
-               if (libmv_reporojectionPointForTrack(libmv_reconstruction, tracknr, pos)) {
+               if (libmv_reprojectionPointForTrack(libmv_reconstruction, tracknr, pos)) {
                        track->bundle_pos[0] = pos[0];
                        track->bundle_pos[1] = pos[1];
                        track->bundle_pos[2] = pos[2];
 
                        track->flag |= TRACK_HAS_BUNDLE;
-                       track->error = libmv_reporojectionErrorForTrack(libmv_reconstruction, tracknr);
+                       track->error = libmv_reprojectionErrorForTrack(libmv_reconstruction, tracknr);
                }
                else {
                        track->flag &= ~TRACK_HAS_BUNDLE;
@@ -3017,10 +3017,10 @@ static int reconstruct_retrieve_libmv_tracks(MovieReconstructContext *context, M
        for (a = sfra; a <= efra; a++) {
                double matd[4][4];
 
-               if (libmv_reporojectionCameraForImage(libmv_reconstruction, a, matd)) {
+               if (libmv_reprojectionCameraForImage(libmv_reconstruction, a, matd)) {
                        int i, j;
                        float mat[4][4];
-                       float error = libmv_reporojectionErrorForImage(libmv_reconstruction, a);
+                       float error = libmv_reprojectionErrorForImage(libmv_reconstruction, a);
 
                        for (i = 0; i < 4; i++) {
                                for (j = 0; j < 4; j++)
@@ -3081,8 +3081,8 @@ static int reconstruct_retrieve_libmv_tracks(MovieReconstructContext *context, M
 /* Retrieve all the libmv data from context to blender's side data blocks. */
 static int reconstruct_retrieve_libmv(MovieReconstructContext *context, MovieTracking *tracking)
 {
-       /* take the intrinscis back from libmv */
-       reconstruct_retrieve_libmv_intrinscis(context, tracking);
+       /* take the intrinsics back from libmv */
+       reconstruct_retrieve_libmv_intrinsics(context, tracking);
 
        return reconstruct_retrieve_libmv_tracks(context, tracking);
 }
@@ -3243,7 +3243,7 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
 void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context)
 {
        if (context->reconstruction)
-               libmv_destroyReconstruction(context->reconstruction);
+               libmv_reconstructionDestroy(context->reconstruction);
 
        libmv_tracksDestroy(context->tracks);
 
@@ -3266,7 +3266,7 @@ static void reconstruct_update_solve_cb(void *customdata, double progress, const
 }
 
 /* FIll in camera intrinsics structure from reconstruction context. */
-static void camraIntrincicsOptionsFromContext(libmv_cameraIntrinsicsOptions *camera_intrinsics_options,
+static void camraIntrincicsOptionsFromContext(libmv_CameraIntrinsicsOptions *camera_intrinsics_options,
                                               MovieReconstructContext *context)
 {
        camera_intrinsics_options->focal_length = context->focal_length;
@@ -3283,7 +3283,7 @@ static void camraIntrincicsOptionsFromContext(libmv_cameraIntrinsicsOptions *cam
 }
 
 /* Fill in reconstruction options structure from reconstruction context. */
-static void reconstructionOptionsFromContext(libmv_reconstructionOptions *reconstruction_options,
+static void reconstructionOptionsFromContext(libmv_ReconstructionOptions *reconstruction_options,
                                              MovieReconstructContext *context)
 {
        reconstruction_options->select_keyframes = context->select_keyframes;
@@ -3313,8 +3313,8 @@ void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *
 
        ReconstructProgressData progressdata;
 
-       libmv_cameraIntrinsicsOptions camera_intrinsics_options;
-       libmv_reconstructionOptions reconstruction_options;
+       libmv_CameraIntrinsicsOptions camera_intrinsics_options;
+       libmv_ReconstructionOptions reconstruction_options;
 
        progressdata.stop = stop;
        progressdata.do_update = do_update;
@@ -3558,7 +3558,7 @@ void BKE_tracking_detect_fast(MovieTracking *tracking, ListBase *tracksbase, ImB
                                       framenr, ibuf->x, ibuf->y, layer,
                                       place_outside_layer ? true : false);
 
-       libmv_destroyFeatures(features);
+       libmv_featuresDestroy(features);
 }
 
 /*********************** 2D stabilization *************************/
index ec6e9bbbfb3f53550d6aa864a72b89b6b81abdc4..5910909142c48673e01b27831ab514f3150dc355 100644 (file)
@@ -148,7 +148,7 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int
                if (BLI_rcti_isect_pt(&sa->totrct, mx, my)) {
                        if (sa->spacetype == SPACE_IMAGE) {
                                ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-                               if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
+                               if (ar && BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
                                        SpaceImage *sima = sa->spacedata.first;
                                        int mval[2] = {mx - ar->winrct.xmin,
                                                       my - ar->winrct.ymin};
@@ -160,7 +160,7 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int
                        }
                        else if (sa->spacetype == SPACE_NODE) {
                                ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-                               if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
+                               if (ar && BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
                                        SpaceNode *snode = sa->spacedata.first;
                                        int mval[2] = {mx - ar->winrct.xmin,
                                                       my - ar->winrct.ymin};
@@ -172,7 +172,7 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int
                        }
                        else if (sa->spacetype == SPACE_CLIP) {
                                ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-                               if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
+                               if (ar && BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
                                        SpaceClip *sc = sa->spacedata.first;
                                        int mval[2] = {mx - ar->winrct.xmin,
                                                       my - ar->winrct.ymin};
index 3405d81e04abc567b449a216b77016a35201ac3f..95f47be0b70c3dff091381f9abee7da738340750 100644 (file)
@@ -590,7 +590,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                        /* never fails */
                        id_path = RNA_path_full_ID_py(id);
 
-                       if (ptr->id.data && ptr->data && prop) {
+                       if (ptr->data && prop) {
                                data_path = RNA_path_from_ID_to_property(ptr, prop);
                        }
 
@@ -2268,10 +2268,8 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_
        
        block = uiBeginBlock(C, handle->region, __func__, UI_EMBOSS);
        
-       if (but->rnaprop) {
-               if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
-                       block->color_profile = FALSE;
-               }
+       if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
+               block->color_profile = false;
        }
 
        if (but->block) {
index 772bd6fe671a2a5c4edf9f566334c8675a2755d6..929b7ae2a5d6ff86ffff9beffafb0b4671194ce1 100644 (file)
@@ -1288,7 +1288,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar,
                fac = smooth_view_rect_to_fac(&v2d->cur, cur);
        }
 
-       if (C && U.smooth_viewtx && fac > FLT_EPSILON) {
+       if (U.smooth_viewtx && fac > FLT_EPSILON) {
                int changed = FALSE;
 
                if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == FALSE)
index 6b55518552ae7837ad068fb14691e220fb55571b..b4532e0571c19deda268c64bc899dc9000331d97 100644 (file)
@@ -469,9 +469,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
                WM_event_remove_timer(oglrender->wm, oglrender->win, oglrender->timer);
        }
 
-       if (oglrender->win) {
-               WM_cursor_restore(oglrender->win);
-       }
+       WM_cursor_restore(oglrender->win);
 
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene);
 
@@ -560,9 +558,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
                }
        }
 
-       if (oglrender->win) {
-               WM_cursor_time(oglrender->win, scene->r.cfra);
-       }
+       WM_cursor_time(oglrender->win, scene->r.cfra);
 
        BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
 
index aec7213ee05e0f9758d789feda8b46c70438d010..b308bd09026f68fd63a09c0d08520adcc44cfae0 100644 (file)
@@ -263,7 +263,7 @@ static void restrictbutton_bone_visibility_cb(bContext *C, void *poin, void *poi
 {
        bArmature *arm = (bArmature *)poin;
        Bone *bone = (Bone *)poin2;
-       if (bone && (bone->flag & BONE_HIDDEN_P))
+       if (bone->flag & BONE_HIDDEN_P)
                bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 
        if (CTX_wm_window(C)->eventstate->ctrl) {
@@ -277,7 +277,7 @@ static void restrictbutton_bone_select_cb(bContext *C, void *poin, void *poin2)
 {
        bArmature *arm = (bArmature *)poin;
        Bone *bone = (Bone *)poin2;
-       if (bone && (bone->flag & BONE_UNSELECTABLE))
+       if (bone->flag & BONE_UNSELECTABLE)
                bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 
        if (CTX_wm_window(C)->eventstate->ctrl) {
index 36b27094cc4c43db659539cd08ab3f20574926d7..a813346062841306425a876274064eb88c54a2f1 100644 (file)
@@ -267,6 +267,7 @@ static void node_reroute_inherit_type_recursive(bNodeTree *ntree, bNode *node)
        bNodeSocket *output = node->outputs.first;
        bNodeLink *link;
        int type = SOCK_FLOAT;
+       const char *type_idname = nodeStaticSocketType(type, PROP_NONE);
        
        /* XXX it would be a little bit more efficient to restrict actual updates
         * to rerout nodes connected to an updated node, but there's no reliable flag
@@ -292,21 +293,37 @@ static void node_reroute_inherit_type_recursive(bNodeTree *ntree, bNode *node)
        }
        
        /* determine socket type from unambiguous input/output connection if possible */
-       if (input->limit == 1 && input->link)
+       if (input->limit == 1 && input->link) {
                type = input->link->fromsock->type;
-       else if (output->limit == 1 && output->link)
+               type_idname = nodeStaticSocketType(type, PROP_NONE);
+       }
+       else if (output->limit == 1 && output->link) {
                type = output->link->tosock->type;
+               type_idname = nodeStaticSocketType(type, PROP_NONE);
+       }
        
-       /* arbitrary, could also test output->type, both are the same */
        if (input->type != type) {
-               PointerRNA input_ptr, output_ptr;
-               /* same type for input/output */
-               RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, input, &input_ptr);
-               RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, output, &output_ptr);
-               
-               RNA_enum_set(&input_ptr, "type", type);
-               RNA_enum_set(&output_ptr, "type", type);
+               bNodeSocket *ninput = nodeAddSocket(ntree, node, SOCK_IN, type_idname, "input", "Input");
+               for (link = ntree->links.first; link; link = link->next) {
+                       if (link->tosock == input) {
+                               link->tosock = ninput;
+                               ninput->link = link;
+                       }
+               }
+               nodeRemoveSocket(ntree, node, input);
        }
+       
+       if (output->type != type) {
+               bNodeSocket *noutput = nodeAddSocket(ntree, node, SOCK_OUT, type_idname, "output", "Output");
+               for (link = ntree->links.first; link; link = link->next) {
+                       if (link->fromsock == output) {
+                               link->fromsock = noutput;
+                       }
+               }
+               nodeRemoveSocket(ntree, node, output);
+       }
+       
+       nodeUpdateInternalLinks(ntree, node);
 }
 
 /* Global update function for Reroute node types.
index d18dddd4ff4220420172c59435bde3702d2dbf85..2b6318679e00832e7a53485eb59ac5eddb7073c3 100644 (file)
@@ -98,6 +98,10 @@ static void node_init_output_index(bNodeSocket *sock, int *index, ListBase *inte
                for (link = internal_links->first; link; link = link->next) {
                        if (link->tosock == sock) {
                                sock->stack_index = link->fromsock->stack_index;
+                               /* set the link pointer to indicate that this socket
+                                * should not overwrite the stack value!
+                                */
+                               sock->link = link;
                                break;
                        }
                }
index 63713eb1e020bd69c073b372b73e084f9a79c8a0..9d769b284b1e26d06ae534d49e944288571b400e 100644 (file)
@@ -38,6 +38,7 @@ static bNodeSocketTemplate sh_node_light_path_out[] = {
        {       SOCK_FLOAT, 0, N_("Is Reflection Ray"),         0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
        {       SOCK_FLOAT, 0, N_("Is Transmission Ray"),       0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
        {       SOCK_FLOAT, 0, N_("Ray Length"),                        0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+       {       SOCK_FLOAT, 0, N_("Ray Depth"),                         0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
        {       -1, 0, ""       }
 };
 
index a15f8607fee01a41efb1f5b9fdae27b70facb464..a5b3572aa5b36fb58e5035409be20a714fd72fa6 100644 (file)
@@ -803,7 +803,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[4][4], int
        totvert= obr->totvert;
        /* we now test all vertices, when faces have a normal too much different: they get a new vertex */
        for (a=0, asv=asverts; a<totvert; a++, asv++) {
-               if (asv && asv->totface>1) {
+               if (asv->totface > 1) {
                        ver= RE_findOrAddVert(obr, a);
 
                        asf= asv->faces.first;
index 2377a2cbc84bed5e5f6062310adec42f93c9d988..8d7152fb98b756603da8400e1773643c8630b522 100644 (file)
@@ -982,7 +982,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event,
                        WM_operator_last_properties_init(op);
                }
 
-               if ((G.debug & G_DEBUG_HANDLERS) && event && event->type != MOUSEMOVE) {
+               if ((G.debug & G_DEBUG_HANDLERS) && ((event == NULL) || (event->type != MOUSEMOVE))) {
                        printf("%s: handle evt %d win %d op %s\n",
                               __func__, event ? event->type : 0, CTX_wm_screen(C)->subwinactive, ot->idname);
                }