Camera tracking: support of tripod motion solving
authorSergey Sharybin <sergey.vfx@gmail.com>
Sat, 28 Apr 2012 14:54:45 +0000 (14:54 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sat, 28 Apr 2012 14:54:45 +0000 (14:54 +0000)
Expose option into interface to use modal solver which currently
supports only tripod motion.

This solver requires two tracks at least to reconstruct motion.
Using more tracks aren't improving solution in general, just adds
instability into solution and slows down things a lot.

Refirement of camera intrinsics was disabled due to it's not only
refines camera intrinsics but also adjusts camera position which
isn't necessary here

To use this solver just activate "Tripod Motion" checkbox in
solver panel.

Merged from tomato: svn merge ^/branches/soc-2011-tomato -r45622:45624 -r46036:46037

P.S. Quite experimental yet, requires more checking and probably
tweaks to prevent camera jumps when tracks apperars/disappears
from the screen.

745 files changed:
CMakeLists.txt
SConstruct
build_files/buildbot/master.cfg
build_files/buildbot/master_unpack.py
build_files/buildbot/slave_compile.py
build_files/buildbot/slave_pack.py
build_files/cmake/macros.cmake
build_files/cmake/project_info.py
build_files/scons/config/win32-mingw-config.py
build_files/scons/config/win64-mingw-config.py [new file with mode: 0644]
build_files/scons/tools/Blender.py
build_files/scons/tools/btools.py
doc/manpage/blender.1
doc/python_api/examples/bpy.types.Mesh.py [new file with mode: 0644]
doc/python_api/rst/include__bmesh.rst
doc/python_api/rst/info_gotcha.rst
doc/python_api/sphinx_doc_gen.py
extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h
extern/bullet2/src/SConscript
extern/carve/SConscript
extern/carve/bundle.sh
extern/carve/patches/mingw_w64.patch [new file with mode: 0644]
extern/libmv/SConscript
extern/libmv/bundle.sh
extern/libmv/libmv-capi.cpp
extern/libmv/libmv-capi.h
extern/libmv/libmv/numeric/numeric.h
extern/libmv/libmv/simple_pipeline/modal_solver.cc
extern/libmv/patches/mingw_w64_support.patch [new file with mode: 0644]
extern/libmv/third_party/glog/src/windows/port.cc
extern/libmv/third_party/glog/src/windows/port.h
intern/SConscript
intern/audaspace/SConscript
intern/audaspace/intern/AUD_C-API.cpp
intern/audaspace/intern/AUD_C-API.h
intern/audaspace/intern/AUD_FileWriter.cpp
intern/audaspace/intern/AUD_FileWriter.h
intern/audaspace/intern/AUD_Reference.h
intern/audaspace/intern/AUD_ReferenceHandler.cpp
intern/boolop/SConscript
intern/container/CTR_Map.h
intern/cycles/SConscript
intern/cycles/app/cycles_xml.cpp
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_session.cpp
intern/cycles/blender/blender_sync.cpp
intern/cycles/blender/blender_sync.h
intern/cycles/bvh/CMakeLists.txt
intern/cycles/bvh/bvh.cpp
intern/cycles/bvh/bvh_binning.cpp [new file with mode: 0644]
intern/cycles/bvh/bvh_binning.h [new file with mode: 0644]
intern/cycles/bvh/bvh_build.cpp
intern/cycles/bvh/bvh_build.h
intern/cycles/bvh/bvh_node.cpp
intern/cycles/bvh/bvh_node.h
intern/cycles/bvh/bvh_params.h
intern/cycles/bvh/bvh_sort.cpp
intern/cycles/bvh/bvh_sort.h
intern/cycles/bvh/bvh_split.cpp [new file with mode: 0644]
intern/cycles/bvh/bvh_split.h [new file with mode: 0644]
intern/cycles/device/device.cpp
intern/cycles/device/device.h
intern/cycles/device/device_cpu.cpp
intern/cycles/device/device_multi.cpp
intern/cycles/kernel/kernel_accumulate.h
intern/cycles/kernel/kernel_bvh.h
intern/cycles/kernel/kernel_camera.h
intern/cycles/kernel/kernel_mbvh.h
intern/cycles/kernel/kernel_object.h
intern/cycles/kernel/kernel_passes.h
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/kernel_qbvh.h
intern/cycles/kernel/kernel_types.h
intern/cycles/kernel/svm/svm_camera.h
intern/cycles/kernel/svm/svm_mapping.h
intern/cycles/kernel/svm/svm_tex_coord.h
intern/cycles/kernel/svm/svm_types.h
intern/cycles/render/buffers.cpp
intern/cycles/render/camera.cpp
intern/cycles/render/film.cpp
intern/cycles/render/integrator.cpp
intern/cycles/render/integrator.h
intern/cycles/render/light.cpp
intern/cycles/render/mesh.cpp
intern/cycles/render/nodes.cpp
intern/cycles/render/object.cpp
intern/cycles/render/session.cpp
intern/cycles/subd/subd_dice.cpp
intern/cycles/subd/subd_patch.cpp
intern/cycles/subd/subd_split.cpp
intern/cycles/util/CMakeLists.txt
intern/cycles/util/util_boundbox.h
intern/cycles/util/util_math.h
intern/cycles/util/util_task.cpp [new file with mode: 0644]
intern/cycles/util/util_task.h [new file with mode: 0644]
intern/cycles/util/util_thread.h
intern/cycles/util/util_transform.cpp
intern/cycles/util/util_transform.h
intern/cycles/util/util_types.h
intern/dualcon/intern/Projections.h
intern/dualcon/intern/dualcon_c_api.cpp
intern/elbeem/intern/ntl_geometrymodel.cpp
intern/elbeem/intern/ntl_world.cpp
intern/elbeem/intern/solver_relax.h
intern/ghost/GHOST_Rect.h
intern/ghost/SConscript
intern/ghost/intern/GHOST_NDOFManagerX11.cpp
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/guardedalloc/MEM_sys_types.h
intern/guardedalloc/intern/mallocn.c
intern/mikktspace/mikktspace.c
intern/opennl/CMakeLists.txt
intern/opennl/SConscript
intern/utfconv/SConscript
intern/utfconv/utf_winfunc.c
release/datafiles/splash.png
release/freedesktop/blender.desktop
release/plugins/sequence/blur.c
release/plugins/texture/clouds2.c
release/plugins/texture/tiles.c
release/scripts/modules/addon_utils.py
release/scripts/modules/blend_render_info.py
release/scripts/presets/camera/Nikon_D35.py [deleted file]
release/scripts/presets/fluid/honey.py [new file with mode: 0644]
release/scripts/presets/fluid/oil.py [new file with mode: 0644]
release/scripts/presets/fluid/water.py [new file with mode: 0644]
release/scripts/presets/tracking_settings/blurry_movie.py [deleted file]
release/scripts/startup/bl_operators/console.py
release/scripts/startup/bl_operators/mesh.py
release/scripts/startup/bl_operators/object.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_operators/uvcalc_follow_active.py
release/scripts/startup/bl_operators/uvcalc_lightmap.py
release/scripts/startup/bl_operators/uvcalc_smart_project.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_data_armature.py
release/scripts/startup/bl_ui/properties_data_modifier.py
release/scripts/startup/bl_ui/properties_game.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/properties_physics_cloth.py
release/scripts/startup/bl_ui/properties_physics_common.py
release/scripts/startup/bl_ui/properties_physics_fluid.py
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_sequencer.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
release/scripts/startup/keyingsets_builtins.py
release/scripts/templates/operator_file_export.py [moved from release/scripts/templates/operator_export.py with 84% similarity]
release/scripts/templates/operator_file_import.py [new file with mode: 0644]
release/scripts/templates/operator_modal_timer.py
release/windows/installer/00.sconsblender.nsi
source/SConscript
source/blender/avi/intern/avi.c
source/blender/avi/intern/codecs.c
source/blender/avi/intern/options.c
source/blender/blenfont/BLF_translation.h
source/blender/blenfont/intern/blf_font.c
source/blender/blenkernel/BKE_armature.h
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_context.h
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/BKE_lattice.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/BKE_multires.h
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/BKE_pointcache.h
source/blender/blenkernel/BKE_report.h
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/BKE_subsurf.h
source/blender/blenkernel/BKE_tessmesh.h
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/CCGSubSurf.c
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/boids.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/bvhutils.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/colortools.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/context.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/fmodifier.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/idprop.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/image_gen.c
source/blender/blenkernel/intern/implicit.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/mesh_validate.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/navmesh_conversion.c
source/blender/blenkernel/intern/nla.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/ocean.c
source/blender/blenkernel/intern/packedFile.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/property.c
source/blender/blenkernel/intern/report.c
source/blender/blenkernel/intern/sca.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/screen.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenkernel/intern/sketch.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenkernel/intern/sound.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/tracking.c
source/blender/blenkernel/intern/unit.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenkernel/intern/writeframeserver.c
source/blender/blenlib/BLI_array.h
source/blender/blenlib/BLI_editVert.h [deleted file]
source/blender/blenlib/BLI_lasso.h [new file with mode: 0644]
source/blender/blenlib/BLI_math_vector.h
source/blender/blenlib/BLI_pbvh.h
source/blender/blenlib/BLI_scanfill.h
source/blender/blenlib/BLI_threads.h
source/blender/blenlib/BLI_winstuff.h
source/blender/blenlib/CMakeLists.txt
source/blender/blenlib/SConscript
source/blender/blenlib/intern/BLI_kdopbvh.c
source/blender/blenlib/intern/BLI_kdtree.c
source/blender/blenlib/intern/DLRB_tree.c
source/blender/blenlib/intern/bpath.c
source/blender/blenlib/intern/dynlib.c
source/blender/blenlib/intern/fileops.c
source/blender/blenlib/intern/fnmatch.c
source/blender/blenlib/intern/freetypefont.c
source/blender/blenlib/intern/graph.c
source/blender/blenlib/intern/lasso.c [new file with mode: 0644]
source/blender/blenlib/intern/listbase.c
source/blender/blenlib/intern/math_base_inline.c
source/blender/blenlib/intern/math_color_inline.c
source/blender/blenlib/intern/math_geom.c
source/blender/blenlib/intern/math_rotation.c
source/blender/blenlib/intern/math_vector.c
source/blender/blenlib/intern/math_vector_inline.c
source/blender/blenlib/intern/path_util.c
source/blender/blenlib/intern/pbvh.c
source/blender/blenlib/intern/rand.c
source/blender/blenlib/intern/scanfill.c
source/blender/blenlib/intern/storage.c
source/blender/blenlib/intern/string.c
source/blender/blenlib/intern/string_utf8.c
source/blender/blenlib/intern/threads.c
source/blender/blenloader/BLO_sys_types.h
source/blender/blenloader/BLO_undofile.h
source/blender/blenloader/BLO_writefile.h
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/runtime.c
source/blender/blenloader/intern/undofile.c
source/blender/blenloader/intern/writefile.c
source/blender/blenpluginapi/SConscript
source/blender/bmesh/CMakeLists.txt
source/blender/bmesh/SConscript
source/blender/bmesh/bmesh.h
source/blender/bmesh/intern/bmesh_construct.c
source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/intern/bmesh_interp.c
source/blender/bmesh/intern/bmesh_iterators.c
source/blender/bmesh/intern/bmesh_iterators.h
source/blender/bmesh/intern/bmesh_iterators_inline.h
source/blender/bmesh/intern/bmesh_marking.c
source/blender/bmesh/intern/bmesh_marking.h
source/blender/bmesh/intern/bmesh_mesh.c
source/blender/bmesh/intern/bmesh_mesh.h
source/blender/bmesh/intern/bmesh_mesh_conv.c
source/blender/bmesh/intern/bmesh_mesh_validate.c
source/blender/bmesh/intern/bmesh_mods.c
source/blender/bmesh/intern/bmesh_mods.h
source/blender/bmesh/intern/bmesh_opdefines.c
source/blender/bmesh/intern/bmesh_operator_api.h
source/blender/bmesh/intern/bmesh_operators.c
source/blender/bmesh/intern/bmesh_operators.h
source/blender/bmesh/intern/bmesh_operators_private.h
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/bmesh/intern/bmesh_polygon.h
source/blender/bmesh/intern/bmesh_private.h
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/intern/bmesh_queries.h
source/blender/bmesh/intern/bmesh_walkers.c
source/blender/bmesh/intern/bmesh_walkers_impl.c
source/blender/bmesh/operators/bmo_bevel.c
source/blender/bmesh/operators/bmo_connect.c
source/blender/bmesh/operators/bmo_create.c
source/blender/bmesh/operators/bmo_dissolve.c
source/blender/bmesh/operators/bmo_dupe.c
source/blender/bmesh/operators/bmo_edgesplit.c
source/blender/bmesh/operators/bmo_extrude.c
source/blender/bmesh/operators/bmo_inset.c
source/blender/bmesh/operators/bmo_join_triangles.c
source/blender/bmesh/operators/bmo_mirror.c
source/blender/bmesh/operators/bmo_primitive.c
source/blender/bmesh/operators/bmo_removedoubles.c
source/blender/bmesh/operators/bmo_slide.c
source/blender/bmesh/operators/bmo_subdivide.c
source/blender/bmesh/operators/bmo_subdivide.h
source/blender/bmesh/operators/bmo_triangulate.c
source/blender/bmesh/operators/bmo_utils.c
source/blender/bmesh/tools/BME_bevel.c
source/blender/collada/AnimationExporter.cpp
source/blender/collada/AnimationImporter.cpp
source/blender/collada/ArmatureExporter.cpp
source/blender/collada/ArmatureImporter.cpp
source/blender/collada/CameraExporter.cpp
source/blender/collada/DocumentExporter.cpp
source/blender/collada/DocumentImporter.cpp
source/blender/collada/EffectExporter.cpp
source/blender/collada/ErrorHandler.cpp
source/blender/collada/GeometryExporter.cpp
source/blender/collada/GeometryExporter.h
source/blender/collada/ImageExporter.cpp
source/blender/collada/LightExporter.cpp
source/blender/collada/MaterialExporter.cpp
source/blender/collada/MaterialExporter.h
source/blender/collada/MeshImporter.cpp
source/blender/collada/SceneExporter.cpp
source/blender/collada/TransformReader.cpp
source/blender/collada/TransformWriter.cpp
source/blender/collada/collada_internal.cpp
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/armature/SConscript
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/editarmature_generate.c
source/blender/editors/armature/editarmature_retarget.c
source/blender/editors/armature/editarmature_sketch.c
source/blender/editors/armature/meshlaplacian.c
source/blender/editors/armature/poselib.c
source/blender/editors/armature/reeb.c
source/blender/editors/curve/editcurve.c
source/blender/editors/curve/editfont.c
source/blender/editors/datafiles/splash.png.c
source/blender/editors/datafiles/startup.blend.c
source/blender/editors/include/BIF_glutil.h
source/blender/editors/include/ED_anim_api.h
source/blender/editors/include/ED_clip.h
source/blender/editors/include/ED_curve.h
source/blender/editors/include/ED_keyframing.h
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/ED_numinput.h
source/blender/editors/include/ED_render.h
source/blender/editors/include/ED_uvedit.h
source/blender/editors/include/ED_view3d.h
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_utils.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/resources.c
source/blender/editors/interface/view2d.c
source/blender/editors/mesh/CMakeLists.txt
source/blender/editors/mesh/SConscript
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/editmesh_bvh.c
source/blender/editors/mesh/editmesh_bvh.h
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/mesh/editmesh_loopcut.c
source/blender/editors/mesh/editmesh_rip.c [new file with mode: 0644]
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/editmesh_slide.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_navmesh.c
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/SConscript
source/blender/editors/object/object_add.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_group.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_relations.c
source/blender/editors/object/object_select.c
source/blender/editors/object/object_shapekey.c
source/blender/editors/object/object_transform.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/SConscript
source/blender/editors/physics/dynamicpaint_ops.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/render/SConscript
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_opengl.c
source/blender/editors/render/render_preview.c
source/blender/editors/render/render_shading.c
source/blender/editors/render/render_update.c
source/blender/editors/screen/SConscript
source/blender/editors/screen/area.c
source/blender/editors/screen/glutil.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/screen/screendump.c
source/blender/editors/sculpt_paint/SConscript
source/blender/editors/sculpt_paint/paint_cursor.c
source/blender/editors/sculpt_paint/paint_hide.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_undo.c
source/blender/editors/sculpt_paint/sculpt_uv.c
source/blender/editors/sound/sound_ops.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_buttons/buttons_header.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_clip/CMakeLists.txt
source/blender/editors/space_clip/SConscript
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/clip_graph_ops.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/SConscript
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/fsmenu.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/graph_buttons.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/SConscript
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_logic/logic_buttons.c
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_logic/space_logic.c
source/blender/editors/space_nla/nla_buttons.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_node/SConscript
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_buttons.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_node/node_select.c
source/blender/editors/space_node/node_templates.c
source/blender/editors/space_node/space_node.c
source/blender/editors/space_outliner/CMakeLists.txt
source/blender/editors/space_outliner/SConscript
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_outliner/outliner_ops.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_outliner/outliner_tree.c
source/blender/editors/space_outliner/space_outliner.c
source/blender/editors/space_sequencer/SConscript
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_scopes.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_text/text_header.c
source/blender/editors/space_text/text_python.c
source/blender/editors/space_time/space_time.c
source/blender/editors/space_userpref/space_userpref.c
source/blender/editors/space_view3d/SConscript
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_fly.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_snap.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_constraints.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_input.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_ops.c
source/blender/editors/transform/transform_orientations.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/util/CMakeLists.txt
source/blender/editors/util/SConscript
source/blender/editors/util/crazyspace.c
source/blender/editors/util/ed_util.c
source/blender/editors/util/numinput.c
source/blender/editors/util/undo.c
source/blender/editors/uvedit/uvedit_buttons.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/editors/uvedit/uvedit_intern.h
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_parametrizer.c
source/blender/editors/uvedit/uvedit_parametrizer.h
source/blender/editors/uvedit/uvedit_smart_stitch.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/gpu/SConscript
source/blender/gpu/intern/gpu_buffers.c
source/blender/gpu/intern/gpu_codegen.c
source/blender/gpu/intern/gpu_draw.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/gpu/intern/gpu_material.c
source/blender/gpu/intern/gpu_shader_material.glsl
source/blender/gpu/intern/gpu_shader_material.glsl.c
source/blender/ikplugin/intern/iksolver_plugin.c
source/blender/ikplugin/intern/itasc_plugin.cpp
source/blender/imbuf/SConscript
source/blender/imbuf/intern/anim_movie.c
source/blender/imbuf/intern/bmp.c
source/blender/imbuf/intern/dds/ColorBlock.cpp
source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
source/blender/imbuf/intern/dds/PixelFormat.h
source/blender/imbuf/intern/indexer.c
source/blender/imbuf/intern/jp2.c
source/blender/imbuf/intern/jpeg.c
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/png.c
source/blender/imbuf/intern/radiance_hdr.c
source/blender/imbuf/intern/targa.c
source/blender/imbuf/intern/thumbs.c
source/blender/imbuf/intern/tiff.c
source/blender/imbuf/intern/util.c
source/blender/makesdna/DNA_key_types.h
source/blender/makesdna/DNA_meshdata_types.h
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesdna/DNA_node_types.h
source/blender/makesdna/DNA_object_fluidsim.h
source/blender/makesdna/DNA_object_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_sequence_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_windowmanager_types.h
source/blender/makesdna/intern/SConscript
source/blender/makesdna/intern/dna_genfile.c
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/SConscript
source/blender/makesrna/intern/SConscript
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_actuator.c
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_boid.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_fcurve.c
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_image_api.c
source/blender/makesrna/intern/rna_key.c
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_meta.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_nodetree_types.h
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sequencer.c
source/blender/makesrna/intern/rna_sequencer_api.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_texture.c
source/blender/makesrna/intern/rna_tracking.c
source/blender/makesrna/intern/rna_ui.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/makesrna/intern/rna_wm_api.c
source/blender/modifiers/intern/MOD_array.c
source/blender/modifiers/intern/MOD_bevel.c
source/blender/modifiers/intern/MOD_boolean.c
source/blender/modifiers/intern/MOD_cast.c
source/blender/modifiers/intern/MOD_collision.c
source/blender/modifiers/intern/MOD_displace.c
source/blender/modifiers/intern/MOD_edgesplit.c
source/blender/modifiers/intern/MOD_explode.c
source/blender/modifiers/intern/MOD_fluidsim_util.c
source/blender/modifiers/intern/MOD_hook.c
source/blender/modifiers/intern/MOD_mask.c
source/blender/modifiers/intern/MOD_remesh.c
source/blender/modifiers/intern/MOD_screw.c
source/blender/modifiers/intern/MOD_shrinkwrap.c
source/blender/modifiers/intern/MOD_simpledeform.c
source/blender/modifiers/intern/MOD_util.c
source/blender/modifiers/intern/MOD_warp.c
source/blender/modifiers/intern/MOD_wave.c
source/blender/modifiers/intern/MOD_weightvg_util.c
source/blender/nodes/SConscript
source/blender/nodes/composite/node_composite_tree.c
source/blender/nodes/composite/node_composite_util.c
source/blender/nodes/composite/nodes/node_composite_channelMatte.c
source/blender/nodes/composite/nodes/node_composite_colorSpill.c
source/blender/nodes/composite/nodes/node_composite_filter.c
source/blender/nodes/composite/nodes/node_composite_image.c
source/blender/nodes/composite/nodes/node_composite_levels.c
source/blender/nodes/composite/nodes/node_composite_math.c
source/blender/nodes/composite/nodes/node_composite_movieclip.c
source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
source/blender/nodes/composite/nodes/node_composite_rotate.c
source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
source/blender/nodes/composite/nodes/node_composite_transform.c
source/blender/nodes/intern/node_common.c
source/blender/nodes/shader/node_shader_util.c
source/blender/nodes/shader/nodes/node_shader_geom.c
source/blender/nodes/shader/nodes/node_shader_math.c
source/blender/nodes/texture/nodes/node_texture_math.c
source/blender/nodes/texture/nodes/node_texture_output.c
source/blender/python/SConscript
source/blender/python/bmesh/bmesh_py_api.c
source/blender/python/bmesh/bmesh_py_types.c
source/blender/python/bmesh/bmesh_py_types.h
source/blender/python/bmesh/bmesh_py_types_customdata.c
source/blender/python/bmesh/bmesh_py_utils.c
source/blender/python/generic/idprop_py_api.c
source/blender/python/generic/idprop_py_api.h
source/blender/python/intern/bpy.c
source/blender/python/intern/bpy_interface.c
source/blender/python/mathutils/mathutils.c
source/blender/python/mathutils/mathutils.h
source/blender/python/mathutils/mathutils_Color.c
source/blender/python/mathutils/mathutils_Euler.c
source/blender/python/mathutils/mathutils_Matrix.c
source/blender/python/mathutils/mathutils_Quaternion.c
source/blender/python/mathutils/mathutils_Vector.c
source/blender/python/mathutils/mathutils_geometry.c
source/blender/quicktime/apple/quicktime_import.c
source/blender/render/SConscript
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/extern/include/RE_render_ext.h
source/blender/render/intern/raytrace/bvh.h
source/blender/render/intern/raytrace/rayobject.cpp
source/blender/render/intern/raytrace/rayobject_blibvh.cpp
source/blender/render/intern/raytrace/rayobject_hint.h
source/blender/render/intern/raytrace/rayobject_instance.cpp
source/blender/render/intern/raytrace/rayobject_octree.cpp
source/blender/render/intern/raytrace/rayobject_qbvh.cpp
source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
source/blender/render/intern/raytrace/rayobject_svbvh.cpp
source/blender/render/intern/raytrace/rayobject_vbvh.cpp
source/blender/render/intern/raytrace/reorganize.h
source/blender/render/intern/raytrace/svbvh.h
source/blender/render/intern/raytrace/vbvh.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/pointdensity.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/render_result.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/renderdatabase.c
source/blender/render/intern/source/shadbuf.c
source/blender/render/intern/source/shadeinput.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/sss.c
source/blender/render/intern/source/strand.c
source/blender/render/intern/source/sunsky.c
source/blender/render/intern/source/volume_precache.c
source/blender/render/intern/source/volumetric.c
source/blender/render/intern/source/voxeldata.c
source/blender/render/intern/source/zbuf.c
source/blender/windowmanager/SConscript
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_keymap.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_dragdrop.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_jobs.c
source/blender/windowmanager/intern/wm_keymap.c
source/blender/windowmanager/intern/wm_operators.c
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/CMakeLists.txt
source/creator/creator.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Converter/SConscript
source/gameengine/Expressions/KX_HashedPtr.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_IPO_SGController.cpp
source/gameengine/Ketsji/KX_NavMeshObject.cpp
source/gameengine/Ketsji/KX_ObstacleSimulation.h
source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
source/gameengine/Ketsji/KX_PolygonMaterial.cpp
source/gameengine/Ketsji/KX_PolygonMaterial.h
source/gameengine/Ketsji/KX_SteeringActuator.cpp
source/gameengine/Ketsji/KX_SteeringActuator.h
source/gameengine/Ketsji/SConscript
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
source/gameengine/Rasterizer/RAS_FramingManager.h
source/gameengine/SceneGraph/SG_ParentRelation.h
source/gameengine/VideoTexture/SConscript
source/tests/bl_mesh_modifiers.py

index e3ce376ff7d3f74606d50b7505cf43a7e736f72f..6a9ca35cd0537909cbc633c01c6710b2a193261f 100644 (file)
@@ -153,7 +153,7 @@ if(UNIX AND NOT APPLE)
 else()
        set(PLATFORM_DEFAULT OFF)
 endif()
-option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" PLATFORM_DEFAULT)
+option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ${PLATFORM_DEFAULT})
 unset(PLATFORM_DEFAULT)
 
 
@@ -195,6 +195,8 @@ option(WITH_IMAGE_FRAMESERVER   "Enable image FrameServer Support for rendering"
 
 # Audio/Video format support
 option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
+unset(PLATFORM_DEFAULT)
+
 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
 if(APPLE OR (WIN32 AND NOT UNIX))
        option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" OFF)
@@ -226,6 +228,8 @@ if(UNIX AND NOT APPLE)
        option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
 endif()
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
+option(WITH_MINGW64                   "Use the 64-bit version of MinGW" OFF)
+mark_as_advanced(WITH_MINGW64)
 
 # Cycles
 option(WITH_CYCLES                                     "Enable cycles Render Engine" ON)
@@ -357,6 +361,18 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
        set(WITH_GHOST_XDND OFF)
 endif()
 
+if(MINGW)
+       if(WITH_CODEC_QUICKTIME)
+               message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
+                                   "because it is currently unsupported, remove this "
+                                   "line if youre a developer who wants to add support.")
+       endif()
+       
+       if((WITH_MINGW64) AND (WITH_OPENCOLLADA OR WITH_CODEC_FFMPEG))
+               message(FATAL_ERROR "MINGW64 still doesn't support: WITH_OPENCOLLADA/WITH_CODEC_FFMPEG")
+       endif()
+endif()
+
 TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
 
 
@@ -720,14 +736,24 @@ elseif(WIN32)
        # this file is included anyway when building under Windows with cl.exe
        #  include(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
 
-       set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
+       if(CMAKE_COMPILER_IS_GNUCC)
+               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
 
-       # Setup 64bit and 64bit windows systems
-       if(CMAKE_CL_64)
-               message("64 bit compiler detected.")
-               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
-       endif()
+               # Setup 64bit and 64bit windows systems         
+               if(WITH_MINGW64)
+                       message("Set 64 bit compiler for MinGW.")
+                       set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
+               endif()
+       else()
+               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
 
+               # Setup 64bit and 64bit windows systems
+               if(CMAKE_CL_64)
+                       message("64 bit compiler detected.")
+                       set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
+               endif()
+       endif()
+               
        add_definitions(-DWIN32)
 
        if(WITH_INTERNATIONAL)
@@ -776,33 +802,35 @@ elseif(WIN32)
        endif()
 
        if(MSVC)
-               if(CMAKE_CL_64)
-                       set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
-               else()
-                       set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
-               endif()
+               set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
 
                add_definitions(/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB)
 
-               set(CMAKE_CXX_FLAGS "/nologo /J /W1 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013" CACHE STRING "MSVC MT C++ flags " FORCE)
-               set(CMAKE_C_FLAGS   "/nologo /J /W1 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013 /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
+               set(CMAKE_CXX_FLAGS "/nologo /J /Gd /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
+               set(CMAKE_C_FLAGS   "/nologo /J /Gd"       CACHE STRING "MSVC MT C++ flags " FORCE)
 
                if(CMAKE_CL_64)
-                       set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+                       set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /Zi" CACHE STRING "MSVC MT flags " FORCE)
                else()
-                       set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
+                       set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /ZI" CACHE STRING "MSVC MT flags " FORCE)
                endif()
-               set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
-               set(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
-               set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+               set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /MT" CACHE STRING "MSVC MT flags " FORCE)
+               set(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /MT" CACHE STRING "MSVC MT flags " FORCE)
+               set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /MT /Zi" CACHE STRING "MSVC MT flags " FORCE)
                if(CMAKE_CL_64)
-                       set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+                       set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /Zi" CACHE STRING "MSVC MT flags " FORCE)
                else()
-                       set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
+                       set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /ZI" CACHE STRING "MSVC MT flags " FORCE)
                endif()
-               set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
-               set(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
-               set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+               set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MT" CACHE STRING "MSVC MT flags " FORCE)
+               set(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /MT" CACHE STRING "MSVC MT flags " FORCE)
+               set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /MT /Zi" CACHE STRING "MSVC MT flags " FORCE)
+
+               # most msvc warnings are C & C++
+               set(_WARNINGS "/W3 /wd4018 /wd4244 /wd4305 /wd4800 /wd4181 /wd4065 /wd4267 /we4013")
+               set(C_WARNINGS "${_WARNINGS}")
+               set(CXX_WARNINGS "${_WARNINGS}")
+               unset(_WARNINGS)
 
                if(WITH_INTERNATIONAL)
                        set(GETTEXT ${LIBDIR}/gettext)
@@ -975,29 +1003,44 @@ elseif(WIN32)
 
                set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
 
-       else()
-               # keep GCC specific stuff here
-               if(CMAKE_COMPILER_IS_GNUCC)
-                       set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi")
-                       set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
+               # used in many places so include globally, like OpenGL
+               blender_include_dirs("${PTHREADS_INCLUDE_DIRS}")
+
+       elseif(CMAKE_COMPILER_IS_GNUCC)
+       # keep GCC specific stuff here          
+               set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi")
+               set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
 
-                       add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
+               if(WITH_MINGW64)
+                       #Yes, the point for MinGW64 is moar optimization by default :)
+                       set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2 -ftree-vectorize")
+                       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
+                       set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread")
+                       
+                       add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
                endif()
 
+               add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
+
+
                add_definitions(-DFREE_WINDOWS)
 
                if(WITH_INTERNATIONAL)
-                       set(GETTEXT ${LIBDIR}/gcc/gettext)
+                       set(GETTEXT ${LIBDIR}/gettext)
                        set(GETTEXT_INCLUDE_DIRS ${GETTEXT}/include)
                        set(GETTEXT_LIBPATH ${GETTEXT}/lib)
                        set(GETTEXT_LIBRARIES intl)
                endif()
                
-               set(PNG "${LIBDIR}/gcc/png")
+               set(PNG "${LIBDIR}/png")
                set(PNG_INCLUDE_DIR "${PNG}/include")
                set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
 
-               set(JPEG_LIBRARIES libjpeg)
+               if(WITH_MINGW64)
+                       set(JPEG_LIBRARIES jpeg)
+               else()
+                       set(JPEG_LIBRARIES libjpeg)
+               endif()
                set(PNG_LIBRARIES png)
 
                set(ZLIB ${LIBDIR}/zlib)
@@ -1005,31 +1048,34 @@ elseif(WIN32)
                set(ZLIB_LIBPATH ${ZLIB}/lib)
                set(ZLIB_LIBRARIES z)
 
-               set(PTHREADS ${LIBDIR}/pthreads)
-               set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
-               set(PTHREADS_LIBPATH ${PTHREADS}/lib)
-               set(PTHREADS_LIBRARIES pthreadGC2)
-
-               set(FREETYPE ${LIBDIR}/gcc/freetype)
+               #comes with own pthread library
+               if(NOT WITH_MINGW64)
+                       set(PTHREADS ${LIBDIR}/pthreads)
+                       set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
+                       set(PTHREADS_LIBPATH ${PTHREADS}/lib)
+                       set(PTHREADS_LIBRARIES pthreadGC2)
+               endif()
+               
+               set(FREETYPE ${LIBDIR}/freetype)
                set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
                set(FREETYPE_LIBPATH ${FREETYPE}/lib)
                set(FREETYPE_LIBRARY freetype)
 
                if(WITH_FFTW3)
-                       set(FFTW3 ${LIBDIR}/gcc/fftw3)
+                       set(FFTW3 ${LIBDIR}/fftw3)
                        set(FFTW3_LIBRARIES fftw3)
                        set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
                        set(FFTW3_LIBPATH ${FFTW3}/lib)
                endif()
 
                if(WITH_OPENCOLLADA)
-                       set(OPENCOLLADA ${LIBDIR}/gcc/opencollada)
+                       set(OPENCOLLADA ${LIBDIR}/opencollada)
                        set(OPENCOLLADA_INCLUDE_DIRS
-                               ${LIBDIR}/gcc/opencollada/include/COLLADAStreamWriter/include
-                               ${LIBDIR}/gcc/opencollada/include/COLLADABaseUtils/include
-                               ${LIBDIR}/gcc/opencollada/include/COLLADAFramework/include
-                               ${LIBDIR}/gcc/opencollada/include/COLLADASaxFrameworkLoader/include
-                               ${LIBDIR}/gcc/opencollada/include/GeneratedSaxParser/include
+                               ${LIBDIR}/opencollada/include/COLLADAStreamWriter/include
+                               ${LIBDIR}/opencollada/include/COLLADABaseUtils/include
+                               ${LIBDIR}/opencollada/include/COLLADAFramework/include
+                               ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader/include
+                               ${LIBDIR}/opencollada/include/GeneratedSaxParser/include
                        )
                        set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
                        set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
@@ -1044,14 +1090,14 @@ elseif(WIN32)
                endif()
 
                if(WITH_IMAGE_OPENEXR)
-                       set(OPENEXR ${LIBDIR}/gcc/openexr)
+                       set(OPENEXR ${LIBDIR}/openexr)
                        set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
                        set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
                        set(OPENEXR_LIBPATH ${OPENEXR}/lib)
                endif()
 
                if(WITH_IMAGE_TIFF)
-                       set(TIFF ${LIBDIR}/gcc/tiff)
+                       set(TIFF ${LIBDIR}/tiff)
                        set(TIFF_LIBRARY tiff)
                        set(TIFF_INCLUDE_DIR ${TIFF}/include)
                        set(TIFF_LIBPATH ${TIFF}/lib)
@@ -1081,19 +1127,24 @@ elseif(WIN32)
                if(WITH_BOOST)
                        set(BOOST ${LIBDIR}/boost)
                        set(BOOST_INCLUDE_DIR ${BOOST}/include)
-                       set(BOOST_POSTFIX "mgw46-mt-s-1_47")
-                       set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_47")
+                       if(WITH_MINGW64)
+                               set(BOOST_POSTFIX "mgw47-mt-s-1_49")
+                               set(BOOST_DEBUG_POSTFIX "mgw47-mt-sd-1_49")
+                       else()
+                               set(BOOST_POSTFIX "mgw46-mt-s-1_47")
+                               set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_47")
+                       endif()         
                        set(BOOST_LIBRARIES
                                optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX}
                                boost_regex-${BOOST_POSTFIX} boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX}
                                debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
                                boost_regex-${BOOST_DEBUG_POSTFIX} boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
-                       set(BOOST_LIBPATH ${BOOST}/lib/gcc)
+                       set(BOOST_LIBPATH ${BOOST}/lib)
                        set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
                endif()
                        
                if(WITH_OPENIMAGEIO)
-                       set(OPENIMAGEIO ${LIBDIR}/gcc/openimageio)
+                       set(OPENIMAGEIO ${LIBDIR}/openimageio)
                        set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
                        set(OPENIMAGEIO_LIBRARIES OpenImageIO)
                        set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
@@ -1108,16 +1159,13 @@ elseif(WIN32)
 
        endif()
 
-       # used in many places so include globally, like OpenGL
-       blender_include_dirs("${PTHREADS_INCLUDE_DIRS}")
-
 elseif(APPLE)
 
        if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5" OR ${CMAKE_OSX_DEPLOYMENT_TARGET} STRGREATER "10.5")
                set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE) # valid also for 10.6/10.7
        endif()
 
-       if(${XCODE_VERSION} LESS 4.3)
+       if(${XCODE_VERSION} VERSION_LESS 4.3)
                SET(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE ) # use guaranteed existing sdk
        else()
                # note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
index ff668a974836cb7168cd3a277988cdc45f743601..b1603fd0397c0dcdee7764c192ff0f73368d51cd 100644 (file)
@@ -170,7 +170,7 @@ if sys.platform=='win32':
     if env['CC'] in ['cl', 'cl.exe']:
         platform = 'win64-vc' if bitness == 64 else 'win32-vc'
     elif env['CC'] in ['gcc']:
-        platform = 'win32-mingw'
+        platform = 'win64-mingw' if bitness == 64 else 'win32-mingw'
 
 env.SConscriptChdir(0)
 
@@ -251,6 +251,7 @@ if 'blenderlite' in B.targets:
     target_env_defs['WITH_BF_REDCODE'] = False
     target_env_defs['WITH_BF_DDS'] = False
     target_env_defs['WITH_BF_CINEON'] = False
+    target_env_defs['WITH_BF_FRAMESERVER'] = False
     target_env_defs['WITH_BF_HDR'] = False
     target_env_defs['WITH_BF_ZLIB'] = False
     target_env_defs['WITH_BF_SDL'] = False
@@ -261,6 +262,7 @@ if 'blenderlite' in B.targets:
     target_env_defs['BF_BUILDINFO'] = False
     target_env_defs['WITH_BF_FLUID'] = False
     target_env_defs['WITH_BF_OCEANSIM'] = False
+    target_env_defs['WITH_BF_SMOKE'] = False
     target_env_defs['WITH_BF_DECIMATE'] = False
     target_env_defs['WITH_BF_BOOLEAN'] = False
     target_env_defs['WITH_BF_REMESH'] = False
@@ -772,7 +774,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
         dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll') 
     dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
 
-    if env['WITH_BF_OIIO']:
+    if env['WITH_BF_OIIO'] and env['OURPLATFORM'] != 'win32-mingw':
         dllsources.append('${LCGDIR}/openimageio/bin/OpenImageIO.dll')
 
     dllsources.append('#source/icons/blender.exe.manifest')
@@ -780,6 +782,34 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
     windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
     allinstall += windlls
 
+if env['OURPLATFORM'] == 'win64-mingw':
+    dllsources = []
+    
+    if env['WITH_BF_PYTHON']:
+        if env['BF_DEBUG']:
+            dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
+        else:
+            dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
+
+    if env['WITH_BF_FFMPEG']:
+        dllsources += env['BF_FFMPEG_DLL'].split()
+
+    if env['WITH_BF_OPENAL']:
+        dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
+        dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
+
+    if env['WITH_BF_SNDFILE']:
+        dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
+
+    if env['WITH_BF_SDL']:
+        dllsources.append('${LCGDIR}/sdl/lib/SDL.dll')
+       
+    dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
+    dllsources.append('#source/icons/blender.exe.manifest')
+
+    windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
+    allinstall += windlls
+
 installtarget = env.Alias('install', allinstall)
 bininstalltarget = env.Alias('install-bin', blenderinstall)
 
index 23751f7dcd49a6a072c58a70fac979580cb2d791..066c133d3357d085ab95926d3e21a59f0ec5f1a6 100644 (file)
@@ -117,6 +117,8 @@ add_builder(c, 'salad_linux_x86_64_scons', '', generic_builder, 'soc-2011-salad'
 add_builder(c, 'win32_scons', 'windows', generic_builder)
 add_builder(c, 'salad_win32_scons', 'windows', generic_builder, 'soc-2011-salad')
 add_builder(c, 'win64_scons', 'win64', generic_builder)
+add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder)
+add_builder(c, 'mingw_win32_scons', 'mingw32', generic_builder)
 #add_builder(c, 'freebsd_i386_cmake', '', generic_builder)
 #add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder)
 
index 3df22ad8745c2c1836be4059bdb84b4ced298f3d..f67bd294496a0e2da08166b407f753978907614c 100644 (file)
@@ -48,7 +48,8 @@ def get_platform(filename):
     tokens = filename.split("-")
     platforms = ('osx', 'mac', 'bsd',
                  'win', 'linux', 'source',
-                 'solaris')
+                 'solaris',
+                 'mingw')
     platform_tokens = []
     found = False
 
index 209253296be04903d4106b7902ea5803ccedfcaa..eafdf0868cd4a10951864d31742705440de4638d 100644 (file)
@@ -117,6 +117,8 @@ else:
             scons_options.append('BF_BITNESS=' + bitness)
             scons_options.append('WITH_BF_CYCLES_CUDA_BINARIES=True')
             scons_options.append('BF_CYCLES_CUDA_NVCC=nvcc.exe')
+            if builder.find('mingw') != -1:
+                scons_options.append('BF_TOOLSET=mingw')
 
         retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
         sys.exit(retcode)
index cb02e619c1dc03710b895be280ff897d9cd6281e..73c633d0c29cc2fed5c3857b4114521387f464f0 100644 (file)
@@ -81,6 +81,8 @@ if builder.find('scons') != -1:
             scons_options.append('BF_BITNESS=' + bitness)
             scons_options.append('WITH_BF_CYCLES_CUDA_BINARIES=True')
             scons_options.append('BF_CYCLES_CUDA_NVCC=nvcc.exe')
+            if builder.find('mingw') != -1:
+                scons_options.append('BF_TOOLSET=mingw')
 
         retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
         sys.exit(retcode)
index 406f2537dce748b622f243394cf99f24f20f35a8..eeefcf730c85812e66cbe2d58ebbe867a732f834 100644 (file)
@@ -212,11 +212,9 @@ macro(setup_liblinks
        target_link_libraries(${target}
                        ${OPENGL_gl_LIBRARY}
                        ${OPENGL_glu_LIBRARY}
-                       ${JPEG_LIBRARIES}
                        ${PNG_LIBRARIES}
                        ${ZLIB_LIBRARIES}
-                       ${FREETYPE_LIBRARY}
-                       ${PLATFORM_LINKLIBS})
+                       ${FREETYPE_LIBRARY})
 
        # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
        if(WITH_PYTHON)  # AND NOT WITH_PYTHON_MODULE  # WIN32 needs
@@ -271,6 +269,7 @@ macro(setup_liblinks
        if(WITH_BOOST)
                target_link_libraries(${target} ${BOOST_LIBRARIES})
        endif()
+       target_link_libraries(${target} ${JPEG_LIBRARIES})
        if(WITH_IMAGE_OPENEXR)
                if(WIN32 AND NOT UNIX AND NOT CMAKE_COMPILER_IS_GNUCC)
                        file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
@@ -328,6 +327,8 @@ macro(setup_liblinks
        if(WIN32 AND NOT UNIX)
                target_link_libraries(${target} ${PTHREADS_LIBRARIES})
        endif()
+
+       target_link_libraries(${target} ${PLATFORM_LINKLIBS})
 endmacro()
 
 macro(TEST_SSE_SUPPORT
@@ -677,4 +678,4 @@ macro(set_lib_path
        endif()
 
 
-endmacro()
\ No newline at end of file
+endmacro()
index 77574f17e2e4f336fde3c262d0fcffd4a8a4ea39..3f64ac51a4d374a29a6294fd0b786e4d5469af63 100755 (executable)
@@ -231,8 +231,13 @@ def project_name_get(path, fallback="Blender", prefix="Blender_"):
         return fallback
 
     import subprocess
-    info = subprocess.Popen(["svn", "info", path],
-                            stdout=subprocess.PIPE).communicate()[0]
+    try:
+        info = subprocess.Popen(["svn", "info", path],
+                                stdout=subprocess.PIPE).communicate()[0]
+    except:
+        # possibly 'svn' isnt found/installed
+        return fallback
+
     # string version, we only want the URL
     info = info.decode(encoding="utf-8", errors="ignore")
 
index 855f643129a23ccb5163da45ae65176ff0ed125a..576415559878a83fda2837bcef0e3d0fc11680e7 100644 (file)
@@ -1,4 +1,4 @@
-LCGDIR = '#../lib/windows'
+LCGDIR = '#../lib/mingw32'
 LIBDIR = "${LCGDIR}"
 
 BF_PYTHON = LIBDIR + '/python'
@@ -48,7 +48,7 @@ BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
 
 WITH_BF_OPENEXR = True
 WITH_BF_STATICOPENEXR = False
-BF_OPENEXR = LIBDIR + '/gcc/openexr'
+BF_OPENEXR = LIBDIR + '/openexr'
 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
 BF_OPENEXR_LIB = 'Half IlmImf Imath IlmThread Iex'
 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
@@ -64,13 +64,13 @@ BF_JPEG_LIB = 'liblibjpeg'
 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
 
 WITH_BF_PNG = True
-BF_PNG = LIBDIR + '/gcc/png'
+BF_PNG = LIBDIR + '/png'
 BF_PNG_INC = '${BF_PNG}/include'
 BF_PNG_LIB = 'png'
 BF_PNG_LIBPATH = '${BF_PNG}/lib'
 
 WITH_BF_TIFF = True
-BF_TIFF = LIBDIR + '/gcc/tiff'
+BF_TIFF = LIBDIR + '/tiff'
 BF_TIFF_INC = '${BF_TIFF}/include'
 BF_TIFF_LIB = 'tiff'
 BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
@@ -83,7 +83,7 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = LIBDIR + '/gcc/gettext'
+BF_GETTEXT = LIBDIR + '/gettext'
 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
 BF_GETTEXT_LIB = 'intl'
 BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
@@ -95,7 +95,7 @@ BF_OPENJPEG_INC = '${BF_OPENJPEG}'
 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
 
 WITH_BF_FFTW3 = True
-BF_FFTW3 = LIBDIR + '/gcc/fftw3'
+BF_FFTW3 = LIBDIR + '/fftw3'
 BF_FFTW3_INC = '${BF_FFTW3}/include'
 BF_FFTW3_LIB = 'fftw3'
 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
@@ -112,7 +112,7 @@ BF_BULLET_LIB = 'extern_bullet'
 BF_WINTAB = LIBDIR + '/wintab'
 BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
 
-BF_FREETYPE = LIBDIR + '/gcc/freetype'
+BF_FREETYPE = LIBDIR + '/freetype'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
@@ -145,7 +145,7 @@ BF_COLLADA = '#source/blender/collada'
 BF_COLLADA_INC = '${BF_COLLADA}'
 BF_COLLADA_LIB = 'bf_collada'
 
-BF_OPENCOLLADA = LIBDIR + '/gcc/opencollada'
+BF_OPENCOLLADA = LIBDIR + '/opencollada'
 BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
 BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa'
 BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
@@ -154,7 +154,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
 WITH_BF_CYCLES = True 
 
 WITH_BF_OIIO = True
-BF_OIIO = LIBDIR + '/gcc/openimageio'
+BF_OIIO = LIBDIR + '/openimageio'
 BF_OIIO_INC = BF_OIIO + '/include'
 BF_OIIO_LIB = 'OpenImageIO'
 BF_OIIO_LIBPATH = BF_OIIO + '/lib'
@@ -163,7 +163,7 @@ WITH_BF_BOOST = True
 BF_BOOST = LIBDIR + '/boost'
 BF_BOOST_INC = BF_BOOST + '/include'
 BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_47 boost_filesystem-mgw46-mt-s-1_47 boost_regex-mgw46-mt-s-1_47 boost_system-mgw46-mt-s-1_47 boost_thread-mgw46-mt-s-1_47'
-BF_BOOST_LIBPATH = BF_BOOST + '/lib/gcc'
+BF_BOOST_LIBPATH = BF_BOOST + '/lib'
 
 #Ray trace optimization
 WITH_BF_RAYOPTIMIZATION = True
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
new file mode 100644 (file)
index 0000000..055b0c7
--- /dev/null
@@ -0,0 +1,207 @@
+LCGDIR = '#../lib/mingw64'
+LIBDIR = "${LCGDIR}"
+
+BF_PYTHON = LIBDIR + '/python'
+BF_PYTHON_VERSION = '3.2'
+WITH_BF_STATICPYTHON = False
+BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
+BF_PYTHON_BINARY = 'python'
+BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw'
+BF_PYTHON_DLL = 'python32'
+BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
+
+WITH_BF_OPENAL = True
+BF_OPENAL = LIBDIR + '/openal'
+BF_OPENAL_INC = '${BF_OPENAL}/include'
+BF_OPENAL_LIB = 'wrap_oal'
+BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
+
+WITH_BF_FFMPEG = False # TODO: FFmpeg gives linking errors, need to compile with MinGW-w64?
+BF_FFMPEG_LIB = 'avformat-53 avcodec-53 avdevice-53 avutil-51 swscale-2'
+BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
+BF_FFMPEG_INC =  LIBDIR + '/ffmpeg/include'
+BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
+
+WITH_BF_JACK = False
+BF_JACK = LIBDIR + '/jack'
+BF_JACK_INC = '${BF_JACK}/include'
+BF_JACK_LIB = 'libjack'
+BF_JACK_LIBPATH = '${BF_JACK}/lib'
+
+WITH_BF_SNDFILE = False
+BF_SNDFILE = LIBDIR + '/sndfile'
+BF_SNDFILE_INC = '${BF_SNDFILE}/include'
+BF_SNDFILE_LIB = 'libsndfile-1'
+BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
+
+WITH_BF_SDL = True
+BF_SDL = LIBDIR + '/sdl'
+BF_SDL_INC = '${BF_SDL}/include'
+BF_SDL_LIB = 'SDL'
+BF_SDL_LIBPATH = '${BF_SDL}/lib'
+
+BF_PTHREADS = '' # Part of MinGW-w64
+BF_PTHREADS_INC = ''
+BF_PTHREADS_LIB = ''
+BF_PTHREADS_LIBPATH = ''
+
+WITH_BF_OPENEXR = True
+WITH_BF_STATICOPENEXR = False
+BF_OPENEXR = LIBDIR + '/openexr'
+BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
+BF_OPENEXR_LIB = 'Half IlmImf Imath IlmThread Iex'
+BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
+
+WITH_BF_DDS = True
+
+WITH_BF_JPEG = True
+BF_JPEG = LIBDIR + '/jpeg'
+BF_JPEG_INC = '${BF_JPEG}/include'
+BF_JPEG_LIB = 'jpeg'
+BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
+
+WITH_BF_PNG = True
+BF_PNG = LIBDIR + '/png'
+BF_PNG_INC = '${BF_PNG}/include'
+BF_PNG_LIB = 'png'
+BF_PNG_LIBPATH = '${BF_PNG}/lib'
+
+WITH_BF_TIFF = True
+BF_TIFF = LIBDIR + '/tiff'
+BF_TIFF_INC = '${BF_TIFF}/include'
+BF_TIFF_LIB = 'tiff'
+BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
+
+WITH_BF_ZLIB = True
+BF_ZLIB = LIBDIR + '/zlib'
+BF_ZLIB_INC = '${BF_ZLIB}/include'
+BF_ZLIB_LIB = 'z'
+BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
+
+WITH_BF_INTERNATIONAL = True
+
+BF_GETTEXT = LIBDIR + '/gettext'
+BF_GETTEXT_INC = '${BF_GETTEXT}/include'
+BF_GETTEXT_LIB = 'intl'
+BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
+
+WITH_BF_OPENJPEG = True
+BF_OPENJPEG = '#extern/libopenjpeg'
+BF_OPENJPEG_LIB = ''
+BF_OPENJPEG_INC = '${BF_OPENJPEG}'
+BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
+
+WITH_BF_FFTW3 = True
+BF_FFTW3 = LIBDIR + '/fftw3'
+BF_FFTW3_INC = '${BF_FFTW3}/include'
+BF_FFTW3_LIB = 'fftw3'
+BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_OCEANSIM = True
+WITH_BF_PLAYER = True
+WITH_BF_LIBMV = True
+
+WITH_BF_BULLET = True
+BF_BULLET = '#extern/bullet2/src'
+BF_BULLET_INC = '${BF_BULLET}'
+BF_BULLET_LIB = 'extern_bullet'
+
+BF_WINTAB = LIBDIR + '/wintab'
+BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
+
+# enable freetype2 support for text objects
+BF_FREETYPE = LIBDIR + '/freetype'
+BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2/'
+BF_FREETYPE_LIB = 'freetype'
+BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
+
+WITH_BF_QUICKTIME = False
+
+WITH_BF_ICONV = True
+BF_ICONV = LIBDIR + "/iconv"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
+WITH_BF_REDCODE = False
+BF_REDCODE_INC = '#extern'
+
+# Mesa Libs should go here if your using them as well....
+WITH_BF_STATICOPENGL = False
+BF_OPENGL = 'C:\\MingW'
+BF_OPENGL_INC = '${BF_OPENGL}/include'
+BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
+BF_OPENGL_LIB = 'opengl32 glu32'
+BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a',
+             '${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
+             '${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
+
+WITH_BF_COLLADA = False # TODO: Compile Collada with MinGW-w64
+BF_COLLADA = '#source/blender/collada'
+BF_COLLADA_INC = '${BF_COLLADA}'
+BF_COLLADA_LIB = 'bf_collada'
+
+BF_OPENCOLLADA = LIBDIR + '/opencollada'
+BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
+BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa'
+BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
+
+#Cycles
+WITH_BF_CYCLES = True
+WITH_BF_CYCLES_CUDA_BINARIES = False
+BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21']
+
+WITH_BF_OIIO = True
+BF_OIIO = LIBDIR + '/openimageio'
+BF_OIIO_INC = '${BF_OIIO}/include'
+BF_OIIO_LIB = 'OpenImageIO'
+BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+
+WITH_BF_BOOST = True
+BF_BOOST = LIBDIR + '/boost'
+BF_BOOST_INC = BF_BOOST + '/include'
+BF_BOOST_LIB = 'boost_date_time-mgw47-mt-s-1_49 boost_date_time-mgw47-mt-sd-1_49 boost_filesystem-mgw47-mt-s-1_49 boost_filesystem-mgw47-mt-sd-1_49 boost_regex-mgw47-mt-s-1_49 boost_regex-mgw47-mt-sd-1_49 boost_system-mgw47-mt-s-1_49 boost_system-mgw47-mt-sd-1_49 boost_thread-mgw47-mt-s-1_49 boost_thread-mgw47-mt-sd-1_49'
+BF_BOOST_LIBPATH = BF_BOOST + '/lib'
+
+#Ray trace optimization
+WITH_BF_RAYOPTIMIZATION = True
+BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2', '-ftree-vectorize']
+
+WITH_BF_OPENMP = True
+
+##
+CC = 'gcc'
+CXX = 'g++'
+
+CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
+CXXFLAGS = [ '-fpermissive' ]
+
+CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-D_SSIZE_T_']
+REL_CFLAGS = []
+REL_CXXFLAGS = []
+REL_CCFLAGS = ['-DNDEBUG', '-O2', '-ftree-vectorize', '-mmmx', '-msse', '-msse2']
+
+C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes']
+
+CC_WARN = [ '-Wall' ]
+
+LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread']
+
+PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
+
+## DISABLED, causes linking errors!
+## for re-distrobution, so users dont need mingw installed
+# PLATFORM_LINKFLAGS += ["-static-libgcc", "-static-libstdc++"]
+
+BF_DEBUG = False
+BF_DEBUG_CCFLAGS= ['-g', '-D_DEBUG']
+
+BF_PROFILE_CCFLAGS = ['-pg', '-g']
+BF_PROFILE_LINKFLAGS = ['-pg']
+BF_PROFILE_FLAGS = BF_PROFILE_CCFLAGS
+BF_PROFILE = False
+
+BF_BUILDDIR = '..\\build\\win64-mingw'
+BF_INSTALLDIR='..\\install\\win64-mingw'
index ec7b6a0ce4c31ccb6f9c35df117b571837be1ec1..5a066470225eadc19a66f35cfb148b31bf235446 100644 (file)
@@ -182,12 +182,12 @@ def setup_staticlibs(lenv):
     if lenv['WITH_BF_SNDFILE'] and lenv['WITH_BF_STATICSNDFILE']:
         statlibs += Split(lenv['BF_SNDFILE_LIB_STATIC'])
 
-    if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+    if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
         libincs += Split(lenv['BF_PTHREADS_LIBPATH'])
 
     if lenv['WITH_BF_COLLADA']:
         libincs += Split(lenv['BF_OPENCOLLADA_LIBPATH'])
-        if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+        if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
             libincs += Split(lenv['BF_PCRE_LIBPATH'])
             libincs += Split(lenv['BF_EXPAT_LIBPATH'])
 
@@ -206,7 +206,7 @@ def setup_staticlibs(lenv):
             statlibs += Split(lenv['BF_BOOST_LIB_STATIC'])
 
     # setting this last so any overriding of manually libs could be handled
-    if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
+    if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'):
         libincs.append('/usr/lib')
 
     if lenv['WITH_BF_JEMALLOC']:
@@ -228,7 +228,7 @@ def setup_syslibs(lenv):
     if not lenv['WITH_BF_FREETYPE_STATIC']:
         syslibs += Split(lenv['BF_FREETYPE_LIB'])
     if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']:
-        if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
+        if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
             syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
         else:
             syslibs.append(lenv['BF_PYTHON_LIB'])
@@ -268,7 +268,7 @@ def setup_syslibs(lenv):
         syslibs += Split(lenv['BF_SDL_LIB'])
     if not lenv['WITH_BF_STATICOPENGL']:
         syslibs += Split(lenv['BF_OPENGL_LIB'])
-    if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc'):
+    if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc', 'win64-mingw'):
         syslibs += Split(lenv['BF_PTHREADS_LIB'])
     if lenv['WITH_BF_COLLADA']:
         syslibs.append(lenv['BF_PCRE_LIB'])
@@ -341,7 +341,7 @@ def creator(env):
         if env['BF_DEBUG']:
             defs.append('_DEBUG')
 
-    if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+    if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
         incs.append(env['BF_PTHREADS_INC'])
         incs.append('#/intern/utfconv')
 
@@ -731,7 +731,7 @@ class BlenderEnvironment(SConsEnvironment):
         if not self or not libname or not source:
             print bc.FAIL+'Cannot continue.  Missing argument for BlenderRes '+libname+bc.ENDC
             self.Exit()
-        if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross', 'win64-vc'):
+        if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross', 'win64-vc', 'win64-mingw'):
             print bc.FAIL+'BlenderRes is for windows only!'+bc.END
             self.Exit()
         
index bb1948b2c167d6a7a893cd769b8be28c98c67774..65593d559ed1ff122e4132c9bcb22bca37460dcf 100644 (file)
@@ -107,6 +107,7 @@ def validate_arguments(args, bc):
             'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG',  'BF_FFMPEG_INC', 'BF_FFMPEG_DLL',
             'WITH_BF_STATICFFMPEG', 'BF_FFMPEG_LIB_STATIC',
             'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
+            'WITH_BF_FRAMESERVER',
             'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
             'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH',
             'WITH_BF_REDCODE', 'BF_REDCODE', 'BF_REDCODE_INC', 'BF_REDCODE_LIB', 'BF_REDCODE_LIBPATH',
@@ -154,6 +155,7 @@ def validate_arguments(args, bc):
             'WITH_BF_BOOLEAN',
             'WITH_BF_REMESH',
             'WITH_BF_OCEANSIM',
+            'WITH_BF_SMOKE',
             'WITH_BF_CXX_GUARDEDALLOC',
             'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
             'BUILDBOT_BRANCH',
@@ -264,6 +266,7 @@ def read_opts(env, cfg, args):
         (BoolVariable('WITH_BF_BOOLEAN', 'Build with boolean modifier', True)),
         (BoolVariable('WITH_BF_REMESH', 'Build with remesh modifier', True)),
         (BoolVariable('WITH_BF_OCEANSIM', 'Build with ocean simulation', False)),
+        (BoolVariable('WITH_BF_SMOKE', 'Build with smoke simulation', True)),
         ('BF_PROFILE_FLAGS', 'Profiling compiler flags', ''),
         (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)),
         ('BF_OPENAL', 'Base path for OpenAL', ''),
@@ -311,6 +314,8 @@ def read_opts(env, cfg, args):
         (BoolVariable('WITH_BF_CINEON', 'Support CINEON and DPX image formats if true', True)),
 
         (BoolVariable('WITH_BF_HDR', 'Support HDR image formats if true', True)),
+        
+        (BoolVariable('WITH_BF_FRAMESERVER', 'Support export to a frameserver', True)),
 
         (BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)),
         ('BF_FFMPEG', 'FFMPEG base path', ''),
@@ -612,12 +617,18 @@ def buildslave(target=None, source=None, env=None):
     Builder for buildbot integration. Used by buildslaves of http://builder.blender.org only.
     """
 
-    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'darwin'):
+    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'darwin', 'win64-mingw'):
         extension = '.zip'
     else:
         extension = '.tar.bz2'
 
-    platform = env['OURPLATFORM'].split('-')[0]
+    if env['OURPLATFORM'] == 'win32-mingw':
+        platform = 'mingw32'
+    elif env['OURPLATFORM'] == 'win64-mingw':
+        platform = 'mingw64'
+    else:
+        platform = env['OURPLATFORM'].split('-')[0]
+
     if platform == 'linux':
         import platform
 
@@ -657,15 +668,13 @@ def NSIS_print(target, source, env):
 def NSIS_Installer(target=None, source=None, env=None):
     print "="*35
 
-    if env['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc'):
+    if env['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'win64-mingw'):
         print "NSIS installer is only available on Windows."
         Exit()
-    if env['OURPLATFORM'] == 'win32-vc':
+    if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
         bitness = '32'
-    elif env['OURPLATFORM'] == 'win64-vc':
+    elif env['OURPLATFORM'] in ('win64-vc', 'win64-mingw'):
         bitness = '64'
-    else:
-        bitness = '-mingw'
 
     start_dir = os.getcwd()
     rel_dir = os.path.join(start_dir,'release','windows','installer')
@@ -757,7 +766,7 @@ def NSIS_Installer(target=None, source=None, env=None):
     cmdline = "makensis " + "\""+tmpnsi+"\""
 
     startupinfo = subprocess.STARTUPINFO()
-    startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+    #startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
     proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
         stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True)
     data, err = proc.communicate()
index 97c11bc138cb3c64d8e046fe96b952c1432f70c5..6257a78171b4c7d425ac03fd4c6346e5ec50c7ab 100644 (file)
@@ -1,4 +1,13 @@
-.TH "BLENDER" "1" "April 05, 2012" "Blender Blender 2\&.62 (sub 3)"
+.TH "BLENDER" "1" "April 26, 2012" "Blender Blender 2\&.63 (sub 0)
+       build date: 2012-04-26
+       build time: 19:38:31
+       build revision: 45987
+       build platform: Linux
+       build type: Debug
+       build c flags:  -fopenmp  -msse2  -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing  -Wall -Wcast-align -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type -Wstrict-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings
+       build c++ flags:  -D__STDC_CONSTANT_MACROS -fopenmp  -msse2  -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing  -Wall -Wno-invalid-offsetof -Wno-sign-compare
+       build link flags: -pthread
+       build system: CMake"
 
 .SH NAME
 blender \- a 3D modelling and rendering package
@@ -15,7 +24,7 @@ Use Blender to create TV commercials, to make technical visualizations, business
 http://www.blender.org
 .SH OPTIONS
 
-Blender 2.62 (sub 3)
+Blender 2.63 (sub 0)
 Usage: blender [args ...] [file] [args ...]
 .br
 .SS "Render Options:"
@@ -220,6 +229,12 @@ Enable floating point exceptions
 Enable debug messages from FFmpeg library
 .br
 
+.TP
+.B \-\-debug\-libmv
+.br
+Enable debug messages from libmv library
+.br
+
 .IP
 
 .TP
@@ -406,6 +421,7 @@ Arguments are executed in the order they are given. eg
   \fIBLENDER_SYSTEM_DATAFILES\fR Directory for system wide data files.
   \fIBLENDER_SYSTEM_PYTHON\fR Directory for system python libraries.
   \fITMP\fR or \fITMPDIR\fR Store temporary files here.
+  \fISDL_AUDIODRIVER\fR LibSDL audio driver \- alsa, esd, dma.
   \fIPYTHONHOME\fR Path to the python directory, eg. /usr/lib/python.
 .br
 .br
diff --git a/doc/python_api/examples/bpy.types.Mesh.py b/doc/python_api/examples/bpy.types.Mesh.py
new file mode 100644 (file)
index 0000000..69edf2c
--- /dev/null
@@ -0,0 +1,41 @@
+"""
+Mesh Data
++++++++++
+
+The mesh data is accessed in object mode and intended for compact storage,
+for more flexible mesh editing from python see :mod:`bmesh`.
+
+Blender stores 4 main arrays to define mesh geometry.
+
+* :class:`Mesh.vertices` (3 points in space)
+* :class:`Mesh.edges` (reference 2 vertices)
+* :class:`Mesh.loops` (reference a single vertex and edge)
+* :class:`Mesh.polygons`: (reference a range of loops)
+
+
+Each polygon reference a slice in the loop array, this way, polygons do not store vertices or corner data such as UV's directly,
+only a reference to loops that the polygon uses.
+
+:class:`Mesh.loops`, :class:`Mesh.uv_layers` :class:`Mesh.vertex_colors` are all aligned so the same polygon loop
+indicies can be used to find the UV's and vertex colors as with as the vertices.
+
+To compare mesh API options see: :ref:`NGons and Tessellation Faces <info_gotcha_mesh_faces>`
+
+
+This example script prints the vertices and UV's for each polygon, assumes the active object is a mesh with UVs.
+"""
+
+import bpy
+
+me = bpy.context.object.data
+uv_layer = me.uv.layers.active.data
+
+for poly in me.polygons:
+    print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total))
+
+    # range is used here to show how the polygons reference loops,
+    # for convenience 'poly.loop_indices' can be used instead.
+    for loop_index in range(poly.loop_start, poly.loop_start + poly.loop_total):
+        print("    Vertex: %d" % me.loops[loop_index].vertex_index)
+        print("    UV: %r" % uv_layer[loop_index].uv)
+    
index 24f113e7b50e60faf7384be8d392713e3420b65d..212ab4e4708466c3092375b79ca6b00ba0061758 100644 (file)
@@ -32,12 +32,11 @@ For an overview of BMesh data types and how they reference each other see:
 
 .. warning::
 
-   TODO Items Are
+   TODO items are...
 
    * add access to BMesh **walkers**
-   * add a way to re-tessellate an editmode bmesh.
-   * add deform vert custom-data access.
-
+   * add api for calling BMesh operators (unrelated to bpy.ops)
+   * add custom-data manipulation functions add/remove/rename.
 
 Example Script
 --------------
@@ -110,8 +109,8 @@ Here are some examples ...
    shape_lay = bm.verts.layers.shape["Key.001"]
 
    for vert in bm.verts:
-               shape = vert[shape_lay]
-        print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z))
+       shape = vert[shape_lay]
+       print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z))
 
 
 .. code-block:: python
@@ -125,7 +124,7 @@ Here are some examples ...
 
    for vert in bm.verts:
        dvert = vert[dvert_lay]
-               
+
        if group_index in dvert:
            print("Weight %f" % dvert[group_index])
        else:
index 25ef5175976fa90c5f899bf7ad127984d92ccbc2..eb312799b41a59a85d8e495942f8b9ef97a6c1d1 100644 (file)
@@ -132,6 +132,8 @@ write useful tools in python which are also fast to execute while in edit-mode.
 For the time being this limitation just has to be worked around but we're aware its frustrating needs to be addressed.
 
 
+.. _info_gotcha_mesh_faces:
+
 NGons and Tessellation Faces
 ============================
 
index cb03907c194330d330f11563a2731c917915b320..bfef94b35d7d79df486ad0c28e32c9178ead6537 100644 (file)
@@ -131,7 +131,7 @@ def handle_args():
                         dest="sphinx_theme",
                         type=str,
                         default='default',
-                        help =
+                        help=
                         # see SPHINX_THEMES below
                         "Sphinx theme (default='default')\n"
                         "Available themes\n"
@@ -230,10 +230,10 @@ if not ARGS.partial:
 
 else:
     # can manually edit this too:
-    FILTER_BPY_OPS = ("import.scene", )  # allow
-    FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID")  # allow
+    #FILTER_BPY_OPS = ("import.scene", )  # allow
+    #FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID")  # allow
     EXCLUDE_INFO_DOCS = True
-    EXCLUDE_MODULES = (
+    EXCLUDE_MODULES = [
         "aud",
         "bge",
         "bge.constraints",
@@ -261,7 +261,7 @@ else:
         "mathutils",
         "mathutils.geometry",
         "mathutils.noise",
-    )
+        ]
 
     # ------
     # Filter
@@ -269,7 +269,18 @@ else:
     # TODO, support bpy.ops and bpy.types filtering
     import fnmatch
     m = None
-    EXCLUDE_MODULES = tuple([m for m in EXCLUDE_MODULES if not fnmatch.fnmatchcase(m, ARGS.partial)])
+    EXCLUDE_MODULES = [m for m in EXCLUDE_MODULES if not fnmatch.fnmatchcase(m, ARGS.partial)]
+
+    # special support for bpy.types.XXX
+    FILTER_BPY_OPS = tuple([m[8:] for m in ARGS.partial.split(":") if m.startswith("bpy.ops.")])
+    if FILTER_BPY_OPS:
+        EXCLUDE_MODULES.remove("bpy.ops")
+
+    FILTER_BPY_TYPES = tuple([m[10:] for m in ARGS.partial.split(":") if m.startswith("bpy.types.")])
+    if FILTER_BPY_TYPES:
+        EXCLUDE_MODULES.remove("bpy.types")
+
+    print(FILTER_BPY_TYPES)
 
     EXCLUDE_INFO_DOCS = (not fnmatch.fnmatchcase("info", ARGS.partial))
 
index aa30d43a025381295446ca6d8e59b0bd3fa38ade..51b27afe6866612359e52c844eb036540ca26697 100644 (file)
@@ -78,8 +78,10 @@ ATTRIBUTE_ALIGNED16  (struct) btQuantizedBvhNode
        int     getTriangleIndex() const
        {
                btAssert(isLeafNode());
+               unsigned int x=0;
+               unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS);
                // Get only the lower bits where the triangle index is stored
-               return (m_escapeIndexOrTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS)));
+               return (m_escapeIndexOrTriangleIndex&~(y));
        }
        int     getPartId() const
        {
index a6ea33717bc9288968e52909dfb492f0be904b67..f311419d4a82496e38ed466acaab420b1c8c73d6 100644 (file)
@@ -45,7 +45,9 @@ struct btTriIndex
        int     getTriangleIndex() const
        {
                // Get only the lower bits where the triangle index is stored
-               return (m_PartIdTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS)));
+               unsigned int x = 0;
+               unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS);
+               return (m_PartIdTriangleIndex&~(y));
        }
        int     getPartId() const
        {
index fa00ad7bc2eebb307f6d3a263213b60e7b0c95db..f59bcba9fa61e4980435523eddd91f0d61004291 100644 (file)
@@ -11,7 +11,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
     defs += ' WIN32 NDEBUG _WINDOWS'
     #cflags += ['/MT', '/W3', '/GX', '/O2', '/Op']
     cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6', '/O3', '/EHcs']
-elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
+elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross', 'win64-mingw'):
     defs += ' NDEBUG'
     cflags += ['-O2']
 elif env['OURPLATFORM'] in ('linux', 'freebsd4', 'freebsd5'):
index e2f3c814e2eb741cecd04d5ac8e1a63c6db2d8b5..1ba67e51327dfcaa3771faa803273dc80abaf7c5 100644 (file)
@@ -14,7 +14,7 @@ incs = ['include']
 if env['WITH_BF_BOOST']:
     if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
         # Boost is setting as preferred collections library in the Carve code when using MSVC compiler
-        if env['OURPLATFORM'] != 'win32-mingw':
+        if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'):
             defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS')
 
     defs.append('CARVE_SYSTEM_BOOST')
index e68b2c7e90e4dcf92b5d1097f3f967c23b6ff6f0..881367fe6877e19cd0afcf678bcd560917c54ff5 100755 (executable)
@@ -114,7 +114,7 @@ incs = ['include']
 if env['WITH_BF_BOOST']:
     if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
         # Boost is setting as preferred collections library in the Carve code when using MSVC compiler
-        if env['OURPLATFORM'] != 'win32-mingw':
+        if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'):
             defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS')
 
     defs.append('CARVE_SYSTEM_BOOST')
diff --git a/extern/carve/patches/mingw_w64.patch b/extern/carve/patches/mingw_w64.patch
new file mode 100644 (file)
index 0000000..26a30be
--- /dev/null
@@ -0,0 +1,13 @@
+Index: bundle.sh
+===================================================================
+--- bundle.sh  (revision 45912)
++++ bundle.sh  (working copy)
+@@ -114,7 +114,7 @@
+ if env['WITH_BF_BOOST']:
+     if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
+         # Boost is setting as preferred collections library in the Carve code when using MSVC compiler
+-        if env['OURPLATFORM'] != 'win32-mingw':
++        if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'):
+             defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS')
+     defs.append('CARVE_SYSTEM_BOOST')
index fbcd92503d8dc5af7da292ffe2f60514d3ddfe7d..fbb6ee36f8559eb96c291057c725f549bcce0259 100644 (file)
@@ -34,7 +34,7 @@ incs = '. ../Eigen3'
 incs += ' ' + env['BF_PNG_INC']
 incs += ' ' + env['BF_ZLIB_INC']
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
         incs += ' ./third_party/msinttypes'
index a34e45a38b0a0dbdfd4e933c3b76e8f8ce75c6af..30d08cd680a46d0be8aed9c0493e7c6097c0cf17 100755 (executable)
@@ -248,7 +248,7 @@ incs = '. ../Eigen3'
 incs += ' ' + env['BF_PNG_INC']
 incs += ' ' + env['BF_ZLIB_INC']
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
         incs += ' ./third_party/msinttypes'
index 3f697d487b6234238baad7e240df25027dead697..6c20d76eeac900626c1d25437e8e874edf880dc5 100644 (file)
@@ -460,7 +460,7 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
        return (libmv_Reconstruction *)libmv_reconstruction;
 }
 
-struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, int refine_intrinsics, double focal_length,
+struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, double focal_length,
                        double principal_x, double principal_y, double k1, double k2, double k3,
                        reconstruct_progress_update_cb progress_update_callback, void *callback_customdata)
 {
@@ -488,11 +488,6 @@ struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, int r
 
        libmv::ModalSolver(normalized_tracks, reconstruction, &update_callback);
 
-       if (refine_intrinsics) {
-               libmv_solveRefineIntrinsics((libmv::Tracks *)tracks, intrinsics, reconstruction,
-                       refine_intrinsics, progress_update_callback, callback_customdata);
-       }
-
        progress_update_callback(callback_customdata, 1.0, "Finishing solution");
        libmv_reconstruction->tracks = *(libmv::Tracks *)tracks;
        libmv_reconstruction->error = libmv::EuclideanReprojectionError(*(libmv::Tracks *)tracks, *reconstruction, *intrinsics);
index f72a72d494b313673195d6679d07da96ca3322ac..bccc47068322741badca2c1d68a1c60f1827217f 100644 (file)
@@ -68,7 +68,7 @@ int libmv_refineParametersAreValid(int parameters);
 struct libmv_Reconstruction *libmv_solveReconstruction(struct libmv_Tracks *tracks, int keyframe1, int keyframe2,
                        int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3,
                        reconstruct_progress_update_cb progress_update_callback, void *callback_customdata);
-struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, int refine_intrinsics, double focal_length,
+struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, double focal_length,
                        double principal_x, double principal_y, double k1, double k2, double k3,
                        reconstruct_progress_update_cb progress_update_callback, void *callback_customdata);
 int libmv_reporojectionPointForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]);
index ad707fb76f2930234291cd613d42d6ba2c06b618..d2cadf4b57936107d2a582e47714dbf23aa6bfba 100644 (file)
@@ -33,7 +33,7 @@
 #include <Eigen/QR>
 #include <Eigen/SVD>
 
-#if _WIN32 || __APPLE__ || __FreeBSD__
+#if (defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__)) && !defined(__MINGW64__)
   void static sincos (double x, double *sinx, double *cosx) {
     *sinx = sin(x);
     *cosx = cos(x);
index ede0071dc645e28dc26e222a2604c5b526278bcd..bb49b30dbcef737bf71650c8718424f2cf803a2d 100644 (file)
@@ -91,19 +91,15 @@ void ModalSolver(Tracks &tracks,
 
           ProjectMarkerOnSphere(marker, X);
 
-          points.push_back(R * point->X);
+          points.push_back(point->X);
           reference_points.push_back(X);
         }
       }
     }
 
     if (points.size()) {
-      Mat3 dR = Mat3::Identity();
-
-      // Find rigid delta transformation from previous image to current image
-      RigidRegistration(reference_points, points, dR);
-
-      R *= dR;
+      // Find rigid delta transformation to current image
+      RigidRegistration(reference_points, points, R);
     }
 
     reconstruction->InsertCamera(image, R, Vec3::Zero());
diff --git a/extern/libmv/patches/mingw_w64_support.patch b/extern/libmv/patches/mingw_w64_support.patch
new file mode 100644 (file)
index 0000000..360287e
--- /dev/null
@@ -0,0 +1,58 @@
+Index: bundle.sh
+===================================================================
+--- bundle.sh  (revision 45912)
++++ bundle.sh  (working copy)
+@@ -248,7 +248,7 @@
+ incs += ' ' + env['BF_PNG_INC']
+ incs += ' ' + env['BF_ZLIB_INC']
+-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
++if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
+     incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
+     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+         incs += ' ./third_party/msinttypes'
+Index: libmv/numeric/numeric.h
+===================================================================
+--- libmv/numeric/numeric.h    (revision 45912)
++++ libmv/numeric/numeric.h    (working copy)
+@@ -33,7 +33,7 @@
+ #include <Eigen/QR>
+ #include <Eigen/SVD>
+-#if _WIN32 || __APPLE__ || __FreeBSD__
++#if (defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__)) && !defined(__MINGW64__)
+   void static sincos (double x, double *sinx, double *cosx) {
+     *sinx = sin(x);
+     *cosx = cos(x);
+Index: third_party/glog/src/windows/port.cc
+===================================================================
+--- third_party/glog/src/windows/port.cc       (revision 45912)
++++ third_party/glog/src/windows/port.cc       (working copy)
+@@ -55,6 +55,8 @@
+   return _vsnprintf(str, size-1, format, ap);
+ }
++// MinGW64 defines
++#ifndef __MINGW64__
+ int snprintf(char *str, size_t size, const char *format, ...) {
+   va_list ap;
+   va_start(ap, format);
+@@ -62,3 +64,4 @@
+   va_end(ap);
+   return r;
+ }
++#endif
+Index: third_party/glog/src/windows/port.h
+===================================================================
+--- third_party/glog/src/windows/port.h        (revision 45912)
++++ third_party/glog/src/windows/port.h        (working copy)
+@@ -120,7 +120,9 @@
+ #define DEFAULT_TEMPLATE_ROOTDIR  ".."
+ // ----------------------------------- SYSTEM/PROCESS
++#ifndef __MINGW64__
+ typedef int pid_t;
++#endif
+ #define getpid  _getpid
+ // ----------------------------------- THREADS
index bfa6e70afbb051ee7b12aba7f3c9a029fd021e4e..58e28b026c0d482072346808f587a595dfab120e 100644 (file)
@@ -55,6 +55,8 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
   return _vsnprintf(str, size-1, format, ap);
 }
 
+// MinGW64 defines
+#ifndef __MINGW64__
 int snprintf(char *str, size_t size, const char *format, ...) {
   va_list ap;
   va_start(ap, format);
@@ -62,3 +64,4 @@ int snprintf(char *str, size_t size, const char *format, ...) {
   va_end(ap);
   return r;
 }
+#endif
index abfcf65384ce05f81128d190fe413543edd3952e..72e3906f82f0a6519bf415f657a7dee969f3e6b3 100644 (file)
@@ -120,7 +120,9 @@ extern int safe_vsnprintf(char *str, size_t size,
 #define DEFAULT_TEMPLATE_ROOTDIR  ".."
 
 // ----------------------------------- SYSTEM/PROCESS
+#ifndef __MINGW64__
 typedef int pid_t;
+#endif
 #define getpid  _getpid
 
 // ----------------------------------- THREADS
index d7c3715349b2aa37780a5c120df498d0c8c0a1b9..b6305f7dbaba06a6d877f596ec450edf66a4b8a8 100644 (file)
@@ -36,5 +36,5 @@ if NEW_CSG == 'false':
 else:
     SConscript(['csg/SConscript'])
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
     SConscript(['utfconv/SConscript'])
index b8d5a56a6255f5c9e7e7f4176011b8cc8f33a750..50c81db46dd77f0f424ec45910d85bf487cc271f 100644 (file)
@@ -41,7 +41,7 @@ if env['WITH_BF_PYTHON']:
     incs += ' Python ' + env['BF_PYTHON_INC']
     defs.append('WITH_PYTHON')
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 env.BlenderLib ('bf_intern_audaspace', sources, Split(incs), defs, libtype=['intern','player'], priority = [25,215] )
index 9100a277124b67a5e0a7f59acf366b277fe7828f..50b476506969a014356a386eec367f19fce66b9f 100644 (file)
@@ -41,6 +41,7 @@
 #include <cstdlib>
 #include <cstring>
 #include <cmath>
+#include <sstream>
 
 #include "AUD_NULLDevice.h"
 #include "AUD_I3DDevice.h"
@@ -1236,6 +1237,47 @@ const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int lengt
        }
 }
 
+const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
+{
+       try
+       {
+               AUD_SequencerFactory* f = dynamic_cast<AUD_SequencerFactory*>(sound->get());
+
+               f->setSpecs(specs.specs);
+
+               std::vector<AUD_Reference<AUD_IWriter> > writers;
+
+               int channels = specs.channels;
+               specs.channels = AUD_CHANNELS_MONO;
+
+               for(int i = 0; i < channels; i++)
+               {
+                       std::stringstream stream;
+                       std::string fn = filename;
+                       size_t index = fn.find_last_of('.');
+                       size_t index_slash = fn.find_last_of('/');
+                       size_t index_backslash = fn.find_last_of('\\');
+                       if((index == std::string::npos) ||
+                                       ((index < index_slash) && (index_slash != std::string::npos)) ||
+                                       ((index < index_backslash) && (index_backslash != std::string::npos)))
+                               stream << filename << "_" << (i + 1);
+                       else
+                               stream << fn.substr(0, index) << "_" << (i + 1) << fn.substr(index);
+                       writers.push_back(AUD_FileWriter::createWriter(stream.str(), specs, format, codec, bitrate));
+               }
+
+               AUD_Reference<AUD_IReader> reader = f->createQualityReader();
+               reader->seek(start);
+               AUD_FileWriter::writeReader(reader, writers, length, buffersize);
+
+               return NULL;
+       }
+       catch(AUD_Exception& e)
+       {
+               return e.str;
+       }
+}
+
 AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, float start)
 {
        try
index 8388af2170d45b5dc4b9d7116e21d6f53bacb207..a52a1fa836954cfc5f0434b2d0de8ad15ac021a4 100644 (file)
@@ -709,6 +709,21 @@ extern void* AUD_getSet(void* set);
  */
 extern const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate);
 
+/**
+ * Mixes a sound down into multiple files.
+ * \param sound The sound scene to mix down.
+ * \param start The start frame.
+ * \param length The count of frames to write.
+ * \param buffersize How many samples should be written at once.
+ * \param filename The file to write to, the channel number and an underscore are added at the beginning.
+ * \param specs The file's audio specification.
+ * \param format The file's container format.
+ * \param codec The codec used for encoding the audio data.
+ * \param bitrate The bitrate for encoding.
+ * \return An error message or NULL in case of success.
+ */
+extern const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate);
+
 /**
  * Opens a read device and prepares it for mixdown of the sound scene.
  * \param specs Output audio specifications.
index df76b667e3fe843abd703a6d50f1c5c09be91e33..f74021acad19a45d328c6f75f7071bcf1d449b92 100644 (file)
@@ -93,3 +93,39 @@ void AUD_FileWriter::writeReader(AUD_Reference<AUD_IReader> reader, AUD_Referenc
                writer->write(len, buf);
        }
 }
+
+void AUD_FileWriter::writeReader(AUD_Reference<AUD_IReader> reader, std::vector<AUD_Reference<AUD_IWriter> >& writers, unsigned int length, unsigned int buffersize)
+{
+       AUD_Buffer buffer(buffersize * AUD_SAMPLE_SIZE(reader->getSpecs()));
+       AUD_Buffer buffer2(buffersize * sizeof(sample_t));
+       sample_t* buf = buffer.getBuffer();
+       sample_t* buf2 = buffer2.getBuffer();
+
+       int len;
+       bool eos = false;
+       int channels = reader->getSpecs().channels;
+
+       for(unsigned int pos = 0; ((pos < length) || (length <= 0)) && !eos; pos += len)
+       {
+               len = buffersize;
+               if((len > length - pos) && (length > 0))
+                       len = length - pos;
+               reader->read(len, eos, buf);
+
+               for(int channel = 0; channel < channels; channel++)
+               {
+                       for(int i = 0; i < len; i++)
+                       {
+                               // clamping!
+                               if(buf[i * channels + channel] > 1)
+                                       buf2[i] = 1;
+                               else if(buf[i * channels + channel] < -1)
+                                       buf2[i] = -1;
+                               else
+                                       buf2[i] = buf[i * channels + channel];
+                       }
+
+                       writers[channel]->write(len, buf2);
+               }
+       }
+}
index c9ee2b1ee12046baae22523256f56be9b852b6e7..385aba5ef45867c15c405f3f79be129e2df41d72 100644 (file)
@@ -31,6 +31,7 @@
 #define __AUD_FILEWRITER_H__
 
 #include <string>
+#include <vector>
 
 #include "AUD_Reference.h"
 
@@ -68,6 +69,15 @@ public:
         * \param buffersize How many samples should be transfered at once.
         */
        static void writeReader(AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_IWriter> writer, unsigned int length, unsigned int buffersize);
+
+       /**
+        * Writes a reader to several writers.
+        * \param reader The reader to read from.
+        * \param writers The writers to write to.
+        * \param length How many samples should be transfered.
+        * \param buffersize How many samples should be transfered at once.
+        */
+       static void writeReader(AUD_Reference<AUD_IReader> reader, std::vector<AUD_Reference<AUD_IWriter> >& writers, unsigned int length, unsigned int buffersize);
 };
 
 #endif //__AUD_FILEWRITER_H__
index 2e07417154b85828ea822c048628ab834ff940d0..0c9f02c0155d86452e99176976f8bd52234a266c 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <map>
 #include <cstddef>
+#include <pthread.h>
 
 // #define MEM_DEBUG
 
@@ -49,8 +50,13 @@ private:
         * Saves the reference counts.
         */
        static std::map<void*, unsigned int> m_references;
+       static pthread_mutex_t m_mutex;
+       static bool m_mutex_initialised;
 
 public:
+
+       static pthread_mutex_t* getMutex();
+
        /**
         * Reference increment.
         * \param reference The reference.
@@ -108,6 +114,7 @@ public:
        template <class U>
        AUD_Reference(U* reference)
        {
+               pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
                m_original = reference;
                m_reference = dynamic_cast<T*>(reference);
                AUD_ReferenceHandler::incref(m_original);
@@ -115,6 +122,7 @@ public:
                if(m_reference != NULL)
                        std::cerr << "+" << typeid(*m_reference).name() << std::endl;
 #endif
+               pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
        }
 
        AUD_Reference()
@@ -129,6 +137,7 @@ public:
         */
        AUD_Reference(const AUD_Reference& ref)
        {
+               pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
                m_original = ref.m_original;
                m_reference = ref.m_reference;
                AUD_ReferenceHandler::incref(m_original);
@@ -136,11 +145,13 @@ public:
                if(m_reference != NULL)
                        std::cerr << "+" << typeid(*m_reference).name() << std::endl;
 #endif
+               pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
        }
 
        template <class U>
        explicit AUD_Reference(const AUD_Reference<U>& ref)
        {
+               pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
                m_original = ref.get();
                m_reference = dynamic_cast<T*>(ref.get());
                AUD_ReferenceHandler::incref(m_original);
@@ -148,6 +159,7 @@ public:
                if(m_reference != NULL)
                        std::cerr << "+" << typeid(*m_reference).name() << std::endl;
 #endif
+               pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
        }
 
        /**
@@ -156,12 +168,14 @@ public:
         */
        ~AUD_Reference()
        {
+               pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
 #ifdef MEM_DEBUG
                if(m_reference != NULL)
                        std::cerr << "-" << typeid(*m_reference).name() << std::endl;
 #endif
                if(AUD_ReferenceHandler::decref(m_original))
                        delete m_reference;
+               pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
        }
 
        /**
@@ -173,6 +187,8 @@ public:
                if(&ref == this)
                        return *this;
 
+               pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
+
 #ifdef MEM_DEBUG
                if(m_reference != NULL)
                        std::cerr << "-" << typeid(*m_reference).name() << std::endl;
@@ -188,6 +204,8 @@ public:
                        std::cerr << "+" << typeid(*m_reference).name() << std::endl;
 #endif
 
+               pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
+
                return *this;
        }
 
index 24f645df76100a298615eb568ae8ace5314ce2b8..3e9f6707262daab08cba9bc36e788c58070cd068 100644 (file)
 #include "AUD_Reference.h"
 
 std::map<void*, unsigned int> AUD_ReferenceHandler::m_references;
+pthread_mutex_t AUD_ReferenceHandler::m_mutex;
+bool AUD_ReferenceHandler::m_mutex_initialised = false;
+
+pthread_mutex_t *AUD_ReferenceHandler::getMutex()
+{
+       if(!m_mutex_initialised)
+       {
+               pthread_mutexattr_t attr;
+               pthread_mutexattr_init(&attr);
+               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+
+               pthread_mutex_init(&m_mutex, &attr);
+
+               pthread_mutexattr_destroy(&attr);
+
+               m_mutex_initialised = true;
+       }
+
+       return &m_mutex;
+}
+
index 1c8c912614dd6e1f2dda14d68e8a9cb639a43c72..f630d1d58e0ee71c91fd9721ad609172616ff9bb 100644 (file)
@@ -18,13 +18,13 @@ else:
     if env['WITH_BF_BOOST']:
         if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
             # Boost is setting as preferred collections library in the Carve code when using MSVC compiler
-            if env['OURPLATFORM'] != 'win32-mingw':
+            if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'):
                 defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS')
 
         defs.append('CARVE_SYSTEM_BOOST')
         incs +=  ' ' + env['BF_BOOST_INC']
 
-if (env['OURPLATFORM'] == 'win32-mingw'):
+if (env['OURPLATFORM'] in ('win32-mingw', 'win64-mingw')):
     env.BlenderLib ('bf_intern_bop', sources, Split(incs) , [], libtype='intern', priority = 5 )
 else:
     env.BlenderLib ('bf_intern_bop', sources, Split(incs) , defs, libtype='intern', priority = 5 )
index 8b6d84337c2b51019148fa0f160adf4e177e7efd..9557821d642786f467c629ee0100da7e93ff48fc 100644 (file)
@@ -63,7 +63,7 @@ public:
                for (int i = 0; i < m_num_buckets; ++i) {
                        m_buckets[i] = 0;
 
-                       for(Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
+                       for (Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
                                insert(entry->m_key, entry->m_value);
                }
        }
index 2ea224f052dff2089ea80572dc72c3044e597662..34c6e8df2fd2a917fbce303895a662dc213c7c63 100644 (file)
@@ -39,7 +39,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
 else:
     cxxflags.append('-ffast-math'.split())
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs.append(env['BF_PTHREADS_INC'])
 
 # optimized kernel
index b93f61b98d509e4cbd8ca2f395d651e09f75e8a1..b954ff45e2781db68001b58b351df06567e81adc 100644 (file)
@@ -724,7 +724,7 @@ static void xml_read_patch(const XMLReadState& state, pugi::xml_node node)
                        LinearQuadPatch *bpatch = new LinearQuadPatch();
 
                        for(int i = 0; i < 4; i++)
-                               P[i] = transform(&state.tfm, P[i]);
+                               P[i] = transform_point(&state.tfm, P[i]);
                        memcpy(bpatch->hull, &P[0], sizeof(bpatch->hull));
 
                        patch = bpatch;
@@ -738,7 +738,7 @@ static void xml_read_patch(const XMLReadState& state, pugi::xml_node node)
                        BicubicPatch *bpatch = new BicubicPatch();
 
                        for(int i = 0; i < 16; i++)
-                               P[i] = transform(&state.tfm, P[i]);
+                               P[i] = transform_point(&state.tfm, P[i]);
                        memcpy(bpatch->hull, &P[0], sizeof(bpatch->hull));
 
                        patch = bpatch;
@@ -777,7 +777,7 @@ static void xml_read_light(const XMLReadState& state, pugi::xml_node node)
        Light *light = new Light();
        light->shader = state.shader;
        xml_read_float3(&light->co, node, "P");
-       light->co = transform(&state.tfm, light->co);
+       light->co = transform_point(&state.tfm, light->co);
 
        state.scene->lights.push_back(light);
 }
index cb99ea3b499d49df4c7154e29795ac006ba234c9..35f97bf629f42e303f60059709f273de485a440c 100644 (file)
@@ -85,10 +85,10 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
                 description="Leave out caustics, resulting in a darker image with less noise",
                 default=False,
                 )
-        cls.blur_caustics = FloatProperty(
-                name="Blur Caustics",
-                description="Blur caustics to reduce noise",
-                min=0.0, max=1.0,
+        cls.blur_glossy = FloatProperty(
+                name="Filter Glossy",
+                description="Adaptively blur glossy shaders after blurry bounces, to reduce noise at the cost of accuracy",
+                min=0.0, max=10.0,
                 default=0.0,
                 )
 
index 4a8b639b390ca731a8c96abf415841eff4ca732a..0ed08589327a77a90a25ff6385887704fb95a474 100644 (file)
@@ -87,11 +87,11 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
         sub.prop(cscene, "diffuse_bounces", text="Diffuse")
         sub.prop(cscene, "glossy_bounces", text="Glossy")
         sub.prop(cscene, "transmission_bounces", text="Transmission")
-        sub.prop(cscene, "no_caustics")
 
-        #row = col.row()
-        #row.prop(cscene, "blur_caustics")
-        #row.active = not cscene.no_caustics
+        col.separator()
+
+        col.prop(cscene, "no_caustics")
+        col.prop(cscene, "blur_glossy")
 
 
 class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
@@ -178,10 +178,7 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
 
         col = split.column()
         col.prop(scene, "layers", text="Scene")
-        col.label(text="Material:")
-        col.prop(rl, "material_override", text="")
-
-        col.prop(rl, "use_sky", "Use Environment")
+        col.prop(rl, "layers_exclude", text="Exclude")
 
         col = split.column()
         col.prop(rl, "layers", text="Layer")
@@ -190,6 +187,16 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
 
         split = layout.split()
 
+        col = split.column()
+        col.label(text="Material:")
+        col.prop(rl, "material_override", text="")
+
+        col = split.column()
+        col.prop(rl, "samples")
+        col.prop(rl, "use_sky", "Use Environment")
+
+        split = layout.split()
+
         col = split.column()
         col.label(text="Passes:")
         col.prop(rl, "use_pass_combined")
@@ -783,6 +790,31 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
             layout.template_color_ramp(mapping, "color_ramp", expand=True)
 
 
+class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
+    bl_label = "Simplify"
+    bl_context = "scene"
+    COMPAT_ENGINES = {'CYCLES'}
+
+    def draw_header(self, context):
+        rd = context.scene.render
+        self.layout.prop(rd, "use_simplify", text="")
+
+    def draw(self, context):
+        layout = self.layout
+
+        rd = context.scene.render
+
+        layout.active = rd.use_simplify
+
+        split = layout.split()
+
+        col = split.column()
+        col.prop(rd, "simplify_subdivision", text="Subdivision")
+
+        col = split.column()
+        col.prop(rd, "simplify_child_particles", text="Child Particles")
+
+
 def draw_device(self, context):
     scene = context.scene
     layout = self.layout
index 7c8d36ab574e0d437a1ce72a81c1b1d5217927e2..7caa6b3d511c2e47dbfbeb7c27f160aa27b16818 100644 (file)
@@ -227,6 +227,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool holdout, bool object_updated)
        /* test if we can instance or if the object is modified */
        BL::ID b_ob_data = b_ob.data();
        BL::ID key = (object_is_modified(b_ob) || holdout)? b_ob: b_ob_data;
+       BL::Material material_override = render_layer.material_override;
 
        /* find shader indices */
        vector<uint> used_shaders;
@@ -246,6 +247,8 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool holdout, bool object_updated)
        if(used_shaders.size() == 0) {
                if(holdout)
                        used_shaders.push_back(scene->default_holdout);
+               else if(material_override)
+                       find_shader(material_override, used_shaders, scene->default_surface);
                else
                        used_shaders.push_back(scene->default_surface);
        }
index dc6c69e29042167046bb4993cc80ee65eaf8f261..5ece7aa26e205d8953028a2add9eb067a78be781 100644 (file)
@@ -218,12 +218,13 @@ void BlenderSession::render()
                scene->film->passes = passes;
                scene->film->tag_update(scene);
 
-               /* update session */
-               session->reset(buffer_params, session_params.samples);
-
                /* update scene */
                sync->sync_data(b_v3d, b_iter->name().c_str());
 
+               /* update session */
+               int samples = sync->get_layer_samples();
+               session->reset(buffer_params, (samples == 0)? session_params.samples: samples);
+
                /* render */
                session->start();
                session->wait();
index 5a28629877441efc83fd9874ad7d7f26dd2863b5..41cd200d0031ea234a1cfb04c0409a53f836cdb0 100644 (file)
@@ -153,6 +153,8 @@ void BlenderSync::sync_integrator()
        integrator->transparent_shadows = get_boolean(cscene, "use_transparent_shadows");
 
        integrator->no_caustics = get_boolean(cscene, "no_caustics");
+       integrator->filter_glossy = get_float(cscene, "blur_glossy");
+
        integrator->seed = get_int(cscene, "seed");
 
        integrator->layer_flag = render_layer.layer;
@@ -208,6 +210,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
                        render_layer.holdout_layer = 0;
                        render_layer.material_override = PointerRNA_NULL;
                        render_layer.use_background = true;
+                       render_layer.samples = 0;
                        return;
                }
        }
@@ -220,12 +223,13 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
        for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) {
                if((!layer && first_layer) || (layer && b_rlay->name() == layer)) {
                        render_layer.name = b_rlay->name();
-                       render_layer.scene_layer = get_layer(b_scene.layers());
+                       render_layer.scene_layer = get_layer(b_scene.layers()) & ~get_layer(b_rlay->layers_exclude());
                        render_layer.layer = get_layer(b_rlay->layers());
                        render_layer.holdout_layer = get_layer(b_rlay->layers_zmask());
                        render_layer.layer |= render_layer.holdout_layer;
                        render_layer.material_override = b_rlay->material_override();
                        render_layer.use_background = b_rlay->use_sky();
+                       render_layer.samples = b_rlay->samples();
                }
 
                first_layer = false;
index d2550a1ffd7150bd77276aa320f504edccf773d9..ab8e4bd8d00afa7486a515d37c69c5b9c3bfa4b8 100644 (file)
@@ -57,6 +57,7 @@ public:
        void sync_data(BL::SpaceView3D b_v3d, const char *layer = 0);
        void sync_camera(BL::Object b_override, int width, int height);
        void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
+       int get_layer_samples() { return render_layer.samples; }
 
        /* get parameters */
        static SceneParams get_scene_params(BL::Scene b_scene, bool background);
@@ -108,7 +109,8 @@ private:
                RenderLayerInfo()
                : scene_layer(0), layer(0), holdout_layer(0),
                  material_override(PointerRNA_NULL),
-                 use_background(true)
+                 use_background(true),
+                 samples(0)
                {}
 
                string name;
@@ -117,6 +119,7 @@ private:
                uint holdout_layer;
                BL::Material material_override;
                bool use_background;
+               int samples;
        } render_layer;
 };
 
index decc576fe51e393c3874317c5d58a48b7cd4feae..131a7a1f750f7545ce9d36ead0063c90200c7923 100644 (file)
@@ -10,17 +10,21 @@ set(INC
 
 set(SRC
        bvh.cpp
+       bvh_binning.cpp
        bvh_build.cpp
        bvh_node.cpp
        bvh_sort.cpp
+       bvh_split.cpp
 )
 
 set(SRC_HEADERS
        bvh.h
+       bvh_binning.h
        bvh_build.h
        bvh_node.h
        bvh_params.h
        bvh_sort.h
+       bvh_split.h
 )
 
 include_directories(${INC})
index c9bfa9643322e7d09dd7617ff0e651622083c375..15695dddf459f2580ced4716d587d366a43c8c0c 100644 (file)
@@ -530,7 +530,7 @@ void RegularBVH::refit_nodes()
 {
        assert(!params.top_level);
 
-       BoundBox bbox;
+       BoundBox bbox = BoundBox::empty;
        uint visibility = 0;
        refit_node(0, (pack.is_leaf[0])? true: false, bbox, visibility);
 }
@@ -572,7 +572,7 @@ void RegularBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility
        }
        else {
                /* refit inner node, set bbox from children */
-               BoundBox bbox0, bbox1;
+               BoundBox bbox0 = BoundBox::empty, bbox1 = BoundBox::empty;
                uint visibility0 = 0, visibility1 = 0;
 
                refit_node((c0 < 0)? -c0-1: c0, (c0 < 0), bbox0, visibility0);
diff --git a/intern/cycles/bvh/bvh_binning.cpp b/intern/cycles/bvh/bvh_binning.cpp
new file mode 100644 (file)
index 0000000..661541a
--- /dev/null
@@ -0,0 +1,223 @@
+/*
+ * Adapted from code copyright 2009-2011 Intel Corporation
+ * Modifications Copyright 2012, Blender Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define __KERNEL_SSE__
+
+#include <stdlib.h>
+
+#include "bvh_binning.h"
+
+#include "util_algorithm.h"
+#include "util_boundbox.h"
+#include "util_types.h"
+
+CCL_NAMESPACE_BEGIN
+
+/* SSE replacements */
+
+__forceinline void prefetch_L1 (const void* ptr) { }
+__forceinline void prefetch_L2 (const void* ptr) { }
+__forceinline void prefetch_L3 (const void* ptr) { }
+__forceinline void prefetch_NTA(const void* ptr) { }
+
+template<size_t src> __forceinline float extract(const int4& b)
+{ return b[src]; }
+template<size_t dst> __forceinline const float4 insert(const float4& a, const float b)
+{ float4 r = a; r[dst] = b; return r; }
+
+__forceinline int get_best_dimension(const float4& bestSAH)
+{
+       // return (int)__bsf(movemask(reduce_min(bestSAH) == bestSAH));
+
+       float minSAH = min(bestSAH.x, min(bestSAH.y, bestSAH.z));
+
+       if(bestSAH.x == minSAH) return 0;
+       else if(bestSAH.y == minSAH) return 1;
+       else return 2;
+}
+
+/* BVH Object Binning */
+
+BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
+: BVHRange(job), splitSAH(FLT_MAX), dim(0), pos(0)
+{
+       /* compute number of bins to use and precompute scaling factor for binning */
+       num_bins = min(size_t(MAX_BINS), size_t(4.0f + 0.05f*size()));
+       scale = rcp(cent_bounds().size()) * make_float3((float)num_bins);
+
+       /* initialize binning counter and bounds */
+       BoundBox bin_bounds[MAX_BINS][4];       /* bounds for every bin in every dimension */
+       int4 bin_count[MAX_BINS];                       /* number of primitives mapped to bin */
+
+       for(size_t i = 0; i < num_bins; i++) {
+               bin_count[i] = make_int4(0);
+               bin_bounds[i][0] = bin_bounds[i][1] = bin_bounds[i][2] = BoundBox::empty;
+       }
+
+       /* map geometry to bins, unrolled once */
+       {
+               ssize_t i;
+
+               for(i = 0; i < ssize_t(size()) - 1; i += 2) {
+                       prefetch_L2(&prims[start() + i + 8]);
+
+                       /* map even and odd primitive to bin */
+                       BVHReference prim0 = prims[start() + i + 0];
+                       BVHReference prim1 = prims[start() + i + 1];
+
+                       int4 bin0 = get_bin(prim0.bounds());
+                       int4 bin1 = get_bin(prim1.bounds());
+
+                       /* increase bounds for bins for even primitive */
+                       int b00 = extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
+                       int b01 = extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
+                       int b02 = extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
+
+                       /* increase bounds of bins for odd primitive */
+                       int b10 = extract<0>(bin1); bin_count[b10][0]++; bin_bounds[b10][0].grow(prim1.bounds());
+                       int b11 = extract<1>(bin1); bin_count[b11][1]++; bin_bounds[b11][1].grow(prim1.bounds());
+                       int b12 = extract<2>(bin1); bin_count[b12][2]++; bin_bounds[b12][2].grow(prim1.bounds());
+               }
+
+               /* for uneven number of primitives */
+               if(i < ssize_t(size())) {
+                       /* map primitive to bin */
+                       BVHReference prim0 = prims[start() + i];
+                       int4 bin0 = get_bin(prim0.bounds());
+
+                       /* increase bounds of bins */
+                       int b00 = extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
+                       int b01 = extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
+                       int b02 = extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
+               }
+       }
+
+       /* sweep from right to left and compute parallel prefix of merged bounds */
+       float4 r_area[MAX_BINS];        /* area of bounds of primitives on the right */
+       float4 r_count[MAX_BINS];       /* number of primitives on the right */
+       int4 count = make_int4(0);
+
+       BoundBox bx = BoundBox::empty;
+       BoundBox by = BoundBox::empty;
+       BoundBox bz = BoundBox::empty;
+
+       for(size_t i = num_bins - 1; i > 0; i--) {
+               count = count + bin_count[i];
+               r_count[i] = blocks(count);
+
+               bx = merge(bx,bin_bounds[i][0]); r_area[i][0] = bx.half_area();
+               by = merge(by,bin_bounds[i][1]); r_area[i][1] = by.half_area();
+               bz = merge(bz,bin_bounds[i][2]); r_area[i][2] = bz.half_area();
+       }
+
+       /* sweep from left to right and compute SAH */
+       int4 ii = make_int4(1);
+       float4 bestSAH = make_float4(FLT_MAX);
+       int4 bestSplit = make_int4(-1);
+
+       count = make_int4(0);
+
+       bx = BoundBox::empty;
+       by = BoundBox::empty;
+       bz = BoundBox::empty;
+
+       for(size_t i = 1; i < num_bins; i++, ii += make_int4(1)) {
+               count = count + bin_count[i-1];
+
+               bx = merge(bx,bin_bounds[i-1][0]); float Ax = bx.half_area();
+               by = merge(by,bin_bounds[i-1][1]); float Ay = by.half_area();
+               bz = merge(bz,bin_bounds[i-1][2]); float Az = bz.half_area();
+
+               float4 lCount = blocks(count);
+               float4 lArea = make_float4(Ax,Ay,Az,Az);
+               float4 sah = lArea*lCount + r_area[i]*r_count[i];
+
+               bestSplit = select(sah < bestSAH,ii,bestSplit);
+               bestSAH = min(sah,bestSAH);
+       }
+
+       int4 mask = float3_to_float4(cent_bounds().size()) <= make_float4(0.0f);
+       bestSAH = insert<3>(select(mask, make_float4(FLT_MAX), bestSAH), FLT_MAX);
+
+       /* find best dimension */
+       dim = get_best_dimension(bestSAH);
+       splitSAH = bestSAH[dim];
+       pos = bestSplit[dim];
+       leafSAH = bounds().half_area() * blocks(size());
+}
+
+void BVHObjectBinning::split(BVHReference* prims, BVHObjectBinning& left_o, BVHObjectBinning& right_o) const
+{
+       size_t N = size();
+
+       BoundBox lgeom_bounds = BoundBox::empty;
+       BoundBox rgeom_bounds = BoundBox::empty;
+       BoundBox lcent_bounds = BoundBox::empty;
+       BoundBox rcent_bounds = BoundBox::empty;
+
+       ssize_t l = 0, r = N-1;
+
+       while(l <= r) {
+               prefetch_L2(&prims[start() + l + 8]);
+               prefetch_L2(&prims[start() + r - 8]);
+
+               BVHReference prim = prims[start() + l];
+               float3 center = prim.bounds().center2();
+
+               if(get_bin(center)[dim] < pos) {
+                       lgeom_bounds.grow(prim.bounds());
+                       lcent_bounds.grow(center);
+                       l++;
+               }
+               else {
+                       rgeom_bounds.grow(prim.bounds());
+                       rcent_bounds.grow(center);
+                       swap(prims[start()+l],prims[start()+r]);
+                       r--;
+               }
+       }
+
+       /* finish */
+       if(l != 0 && N-1-r != 0) {
+               right_o = BVHObjectBinning(BVHRange(rgeom_bounds, rcent_bounds, start() + l, N-1-r), prims);
+               left_o  = BVHObjectBinning(BVHRange(lgeom_bounds, lcent_bounds, start(), l), prims);
+               return;
+       }
+
+       /* object medium split if we did not make progress, can happen when all
+          primitives have same centroid */
+       lgeom_bounds = BoundBox::empty;
+       rgeom_bounds = BoundBox::empty;
+       lcent_bounds = BoundBox::empty;
+       rcent_bounds = BoundBox::empty;
+
+       for(size_t i = 0; i < N/2; i++) {
+               lgeom_bounds.grow(prims[start()+i].bounds());
+               lcent_bounds.grow(prims[start()+i].bounds().center2());
+       }
+
+       for(size_t i = N/2; i < N; i++) {
+               rgeom_bounds.grow(prims[start()+i].bounds());
+               rcent_bounds.grow(prims[start()+i].bounds().center2());
+       }
+
+       right_o = BVHObjectBinning(BVHRange(rgeom_bounds, rcent_bounds, start() + N/2, N/2 + N%2), prims);
+       left_o  = BVHObjectBinning(BVHRange(lgeom_bounds, lcent_bounds, start(), N/2), prims);
+}
+
+CCL_NAMESPACE_END
+
diff --git a/intern/cycles/bvh/bvh_binning.h b/intern/cycles/bvh/bvh_binning.h
new file mode 100644 (file)
index 0000000..6074215
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Adapted from code copyright 2009-2011 Intel Corporation
+ * Modifications Copyright 2012, Blender Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __BVH_BINNING_H__
+#define __BVH_BINNING_H__
+
+#include "bvh_params.h"
+
+#include "util_types.h"
+
+CCL_NAMESPACE_BEGIN
+
+/* Single threaded object binner. Finds the split with the best SAH heuristic
+ * by testing for each dimension multiple partitionings for regular spaced
+ * partition locations. A partitioning for a partition location is computed,
+ * by putting primitives whose centroid is on the left and right of the split
+ * location to different sets. The SAH is evaluated by computing the number of
+ * blocks occupied by the primitives in the partitions. */
+
+class BVHObjectBinning : public BVHRange
+{
+public:
+       __forceinline BVHObjectBinning() {}
+       BVHObjectBinning(const BVHRange& job, BVHReference *prims);
+
+       void split(BVHReference *prims, BVHObjectBinning& left_o, BVHObjectBinning& right_o) const;
+
+       float splitSAH; /* SAH cost of the best split */
+       float leafSAH;  /* SAH cost of creating a leaf */
+
+protected:
+       int dim;                        /* best split dimension */
+       int pos;                        /* best split position */
+       size_t num_bins;        /* actual number of bins to use */
+       float3 scale;           /* scaling factor to compute bin */
+
+       enum { MAX_BINS = 32 };
+       enum { LOG_BLOCK_SIZE = 2 };
+
+       /* computes the bin numbers for each dimension for a box. */
+       __forceinline int4 get_bin(const BoundBox& box) const
+       {
+               int4 a = make_int4((box.center2() - cent_bounds().min)*scale - make_float3(0.5f));
+               int4 mn = make_int4(0);
+               int4 mx = make_int4((int)num_bins-1);
+
+               return clamp(a, mn, mx);
+       }
+
+       /* computes the bin numbers for each dimension for a point. */
+       __forceinline int4 get_bin(const float3& c) const
+       {
+               return make_int4((c - cent_bounds().min)*scale - make_float3(0.5f));
+       }
+
+       /* compute the number of blocks occupied for each dimension. */
+       __forceinline float4 blocks(const int4& a) const
+       {
+               return make_float4((a + make_int4((1 << LOG_BLOCK_SIZE)-1)) >> LOG_BLOCK_SIZE);
+       }
+
+       /* compute the number of blocks occupied in one dimension. */
+       __forceinline int blocks(size_t a) const
+       {
+               return (int)((a+((1LL << LOG_BLOCK_SIZE)-1)) >> LOG_BLOCK_SIZE);
+       }
+};
+
+CCL_NAMESPACE_END
+
+#endif
+
index 38674c2c5611da943387111de49ca47a7bc82ea3..c5b4f1d01ae94468ca4e99784d6856723d26f74a 100644 (file)
  * limitations under the License.
  */
 
+#include "bvh_binning.h"
 #include "bvh_build.h"
 #include "bvh_node.h"
 #include "bvh_params.h"
-#include "bvh_sort.h"
+#include "bvh_split.h"
 
 #include "mesh.h"
 #include "object.h"
 #include "scene.h"
 
-#include "util_algorithm.h"
+#include "util_debug.h"
 #include "util_foreach.h"
 #include "util_progress.h"
 #include "util_time.h"
 
 CCL_NAMESPACE_BEGIN
 
+/* BVH Build Task */
+
+class BVHBuildTask : public Task {
+public:
+       BVHBuildTask(InnerNode *node_, int child_, BVHObjectBinning& range_, int level_)
+       : node(node_), child(child_), level(level_), range(range_) {}
+
+       InnerNode *node;
+       int child;
+       int level;
+       BVHObjectBinning range;
+};
+
 /* Constructor / Destructor */
 
 BVHBuild::BVHBuild(const vector<Object*>& objects_,
@@ -41,10 +55,10 @@ BVHBuild::BVHBuild(const vector<Object*>& objects_,
   prim_object(prim_object_),
   params(params_),
   progress(progress_),
-  progress_start_time(0.0)
+  progress_start_time(0.0),
+  task_pool(function_bind(&BVHBuild::thread_build_node, this, _1, _2))
 {
        spatial_min_overlap = 0.0f;
-       progress_num_duplicates = 0;
 }
 
 BVHBuild::~BVHBuild()
@@ -53,57 +67,63 @@ BVHBuild::~BVHBuild()
 
 /* Adding References */
 
-void BVHBuild::add_reference_mesh(NodeSpec& root, Mesh *mesh, int i)
+void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
 {
        for(uint j = 0; j < mesh->triangles.size(); j++) {
                Mesh::Triangle t = mesh->triangles[j];
-               Reference ref;
+               BoundBox bounds = BoundBox::empty;
 
                for(int k = 0; k < 3; k++) {
                        float3 pt = mesh->verts[t.v[k]];
-                       ref.bounds.grow(pt);
+                       bounds.grow(pt);
                }
 
-               if(ref.bounds.valid()) {
-                       ref.prim_index = j;
-                       ref.prim_object = i;
-
-                       references.push_back(ref);
-                       root.bounds.grow(ref.bounds);
+               if(bounds.valid()) {
+                       references.push_back(BVHReference(bounds, j, i));
+                       root.grow(bounds);
+                       center.grow(bounds.center2());
                }
        }
 }
 
-void BVHBuild::add_reference_object(NodeSpec& root, Object *ob, int i)
+void BVHBuild::add_reference_object(BoundBox& root, BoundBox& center, Object *ob, int i)
 {
-       Reference ref;
-
-       ref.prim_index = -1;
-       ref.prim_object = i;
-       ref.bounds = ob->bounds;
-
-       references.push_back(ref);
-       root.bounds.grow(ref.bounds);
+       references.push_back(BVHReference(ob->bounds, -1, i));
+       root.grow(ob->bounds);
+       center.grow(ob->bounds.center2());
 }
 
-void BVHBuild::add_references(NodeSpec& root)
+void BVHBuild::add_references(BVHRange& root)
 {
-       /* init root spec */
-       root.num = 0;
-       root.bounds = BoundBox();
+       /* reserve space for references */
+       size_t num_alloc_references = 0;
+
+       foreach(Object *ob, objects) {
+               if(params.top_level) {
+                       if(ob->mesh->transform_applied)
+                               num_alloc_references += ob->mesh->triangles.size();
+                       else
+                               num_alloc_references++;
+               }
+               else
+                       num_alloc_references += ob->mesh->triangles.size();
+       }
+
+       references.reserve(num_alloc_references);
 
-       /* add objects */
+       /* add references from objects */
+       BoundBox bounds = BoundBox::empty, center = BoundBox::empty;
        int i = 0;
 
        foreach(Object *ob, objects) {
                if(params.top_level) {
                        if(ob->mesh->transform_applied)
-                               add_reference_mesh(root, ob->mesh, i);
+                               add_reference_mesh(bounds, center, ob->mesh, i);
                        else
-                               add_reference_object(root, ob, i);
+                               add_reference_object(bounds, center, ob, i);
                }
                else
-                       add_reference_mesh(root, ob->mesh, i);
+                       add_reference_mesh(bounds, center, ob->mesh, i);
 
                i++;
 
@@ -111,129 +131,213 @@ void BVHBuild::add_references(NodeSpec& root)
        }
 
        /* happens mostly on empty meshes */
-       if(!root.bounds.valid())
-               root.bounds.grow(make_float3(0.0f, 0.0f, 0.0f));
+       if(!bounds.valid())
+               bounds.grow(make_float3(0.0f, 0.0f, 0.0f));
 
-       root.num = references.size();
+       root = BVHRange(bounds, center, 0, references.size());
 }
 
 /* Build */
 
 BVHNode* BVHBuild::run()
 {
-       NodeSpec root;
+       BVHRange root;
 
        /* add references */
        add_references(root);
 
-       if(progress.get_cancel()) return NULL;
+       if(progress.get_cancel())
+               return NULL;
 
        /* init spatial splits */
        if(params.top_level) /* todo: get rid of this */
                params.use_spatial_split = false;
 
-       spatial_min_overlap = root.bounds.area() * params.spatial_split_alpha;
+       spatial_min_overlap = root.bounds().safe_area() * params.spatial_split_alpha;
        spatial_right_bounds.clear();
-       spatial_right_bounds.resize(max(root.num, (int)BVHParams::NUM_SPATIAL_BINS) - 1);
+       spatial_right_bounds.resize(max(root.size(), (int)BVHParams::NUM_SPATIAL_BINS) - 1);
 
        /* init progress updates */
-       progress_num_duplicates = 0;
        progress_start_time = time_dt();
+       progress_count = 0;
+       progress_total = references.size();
+       progress_original_total = progress_total;
+
+       prim_index.resize(references.size());
+       prim_object.resize(references.size());
 
        /* build recursively */
-       return build_node(root, 0, 0.0f, 1.0f);
+       BVHNode *rootnode;
+
+       if(params.use_spatial_split) {
+               /* singlethreaded spatial split build */
+               rootnode = build_node(root, 0);
+       }
+       else {
+               /* multithreaded binning build */
+               BVHObjectBinning rootbin(root, &references[0]);
+               rootnode = build_node(rootbin, 0);
+               task_pool.wait();
+       }
+
+       /* delete if we cancelled */
+       if(rootnode) {
+               if(progress.get_cancel()) {
+                       rootnode->deleteSubtree();
+                       rootnode = NULL;
+               }
+               else if(!params.use_spatial_split) {
+                       /*rotate(rootnode, 4, 5);*/
+                       rootnode->update_visibility();
+               }
+       }
+
+       return rootnode;
 }
 
-void BVHBuild::progress_update(float progress_start, float progress_end)
+void BVHBuild::progress_update()
 {
        if(time_dt() - progress_start_time < 0.25f)
                return;
+       
+       double progress_start = (double)progress_count/(double)progress_total;
+       double duplicates = (double)(progress_total - progress_original_total)/(double)progress_total;
 
-       float duplicates = (float)progress_num_duplicates/(float)references.size();
        string msg = string_printf("Building BVH %.0f%%, duplicates %.0f%%",
                progress_start*100.0f, duplicates*100.0f);
 
        progress.set_substatus(msg);
-       progress_start_time = time_dt();
+       progress_start_time = time_dt(); 
 }
 
-BVHNode* BVHBuild::build_node(const NodeSpec& spec, int level, float progress_start, float progress_end)
+void BVHBuild::thread_build_node(Task *task_, int thread_id)
 {
-       /* progress update */
-       progress_update(progress_start, progress_end);
-       if(progress.get_cancel()) return NULL;
+       if(progress.get_cancel())
+               return;
 
-       /* small enough or too deep => create leaf. */
-       if(spec.num <= params.min_leaf_size || level >= BVHParams::MAX_DEPTH)
-               return create_leaf_node(spec);
-
-       /* find split candidates. */
-       float area = spec.bounds.area();
-       float leafSAH = area * params.triangle_cost(spec.num);
-       float nodeSAH = area * params.node_cost(2);
-       ObjectSplit object = find_object_split(spec, nodeSAH);
-       SpatialSplit spatial;
-
-       if(params.use_spatial_split && level < BVHParams::MAX_SPATIAL_DEPTH) {
-               BoundBox overlap = object.left_bounds;
-               overlap.intersect(object.right_bounds);
-
-               if(overlap.area() >= spatial_min_overlap)
-                       spatial = find_spatial_split(spec, nodeSAH);
-       }
+       /* build nodes */
+       BVHBuildTask *task = (BVHBuildTask*)task_;
+       BVHNode *node = build_node(task->range, task->level);
+
+       /* set child in inner node */
+       task->node->children[task->child] = node;
 
-       /* leaf SAH is the lowest => create leaf. */
-       float minSAH = min(min(leafSAH, object.sah), spatial.sah);
+       /* update progress */
+       if(task->range.size() < THREAD_TASK_SIZE) {
+               /*rotate(node, INT_MAX, 5);*/
 
-       if(minSAH == leafSAH && spec.num <= params.max_leaf_size)
-               return create_leaf_node(spec);
+               thread_scoped_lock lock(build_mutex);
 
-       /* perform split. */
-       NodeSpec left, right;
+               progress_count += task->range.size();
+               progress_update();
+       }
+}
+
+/* multithreaded binning builder */
+BVHNode* BVHBuild::build_node(const BVHObjectBinning& range, int level)
+{
+       size_t size = range.size();
+       float leafSAH = params.sah_triangle_cost * range.leafSAH;
+       float splitSAH = params.sah_node_cost * range.bounds().half_area() + params.sah_triangle_cost * range.splitSAH;
 
-       if(params.use_spatial_split && minSAH == spatial.sah)
-               do_spatial_split(left, right, spec, spatial);
-       if(!left.num || !right.num)
-               do_object_split(left, right, spec, object);
+       /* make leaf node when threshold reached or SAH tells us */
+       if(params.small_enough_for_leaf(size, level) || (size <= params.max_leaf_size && leafSAH < splitSAH))
+               return create_leaf_node(range);
+
+       /* perform split */
+       BVHObjectBinning left, right;
+       range.split(&references[0], left, right);
 
        /* create inner node. */
-       progress_num_duplicates += left.num + right.num - spec.num;
+       InnerNode *inner;
 
-       float progress_mid = lerp(progress_start, progress_end, (float)right.num / (float)(left.num + right.num));
+       if(range.size() < THREAD_TASK_SIZE) {
+               /* local build */
+               BVHNode *leftnode = build_node(left, level + 1);
+               BVHNode *rightnode = build_node(right, level + 1);
 
-       BVHNode* rightNode = build_node(right, level + 1, progress_start, progress_mid);
-       if(progress.get_cancel()) {
-               if(rightNode) rightNode->deleteSubtree();
-               return NULL;
+               inner = new InnerNode(range.bounds(), leftnode, rightnode);
        }
+       else {
+               /* threaded build */
+               inner = new InnerNode(range.bounds());
+
+               task_pool.push(new BVHBuildTask(inner, 0, left, level + 1), true);
+               task_pool.push(new BVHBuildTask(inner, 1, right, level + 1), true);
+       }
+
+       return inner;
+}
 
-       BVHNode* leftNode = build_node(left, level + 1, progress_mid, progress_end);
-       if(progress.get_cancel()) {
-               if(leftNode) leftNode->deleteSubtree();
+/* single threaded spatial split builder */
+BVHNode* BVHBuild::build_node(const BVHRange& range, int level)
+{
+       /* progress update */
+       progress_update();
+       if(progress.get_cancel())
                return NULL;
+
+       /* small enough or too deep => create leaf. */
+       if(params.small_enough_for_leaf(range.size(), level)) {
+               progress_count += range.size();
+               return create_leaf_node(range);
+       }
+
+       /* splitting test */
+       BVHMixedSplit split(this, range, level);
+
+       if(split.no_split) {
+               progress_count += range.size();
+               return create_leaf_node(range);
        }
+       
+       /* do split */
+       BVHRange left, right;
+       split.split(this, left, right, range);
+
+       progress_total += left.size() + right.size() - range.size();
+       size_t total = progress_total;
+
+       /* leaft node */
+       BVHNode *leftnode = build_node(left, level + 1);
+
+       /* right node (modify start for splits) */
+       right.set_start(right.start() + progress_total - total);
+       BVHNode *rightnode = build_node(right, level + 1);
 
-       return new InnerNode(spec.bounds, leftNode, rightNode);
+       /* inner node */
+       return new InnerNode(range.bounds(), leftnode, rightnode);
 }
 
-BVHNode *BVHBuild::create_object_leaf_nodes(const Reference *ref, int num)
+/* Create Nodes */
+
+BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start, int num)
 {
        if(num == 0) {
-               BoundBox bounds;
+               BoundBox bounds = BoundBox::empty;
                return new LeafNode(bounds, 0, 0, 0);
        }
        else if(num == 1) {
-               prim_index.push_back(ref[0].prim_index);
-               prim_object.push_back(ref[0].prim_object);
-               uint visibility = objects[ref[0].prim_object]->visibility;
-               return new LeafNode(ref[0].bounds, visibility, prim_index.size()-1, prim_index.size());
+               if(start == prim_index.size()) {
+                       assert(params.use_spatial_split);
+
+                       prim_index.push_back(ref->prim_index());
+                       prim_object.push_back(ref->prim_object());
+               }
+               else {
+                       prim_index[start] = ref->prim_index();
+                       prim_object[start] = ref->prim_object();
+               }
+
+               uint visibility = objects[ref->prim_object()]->visibility;
+               return new LeafNode(ref->bounds(), visibility, start, start+1);
        }
        else {
                int mid = num/2;
-               BVHNode *leaf0 = create_object_leaf_nodes(ref, mid); 
-               BVHNode *leaf1 = create_object_leaf_nodes(ref+mid, num-mid); 
+               BVHNode *leaf0 = create_object_leaf_nodes(ref, start, mid); 
+               BVHNode *leaf1 = create_object_leaf_nodes(ref+mid, start+mid, num-mid); 
 
-               BoundBox bounds;
+               BoundBox bounds = BoundBox::empty;
                bounds.grow(leaf0->m_bounds);
                bounds.grow(leaf1->m_bounds);
 
@@ -241,310 +345,136 @@ BVHNode *BVHBuild::create_object_leaf_nodes(const Reference *ref, int num)
        }
 }
 
-BVHNode* BVHBuild::create_leaf_node(const NodeSpec& spec)
+BVHNode* BVHBuild::create_leaf_node(const BVHRange& range)
 {
        vector<int>& p_index = prim_index;
        vector<int>& p_object = prim_object;
-       BoundBox bounds;
-       int num = 0;
+       BoundBox bounds = BoundBox::empty;
+       int num = 0, ob_num = 0;
        uint visibility = 0;
 
-       for(int i = 0; i < spec.num; i++) {
-               if(references.back().prim_index != -1) {
-                       p_index.push_back(references.back().prim_index);
-                       p_object.push_back(references.back().prim_object);
-                       bounds.grow(references.back().bounds);
-                       visibility |= objects[references.back().prim_object]->visibility;
-                       references.pop_back();
+       for(int i = 0; i < range.size(); i++) {
+               BVHReference& ref = references[range.start() + i];
+
+               if(ref.prim_index() != -1) {
+                       if(range.start() + num == prim_index.size()) {
+                               assert(params.use_spatial_split);
+
+                               p_index.push_back(ref.prim_index());
+                               p_object.push_back(ref.prim_object());
+                       }
+                       else {
+                               p_index[range.start() + num] = ref.prim_index();
+                               p_object[range.start() + num] = ref.prim_object();
+                       }
+
+                       bounds.grow(ref.bounds());
+                       visibility |= objects[ref.prim_object()]->visibility;
                        num++;
                }
+               else {
+                       if(ob_num < i)
+                               references[range.start() + ob_num] = ref;
+                       ob_num++;
+               }
        }
 
        BVHNode *leaf = NULL;
        
        if(num > 0) {
-               leaf = new LeafNode(bounds, visibility, p_index.size() - num, p_index.size());
+               leaf = new LeafNode(bounds, visibility, range.start(), range.start() + num);
 
-               if(num == spec.num)
+               if(num == range.size())
                        return leaf;
        }
 
        /* while there may be multiple triangles in a leaf, for object primitives
-        * we want them to be the only one, so we  */
-       int ob_num = spec.num - num;
-       const Reference *ref = (ob_num)? &references.back() - (ob_num - 1): NULL;
-       BVHNode *oleaf = create_object_leaf_nodes(ref, ob_num);
-       for(int i = 0; i < ob_num; i++)
-               references.pop_back();
+        * we want there to be the only one, so we keep splitting */
+       const BVHReference *ref = (ob_num)? &references[range.start()]: NULL;
+       BVHNode *oleaf = create_object_leaf_nodes(ref, range.start() + num, ob_num);
        
        if(leaf)
-               return new InnerNode(spec.bounds, leaf, oleaf);
+               return new InnerNode(range.bounds(), leaf, oleaf);
        else
                return oleaf;
 }
 
-/* Object Split */
+/* Tree Rotations */
 
-BVHBuild::ObjectSplit BVHBuild::find_object_split(const NodeSpec& spec, float nodeSAH)
+void BVHBuild::rotate(BVHNode *node, int max_depth, int iterations)
 {
-       ObjectSplit split;
-       const Reference *ref_ptr = &references[references.size() - spec.num];
-
-       for(int dim = 0; dim < 3; dim++) {
-               /* sort references */
-               bvh_reference_sort(references.size() - spec.num, references.size(), &references[0], dim);
-
-               /* sweep right to left and determine bounds. */
-               BoundBox right_bounds;
-
-               for(int i = spec.num - 1; i > 0; i--) {
-                       right_bounds.grow(ref_ptr[i].bounds);
-                       spatial_right_bounds[i - 1] = right_bounds;
-               }
-
-               /* sweep left to right and select lowest SAH. */
-               BoundBox left_bounds;
-
-               for(int i = 1; i < spec.num; i++) {
-                       left_bounds.grow(ref_ptr[i - 1].bounds);
-                       right_bounds = spatial_right_bounds[i - 1];
-
-                       float sah = nodeSAH +
-                               left_bounds.area() * params.triangle_cost(i) +
-                               right_bounds.area() * params.triangle_cost(spec.num - i);
-
-                       if(sah < split.sah) {
-                               split.sah = sah;
-                               split.dim = dim;
-                               split.num_left = i;
-                               split.left_bounds = left_bounds;
-                               split.right_bounds = right_bounds;
-                       }
-               }
-       }
-
-       return split;
+       /* in tested scenes, this resulted in slightly slower raytracing, so disabled
+        * it for now. could be implementation bug, or depend on the scene */
+       if(node)
+               for(int i = 0; i < iterations; i++)
+                       rotate(node, max_depth);
 }
 
-void BVHBuild::do_object_split(NodeSpec& left, NodeSpec& right, const NodeSpec& spec, const ObjectSplit& split)
+void BVHBuild::rotate(BVHNode *node, int max_depth)
 {
-       /* sort references according to split */
-       int start = references.size() - spec.num;
-       int end = references.size(); /* todo: is this right? */
-
-       bvh_reference_sort(start, end, &references[0], split.dim);
-
-       /* split node specs */
-       left.num = split.num_left;
-       left.bounds = split.left_bounds;
-       right.num = spec.num - split.num_left;
-       right.bounds = split.right_bounds;
-}
-
-/* Spatial Split */
-
-BVHBuild::SpatialSplit BVHBuild::find_spatial_split(const NodeSpec& spec, float nodeSAH)
-{
-       /* initialize bins. */
-       float3 origin = spec.bounds.min;
-       float3 binSize = (spec.bounds.max - origin) * (1.0f / (float)BVHParams::NUM_SPATIAL_BINS);
-       float3 invBinSize = 1.0f / binSize;
-
-       for(int dim = 0; dim < 3; dim++) {
-               for(int i = 0; i < BVHParams::NUM_SPATIAL_BINS; i++) {
-                       SpatialBin& bin = spatial_bins[dim][i];
-
-                       bin.bounds = BoundBox();
-                       bin.enter = 0;
-                       bin.exit = 0;
-               }
-       }
-
-       /* chop references into bins. */
-       for(unsigned int refIdx = references.size() - spec.num; refIdx < references.size(); refIdx++) {
-               const Reference& ref = references[refIdx];
-               float3 firstBinf = (ref.bounds.min - origin) * invBinSize;
-               f