1
1

Compare commits

...

1908 Commits

Author SHA1 Message Date
32b13c13af fix typo in last commit 2008-09-22 00:00:38 +00:00
9f802038b6 This should convert branch fluidcontrol files to trunk compatible ones 2008-09-21 23:50:36 +00:00
518b8fe018 svn merge -r 16593:16648 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-21 13:03:39 +00:00
92829e821f Bugfix #17656
- Changed order for applying atmosphere, it does it now before alpha-adding
  sky, giving correct transparency
- Added correction for de-premulling and premulling scatter color
2008-09-21 12:03:41 +00:00
f7a5288111 #bugfix #17337
FSA didn't work for atmosphere option.
2008-09-21 10:31:22 +00:00
a9988317c9 Added select grouped property (objects with shared property names will be selected)
(updated select group toolbox and header menu)

Added 2 copy property options - Replace All and Merge All, since there was no way to remove all properties, or set all objects game properties to be the same as the active objects.
Added set_ob_property(ob, prop) to property api.

bugfix in python api, copyAllPropertiesTo, it didnt check for duplicates or that it wasnt copying from/to the same object.
2008-09-21 10:12:33 +00:00
e11cd5a962 game engine now compiles with SDL disabled. CDROM and Joystick wont function in this case 2008-09-21 05:38:28 +00:00
2064f5542a set the visibility state based on the objects render option in the outliner.
- saves adding UV's to faces just to set the invisibility option or having an logic bricks to set the visibility state.
2008-09-21 04:39:40 +00:00
deba5ab9a7 encountered some issue with the btDbvtBroadphase, switch of a deferred collision feature. 2008-09-21 01:13:54 +00:00
2941f755f7 attempt to support negative local scaling for convex hull, box,sphere, cylinder, cone and btScaledBvhTriangleMeshShape in Bullet. 2008-09-20 23:45:45 +00:00
877d70b14a fixed sphere-sphere collision: contact points were not properly removed/refreshed. 2008-09-20 22:34:54 +00:00
a72b65011e BGE bug fix: dupligroup scale not correctly applied to bullet shape. 2008-09-20 22:19:59 +00:00
22a50402ef BGE patch: allow Bullet mesh shape sharing for objects copied with ALT-D. 2008-09-20 21:33:54 +00:00
768e12a064 Patch #17631 by Early Ehlinger
His log:
One of the calls to PIL_dynlib_get_error_as_string was assuming that 
it would return a valid string and not NULL (perhaps by converting
to std::string).
This patch simply changes it to always return a string, even when the 
error is not recognized.
2008-09-20 14:43:59 +00:00
0a364788c1 simple changes for bez point selection. use as a flag incase other flags are stored in bezt->f1,2,3 2008-09-20 13:21:10 +00:00
2bd6e1ae82 Patch #8461, by Rob Hausauer
This unifies all usage of FTOCHAR, putting it in utildefines.h
Submitter did several interesting tests for speed, check it here:
http://projects.blender.org/tracker/?func=detail&atid=127&aid=8461&group_id=9
2008-09-20 13:02:06 +00:00
63f10e6b55 Patch 17403, small gcc warning fixes. 2008-09-20 12:28:01 +00:00
9b9edad6b6 Patch 17403, small gcc warning fixes. 2008-09-20 12:26:18 +00:00
3dbdd8939b 16624 was incorrect. Blender wont always give the requested name for new datablocks or for renaming. scripts need to account for this. 2008-09-20 11:54:27 +00:00
f510057fef [#17600] char* -> const char*
Thanks to Sean Bartell (wtachi), was causing many many warnings which distracted from the real problems.
2008-09-20 11:08:35 +00:00
a12375cb4f PyAPI - *.insertkey()
Updated insertkey calls in PyAPI so that they behave like the new common_insertkey() behaviour.
2008-09-20 10:30:10 +00:00
224607982a Python api access to obcolor
Option to copy obcolor in the copy menu
Option to select same color in select grouped menu
console.py - mistake in last commit caused a python error
2008-09-20 10:11:42 +00:00
c282178411 Patch #17654: Fix for Scene.Get with input >20 chars
Patch by Darryl Pogue (paradox).

Blender cuts off datablock names at 20 chars, which causes issues if you're trying to access Scenes with a string longer
than 20 chars.

Ex.

s = 'GuildPub-Writers_GLOBAL'
Blender.Scene.New(s) #This creates the scene "GuildPub-Writers_GLOB"
Blender.Scene.Get(s) #This throws an error: the name and the string don't match

This patch cuts down the input of Scene.Get() to the 20 char limits, thus making the the above example return the correct
scene.
2008-09-20 10:10:50 +00:00
e7c62e9038 Bugfix #17652: "K" mode for controlling keys and drivers cause crashes
When using a transform and there didn't exist an IPO-channel for that transform's focus (i.e. no rot curves when rotating) and "K" mode was active, there would be a crash due to missing checks for such situations.
2008-09-20 10:02:13 +00:00
415868b5e2 Fix for gcc compiler warning about a call to do_lamp_tex() resulting in "overflow in implicit constant conversion" 2008-09-20 09:17:40 +00:00
4d551c0a0d Text.c
- calling Text_reset within C/Api funcs didnt decref the Py_None Text_reset returned.
 - Text_delete wasnt checking if the input was an int.
 - a number of functions wernt checking if the text was removed.
console.py
 - added clear output
 - command history leaves empty command before wrapping
 - add imports as dummy user input so commands written to a text file will run.
 - faster writing of output to a textblock.
2008-09-20 04:37:10 +00:00
5f3c4edb8f == Outliner ==
Commit patch #8195

New outliner mode: Sequence, it's show all the sequence and strip that
we have in the outliner, split it for type (particle, sound and so on..).

Some notes to take care:
 * The strip can be selected with LMB
 * The sequence can be deleted with XKEY (all the selected)
 * The "Meta" are stored in a single tree (Meta Strip)
   with all the sequence.
 * Duplicate sequence (with the same name) are store in a single tree
   and you can select all the Sequence with LMB in the "root" entry.
 * Also show the directory path.

[ As Ton point in the tracker, still need more work (and options, Luca made
  a really good list in the tracker), so move to the trunk and start
  working here, probably a good topic for next meeting. ]
2008-09-19 22:51:05 +00:00
a15296eff6 Small dependency debugging aid: now it also prints cycles for
the object depsgrah instead of only armatures.
2008-09-19 22:03:16 +00:00
4f737bafa7 == Render ==
Commit patch #7788, allow to set the render step, so it's
possible make render every N frames only.

The step is change in Scene buttons (F10), below start and
end frame buttons.

Also add a command line options (-j), so it's possible to
overwrite the file step (useful for renderfarm).

[ Brecht, this work with OpenGL renders and simulated
  the skipped frames, please double check ]
2008-09-19 21:57:15 +00:00
650ae3b4e6 Fix for bug #16662: modifiers on lattices were ignored sometimes
when rendering opengl previews, it unnecessarily cleared lattice
displists when it was really intended for shaded mode colors.
2008-09-19 21:52:15 +00:00
Ken Hughes
4693a5af48 Linux platforms
---------------
Patch to include freedesktop icons in linux release builds, contributed by
Ralf Hölzemer (cheleb).
2008-09-19 21:00:45 +00:00
a44177a401 BGE patch: new 'Advanced Settings' button to keep special Bullet options away from main UI.
Three features that were on the main UI interface are now 
moved to the Advanced Settings panel:
Margin, Actor (that becomes Sensor Actor) and No sleeping.

Sensor Actor is now a feature: it can be turned on and off
for all types of objects, and not just static objects.
Select the Sensor Actor button to make the object visible
to Near and Radar sensor.
The button is selected by default for dynamic objects
and unselected by default for static objects, to match
previous behavior.
2008-09-19 20:41:38 +00:00
00ed5a2cc9 Patch #17348 by Roger Wickes
Fix in Bake Constraints script, better naming for new object.
2008-09-19 20:22:54 +00:00
905983229a == Python Space Handlers ==
Patch #9673: "Short patch to make spacehandler event scripts work more like normal python gui script handlers" by Steven Truppe:
http://projects.blender.org/tracker/?func=detail&atid=127&aid=9673&group_id=9

This patch adds the Blender.eventValue variable available for space handlers, holding the event value (aka 1 for button and key presses, X or Y coordinate for mousex / mousey movement). Thanks, Steven. PS: this doesn't break existing scripts.
2008-09-19 18:53:05 +00:00
0f6fc0b207 Fix again for the NVidia driver bug. This time I'm just giving up
using linking together the precompiled library shader code and
material code and recompiling it all again for each material even
if it gives a performance hit, since the previous workaround only
worked on some driver versions still.
2008-09-19 16:09:26 +00:00
65ddef19b9 Patch #13422, By Roland Hess, Shadow Color
Finally, after a long time new render candy for the non-game peoples! :)

Good doc is here: (url splits in two)
http://www.harkyman.com/2008/08/06/controllable-shadow-intensity-
and-color/

Note the colorpicker for shadow is in "Shadow and Spot" panel. A bit
hidden, could get more attention. For later. :)
2008-09-19 16:01:22 +00:00
a0504ac922 Patch #8213 by Shunichi Fuji
Fixes crash with FT fonts in some cases, just removed unnused line of code.
2008-09-19 14:18:41 +00:00
6f9a254d61 PyConstraints:
Basic (non-python) target evaluation still occurs when scriptlinks are disabled.
2008-09-19 12:43:21 +00:00
ef8a1dccc7 Bugfix #17643: Action Editor buffer copy/paste not working
Removed superfluous check for destination IPO-block/IPO-curve which may not have existed. This meant that pasting keyframes into an "empty" Action Channel sometimes failed.
2008-09-19 12:41:26 +00:00
9c27e097df == IPO Defines Cleanup ==
Just a bit of tidyup for IPO header-files. 

Warning:
Moved IPO Curves + Drivers out of DNA_curve_types.h
2008-09-19 12:33:17 +00:00
15bce017df scons update, BF_NO_ELBEEM wasnt working, WITH_BF_SDL wasnt implimented, WITH_CCGSUBSURF isnt used anymore. 2008-09-19 01:39:34 +00:00
6ff74f4527 == Python Script Links ==
Bug #17599:
Summary: Python constraints, good in 2.46 not working anymore in 2.47
http://projects.blender.org/tracker/?func=detail&atid=125&aid=17599&group_id=9

Improved my old hack to avoid frame changed scriptlinks from running when rendering stills, should fix this bug. It also causes REDRAW scriptlinks to be executed during renders, but that conforms to how FRAMECHANGED ones work.

BTW: this can still be improved. The current system meant to disable all Python functionality at once needs imo to be replaced by one that allows to enable / disable per feature (scriptlinks, pyconstraints, pynodes, etc.). A better way to inform scriptlinks about what is going on (render, anim, render anim, etc.) would also help. Will discuss with others.
2008-09-18 22:33:49 +00:00
ec6bd008c1 fixing scons build. needed BoolOption in argument definition 2008-09-18 21:18:53 +00:00
5f25e52c20 [#7297] Fix knife visualization on MacMini Intel w/ Intel gfx 2008-09-18 20:37:11 +00:00
02a91ac784 BGE patch: change constraint location actuator to work in local coordinates. It won't change anything for root objects but will be of some use for child objects. 2008-09-18 19:28:28 +00:00
a283e7e4af A typo in my fix for bug #11740 caused problems with at least grid distributed particles. 2008-09-18 17:42:17 +00:00
f7113fd267 Reactor particles were born with incorrect timing. Some changes made could effect normal particles too, but after many tests I didn't notice any adverse effects. Be sure to poke me hard if there are some though :) 2008-09-18 17:19:40 +00:00
6b7b812208 This file did not compile, but is also not part of the build target...
Fixed neverheless, patch #6258 from Early Ehlinger
2008-09-18 16:43:31 +00:00
fc312fae98 svn merge -r 16454:16593 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-18 14:59:44 +00:00
423b053904 Grease Pencil - Stroke Sensitivity:
Sensitivity to mouse movement when drawing can now be customised in the User Prefs, under 'Edit Methods'.
2008-09-18 11:49:57 +00:00
8d1163c639 scons options BF_CXX, WITH_BF_STATICCXX, BF_CXX_LIB_STATIC for static linking to stdc++ because of problems running blender on some systems. 2008-09-18 03:05:02 +00:00
beb7738a29 Hopefully fixes crash in particle system with effector enabled 2008-09-18 01:55:43 +00:00
0a7767d597 Fix for bug #3858: the game engine mouse focus sensor did not work
correct if there was more than one camera. It shoots rays from the
active camera, but used the viewport from whichever camera was drawn
last, now it uses the correct vieport.
2008-09-18 01:46:28 +00:00
3bf0a6fed8 This adds support for the new-ish options:
QUATERNION
B_BONE_REST
INVERT_VERTGROUP
MULTIMODIFIER

to the bpy armature modifier API.

It also fixes a significant problem - In the docs, it refers to 
the 'VERTGROUP' field as being a string value, shared
by lattice, armature, etc, referring to the 'VGroup' field in the 
armature modifier that defines a vertex group 'mask'
which the armature's effect is restricted to.

However, previously, for some very mistaken reason, in processing 
the getters/setters for the armature modifier, the
VERTGROUP field was pointing to the quite different 'Vert. Groups' 
toggle in the armature modifier, that enables or
disables using vertex groups for deformation (as opposed to 
envelopes).

I've fixed this, so VERTGROUP points to the VGroup string, as is 
already defined in the docs and consistent with other
modifiers like Lattice. A new field: 'VGROUPS' has been added, 
which is the analog to the 'Vert Groups' toggle.
2008-09-18 00:51:51 +00:00
7e6c1e1091 needed these changes to get bullet building with cmake and linking with scons 2008-09-18 00:10:12 +00:00
067a890d82 BGE bug #17578: repair linV actuator in Add+Local mode. 2008-09-17 21:47:05 +00:00
0c1ec934c6 Update MSVC project file to include BulletSoftBody 2008-09-17 21:14:48 +00:00
80f22a9e60 added another missing file, btHashMap 2008-09-17 20:02:20 +00:00
8b73f35141 added src/LinearMath/btConvexHull.cpp 2008-09-17 19:58:16 +00:00
015a42079c Please add extern/bullet2/src/LinearMath/btConvexHull.cpp to your build system!
Reverted back to original Bullet version.
2008-09-17 19:47:26 +00:00
0a6d2e26a9 Fix for [#17642] Particule Hair - Vertex Group lenght don't works without Children
- This feature had been removed from the code! So this is how things work now:
For normal (non-child) hair particles the length vgroup is used if we're not in particle edit mode and if there are no child particles. So for example checking "Parents" in the visualization panel when children are in use will result in full length parent strands, this is a feature so that you can see how the parent's go to predict child behavior better, not a bug :)
2008-09-17 19:29:44 +00:00
0a43036701 Fix for [#17637] Children from "Faces" in Object without a face leads to crash
- a simple check for psys->child was missing
2008-09-17 17:59:29 +00:00
3ecbcb5848 Bugfix #14412
Outliner option 'unlink group' didn't remove its members, in case the
group members were local in file, a confusing situation happened. Now
it removes members.
2008-09-17 17:47:59 +00:00
b4e4ffc0b8 Fix for bug #17634: crash on automatically removing zero size window. 2008-09-17 16:59:52 +00:00
2b6aea2009 Added BulletSoftBody as target for Makefile installing of .h files 2008-09-17 11:31:03 +00:00
bbdcd3a082 rev 16569 broke building.
Looks like bullets Extras/ConvexDecomposition is missing from blenders source.
comment functions so it builds for now.
2008-09-17 11:23:28 +00:00
f0e0e6b1c9 * Some tweaks to the OBJ importer/exporter after chatting with Campbell
- renamed the 'morph target' option to 'keep vertex order'
- enabled 'keep vertex order' by default

This should improve usability for importing and exporting shape keys, point caches, mdds ,etc.
2008-09-17 04:07:58 +00:00
36e2004fca Delete Keyframe Tool:
* Changed hotkey to Alt-I. As a result, Remove IK is now Ctrl-Alt-I, though that shouldn't affect many people at all as it appears that hardly anyone uses it.

* Added menu entries for Delete Keyframe
2008-09-17 04:06:59 +00:00
4cd85aa61c Texture_getHFracDim was returning an int rather then a float (thanks zuegs for spotting)
removed unused var
2008-09-17 03:13:15 +00:00
651c0e4861 Applied some fixes from Bullet: issues with btDbvtBroadphase, and btSoftBody, and better fix for 64-bit issue in btCompoundCollisionAlgorithm. 2008-09-17 02:30:19 +00:00
ae418491dc Preparation for real-time soft bodies for the game engine, step 1 out of 3. This should be harmless/non-intrusive.
Please make sure each build system include extern/bullet2/src/BulletSoftBody/* and extern/bullet2/src/LinearMath/btConvexHull.*
2008-09-17 01:49:47 +00:00
9064ed8d6a Fix for bug #4192: game engine armatures that are dynamically added
but don't have an action got the pose of already added armatures, even
though they're not related. This also fixes an issue where the armature
in Blender would end up in the pose from the game after ESC, removes
unneeded copies made during armature evaluation, and also solves the
constraint copying hack.
2008-09-17 01:29:54 +00:00
9b7d40dbae BGE patch: bullet buttons UI change after discussion with Erwin: use a drop down instead of a series of buttons. Introduction of soft body option. 2008-09-16 22:52:42 +00:00
Nathan Letwory
73c8d76ba4 * make BulletSoftBody own small lib to make sure bullet libs don't grow too large for our beloved scons/mingw users. 2008-09-16 21:23:56 +00:00
0cae815127 Fix for [#17561] when i try to change the particle to hair I cant choose group or object as viz.
-Partly reverted Genscher's previous fix on the issue and added the idea he had as a special case
2008-09-16 21:16:32 +00:00
73fd800077 Fix for bug #5413: game engine armature actions and shapes keys
didn't work correct with scene suspend/resume, now works the same
as IPO's.
2008-09-16 21:11:38 +00:00
0c77a178da add BulletSoftBody to SConscript and Makefile 2008-09-16 21:09:24 +00:00
5941411839 add src/BulletSoftBody/* to cmake (other build systems also will need to do this soon) 2008-09-16 20:52:38 +00:00
99cd0dd5d5 Fix bug that broke editing vertices through python in the game engine. 2008-09-16 19:28:54 +00:00
c6d0be2a99 Fix (harmless) error print about GameLogic.globalDict being lost. Also
fixed some memory leaks in this code and simplified it.
2008-09-16 19:25:35 +00:00
75685a9ca8 == Transform Snap ==
Tighten test for excluding objects as snap target.

Now exclude all object that are themselves moving (that includes childs of selected objects) as well as objects with moving geometry (like hooked meshes).

The previous situation would cause unfrequent bugs, but especially present in alignment cases (those concerned will understand).
2008-09-16 19:10:58 +00:00
0922ecee93 "Fix" for #17636 Crashing bug - won't open a file
- The cause was indeed corrupted particle settings which should have caused a deletion of the whole particle system. However the particle modifier was still left and that led to the crash.
- A "fix" because there's really no way of knowing what caused the corruption of the particle settings. If anyone else gets this and can recreate I'd love to get a .blend. Now that there shouldn't be a crash anymore the symptom will be a missing particle system after file load in an object that had a particle system before.
2008-09-16 18:40:54 +00:00
80458f69b2 Added check for failing linking of a ID_PA block. 2008-09-16 16:20:51 +00:00
8cd673fdfb Bugfix #17633
Tiny feature: "Flip normals" in editmode also recalculates vertex normals.
2008-09-16 15:28:07 +00:00
7350d71b66 Bugfix #17630: objects are disappearing if you insert a layer key and then change time
Forgot to set type of data for inserting keyframes, so data was probably written as float or so.
2008-09-16 06:55:15 +00:00
18cda1583d Bugfix #17622: clicking on action IPO in outliner causes crash
In some cases, no action channels existed, but yet the Outliner displayed some that, when clicked on, would cause a crash.
2008-09-16 06:33:59 +00:00
0f39be9ce8 added static openal and openexr options for scons.
also added a target 'blenderlite' - turns almost everything off, compressed binary is ~3.4meg
2008-09-16 06:31:55 +00:00
5df9b4938e Bugfix #17627: Autokeyframe for Visual keying
Several months old typo! 'Visual keying' was not working for autokeyframing, as the test for it didn't even work.
2008-09-16 06:11:02 +00:00
9031ef3e87 Fix for bug #12028: background rendering on Mac OS X without
a window manager did not work anymore since 2.46.
2008-09-16 02:58:33 +00:00
4683cb34e4 Fix for #17618 Particles: changing RGB sliders snap back
-particle drawing was reading material ipos in a too invasive way
2008-09-15 22:08:30 +00:00
f807d3f303 BGE bug #17565 fixed: Constraint Actuator Location: GUI broken. Axis selection was not persistent, now it is. 2008-09-15 21:37:27 +00:00
95afafb5e5 BGE bug #17621 fixed: State Actuator GUI Flaw. State actuator didn't behave like the object state mask. Now it works the same: LMB select one state, deselects all others, multiple select with SHIFT-LMB 2008-09-15 21:10:51 +00:00
aae506aea7 Small fix in GHOST X11 system.
* Fix and a little of cleanup to the full screen, minimzed and
  maximized code.

* Fix bad argument in the ClientMessage event to support the
  _NET_ACTIVE_WINDOW property.

* Fix focus problem in some WM (like TWM), this is because Blender
  don't set the WM_PROTOCOLS list, now it does, a very basic list
  but it's what we need now.
2008-09-15 18:23:34 +00:00
35c269e395 Workaround for an Nvidia driver bug on 32 bit linux (maybe windows too).
I reversed the order of attaching shader objects for linking to solve an
issue in the driver before, but now it appears it needs to be the other
way around again? I don't know if these are the same cards that now want
it different again due to changes in the glsl code, but I found another
workaround for the first bug in a forum post (leaving out parameter names
in the declarations), so with some luck both cases work?

http://developer.nvidia.com/forums/index.php?showtopic=596
2008-09-15 18:15:11 +00:00
cffba77f50 Small tweak to get things compiling again.
Kent
2008-09-15 15:58:50 +00:00
dc2594c81b Added -d debug option for blenderplayer, and remove some
invalid/unnecessary opengl calls on shader errors.
2008-09-15 12:40:17 +00:00
fd3a40a129 Fix glsl vertex shader string that was not 0 terminated, no idea
if it caused any problems.
2008-09-15 11:39:49 +00:00
e5ce1e962d copy menu didnt copy visible and initial states, physics margin was also missing from "all physical attributes" option 2008-09-15 09:24:54 +00:00
a08b21263e tooltip improvements from dfelinto, some minor edits 2008-09-15 09:08:36 +00:00
ec30a3a470 Delete Key Tool - Bugfixes:
* Available option would crash
* 'Visual' options are now not available for this tool (are not relevant)
2008-09-15 04:15:37 +00:00
89721ec4de replaced static make_absolute_filename with BLI_convertstringcwd 2008-09-15 02:18:37 +00:00
ac86c04401 added BLI_convertstringcwd, used so command line blendfiles and python scripts can be relative to the current path.
- was alredy doing this for blendfiles, but better to have in its own function.

header_text.c - renamed PATH_MAX, was defined by system includes.
2008-09-15 01:32:53 +00:00
2c31cc4503 Fix for bug #17620: the motion blur actuator did not work correct
with an always sensor, it kept resettting the motion blur each frame.
2008-09-15 00:57:11 +00:00
a24960daa8 Fix for bug #4859: once a visibility actuator was set it was not
possible to change the visibility again through python for example.
This is because the actuator kept setting the visibility again each
frame, as a workaround for there being no separate visible and
viewport culling flag, but that was added some time ago.
2008-09-15 00:34:43 +00:00
3b153f887a Fix zoom level and clipping to be consistent with the viewport
when pressing P without a camera active, now it should match
the view exactly.

Fix an issue when setting a camera with an actuator and being
in orthographic mode in the viewport without an active camera,
it used a strange mix of the set camera and the viewport then.
2008-09-15 00:11:30 +00:00
f554f14329 Fix for bug #17617: GLSL shaders change vertex color unexpectedly. 2008-09-14 21:31:07 +00:00
41a0b56b70 BGE patch: new Physics button and margin parameter in Logic panel. Change subversion.
The Physics button controls the creation of a physics representation 
of the object when starting the game. If the button is not selected,
the object is a pure graphical object with no physics representation
and all the other physics buttons are hidden.
Selecting this button gives access to the usual physics buttons.
The physics button is enabled by default to match previous Blender
behavior.

The margin parameter allows to control the collision margin from
the UI. Previously, this parameter was only accessible through 
Python. By default, the collision margin is set to 0.0 on static 
objects and 0.06 on dynamic objects. 
To maintain compatibility with older games, the collision margin
is set to 0.06 on all objects when loading older blend file.

Note about the collision algorithms in Bullet 2.71
--------------------------------------------------
Bullet 2.71 handles the collision margin differently than Bullet 2.53
(the previous Bullet version in Blender). The collision margin is 
now kept "inside" the object for box, sphere and cylinder bound 
shapes. This means that two objects bound to any of these shape will
come in close contact when colliding. 
The static mesh, convex hull and cone shapes still have their
collision margin "outside" the object, which leaves a space of 1
or 2 times the collision margin between objects. 

The situation with Bullet 2.53 was more complicated, generally
leading to more space between objects, except for box-box collisions. 

This means that running a old game under Bullet 2.71 may cause
visual problems, especially if the objects are small. You can fix
these problems by changing some visual aspect of the objects: 
center, shape, size, position of children, etc.
2008-09-14 19:34:06 +00:00
7762100fcb Update MSVC project and fix compilation problem in VS2003 with keyframing.c 2008-09-14 19:07:57 +00:00
59b202fc32 Fix a game engine crash with mesh objects parented to an armature
without vertex groups.
2008-09-14 17:59:22 +00:00
0ad48b7332 scons option for linking python statically - useful for building a more compatible blenderplayer, where most games python scripts only use builtin modules anyway. 2008-09-14 17:56:15 +00:00
9444b314db fix for what looks like simple mistake, function wasnt returning any values (compiler warning) and the variable being checked to return a value was never assigned. 2008-09-14 17:19:59 +00:00
2eb8eb4e7e Bugfix: avoid crash with too long pathname. 2008-09-14 16:22:03 +00:00
Ken Hughes
6977816ff3 Python API
----------
Fix C90 mixed declarations and code.
2008-09-14 14:17:44 +00:00
4245aaed86 == Global 'Delete Key' Tool ==
The 'opposite' of the "Insert Key" tool. 
- Use the hotkey Ctrl-Alt-IKEY to activate.
- Only available in 3d-view and buttons window 

I've added an extra var to verify_ipo and verify_ipocurve to save having to make another duplicate of that code. Hopefully the gameengine compiles ok with this.
2008-09-14 12:41:42 +00:00
2bf26b93e1 Bugfix #17608
Fileselect window:
Pressing X to remove a file should not work in databrowse view.
2008-09-14 09:09:10 +00:00
375a6bbe41 More bugfixes:
* Added missing includes
* Fixed typos in header
* Added code to get ipo for 'Available' keyingsets to work
2008-09-14 05:52:57 +00:00
b25d0cc5cc game engine didnt compile with recent keyframing changes 2008-09-14 05:42:05 +00:00
1a917f50a6 running scripts in background mode would crash in some cases. (tested all scripts, none segfault now) 2008-09-14 05:10:45 +00:00
0f1a1a159f == Keyframing - Cleanup of API ==
* Moved all keyframing functions to their own file (keyframing.c)

* Merged all the different keyframing options (needed, visual, fast) into a single API call. The direct benefit of this is that it allows them to be used in conjunction with each other. Also, this means that when using the IKEY, autokeying settings for these are respected too.

* Implemented 'keyingsets' system (instead of directly calling insertkey on relevant channels), which is easier to maintain and cleaner. A keyingset basically defines all the channels that can be keyframed together. This paves the way for custom keyingsets sometime down the track (and also for quick-insert keyframes for previously used keyingset).

Menus for choosing the keying set to use are generated automatically from the definitions.
2008-09-14 04:32:17 +00:00
d111983064 Fix for bug #5758 and #17585: armatures with IK constraint did not
work in the game player, now the IK lib is linked into the player.

Makefiles/Scons/CMake buildsystems have been updated.

Fix materials nodes to work in the game player.
2008-09-14 03:51:51 +00:00
c4cde9a027 Fix for bug #7097: blender multitexture materials in the game engine
player did not enable mipmapping when falling back to texfaces.

Also commented out code that disabled mipmapping in the player on
Mac OS X. If that is a workaround for a bug it is a really poor one,
and hopefully fixed now since this code is from 2002 or earlier.
2008-09-14 01:10:45 +00:00
704fef314a Various game engine fixes:
* Fix issue with add transparency mode with blender materials.
* Possible fix at frontface flip in the game engine.
* Fix color buffering clearing for multiple viewports, it used
  to clear as if there was one.
* Fix for zoom level in user defined viewports, it was based on
  the full window before, now it is based on the viewport itself.
* For user defined viewports, always use Expose instead of
  Letterbox with bars, the latter doesn't make sense then.
2008-09-14 00:32:18 +00:00
06be41648f Fix for #11740 - Reactor particles do not render in animation.
- Particle data was deleted when the current frame was outside the baked range. Reactor particles need this data to store birth and death times.
2008-09-13 21:06:22 +00:00
fa825e70e3 Game engine: added Rasterizer.get/setMaterialMode to set texface,
multitexture or glsl materials. This does not affect existing
scenes, only newly created ones.
2008-09-13 19:19:51 +00:00
d2186508da Particle collisions upgrade:
- Particle now use the deflector objects collision modifier data to collide with deflectors and as a result can now use the velocity of the colliding object for more realistic collisions.
- Dynamic rotations are also quite a bit more realistic and are related to the friction setting of the deflector (to get any dynamic rotations there has to be some friction). This is largely due to the separate handling of rolling friction (approximated to be 1% of normal sliding friction).
- Collisions should be a bit faster on complex deflectors due to the tree structure used by the collision modifier.
- Collision should also generally be a bit more accurate.

To be noted: Only the average velocity of individual deflector faces is used, so collisions with rotating or deforming objects can't be handled accurately - this would require much more complex calculations. Subdividing the deflector object surface to smaller faces can help with this as the individual face velocities become more linear.
2008-09-13 18:09:41 +00:00
8925ae6042 BGE patch: use new btScaledBvhTriangleMeshShape to allow shape sharing between replicas and avoid BVH rebuild in case of scaling. This will save memory and speed up greatly the instantiation of static mesh. 2008-09-13 16:03:11 +00:00
63ecf9966e Fix to make blenderplayer compile with makefiles on Mac OS X. It worked
on Linux already, I think there is a difference in the linker.
2008-09-13 14:21:06 +00:00
ce41cfa40a bullet wasnt building on 64bit linux 2008-09-13 12:07:36 +00:00
ba9d3aa4ab BGE patch: fix transform bug on compound shape: child shape didn't take into account parent inverse node. Fix scaling bug on instantiation of compound shape: child shape didn't have correct shape. Note: global scaling doesn't work on compound shape (limitation of Bullet); don't set any scale on the top dynamic object. 2008-09-13 11:46:07 +00:00
dfb5ebb12e return dummy python values when no joystick is present 2008-09-13 11:43:01 +00:00
a9a8f74b80 Update MSVC project files for latest bullet revision 2008-09-13 11:41:52 +00:00
1c3043f011 32 sounds max would crash on windows because the openal limit is 24, tested an the to-frankie demo playes ok with 24, but would be good to make use of the sound lib's 'priority' option. 2008-09-13 08:22:55 +00:00
9a94620df0 Adapt MSVC project files for latest lib/windows configuration (update lib/windows first). 2008-09-13 08:10:50 +00:00
17478eeb23 Update MSVC project file for latest Bullet revision. Remove compound patch as it is now included in Bullet trunk. 2008-09-13 08:05:16 +00:00
7f293488d1 Upgrade to latest Bullet trunk, that is in sync with Blender/extern/bullet2. (except for one define 'WIN32_AVOID_SSE_WHEN_EMBEDDED_INSIDE_BLENDER')
In case someone reads those SVN logs: you can enable some extra broadphase SSE optimizations by replacing WIN32_AVOID_SSE_WHEN_EMBEDDED_INSIDE_BLENDER by WIN32 in extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvt.h

Thanks to Benoit Bolsee for the upstream patch/contribution.
Removed some obsolete files, they were just intended for comparison/testing.
2008-09-13 07:06:43 +00:00
206cfe7955 avoid crash when game engine returns to Blender, and OpenAL sources haven't been initialized properly for some reason. 2008-09-13 05:24:52 +00:00
21d74deda6 Fixes for game engine runtime on Mac OS X, there were issues
working with relative paths. Still doesn't work optimal, since
paths are relative to game.blend which is in the app bundle
under Contents/Resources, so other files need to be moved there
manually at the moment.
2008-09-12 16:06:17 +00:00
6ebd6cfa73 Bugfixes in SDL joystick, apparently it gives NULLs in OSX. 2008-09-12 15:26:00 +00:00
ed0a0c704d merging bullet 2.71 to trunk --> svn merge -r16334:16486 https://svn.blender.org/svnroot/bf-blender/branches/sim_physics 2008-09-12 14:09:44 +00:00
f40aa6d13f typo in recent commit 2008-09-12 13:26:49 +00:00
b0d9994220 made max sounds playable at once 32 rather then 16. (demo release background music would turn off otherwise)
made selecting sound samples keep the relative path setting.
2008-09-12 13:24:22 +00:00
0795d01df4 Bugfix [#17609] Complex particles crash II - related to #17592 2008-09-12 13:15:52 +00:00
f274336f2f svn merge -r 16453:16485 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-12 12:58:08 +00:00
1adc2dce52 Correct half of rev16483, which does typecasts which are not nice on Win64 plattform 2008-09-12 12:33:55 +00:00
215828455a IPO Editor - Zoom view to area
The Shift-B hotkey can now be used to access this tool.
2008-09-12 05:54:39 +00:00
Ken Hughes
3e5549213c Add some typecasts for intptr_t and uintptr_t value to fix gcc warnings. 2008-09-12 05:27:02 +00:00
c45f1f504b Fix segmentation fault in ipo transform.
The NLA_IPO_SCALED define don't check if we have a Ipo Space open,
so in some case (like when you move a rig with locrot key) when
the function make_ipokey_transform is called, Blender crash.
2008-09-12 05:14:57 +00:00
Ken Hughes
d86c4c1004 Python API
----------
Patch #17481: added Material attributes for missing colorbands controls:
 * material.colorbandDiffuseInput
 * material.colorbandDiffuseMethod
 * material.colorbandDiffuseFactor
 * material.colorbandSpecularInput
 * material.colorbandSpecularMethod
 * material.colorbandSpecularFactor

Contributed by Emilio José Encinas Mir (asfhy).  Thanks!
2008-09-12 05:02:06 +00:00
Ken Hughes
4335811695 Python API
----------
Second and final part of MTex API changes.  Added support for new attributes for MTex World objects, stricter checking of attribute types for materia/lamp/world MTex objects, setters for lamp.textures and world.textures attributes, and updated documentation.
2008-09-12 02:23:52 +00:00
0dea748e01 save and load configuration actuator, (option in game actuator menu)
saves a marshal'd GameLogic.globalDict to the blendfile path with the blend extension replaced with bgeconf

Use this in YoFrankie to save keyboard layout and graphics quality settings.
2008-09-12 02:15:16 +00:00
Ken Hughes
75841bc97f Python API
----------
Add description for missing parameter in Mesh.MFaceSeq.extend() documentation.
2008-09-11 23:50:22 +00:00
b16b0f91ec Repair rayCast part 2: return correct polygon information and true normal 2008-09-11 20:16:30 +00:00
13b0cf94d5 Bullet patch for compound ray cast. The patch is filed in Bullet patch tracker for inclusion in later revision. If it is not included, apply manually extern/bullet2/bullet_compound_raycast.patch 2008-09-11 20:09:07 +00:00
3ac4cffdd0 Bugfix #14033
Option for Image render "Clip" gave wrong alphas on the edge of image.
2008-09-11 16:50:34 +00:00
d5839f21ab Bugfix 12478
Border render didnt work for ANIM render.
2008-09-11 16:37:53 +00:00
97178fecd9 BGE message python api could return a CList type or None which makes exception checks annoying. just return an empty CList rather then None. 2008-09-11 14:58:13 +00:00
729af67742 Bugfix: saved game engine runtimes failed to load library .blend
files with relative paths.
2008-09-11 13:00:54 +00:00
695c354b61 Fix for bug #17602: 32 bit bmp files were read with red and blue swapped. 2008-09-11 11:30:32 +00:00
5eb1d5e3dc Fix for bug #17593: glsl crash using a texture node without a
texture assigned.
2008-09-11 10:17:17 +00:00
7b98b5d34e Compiler warning fixes (mingw) 2008-09-11 06:17:21 +00:00
2af7083d75 BPY api addition material.freeNodes() - use to cleanup apricot files, since there is no way to remove a node tree via the UI, unused materials and duplicate images were hanging around.
buttons_logic - gave the name a but more room then the controller type, better for documentation screenshots.
2008-09-11 01:51:45 +00:00
Ken Hughes
9d7c56a7f2 Tools
---------
Fix user counting for particles.  id.us was not being decremented when using
the browser to replace current particle system.
2008-09-10 23:22:12 +00:00
dca6bd87ef removed debug print 2008-09-10 22:49:11 +00:00
Ken Hughes
0859141238 Scripts
-------
Removed empty parenthesis from class definitions, causes a syntax error in 
Python 2.4 (reported by Sanne on IRC, thanks!)
2008-09-10 21:37:22 +00:00
9e675e547e Bugfix [#17594] separated mesh crash 2008-09-10 15:51:10 +00:00
3bf182c4b4 Bugfix for [#17561] when i try to change the particle to hair I cant choose group or object as viz; Bugfix for mat[4][4] equal to zero resulting in no duplis --> Important: Janne could you check that fixes? 2008-09-10 15:25:06 +00:00
bd518b8de6 This is patch:
[#15135] imbuf DDS support: sync to nvidia texture tools revision 602 + fix for ATI2 compressed normal maps

It just updates the dds stuff.

Provided by Amorilia

Kent
2008-09-10 15:07:20 +00:00
90272dfdad Fix for bug #8132: on Mac OS X 10.5 with Nvidia cards drawing
background images and node previews goes wrong. The exact cause
of that is not sure, may be a driver bug, workaround is to fall
back to another slower function.
2008-09-10 13:02:58 +00:00
a42dd1482f Bugfix:
There were too many undo events being added for IPO Editor when selecting items with the mouse. Removed deselectall_editipo()'s undo push, as it was never called standalone anyway.
2008-09-10 12:04:20 +00:00
f5c19c2c35 Bugfix #17495: IPO curve handles go haywire
When editing IPO curve handles on a curve that belongs to a NLA-strip with repeat != 1 and 'AutoMerge Keyframes' on, the scaling correction was causing more problems than it was worth.
2008-09-10 11:45:42 +00:00
fdb057ff53 Implement softbody function for modifier_depeends_on_time() 2008-09-10 11:42:07 +00:00
1c44562d64 Bugfix [#12033] Cloth and Softbody don't work with Object Actions (fix pointed out by Aligorith. Ton: You might like to look over this) 2008-09-10 11:40:30 +00:00
dfd51ab5b6 Bugfix [#17592] Complex particle system crash 2008-09-10 11:38:19 +00:00
190aae27ae svn merge -r 16369:16454 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-10 11:04:07 +00:00
c40fe7b255 svn merge -r 16411:16453 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-10 10:53:38 +00:00
75078d62df Fix for bug #17589: removing a lamp in the game engine with glsl
materials did not work correct.
2008-09-10 09:51:06 +00:00
ecc5bdb8d7 2 gamelogic templates, one with example functions and comments, another minimal template for those who know the api. 2008-09-10 03:34:08 +00:00
eaf84d2c25 BPY merge from apricot branch.
work around non unix line endings using pythons execfile() function rather then loading the binary data and manually stripping the line endings.
2008-09-10 01:17:03 +00:00
74ab278d46 BGE bug #17549: fix crash on removeParent() with static mesh. Fix scaling bug on setParent(). Add python setWorldPosition() to allow setting object position in world coordinate regardless if it is a root or a child object. 2008-09-09 22:40:10 +00:00
aa10e1b11e Bugfix for [#17363] Edge selection mode + knife twice = latter cut doesn't do anything 2008-09-09 21:46:19 +00:00
f305bb22b7 Patch 17508: Blender Web Plugin - XEmbed. Enable XEmbed integration of blenderplayer, using -i as input parameter to pass embedder window id. create a minimal web plugin to embed blenderplayer on web pages (using gecko/mozilla as browser). Only for *nix. 2008-09-09 21:15:30 +00:00
Ken Hughes
fede495c07 Python API
----------
Bugfix #14425.  Particle.Get() could return a list of invalid items.  The API
still needs more work, but for now throw an NotImplemented exception.
2008-09-09 20:52:18 +00:00
f198acd5dd Fix for bug #14775: memorblock end corrupt print, needed to allocate
one byte more for the align menu string 0 terminator.
2008-09-09 20:19:00 +00:00
df1d59805f Fix for bug #17588: crash with ctrl+a and no active object. 2008-09-09 20:09:54 +00:00
84d7e2ea9c Fix for bug #17443: make bone heat weighting solve a bit less
sensitive to poorly shaped geometry, should succeed solving
in more cases now.
2008-09-09 20:00:57 +00:00
568ba15726 Bugfix for [#17329] Bevel Weights are lost after Subsurf 2008-09-09 18:44:10 +00:00
be19db6854 Fix for bug #12132: vector blur with fast moving objects does
not give a smooth fallof. there's no correct fix possible due
to a lack of information, but this manually adds a smoother
falloff, overestimating the contribution of foregroud pixels
instead of becoming transparent.
2008-09-09 17:27:01 +00:00
d9404adcd1 Bugfix #17562: array fit to curve isnt working 2008-09-09 16:38:08 +00:00
e9b08b64fa Fix for bug #17402: IK influence blending with pole targets
didn't give smooth transition. Now it blends the result of
IK solving in that case.
2008-09-09 15:15:01 +00:00
160c0de87b Fix for bug #17580: crash rendering instanced objects with
halo material attach to the object instead of the mesh.

Also for bug #13489: avoid a crash rendering with invalid
active vcol layer, most likely caused by a bug that was
already fixed.
2008-09-09 14:16:54 +00:00
68d7f0a3d1 Bugfix #13592
Sequencer, Time, Sound windows were drawing frame numbers double when
too far zoomed in.
2008-09-09 13:35:38 +00:00
7366834443 Bugfix #13596
Wrong popup on single-user particles, it said "make local".
2008-09-09 12:51:22 +00:00
4db3d6c595 Bugfix #13653
Autosave disable didn't work.

Note however that a disabled autosave only gets active on saving the 
user settings, and loading blender again. This is a timer that gets 
set on startup. I didn't code a kill timer. :)
2008-09-09 12:00:38 +00:00
ad31f6a4b3 Bugfix #13675
Edge render made star render disappear. Wrong Z value comparing...
(2 year old bug!)
2008-09-09 11:40:29 +00:00
0995466927 wasnt using icon buttons correctly 2008-09-09 10:58:58 +00:00
70be839859 Bugfix #13837
Tonemap didn't correctly accept any buffer type.
The coder who added this should check this fix! Any node coder maybe...
2008-09-09 10:16:09 +00:00
Ken Hughes
3f87319428 Python API
----------
Add access to MTex objects from Lamps and Worlds (first pass).  Since the
MTex structure is slightly difference between materials, lamps, and worlds,
a field is added to the BPy MTex object to distinquish which type it wraps.

Attempting to access attributes which are unique to materials for lamp or
world MTex objects throw an exception.  The next pass will implement MTex
attributes which are specific to Lamps and Worlds.

A new attribute (textures) is added to each module.  It is compatible with
the previous Material.getTextures(), which returns a tuple of either MTex
objects or None.  Surprised we never added an attribute for this before in
all the changes and refactoring.
2008-09-08 23:39:32 +00:00
de48280368 Bugfix #17566
Modifier buttons: now check properly for external lib data, modifiers are
on object only. Only "Apply" is locked now.
2008-09-08 15:15:00 +00:00
f7a6d032fc Bugfix #17375
Crash on converting object to other type, and replace object.
Deleting should trigger a new depsgraph.

Oldie bug!
2008-09-08 13:04:10 +00:00
2768ee67bd Grease Pencil - Defaults Cleanups:
* Made new layers default to having thickness of 3, and opacity of 0.9. These values seem to be used more often.
* Newly added Grease Pencil blocks will now be expanded by default in the Action Editor
* Added support for Image Editor grease-pencil blocks to the Action Editor
* Added version-patching for missing colours used by the info-string for GPencil.
2008-09-08 12:36:49 +00:00
e3172d8f4d Bugfix:
Grease Pencil panel now updates correctly in Sequencer
2008-09-08 12:06:40 +00:00
da474210de Bug #17317
Vertexpaint mode: option "paint mask" (Fkey) missed redraw for buttons
2008-09-08 11:13:34 +00:00
6a83746fb3 Bugfix #17305
3d window didn't refresh correctly when loading a new background image.
Fix by Ken Hughes. :)
2008-09-08 10:31:00 +00:00
ce7caf203d View 3D - Improvements for Info Drawing:
The little info string beside the mini-axis (in bottom left corner) is now more useful when animating fullscreen. ZanQdo feature request.

* Info string is drawn in yellow when there is a keyframe on this frame. 
Hopefully this doesn't introduce any major slowdowns, as it does do a search for keyframes for every redraw.
* Name of first marker that occurs on the current frame is now also shown (in angled brackets). No angle brackets are shown if no marker.
* Info string is also shown when there is no active object.
2008-09-08 06:49:19 +00:00
a9d334df67 Bugfix for #17572 Boids Particles Crash 2008-09-07 20:46:54 +00:00
26d8da99cc Bug [#17454] Wave modifier crash, fix provided by Banlu Kemiyatorn 2008-09-07 20:18:26 +00:00
f3fc5a8b61 BGE bug #17574 fixed: GE Text input doesn't register in 2.47. Force registration of keyboard sensor with no link as this is typically the setting for key logging. 2008-09-07 19:58:37 +00:00
44f9276b67 svn merge -r 16396:16411 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-07 19:47:15 +00:00
1d41c27625 Bugfix #17446
Two menu errors in Node Editor.
2008-09-07 18:18:50 +00:00
8569a78cbb bugfix 17527
Halo render: lines and rings were not using random anymore... got lost
in particle upgrade of pre-peach. Tsk!
2008-09-07 17:13:05 +00:00
d0b3ce3c48 Draw icons in the layer button to show used layers as well as layer of active object, this is a feature from apricot but used button color instead which was confusing. 2008-09-07 16:37:55 +00:00
91c8eea325 [#17579] Added support to VSE Python API for adding movie and audio HD sequences
from Rob Scott (spamagnet)
2008-09-07 14:02:58 +00:00
a14d7c9b7d Bugfix #17497
FSA didn't support "key alpha", fixed it.
Also noticed edge-enhance didnt work for FSA, added warning for that,
fixing it is too clumsy, this option belongs in compositor.
2008-09-07 13:15:44 +00:00
e0fad0e6a1 Grease Pencil - Stick to View for Sequencer:
The 'Stick to View' feature now works in the sequencer (image previews)
2008-09-07 11:36:52 +00:00
0bf03ef2f1 BGE patch: Simulate dupligroup operation when parent and child are not active/inactive at the same time: don't convert the child. This unusual situation is used in Apricot for testing. 2008-09-07 10:47:33 +00:00
7666666992 Bugfix #17490
Camera feature "DOF Object" was drawing the cross marker on wrong location
when camera scales. Simple fix by using Mat4Ortho()
2008-09-07 10:24:02 +00:00
eb9f4461ea Constraints - Space Conversions Code Tidyup:
Finished verifying that all possible combinations of space conversions were accounted for.
2008-09-07 04:43:31 +00:00
54a4b036a3 Some version were not merged from svn/missing --> svn merge -r 16370:16371 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-07 01:43:55 +00:00
667c8d83fb BGE patch: break parent relationship when child and parent are not active/inactive at the same time. This unusual situation is used in Apricot for test purposes. 2008-09-06 22:06:01 +00:00
9f05477ea1 svn merge -r 16371:16396 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-06 17:49:26 +00:00
c7fe2199a7 object_find, didnt get images from an objects material textures
KX_PythonInit.cpp - own error in recent commit.
2008-09-06 17:04:54 +00:00
601979fc15 Fix Windows compile error. Update MSVC project files 2008-09-06 16:53:44 +00:00
115cf18bed converted my gen_utils.h fix to PyObjectPlus.h
Also added a fix for PyMarshal_WriteObjectToString

Now I just need to figure out linking of the gameengine on my imac.

Kent
2008-09-06 14:13:31 +00:00
810f799660 Revert a commit from 5 years ago that added a glFinish call before swapping on Windows. This is really bad for performance and especially showed in the game engine. The purpose was to disable FSAA and fix some UI issue on Geforce 2 graphics cards, hopefully the drivers have been fixed by now? I have no way to test this, so we'll see if an issue pops up on those older cards, and a lot of code changed since then anyway so it might not even be needed anymore. 2008-09-06 13:24:42 +00:00
1bd365e112 find objects by texture name raised a python error 2008-09-06 12:50:22 +00:00
742e917c6a added ALPHASORT flag to the bpython api 2008-09-06 10:39:19 +00:00
8675ff6d1d Trying to keep things compiling on my imac (10.4.11)
I'm getting this error now:
GPG_Application.cpp: In member function 'void GPG_Application::stopEngine()':
/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/marshal.h:12: error: too many arguments to function 'PyObject* PyMarshal_WriteObjectToString(PyObject*)'
GPG_Application.cpp:720: error: at this point in file

Are we offically not supporint older versions of python now? :)

Kent
2008-09-06 02:46:11 +00:00
e279aadb97 Bugfix: game engine could crash with empty display arrays on
windows (caused by invisible faces for example).
2008-09-06 01:18:53 +00:00
61e6283657 treaded soft bodies final (hopefully)
bug fix [17428]
/*backward compatibility note:
G.rt==16 still activates 'old' code
fixing bug [17428] which forces adaptive step size to tiny steps in some situations .. keeping G.rt==17 0x11 option for old files 'needing' the bug*/
2008-09-05 23:28:28 +00:00
af42ff6aa2 Fix: compiling with cmake 2.4 didn't work anymore due to a
compatibility fix for cmake 2.6.
2008-09-05 21:57:34 +00:00
Ken Hughes
3f9d32783a Python API
----------
Add missing Textures.ExtendModes.CHECKER constant.
2008-09-05 20:41:09 +00:00
d8b9ca34a0 GLSL: small optimization if Use Alpha is disabled for textures. 2008-09-05 20:34:35 +00:00
5eab0da633 BGE set visible actuator, option to set visibility recursively to make managing visibility for collections of objects a lot easier.
BGE Python api's ob.setVisible() also takes an optional recursive arg thats off by default
2008-09-05 16:22:14 +00:00
2e653838c0 Bugfix for GLSL: no specular/diffuse + only shadow for lamps
didn't work correct.
2008-09-05 15:08:01 +00:00
f1415bca7e Missing header.
Kent
2008-09-05 14:42:03 +00:00
330aa94ecc * GLSL lamps now respect 3d viewport layers.
* Fix undo crash related to sound. Sounds still stop working in
  the game engine after undo, but seems to be a different issue.
2008-09-05 14:33:36 +00:00
5b6e9eec7b Two more apricot branch features:
* Auto Depth: use the depth buffer for improving pan/zoom/rotate
  in large scenes.
* The viewport drawtype for objects in groups now aren't just taken
  from the original object, but the minimum together with the parent
  drawtype is used.
2008-09-05 13:08:50 +00:00
d88b4acc9b Fixing non-working check for incompatible trees 2008-09-05 12:06:47 +00:00
b32036f5d6 bvh nodes got parent node reference again 2008-09-05 11:55:39 +00:00
e8621cf05e Grease Pencil - Available in Image Editor:
Grease Pencil is now available in the image editor. It is important to note that the strokes drawn WILL NOT become part of the image visible at the time.

Unfortunately, 'fancy' stroke drawing cannot be enabled for use with the 'Stick to View' setting here, as the scaling is wrong.
2008-09-05 07:12:04 +00:00
18fe6c27ff Compiling/Warning Fixes (for scons/mingw + "split sources hack") Part 1:
* Removed compiler warnings from texteditor work
* Added round brackets around the new defines for IPO channels for extra texture layers
* Tweaked priorities so that BLI_heap_* functions in blenlib can be found by linker (split-sources specific)

TODO:
* "monkey*" vars cannot be found still
2008-09-05 06:05:25 +00:00
18b5b4ff0c * Made the Ipo editor handle colours initialise from old files to the previously stored Ipo editor vertex colours, rather than the default pink and yellow. This keeps existing themes looking the same as they did before rather than turning them pink by default. 2008-09-05 05:17:26 +00:00
e3a1547eea BGE Py API
added exception messages for replaceMesh.setMesh() and allowed None as an argument.
added exception messages for other BGE module functions.
2008-09-05 02:53:12 +00:00
3c95d91a57 * corrective UV transformation - only works with UV edge slide right now. but should be extended so transforming dosnt distort UV's
* smooth respects mirror option (will move mirrored vert too)
2008-09-05 00:28:17 +00:00
d2c13039ed svn merge -r 16320:16369 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-05 00:12:01 +00:00
dd03596bfe svn merge -r 16351:16368 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-04 23:33:19 +00:00
2d50ead6b8 Partial repair of raycast system with Bullet 2.71. Still to be done: face and normal information 2008-09-04 23:07:43 +00:00
d682dc5bd5 svn merge -c 16350 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-04 23:05:00 +00:00
cb89decfdc Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:

* GLSL support in the viewport and game engine, enable in the game
  menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
  gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
  storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.

* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
  An extra texture slot shows up once the last slot is used.

* Memory limit for undo, not enabled by default yet because it
  needs the .B.blend to be changed.
* Multiple undo for image painting.

* An offset for dupligroups, so not all objects in a group have to
  be at the origin.
2008-09-04 20:51:28 +00:00
2167e5c341 Cleaned up some small warnings.
Kent
2008-09-04 16:40:20 +00:00
f0eaf424ab Added SDL headers so gamestuff compiles with Makefiles again.
Kent
2008-09-04 15:29:43 +00:00
05056f2e1d overlapping UI causing problems, forgot the label has a function assigned to it 2008-09-04 12:17:01 +00:00
e356c4d5d4 pin option for sensors and actuators,
this helps in cases where you want to use a logic brick in 2 states, linking the sensor to a second state's controller can be tricky.
This way you can pin a sensor or actuator, change the visible state and link it to another controller.

The pin button will only be displayed when states view is enabled and the logic brick is expanded or when it is alredy pinned.
2008-09-04 12:11:47 +00:00
7afc0ca600 Two compile fixes for msvc and cmake provided by broken 2008-09-04 10:29:41 +00:00
a7348dd43e Bugfix: yafray export crash if new hsv texture blend types were
used, the code here needed to be updated.
2008-09-04 00:27:05 +00:00
961a26d500 fix for 2 python refcounting errors 2008-09-03 23:51:55 +00:00
11ec880483 Clean up merging conflict 2008-09-03 16:10:20 +00:00
a9ffeb8cad Fixing debug output 2008-09-03 16:02:40 +00:00
c587252a78 Bugfix for sphere-in-control-object (reported by broken) 2008-09-03 16:01:25 +00:00
19d5a5da45 Update MSVC project files after GSoC merge 2008-09-03 12:54:46 +00:00
096b4638c4 Revert rev16344 on trunk, bullet work is done in sim_physics branch as discussed on sunday meeting 2008-09-03 11:11:11 +00:00
85deff9c30 svn merge -r 16334:16347 https://svn.blender.org/svnroot/bf-blender/trunk/blender + also added missing files from bullet-2.71alpha0 archiv + fixed compile errors 2008-09-03 10:55:46 +00:00
cfa07e8d2b BGE Py api, deleting properties didnt raise an error when the property wasnt there. also added some exception messages and renamed joystick getConnected() to isConnected() 2008-09-03 06:43:07 +00:00
b818b1a164 cleanup mesh materials option was setting incorrect material indicies 2008-09-03 03:24:01 +00:00
1926e84650 Finally upgraded to latest Bullet subversion, about to release 2.71. Some recent changes in extern/bullet2 need to be re-applied, will check with Benoit. Ray tests in 0_FPS_Template.blend is broken, didn't figure out why yet.
HELP BUILD SYSTEM MAINTAINERS: Please help with updating all build systems: the newly added files need to be added. Note that the src/SoftBody has been added for future extension of real-time soft bodies.
2008-09-03 02:27:16 +00:00
33ac84e888 Compile fixes (reported by broken) 2008-09-03 00:00:32 +00:00
fe93743518 BGE patch 17547 approved: Cleaned up pydoc for BGE, compiles now error free 2008-09-02 22:13:07 +00:00
Ken Hughes
bbf2ff410b Fix some more gcc warnings. 2008-09-02 21:09:29 +00:00
Ken Hughes
e4dbf0e7d6 Fix gcc compiler warnings. 2008-09-02 20:53:07 +00:00
0fe906f49e BGE patch: simple fix to synchronize sensor pulse mode with sensor state transitions. 2008-09-02 18:34:54 +00:00
dcbf8fbf76 Fix segmentation fault when try separate a mesh with the active face selected.
If the active face is part of the selection, Blender crash when
split the mesh because the act_face have an invalid pointer.

The solution is simple, check if the active face is part of the selection
and in that case, set it to NULL.

Campbell please double check this.
2008-09-02 17:50:54 +00:00
ead69661e8 -> Fix for 64 bit alignment of Vertex colors in bmesh
Vertex color structure in bmesh needed to be padded for
8 byte aligned memory access.
2008-09-02 16:39:03 +00:00
de493dacb3 New physics + related branch for Nils smoke stuff, Pablos volumetrics stuff and also Bullet work (Ben) 2008-09-02 15:21:05 +00:00
84dcfa181b BGE Bugfix, SDL joysticks arrow keys didnt work when 2 joysticks were being used at the same time.
The event queue was running for every joystick sensor without checking if the events were for that joystick.
seperating the event queue for each joystick is overkill so instead deal with all joysticks events in once function.

Also removed some unused functions
2008-09-02 06:12:19 +00:00
81ad271d15 BGE joystick sensor bugfix, was sending true events logic tick (as if the true pulse option was enabled). 2008-09-02 02:03:03 +00:00
aa4e4da8c3 Text Editor (GSOC 2008)
=======================
Merge of branch soc-2008-quorn to trunk:
Merged 14970:16308 to trunk@16307, updated to HEAD.
Merged 16318

Main features from this branch:
 - Python text plugins
 - Suggestions and documentation elements
 - Improved syntax highlighting
 - Word wrap
 - Additional editing tools
 - Various undo and clipboard fixes
 - File header info and modification checks
2008-09-01 14:04:22 +00:00
7b9ee57c0b BGE joystick sensor py api function 'getConnected()', returns true if the joystick is connected and working.
SCA_Joystick.h seemed to have twice as many newlines as needed.
2008-09-01 06:25:13 +00:00
6f3a8519da Bugfix #17557: Segfault when no active node and trying to insert keyframe
When there is no active node in the Composite Nodes, Blender crashes when trying to insert a keyframe using IKEY.
2008-09-01 04:09:07 +00:00
e8049903ac BGE python api for get/setting the joystick index, minor cleanup also. 2008-09-01 00:12:39 +00:00
234b616078 BGE bug #17459 fixed: action actuators depending on their order in the actuator list. 2008-08-31 21:53:39 +00:00
8cf385a93d svn merge -r 16222:16320 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-31 21:00:20 +00:00
7f257df5b4 BGE patch 17547 applied in trunk: Cleaned up pydoc for BGE, compiles now error free 2008-08-31 19:07:10 +00:00
74339c639a BGE patch approved: BGE Multiple Joysticks 2008-08-31 18:42:58 +00:00
062bf735e7 Minor tidying and commenting 2008-08-31 16:23:31 +00:00
a4e74c92f7 == Grease Pencil Conversions - Armature ==
Can now also convert active layer to a series of bone chains. Each stroke will be converted to a chain of connected bones.

At the moment, it is still necessary to manually recalculate roll angles after the armature has been created, as the bones are not assigned the correct roll angles yet.
2008-08-31 12:47:04 +00:00
6aee42daaf Bugfix #17551: AutoKey for Visual Keying non-functional
No VisualKeying checks were being done
2008-08-31 07:33:27 +00:00
9818b8a95c Fix for win64 building (gettextlib had wrong name) 2008-08-31 01:57:53 +00:00
25c116e80a Fixing typo to make compile working again 2008-08-30 23:12:01 +00:00
Nathan Letwory
ff0aab05b2 patch for bug #17553: material emit is allowed to go from 0.0 to 2.0; however curves only make it go to 1.0
reported and patched by slikdigit
2008-08-30 21:41:02 +00:00
3bab89cc1c Merge from trunk 16122-16307 2008-08-30 14:32:16 +00:00
bccce7e30e Fix for class variable parsing/listing bug. 2008-08-30 11:27:27 +00:00
4d888fb6c8 Added missing null check to convertmenu
Remported by alxarch.
If you remove the active object and then tried alt-c it would crash.

Kent
2008-08-29 14:19:34 +00:00
b77e130dd6 Grease Pencil:
* Added 'Convert To...' button for easy access to conversion tool. The hotkey has been mentioned in the tooltip. This replaces the 'Del Active Frame' button in 3d view only.

Armature Apply Pose:
* Added menu entry (beside Relax Pose)
* Bone-parented objects now get their parent inverse matrices correctly recalculated
* Changes for 'scale' code in previous commit wasn't correct... reverting
* IPO/anim flush protection is now set on bones to prevent them from being sprawled everywhere after applying
2008-08-29 12:24:07 +00:00
ff06fcfc33 Bugfix:
* Roll is now correctly calculated for Apply Armature
* Scale on x,z axes is no longer cleared (only scale on y axis needs to be)
2008-08-29 11:15:24 +00:00
bcff5afeb2 == Grease Pencil ==
Special request by Alxarch for Architecture:
Hold Ctrl-Key when 'Draw Mode' is enabled to draw straight lines. 
Although when drawing the stroke, the stroke will still be freehand, the final result will be a line between the endpoints of that stroke. This is useful for annotations of sectioning lines + site maps, etc.
2008-08-29 10:47:53 +00:00
e21b3d81c5 Use Py_ssize_t rather then int, broke building on 64bt linux 2008-08-29 06:32:42 +00:00
f60992daae BGE Py API - GameKeys.EventToString() utility function, makes key configuration menu's easier to write.
own error with blenderplayer, wasnt decreffing the GameLogic module, probably didnt matter since python was restarted anyway, but is incorrect.
2008-08-29 03:15:17 +00:00
272132888f BGE patch: add X-Ray option to ray sensor. The option is effective only if a property is set: the sensor will ignore the objects that don't have the property. 2008-08-28 19:37:49 +00:00
9f10007bfb == Apply Current Pose as New Restpose ==
In PoseMode, the Ctrl-A hotkey can now be used to apply the current pose as the new restpose for the armature. 

Notes:
* Roll correction may not be totally correct on bone chains, but is ok in most cases.
* Objects that are bone parented to the armature where this is applied are not correctly adjusted yet. 
* It is advisable to 'apply' the existing armature deformations to geometry deformed by the armature before applying this, to prevent unexpected results.
* No menu entry yet... will add in due course.
2008-08-28 12:22:55 +00:00
9f89f4cf34 compilation problem with gcc, memset undeclared 2008-08-28 12:12:56 +00:00
6a98b9215c final fix for compilation problem with KX_RayCast::Callback template in gcc 2008-08-28 11:13:04 +00:00
116001ac34 more fix for compilation problem with KX_RayCast::Callback template in gcc 2008-08-28 11:06:46 +00:00
bf7387b2d8 GPencil Bezier Curve Conversion:
Now sets vector/free handles by default
2008-08-28 10:43:17 +00:00
84d1dfb89b patch for compilation problem around KX_RayCast::Callback template with gcc 2008-08-28 10:28:06 +00:00
1032da67cc Grease Pencil - Curve Conversion Improvements:
* Changed hotkey from Alt-C to Alt-Shift-C so that it works when the active object cannot be deselected/deactivated.
* Added option to convert to bezier curves. Note that currently, the handles are simply placed to the same location as the point so that there is an exact match with the gpencil strokes. In future, it would be interesting to investigate using proper curve-fitting algos instead.
2008-08-28 10:19:34 +00:00
794ffdcd2c didnt build before committiong this small change :/
isLight() is apricot only. Add this back when GLSL is merged to avoid conflicts.
2008-08-28 09:02:04 +00:00
c8d0a540f5 BGE patch: fix division by 0 error when sound sample cannot be loaded in sound actuator. 2008-08-28 08:13:58 +00:00
f88c5d9721 BGE Bugfix, lights were not being removed when their gameobject was removed causing odd shadows to hang about the scene. 2008-08-28 07:03:23 +00:00
2934e78a86 remove more python functions from builtins that could allow scripts to do bad stuff.
- reload, file, execfile, compile
These are only removed when running in higher security mode thats not default in blender.
2008-08-28 05:45:20 +00:00
becd467be8 BGE patch: KX_GameObject::rayCast() improvements to have X-Ray option, return true face normal and hit polygon information.
rayCast(to,from,dist,prop,face,xray,poly):

The face paremeter determines the orientation of the normal: 
  0 or omitted => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
  1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray.
The prop and xray parameters interact as follow:
    prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray.
    prop off, xray on : idem.
    prop on,  xray off: return closest hit if it matches prop, no hit otherwise.
    prop on,  xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray.
if poly is 0 or omitted, returns a 3-tuple with object reference, hit point and hit normal or (None,None,None) if no hit.
if poly is 1, returns a 4-tuple with in addition a KX_PolyProxy as 4th element.

The KX_PolyProxy object holds information on the polygon hit by the ray: the index of the vertex forming the poylgon, material, etc.

Attributes (read-only):
 matname: The name of polygon material, empty if no material.
 material: The material of the polygon
 texture: The texture name of the polygon.
 matid: The material index of the polygon, use this to retrieve vertex proxy from mesh proxy
 v1: vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy
 v2: vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy
 v3: vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy
 v4: vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex
     use this to retrieve vertex proxy from mesh proxy
 visible: visible state of the polygon: 1=visible, 0=invisible
 collide: collide state of the polygon: 1=receives collision, 0=collision free.
Methods:
 getMaterialName(): Returns the polygon material name with MA prefix
 getMaterial(): Returns the polygon material
 getTextureName(): Returns the polygon texture name
 getMaterialIndex(): Returns the material bucket index of the polygon. 
 getNumVertex(): Returns the number of vertex of the polygon.
 isVisible(): Returns whether the polygon is visible or not
 isCollider(): Returns whether the polygon is receives collision or not
 getVertexIndex(vertex): Returns the mesh vertex index of a polygon vertex
 getMesh(): Returns a mesh proxy

New methods of KX_MeshProxy have been implemented to retrieve KX_PolyProxy objects:
 getNumPolygons(): Returns the number of polygon in the mesh.
 getPolygon(index): Gets the specified polygon from the mesh.

More details in PyDoc.
2008-08-27 19:34:19 +00:00
f6bdba8351 Bullet patch: option to return true face normal, complete triangle information and broad phase filter. This patch is needed to support enhanced ray cast function in the BGE. I have proposed it to the Bullet forum for inclusion in the next Bullet version. 2008-08-27 19:16:21 +00:00
c6acbc3047 == Grease Pencil - Conversions + Bugfixes ==
* New stuff: Grease Pencil strokes on the active layer can now be converted to 3d curves (geometry). More work is still needed to make the result look be more optimal (i.e. extruded curve)

* Bugfix: Spacing between collapsed layers is more compact now
2008-08-27 13:02:44 +00:00
6cccdf0cb2 BGE bugfix, ipo actuator's foce option didnt check that the object was dynamic. 2008-08-27 06:02:10 +00:00
d566765635 get/set Angular velocity for KX_GameObjects python api and for the AddObject actuator.
Needed so objects created in an explosion could start spinning without having motion actuators and collision sensors on each item.
2008-08-27 03:34:53 +00:00
6778c8dc29 BGE: allow sound actuators to be converted even when they have invalid samples
without this, an incorrect sound path could cause scripts to to fail, making some functionality not work at all.

This also fixes a problem where samples would be loaded multiple times.
2008-08-27 01:03:55 +00:00
0257f500e7 Fix for text plug-in scripts on 64-bit platforms. 2008-08-26 17:09:17 +00:00
0b523ac3e6 Particle System: a) Fixing visibility bug when a duplipart-system was deleted it didn't show up in during render any more, b) fixing possible crash during render 2008-08-26 01:07:18 +00:00
b81bdfdc7c TLC needed for Makefiles to get gameengine compiling again.
Sorry it took me so long to do this :)

Kent
2008-08-25 19:50:17 +00:00
Chris Want
e3961717be Patch #17517 from Enrico Fracasso (thanks!)
Explicitly setting CMake policy CMP003 to obey the CMake 2.6
way of dealing with how to find libraries when the full path
isn't known. See:

http://www.cmake.org/HTML/cmake-2.6.html#policy:CMP0003
2008-08-25 15:33:18 +00:00
10bcba77b1 Crash fix for having wind noise + particles (reported by Wahooney) 2008-08-25 13:49:55 +00:00
683aabae93 Fixing compiler warning due to unsed code 2008-08-25 11:49:58 +00:00
d37f0325ca Effector fall-off power was off by one for spherical, magnet, harmonic and charge fields. For example a square fall-off was reduced to linear etc. 2008-08-25 11:46:55 +00:00
afa8a76f46 Grease Pencil Eraser - Bugfix:
* 3d strokes could only be erased from start of stroke 
NB: 3d-strokes could be erased starting from previous commit
2008-08-25 11:09:19 +00:00
b5d254445c getting the last created object would return an object that had no SG_Node which would crash whenever python tried to get its location.
since the object was removed from the scene anyway, there is no reason to return it.
2008-08-25 09:52:38 +00:00
1ed408e8c6 == Grease Pencil - Drawing + Eraser Improvements ==
Drawing Improvements:
* Single 'dots' now draw rounded
* Strokes being drawn are drawn 'solid' instead of as dotted lines

Eraser:
* Now operates interactively, so no more wait to see if stuff was erased
* An influence circle is now drawn - the radius of this is defined as the thickness^2
2008-08-25 06:22:21 +00:00
5e13055849 Little feature request
Adding numerical input support to edge slide (and at the same time, loop cut).

Also clean up NumInput functions for external use. I might have a second pass at this to make it even easier.
2008-08-24 20:57:56 +00:00
bdcf3783d7 [#17433] Cannot break node links with LMB drag under linux.
Grease pencil commit added some panel draw code or whatnot which seems to change the matrix stack in unwanted (in this case) ways. Reset to identity fixes it.

* I don't think it was limited to Linux though
2008-08-24 15:22:44 +00:00
bf0803c0c2 Added better grouping for text markers with a separate group field (instead of using flags). The lower two bytes of the group are used for python scripts while the upper two (or more) are reserved for internal grouping. Plenty either way. 2008-08-24 13:30:35 +00:00
Hans Lambermont
b33e57952c fix settings for freebsd7 2008-08-23 13:12:17 +00:00
bc8f002a4c BGE state system improvement: the sensor with Level option enabled will trigger the controller of a newly activated state, even if the sensor is already connected to an active state; new isTriggered() python function to determine which sensor triggered the current controller.
Previously, this behaviour was available only for sensors
that were not connected to any active state, which was
forcing the game designer to duplicate sensors in some 
cases.
For example the Always sensors used to initialize the 
states needed to be duplicated for each state. With this
patch, a single Always sensor with Level option enabled
will suffice to initialize all the states. 
A Python controller can determine which sensor did trigger
with the new SCA_ISensor::isTriggered() function.

Notes:
- When a sensor with level option enabled is connected
  to multiple controllers, only those of newly activated
  states will be triggered. The controllers of already
  activated states will receive no trigger, unless the 
  sensor internal state toggled, in which case all the
  controllers are triggered as always.
- The old isPositive() function returns the internal
  state of the sensor, positive or negative; the new 
  isTriggered() function returns 1 only for sensors
  that generated an event in the current frame.
2008-08-23 11:54:27 +00:00
2076703a28 Removed cast warnings from shrinkwrap.c and BLI_kdopbvh.c
Only unused functions and openmp warnings left on those.
2008-08-22 18:28:34 +00:00
7630539fe8 Fix Windows compilation problem and update MSVC project files 2008-08-22 15:00:30 +00:00
39a8125e4c Typo in copyright notice (VF -> BF) 2008-08-22 12:48:12 +00:00
88b30a740a A bit of cleanup of warnings (gcc).
Warnings still exist in the following places:
* places (exotic.c, etc.) where format strings still use 'longs' but datatype is uintptr_t (i.e. resulting from the win64 changes)
* shrinkwrap.c - a few "incompatable type" warnings
2008-08-22 12:10:02 +00:00
c230bc4a82 Grease Pencil - Drawing Improvements:
This commit finishes the work started in the previous commit. 
1) Reduced the effects of 'shrinking' lines with acute angles (*)
2) Ends of strokes now get crude end-caps which look ok for most purposes (they are really just simple trapeziums not fancy semicircles)

* Note: some shrinking does still occur if the stroke was drawn quickly enough for few points to be recorded. Also, although there are still zones of overlapping when there are acute angles, this is reduced to steeper angles (and is not too bad considering real-life materials)
2008-08-22 11:46:59 +00:00
f88dabae8a BGE data conversion was making sound paths absolute, modify a copy rather then the original. 2008-08-22 10:27:16 +00:00
5dafc1a553 svn merge -r 16060:16222 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-22 09:31:32 +00:00
eab746fc5f Grease Pencil: WIP commit (nothing new)
Just a little commit so that I can transfer some changes back over to laptop. 
* Line drawing should now be improved for most cases, but acute angles still need more work to reduce 'shrinking' artifacts. As such, this is still hidden behind 'rt' setting
* Preparation work for Grease-Pencil in Image Editor, and also 'Stick to View' for Image/Sequence editors.
2008-08-22 08:36:29 +00:00
9b29810912 BGE Python API - GameLogic.getBlendFileList(path='//') to return a list of blend's in the current directory. Needed for creating a level selector that lists all files in the level directory.
CMakeFile include path to compile with recent changes.
2008-08-22 06:02:01 +00:00
4655426ec7 Merged shrinkwrap modifier from soc-2008-jaguarandi 2008-08-22 00:35:14 +00:00
f4ae23f379 svn merge -r 16174:16215 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-21 22:57:25 +00:00
f0d58a8b99 Update scons files in source/gameengine/Physics/Bullet.
Please Nathan double check this, but all compile fine here :)
2008-08-21 21:14:08 +00:00
57d1a1eac2 New things for particle effectors:
- For newtonian particles a "self effect" button in particle extras makes the particles be effected by themselves if a particle effector is defined for this system, currently this is a brute force method so things start getting slow with more than ~100 particles, but this will hopefully change in the future.
- Two new effector types: charge and a Lennard-Jones potential based force (inter-molecular forces for example).
   -Charge is similar to spherical field except it changes behavior (attract/repulse) based on the effected particles charge field (negative/positive) like real particles with a charge.
   -The Lennard-Jones field is a very short range force with a behavior determined by the sizes of the effector and effected particle. At a distance smaller than the combined sizes the field is very repulsive and after that distance it's attractive. It tries to keep the particles at an equilibrium distance from each other. Particles need to be at a close proximity to each other to be effected by this field at all.
- Particle systems can now have two effector fields (two slots in the fields panel). This allows to create particles which for example have both a charge and a Lennard-Jones potential.
2008-08-21 21:12:27 +00:00
3d3527eb6d BGE bug #17411 fixed: the always sensor is called before the the scale of the object is applied. The scale is now applied to the shape before the creation of the rigid body. 2008-08-21 21:04:42 +00:00
Ken Hughes
8551ac5e08 Missing newline at EOF. 2008-08-21 20:28:33 +00:00
ca1182ff56 fix warning in previous revision, update MSVC project files, scons files in source/gameengine/Physics/Bullet must be updated by adding these directories in the include list: intern/string/include, source/gameengine/Rasterizer, source/kernel/gen_system. I leave it up to more expert than me. 2008-08-21 19:00:24 +00:00
Ken Hughes
0a87d821a9 Python API
----------
Fix typo in Mesh module exception messages (submitted by Teppo Kansala ).
2008-08-21 16:13:26 +00:00
Ken Hughes
7e0c880c2e Python API
----------
Access to empty shapes by object.emptyShape attribute, contributed by Domino
Marama (thanks!)
2008-08-21 16:10:30 +00:00
e912ca9331 BGE bug #17491 fixed: BGE, Dupli instance with different scale, massive slowdown.
The root cause of this bug is the fact that Bullet shapes 
are shared between duplicated game objects. As the physics
object scale is stored in the shape, all duplicas must 
have the same scale otherwise the physics representation
is incorrect.
This fix introduces a mechanism to duplicate shapes at
runtime so that Bullet shapes are not shared anymore.
The drawback is an increased memory consuption. 
A reference count mechanism will be introduced in a 
later revision to keep Bullet shape shared between
duplicas that have the same scale.
2008-08-21 15:19:54 +00:00
4b9f5b2710 BGE Bullet fix: physics debug representation of cone shape does not take Up axis into account. Use Bullet 2.69 code to fix that bug. 2008-08-21 14:07:24 +00:00
09c4e88336 -> more FLT tweaks
LOD editor input ranges were too low.
Also fixed the interface drawing so it
always started at bottom of screen area.
2008-08-20 20:10:33 +00:00
e7cf01d083 -> Fix for last commit
The range of allowed values for the LOD editor
 inputs was too low.
2008-08-20 19:18:52 +00:00
6d7fa6020e -> LOD and DOF editor scripts
Two new scripts for the 'Misc' Menu. LOD and DOF
 Editors for creating/editing DOF and LOD FLT nodes
 inside of blender.
2008-08-20 19:10:33 +00:00
7608dcfc51 GameLogic.globalDict blenderplayer now keeps settings when loading new blend files.
workaround for python stopping and starting by storing the dictionary as marshal'd data. this means only python types are supported.
This feature is needed so when switching from a menu to a level blendfile, the configuration isnt lost.
2008-08-20 06:11:11 +00:00
b23f3f62c2 Ipo Handle vertex have own color and size (Venom request).
Now the vertex of the ipo handle have own color and
size, can be change from Theme -> Ipo Curve Editor:
	Handle Vertex		-	(Default Color)
	Handle Vertex Select	-	(Selected Color)
	Handle Size		-	(Point size, for vertex)

Add subverion so by default the handler have the same
settings that the ipo vertex options.
2008-08-19 14:39:11 +00:00
812583f1fa Added GameLogic.globalDict, this is a place where data can be stored even when new blend files are loaded. Using for apricot so frankie can go into levels in new blendfiles keeping his inventory, currently it dosnt work for the blenderplayer which stops python before loading new blend files. 2008-08-19 11:53:24 +00:00
7f49f67352 Particles now got that force-hiding feature, too --> jahka: please take a look :) 2008-08-19 11:26:18 +00:00
a7f5109f23 BGE Blend file loading was using BLO_read_from_memory which meant relative linked libraries could not be found.
This is odd because BLO_read_from_file was commented out with """//this doesn't work anymore for relative paths, so use BLO_read_from_memory instead"""
Undoing Erwins changes from r7497, just use normal file loading. From the commit log its not clear if he means relative filenames or relative linked libs but from testing both work now.
2008-08-18 23:48:59 +00:00
Ken Hughes
deadd5ee01 Python API
----------
Add Material.enabledTextures attribute; this allows users to enable and
disable textures assigned to a material.
2008-08-18 22:39:55 +00:00
17e4222230 Little tweaks so 0 wind results in 0 noise, also removed double-mass dependancy in cloth 2008-08-18 19:32:21 +00:00
a06321d55c Implemented a find_nearest with heaps. This reachs a minimal number of distance queries.
But the cost of maintaining the heap seems to be very high.

For now DFS with local heuristics gets better times.. so BVHTree still uses that.
2008-08-18 19:31:40 +00:00
d6a9f7f485 Made modification alert slightly less intrusive and added Ignore option. 2008-08-18 17:08:25 +00:00
8562efe8a3 a) Forces can be hidden by deflector object now (need to talk with jahka about particle integration - should be copy-paste) see http://dldw.de/tmp/index.php?file=w2.blend (press play button in timeline and change the absorption value ob the cube) b) fixed deflector/collision bug with continues physics c) cloth wind/forces uses masses now d) even faster collision object gathering e) have fun ;) 2008-08-18 14:41:24 +00:00
2ce338f7e8 svn merge -r 16077:16174 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-18 14:33:26 +00:00
e1ceab6ed6 Missed parentheses from except clause, has a whole different meaning. 2008-08-18 14:16:34 +00:00
410dbe9037 python get/set material function for 3d text 2008-08-18 12:40:31 +00:00
5aecd230cb Fix for bug #17485: inter object sensor/controller/actuator links could
get lost in reading libraries. The pointers were being remapped in the
expand stage, but not all objects were guaranteed to be linked in at that
point, so they got lost. Now it always does this in the lib linking stage
for both regular and library objects.
2008-08-18 11:55:40 +00:00
d5a890c078 a) New unified effector system by Janne (jahka) + Me (genscher): particle and cloth/sb don't use different systems anymore. b) cloth wind corrected for new system c) Wind has noise option now d) @ Bjornmose: since the old factors are gone SB doesn't need to divide by 1000 etc. anymore. I didn't want to touch your code - you might like to take a look at it :) 2008-08-18 11:09:27 +00:00
a84d346939 #2: Fixing compile errors on mingw/cygwin (reported by aligorith) 2008-08-18 10:48:37 +00:00
f876fd66b4 Fixing compile errors on mingw/cygwin (reported by aligorith) 2008-08-18 10:37:15 +00:00
d39cdd7aad Moving the find panel caused some funky projection effect, introduced when I fixed the scrollbar. The scrollbar and panel now play nice. 2008-08-18 10:24:56 +00:00
7f30e5fdd2 Better class support with inheritance for text parsing. 2008-08-18 10:01:49 +00:00
ff45582551 Added vec.reflect(mirror) method to Python Mathutils Vector type
also made sensor and actuator text areas a bit bigger so full names can be read.
2008-08-18 02:29:25 +00:00
89a735e4f8 BVHTree fix (non 2.47)
It was building incorrect trees when there was only 1 leaf.
Code fixed to always generate a tree with at least 1 branch.. since most of bvh code relies on this.
2008-08-17 23:48:16 +00:00
0c79804dbe another compile fix reported by ccherrett 2008-08-17 23:03:45 +00:00
0db489b119 another compile fix reported by ccherrett 2008-08-17 22:58:00 +00:00
ed9a0fe7e9 Update MSVC project files after Win64 patch 2008-08-17 22:32:40 +00:00
9f6109002b Fix compile problem in MSVC after Win64 patch 2008-08-17 22:28:30 +00:00
904b97eee9 Win64: Another missing include only appearing with powerpc-apple-gcc-4.x (reported by daredemo/#blendercoders) 2008-08-17 19:58:13 +00:00
0c5adb7504 Win64: compiles fine with scons with gcc now 2008-08-17 17:22:10 +00:00
62845c3d52 Win64: forget include => this compile errors never showed up on msvc (if anyone wonders) 2008-08-17 17:16:49 +00:00
1f46aaa547 Win64: forget include 2008-08-17 17:12:10 +00:00
7fd701ab58 == BPython API ==
Bug: Draw.Number wasn't properly checking that the initial, min and max values passed to it were numbers. On errors Python would set an error flag that would only be caught later on, masking where the real problem was. Pesky bug...

Reported by André (jaguarandi) on irc, thanks!

PS for bpy devs: PyInt_AsLong returns -1 on error and sets the error flag. With functions like that we need to take special care or not that obvious bugs appear.
2008-08-17 17:11:51 +00:00
f4d682dd2c Win64: forrget include 2008-08-17 17:11:00 +00:00
fd0072e77c Win64: please check my changes if you ran across them ;) But should be fine since no additional crashes were reported! 2008-08-17 17:08:00 +00:00
68765dc94b Win64 commit: first little commit to test how it compiles on other plattforms - I'll then commit the other changes if all is fine :) 2008-08-17 16:36:37 +00:00
e93151dc39 Fix for text area scrollbar drawing incorrectly 2008-08-17 10:10:25 +00:00
3a62928777 Fix for numeric var types creating an error. 2008-08-17 10:08:38 +00:00
5c2015fa89 Fix for fix. Forgot to check if markers exist before trying to clear. Oops 2008-08-17 09:46:47 +00:00
fda00bc034 BGE patch: New Delay sensor (derived from patch #17472)
Introduction of a new Delay sensor that can be used to 
generate positive and negative triggers at precise time,
expressed in number of frames. 
The delay parameter defines the length of the initial 
OFF period. A positive trigger is generated at the end
of this period. The duration parameter defines the 
length of the ON period following the OFF period.
A negative trigger is generated at the end of the ON period. 
If duration is 0, the sensor stays ON and there is no 
negative trigger. 
The sensor runs the OFF-ON cycle once unless the repeat 
option is set: the OFF-ON cycle repeats indefinately 
(or the OFF cycle if duration is 0).

The new generic SCA_ISensor::reset() Python function
can be used at any time to restart the sensor: the
current cycle is interrupted and no trigger is generated.
2008-08-16 20:45:37 +00:00
9b6dffad2d Fixed problems with markers where Edit All did not behave the same for every marker and deleting selections that intersect markers did not remove the marker in all cases. 2008-08-16 20:31:38 +00:00
ae42934c93 Boids didn't get correct fall-off from wind effector.
Boids now react to vortex field also.
2008-08-16 16:29:12 +00:00
a6514f0c39 Animateable (ipos) power and fall-off for particle effectors. 2008-08-16 16:21:01 +00:00
310a6e2179 Esc removes markers in stages. Temporary markers are removed first (if any) then other markers follow. 2008-08-16 14:38:08 +00:00
a5d414c298 warning message for when sensors loose their controllers, has been a problem recently with linking in groups that contain game logic.
- also useful for testing bug [#17485] Sensors lost when loading objects from a group (apricot showstopper)
2008-08-16 12:42:34 +00:00
1ffede8872 SCA_PythonController.cpp - Made errors in python print the controller name, useful when blender crashes on printing the python error which happens frequently.
buttons_logic.c - NULL checks for game logic buttons, linking in groups with some logic links to objects outsude the group could crash blender. There are NULL checks for this case elsewhere so I assume it should be supported.
CMakeLists.txt - remove YESIAMSTUPID option, is not used anymore.
2008-08-16 00:06:51 +00:00
d1d1d2b870 Improvements to the base BPyTextPlugin module:
- Added a centralized function for resolving targets (aaa.bbb.ccc)
 - Added documentation support for locally defined classes and methods
 - The time taken to parse now dictates how long to use the cache before parsing again
 - Other tweaks and comments and support for numeric var types

The text plugin scripts have been updated to make use of these features.
2008-08-15 23:14:22 +00:00
528722f472 BGE bug fix: the fix in revision 16022 for bug #17450 was wrong: the formula used to extract scaling and rotation was giving incorrect results for some type of rotation, leading to wrong position and orientation for parented objects with no scale applied. The new formula follows Blender's internal math. 2008-08-15 22:17:50 +00:00
a88eb64f70 Simpledeform origin is no longer attache to parent by default
That was due to a current limitation on dag system.. that leads to cyclic dependencies.

So now you can attach the origin of a simpledeform  to an empty and mark whether its
affected by the relative position of empty or the global one.

brecht found a workarround to solve the cyclic dependency by
using a parent of both the mesh and the control empty:

empty_parent
 |
 |-> empty controlling simpledeform
 |-> mesh with simpledeform modifier
2008-08-15 00:51:44 +00:00
bda3e4f8e2 Merge from trunk 16031:16122 2008-08-15 00:00:27 +00:00
feb5e3a688 Add a function to join thread by index in the thread list.
This can be safely merged in trunk, in case anyone needs something like that.
2008-08-14 23:48:52 +00:00
db42038bcf merging trunk 15964 -> 16116 2008-08-14 21:16:48 +00:00
c965ef7824 Fixing button placement typo reported by Carsten on mailing list 2008-08-14 19:16:55 +00:00
4cec480338 Used the Python icon for the text plugin button and created an ON version. 2008-08-14 17:09:39 +00:00
7b1a2d5f3a Got rid of the horrible blocking UI problems with Find and Replace by using a blockhandler panel. The panel is shown when find is invoked with Alt F (or from the menu). Successive presses of Alt F search again, while the panel is visible. Alt H does the same for replace. (Ctrl F and Ctrl H also work - more like other editors) 2008-08-14 16:22:25 +00:00
c37923c7a3 Fixed bug related to some missed rays-hits.. just a lack of a FLT_EPSILON 2008-08-14 15:37:47 +00:00
c5d902133f Bugfix for a) Fluid ipos gone after save-load b) changing viscosity causes fluidsim to be reversed [both reported by broken] (at least 3 known bugs left) 2008-08-14 09:19:41 +00:00
47c2271d67 Python API get/setObject update for Actuators. (SetParent, AddObject, Camera and TrackTo)
* bugfix for BGE python api - SetParent actuator getObject would segfault if the object was not set.
* Added utility function ConvertPythonToGameObject() that can take a GameObject, string or None and set the game object from this since it was being done in a number of places.
* allow setObject(None), since no object is valid for actuators, Python should be able to set this.
* added optional argument for getObject() so it returns the KX_GameObject rather then its name, would prefer this be default but it could break existing games.
2008-08-14 08:58:25 +00:00
639f3e12a9 Last part of the svn release commit.
No need freeze, in a sec I merge both revision into
the 2.47 branch and tag it.
2008-08-14 06:42:52 +00:00
ae3a875ad2 Part one of the 2.47 release commit 2008-08-14 06:33:19 +00:00
29668ba2d0 bugfix (good for 2.47) - 2 cases of returning Py_None without increfing it. this can crash blender. 2008-08-14 05:06:59 +00:00
3f2cb6e878 game engine python api
* removed macros that were not used much, some misleading.
* removed error string setting calls that overwrote the error set by PyArg_ParseTuple with a less useful one.
* use python macros Py_RETURN_NONE, Py_RETURN_TRUE, Py_RETURN_FALSE
2008-08-14 03:23:36 +00:00
8da4ad74e9 Added subsurface levels option to normal projection.
Now when doing normal projeciton is possible to ask it to project along the normals
that the vertex would have if it was subsurfaced... this gives "better" projections on
low polys.

Point of this commit is to add the feature request from Eclectiel
http://blenderartists.org/forum/showpost.php?p=1181531&postcount=9

workflow as Eclectiel wanted is now possible:

to archieve a nice low-res retopology that aproximates a high-res mesh when subsurfaced:
1 - make base low-poly retopo
2 - apply a shrinkwrap with projection along normal.. and with SS level = N (where N>0)
3 - add a Subsurface with level N
4 - run bretch's script (ss_fit)
2008-08-14 03:05:13 +00:00
6a5976a0f5 Added a Marker sub-menu to the Edit menu in the text space header. 2008-08-13 21:13:56 +00:00
715ca7cbf6 starting threading code for retarget
nothing working yet, will finish tomorrow at home
2008-08-13 20:33:57 +00:00
89be876f96 Fixed problem of "lack of normal information" 2008-08-13 20:18:56 +00:00
43bf03580f svn merge -r 15988:16077 https://svn.blender.org/svnroot/bf-blender/trunk/blender
To have the 50% faster nearest_surface point.
Changed mesh_faces_nearest_point to return the face normal instead of collision normal
2008-08-13 19:22:35 +00:00
d2750f7bda Snap menu header rewording, to make documentation clearer (there was "mode" and "snap mode").
This can and should be merged for 2.47, as the docs will use those wordings.
2008-08-13 17:38:38 +00:00
6a8236a8da Fixed a typo
I was using the word "kept" (past tense) instead of "keep" (basic form).
I hope my english teachter dont sees this commit xD
2008-08-13 17:34:09 +00:00
55438d9fe0 Small bug fix: Scripts were not being recompiled after an error, if the (auto-selected) erroneous text was simply deleted and the script re-run. 2008-08-13 17:29:51 +00:00
3713470204 Fixed compile for windows 2008-08-13 13:36:09 +00:00
e2c42be829 PageUp/Down now moves the mouse cursor instead of just the view. Also added some other pops for when the cursor went off screen (click after horizontal scroll, undo, redo, etc.) 2008-08-13 12:20:49 +00:00
d60025e95f Bugfix: in the game engine, errors in a particular python script caused
somewhat random crashes, which I think was caused by the error print
using python objects that were freed too soon. Now it frees the dictionary
after the print.
2008-08-13 10:19:47 +00:00
1e7e8ceaac fixed a bug related with "cullfaces" option on shrinkwrap
enabled openmp during the tree queries (before it was only enabled during tree building)
2008-08-13 01:38:13 +00:00
5ade004592 Added a button to allow plug-ins to be enabled/disabled for each text space. It was confusing using the syntax button for both. 2008-08-12 22:12:24 +00:00
c6de35e558 *Added documentation mainly at shrinkwrap.c
*removed commented code about the dropped shrinkwrap options
*Removed references to "cut plane", "limitMesh".. its now called "auxiliar target"

*Added option to shrinkwrap over an selected axis
*"Normal projection" mode is now called "projection" since it can now project over "normal, and any combination X, Y, Z"
2008-08-12 20:43:10 +00:00
b30a925447 Add missing stuff in new scene code to properly init skeletor params properly.
Add sanity check on file load to fix old files (won't be merged in trunk).
2008-08-12 19:56:03 +00:00
65d0ef3e74 Speed improvements for reading text lines and the option to specify a range for Text.asLines([start[, end]]) Also some tweaks for the plug-in scripts and updates to pydocs. 2008-08-12 15:17:08 +00:00
7af0643df7 New nearest_point_in_tri_surface function.. 50% faster
Results were verified against the old function

Non 2.47 fix
2008-08-12 13:30:17 +00:00
2345757746 raise an error when assigning properties to a game object that cant be converted. also use python apis functions for converting floats and int types (faster then PyArg_Parse) 2008-08-12 12:32:54 +00:00
0410775e2e Rolled back on rev. 16039. Had problems with display, messages being blank and scripts not being recompiled in some cases. Needs more thought before committing. 2008-08-12 10:08:46 +00:00
bd34ecafef svn merge -r 15973:16060 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-12 09:49:46 +00:00
5a310fe8e1 Bugfix for non-compiling on msvc and mingw (reported by Matt) 2008-08-12 09:36:51 +00:00
ea134f8411 bdiego no 2.47 option for now
make soft bodies spawn threads on a mid level 
use G.rt == 16 to switch to 'old style'
i am going to remove that G.rt switch if everyone is fine /* i do not intend to keep 2 versions of code up because of "BAD STYLE" */
so .. give feed back ..
2008-08-11 20:40:29 +00:00
d4f1a98219 Fix flipped arc caused by harmonic interpolation 2008-08-11 20:01:15 +00:00
Ken Hughes
7f3a2a4abe Python API
----------
Added texture.offset and textute.gain attributes, to access parameters for Musgrove textures.
2008-08-11 19:06:30 +00:00
7e7d416f4d svn merge -r 15988:16055 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-11 13:29:38 +00:00
991539d1c8 preparing to merge trunk (those files were sent to trunk) 2008-08-11 13:16:06 +00:00
d90d413421 Suggestion list scrolling and selection made independent for easier use. Selections no longer move away from the cursor. 2008-08-11 11:10:16 +00:00
04b90467c3 * Fix for a bug zanqdo reported in IRC - transparent shadows were not
getting correct alpha when cast through node materials - in fact the 
node tree wasn't being shaded at all.
2008-08-11 05:23:36 +00:00
f876930904 fix for [#17365] PLY export script writes comment in invalid way
this is good for 2.47
2008-08-11 03:52:21 +00:00
a5d955632f Added sys.path module search to BPyTextPlugin module and fixed IndentationError when parsing. 2008-08-10 17:00:25 +00:00
5dad154414 Fixed inconsistencies between the text plugins and them not suggesting when called from the menu. 2008-08-10 16:07:14 +00:00
fb3a42d0f9 Shift keys cancelled the suggestions list (missed from earlier event refactor) 2008-08-10 14:24:14 +00:00
6ba72d4550 Fixed saving to relative paths and made external modification messages more user friendly. 2008-08-10 12:02:33 +00:00
f3c138e131 Changed a few places where visibility for EditMode bones is tested, so that they now use a macro I introduced in the previous commit. 2008-08-10 03:39:09 +00:00
2fe31596e3 == Armature Editing Tweaks ==
* New Tool: Switch Direction
This tool switches the direction of selected bones in EditMode, and can be found under the Specials Menu (WKey). It also adjusts the parenting, so that continuous chains can still be linked. 

* Bone Locking:
Removed Lock/Unlock functions from Specials menu, and moved this functionality under the Toggle/Set/Clear Bone Settings tools (Shift/Ctrl-Shift/Alt W respectively)
2008-08-10 03:10:07 +00:00
00c308391a * Script to convert BDF pixel fonts into C++ files blender can read. - Amiga bitmap font example http://download.blender.org/ftp/incoming/bitmap.png
* BF_CONFIG was missing from SCons help menu.
2008-08-10 01:38:02 +00:00
Ken Hughes
295155b448 Python API
----------
Remove documentation for Render.EnableEdgeShift and Render.EnableEdgeAll methods, which are no longer in the API.
2008-08-09 22:24:12 +00:00
c1e9d25364 Fix bug caused by extranuous return in distance weight calculations (ignored the weighting parameter)
Extract constant for shape level matching
Go to lowest node with matching shape, instead of just lowest node (created bugs)
2008-08-09 19:39:31 +00:00
83bcb9deff Python errors originating in the active text are now displayed at the top of the text area. Errors in other files/scripts still pop up a message as before and all errors are still printed to the console. This removes the need to switch to the console for local errors. 2008-08-09 18:11:40 +00:00
4c89ee7838 Line highlighting did not work for syntax errors. 2008-08-09 14:47:51 +00:00
7cbfe78044 Bugfix #17465: "Pose Edit Not Possible" message activated on 3D navigation
When navigating the 3d-view with a bone (or bones) selected, 'Rest Pose' enabled for the armature, and 'Orbit Around Selection' turned on, a "Pose Edit Not Possible" warning would pop up every time the view was manipulated. 

Was caused by a missing check for the 'TFM_DUMMY' transform mode used when calculating center to use (based on active item)
2008-08-09 10:50:59 +00:00
ed972db1a3 Merge from trunk: 15912:16031 2008-08-09 10:12:59 +00:00
d7f64d43dd Whole word ops. now treat symbols differently to whitespace allowing better control over cursor movements (solves mindrones' request). 2008-08-08 23:14:32 +00:00
4d83ce920a Improvements to the suggestion and doc listing events (when to update and when to remove). 2008-08-08 20:30:55 +00:00
e9c92144d1 Clipboard operations added to text editor RMB menu. 2008-08-08 16:49:14 +00:00
adcd339198 Fix for [#13697] Reactor particles with children doesn't render
-Particles were being recalculated a bit too aggressively. Normal particles didn't care, but since reactor particles have dynamic birth times they lost crucial information in the recalculation.
2008-08-08 16:40:41 +00:00
d42891975b Typing 'from a import b' threw an error if b was not found. Accidentally moved this out of the try block in an earlier tidy-up. 2008-08-08 15:54:04 +00:00
3832af90d7 Fix for [#16671] Moving a metaball that a particle system uses as a object (for visualization) also moves the particles
-The particle dupliobjects were using the objects trackflag in combination with it's rotation causing strange behavior. Now the trackflag is ignored and only the rotation of the object being duplicated is taken into account.
2008-08-08 15:38:14 +00:00
6501ff6bdd Fixing point-face distance to support degenerated tris/quads with area<FLT_EPSILON 2008-08-08 14:24:47 +00:00
98302f6c7c forgot update ver.number in last commit 2008-08-08 11:40:51 +00:00
277a420a90 == PoseLib: Add New (on Current Frame) ==
When adding poses to a PoseLib, it is now possible to make them be added on the current frame. It is still recommended to use the default method (plain Add New), as it is prevents poses stored in the PoseLib from being overwritten accidentally.
2008-08-08 10:15:08 +00:00
62f9ba67c0 BGE bug #17450 fixed: When we have parented objects with no scale-applyed objects the ray hit system doesn't work properly. Fix by separating rotation and scaling in the parent inverse node to keep scaling correct down to the leaf objects. Only isotropric scaling should be used, as always with the BGE. 2008-08-08 09:57:17 +00:00
fa98def953 Update MSVC project to include bvhutils.c 2008-08-08 09:52:32 +00:00
1d425f8da2 -> Fix for warnings in FLT exporter and Palette Manager
Removed buffer overflow masking warnings from the
FLT exporter and Palette Manager.
2008-08-07 22:31:35 +00:00
a821c8af1e Typing digits over the line numbers jumps to that line (from mindrones' wishlist) 2008-08-07 22:15:54 +00:00
c58e27d070 Fixing compile error with msvc (introducing max tree to 32) 2008-08-07 22:05:45 +00:00
2edb87d90e Fixed compiling warnings of bvhutils.c
Commited the right version of BLI_kdopbvh.c
2008-08-07 20:12:56 +00:00
Ken Hughes
10dc8169cc Disable redcode (the file format of RED one, R3D) by default. 2008-08-07 18:01:39 +00:00
36ef95eff5 BGE bug #17408 fixed: Radar sensor is oriented the wrong way when the set along negative axis. Improve reliability of Radar detection by clearing the manifold cache instead of updating it. 2008-08-07 17:29:06 +00:00
c25bb4685a BVH-KDOP update (merge from shrinkwrap branch): supports raytracing, nearest neighbour, non-recursive now, faster than kdtree.c implementation normaly, divided into 2 sources: generla structure in blenlib, mesh/derivedmesh depending interface stuff in blenkernel 2008-08-07 17:27:29 +00:00
29a44ca927 Moved bvhtree_from_mesh api to its own files
BKE_bvhutils.h and intern/bvhutils.c
2008-08-07 15:18:47 +00:00
0b533d022d Added several comments to BLI_kdopbvh
Changed BENCH to print both wall-clock/real time and cpu time
2008-08-07 14:26:27 +00:00
a37938ea3c Word-wrap support for up and down arrows between lines, and home/end keys for a wrapped line segment. 2008-08-07 14:21:43 +00:00
15952fb26c BGE bug #17409 fixed: BGE Near Sensor Incorrect once inside the radius. The bug is located in Bullet: the manifold contact points for non-response objects (sensor, ghost) are not refreshed and stay in the cash as long as the objects overlap in the broad phase. Instead of fixing Bullet, I put a work around in the BGE. This may need review when a new Bullet library is integrated 2008-08-07 11:31:24 +00:00
3adf5dda97 BGE fix: alignToVect() fac parameter clamping should obviously be done the other way round 2008-08-07 11:25:45 +00:00
a1f46e1e32 fix for [#17448] Duplicating textures with IPOs doesn't increment IPO user count 2008-08-07 09:56:31 +00:00
66d6221899 -> Slight tweak to FLT exporter
FLT files written by the FLT exporter would
reference external files (other FLT files,
texture maps, ect) with standard backslash
seperators on win32. However, many tools
that deal with FLT files expect directory
seperators to always be forward slashes
regardless of platform.
2008-08-07 04:38:35 +00:00
5d62ad194d added back copy buttons to "Texture Face" panel. 2008-08-07 01:02:06 +00:00
Chris Want
ba12aa0962 Getting the blenderplayer to compile/link with CMake.
Note: yuck, this is a horrible way to do it -- python devs should
think about splitting the python stuff into separate libs if they
only want to partially include it in the game engine.
2008-08-06 20:37:15 +00:00
Ken Hughes
6688ab7ae4 Python API
----------
Fix typo in documentation for render.startFrame() and render.endFrame().  Arguments are valid in the range 1 to MAXFRAME.
2008-08-06 20:05:08 +00:00
Chris Want
5539d57b1a Fixed a warning due to a change in policy between cmake 2.4 and
cmake 2.6. (Other warnings still exist, but are harder to fix.)
2008-08-06 19:47:52 +00:00
523634ca17 svn merge -r 15908:15988 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-06 16:50:07 +00:00
e57c5ef56c Fixed non_recursive BVHbuild with openmp
CHanged the BENCH functions to use: gettimeofday (wall time) instead of clock (cpu time)
This was to test if the openmp was working right.
2008-08-06 15:46:38 +00:00
6c0f4660ed Various UI drawing and event tweaks to make markers feel more natural and avoid getting in the way. If there is a marker under the cursor, ESC will remove it and others in its group. Otherwise all temporary markers are removed. Tab finds/cycles/removes temp. markers, cycles non-temp. markers (under cursor) and behaves normally in all other cases. 2008-08-06 13:46:44 +00:00
8102217b9c BGE fix: confirm fix for segmentation fault by Diego and remove warning in calling ConvertMaterial Ipos. 2008-08-06 10:23:47 +00:00
553e35e36f * blenderplayer wasnt useing the scenes frame rate.
* GBE Python API's alignToVect wasnt clamping the align ammount from 0.0-1.0
* Generated images arnt animated - use for a test to see if the textures animated.
2008-08-06 04:09:10 +00:00
799ba2c351 Added a Python interface to the marker system with a few additional functions for modifying text selections in general. Tweaked some of the events and drawing code and added a template completion script along the lines of gedit's snippets. 2008-08-05 23:23:31 +00:00
028d44c075 Made Mathutils its own module rather then GanmeLogic.Mathutils 2008-08-05 22:26:00 +00:00
553da831e6 Update MSVC project files for Mathutils support in the blenderplayer 2008-08-05 22:23:38 +00:00
Ken Hughes
ab5f21e24c Fix compiler warnings from earlier commit. 2008-08-05 22:13:13 +00:00
a86609af8e Fix segmentation faul in GE.
We assign the material name before check the pointer.

Please Benoit check this and also I have a compiler warning
about the second argument in the previous call of
ConvertMaterialIpos, the argument is NULL but the function
need a dword.
2008-08-05 21:20:14 +00:00
2d04b641d4 Just a tmp commit about bvhtree build
Theres something broken with BVHtree queries.. updates are not advised at all
2008-08-05 18:49:51 +00:00
06c3dee92b Find and Replace now support "Mark All" which marks all occurrences of a string and allows them to be edited from one instance. Improvements have also been made to the UI allowing better control over which occurrences to replace. 2008-08-05 17:43:03 +00:00
553694b614 BGE fix bug #17430: BGE Collide/Touch Sensor interfearing with other unrelated sensor states. The bug was introduced in the recent logic optimization patch. It only affects collision and touch sensors. The bug is fixed by keeping track of registration count. 2008-08-05 16:23:33 +00:00
1d87a596e4 svn merge -r 15800:15973 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-05 16:12:40 +00:00
b277de2895 Fix for [#17421] Issue with Displace modifier not updating with
animated textures

I have added a dependsOnTime function for the Displace modifier which checks
if the displacement texture has IPOs, is a plugin, or uses an animated image.
2008-08-05 14:42:04 +00:00
cd1d46c61d Added GameLogic.Mathutils so Mathutils and its types can be accessed from blenderplayer.
also changed importText so it dosnt do a malloc
2008-08-05 09:35:46 +00:00
9e968cea47 Bugfix #16673: Segfault when using Bake Constraints Script
There were several buggy things here (in order of significance):
1) PyAPI method didn't check to make sure that there was an active posechannel when deleting posechannel constraints. This was required by constraint_active_func() to be able to update the 'active' flags for the constraints in that stack
2) PyAPI method removed the links to the constraint data from the constraints list, even though that wasn't necessary, and may have caused memory leaks. 
3) constraint_active_func() had no error checking for no constraints-stack being found
2008-08-05 03:29:46 +00:00
e238066525 Merging with trunk
15568 - 15963
2008-08-05 02:27:09 +00:00
07bc1e56fe own bug in weightpaint cleaning, wasnt removing as many groups from verts as it should be. 2008-08-04 23:20:12 +00:00
53e535dfcf Text Markers: multiple, coloured selections within a Text object with group relationships. They allow portions of text to be edited as one and enable quick jumping between and editing of different areas.
Flags control the behaviour and grouping of markers. At present, Ctrl+M places a marker with TMARK_EDITALL set for testing purposes.

I have also split the text area event handler into separate methods for marker handling and the existing text tools. This makes the events system much easier to follow as it was getting a little hairy.
2008-08-04 23:01:47 +00:00
0008b1d424 Shrink BVHNode by 16bits 2008-08-04 20:30:57 +00:00
d4b646103a Option to hide embedding dots on display
Merge internal and external filtering in a single loop (solve problems caused by order of filtering)
Made graph length calculations work on cyclic graphs (it unrolls them)
2008-08-04 19:12:42 +00:00
8d285fc10a Fix for better icc + openmp support using scons 2008-08-04 17:24:11 +00:00
51d90eeb49 Fix for [#17291] Array modifier merge caps leaves a whole
This code was missing a test_index_face call after merging, so it was making
quads with v4 == 0.
2008-08-04 16:44:13 +00:00
cbec9883f9 Fix for [#17376] Applying mirror modifier does not respect UV pinning.
The custom data system wasn't swapping pinning or selection flags for MTFace
data when face vertices were reordered.
2008-08-04 14:49:55 +00:00
a0f39107fd Made shrinkwrap variables be initialized when declared 2008-08-04 14:27:25 +00:00
9ec6083cfe Fix for [#17414] Particles doesn't obey to lattice once children are added
-Lattice calculations were left out for children by accident
2008-08-04 14:17:11 +00:00
0c9508d248 Fix for [#17366] Particle children from particles only take colour from UV-Maps
-Some old code in particle rendering hadn't been updated properly.
2008-08-04 13:57:04 +00:00
919eba04de SimpleDeform modifications:
* Added "Lock axis" options on taper and strech/squash (suggested by ZanQdo)
  * Better control of deform factor (suggested by ZanQdo)
  * Added eModifierTypeFlag_AcceptsCVs (so it now accepts both curves and meshes)
2008-08-04 13:12:35 +00:00
d786fead10 Fixed double inflation in case of co_moving points 2008-08-04 11:50:36 +00:00
2e6a3710bb * Armature hierarchy selection tools
These are for use in pose mode or armature edit mode, to let you quickly traverse up and down a chain of bones. 
It's quite useful for bones that are in hard-to-click places.

The tools are:
*Select parent/child ( [ and ] )
selects the parent or child of the active bone, deselecting the original active bone

* Extend select parent/child (shift [ and shift ] )
selects the parent or child of the active bone, adding to the selection

Thanks to Joshua for reviewing this so promptly!

PS. I'd like to use these [ and ] keys more widely in blender as consistent 'select next / previous' tools. I can imagine it being very useful for a lot of things like keyframes, nodes, mesh edges, etc.
2008-08-04 11:47:17 +00:00
3598dcd279 * KX_GameObject.cpp - error with getMesh(), was returning None rather then an error with invalid args. also memory leak with getVectTo() if invalid args were given.
* Material.c - functions for get/setRayTransGlossSamples were not being used.
* BPY_interface.c - removed function GetName(), since everything else just uses id->name+2.
* header_info.c - added ifdef win32 around copy_game_dll since its not needed for other os's yet
2008-08-04 01:57:22 +00:00
ae762bec91 BGE patch #17398 approved: implementation of BGE method getVectTo(). 2008-08-03 21:59:36 +00:00
df2364ab1a Update MSVC project files for new Boolean Operation file (BOP_Merge2.cpp) 2008-08-03 21:57:52 +00:00
b647c5bba5 == FFMPEG ==
This fixes:
[#16655] Blender crashes when Fraps videos are added to the sequencer

(sorry, color conversion is not supported by swscaler for some reason,
so currently, only the crash is fixed)
2008-08-03 16:11:57 +00:00
ac7aef6b3d DXF-importer script. Works well with 2.46winXP
Please commit to 2.47 branch
patch history:
 v1.12 - 2008.08.03
 c2 warningfix: relocating of globals: layersmap, oblist 
 c2 modif UI: buttons newScene+targetLayer moved to start panel
 v1.12 - 2008.07.04
 c1 added control Curve's OrderU parameter
 c1 modif UI: preset buttons X-2D-3D moved to start panel
 b6 added handling exception of not registered LAYERs (Hammer-HL-editor DXF output)
 b5 rebuild UI: global preset 2D for Curve-Import
 b5 added UI-options: PL-MESH N+N plmesh_flip and normals_out 
 b5 added support for SPLINEs, added control OrderU parameter
 b5 rewrote draw module for NURBS_curve and Bezier_curve
 v1.12 - 2008.06.22
 b4 change versioning system 1.0.12 -> 1.12
 b4 print at start version-info to console
 b3 bugfix: ob.name conflict with existing meshes (different ob.name/mesh.name)
2008-08-03 15:57:09 +00:00
855fa737d7 == Sequencer ==
Fixes:
[#15082] Sequencer: for image strips, the Input file field disappears if the cursor is out of the selected strip

also it wasn't really a bug, since the file name of image input strips
_has_ to depend on CFRA.

Well, we choose the next possible image strip, which is most likely the thing,
most people expected...
2008-08-03 15:56:35 +00:00
7fc6741bcf == Sequencer ==
This fixes:
[#17405] Sequencer: unselected black strips are unreadable
using
[#17418] Fix for bug #17405: unselected black seq strips text unreadable

Thanks to Roelf De Kock for providing the patch and 
mindrones for the bug report :)
2008-08-03 15:45:53 +00:00
c2cd6bebe6 added openmp support for bvhtree build (max processes = tree_type) 2008-08-03 15:37:24 +00:00
cad3b73144 == Sequencer ==
This fixes:
[#17413] Sequencer: Blender crashes pressing R on a color strip
2008-08-03 15:35:56 +00:00
27b259345e Grease Pencil Drawing:
Some WIP code for 'nicer' drawing of thick 2d-strokes that will hopefully result in smoother lines, particularly with abrupt direction changes. Currently the code is hidden behind the rt button (for rt != 0), as in some cases, it still looks rather bad.
2008-08-03 11:55:45 +00:00
7a14a3580b Little speedup for kdop-bvh 2008-08-03 11:40:09 +00:00
ae5217733d Added shrinkwrap as a constraint.
All modes are available:
nearest surface
nearest vertex
normal projection (along X,Y or Z axis)
2008-08-03 02:02:15 +00:00
1d49ed89cb Bugfix for non working selfcollisions [no 2.47 bugfix] 2008-08-03 01:41:57 +00:00
ad2be5f64f Bugfix for weird + in the code, no idea why it compiled (yet some selfcollision bug to fix) [no 2.47 fix] 2008-08-03 01:00:51 +00:00
bf168dc3c5 Small update to get the BlenderPlayer compiling (also needed for 2.47) 2008-08-02 22:11:22 +00:00
e632b966ec BKE_global.h include path wasnt correct. made boxpack2d.c a bit more
readable. no functionality changes.
2008-08-02 21:39:01 +00:00
03f9c6a3fc Copies all required DLLS for Save Game as Runtime.
Under Windows, all DLLs are copied to the same folder as the runtime .EXE, so that the process becomes a single click and deploy solution.

Linux doesn't require this ( thx for info centralnoise ) and will update to work on OS/X after I do a bit of research on .a and .so files ( thx for info kaito ).
2008-08-02 17:08:16 +00:00
341655eab7 == imagebrowser ==
- HKEY now toggles hide/show dotfiles
2008-08-02 09:44:01 +00:00
82d87b2ab9 * patch #17394 by Vilem Novak - add menu item for 'Make Proxy Object'. Thanks! 2008-08-02 06:31:56 +00:00
38aa350173 * (slightly modified) old patch #7471 from Davide Vercelli - menu items for Show All Layers/Show Previous layers in the 3D View. Sorry this took so long! 2008-08-02 06:29:15 +00:00
b11790e08f * Minor tweaks to file menu item naming 2008-08-02 06:11:35 +00:00
451c00697f Scons - Mingw Compiling Fix:
When using BF_SPLIT_SRCS as a hack to get some of the larger libs compiled, there were some problems linking Blender related to some boolean calls. This commit tweaks the priorities for the boolean libs for the 'intern' group so that they get linked before the src libs are.
2008-08-02 00:25:50 +00:00
ed5002458b Merged 15771:15912 from trunk 2008-08-01 23:39:52 +00:00
Maxime Curioni
7565990db2 soc-2008-mxcurioni: made considerable changes to support cross-language polymorphism for UnaryFunction0D, Interface0D, Interface1D. Add to change UnaryFunction1D<void> to static UnaryFunction1D_void. Resolved namespace collision on the Image class (changed to FrsImage). There is greater support for style modules but somehow, some do not show anything yet (japanese_bigbrush being an example). 2008-08-01 21:55:58 +00:00
289d875dfd svn merge -r 15688:15908 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-01 21:37:36 +00:00
aa02e605f1 Fix for GE Make Runtime menu option
Doh - I forgot to add a comment to the previous commit.

This adds a file exists check for Make Dynamic Runtime for the GE.  It also removes this menu option for now, as the required file ( blenderdynplayer.exe ) hasn't been included with the Blender app for quite a few releases ( therefore the feature has been broken ).

I also renamed the option, to make it a bit more understandable.  This might even be better moved to the Game menu, but I didn't want to do that ( yet :) )
2008-08-01 21:17:54 +00:00
fc52146342 2008-08-01 21:12:47 +00:00
ede6c42dc2 Fix problem with long stretches without embedding between head/tail nodes and the actual start and end of embedding bucket.
Instead of having to muck around in the generating and retargetting code to deal with those cases, just fill dummy buckets with interpolations.
2008-08-01 20:29:42 +00:00
2568b3d486 Draw embeding points in blue, easy to visualize long stretches without embedings. 2008-08-01 20:01:01 +00:00
b767d406ad Mouse cursor positioning and selections now work with word-wrapped text. It's not the best solution but it does the job for now. I wanted to get a working version committed before I improve/break it. 2008-08-01 13:00:53 +00:00
115dfb22cc Ipo Editor would not allow access to either World or Lamp texture Ipos. Now it does. Fixes bug #17379. 2008-08-01 12:56:29 +00:00
Maxime Curioni
c324f0cbc7 soc-2008-mxcurioni: clean-up #2 2008-08-01 02:25:21 +00:00
Maxime Curioni
4580fd1415 soc-2008-mxcurioni: clean-up #1 2008-08-01 02:16:36 +00:00
Maxime Curioni
149f3688a4 soc-2008-mxcurioni: moved Curve to FrsCurve, fixed bugs with some style modules having with strokes without a representation and iterators not being correctly routed. For example, the cartoon style module should work now. 2008-08-01 02:15:25 +00:00
Ken Hughes
cb0aa467cd Tools
-----
New boolean merge algorithm.  The current code often does a poor job of merging tris and quads after the operation, resulting in many unnecessary faces.  This commit add a new algorithm which takes advantage of topology information saved in the interal BOP structures.

The file intern/boolop/intern/BOP_Misc.h has two #defines which control which algorithm(s) are compiled.  They are set now to compile both, with the new algorithm as the default.  The original algorithm can be enabled by setting the "rt" debugging button on the Scene panel (F10) to 100.

One note: the current boolean code still occasionally creates a non-manifold mesh from an operation on two manifold meshes.  The original merge algorithm would sometimes "close" these meshes and sometimes not.  The new algorithms behaves the same way, but sometimes closes a mesh the original would not and sometimes leaves open a mesh the original would close.  My fairly extensive tests did not indicate any significant difference in the percentage of final non-manifold meshes.
2008-07-31 18:37:03 +00:00
2c4a1bf381 Accidentally removed too many BIF_ThemeColors resulting in funny colours for non-syntax-highlighted text. 2008-07-31 18:16:01 +00:00
baf20b803f Selected two closest nodes when joining subgraphs, not just closest on one side with first on other side. (helps get good result out of high joining threshold) 2008-07-31 17:54:21 +00:00
d66449996c == Grease Pencil Eraser - Tweaks ==
Improved accuracy of the eraser a bit. Now it does a boundbox test first before trying to erase strokes, which means that other (rather unrelated) strokes are less likely to be affected as well.
2008-07-31 12:23:29 +00:00
db82e15e6f Korean translation, provided by J.H. Jeong (yongdori)
(Bugreport 17415)
2008-07-31 12:23:09 +00:00
Maxime Curioni
6a6c23ecd8 soc-2008-mxcurioni: moved namespace collision resolution to the freestyle_init.py (for Curve, Material and Noise) 2008-07-31 11:59:06 +00:00
726982be29 Word wrap fix: There were cases where the brackets, cursor and selections (which all use the same function) weren't lining up with the drawn text (which uses its own function). This fix simplifies the algorithm and hopefully now makes it work for all cases. 2008-07-31 11:54:17 +00:00
Maxime Curioni
f09f89d5dc soc-2008-mxcurioni: added a Freestyle panel to select a style at run-time, by specifying its pathname. By default, it is loaded with the contour.py path. 2008-07-31 11:20:30 +00:00
Maxime Curioni
3010f2b753 soc-2008-mxcurioni: the native Python system now supports cross-language polymorphism for the following classes: BinaryPredicate0D (__call__), BinaryPredicate1D (__call__), UnaryPredicate0D (__call__), UnaryPredicate1D (__call__), StrokeShader (shade), ChainingIterator (init, traverse).
Other methods could easily be supported in the future. The method now works as planned for the contour style. For style modules with Python shaders, there still is a problem that I will fix right away.
2008-07-31 08:50:12 +00:00
Ken Hughes
1b78333087 Tools
-----
Minor changes to boolean code; add an new include file to gather various
#defines global to the boolean system.  Currently, this just allows control
of whether some debugging code is compiled or not.

This is a precursor commit for some other boolean optimizations/cleanups.
But in case that commit is later reverted, this code should still remain.
2008-07-30 21:52:02 +00:00
Nathan Letwory
01b1bd4901 * another commit adding std:: to the sort call (older msvc [<9] choked?) 2008-07-30 20:45:04 +00:00
409d0eac7c Merge subgraph with closest node, not just first node under threshold. 2008-07-30 18:10:21 +00:00
8a8a12ed84 BGE patch: logic optimization part 2: remove inactive sensors from logic manager.
With this patch, only sensors that are connected to 
active states are actually registered in the logic
manager. Inactive sensors won't take any CPU,
especially the Radar and Near sensors that use a
physical object for the detection: these objects
are removed from the physics engine.

To take advantage of this optimization patch, you
need to define very light idle state when the 
objects are inactive: make them transparent, suspend
the physics, keep few sensors active (e,g a message
sensor to wake up), etc.
2008-07-30 17:41:47 +00:00
d05363627b Update MSVC project since recent commit 2008-07-30 17:22:57 +00:00
7f170c18bb Bugfixes: fix for two memory leaks related to dupligroups,
and a missing reference count in the trackto actuator. This
showed up as leaked pose data, but actually the whole object
was not being freed.
2008-07-30 16:15:15 +00:00
9667af9cfd Oops, forgot about horizontal/vertical scrolling. Cursor, selections and brackets should now draw correctly when scrolled. 2008-07-30 11:27:04 +00:00
2d3a57eaa3 Bugfix for mesh deformer under windows --> uninitialized variable was used in meshdeform_inside_cage() 2008-07-30 11:21:10 +00:00
f3a4f3adaf Grease Pencil Bugfixes:
* Segfaults with eraser should now be fixed 
* Attempted fixed for sequencer redraw problems with buttons
2008-07-30 09:20:05 +00:00
7b819bc631 == Grease Pencil - Eraser (First Draft) ==
This commit introduces the ability to erase strokes. Admittedly, the code for this is not totally stable yet, and doesn't always produce optimum results. I'm committing now for backup purposes.

It currently uses the lasso code to check whether segments of the strokes (a segment occurs between two recorded points) occur inside a region defined by the 'eraser' stroke, or any intersections it makes with the 'eraser' stroke.

There are multiple ways to erase strokes:
* With 'Draw Mode' on, use RMB-drag to erase
* With a tablet, use the 'eraser' end of the stylus
* Hold the Alt Key, and use the 'selection' mouse-button (i.e. LMB if mouse-button swapping is on, RMB otherwise) to erase. For this one, this is necessary to avoid overriding the view-rotation hotkey combo for 2-button mice!

Todo:
* 3d-strokes are not correctly mapped back to screen-space for sampling yet
* Drawing of eraser strokes is still not distinctive enough
* After running a few times, may cause stack corruption/segfaults, so be careful!


== Bugfixes ==
* Grease-Pencil Onion-Skinning works again. Onionskining was being supplied the wrong frames, and the alpha factor was still the old one used for 0-255 ranged colour values
2008-07-30 09:07:56 +00:00
Maxime Curioni
a482f64424 soc-2008-mxcurioni: Tested SWIG-less environment more and understood why the former predicate methods were not working. As Stéphane had mentioned a few months ago, Freestyle uses SWIG directors to provide cross-language polymorphism. The API and the system I had provided did not support that feature and only implementations in C++ were supported. To correct the problem, after researching how directors are implemented in SWIG, I provided the same functionality. So far, I only provided the code for the UnaryPredicate1D class and it works. The implementation is in intern/python/Director.cpp and Operators.cpp. I will port the remaining directors tonight and continue to test it.
To prevent strokes from piling up after each render,  I clear the canvas at each render now (as it should have been all along)
2008-07-30 01:51:40 +00:00
140a8b740d Bracket matching now works with word-wrap. Mouse selection and scrolling to do. 2008-07-30 00:05:19 +00:00
34bb446734 Simple changes to Motion Actuator UI.
This includes...

- Renaming dLoc and dRot as Loc and Rot ( as well as changing the tooltip to location and rotation ).  dLoc and dRot are programming terms, not user terms.

- Placing Loc and Rot as the two initial shown values, so that the physical ones are all shown together.

I also changed it so that only Loc and Rot are shown in the UI, unless the object is Dynamic ( as the other values only make sense if it is dynamic ).

These are just a few simple changes, that should make a lot of difference to users when learning how to use the GE.


--------------------------------------

Things I'd *really* like to do to this, when I get a chance to code Blender again ( hopefully in a few days time, after I have finished teaching on the GE course )...

Color / Colour tint the X,Y and Z entry boxes as slightly red, green and blue, to reflect the colour of the axis / transform gizmo
...or...
Just show X,Y and Z labels above all of the values.

Getting to grips with the whole XYZ thing is very confusing for users, esp when they are presented with 6 x 3 entry boxes.
2008-07-29 22:44:43 +00:00
Nathan Letwory
e04c48df86 * making sure BGE compiles after brecht's big commit (r15867). Needed <algorithm> to compile with msvc. 2008-07-29 21:56:50 +00:00
7f3c27995e Copy Attributes now has option to copy all physical attributes.
There existed two options to copy only the mass, and only the damping, but no option to copy all of the physical attributes.

This patch adds in this option, right under the Mass and Damping listings.
2008-07-29 21:49:59 +00:00
ca951b3627 Am teaching a GE course this week, and am finding some small issues that I'm hoping to patch.
This one deals with the very small default clipend value ( 100.0 ) when pressing P to run the GE from a non-camera view.  ( ie if the user zooms out a bit from the default box area, the box will get clipped out of view, so it's a WFT from the user )

To see what this fixes, load up Blender default scene, go into perspective, and press P. Everything looks grand.  Now, zoom out until the box is about 10 pixels high, and press P again.  The box will disappear / be clipped out.

I've set the clip end to the maximum ( 5000 ) as defined in Camera.h.

This should be suitable for inclusion in 2.47 branch also.
2008-07-29 20:28:11 +00:00
2efd74138c Bug fixes:
Retag subgraphs when merging, to prevent loops
Mark missing up link in multi resolution as NULL
Ignore hidden vertices when propagating weight between islands
2008-07-29 20:20:24 +00:00
039814f7d2 No long needed here (win64 cleanup) 2008-07-29 18:07:06 +00:00
908337bee1 Game Engine: alpha blending and sorting
=======================================

Alpha blending + sorting was revised, to fix bugs and get it
to work more predictable.

* A new per texture face "Sort" setting defines if the face
  is alpha sorted or not, instead of abusing the "ZTransp"
  setting as it did before.
* Existing files are converted to hopefully match the old
  behavior as much as possible with a version patch.
* On new meshes the Sort flag is disabled by the default, to
  avoid unexpected and hard to find slowdowns.
* Alpha sorting for faces was incredibly slow. Sorting faces
  in a mesh with 600 faces lowered the framerate from 200 to
  70 fps in my test.. the sorting there case goes about 15x
  faster now, but it is still advised to use Clip Alpha if
  possible instead of regular Alpha.
* There still various limitations in the alpha sorting code,
  I've added some comments to the code about this.

Some docs at the bottom of the page:
http://www.blender.org/development/current-projects/changes-since-246/realtime-glsl-materials/

Merged some fixes from the apricot branch, most important
change is that  tangents are now exactly the same as the rest
of Blender, instead of being computed in the game engine with a
different algorithm.

Also, the subversion was bumped to 1.
2008-07-29 15:48:31 +00:00
b204eeca7d Selections now draw correctly when word-wrapped. 2008-07-29 11:37:11 +00:00
Maxime Curioni
7d5eaa674b soc-2008-mxcurioni: corrected problems in API with UnaryFunction1DVoid subclasses and Curvature2DAngleF1D. Understood that Curve and Noise classes cannot be defined in Freestyle's API because they are already given by Blender's API. Will rename to FrsCurve and FrsNoise and change the corresponding style modules. 2008-07-29 11:19:30 +00:00
Maxime Curioni
4fa17fc69c soc-2008-mxcurioni: SWIG replacement is effective and the native Freestyle API renders a correct result for the test style module 'contour.py'. More testing needs to be done to make sure my work was correct.
To make it work, I had to:
- update Operators to include all of its methods in the Python API
- redefine the Freestyle modules as local classes, allowing predicates to support the __call__ method (I found out that Python does not allow modules to be callable). The API is defined in the new freestyle_init.py  file.
- remove all references to former Python Freestyle API (located in source/blender/freestyle/python/, under the Freestyle.py file) and replace it with the new API file.
- normalize all constants related to the Nature class
- redefine the logical_operators.py file so that AndUP1D, OrUP1D and NotUP1D would be subclasses of a UnaryPredicate1D subclass having a operator() implementation. Using UnaryPredicate1D as a superclass would somehow prevent calls to the operator(). For the time being, I chose ContourUP1D (even though it does not really matter which subclass it is, since the __call__ method is redefined in all of these classes). I will implement this classes in C++ to get rid of the problem altogether.
- turn off a few classes that somehow are not well recognized (Noise, Curve...). I will reenable them later once I understand what's going on.
2008-07-29 10:45:06 +00:00
Maxime Curioni
725915615a soc-2008-mxcurioni: SWIG replacement is effective and the native Freestyle API renders a correct result for the test style module 'contour.py'. More testing needs to be done to make sure my work was correct.
To make it work, I had to:
- update Operators to include all of its methods in the Python API
- redefine the Freestyle modules as local classes, allowing predicates to support the __call__ method (I found out that Python does not allow modules to be callable). The API is defined in the new freestyle_init.py  file.
- remove all references to former Python Freestyle API (located in source/blender/freestyle/python/, under the Freestyle.py file) and replace it with the new API file.
- normalize all constants related to the Nature class
- redefine the logical_operators.py file so that AndUP1D, OrUP1D and NotUP1D would be subclasses of a UnaryPredicate1D subclass having a operator() implementation. Using UnaryPredicate1D as a superclass would somehow prevent calls to the operator(). For the time being, I chose ContourUP1D (even though it does not really matter which subclass it is, since the __call__ method is redefined in all of these classes). I will implement this classes in C++ to get rid of the problem altogether.
- turn off a few classes that somehow are not well recognized (Noise, Curve...). I will reenable them later once I understand what's going on.
2008-07-29 10:42:10 +00:00
Maxime Curioni
db6388e0f2 soc-2008-mxcurioni: finished porting the Freestyle API. All of the original classes, except EdgeModifier and TimestampModifier (which aren't even ported via SWIG), are available under the Blender.Freestyle module. Testing of the porting will now begin to make sure the SWIG-less system works as the original.
Quite a few modifications were made to finish the API:
- Freestyle's SConscript was modified to catch all files within the intern/python directory, allowing integration of future shaders implemented in C++.
- the Operators class was ported, with a special care of making its methods static (using the METH_STATIC flag in the tp_methods method definitions)
- all of the type-checking functions [ BPy_[class name]_Check(obj) ] were changed to allow subclasses to be seen as that type too: instead on looking at the ob_type value, the PyObject_IsInstance function is used.
- all of the iterators can now retrieve the object pointed to by the operator, using the getObject() method. A directedViewEdge pair is returned as a list of the two elements in the pair.
- all of the style modules were copied to a style_modules_blender/ folder and were modified to use Freestyle as a Blender's submodule. IntegrationType and MediumType was also integrated (for example, changing MEAN to IntegrationType.MEAN).

Testing now begins. If everything works correctly, I'll move on to lib3ds removal right away.
2008-07-29 05:45:16 +00:00
5ba56ffe47 Bugfix to get deform modifiers after subsurf work again (reported by nudel) 2008-07-28 22:56:30 +00:00
Maxime Curioni
e4677c409d soc-2008-mxcurioni: add all predicate subclasses( BinaryPredicate1D, UnaryPredicate{0D,1D} ).
There is just one more class remaining to port (and probably the most important): Operators. After that, I'll be able to test whether Freestyle functions well without SWIG.
2008-07-28 22:53:42 +00:00
b0c513e83a BGE patch: fix support of group hidden layer in dupli group instantiation: only the objects in layers matching the group layer mask will be instantiated. This is equivalent to the 3D view 2008-07-28 22:36:27 +00:00
Ken Hughes
3120af6f34 Bugfix for #17396. Adding a text object would segfault when using freetype
2.3.6 or later.  Thanks to Cyril Brulebois for a one-line patch, which was
sent to the ML a while back.
2008-07-28 22:10:32 +00:00
dfc93da127 UI fixes are the hardest ones.. (2nd try) 2008-07-28 21:52:37 +00:00
dd1634b07d Bugfix for messed up UI (reported by nudel) 2008-07-28 20:24:05 +00:00
8b77b54469 WIP commit, completely untested (should introduce: 1. copy of modifier settings work, 2. reverse domain, 3. reverse control) 2008-07-28 16:55:48 +00:00
fd327cb393 Word wrap fix: formatting and cursor positioning was not working correctly for wrapped lines containing tabs, or lines with no breaks. 2008-07-28 15:47:46 +00:00
d63a3f7a7c Bugfix for not-working-deformers (reported by nudel) 2008-07-28 15:21:18 +00:00
c566867de9 Add automatic weight probagation between islands without any selected vertex. Makes it easier to do multi part meshes. 2008-07-28 15:03:58 +00:00
bc85f11e68 Bugfix: game engine does not support non-camera type objects as a
camera, would crash, so disabled using the object as a camera then.
2008-07-28 14:28:19 +00:00
12f0fb1a42 Draw cursor at the leading edge of selection (as in other apps.) and hide cursor swapping from the user. 2008-07-28 11:54:13 +00:00
f45aca0447 Complete rewrite of syntax highlighting and formatting. Some improvements:
- Takes less than half the time to format a full document
 - Where possible only the required lines are re-parsed when text is changed (was the whole file, for every key press!)
 - Memory is allocated in one place only (there were all sorts of problems here)
 - Should be easily extensible for other scripting languages
 - Lots of comments to make it very easy to follow / change
 - def and class are now properly coloured. They had a theme colour but the checks didn't work.
2008-07-28 11:05:35 +00:00
48b7f16d76 Phase1: fluidsim obstacles/control objects are grabbed from the specific position in modifier stack now (introducing new funciton in DerivedMesh.c), fixed some UI glitches. 2008-07-28 11:01:34 +00:00
91ece746b8 commit by jms:
Rvk1 to rvk2 script python did not work anymore with the softbodie in blender 2.46.  Only one line needs to be removed.
2008-07-28 10:13:56 +00:00
8162215f2a Bugfix:
Bone-locking should only be set if the bone (and not its parent/children) are selected. Transposition error from the patch (I had to manually apply as there were some oddities about the patch file).
2008-07-28 04:08:46 +00:00
edf557cb1c * Fix for Aligorith's fix for my mistaken uninitialised variable in outliner.c - it was never needed in the first place. 2008-07-28 00:21:34 +00:00
1a370eaafc Fix crash on baking pointcache reported by nudel 2008-07-27 16:27:59 +00:00
Maxime Curioni
362e4f763f soc-2008-mxcurioni: implemented and integrated all 21 original stroke shaders. 2008-07-27 13:40:33 +00:00
f4def51cd3 #17309: Copy/pasting bone names (without editing text) doesn't update bone/pose names
The pasting code for text-buttons (when hovering over the button), was incorrectly using the drawstr (i.e. the string that is displayed in the text-button, and includes the 'name' of the button) as the old value. This meant that the renaming code could not correctly detect matches to rename.
2008-07-27 12:48:46 +00:00
7762ef9574 Almost done with 'Phase 1': Fixed depsgraph update of modifier, fixed material index deletion, fixed face flag deletion (using face0 now as old fluid code) 2008-07-27 12:28:34 +00:00
b2be0a181f Bugfix #17334:
This bug-report revealed a critical error made in the menus for Constraints Owner/Target spaces. It seems that the wrong values have been used for 'pose space' and 'local with parent' space. This has now been rectified, so that old rigs won't break (just that the labels will be a bit different).
2008-07-27 11:41:39 +00:00
Maxime Curioni
2b2df54aef soc-2008-mxcurioni: ported ALL 1D unary functions, representing 32 new classes. 2008-07-27 11:27:59 +00:00
5ae7824a47 svn merge -r 15649:15800 https://svn.blender.org/svnroot/bf-blender/trunk/blender + forgot something in last commit --> e) Last simulated Frame will stay and not turn into cube/domain after last valid simulated frame. f) Fixed loading of old fluidsims (1 parameter was wrong) 2008-07-27 10:46:46 +00:00
d4656ae5a1 Phase 1: a) Fluidsim is a modifier now which allows apply'ing now. b) Fluid control start time/end time works now. c) Negative attraction forces are available now. d) Fluidsim IPOs are now hidden if they don't apply to the selected fluid-type (less confusion for the user). 2008-07-27 10:38:30 +00:00
Maxime Curioni
0cc6f9db3d soc-2008-mxcurioni: ported ALL 0D unary functions, representing 34 new classes. I will do the same for the 1D unary functions. 2008-07-27 06:57:46 +00:00
05ec9021e4 Outliner.c:
Fixed some warnings about 'ob' being used uninitialsed. In some places that was definitely the case!
2008-07-27 05:20:35 +00:00
6035b3e0c7 Grease-Pencil:
* UI - added delete button for hidden layers
* Renamed the two hardcoded defines added for testing distances to their more formal nomenclature.
2008-07-27 04:39:55 +00:00
b24485ab92 Patch #17336: Lock bones in edit mode
Submitted by: Lorenzo Pierfederici (lento) 

This patch adds the ability to lock transformation on bones in edit mode, to protect them from accidental editing.

Bones can be locked from the editing buttons, the transform property panel, the specials popup menu or the python api.
2008-07-27 04:19:56 +00:00
Maxime Curioni
995fdd9fcd soc-2008-mxcurioni: implemented and tested unary predicates. The good news is that My approach seems to works (even though it is not fully testable as it needs Freestyle to be running). I will now port the 80 predicate subclasses left.
In this commit, UnaryPredicate0DDouble and its subclasses DensityF0D and LocalAverageDepthF0D are implemented and integrated in the API.
2008-07-27 03:40:37 +00:00
b4fc80eb3d == Pose Mode - Copy Menu (Ctrl C) ==
This now works even when there is a proxy-protected bone selected with a few differences.
* The Transform Locks, IK-Flags, and Custom Bone Shape settings are unavailable, as they would be reset by the proxy protection anyway

Also, the Copy Constraints options have been altered so that they do NOT free all existing constraints on the target bones before copying.
* Constraints are now appended to the end of the constraint stacks, with those added to bones belonging on proxy protected layers getting tagged as 'local' constraints.
* This is more useful for riggers than the previous behaviour (which was quite nasty too).
2008-07-27 03:15:17 +00:00
01a6d44b07 Undo Fix: Down arrow on last line sent cursor to end (right) but undo sent it up. Similar for up arrow on first line. Undo was then off by a line. 2008-07-26 22:37:05 +00:00
6872ff71d5 Oops, forgot to reset counters for each line when calculating wrap. 2008-07-26 22:25:26 +00:00
8a295553f7 == Python scriptlinks ==
Render/postrender events were missing from bg rendering (and also from rendering called inside scripts). Found this because of bug #17389, the code to prevent race conditions with pynodes is currently inside BPY_do_all_scripts (that runs scriptlinks) and so was not being called in bg mode or rendering via scripts.

http://projects.blender.org/tracker/?func=detail&atid=125&aid=17389&group_id=9
2008-07-26 22:00:26 +00:00
Maxime Curioni
0c64c49d2f soc-2008-mxcurioni: added (but did not test) ViewMap and Noise classes. Updated ViewShape class accordingly 2008-07-26 21:47:39 +00:00
Maxime Curioni
5718639a79 soc-2008-mxcurioni: implemented (but did not test) ChainPredicateIterator and ChainSilhouetteIterator 2008-07-26 20:05:55 +00:00
6531d859ba TextPlugin update: Converted try-except blocks to use try-catch-else to allow better error tracking. Commented the descriptor classes and improved variable support for basic types (string, list, etc.) 2008-07-26 20:02:10 +00:00
Maxime Curioni
13364bf208 soc-2008-mxcurioni: completed implementing ViewEdgeIterator and ChainingIterator. Updated UnaryPredicate{0D,1D} 2008-07-26 19:32:47 +00:00
9f19d88a5d Word-wrap initial commit. Added button to header and updated draw code for text and cursor. Simple typing/deleting works fine. Other events (selections, clicking) behave as if text has not been wrapped and need work. 2008-07-26 18:38:59 +00:00
70ce017777 == Grease Pencil - Drawing (User Action not Display) Accuracy ==
This commit attempts to fix some of the problems with the accuracy of strokes recorded.

I've disabled the post-draw smoothing of strokes as it deviated from the source stroke too much. This was introduced to try to eliminate the effects of fine 'jitter' (which is especially noticable when using optical mice + fast computer). 

Now, I've introduced two thresholds which determine the 'minimum' distances that the mouse needs to have moved from the previous mouse-coordinates recorded, to be recorded. These are currently hardcoded, but may be exposed in the UI if there is significant need to do so.
- The first is for the distance that the mouse must have moved on both axes to be considered.
- The second is for the 'pythagorean' distance that needs to have been travelled by the mouse.
2008-07-26 12:54:03 +00:00
c4116a7f8d BGE patch: support runtime duplication of groups. Adding an object with Dupligroup option set will cause the group to be instantiated. No special actuator is needed for this feature, just put dupligroup objects in inactive layers and add them dynamically 2008-07-26 11:00:21 +00:00
4a8aa06a14 Merge from trunk
revs. 15635:15771
2008-07-26 10:45:11 +00:00
9f803439c7 == Sequencer ==
Fixes: [#17347] Scaling problems when "Use Translate" is enabled for image strip
2008-07-26 06:43:36 +00:00
8234abe2b5 == Sequencer ==
since clear_last_seq replaces set_last_seq in kernel,
removed unneeded bad_level_call.
2008-07-26 06:19:50 +00:00
Maxime Curioni
b216e4d12d soc-2008-mxcurioni: implemented (but did not test) the following classes: Material, Chain, FEdgeSharp, FEdgeSmooth. All Interface1D classes have now been fully implemented. 2008-07-26 02:33:21 +00:00
d979ebe11f Two fixes:
* For constraint mesh-targets, the check for whether the target mesh was in EditMode didn't check to see if the target mesh was the mesh in EditMode. 
Thanks jaguarandi for catching that!

* Bumped up size of buffer for grease-pencil drawing after seeing a program written in 1989 that had a 100 times larger buffer
2008-07-26 00:43:29 +00:00
4c6e0d49c8 Text plug-ins should only be invoked when syntax highlight is enabled (since they only update when it is set). We don't want things popping up when we're just writing text. 2008-07-26 00:25:03 +00:00
9e1ca2c1be Fixed simple deform strech/squash function 2008-07-25 23:52:16 +00:00
1b3cf253ed rolling back 'bad' wind and force scaling compared to particles ..
because i have no solution on backward compatibility  
keeping bug fix
-wind and force did not work if aero or edge collision was activated.
2008-07-25 22:58:22 +00:00
f6b85a55fa == PyNodes ==
Early Ehlinger reported a deadlock when a script tells Blender to render an animation and there are pynodes. While investigating I saw related crashes in bg (blender -b) mode, still not fixed. This commit tries to fix the problem for interactive mode, then. What it does is releasing the lock before rendering and relocking after that, like theeth suggests in the bug report:

http://projects.blender.org/tracker/?func=detail&atid=125&aid=17389&group_id=9
2008-07-25 22:30:03 +00:00
Maxime Curioni
51f9082c96 soc-2008-mxcurioni: added (but did not test) NonTVertex and TVertex classes. All Interface0D structures have been implemented 2008-07-25 21:56:06 +00:00
229a5809bb added exception messages to game engine matrix and vector conversions. also removed own unneeded defines in arithb.c 2008-07-25 21:14:23 +00:00
d7fecc9e96 Fluid control: WIP commit before weekend, not working is crashing on the first 3 frames 2008-07-25 18:57:16 +00:00
1537e75cba Converted shrinkwrap to a DeformOnly modifier
*the options "remove faces", "merge" points were removed
*made shrinkwrap work with CVs (curves and nurbs surfaces)
*cleanup shrinkwrap code.. (removed bruteforces and raytree methods)
2008-07-25 18:48:24 +00:00
a7f951f25e BGE patch: approve patch #17312: Multiple material IPOs per mesh in BGE. 2008-07-25 13:45:57 +00:00
ab44742cf3 BGE bug fix: approve patch #17297: Track To Actuator bug fix 2008-07-25 10:52:10 +00:00
1634b7c460 Documentation panel improved to scroll and have better word-wrapping. 2008-07-25 08:06:30 +00:00
Nathan Letwory
8df67dae36 * make sure blenderplayer links again 2008-07-25 07:56:07 +00:00
325b1666d4 Grease Pencil - Backend work:
Just preparation work for an eraser tool (as well as the code of a failed attempt at an implementation).
2008-07-25 07:11:08 +00:00
Maxime Curioni
dc385c59ea soc-2008-mxcurioni: fully implemented (but did not test) Curve class. 2008-07-25 02:18:02 +00:00
Maxime Curioni
c0f567e757 soc-2008-mxcurioni: fully implemented (but did not test) ViewEdge class. Modified functions accross API taking input boolean values. 2008-07-25 01:38:19 +00:00
846ae7a187 * Fix for bug #9450 'Problems with Extended Material node with AmbCol socket'
It turns out the material AmbCol property was never working properly, or even supported in the renderer, so I've removed it. Also included is a fix to make the 'Amb' input work properly too.
2008-07-25 01:17:37 +00:00
Maxime Curioni
d8d9839ab3 soc-2008-mxcurioni: Added iterator capability to FEdge and Stroke. Recoded parts of ViewVertex, SVertex and Convert to support these changes. 2008-07-25 00:18:10 +00:00
Maxime Curioni
fc97e91a3e soc-2008-mxcurioni: found and fixed all potential issues iterating over internal view-map data. The internal namespaces (ViewEdgeInternal, ViewVertexInternal, CurveInternal, StrokeInternal...) should NOT be included to prevent redefintion errors. 2008-07-24 21:32:50 +00:00
Maxime Curioni
2860bc5d5b soc-2008-mxcurioni: cleaned up the Convert header file to prevent cyclic or header positioning problems and adapted classes accordingly 2008-07-24 20:39:13 +00:00
71b2bf23e0 Slight code changes to select different limits for simulated annealing (commit now to test on another machine later) 2008-07-24 20:03:25 +00:00
bbd636df13 added note to epydocs explaining the nature of floats in id properties from the python point of view 2008-07-24 19:34:49 +00:00
0118a82379 added support for doubles to the id property code, and made the python code use them by default 2008-07-24 19:22:17 +00:00
d1bdd58797 Axial symmetry stability bug fix.
Axial symmetry tagging was depending on the order of the nodes, so it might tag left side as right and vice versa depending on the order. Stability test ensures the tagging is order independant (what it tags as right and left might not be the real right and left, but at least they are consistant between mesh graph and armature graph, so it doesn't flip limbs)
2008-07-24 19:12:30 +00:00
059b0651de Propagate control bones repositioning (can deal with chains of control bones)
Retargetting IK/FK switcher setups should work ok now (worked on a setup I did, need to test with more)
2008-07-24 14:11:36 +00:00
b93156a686 soft body bug fix own finding
left overs from new particles
-wind and force did not work if aero or edge collision was activated.
-force field had flipped sign compared to particles
tsk who thinks a attractive force should negative sign? well... i am passionless with that.
-adapted effect of wind and fields on softbodies such that softbody "particles" and particle "particles" behave consistently
note! 
effect of wind is 1/25 compared to before   
other forces 1/10
2008-07-24 12:27:31 +00:00
f9dc77c1c8 == Grease Pencil - More Tweaks (I) ==
New Stuff:
* Alt-XKEY / Alt-DelKey will now activate the Grease Pencil "Erase" menu. This will only show up when it's relevant (i.e. when there exists Grease Pencil data). It should make it faster to quickly delete the last stroke made. This hotkey has been added to the tooltips of the relevant buttons.
* Finished off colouring of 'active' layers panel so that they are now easily identify-able. This could also be done for Constraints, but the 'active' one isn't that important there.

Bugfixes:
* Fixed bug with drawing gp-data sources in the Action Editor, which resulted in missing icons.
* Fixed buttons in Grease Pencil panel. My hasty attempt last night at making the Action Editor to refresh was causing problems.
* Added a (hopefully temporary) button that will be used to prevent drawing from occurring with Shift-LMB. This is useful when trying to select stuff sometimes, with LMB as select-button, especially when selecting a bunch of closely spaced bones might be interpreted as a new stroke.
2008-07-24 09:23:13 +00:00
Maxime Curioni
a0359c3750 soc-2008-mxcurioni: added (without testing) the following classes: BBox, SShape, ViewShape. Also corrected a few typos (Get#->get#). 2008-07-24 08:29:48 +00:00
955ffb4abf * Added the ability to toggle visibility/renderability for bones in edit mode or pose mode, in the outliner 2008-07-24 06:21:33 +00:00
c1e85535cc * Added the ability to toggle visibility/renderability for modifiers, from the outliner 2008-07-24 06:04:03 +00:00
Maxime Curioni
dd899939da soc-2008-mxcurioni: Added first batch of Iterators: AdjacencyIterator, Interface0DIterator, CurvePointIterator, StrokeVertexIterator, SVertexIterator, orientedViewEdgeIterator. 2008-07-24 04:48:34 +00:00
004197f720 * A bit more precision in the bevel mod 'width' field 2008-07-24 02:09:44 +00:00
5eb14d70b9 BGE patch: Add PyDoc for new logic bricks, set exception message on Py error, remove args on Py functions that don't take any to save CPU time 2008-07-23 21:37:37 +00:00
d2013570a0 Refactor: Renamed text tool methods (suggestions and docs) for clarity and consistency. 2008-07-23 21:28:48 +00:00
3b70337f7f Improvements to text find (and replace):
- Added GUI panel
 - Selected text is copied to "find" field
 - Option to search "all texts"
 - Option to replace text
 - Alt+F finds, Ctrl+Alt+F finds again (without UI)
 - Alt+H replaces (UI), Ctrl+Alt+H replaces again (and undo works)
 - Fixed: Find didn't push undos so cursor position was wrong
2008-07-23 19:35:13 +00:00
16ebff308e time_t isn't supported in SDNA so we'll use double instead. 56bit precision is plenty for storing seconds (for a billion years at least) 2008-07-23 18:19:56 +00:00
dcbe9ade7a Added NodeUpdateGS so GameObject Python api alignAxisToVect function,
Otherwise the rotation isn't applied.
2008-07-23 15:45:23 +00:00
6b4b03317d Bugfix: Deleting backward selected text was getting stuck on redo.
Selections were not correctly preserved through undo/redo operations causing unexpected behaviour.
2008-07-23 12:59:05 +00:00
8a1dbea363 == Grease Pencil - UI Improvements ==
Based on user feedback, I've made some changes to the Grease Pencil UI (most notably in 'Time Editing' facilities). 
* 'Edit Timing' button gone
* Pin button and '<Grease Pencil Data' string gone from Action Editor
* Action Editor in 'Grease Pencil' mode now displays all grease-pencil datablocks for current screen. 
* AE: GP-Datablocks are drawn like 'groups', with an expand/collapse button to show/hide layers. Its name shows the type of space it comes from, and shows indicative status info (i.e. for 3d-view, it shows view-angle)
* Added refresh calls for action editor after editing relevant data.

I haven't tested all tools yet, but most should be stable. 

Also, I've removed some unnecessary buttons, and added a few tooltips. There's also some experimental code to try to get clearer indication of 'active' layer.
2008-07-23 12:27:08 +00:00
Maxime Curioni
d1b82d1f15 soc-2008-mxcurioni: added Iterator class, base class for all iterators in Freestyle (on the C++ side). Created the equivalent in Python BPy_Iterator with the simple interface:
- getExactTypeName()
- increment()
- decrement()
- isBegin()
- isEnd()

Contrary to previously stated, I am reverting back to implementing iterators in the (Python) API, for different reasons:
- it will make testing quicker to achieve, as I won't have to recode a big chunk of the original Python files
- it will be a base for API refactoring
- it won't prevent the use a list-based approach later (it is simple to get it from the Iterator)
2008-07-23 10:19:08 +00:00
Maxime Curioni
a9789d90ae soc-2008-mxcurioni: renamed all Freestyle API related files with 'BPy_' prefix to avoid library name collision.
Included MediumType's initialization at proper time to avoid Blender's crash.
2008-07-23 07:56:08 +00:00
ab722cf7b1 == Sequencer ==
Fixes: [#17315] Sequencer: after undo there's no active object
closes: [#17357] fix for bug #17315 - Sequencer: after undo there's no active object
(kiemdoder: thanks for the patch, had to do it in a little bit different way,
since sort_seq will kill your sort order idea...)
2008-07-23 07:11:23 +00:00
Maxime Curioni
0c494442d3 soc-2008-mxcurioni: merged changes to revision 15705 2008-07-23 06:02:18 +00:00
Maxime Curioni
0c3f7c2b7e soc-2008-mxcurioni: implemented (without testing) StrokeShader, Stroke and MediumType (used by Stroke to define medium types) classes. The Stroke class is missing the InsertVertex method.
Before porting other classes, I'll resolve the List (Python) <=> Iterator (C++) correspondence problem by implementing a general class appropriately suited for the task.
2008-07-23 05:54:34 +00:00
1e7523ea44 Updated some out of date documentation of Object Ipo curve names 2008-07-23 02:31:56 +00:00
a18c723d55 BGE patch: Add min/max parameters to orientation constraint actuator
The min/max parameters define a minimum/maximum angle
that the object axis can have with the reference 
direction without being constrainted. The angle is 
expressed in degree and is limited to 0-180 range. 
The min/max parameters define a conical free zone
around the reference direction.

If the object axis is outside that free zone, the
actuator will tend to put it back using as a temporary
reference direction the vector that is exactly at
min or max degree of the reference direction 
(depending if the axis angle is below the minimum 
or above the maximum) and is located in the plane 
formed by the axis and the reference direction.

With a low damping value, this is equivalent to 
clamping the axis orientation within min/max degree
of the reference direction.

Backward compatibility corresponds to the absence
of free zone: min = max = 0.
2008-07-22 23:05:06 +00:00
21bf5167ed Update MSVC project files 2008-07-22 18:11:32 +00:00
deccefc029 First draft for control bones repositioning.
All bones marked as no deform are repositioned after the retarget based on their "linked" bone (linked bone is constraint owner if control bone is a target, parent bone if not).

Arithb:
 Function to make a quat between two normalized vectors
2008-07-22 17:44:06 +00:00
1abe753bf0 BGE patch: update KX_GameObject::getChildren() to use CListValue instead of python list (allows name search keep refcount consistent) 2008-07-22 16:44:35 +00:00
6d0e840648 Bug fix for the bug fix. Wasn't closing the clipboard before returning. Thanks b333rt for catching this. 2008-07-22 15:31:22 +00:00
20af6c61e8 Bugfix: Pasting non-text data (or trying to retrieve non-text data from the clipboard) crashed blender on Windows. 2008-07-22 14:56:02 +00:00
aec6b78ded svn merge -r 15590:15688 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-07-22 12:02:57 +00:00
06f67dd531 *BVHTreeFromMesh api changed.. it now stores all information like defaults callbacks to raycast and nearest surface (just to make it easier to use)
*Fixed button size of "Above surface"
2008-07-22 11:50:50 +00:00
32d10bca2b == Grease Pencil ==
Grease Pencil is a tool which allows you to draw freehand in some views, allowing you to annotate/scribble over the contents of that view in either 2d or 3d. This facilitates many easier communication and planning abilities.

To use, simply enable it from the View menu (choose 'Grease Pencil...' and click 'Use Grease Pencil'). Then, click+drag using the left-mouse button and the shift-key held to draw a stroke.

For more information, check the following page on the wiki:
http://wiki.blender.org/index.php/User:Aligorith/247_Grease_Pencil
2008-07-22 09:53:25 +00:00
Maxime Curioni
48732bf2ab soc-2008-mxcurioni: filled and tested StrokeVertex class 2008-07-22 08:15:21 +00:00
Maxime Curioni
2c29af6a29 soc-2008-mxcurioni: corrected StrokeAttribute, verified with test case.
I realized today that it will not be possible to implement getter/setter functionality easily for our Freestyle API. The reason is that Python does not support function overloading as-is. It is possible to 'fake' overloading by taking a general argument object and count the number of arguments in the object (rgbTuple_setCol in Blender's API is a good example of how to go about it). 

For the time being, we'll get around that problem. The tangible effect of that constraint is that all API setter functions return a 'None' PyObject, instead of returning an integer status code. It is important to note that this problem is due to Freestyle's API being C++ in nature. Fortunately, this shouldn't really impact the usage of the API.

If the Blender Python group wants me to correct that, I'll be able to do it. It is just going to take me quite some time correcting it, writing support functions for methods having different types of arguments.
2008-07-22 00:27:40 +00:00
3c8b695f72 Fixed a bug relative to editmode..
now its calling CDDM_calc_normals when receiving a mesh to deform,
since in edit mode the mesh doenst has normals calculated
2008-07-21 22:36:05 +00:00
Maxime Curioni
7426a3e35b Added StrokeAttribute class. Beginning of StrokeVertex.
IMPORTANT: The setters functions' names were normalized due to constant confusion regarding capitalization. All the function names start with set... instead of Set.... This convention was changed all throughout Freestyle. To use Freestyle as an external renderer, the SWIG library MUST be regenerated.
2008-07-21 21:24:37 +00:00
Ken Hughes
4c086bf4ae Python API
----------

Particle patch from Cédric Paille: bugfixes and child-particles export improvements for .getLoc(), part.getRot() part.getSize(), part.getAge() methods.

Also fix a bug with part.randemission getter (was using PART_BOIDS_2D instead of PART_TRAND), plus typos and duplications in API documentation.
2008-07-21 20:42:11 +00:00
07b8c7e887 Updated the textplugin_outliner.py plug-in to use the new Draw.PupTreeMenu and updated this menu to support titles. 2008-07-21 19:11:38 +00:00
4c76c57a77 Made shrinkwrap modifier work when target or cutPlane are in editmode. 2008-07-21 18:12:02 +00:00
78ce90b752 allow to write to libraries that are indirectly linked 2008-07-21 17:05:59 +00:00
434f2172f6 Removed requirement for suggestions to be pre-sorted. Allowed lists of strings to be suggested without having to specify their type. Specifying a prefix when suggesting is now also optional. 2008-07-21 16:40:32 +00:00
9bf0bfcae7 Fix for crash with fc and quality < 5 (reported by Nudel) 2008-07-21 13:47:42 +00:00
4ae4ecd3ce BGE patch: Optimization of bullet adaptation layer - part 1.
First batch of optimizaton of the bullet adaptation layer in the BGE.
- remove circular motion state update.
- optimization of physic adaptation layer for bullet: bypass
  unecessary conversion of rotation matrix to quaternion and back.
- remove double updates during object replication.
2008-07-21 12:37:27 +00:00
5435d7c3ea Oops, typo in rev. 15664 caused error 2008-07-21 11:21:49 +00:00
fab7270e40 Script template added for text plug-ins 2008-07-21 10:07:03 +00:00
2647bed77d Enabled fc for testing 2008-07-21 07:10:10 +00:00
6352cd509e BPyTextPlugin now has descriptors for variables, functions and classes (and their variables/functions). Each descriptor also holds the line number of the definition allowing a simple outliner to be written.
Text.setCursorPos(row, col) now pops the text into view if it is in the active window space. The outliner uses this to jump to any definition in a script; it is invoked with Ctrl+T.
2008-07-21 00:38:42 +00:00
8f17a66036 BGE 2dFilters some extra fixes 2008-07-20 23:34:17 +00:00
5350d5eb2c BGE Bug Fix:#17349, fixes some problems about 2d-filters 2008-07-20 23:03:01 +00:00
9f53999181 BGE patch: constraint orientation actuator did not work when damping=0. 2008-07-20 21:09:56 +00:00
e0fc591697 Fix for crash in collisions (introduced *after* 2.46 with my collision recode) 2008-07-20 21:05:48 +00:00
def3150098 [#17356]: Reactor particles makes blender crash 2008-07-20 18:07:02 +00:00
e95e2fb43e GameObject functions getChildren() and getChildrenRecursive() 2008-07-20 17:18:46 +00:00
433c43932b Bugfix #16662
Curve modifier on lattice suffered drawing updates, only when the system
was not animated though, missed depsgraph calls then.

Solved it by forcing lattice to always return displist for its vertices,
that's same as for how mesh/curve works now.
2008-07-20 16:06:40 +00:00
d725e5f78e BGE bug fix (for 2.47): setParent() fix, third part: set mass to 0 when parenting. Allow loc/scale/orientation change on child object with physic controller. 2008-07-20 15:40:03 +00:00
89f2a63ecd Bugfix #8182
Specular render in Blender still had terminator problems... only the diffuse
part got "phong correction" applied. I didn't fix this before to not change
rendering results just before the release. Now there's time I hope?

Render results should only differ minimal, and only visible for low spec
hardness values (like 1 or 2)
2008-07-20 10:09:19 +00:00
037f1188e6 svn merge -r 15529:15649 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-07-20 08:52:48 +00:00
Maxime Curioni
ab722884d3 soc-2008-mxcurioni: updated support for Nature class. 2008-07-20 05:01:29 +00:00
a8785893c5 Added functions so python can change library paths.
* bpy.libraries.paths() -> list of library paths.
* bpy.libraries.replace(fromPath, toPath)
2008-07-19 15:44:00 +00:00
0703d9aad1 Following the same optimization as bvh raycast:
*Made nearest surface also use "quad" bvh tree (instead of splitting quads in 2 bvh nodes).
 Again that leaded to improvements in build and query time.

*BLI_bvhtree_find_nearest api is now following the same concept as BLI_bvhtree_ray_cast

removed code relative to bvhtree_from_mesh_tris.
2008-07-19 15:22:38 +00:00
37c8f08f28 syntax change so GCC 4.3 will build 2008-07-19 13:04:55 +00:00
7e990de294 BGE bug fix (good for 2.47): remove static-static collision messages on the console since previous SetParent fix. The physical object is set to static+ghost while the object is parented. This behavior will be made optional in a future release. The DisableDynamics actuator will also make the object static except that the ghost/non-ghost flag is preserved. 2008-07-19 10:27:52 +00:00
9ed079bf5c BGE patch: Relink actuators with target within group when duplicating group; generalize protection against object deletion for all actuators that point to objects.
Certain actuators hold a pointer to an objects: Property,
SceneCamera, AddObject, Camera, Parent, TractTo. When a
group is duplicated, the actuators that point to objects
within the group will be relinked to point to the
replicated objects and not to the original objects.
This helps to setup self-contained group with a camera
following a character for example.
This feature also works when adding a single object
(and all its children) with the AddObject actuator.

The second part of the patch extends the protection
against object deletion to all the actuators of the above
list (previously, only the TrackTo, AddObject and
Property actuators were protected). In case the target
object of these actuators is deleted, the BGE won't
crash.
2008-07-19 07:45:19 +00:00
f042a468fd Merged 15170:15635 from trunk (no conflicts or even merges) 2008-07-18 23:35:34 +00:00
123407e0b4 Added a documentation panel with primitive word-wrap functionality. It can be displayed by Text.showDoc(string) in python and has a text-plugin script for function docs which may be invoked with Ctrl+I inside its params list. Eg. type "dir(" <Ctrl+I> 2008-07-18 23:12:19 +00:00
59a2b50171 *Added "kept" mesh above surface option on shrinkwrap to nearest surface
changed a few code relative to project over normal mode (to try to kept code generic and more independent of modifier itself)
2008-07-18 22:24:20 +00:00
Maxime Curioni
16d7d12123 soc-2008-mxcurioni: Added IntegrationType and Nature classes, used to store constants used throughout Freestyle 2008-07-18 20:31:40 +00:00
5e2ee19187 BGE patch: support for partial hierarchy in dupligroup instantiation; removal of links that point to inactive objects during group instantiation.
This situation corresponds to a group containing only a portion
of a parent hierarchy (the Apricot team needed that to avoid
logic duplication). The BGE will instantiate only the
children that are in the group so that it follows the 3D view
more closely.
As a result, the logic links to the objects in the portion of the
hierarchy that was not replicated will point to inactive objects
(if the groups are stored in inactive layers as they should be). 
To keep the logic system consistent, these links are automatically
removed.
This last part of the patch is a general fix that could go in
2.47 but as this situation does not normally occurs in pre-2.47
games, it is not needed.
2008-07-18 19:56:56 +00:00
25de501805 Exponential cooling off and progressive minimization for simulated annealing 2008-07-18 19:09:41 +00:00
c0dfe80e0d Fix misceleanous errors/tweaks in cost calculations
- Angle cost could easily balloon up, don't use relative difference
- fix error with ends (wrong indexes)
- add missing out of bound preventions
2008-07-18 17:57:34 +00:00
a397b4b82f BGE bug fix (good for 2.47): SetParent actuator did not work on dynamic objects. Dynamics will now be disabled automatically and the object will be set ghost for the duration of the parenting; this is to avoid static interaction with the parent object. The dynamic state is restored when the parenting is removed with RemoveParent actuator. This fix also applies to setParent() and removeParent() python functions. 2008-07-18 14:40:24 +00:00
6786c517af own error, recent commit that tried to keep an active face could crash when deleting faces. 2008-07-18 13:05:15 +00:00
c216c980d3 bugfix
the aspect of a block could become negative and default when scaling icons.
this is caused by the using viewRedrawForce (transforming a mesh) and drawing icons in the image panel.
must look into why bwin_getsinglematrix can give a negative value, probably because the opengl state is set incorrect.

This is still not correct because the aspect will be wrong. but at least it wont crash.
2008-07-18 13:04:15 +00:00
b205cf34b4 All parsing is now done in one sweep and cached to allow details to be obtained without re-parsing. A text can be manually parsed with parse_text(text) which also updates the cache. 2008-07-18 11:00:34 +00:00
Maxime Curioni
21674d2db2 soc-2008-mxcurioni: canvas for UnaryFunction0D, UnaryFunction1D, UnaryPredicate0D, UnaryPredicate1D.
UnaryFunction0D and UnaryFunction1D implementations are going to be really challenging due to the changes in the infrastructure: UnaryFunction0D<T> and UnaryFunction0D<T> are templates and must be determined for compile-time. The easiest solution is to support each type individually; unfortunately, it removes the benefit of using an interface. To find a middle ground, a general unary function Python object type was created for 0D and 1D. In both cases, the types have a void* pointer keeping the address of the current unary function type. I am not sure yet if it will work.

Interface0DIterator being removed by a list type, the t() and u() coordinate functions will to be transferred somehow, probably directly at the Interface0D level.
2008-07-18 04:59:07 +00:00
Maxime Curioni
d3973dac71 soc-2008-mxcurioni: FEdge class added. Modifed converting functions to passing-by-reference format. Improved the type checking for FEdge and CurvePoint. Modified FEdge C++ class to test for null vertices. Updated previous classes to support FEdge.
So far, whenever a Python object is created from its corresponding C++ object, the input object reference is copied into a new object. Due to Freestyle's functions (especially regarding the way it is iterated), it is currently impossible to deal with a pointer-based Python object. It is not a real drawback, just an aspect to keep in mind.
2008-07-18 02:55:23 +00:00
1b46522ec4 Max cost for collapsed bones 2008-07-17 20:46:12 +00:00
98d85c3047 Solve a crasher bug in the brute force solver 2008-07-17 19:19:43 +00:00
426451a44d More levels for multi resolution (smoother progression between filtering values). Also different progression for internal edges filtering than external edges (small internal and less important than small external). 2008-07-17 17:33:45 +00:00
Ken Hughes
dcfcc41901 Change message printed by sceneRender.enableCropping() to be more descriptive, and note the method as deprecated in the python docs. 2008-07-17 17:30:32 +00:00
439e474e4e BGE patch: use the Blender convention to duplicate groups in the BGE so that the objects will be created with the location and orientation as in Blender. Note that the BGE handles scaling in a parent tree differently than Blender. To avoid discrepencies between the 3D view and the BGE, use only isotropic scaling on all your objects except the leaf objects (i.e. without children) that can have anisotropic scaling 2008-07-17 15:33:27 +00:00
5848fee125 BGE bug fix (good for 2.47): fix logic reconnection after replication. The old method was matching the bricks by name assuming they are unique but it is not always the case, especially with the new dupligroup feature. The new method matches the bricks by objects and position. 2008-07-17 12:29:42 +00:00
Maxime Curioni
e4748940c0 soc-2008-mxcurioni: SWIG removal - completed SVertex and CurvePoint classes migration. Stabilized a lot of the code for C++ -> Python conversion. Added the correct rich comparison operator and tested it. Corrected 'dupplicate' typo and changde to __copy__ for Python API.
From now on, when a set should be output (PySet_Type), it is given as a list (PyList_Type). The reason is that it doesn't really matter what we bring back to the Python interpreter. The set is guaranteed in memory on the C++ side.

For the CurvePoint class, the userdata variable is not yet ported (and will probably available as a list or a dictionary). The CurvePoint implementation works except for the initialization from other CurvePoints: somehow, the inner variables don't seem to be correctly handled. I do not know if it is a bug in Freestyle or if the CurvePoint object's state is correct for my test case. CurvePoint needs more testing.
2008-07-17 06:35:30 +00:00
dbfc5f6b71 BGE patch: fix mesh deformation errors with duplicated objects sharing the same mesh in case of 1) armature+multiple material 2) shape drivers 2008-07-16 21:24:54 +00:00
7ef48296fc Bugfix: particles with deflection based on size could pass through
objects due to a broken SweepingSphereIntersectsTriangleUV. This
merges the code from the shrinkwrap branch by André Pinto, thanks!
2008-07-16 13:47:03 +00:00
062643eefd Fixed error when scripts were run without a visible Text to work on. 2008-07-16 12:56:23 +00:00
3ae64f67e1 * change active face behavior so that entering editmode will assign the first face as active when none is set. UnSetting the active face will also use the first face as active.
* missing countall when selecting linked
2008-07-16 11:48:55 +00:00
cc89221a24 Previously relying on import to run scripts didn't work every time and was not the right way to do it. Also fixed a problem with 'import *' not working and added the sys.modules list to the import suggestion list with a timed update. 2008-07-16 10:33:48 +00:00
3b8ed8910a Bug Fix #17337, now atmosphere works correctly with FSA enabled 2008-07-16 08:10:23 +00:00
8d94bfec1b Last commit fixed the file contents.. but some svn props were missing.
So I fixed the problem with merges instead of copying files over.
Also trunk/blender/release/scripts/scripttemplate_ipo_gen.py from revision 14530 was missing. (that was fixed)

svn merge -r 15590:15551 https://svn.blender.org/svnroot/bf-blender/branches/soc-2008-jaguarandi (revert changes to the point where the merge was incorrect)
svn merge -r 15552:15572 https://svn.blender.org/svnroot/bf-blender/branches/soc-2008-jaguarandi (apply branch modifications)
svn merge -r 15392:15590 https://svn.blender.org/svnroot/bf-blender/trunk/blender (merge from trunk)
2008-07-15 21:08:39 +00:00
db5a83d083 More merging goodness
fix adjacency list inline instead of having to rebuild fully
	reweight joined graphs properly
2008-07-15 21:07:13 +00:00
7afacb6ea8 BGE patch: DUPLIGROUP option supported in BGE.
Blender duplicates groups in the 3D view at the location of objects having the DUPLIGROUP option set. This feature is now supported in the BGE: the groups will be instantiated as in the 3D view when the scene is converted. This is useful to populate a scene with multiple enemies without having to actually duplicate the objects in the blend file.

Notes: * The BGE applies the same criteria to instantiate the group as Blender to display them: if you see the group in the 3D view, it will be instantiated in the BGE.
       * Groups are instantiated as if the object having the DUPLIGROUP option (usually an empty) executed an AddObject actuator on the top objects of the group (objects without parent).
       * As a result, only intra-group parent relationship is supported: the BGE will not instantiate objects that have parents outside the group.
       * Intra-group logic bricks connections are preserved between the duplicated objects, even between the top objects of the group.
       * For best result, the state engine of the objects in the group should be self-contained: logic bricks should only have intra-group connections. Use messages to communicate with state engines outside the group.
       * Nested groups are supported: if one or more objects in the group have the DUPLIGROUP option set, the corresponding groups will be instantiated at the corresponding position and orientation. 
       * Nested groups are instantiated as separate groups, not as one big group.
       * Linked groups are supported as well as groups containing objects from the active layers.
       * There is a difference in the way Blender displays the groups in the 3D view and how BGE instantiates them: Blender does not take into account the parent relationship in the group and displays the objects as if they were all children of the object having the DUPLIGROUP option. That's correct for the top objects of the group but not for the children. Hence the orientation of the children objects may be different in the BGE.
       * An AddGroup actuator will be added in a future release.
2008-07-15 20:05:23 +00:00
08039ef38f Optimization method selectable at runtime
Start multi resolution match from node, not arc (solve problem with Rinky)
various uglyness being cleaned up or factored out
2008-07-15 19:38:48 +00:00
e433719f51 BGE bug fix (good for 2.47): radar and near sensor did not filter correctly the collisioning objects based on ACTOR flag when the parent object was added dynamically. This could result in a very big performance decrease. 2008-07-15 18:57:10 +00:00
4c48b4846e Updated so things compile. (Missing includes needed)
Kent
2008-07-15 18:12:08 +00:00
512eec04aa Made suggestions case-insensitive which also puts _ prefixed items at the bottom. Improvements have also been made to the way the list works, when it should disappear/update/confirm, etc. 2008-07-15 17:03:59 +00:00
9037159d7a Text plugin script updates: Better error handling, variable parsing, token caching for repeat parsing of the same document. Fixed joining of multiline statements and context detection. 2008-07-15 12:55:20 +00:00
afc30d1a33 There was a problem with the last merge :S
Somehow it didnt finished and didnt added some files under the svn control
(found thanks to lguillaume that reported some files were missing)

Last merge fixed and also merged modifications up to revision 15584.

I checked the diff
svn diff --new . --old https://svn.blender.org/svnroot/bf-blender/trunk/blender
And everything seems to be right now
2008-07-15 12:54:57 +00:00
aeb4d0c631 Created a BPy module BPyTextPlugin to centralize functions used across the text plugin scripts. Also created two more scripts to handle imports and member suggestions. 2008-07-15 07:34:46 +00:00
dbb61988fd Any script can now register a unique key combination as part of its bpy header. For a supported space type, the user may press this shortcut to invoke the script.
Space types that are to support shortcuts like this should call BPY_menu_do_shortcut(...) from the event queue read method (See winqreadtextspace in drawtext.c for example)
2008-07-15 07:04:31 +00:00
Maxime Curioni
cc1a6b398d soc-2008-mxcurioni: reimplemented the initialization/allocation for base classes. The Python object type tp_new slot is now set to PyType_GenericNew, instead of the former custom functions. As a note, by default, Python does not set this slot: it is therefore mandatory for the base classes. For children classes, only __init__ is needed.
To make our base classes subclasses, the Py_TPFLAGS_BASETYPE flag was added to the object type tp_flags slot.

Finally, I began to implement CurvePoint, descendant of Interface0D. This commit allowed me to verify that my SWIG replacement method works: interfaces are well taken into account by children. For a test, use the following code:

================================

import Blender
from Blender import Freestyle
from Blender.Freestyle import *

print Interface0D()
print CurvePoint()

================================

The __repr__ method is only implemented in Interface0D:

PyObject * Interface0D___repr__(BPy_Interface0D* self)
{
   return PyString_FromFormat("type: %s - address: %p", self->if0D->getExactTypeName().c_str(), self->if0D );}

and the result is of the form:

type: Interface0D - address: 0x18e5ccc0
type: CurvePoint - address: 0x18e473f0

As you can see, the correct getExactTypeName of the class is called.
2008-07-15 05:33:12 +00:00
22fc20fe62 Fix segfault in the Sequence.
If you enable the Proxy and Custom Dir options and later disable
the Proxy (but not the Custom Dir options), Blender crash every
time that you try select the strip, because the proxy don't exist
anymore.

The solution: only draw the Custom Dir button if the Proxy
option is enable.
2008-07-15 01:23:56 +00:00
Maxime Curioni
96e52b09da soc-2008-mxcurioni: Reimplemented the Freestyle Python API's files to be correctly used as classes and not submodules. Added and integrated object lifecycle functions (__new__, __alloc__, __repr__) for the previous classes: BinaryPredicate0D, BinaryPredicate1D, Id, Interface0D, Interface1D. All of these classes were tested within Blender's Python interpreter with simple test cases and their getter/setters were corrected.
Interface0DIterator was modified to allow BPy_Interface1D to be instantiated: verticesBegin(), verticesEnd(), pointsBegin(float) and pointsEnd(float) are not pure virtual functions anymore. If they are called directly from  BPy_Interface1D (instead of its subclasses), an error message is displayed.
2008-07-15 01:07:19 +00:00
6583edf07d Bugfix:
My recent commit in transform code messed up Auto-IK.
2008-07-14 23:49:17 +00:00
ac6641664e Subgraph joins to non-terminal nodes 2008-07-14 20:30:23 +00:00
657a3676bd First draft of subgraph joining 2008-07-14 19:05:25 +00:00
785123cc5a Improved build time on BLI_kdopbvh
Its now faster than raytree (both on build and query)

Things tryed:
 X=>Y=>Z=>X split (reduces build time.. but increases query time)
 bucket sorts
	(initial sorts for fast usage of bucket take a long time)
	(nth is linear.. so its quite fast already)

Best times archieve with:
 *usage of 4-ary trees.. reduces build time and tree size but didnt decreased query time
 *quads are on the same node instead of splitting in 2 tris..
	(this actually turned on speedup on query time.. since tree size is reduced by a factor of 2)
 *test ray-bb before ray-primitive gives better times on both tris and quads

Notes:
 measures where made projecting a sphere from inside the head of suzanne.
2008-07-14 18:42:53 +00:00
e8e1f27ac1 bugfix
* samples that wernt loaded could crash blender - divide by zero errors from having 0 channels or bits.
* could also corrupt memory when selecting samples with long names. from the sample selector menu.
2008-07-14 17:19:24 +00:00
84ae0fc000 merge with trunk (15330 -> 15566) 2008-07-14 14:09:36 +00:00
d50d175ba1 Win64 fix: disable 1GB restriction for 64bit windows systems, baking fluid with >4GB is verified to work on Vista64. 2008-07-14 12:24:49 +00:00
0c23d0c2ad Bugfix #17327
Small one: changed the string attribute in multilayer exr files to be:

"2.43 and newer"

To indicate that it's about compatibility of the exr file, not the version
Blender saved it in.
2008-07-14 10:26:11 +00:00
0022222b05 Bugfix #17323
Ztransp OSA render did not include z values anymore in pass... this is
not good Z anyway (aliased), but at least it's back now.

Note: for composites using Z values: use FSA for superior results.
2008-07-14 09:37:06 +00:00
38cfe9c1a2 importing the GameLogic module was being done by adding the text "import GameLogic" to the start of all scripts used in the game engine, this meant every error line number was off by 1 (quite annoying). better to do this to the dictionary that the scripts run with. 2008-07-14 00:47:07 +00:00
8a19adeb58 Win64 fix: if you disable enough things in CMakeList.txt blender compiles on win64 now using cmake --> *BUT* it doesn't say anything about if it works with MEM>4GB (that's next thing to explore!) 2008-07-13 18:29:07 +00:00
915baebda6 Get simulated annealing working correctly. Meaning bone arc retargeting is much faster than before.
Still need to do stability tests and analysis (brute force is probably better in some situations).
2008-07-13 18:24:27 +00:00
37ca3d7a39 Fix to let Ghost compile with win64 msvc compiler. 2008-07-13 17:49:12 +00:00
59df4a4b3a Bugfix #14435
"(De)Select faces with material" (edit buttons) should also draw image window
2008-07-13 14:49:07 +00:00
70730c7226 svn merge -r 15392:15551 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-07-13 13:21:01 +00:00
7d6e004153 Adding the Cullface option on normal projection of shrinkwrap when using bvhtrees 2008-07-13 01:49:53 +00:00
751aa3e121 Fixing the fix: Sometimes, Valgrind sees memory leaks where noone is - especially with external used memory managers like in this case (and Python case) 2008-07-12 22:11:26 +00:00
572f1d88d2 BGE bug fix (good for 2.47): automatic detection that target object of AddObject actuator is being deleted to avoid crash (bad game design anyway) 2008-07-12 12:10:27 +00:00
6c444c205a Update MSVC project files 2008-07-12 11:57:21 +00:00
a49c9c458a improvement of 2d-filter custom shader,
some bugfixes,
now you can use depth buffer and luminance buffer without any settings,
also you can use object's properties in a shader
2008-07-12 10:21:37 +00:00
5f15b164c5 Patch #17285: fix for bug #14685: frame counter not always updating while scrubbing
Patch submitted by Roelf De Kock (kiemdoder) 

The parts of the patch affecting the timeline were have not been committed, as there was a better solution.
2008-07-12 06:49:33 +00:00
a4eb0d6c2f Bugfix #17318: PoseLib: Crash while searching for pose typing in letter i then backspace
When searching failed to find any matches, the pointer to a matching pose was cleared. However, it wasn't reset upon clearing the invalid search-string, so a crash occurred.
2008-07-12 06:44:57 +00:00
279c5b65e2 Patch #17310: Fixing urls in main README
Thanks to Dietrich Bollmann (diresu) for the patch
2008-07-12 06:18:06 +00:00
Maxime Curioni
8398730043 soc-2008-mxcurioni: merge with trunk - rev 15540 2008-07-12 05:02:47 +00:00
42d43de25d == Action Editor - NKEY Properties Panel ==
When the NKEY is pressed in the Action Editor while hovering over the keyframes area, a floating properties panel can now be accessed. It shows relevant properties for the active channel, however this is currently only for Action Groups. Action Channel support will come later.

The key benefit of this panel is that it is now possible to edit the colour set used by a group. Also, there is a button for selecting all the channels in that group (which can also be done by simply Ctrl-Shift clicking on any group).
2008-07-12 05:00:37 +00:00
Maxime Curioni
d124d3c5cd soc-2008-mxcurioni: first part of the Freestyle Python implementation. A new Freestyle module is added. The following modules are implemented: BinaryPredicate0D, BinaryPredicate1D, Id, Interface0D, Interface1D. I added a Convert module to help in the creation of Python objects for Freestyle's data structures. I also added a missing file for guarded_alloc needed for compilation on Windows. 2008-07-12 04:02:08 +00:00
1ffdc66791 Fix for bug [#13479] Particle system "corrupts" when changing material colour and used in conjunction with softbodies
- changing particlesystem settings for hair particles cleared & recalculated everything even when hair softbody was baked
2008-07-11 23:47:44 +00:00
21d032e919 Added sphere cast (tought it doenst seems to solve the intersection problem)
Fixed SweepingSphereIntersectsTriangleUV
2008-07-11 19:46:35 +00:00
b369936b11 Fix for several memory leaks in fluidsim (found with Valgrind). 2008-07-11 18:08:25 +00:00
efb2639a26 Memory leak fix (found with Valgrind) 2008-07-11 17:08:45 +00:00
c83e32fc33 svn merge -r 15409:15529 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-07-11 14:44:20 +00:00
3fce5ba59a Memory leak fix: br_find_exe() uses strdup() which uses malloc and therefore the returned string needs free'ing (Found with valgrind). 2008-07-11 14:11:55 +00:00
2e144abfbd Bugfix #17306: Missing refresh call for button in UserPrefs
Autokey settings were missing redraw for Info-window
2008-07-11 00:36:38 +00:00
de1987eba8 First draft for simulated annealing optimization method (disabled because not ok yet) 2008-07-10 21:04:29 +00:00
ccc62d3385 Use tree length as parameter for multi resolution filtering.
This is the begining of the simplification phase (meaning less parameters to mess up users)
2008-07-10 18:48:27 +00:00
8eab9e15d5 Fix for bug #14411: missing preview render redraw for a few lamp buttons. 2008-07-10 18:11:36 +00:00
7971d7c9f3 Fix for bug #14665: stars not working in 3D view. 2008-07-10 16:29:42 +00:00
46493c0af5 Fix for bug #17292: vertex paint blur darkens the colors as you
paint, due to old optimization to use >>8, but this is equivalent
to /256, and it should be /255.
2008-07-10 15:30:35 +00:00
fbc105335f Special multi resolution lookup on first arc, because the lowest node can get filtered out too. 2008-07-10 15:15:47 +00:00
310a37c29c Adding an option for action actuator - "Continue" this means animations always play from where they left off. Continue was the 2.46 operation too, so new functionality is the option to disable.
When using states, an action like kick or throw can often switch out before finishing playing the action, and there was no way to play from the start frame the second time round. (even setting the actions current frame through python doesn't work work)
2008-07-10 14:23:19 +00:00
99fdf27af9 Sync with Apricot Game Engine
=============================

* Clean up and optimizations in skinned/deformed mesh code.
* Compatibility fixes and clean up in the rasterizer.
* Changes related to GLSL shadow buffers which should have no
  effect, to keep the code in sync with apricot.
2008-07-10 12:47:20 +00:00
3d7358539d AutoMerge Keyframes option for Action/NLA editors will now also delete duplicate keyframes if a Duplicate (SHIFT-DKEY) operation is cancelled. 2008-07-10 01:47:51 +00:00
5c82516261 -> Support for Custom Data in bevel modifier
Added Customdata to Bmesh <-> derivedmesh functions
2008-07-10 00:46:19 +00:00
496a9c1a95 Apricot Request:
When changing the active action in the NLA editor with NLA-override off, armatures now have their restpose applied before the new action is evaluated. 

I've commented the code here to make it clearer what is going on.
2008-07-10 00:15:57 +00:00
45ab006e7c Draw node index
Retargetting, go to higher levels no nodes when no match is found
Fix bug in exterme threshold external filtering
2008-07-09 21:07:02 +00:00
686027a75a Multi resolution retargetting. Go back to lowest level on shared nodes. 2008-07-09 19:44:40 +00:00
d674041f2b Add raycast ability for BLI_kdopbvh
small bvh fixes:
*allow to create any tree type >= 2
*save split axis

changed shrinkwrap to perform normal cast with raytree and bvh tree and print both times:

Shrinkwrap (OBCube)24578 over (OBSuzanne)504482
target = raytree_create_from_mesh(calc->target): 1260.000000ms
shrinkwrap_calc_normal_projection_raytree(&calc): 1850.000000ms
tree = bvhtree_from_mesh_tri(calc->target): 3330.000000ms
shrinkwrap_calc_normal_projection(&calc): 3780.000000ms

On general query time is bit smaller on bvh tree..
but the build time of bvh is pretty big.
(build time can be removed from both if a cache system is added)
But I am still trying to see how fast I can make the bvh build
2008-07-09 19:43:09 +00:00
b915ba5e97 [#17298] surface normal direction compensation for objects with negative scale in rendering with radiosity
from Roelf De Kock (kiemdoder) 

Fixes bug [#7969] Mirroring Object Breaks Radiosity Calculations

- copied from the tracker.
The code in this patch detects whether an object has negative scale (test the OB_NEG_SCALE bit in Object.transflag)
and then compensate for the negative scale when the surface normals are calculated for a radiosity render.
2008-07-09 19:15:26 +00:00
4019cae181 Fix external arc merging bug (could mess up node degrees) 2008-07-09 18:36:35 +00:00
12c128ac04 Fixed bug #14510 - wave modifier crash
CDDM_apply_vert_coords needs a CDDerivedMesh, but it was getting a
CCGDerivedMesh from the preceding Subsurf modifier. This fix just makes
a CDDerivedMesh copy of the supplied DerivedMesh rather than using it directly.
2008-07-09 15:54:53 +00:00
732d886e0a bugfix, vector was not checked for zero length before normalizing, closing blender instantly with an assert. 2008-07-09 15:30:15 +00:00
d0d179dce6 Buhh... and now I left in testing print in exr code. 2008-07-09 15:25:34 +00:00
180a7d1f62 Replaced strcasecmp with BLI_strcasecmp, to make msvc happy! 2008-07-09 13:12:58 +00:00
bad6b003db Fix for reported openexr file reading failures.
For simple RGB(A) files, the channel names in openexr were supposed
to be simply "R" "G" "B" and "A" too.
Other programs like other names... like lower case, or like "ambient.r"

Tested with file from renderman.
2008-07-09 10:51:03 +00:00
838886daf3 Fix for bugfix #12075: gamma node check for nan was always
checking red channel.
2008-07-09 10:13:09 +00:00
60d099648c added a factor argument for aligning to vector, this isn't correct since it does linear interpolation of the vector and renormalizes.
(can be improved to rotate correctly but for our  use ist ok for now, would also be useful to have an argument to clamp the maximum rotation angle to get a constant rotation speed),

This will used to make franky upright when falling from an angle, to track to a surface when hanging onto a ledge and setting the glide pitch.
Without this rotation is instant and jerky.

currently this is done with Mathutils which isnt available in Blender Player.

def do_rotate_up(own):
	own.alignAxisToVect([0,0,1], 2, 0.1)

replaces...

def do_rotate_up(own):
	up_nor = Vector(0,0,1)
	own_mat = Matrix(*own.getOrientation()).transpose()
	own_up = up_nor * own_mat
	ang = AngleBetweenVecs(own_up, up_nor)
	if ang > 0.005:
		# Set orientation
		cross = CrossVecs(own_up, up_nor)
		new_mat = own_mat * RotationMatrix(ang*0.1, 3, 'r', cross)
		own.setOrientation(new_mat.transpose())


M    source/gameengine/Ketsji/KX_GameObject.cpp
M    source/gameengine/Ketsji/KX_GameObject.h
2008-07-09 09:21:52 +00:00
Maxime Curioni
d760119f45 soc-mx-2008: SWIG dependency - wrapper functions extracted from ModuleWrapper.cpp 2008-07-09 08:24:13 +00:00
16dccd3ffd exiting wasnt working (was raising errors), also use dict.keys() rather then appending from iteritems, 2008-07-09 00:58:57 +00:00
Maxime Curioni
f7f0077294 soc-2008-mxcurioni: first (blank) file upload for SWIG removal, in source/blender/freestyle/intern/python. The migration will be based on source/blender/freestyle/intern/swig/ModuleWrapper.{cpp,h} 2008-07-08 22:55:00 +00:00
e279fc4a81 fix for crasher with touch sensor, ben you may want to look at this, should be ok since the ray sensor does NULL checks in for getNewClientInfo in a similar area. 2008-07-08 22:43:44 +00:00
daa853a31f Rename some struct members to reduce confusion
Proper flag clearing for retarget on multi resolution
2008-07-08 19:34:20 +00:00
bbf1ce2762 bugfix - GameEngine PyObject methods did not all return when using dir(), because inherited methods were ignored, This made it incredibly annoying, not only having to search a C++ file to see what functions were available. but looking up methods inherited from other C++ classes.
There is still no __members__ attribute so dir() wont work at all for attributes.
2008-07-08 17:57:31 +00:00
3bab1eba3a Introduced quality to GUI, not yet tested (WIP commit) 2008-07-08 17:38:33 +00:00
092a5b9fbd Fix for crash in freeing group nodes, node trees have to be freed
before materials.
2008-07-08 17:04:58 +00:00
f8afbb4054 Start multi resolution search on first arc and smarter search (match first two levels only).
Now need a way to go back to lower levels at shared nodes.
2008-07-08 16:22:18 +00:00
d1fd99b070 BGE logic patch: new "Add" mode for Ipo actuator, several corrections in state system.
New Add mode for Ipo actuator
=============================
A new Add button, mutually exclusive with Force button, is available in
the Ipo actuator. When selected, it activates the Add mode that consists
in adding the Ipo curve to the current object situation in world
coordinates, or parent coordinates if the object has a parent. Scale Ipo
curves are multiplied instead of added to the object current scale.
If the local flag is selected, the Ipo curve is added (multiplied) in 
the object's local coordinates. 
Delta Ipo curves are handled identically to normal Ipo curve and there 
is no need to work with Delta Ipo curves provided that you make sure 
that the Ipo curve starts from origin. Origin means location 0 for 
Location Ipo curve, rotation 0 for Rotation Ipo curve and scale 1 for 
Scale Ipo curve.

The "current object situation" means the object's location, rotation 
and scale at the start of the Ipo curve. For Loop Stop and Loop End Ipo 
actuators, this means at the start of each loop. This initial state is
used as a base during the execution of the Ipo Curve but when the Ipo 
curve is restarted (later or immediately in case of Loop mode), the  
object current situation at that time is used as the new base.

For reference, here is the exact operation of the Add mode for each
type of Ipo curve (oLoc, oRot, oScale, oMat: object's loc/rot/scale
and orientation matrix at the start of the curve; iLoc, iRot, iScale,
iMat: Ipo curve loc/rot/scale and orientation matrix resulting from
the rotation).

Location
  Local=false: newLoc = oLoc+iLoc
  Local=true : newLoc = oLoc+oScale*(oMat*iLoc)
Rotation
  Local=false: newMat = iMat*oMat
  Local=true : newMat = oMat*iMat
Scale
  Local=false: newScale = oScale*iScale
  Local=true : newScale = oScale*iScale

Add+Local mode is very useful to have dynamic object executing complex
movement relative to their current location/orientation. Of cource, 
dynamics should be disabled during the execution of the curve.

Several corrections in state system
===================================
- Object initial state is taken into account when adding object
  dynamically
- Fix bug with link count when adding object dynamically
- Fix false on-off detection for Actuator sensor when actuator is
  trigged on negative event.
- Fix Parent actuator false activation on negative event
- Loop Ipo curve not restarting at correct frame when start frame is
  different from one.
2008-07-08 12:18:43 +00:00
168ae6765e Bugfix #16535
The infamous Fkey 'make face' in editmode still failed in cases, giving
an annoying convex error popup.
Found two errors in this code:

- not all cases were evaluated to make a face of 4 vertices (6 cases)
- the function that makes always a face when the 4 edges already exist 
  failed when not in vertex-select mode.

I also removed the popup, but added a print... its still not perfect.
2008-07-08 11:47:22 +00:00
a166def7b3 scenes set pose objects would draw in posemode while weight painting if they were set to posemode in their scene. 2008-07-08 10:18:34 +00:00
878a5303f3 Compiler warning fixes (how some of this stuff compiled without stopping compiling I don't know) ;) 2008-07-08 07:30:38 +00:00
22e87792f1 == Select Swap for Armatures (Ctrl I) ==
It is now possible to swap the selection of bones in EditMode and PoseMode using the CTRL IKEY hotkey. 

As a result, the hotkey for adding IK Constraints has now changed to SHIFT IKEY (so that select swap can have a consistent hotkey)
2008-07-08 07:06:42 +00:00
3185253a06 -> UV and VCOL support for bevel (editmode)
BMesh and the bevel code now support UVs/VCOLS.
The offset is fixed at this time, but will be
made dynamic later.
2008-07-08 02:22:37 +00:00
1d822b1cda patch from res2k to stop the blender window being upscaled on vista. 2008-07-07 22:11:11 +00:00
e341586f9d own mistake with drawing used state bits.
Other minor changes and removed some warnings.
2008-07-07 21:04:30 +00:00
01e9635ef1 Correct IPOs again, have yet to find a resolution how to hide some unsused IPOs 2008-07-07 21:04:20 +00:00
52219d52dd First draft: Use multiresolution graph for retargetting (enables bypassing small appendages that don't correspond to anything on the armature). 2008-07-07 20:31:53 +00:00
2ad696111e Some channel fixes for fc 2008-07-07 20:28:56 +00:00
f139e1f1b4 Reeb multiresolution filtering, now with more than one level 2008-07-07 17:27:22 +00:00
e409c2463d WIP commit to introduce channels 2008-07-07 14:36:33 +00:00
d3745d70a5 Another addition of time values, yet some things to follow 2008-07-07 09:23:12 +00:00
17dc66c1d1 [#17288] Sequencer API: added a method, a geter/setter, the blend modes dict and corrected a malfunction on audio strips blend mode
from Luca Bonavita (mindrones) 

- adds the method "rebuildProxy()" useful to rebuild all the strips at once:   the user can do

- adds a BlendModes dictionary under the Blender.Scene.Sequence module: the  user can see the blending option with

- adds the getter/setter "blendMode"

- adds a function seq_can_blend in sequence.c as requested by Peter, useful for these purposes but also to solve a bug
after

- the bug is you can apply blend modes to an audio strip that doesn't make sense: changed the test and now you cannot
assign blend mode other than Replace to audio strips

Omitted DNA cleanup part since its only whitespace and Id prefer to have a useful "svn blame" output.
2008-07-07 04:17:03 +00:00
0456a71edd * New UV editor selection mode: Island
This goes alongside vertex and face selection and selects an entire UV island with a single click. It's a lot less painful to use when rearranging UV layouts, especially with Drag Immediately on - see: http://mke3.net/blender/etc/uv_island.mov
2008-07-07 02:02:10 +00:00
32cefbdecf Derived Mesh Bugfix
EditMesh MEdge vertex index were doubled incremented, so more or less always wrong (even worse, could read outside of array).
2008-07-07 01:56:47 +00:00
707301ad1b Little tweak to timeline_force_draw, so that button windows are updated properly 2008-07-07 00:54:32 +00:00
dd5148e265 Fix for bug: [#14570] particle system: grid distribution + vertex emitting bug
- grid distribution didn't check for emission from vertices
2008-07-06 22:52:55 +00:00
7bbf88d602 Added 4 gui elements to structs, another 2-3 will follow; Unsolved problems: simulation and control time desync 2008-07-06 21:55:03 +00:00
Maxime Curioni
270184e1b2 soc-2008-mxcurioni: merge-repair with trunk rev 15456 2008-07-06 19:53:32 +00:00
b3303c98b1 Another fluid type 'control' added and introduced to elbeem, still some issues to solve but with 1 change in fluidsim.c it kind of works already (hint for me - disabled for other people so they don't complain) 2008-07-06 18:19:42 +00:00
a06a4663c4 === Transform Snap ===
Bugfix face snapping in edit mesh didn't test for selection properly
2008-07-06 15:38:51 +00:00
8a729824f4 GameObject rayCast and rayCastTo were not setting exception strings (causes return without exception set error)
Also made game state buttons only have a dot in states that have controllers in them.
2008-07-06 14:11:30 +00:00
1df2701fd7 Bugfix #16669
The Image "do premul" option didn't work when Image was of type Sequence.
(Note: this option converts key-alpha images to premul, as is standard
in Blender rendering)
2008-07-06 13:52:17 +00:00
37205596da #16675: Object name doesn't get updated in 3D viewports if it is changed via Buttons Window 2008-07-06 11:25:58 +00:00
79f858b795 Bugfix #17139
When "image type" is a movie, image file saving falls back to jpg as a 
default. The code checking extensions didn't correctly include quicktime.
2008-07-06 09:21:39 +00:00
de286af3f1 Filter according to arc length, not weight different (more logic physical filtering) 2008-07-05 22:01:46 +00:00
Maxime Curioni
eda7cdc81d soc-2008-mxcurioni: merged changes to revision 15441 2008-07-05 13:30:48 +00:00
e6e2087e90 Updates from Roger Wickes
[#16494] Animation Bake Constraints update
links cloned children to cloned parents, useful for ik target baking. whitespace, capitalization.

[#15032] C3D Import script cleanup/IK
Changed code to put IK constraints on a user-defined layer, separate from Markers. cleaned up module naming convention.
removed questionable sloc. add revision history. forced the TrackTo constraint to use a valid marker, and not make up
one on its own.
2008-07-05 11:38:16 +00:00
Maxime Curioni
85611d1045 soc-2008-mxcurioni: render buffer modification 2008-07-05 11:16:03 +00:00
Maxime Curioni
d50fbd6568 soc-2008-mxcurioni: render buffer format 2008-07-05 11:13:57 +00:00
2fc5281c83 patch [#17275] Fix for: pressing delete on an empty sequencer pops up a confirmation
from Roelf De Kock (kiemdoder) to address report #15025
2008-07-05 11:08:39 +00:00
Maxime Curioni
65c9dfe436 soc-2008-mxcurioni: render layer with FBOs -> render buffers, version 2. Still not working. 2008-07-05 08:50:41 +00:00
Maxime Curioni
5200f51a87 soc-2008-mxcurioni: first render layer implementation with frame buffer objects. It does not work yet: I cannot manage to read from the correct buffer yet. 2008-07-05 06:22:15 +00:00
eda5b6d736 ->Last Commit broke compilation on GCC
CustomData_bmesh_set function header and
prototype didnt match. For some reason this
not only compiledon MSVC but didnt even warn...
2008-07-04 22:32:06 +00:00
0bdfc6a953 == BUGFIX ==
- fix crash when exiting game engine (with ESC-key).
- reason for crash: std::vector iterator is invalid after vector::erase
2008-07-04 20:24:15 +00:00
488a8291d1 == compile fix ==
- fix compilation for MSVC (added missing math define)
- note: defines were already duplicated, added twice to keep them in synch
2008-07-04 20:21:08 +00:00
37a017b18a *Added vertex groups on simple deform
*Fixed a few UI things

*Make SimpleDeform and Shrinkwrap to use vertexgroup_get_vertex_weight, a similar function
 "static float vert_weight(MDeformVert *dvert, int group)"  existed on modifier.c, changed
it a bit and moved into BKE_deform.h
2008-07-04 19:56:31 +00:00
107b78a3d2 Made some python game engine funcs use NOARGS, getAxisVec was using wrong multiplication order.
Use BUT_TOGDUAL for controllers init states so you can see what the init state is for any controller without using the button to check.
2008-07-04 19:00:56 +00:00
733b4c9351 -> Vertex Group support for bevel (editmode only)
Vertex groups are now preserved when beveling (editmode only).
Modifier support as well as uv/vert colors to follow soon.
2008-07-04 17:59:16 +00:00
d9c60da9b7 -> Moving Pooling Alloctor to BlenLib
Bmesh's pooling allocator is probably usefull for other parts of blender as
well, so I am moving it to BlenLib.
2008-07-04 17:32:55 +00:00
44e13eb8d5 Generate and display multi resolution filtering graphs 2008-07-04 17:05:06 +00:00
baa1001b47 Initial GUI implementation, yet not functional 2008-07-04 15:23:21 +00:00
70d239ef7d BGE logic update: new servo control motion actuator, new distance constraint actuator, new orientation constraint actuator, new actuator sensor.
General
=======
- Removal of Damp option in motion actuator (replaced by
  Servo control motion).
- No PyDoc at present, will be added soon.

Generalization of the Lvl option
================================
A sensor with the Lvl option selected will always produce an 
event at the start of the game or when entering a state or at 
object creation. The event will be positive or negative 
depending of the sensor condition. A negative pulse makes
sense when used with a NAND controller: it will be converted
into an actuator activation.

Servo control motion
====================
A new variant of the motion actuator allows to control speed 
with force. The control if of type "PID" (Propotional, Integral, 
Derivate): the force is automatically adapted to achieve the 
target speed. All the parameters of the servo controller are
configurable. The result is a great variety of motion style: 
anysotropic friction, flying, sliding, pseudo Dloc...
This actuator should be used in preference to Dloc and LinV
as it produces more fluid movements and avoids the collision 
problem with Dloc.
LinV : target speed as (X,Y,Z) vector in local or world 
       coordinates (mostly useful in local coordinates).
Limit: the force can be limited along each axis (in the same
       coordinates of LinV). No limitation means that the force
       will grow as large as necessary to achieve the target 
       speed along that axis. Set a max value to limit the 
       accelaration along an axis (slow start) and set a min
       value (negative) to limit the brake force.
P:     Proportional coefficient of servo controller, don't set
       directly unless you know what you're doing.
I:     Integral coefficient of servo controller. Use low value
       (<0.1) for slow reaction (sliding), high values (>0.5)
       for hard control. The P coefficient will be automatically
       set to 60 times the I coefficient (a reasonable value).
D:     Derivate coefficient. Leave to 0 unless you know what
       you're doing. High values create instability. 

Notes: - This actuator works perfectly in zero friction 
         environment: the PID controller will simulate friction
         by applying force as needed.
       - This actuator is compatible with simple Drot motion
         actuator but not with LinV and Dloc motion.
       - (0,0,0) is a valid target speed.
       - All parameters are accessible through Python.

Distance constraint actuator
============================
A new variant of the constraint actuator allows to set the
distance and orientation relative to a surface. The controller
uses a ray to detect the surface (or any object) and adapt the
distance and orientation parallel to the surface.
Damp:  Time constant (in nb of frames) of distance and 
       orientation control.
Dist:  Select to enable distance control and set target 
       distance. The object will be position at the given
       distance of surface along the ray direction.
Direction: chose a local axis as the ray direction.
Range: length of ray. Objecgt within this distance will be 
       detected.
N    : Select to enable orientation control. The actuator will
       change the orientation and the location of the object 
       so that it is parallel to the surface at the vertical
       of the point of contact of the ray.  
M/P  : Select to enable material detection. Default is property
       detection.
Property/Material: name of property/material that the target of
       ray must have to be detected. If not set, property/
       material filter is disabled and any collisioning object
       within range will be detected.
PER  : Select to enable persistent operation. Normally the 
       actuator disables itself automatically if the ray does
       not reach a valid target. 
time : Maximum activation time of actuator. 
       0 : unlimited.
       >0: number of frames before automatic deactivation.  
rotDamp: Time constant (in nb of frame) of orientation control.
       0 : use Damp parameter.
       >0: use a different time constant for orientation.

Notes: - If neither N nor Dist options are set, the actuator
         does not change the position and orientation of the
         object; it works as a ray sensor.
       - The ray has no "X-ray" capability: if the first object
         hit does not have the required property/material, it
         returns no hit and the actuator disables itself unless
         PER option is enabled.
       - This actuator changes the position and orientation but
         not the speed of the object. This has an important 
         implication in a gravity environment: the gravity will
         cause the speed to increase although the object seems
         to stay still (it is repositioned at each frame).
         The gravity must be compensated in one way or another.
         the new servo control motion actuator is the simplest 
         way: set the target speed along the ray axis to 0
         and the servo control will automatically compensate 
         the gravity.
       - This actuator changes the orientation of the object 
         and will conflict with Drot motion unless it is 
         placed BEFORE the Drot motion actuator (the order of 
         actuator is important)
       - All parameters are accessible through Python.

Orientation constraint 
======================
A new variant of the constraint actuator allows to align an
object axis along a global direction.
Damp : Time constant (in nb of frames) of orientation control.
X,Y,Z: Global coordinates of reference direction. 
time : Maximum activation time of actuator. 
       0 : unlimited.
       >0: number of frames before automatic deactivation.  

Notes: - (X,Y,Z) = (0,0,0) is not a valid direction
       - This actuator changes the orientation of the object
         and will conflict with Drot motion unless it is placed
         BEFORE the Drot motion actuator (the order of 
         actuator is important).
       - This actuator doesn't change the location and speed. 
         It is compatible with gravity.
       - All parameters are accessible through Python.

Actuator sensor 
===============
This sensor detects the activation and deactivation of actuators 
of the same object. The sensor generates a positive pulse when 
the corresponding sensor is activated and a negative pulse when 
it is deactivated (the contrary if the Inv option is selected). 
This is mostly useful to chain actions and to detect the loss of 
contact of the distance motion actuator.

Notes: - Actuators are disabled at the start of the game; if you
         want to detect the On-Off transition of an actuator 
         after it has been activated at least once, unselect the
         Lvl and Inv options and use a NAND controller.
       - Some actuators deactivates themselves immediately after 
         being activated. The sensor detects this situation as 
         an On-Off transition.
       - The actuator name can be set through Python.
2008-07-04 08:14:50 +00:00
Maxime Curioni
5bee0c9a82 soc-2008-mxcurioni: foundations for Freestyle as a render layer - new UI buttons and mode flags, Freestyle API refactoring, modified pipeline to incorporate the new render layer. Compared to previously, the layer functionality is available when selecting 'Blender Internal' as the rendering engine. Freestyle's result is not available in the layer yet. I need to integrate OpenGL offscreen rendering properly (with framebuffer objects) to reach that goal. 2008-07-04 07:59:19 +00:00
ad310b5087 Added modes Squash and Strech to SimpleDeform (need testing)
CHanged the add modifier menu to show a submenu for selecting the type of simpledeform.
2008-07-04 01:03:50 +00:00
bd74679a39 small changes to py funcs that can run 100s of times a second, so python wont generate empty args tuple when they are not needed. 2008-07-04 00:30:44 +00:00
5c93e75682 non user visible changes and small optimizations to the game engine pyapi as well as fixing some bugs.
* 2 returning errors without exception set another return None instead of NULL.
* a missing check for parent relation
* BPY matrix length was incorrect in matrix.c, this change could break some scripts, however when a script expects a list of lists for a matrix, the len() function is incorrect and will give an error. This was the only thing stopping apricot game logic running in trunk.

Also added a function for GameObjects  -  getAxisVect(vec), multiplies the vector be the objects worldspace rotation matrix. Very useful if you want to know what the forward direction is for an object and dont want to use Blender.Mathutils which is tedious and not available in BlenderPlayer yet.
2008-07-04 00:05:50 +00:00
70c33ec526 Window Installer:
A couple of fixes:
 - uninstaller now deletes itself (oops! :)
 - uninstaller now correctly locates \.blender for removal.
2008-07-03 19:10:54 +00:00
a4b6f74a48 Reeb Graph Copy procedures, for multi resolution filtering 2008-07-03 17:51:19 +00:00
a440769843 Fix arc flipping for null embedding filtering 2008-07-03 16:32:19 +00:00
7e7791755a Sun,Sky and atmosphere for lamps(sun type), PATCH#8063 http://projects.blender.org/tracker/?func=detail&atid=127&aid=8063&group_id=9 2008-07-03 10:38:35 +00:00
31aa43da97 Adding GameObject setLinearVelocity(), without this interacting with objects requires them to have logic bricks to apply force which doesn't work well when the character is in a seperate blend file to the levels. (its also messy to have a script & multiple motion actuators on each object you can pickup and throw).
This is also needed for removing any force that existed before suspending dynamics - In the case of franky hanging, resuming dynamics when he fell would apply the velocity he had when grabbing making dropping to the ground work unpredictably. 

Also note in pydocs that enable/disable rigidbody physics doesn't work with bullet yet.
2008-07-03 01:34:50 +00:00
2b3df6ea63 svn merge -r 14676:15409 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-07-02 21:55:25 +00:00
d350e272e7 Remove some debugging prints
Better symmetry detection using subtree shapes instead of depth
Fix the bug with flipping arcs caused by internal filtering
2008-07-02 21:36:45 +00:00
424141f44d == Python, GE & Threads ==
Martin Sell (thanks!) reported that threading via scripts was not working in the game engine with Blender 2.46 and later. My fault, to make pynodes work properly with threads > 1 I disabled Python's "check interval", preventing threads created via scripts from receiving time to run.

Now only during rendering check interval is disabled (set to max int). Still experimental, I added the calls in BPY_do_all_scripts, since it's called in BIF_do_render, but will probably move the code to its own function after more testing & feedback.
2008-07-02 21:01:59 +00:00
8ca128414d Cloth collisions: Reorganized collision system to be more flexible for other parts of blender, so it can be more easily reused. Also slowed down friction impulse. 2008-07-02 20:28:49 +00:00
Maxime Curioni
ffb07fcfb3 soc-2008-mxcurioni: renamed libQGLWidget's Camera class to AppGLWidget_Camera to use Blender's Camera struct, integrated the camera parameters from Blender. Perspective projection (precisely field of view) is now correct. Orthographic projection still having issues. 2008-07-02 12:16:36 +00:00
eca709e481 Added lower and upper options on all modes of simple deform
Fixed existent offset after applying bend.
2008-07-02 00:17:08 +00:00
b0958b6646 Checked all cases where PyArg_ParseTuple is used in blenders game engine and made sure all will raise errors when called with invalid args. 2008-07-01 16:43:46 +00:00
bc8364fef0 bugfix, ActionActuator was missing many checks for PyArg_ParseTuple failing.
This meant an error in a script could be reported in a different line or script file which makes it quite hard to trace the problem. There were also places where invalid pointers could be used because of this.
The whole game engine pyapi probably needs to have these checks added.
2008-07-01 13:21:37 +00:00
06ee2ed60e let the logic buttons operate on objects in different scenes. They would already display but pressing the buttons did nothing.
This is useful when using 1 scene for a character and another for a test level, so the character logic can be edited without switching scenes.
2008-07-01 06:44:34 +00:00
96152f8409 track to would crash (with a C++ assert) if the source and target are in the same location, which I have had happen a few times while testing. 2008-07-01 05:16:08 +00:00
c7dbc65488 svn merge -r 15292:15392 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-06-30 22:57:52 +00:00
90c2c29058 Fix for python APi error - (Campbell: please check :) ) -- using myLamp.setType(Area) resulted in 'TypeError: expected int argument in [0,5]' (reported in IRC by Djoef) 2008-06-30 15:02:22 +00:00
5b15a610ee Fix crash in python API (Campbell: please check :) ) -- using myLamp.setType(number) crashed blender (reported in IRC by Djoef) 2008-06-30 14:44:12 +00:00
6a3e8e7fff BGE python api addition, GameObject get/setState and Controller.getState()
Also added a note in the tooltip for action priority when using more then 1 action at a time.
2008-06-29 21:52:23 +00:00
ab7794392e Fix for bug #7753: after game engine drawing with vertex arrays,
nurbs/curves/text dissappears.

This also removes the "vertex arrays" option and enables it always
for OpenGL version >= 1.1 - there's no need to have an option to
make things render faster disabled by default, also it should work
stable now.
2008-06-29 21:51:27 +00:00
6d7a43dd54 Fix for bug #13757: camera lens minimum value for ipo's was
different than the button.
2008-06-29 21:06:18 +00:00
d5f4b3620f Fix for bug #8680: GameLogic.getRandomFloat() returns very small
values on 64 bit, instead of range 0..1. Also a warning fix.
2008-06-29 20:53:17 +00:00
4b59a4bea0 == FFMPEG / ImBuf ==
Fixed deinterlacing (inplace deinterlacing didn't work out properly...).

[#14672] Sequencer: deinterlace filter artifacts
2008-06-29 15:11:35 +00:00
bdcffe35b9 NDOF bugfixes 14402 & 14403 by ettore Pasquini 2008-06-29 12:53:42 +00:00
7056d63f41 adding explicit cast to get things compiling 2008-06-29 12:25:15 +00:00
13e4ae1542 Action Editor - Group drawing tweaks:
* When all the action-channels for a group are hidden (i.e. their related bones are not visible), the group in question is also not drawn. This helps reduce clutter. (slikdigit funboard request)

* When a group has no channels belonging to it, the expand icon/button isn't drawn for that group.
2008-06-29 05:52:11 +00:00
e27d635e18 Added autokey call for Flip Quats tool (Alt-F in PoseMode) 2008-06-29 03:58:46 +00:00
b98e53b8ac BGE , fix an compile error 2008-06-28 14:19:25 +00:00
1231a2171a BGE 2d-filter, custom shaders now can have depth texture and luminance texture 2008-06-28 03:18:11 +00:00
14c1ed0810 Fixed own platform bug with stat/fstat. 2008-06-28 00:07:22 +00:00
f9ae102afd bugfix, txt_to_buf would crash on an empty text file.
Also checked all other uses of text->lines.first to make sure the assumption isn't made elsewhere.
Added 2 more checks for text->lines.first when converting text buffer to objects.
2008-06-27 23:01:33 +00:00
ab6e6b4c41 Mouse selection (LMB) and confirmation (MMB) added to suggestions UI. Also fixed the problem of offset text (horizontally scrolled). 2008-06-27 19:55:08 +00:00
09c898bd65 Modifications on simple modifier
+Added limits on bend
+button to create an empty and make child of object
+empty is now relative to object
2008-06-27 16:45:37 +00:00
f0a3cbcdac patch [#15865] BGE API call to delete objects
from Dalai Felinto (dfelinto) 
renamed deleteObject to endObject() to match the user interface.
2008-06-27 11:35:55 +00:00
aee5e95610 Modifying a file externally or deleting a file linked with a Blender Text object presents options for reloading, saving or separating the Text object from the external file (like the make local idea). 2008-06-26 18:28:33 +00:00
829b2668c5 Starting to debug the elusive graph spliting bug
Better check for RigGraph head
Fix harmonic weighting for quads
2008-06-26 18:15:45 +00:00
a8f00246ba Fix for bug [#13651] Convertor->Math->Divide broken
Changed the if statement to catch zero case properly.
2008-06-26 17:08:07 +00:00
cef2867fef Make it so it accepts blah.tiff as a filename not just blah.tif
This is for bug [#15132] When saving a render .tif is appended to the saved 
	file even if the name contains .tiff

Kent
2008-06-26 16:42:20 +00:00
11cdc2a002 Python API/Game engine fixes, dosn't affect 2.47
* Action FrameProp was checking if the string was true, not that it contained any text.
* Added GameObject.getVisible() since there is already a getVisible
* Added GameObject.getPropertyNames() Needed in apricot so Franky can collect and throw items in the level without having the names defined elsewhere or modifying his game logic which is stored in a separate blend file.
2008-06-26 12:39:06 +00:00
fc392040dd Added readline() and reset() for reading lines from a Blender Text Object and resetting the pointer to the beginning of the buffer. readline() will return the '\n' character and return '' when the end of the buffer is reached in accordance with other readline methods. 2008-06-25 21:00:39 +00:00
ac25593479 int toggle button function was being used on a short, remove warnings in buttons_logic.c too 2008-06-25 16:15:57 +00:00
84c4e89eba Commented out face transp changing when switching images, this is more annoying then helpful.
Edited Game engine docs to note that the matrix will need to be transposed if used with Mathutils.Matrix()
Edited "Collision" button since ray-sensor also uses collision.
2008-06-25 16:09:29 +00:00
c353af4d3a BGE patch 15044 approved: Edit Object Dynamics Actuator.
Add enable/disable dynamics actuator under the "Edit Object" category.
The Enable/disable rigid body option is also availale but not implemented.
2008-06-25 14:09:15 +00:00
e68834c75b Added UI for suggestions list. Works with arrow-keys and mouse wheel, accept with Enter, reject with Esc or click elsewhere. Mouse selection not yet supported. The script is called from the File->Text Plugins menu.
Tidied python script, the C suggestions functions and fixed some bugs including suggestions not being freed properly.
2008-06-25 13:51:54 +00:00
7ba2389932 added r/w access to nurb curves orderU for migius 2008-06-25 13:21:38 +00:00
820c2df12c BGE patch: Add automatic support for armature driven shape keys.
To take advantage of this feature, you must have a mesh with 
relative shape keys and shape Ipo curves with drivers referring
to bones of the mesh's parent armature. 
The BGE will automatically detect the dependency between the 
shape keys and the armature and execute the Ipo drivers during
the rendering of the armature actions.
This technique is used to make the armature action more natural: 
the shape keys compensate in places where the armature deformation 
is uggly and the drivers make sure that the shape correction
is synchronized with the bone position.

Note: This is not compatible with shape actions; BLender does 
not allow to have Shape Ipo Curves and Shape actions at the same
time.
2008-06-24 22:19:00 +00:00
4d478cbe86 BGE patch: remove Shape key driver code from previous commit 2008-06-24 21:39:45 +00:00
15c105c157 BGE patch: Add damping and clamping option to motion actuator.
This patch introduces two options for the motion actuator:

damping: number of frames to reach the target velocity. It takes
into account the startup velocityin the target velocity direction
and add 1/damping fraction of target velocity until the full 
velocity is reached. Works only with linear and angular velocity.
It will be extended to delta and force motion method in a future
release.

clamping: apply the force and torque as long as the target velocity
is not reached. If this option is set, the velocity specified 
in linV or angV are not applied to the object but used as target
velocity. You should also specify a force in force or torque field: 
the force will be applied as long as the velocity along the axis of
the vector set in linV or angV is not reached. Works best in low
friction environment.
2008-06-24 19:37:43 +00:00
bdc030c664 Text plugin basis with plugin for suggestions/completions. The suggest plugin works for imported global variables, methods, modules and module members. For example typing:
import Blender
from Blender import *
| <- cursor here suggests globals
Blender.Draw.gl| <- cursor here suggests all Draw members starting gl

Currently suggestions are listed in the console when the space is redrawn but will be presented as a menu-style list soon. Also to add are shortcut/activation keys to allow plugins to respond to certain key strokes.
2008-06-24 15:25:25 +00:00
9629f7ca11 Adding initial SimpleModifier (bend,taper,twist)
(I might only touch this code again late on the week :S, so here is a tmp commit)
2008-06-24 12:04:27 +00:00
533539901b Artists complaining about these popups
* Nothing indicated - is not helpful, and very annoying with occluded geometry with high poly meshes, sometimes the selection doesn't work 100% of the time and the menu pops up over what you want to select.
* No (correct) camera error doesn't seem to be needed, has been there since rev 2.
2008-06-24 09:49:29 +00:00
c0daf62733 More robust primary symmetry axis algorithm (support branch in two)
Draw primary axis and weight delta
2008-06-23 21:47:31 +00:00
02132de7aa BGE patch: Add NAND, NOR, XOR, XNOR controllers.
NAND controller is an inverted AND controller: the output is 
     1 if any of the input is 0.
NOR  controller is an inverted OR controller: the output is 0
     if any of the input is 1.
XOR  controller is an exclusive OR: the output is 1 if and only
     if one input is 1 and all the other inputs are 0.
XNOR controller is an inverted XOR: the output is 0 if and only
     if one input is 0 and all the other inputs are 0.
The NAND, NORT and XNOR controllers are very usefull to create
complementary outputs to start and stop actuators synchronously.
MSCV project files updated.
2008-06-23 20:41:18 +00:00
10c57fd86e BGE bug fix: action constraints were not correctly copied from Blender to BGE local copy, only the first one was copied 2008-06-23 20:29:32 +00:00
67c0b32375 BGE patch: Add level option on sensor and fix sensor reset.
Level option is now available on all sensors but is only implemented on 
mouse and keyboard sensors. The purpose of that option is to make
the sensor react on level rather than edge by default. It's only
applicable to state engine system when there is a state transition:
the sensor will generate a pulse if the condition is met from the
start of the state. Normally, the keyboard sensor generate a pulse
only when the key is pressed and not when the key is already pressed.
This patch allows to select this behavior.
The second part of the patch corrects the reset method for sensors
with inverted output.
2008-06-23 20:26:48 +00:00
8b9503e0ec bugfix [#14796] -t <threads> command line switch doesn't work unless FIXED_THREADS has previously been turned on
Command line threads now override blendfile setting in background mode.
Command line Threads greater then 8 are now clamped.
2008-06-23 16:47:15 +00:00
488fa13fc0 MERGING TRUNK 2008-06-23 16:37:51 +00:00
ac898d39ca Changed the style on shrinkwrapModifier_copyData.
Genscher made me do it the same way that the other 10 modifiers do.
The reason why I initially choosed memcpy was so that if anyone added
parameters on DNA there would be no need to update _copyData, unless
if it was a feature related to memory (eg.: point cache)
2008-06-23 16:23:26 +00:00
0f8697b9d2 Fixed bug.. on shrinkwrap_copyModifier 2008-06-23 15:48:03 +00:00
75e22a1917 BGE patch #14386: Action Actuator Current Frame Prop. This patch is very usefull for action feedback logic: a sensor on the property can be used to detect a certain moment in the action and trigger more stuff. The property must be on float type for best results 2008-06-23 15:32:44 +00:00
e426c7ce29 Added shrinkwrapModifier_isDisabled api function 2008-06-23 14:12:22 +00:00
cb6fd8927c An initializer line was missing from the beginning of a loop, causing crashes. 2008-06-23 07:59:26 +00:00
fcc377e204 [#13635] DirectX8Exporter with vertex colors
patch from Masaru Nemoto (mnemoto) 

Made some modifications to the patch, use reduce() to get total face verts and some speedup for face vcol looping, also don't write vcol alpha since its used by brushes internally and has no useful meaning.
2008-06-23 00:21:49 +00:00
7a55f52b1b Transform Snapping
Snap to edges and vertice without have to go through faces.

This means you can import floor plans and use the edges as snapping guides and other sort of fun things.

The bounding box test still needs padding though.
2008-06-22 23:21:29 +00:00
b22d3e615d Moving Line to Line intersection into arithb 2008-06-22 23:07:42 +00:00
484ac5ea1a [#14405] New python Script - Bake Constraints
AGAIN PLEAST USE TABS, lost quite some time with mixed tab/space adjustments alone.
Other then that, patch is very useful ;)

---Text from patch submission --- 
Using a slightly revised BPy_Armature, this script takes any non-armature object type and creates an Action that keys
the object location (by default, for every frame). If it is an Armature, it goes into each bone and keys the locrot
of the bone. You can now edit the armature, but the motions still rotate the bones. This enables the next step, re-targeting,
which changes bone lengths to fit a mesh. High-level, we are working toward:

1. import mocap (bvh or c3d)
2. bake to make an action library (using this script)
3. re-target and use the actions to drive/deform any character mesh (theeth)
2008-06-22 22:46:02 +00:00
9035253493 [#14392] C3D Import
c3d importer for motion capture data
This could do with some improvements but for now its acceptable.
- Note, could people please not mix tabs and spaces.


-Text copied from the patch submission-
The c3d_import with 2.46 was able to import a mocap cloud for some c3d files. I have improved it:
Version History:
 0.4: PERIN Released under Blender Artistic Licence
 0.5: WICKES used marker names, fixed 2.45 depricated call
 0.6: WICKES creates armature for each subject
 0.7: WICKES constrains armature to follow the empties (markers). Verified for shake hands s
 0.8: WICKES resolved DEC support issue

see also http://wiki.blender.org/index.php/Tutorials%5CMoCap-Section_3 for how this program gets the mocap data into
Blender and creates an armature, like the BVH script does.

I'd like someone to test and verify, and if accepted, replace the current c3d_import.py

--- See patch url for example files http://projects.blender.org/tracker/index.php?func=detail&aid=14392&group_id=9&atid=127
2008-06-22 21:48:02 +00:00
d229db61e9 == Sequencer ==
Renamed Filter-Y to De-Interlace and moved F-Key to D-Key.
(Also added file reload on D-Key)
2008-06-22 20:59:29 +00:00
dac3434b03 [#14398] In Object- and EditMode, global rotate manual input is different than mouse
The sign of the rotation angle was sometimes different between num input and mouse input.
2008-06-22 20:40:13 +00:00
abda1a9ec1 == FFMPEG ==
Added serious interlacing to movies opened using ffmpeg.
(Other video decoders to be done)

Rational: deinterlacing, if done seriously _has_ to be done
in YUV-space. Since internal interface first converts data
to RGB we are pretty much lost (and fall back to IMB_filtery
in that case).
2008-06-22 20:39:41 +00:00
381f15189d bugfix, Shift+H would hide unselected objects on unseen layers. 2008-06-22 19:34:18 +00:00
39a7a24838 Display graph in 3d view 2008-06-22 17:06:50 +00:00
63060128ec == Redcode ==
Doing image comparison revealed, that Kb = Kr = 0.0 for redcode :)
2008-06-22 15:48:12 +00:00
5372def2b0 BGE patch: add state engine support in the logic bricks.
This patch introduces a simple state engine system with the logic bricks. This system features full
backward compatibility, multiple active states, multiple state transitions, automatic disabling of 
sensor and actuators, full GUI support and selective display of sensors and actuators. 
Note: Python API is available but not documented yet. It will be added asap.

State internals
===============
The state system is object based. The current state mask is stored in the object as a 32 bit value; 
each bit set in the mask is an active state. The controllers have a state mask too but only one bit
can be set: a controller belongs to a single state. The game engine will only execute controllers 
that belong to active states. Sensors and actuators don't have a state mask but are effectively 
attached to states via their links to the controllers. Sensors and actuators can be connected to more
than one state. When a controller becomes inactive because of a state change, its links to sensors 
and actuators are temporarily broken (until the state becomes active again). If an actuator gets isolated, 
i.e all the links to controllers are broken, it is automatically disabled. If a sensor gets isolated, 
the game engine will stop calling it to save CPU. It will also reset the sensor internal state so that
it can react as if the game just started when it gets reconnected to an active controller. For example,
an Always sensor in no pulse mode that is connected to a single state (i.e connected to one or more 
controllers of a single state) will generate a pulse each time the state becomes active. This feature is 
not available on all sensors, see the notes below.

GUI
===
This system system is fully configurable through the GUI: the object state mask is visible under the
object bar in the controller's colum as an array of buttons just like the 3D view layer mask.
Click on a state bit to only display the controllers of that state. You can select more than one state
with SHIFT-click. The All button sets all the bits so that you can see all the controllers of the object. 
The Ini button sets the state mask back to the object default state. You can change the default state 
of object by first selecting the desired state mask and storing using the menu under the State button. 
If you define a default state mask, it will be loaded into the object state make when you load the blend
file or when you run the game under the blenderplayer. However, when you run the game under Blender, 
the current selected state mask will be used as the startup state for the object. This allows you to test
specific state during the game design.

The controller display the state they belong to with a new button in the controller header. When you add
a new controller, it is added by default in the lowest enabled state. You can change the controller state 
by clicking on the button and selecting another state. If more than one state is enabled in the object
state mask, controllers are grouped by state for more readibility. 

The new Sta button in the sensor and actuator column header allows you to display only the sensors and 
actuators that are linked to visible controllers.

A new state actuator is available to modify the state during the game. It defines a bit mask and 
the operation to apply on the current object state mask:

Cpy: the bit mask is copied to the object state mask.
Add: the bits that set in the bit mask will be turned on in the object state mask.
Sub: the bits that set in the bit mask will be turned off in the object state mask.
Inv: the bits that set in the bit mask will be inverted in the objecyy state mask.

Notes
=====
- Although states have no name, a simply convention consists in using the name of the first controller 
  of the state as the state name. The GUI will support that convention by displaying as a hint the name
  of the first controller of the state when you move the mouse over a state bit of the object state mask
  or of the state actuator bit mask.
- Each object has a state mask and each object can have a state engine but if several objects are 
  part of a logical group, it is recommended to put the state engine only in the main object and to
  link the controllers of that object to the sensors and actuators of the different objects.
- When loading an old blend file, the state mask of all objects and controllers are initialized to 1 
  so that all the controllers belong to this single state. This ensures backward compatibility with 
  existing game.
- When the state actuator is activated at the same time as other actuators, these actuators are 
  guaranteed to execute before being eventually disabled due to the state change. This is useful for
  example to send a message or update a property at the time of changing the state.
- Sensors that depend on underlying resource won't reset fully when they are isolated. By the time they
  are acticated again, they will behave as follow:
  * keyboard sensor: keys already pressed won't be detected. The keyboard sensor is only sensitive 
    to new key press.
  * collision sensor: objects already colliding won't be detected. Only new collisions are 
    detected.
  * near and radar sensor: same as collision sensor.
2008-06-22 14:23:57 +00:00
1ee7a20b93 Compiler warning fixes (part 1 or 2) 2008-06-22 01:56:11 +00:00
86d227367b Bugfix:
Update-automatically option in IPO-Editor now updates objects using the active IPO-block as their ObAction when transforming keyframes.
2008-06-22 01:31:29 +00:00
ffbe42129e svn merge -r 15202:15292 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-06-20 21:36:15 +00:00
824eac5095 Added cut-plane option.
Its now possible to project 2 planes over a model and get a cloth..
Tought it still has a few issues.. related with distance to kept from mesh.
2008-06-20 21:10:16 +00:00
a1e78a0cca * Documented that get/setOrientation use an inverted rotation matrix
* OB prefix is needed when specifying the object for the Message Actuator, this is very bad since other object fields in the BGE dont need this prefix - a real fix would need do_versions to keep old files running.
* RotationMatrix was all nans if the rotation vector axis was 0,0,0, Changed so in this case just return a matrix that doesn't rotate anything,

spent some angry hours to find these issues, maybe this will save others the hassle ;)
2008-06-20 20:54:29 +00:00
b5bde6d4dc More params for reeb graph visualizer 2008-06-20 18:06:41 +00:00
de7619991c BGE bug fix for new shape action: mesh with multiple materials did not deform properly 2008-06-19 14:40:46 +00:00
d6c8d2f701 Just make gcc compiler happy (stupid harmless warning) 2008-06-19 13:41:06 +00:00
df8a3882c6 BGE patch #13625: getLinearVelocity() rewrite to use only vector and matrix operations 2008-06-18 21:22:17 +00:00
Chris Want
fd8e873e01 == VRML97 exporter ==
Faulty indentation of a line sometimes caused a bunch of empty lines to
be printed into the TextureCoordinate and texCoodIndex fields
(benign error, just ugly).
2008-06-18 21:16:29 +00:00
Chris Want
4ed60f4575 == VRML97 export ==
Don't export vertex colors if a mesh doesn't have any (even if a
texface has 'shared cols' set).
2008-06-18 19:58:05 +00:00
Chris Want
1c1f81914c == VRML97 export ==
Patch #10569 from Michalis Kamburelis (sorry for the delay).

This patch adds a popup menu that lets the user choose whether
they want to export selected, whether thay wanted to export
compressed, and whether they want to export the file from
blender's "Z up" coordinates to VRML's "Y up".

I'm not too crazy about the caching to disk of these options
via GetRegistry/SetRegistry, but since this seems to occur
in many of the other export scripts I'll leave it as is.
2008-06-18 17:13:33 +00:00
55433f51d8 Patch #8882 - Falloff in the wave modifier
This patch adds the ability to specify a falloff radius in the Wave modifier.
Currently only linear falloff is supported.

Thanks to Michael Fox for the patch!
2008-06-18 15:22:42 +00:00
3f488f4d70 * Fix for a crash in game engine vertex array drawing with texfaces.
* For 2D filters, don't require opengl 2.0 but just the extensions,
  so it works on computers without full 2.0 support too.
* In debug mode, don't print memory statistics for preview render.
2008-06-18 10:30:14 +00:00
5cd4b6ac90 Small fix to be able to compile Blender. 2008-06-18 09:52:31 +00:00
d39154bb50 bugfix, BGE, use vec.safe_normalized() rather then vec.normalized() because in some cases the ray_cast sensor could crash blender. 2008-06-18 09:06:51 +00:00
48c7c9d957 Forgot to set Id property on new shape action files 2008-06-18 07:03:47 +00:00
2bece8dcb5 BGE Patch: Add Shape Action support and update MSCV_7 project file for glew.
Shape Action are now supported in the BGE. A new type of actuator "Shape Action" is available on mesh objects. It can be combined with Action actuator on parent armature. Only relative keys are supported. All the usual action options are available: type, blending, priority, Python API. Only actions with shape channels should be specified of course, otherwise the actuator has no effect. Shape action will still work after a mesh replacement provided that the new mesh has compatible shape keys.
2008-06-18 06:46:49 +00:00
b4c123c275 [#14400] Crash on grab/move on axis when nothing selected (patch included)
I used a different fix than the included patch, but that was a pretty nasty crasher (only crash on menu/toolbox, not hotkeys).
2008-06-17 21:17:11 +00:00
42eed50935 Distance parameter for retargeting. Keeps bones close to the embedding (pretty much the same thing as the correlation/distance parameter when generating).
This is very slow though, the naive approach to optimising the solution is starting to take its toll.
2008-06-17 21:00:06 +00:00
05ce388f35 Added functions to the BPy Text object for positioning the cursor and inserting text. It seems Text.write() actually inserts *then* moves to the end of the buffer, so it doesn't really append as it says in the docs. However, with these new functions both appending and inserting can be achieved. 2008-06-17 19:26:26 +00:00
91f8ad8398 Added merge option to shrinkwrap when using projection mode (bruteforce for now)
Changed code to remove faces (now quad faces that got one vertice projected are turned on tri)

Merge option is still not very usefull since shrinkwrap does not yet moves unprojected vertices
2008-06-17 19:00:21 +00:00
272a91f754 Merge of apricot branch game engine changes into trunk, excluding GLSL.
GLEW
====

Added the GLEW opengl extension library into extern/, always compiled
into Blender now. This is much nicer than doing this kind of extension
management manually, and will be used in the game engine, for GLSL, and
other opengl extensions.

* According to the GLEW website it works on Windows, Linux, Mac OS X,
  FreeBSD, Irix, and Solaris. There might still be platform specific
  issues due to this commit, so let me know and I'll look into it.
* This means also that all extensions will now always be compiled in,
  regardless of the glext.h on the platform where compilation happens.

Game Engine
===========

Refactoring of the use of opengl extensions and other drawing code
in the game engine, and cleaning up some hacks related to GLSL
integration. These changes will be merged into trunk too after this.

The game engine graphics demos & apricot level survived my tests,
but this could use some good testing of course.

For users: please test with the options "Generate Display Lists" and
"Vertex Arrays" enabled, these should be the fastest and are supposed
to be "unreliable", but if that's the case that's probably due to bugs
that can be fixed.

* The game engine now also uses GLEW for extensions, replacing the
  custom opengl extensions code that was there. Removes a lot of
  #ifdef's, but the runtime checks stay of course.
* Removed the WITHOUT_GLEXT environment variable. This was added to
  work around a specific bug and only disabled multitexturing anyway.
  It might also have caused a slowdown since it was retrieving the
  environment variable for every vertex in immediate mode (bug #13680).

* Refactored the code to allow drawing skinned meshes with vertex
  arrays too, removing some specific immediate mode drawing functions
  for this that only did extra normal calculation. Now it always splits
  vertices of flat faces instead.
* Refactored normal recalculation with some minor optimizations,
  required for the above change.
* Removed some outdated code behind the __NLA_OLDDEFORM #ifdef.
* Fixed various bugs in setting of multitexture coordinates and vertex
  attributes for vertex arrays. These were not being enabled/disabled
  correct according to the opengl spec, leading to crashes. Also tangent
  attributes used an immediate mode call for vertex arrays, which can't
  work.
* Fixed use of uninitialized variable in RAS_TexVert.
* Exporting skinned meshes was doing O(n^2) lookups for vertices and
  deform weights, now uses same trick as regular meshes.
2008-06-17 10:27:34 +00:00
c9d1924ea5 Use the scenes framerate for ipo and action framerate in the game engine, was hard coded to 25. 2008-06-17 10:06:38 +00:00
4c391a0c30 * Simple addition to math node (comp and shading): Greater Than and Less Than modes. 2008-06-17 04:18:34 +00:00
6be46f9ee3 [#11456] New datablock type(s) added to Oops Schematic
patch from Shawn Zilbert (enigmatic)

This patch adds the camera data block type to the oops schematic view of the outliner. It also includes a little bit of code cleanup in the oops files.
2008-06-16 19:54:43 +00:00
bb539ce1b5 Snapping
Snap to cage only in edit mode (respect the edit cage flag of modifiers).

Especially important for subsurf, otherwise, Andy's automerge + snap video doesn't work in current SVN.
2008-06-16 16:48:09 +00:00
1e3bdcf198 bugfix from Markus Ilmola (glome)
patch was in [#8540] Import scripts for MilkShape3D file formats

Some animations were incorrectly imported and this adds support for weights.
2008-06-16 14:08:24 +00:00
9b69c56917 Material color was always overriding OBCOL for blender text. 2008-06-16 09:16:04 +00:00
f445dfbfb6 Patch [#13777]
This commit fix the following problem in the DPX code:

1) The code always assume a depth of 10 bits
2) The code don't check the file type (Log or Linear)
2008-06-16 07:15:09 +00:00
Maxime Curioni
dfa10eba19 soc-2008-mxcurioni: Freestyle now supports camera information (the image is still a bit larger than Blender's internal renderer, probably a field of view problem). 3d scene is now no longer rendered, only 2d scene (strokes from view map information) is. Style module is still static (contour.py), will soon be handled via independent UI panel.
Phase 1 is considered finished. Phase 2 starts now: the objective is integrating Freestyle as an independent render layer.
2008-06-16 00:51:19 +00:00
ad023e108a [#13691] apricot Snap didn’t work correct in svn
1. Updated selected restriction to not be so stingy. Snapping on edges and vertices work if they are part of a partially moving face

2. Change depth ordering (which didn't work all the time). Hits are sorted according to 2D distance and then depth, so for overlapping hits, it picks the one in front.
2008-06-15 17:54:42 +00:00
eb9c4de83f Patch [#13668] Tool tip correction
By Olivier Saraja
2008-06-15 14:22:12 +00:00
a54edca119 Whitespace commit in armature.c 2008-06-15 10:19:38 +00:00
f63b70635c bugfix, clip alpha wasn't working in the GE, not happy with these functions, they probably need bigger changes not to assume all alpha requires face sorting with a disabled depth buffer, 2008-06-15 09:43:24 +00:00
c76bce9e64 bugfix, simple crash in drawaction 2008-06-15 08:56:11 +00:00
89c1875bc9 BGE patch: support Set Scene in BGE. Linked Set Scene should have no name conflict in Object, Object data and Action of the main scene to avoid confusion in Python scripting. Nested Set Scene are supported. You will need Python scripting to create cross references between objects in the main scene and the Set (e.g TrackTo actuator) 2008-06-14 20:42:15 +00:00
13d081c62c fix for ndof inconsistencies, bug #13954
patch provided by Ettore Pasquini
2008-06-14 18:57:42 +00:00
fc7a83b458 Added access for adjusting timeOffset value at runtime, used for apricot (Franky climbing walls) 2008-06-14 17:12:49 +00:00
9c2bf9bdbc bugfix for memory corruption caused by BLI_cleanup_file on paths that went too far back.
/a/b/../../../ - problematic
/a/b/c/../../../ - ok
Also got rid of warnings in shadbuf.c with GET_INT_FROM_POINTER
2008-06-14 16:54:46 +00:00
714c6d5010 Bugfix:
Campbell's recent commit to fix game-engine pose/ipo corruption was causing segfaults with duplicating armatures.
2008-06-14 03:00:38 +00:00
Maxime Curioni
d8171e4bc6 soc-2008-mxcurioni: removed static dependencies (formerly fixed in app_blender/test_config.h). From now on, to use the branch, one needs to define a FREESTYLE_BLENDER_DIR environment variable to point to the Freestyle directory source/blender/freestyle 2008-06-13 22:23:24 +00:00
512019c6f2 First draft for gradient descent optimization for aggressive retargetting (results no go) 2008-06-13 21:07:46 +00:00
8bd82d4e36 Some pose action ipo corruptions when using BGE, added some debug printf's when copying to/from the same pose since it should never happen. 2008-06-13 02:20:09 +00:00
21c2613622 Update MSVC project files 2008-06-12 21:17:02 +00:00
1e7f1f753f When your home directory is full, saving defaults would fail without raising an error.
checked all others instances of BLO_write_file give errors too.
When autosave fails it reports an error in the console so its not too annoying.
2008-06-12 16:29:00 +00:00
7ffd70f39a Patch #8613 - Vertex groups in the mirror modifier.
This patch re-assigns the mirrored data to use vertex groups with "mirrored"
names (e.g. L_arm -> R_arm, Leg.R -> Leg.L etc.). Vertex groups with the
"mirrored" names must already exist in the base mesh.

This means that it is no longer necessary to apply the mirror modifier in order
to rig the mirrored data independently.

Thanks to Michael Fox for the patch!
2008-06-12 15:43:55 +00:00
1091db8f9b didnt name the smooth curve menu item. 2008-06-12 15:00:07 +00:00
82a108b413 Curve Smoorth for venomgfx adjusting animation paths over terrain. 2008-06-12 14:46:32 +00:00
39d35edbe6 Merge from trunk
svn merge -r 15104:15202 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-06-11 22:53:52 +00:00
b5432c6780 Added sample "CreatePlane" .. it simple projects a grid over the selected image and determines which squares are to be used. 2008-06-11 22:35:27 +00:00
39a47826e3 Fix for commit revision 15197, missing braces caused some shortcut
keys not to work anymore.
2008-06-11 20:15:47 +00:00
21a46a0155 bugfix
- duplicated script spaces would keep a pointer to the PyObject button list. (causing python errors with negative reference counts when freeing spaces)
- Exiting blender would crash when a UI was open because the ScriptSpaces button PyList was being free'd after python Py_Finalize was called.
2008-06-11 14:31:51 +00:00
d0fc57e5df [#13723] Select -> Grouped -> Objects in Same Group doesn't work directly after appending
Menu was shown even when it couldn't do anything. behavior now matches the object copy menu.
2008-06-11 10:45:41 +00:00
ef0ea178b1 bugfix, off by 1 error when filling in uninitialized values for new ID values when the requested name length was greater to or equal to 21.
Also replaced incorrect use of strcpy with memmove since the strings overlap
2008-06-11 09:04:41 +00:00
bdb3ef08cf Increased new nla, sound, action, ipo, timeline spaces max zoomlevel to use MAXFRAMEF, so you can view an entire animation ans so all time spaces have the same maximum which is important when the views lock to each others zoomlevel.
Not ideal since it only affects newly created spaces, but probably not worth going through doversions since it wont effect many blender users.
2008-06-11 05:25:52 +00:00
dce7e07001 Skeleton generation
Add option to select bone placement on embedding (following last commit).

Add option for distance to embedding adaptive subdivide (for comparison with correlation based method)
2008-06-10 21:15:48 +00:00
d086126616 -> Stack corruption in viewline in viw.c
viewline() would write past the end of an array
allocated on the stack causing crashes. Fixed this.

Martin, could you take a look at this?
2008-06-10 16:18:45 +00:00
48bf0ef2ed Improvements to whole-word ops (thanks mindrones for suggestions). 2008-06-10 15:25:05 +00:00
70453c9e80 bugfix, missing calls to free editmesh index arrays 2008-06-10 10:26:13 +00:00
f72d450ae9 == redcode ==
This makes it work for Mac OS X. Thanks to Jean-Luc Peuriere for the patch.
2008-06-10 05:12:51 +00:00
192037960d error in variable name, not sure how this even compiled 2008-06-09 22:54:56 +00:00
fd1faa5542 Merge from Apricot Revisions 14897, 14913, 14914, 14915, 14929, 15009, 15046
---------------------------------------------------
Snappy stuff

* Align rotation with snapping target: rotate the object, aligning it with the target (object mode only - temporarily) (New icon in the header when snap is turned on)

* Snap to different mesh elements (face, edge, vertice): snapping target slide on faces and edge or use exact position of vertice. When using Align rotation with edge snapping, the normal is interpolated as you slide along.

Snaps correctly to derived mesh (sculpt, modifiers, ...) and duplis. In object and edit mode.

NOTE: The snapping code is now based on faces, so even if you're snapping to vertices or edges, it will not work on meshes without faces. This might change if needed.
2008-06-09 18:41:16 +00:00
8c68895741 Revision 14869 merged from apricot
----------------------------------
Centralize handling of individual center for rotations
2008-06-09 18:07:12 +00:00
d5c80a3a1b Revision 14929 partial merged from apricot
(partial because I'll merge all snap code in one fell swoop after the libs are done)
----------------------------------
object: ray - boundbox intersection test
2008-06-09 17:50:21 +00:00
ccc78eebde Revision 15045 merged from apricot
----------------------------------
Small fix to derivedmesh for snapping: don't create origindex for
editmesh derivedmesh since it's not being filled correct anyway.
2008-06-09 17:22:38 +00:00
ac0a91920a Revision 14894 merged from apricot
----------------------------------
Arith:
	- axis angle to quat conversion function
	- short to float / float to short normals conversion function (eventually, we could go over the go and replace copy/pasted code everywhere)
	- ray triangle intersection (to complement the line triangle intersection function)
	
View:
	- viewray / viewline (get near plane point under mouse and ray normal/far point)


Particles:
	- extract viewline from brush_add function
2008-06-09 17:16:20 +00:00
83af2c1757 PATCH: [#13656] Bad rotation computing for manual rotation higher than 180 degrees
By Fabrice Tiercelin

This enables rotation angles of more than 180 degrees to result in the same rotation applied to the object (the result used to be clamps between -180 - 180 of the initial rotation).

The patch had to be modified to deal with IPO keys properly
2008-06-09 16:54:54 +00:00
4e2bb896b0 Added back a feature from the old particle system: negative start frame.
At the moment this does mean it will compute all the frames before the
point caching start frame on the first frame, which might be slow.
2008-06-09 16:49:33 +00:00
f39758cddc adding clip alpha (binary alpha) to the 3D view and game engine. 2008-06-09 15:45:46 +00:00
10d59e7208 Merged from trunk
svn merge -r14988:15170 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-06-09 14:04:19 +00:00
7fd8c2424f Fix: Convert to spaces/tabs corrupted syntax 2008-06-09 12:45:49 +00:00
610b877f60 ctrl+LMB drag would add an ipo vert AND zoom in ipo view.
checked revisions 7915 and 10663, it seems this functionality was accidental.
2008-06-09 12:13:51 +00:00
57d83522a2 Fix for bug #13627: bFTGL sconscript missing opengl includes, didn't
compile with non-standard paths.
2008-06-09 10:03:30 +00:00
Maxime Curioni
07001e708e soc-2008-mxcurioni: merged changes to revision 15163 2008-06-08 20:12:29 +00:00
Maxime Curioni
062fb01614 soc-2008-mxcurioni: now supports current scene drawing (instead of fixed scene object), still with fixed style and fixed camera. Initialization is properly handled, which limits memory problems and speed-ups subsequent rendering. The viewing ratio should be correct now too. I also removed linking references to former lib3ds library path (caused some linking problems). 2008-06-08 19:35:20 +00:00
39a6807348 Prevent editing of linked library Texts 2008-06-08 19:29:19 +00:00
71573cbd55 Bugfix #13666:
Missing #include <stdio.h> in source/gameengine/Ketsji/KX_RayCast.cpp
2008-06-08 10:48:37 +00:00
cee9c7a8fa Bugfix #13667: Outliner doesn't update when changing Parent in Transform Properties
There was a missing refresh call for the Outliner.
2008-06-08 10:46:30 +00:00
08f9bcf8ec Bugfix #13649: Segmentation fault when deleting object
When the IPO editor was pinned, and the active object was changed, deleting the active object would cause a crash.
2008-06-08 09:35:05 +00:00
7e095fa695 Another minor typo fix in button naming 2008-06-08 03:39:24 +00:00
96808303c0 Fix for incorrect tooltip (provided by JMS va bf-committers) 2008-06-08 02:59:14 +00:00
a2192ffa09 made the quad split-direction options force splitting since planer quads with UV distortion would get very different results depending on the split direction. 2008-06-07 22:44:18 +00:00
12461cde17 error in customdata editmesh function,
was using the active index when it should use the first index, not a big deal since CustomData_em_get_n isnt used in trunk yet.
2008-06-07 18:16:23 +00:00
cdd461f488 March 22 commit from Campbell to allow Lasso select in Compositor
with CTRL+LMB disabled the recently before added option to make 
a Viewer connected to a node using same hotkey.

Now both work!
2008-06-07 15:06:00 +00:00
12f5a0a228 Added file info to header. Also reopen was marking text dirty (different from disk) which it isn't. 2008-06-06 11:32:45 +00:00
b62955cf3e bugfix, memory leaks when getting particles and particle system loc/size/rot/life (Just remember PyList_Append adds a reference! :) ) 2008-06-06 11:00:32 +00:00
14393c9ffb bugfix - Blender.GetPaths() was returning relative paths from libraries, but with no way to access the library path the the file is relative too. Check for these cases and make them absolute.
bpath also assigned one var it didnt need to.
2008-06-06 08:58:08 +00:00
6ffadbfb10 fix 2dfilter problem on AMD64, Patches item #13626 2008-06-06 01:28:51 +00:00
49abcc980c Added shadow baking 2008-06-05 22:07:59 +00:00
f2407fec55 Apricot feature, thats fit for trunk.
Baking would split non-planer quads in an unpredictable way, which is fine for rending but game engines often use a fixed order (0,1,2), (0,2,3) or (1,2,3) (1,3,0).
Added an option to use a fixed order when baking.
2008-06-05 18:26:34 +00:00
172fe6ed2f Bugfix: [#13619] Transform Rotate and Scale Strange
view: noclip version of int and float projection. Also project from behind the view's position and return coherent values for near clipping

transform: use the above functions for 2d center and helpline drawing

NOTE: the result for centers behind the camera (in perspective) isn't 100% perfect in the case of rotations because they always use the centered view vector as rotation axis and not the one aligned with the 2d center. Changing this would not be desirable anyway. At least it's predictible now.
2008-06-05 14:49:12 +00:00
6757b759ea added checks for zero length strings when checking for the last character 2008-06-05 13:12:17 +00:00
f35289574a BLI_kdopbvh: crashed when traversing with little faces 2008-06-05 13:02:17 +00:00
4f601b478c * python sys.cleanpath() used strstr incorrectly, resulting in paths containing a slash, always returning a path that ends with a slash.
* python Blender.GetPaths() - absolute=0 wasnt working
* BLI_cleanup_file and BLI_cleanup_file were treating the // prefix as a duplicate path, now ignores //
* BLI_convertstringcode was removing the trailing slash from a path
(tested these path functions didnt mess up with some of the peach files and with pointcache)
2008-06-05 13:02:00 +00:00
cc0d730923 import_dxf.py script update: ver. 1.0.12b3-2008.06.05
bugfix: ob.name conflict with existing meshes (different ob.name/mesh.name)
refactor/support for LWPOLYLINEs
2008-06-05 12:31:16 +00:00
fcdbd76625 Collisions: enabling self collision quality setting again (request by Nudel) 2008-06-05 11:08:51 +00:00
3d51c59034 Bugfix for exploding cloth collisions 2008-06-05 10:52:52 +00:00
ded6a1c2e7 bugfix introduced in own commit 15055 - [#13621] Cloth cache files are in same directory as .blend 2008-06-05 10:43:53 +00:00
a68975f4e1 Whole word operations added:
* Alt-Left/Right: moves cursor/selection a word to the left/right
 * Alt-/Ctrl-Delete/Backspace deletes whole words at a time
2008-06-04 23:20:54 +00:00
c8e19a6b25 numbutton python expression evaluation used driver dictionary, when EnableScriptlinks was disabled number
button input didnt 
work. narrow down this test to the part of the pydriver module init that uses a blender textblock as a module. This should 
should reload the pydriver dict whenever the "EnableScriptlinks" state changes. but for now working numbuttons is priority.
2008-06-04 22:32:15 +00:00
fbb56ee997 Issue jms was having with # else on msvc. Seems odd but easy to fix.
Kent
2008-06-04 18:11:48 +00:00
61193cf230 svn merge -r15118:15119 https://svn.blender.org/svnroot/bf-blender/branches/soc-2008-quorn 2008-06-04 16:38:55 +00:00
e26323bcdd Python API object.parentVertexIndex - access vertex parent indicies 2008-06-04 16:19:15 +00:00
ec4b6ba3f3 Fixed unreported bug: Backspace at top of text pushed newline onto undo stack 2008-06-04 16:03:19 +00:00
2dcab87383 Overwrite mode added, toggled with INSERTKEY 2008-06-04 12:32:06 +00:00
d565e8a02f bugfix #13618 - 2d filters + GLSL python scripts 2008-06-04 02:54:42 +00:00
772d241582 Fix BGE bug #13605: GameEngine corrupts Pose data 2008-06-03 22:54:24 +00:00
a39c8de24b Reason of last commits kdopbvh tree is now on trunk.
Added those files to the branch and added code for NearestNeighbour, needed for shrinkwrap
2008-06-03 19:56:19 +00:00
7265e9e855 Merge from trunk
svn merge -r 15064:15104 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-06-03 19:27:46 +00:00
db650f1be9 Removed BLI_kdopbvh 2008-06-03 19:20:57 +00:00
0c0c43f620 Collision commit code cleanup for nicer compile 2008-06-03 19:06:54 +00:00
c84c0201e1 Collisions: Commit of collision cleanup, put kdop-bvh structure into BLI_kdopbvh (just like kdtree interface now), huge speedup for selfcollisions, also better normal collisions (merge from cloth branch) 2008-06-03 18:48:54 +00:00
d6d4382396 Fix mem leak in graph rem doubles 2008-06-03 16:43:07 +00:00
62ca0e07da A few compiler warning fixes. Those in BME_customdata.c were more serious. 2008-06-03 10:04:42 +00:00
29f839b4a5 Bugfix #13603:
Action Editor Copy/Paste didn't trigger a depsgraph update for the active object (if the action was applied to it).
2008-06-03 10:00:09 +00:00
6eeef64370 == REDCODE ==
got #endif position wrong, breaking compile without redcode, sorry.
(Thanks to jms for pointing that out)
2008-06-03 06:42:13 +00:00
510d4b22ec increase the level you can zoom out (andy's timelapse videos were a pain to edit) 2008-06-03 01:01:47 +00:00
cfd67321d2 == REDCODE ==
Forgot to free redcontext in IMB_free_anim...
2008-06-02 22:02:26 +00:00
6be7bb5e03 == redcode ==
Disabled by default now on all platforms besides Linux.
2008-06-02 21:39:45 +00:00
ca8aa8c901 == RED one (redcode) ==
This adds redcode (the file format of RED one, R3D) support to blender.
Seems to work fine with the footage I found on the web, but keep in
mind, that because of the unoptimized nature of libopenjpeg, frame
decoding isn't that fast.

It is also a rather challenging task, to make 4k-float-footage realtime :)
2008-06-02 21:35:57 +00:00
8a5f362192 -> More Bmesh Custom Data stuff
Some more Bmesh custom data functions and
structures. This still does not do anything
yet because the various conversion functions
don't bother making use of the new custom data
functions. Hooking them up should be fairly
simple though.

Also note that the custom data code is mostly
copy/pasted from the existing custom data
functions for editmode with a few modifications.
Duplicating code like this isn't nice, but I
felt it was better to keep things for Bmesh
'standalone' for the moment and take only what is
immediatly needed instead of creating
a tangle of interdependant code.
2008-06-02 20:52:40 +00:00
1cc61f633f Patch #11000 approved: [new function] KX_GameObject::alignAxisToVect() Align an object's axis to a given vector 2008-06-02 17:31:05 +00:00
8a2a91ddfe Added missing newline for error print in Py-button expressions 2008-06-02 02:54:33 +00:00
86a0afb829 Compiler warning fixes (unused vars).
Notes:
- edgehash.c still has some weirdo code causing warnings on lines 80 and 117
i.e.  if (v1<v0) v0 ^= v1 ^= v0 ^= v1;
- material.c (in pyapi) apparently doesn't seem to be making use of some functions for glossy stuff
2008-06-02 01:02:08 +00:00
85e77e53ef -> Fix for last few commits
New memory allocator broke compilation on
GCC/Linux. Fixed
2008-06-01 18:43:22 +00:00
33321d13d3 -> Beginning of Custom Data support for BMesh
Now that new allocator is in place, Custom Data
can be effeciently added to BMesh. The plan is to
make all data not directly related to topology
Custom Data and allow callers to decide precisely
what information a mesh should have in order to
make the best tradeoff between memory usage/speed.

Right now not much to look at, just some structure
definitions and commented out code. More to come
soon...
2008-06-01 18:02:29 +00:00
07b1608fbe -> New memory allocator for Bmesh
Added a new pooling allocator for Bmesh based upon
the pool allocator availible in the Boost C++ library
as described here:

http://www.boost.org/doc/libs/1_34_0/libs/pool/doc/concepts.html

Each pool allocates elements of a fixed size, so every
element type in a mesh gets its own pool. For instance
verts occupy a different pool than edges. Each pool
is comprised of multiple arrays of a fixed size and allocating
/freeing elements is simple as removing or adding a head 
to a linked list. Since the list of free elements is interleaved
throughout the unused space in the arrays, the overhead
for storing the free list is only 1 pointer total per pool.
	
This makes building/destroying bmesh structures much faster
and saves quite a bit of memory as well.
2008-06-01 17:15:03 +00:00
652ee1e31b functionality fix
Originally the only way to run scripts automatically was with scriptlinks, which could be disabled for loading untrusted blend files.
Since then PyDrivers and PyConstraints would run even when G.f&G_DOSCRIPTLINKS was disabled.
Gensher, Theeth and Ianwill agree its acceptable to reuse the flag for other areas python runs automatically.

PyNodes still have no way to be disabled, (todo before 2.46a)
2008-06-01 16:13:04 +00:00
8937989a91 == FFMPEG ==
Shouldn't crash any more in the case that
a) invalid video options were selected
and
b) audio multiplexing was active

[#13311] video_stream NULL when writing ffmpeg

(did'nt crash for me though, but added extra protection :) )
2008-06-01 14:37:09 +00:00
c0199e192d bugfix (typo) [#13587] Python API Material.sssFront broken 2008-06-01 13:18:26 +00:00
26cb5fa0db -Fix for bug #13067
Bevel tool was hanging on certain geometry where the edge
to be beveled was shared by two faces that had more than
one edge in common and caller was not checking return
status of Bmesh eulers. Fixed.
2008-06-01 01:56:35 +00:00
edd2b6ca73 bugfix for own error
[#13588] Python API Material.sssRadiusBlue broken
2008-06-01 01:49:11 +00:00
74903b77f4 Merging revisions 15020-15073 of https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-05-31 21:23:57 +00:00
526d9cc5fc bugfix for own error
glitch when typing in / would ask the user to make a new directory. the last shash was being removed, then the "" path didnt exist and 
asked to create it.
2008-05-31 19:08:12 +00:00
c6528b3cd4 bufgfix for [#13584] SIGSEV in fluid bake with large amount of small fluid objects
the maximum number of objects (255) wasnt being checked, added a check before baking.
also changed bakeing to use G.scene->base rather then G.main->objects since these can be in other scenes, from linked 
groups, or used only by python so they should not be used for baking. it also meant having a domain in 2 scenes would fail with an error.

Nils, could be good to have a dynamic number of bakeable objects.
2008-05-31 19:01:14 +00:00
6d0ac5095f Alternative method for correletation based skeleton subdivision (where bone end points can deviate from embedding).
Disabled because too unstable
2008-05-31 18:52:23 +00:00
32de0da6df bugfix
* [#13394] Sequencer: if internal strips have handles selected, dragging the metastrip changes the meta length
* Extend did not work correctly on metastrips when the nested seq's are out of the meta's frame range, added an argument to seq_tx_get_final_left/right 
that returns the frame clipped by metastrip(s) if any.
2008-05-31 16:22:07 +00:00
57270125d8 bugfix for own error, introduced when running scripts were saved with the blend file.
a script error with a script that has an interface would not stop the interface from running again immediately, causing an annoying 
error message loop.
2008-05-31 12:12:03 +00:00
7f3928652e Added culling on normal projection.
Now renderdemon is happy ;)
and now shrinkwrap can be used for bulging :)
2008-05-31 01:25:24 +00:00
318606addf Merge from trunk
svn merge  -r 14954:15064 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-05-30 20:33:33 +00:00
5c1acc5ced == PyNodes ==
Bug #13277, reported by Juho (bebraw) Vepsalainen (thanks!) - a typo made pynodes w/o input socket definitions fail with an out of range error when accessing the output sockets in the script.
2008-05-30 20:04:52 +00:00
791510f690 This is patch [#9057] Updated doc string to match current defines
also submitted by gsr

It just updates a comment to correct values.

Kent
2008-05-30 19:52:42 +00:00
0caf1573d5 This is patch [#9053] More concrete makesdna reporting
Submitted by gsr

It just makes the printf's all different so you can tell where the problem
is.

Kent
2008-05-30 19:46:48 +00:00
42740a1442 More and less debug prints
Also, setting the merge limit to be non-zero for armature graphs (since very small yet non-zero differences would prevent merges and correct graph creation)
2008-05-30 18:13:43 +00:00
08750f66a4 Retargetting
More refined symmetry grouping (can take care of tails properly) and better matching between symmetry groups (based on relative length of arcs)
2008-05-30 17:42:02 +00:00
2eb897e6db Fix crash with hidden bezier handles
See Cambo, that's why we have module owners.
2008-05-30 09:05:09 +00:00
da2d4904af bugfix
* scene.object.context and scene.object.selected had broken get_item 
funcs so scene.object.context[i]  returned the wrong object.
* aligning the view to an object (numpad*key), did not disable the 
ortho view grid.
* long standing problem where opening a relative image would fail with 
no message. BLI_convertstringcode was returning a path with /../../'s 
that need to be cleaned before the path could be read, the path was also 
invalid from unix shell so its not a blender path reading problem.
2008-05-30 01:59:15 +00:00
6af06ecdd2 Reverted win installer to give 'current user' option only for Application Data.
Added shfolder.lib linking for win9x SHGetFolderPath() support.
2008-05-29 21:12:11 +00:00
8e46d777f3 Transform Orientations
Edit Bone and Pose Bone can now be used as transform orientations

Also fix a bug with CTO comming from non-uniformally scaled meshes.
2008-05-29 19:10:09 +00:00
f1d54f892b -= Collisions =-
Getting some weird results on moving fast edges. This is a backup commit, will try another thing
2008-05-29 14:23:08 +00:00
Maxime Curioni
be2b832db7 soc-mx-curioni: resolved the rendering issue. In the previous steps, I was only rendering the strokes, not the toatl scene (explaining why the render color was being inverted). i added a call to the view's draw() method. Now, the rendering steps are complete and display both the object and the silhouette. 2008-05-29 11:41:06 +00:00
Maxime Curioni
f3966dda4e soc-2008-mxcurioni: made the image rendering faster by reading the frame buffer directly into the RenderResult's ImBuf structure, removing the need to copy it manually 2008-05-29 09:00:49 +00:00
fe7b591280 Another bugfix for Fill Bone Between Joints. Changed the order that bones are created between 'head'/'tail' points 2008-05-29 06:14:53 +00:00
Maxime Curioni
4b7174a6dd soc-2008-mxcurioni: updated SConscript file for SWIG module compilation and linking under Linux 2008-05-29 02:31:36 +00:00
e015796b36 Fill Bone Between Joints:
This tool now parents the newly created bone to whichever bone acted as it's 'head' point. It also sets the connected-to-parent flag.
2008-05-29 01:04:12 +00:00
Maxime Curioni
9a6302e109 soc-2008-mxcurioni: First render ! It should render the teapot upside down on a black background. The correction was made by following Yafray's rendering and display implementation, which is very clear. 2008-05-29 00:27:09 +00:00
a17f322dd0 Bug fix: [#13268] Crash when creating a new particle system
-Ugh.. sorry about that.. damn default cube with it's default material!
2008-05-28 23:38:40 +00:00
Maxime Curioni
9986b5cd73 soc-2008-mxcurioni: corrected GLStrokeRender::preparePaper function for paper texture loading. The canvas view now has its frame properly initialized to fixed dimensions. When the Freestyle render is executed, the render is displayed for a fraction of a second and is then erased by a standard gray background. I have to analyze what command I need to call to keep the result on display. 2008-05-28 21:19:56 +00:00
1a5181c9c7 bugfix for own bug. mousewheel while playing in the sequencer crashes blender. 2008-05-28 21:15:40 +00:00
04067c1833 Fix for bug #13224: vertex parenting didn't work correct with
multiple unconnected curves.
2008-05-28 18:11:45 +00:00
9a19c5c8fe Fix for bug #13230: particle mirror could fail on some faces. 2008-05-28 17:55:06 +00:00
d49d0e174e Small fix for last AO sphere sampling bugfix, didn't update
random sampling code as well.
2008-05-28 17:42:03 +00:00
9a3b25d8a0 Fix for bug: [#11680] "Col" option for particle systems does not work correctly with Mat IPOs
-the feature simply was not coded
2008-05-28 17:16:43 +00:00
c6668755ff bugfix for baking AO with greater then 16 samples, since it was being clamped in sphere_sampler but not in ray_ao_spheresamp that calls it. giving uneven art deco
results.
2008-05-28 17:13:15 +00:00
ab787c9765 Generalizing the graph code used for Reeb graphs and Rig (Armature) graphs
Removing a lot of duplicated code
2008-05-28 16:39:05 +00:00
b36a358c1b bugfix
* python api render() would clamp the endframe to a short.
* python api's render() and renderAnim() would not render compositing because the name they gave to RE_NewRender was NOT G.scene->id.name, added comments to 
G.scene->id.name
2008-05-28 00:44:41 +00:00
6a802f63b6 Merging revisions 14946-15020 of https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-05-27 23:15:08 +00:00
ed42c9a676 -= Collisions -=
1. Test for fast moving edges
2008-05-27 22:46:57 +00:00
da36e8abca -= KDOP / Collisions =-
1. Fix for face with index=0 not handled
2008-05-27 22:42:38 +00:00
07e80dc265 Enabled EditMode on shrinkwrap modifier 2008-05-27 22:39:00 +00:00
c1874b3cee [#10223] a new object function to add vertex group from an armature
Patch from Jean-Michel Soler (with slight modifs)

Small BPy feature to help script writers deal with armatures and vertex groups (calls the bone heat method to create and assign groups)
2008-05-27 20:02:38 +00:00
40b0de4506 Fixed a compile error under msvc. 2008-05-27 18:40:33 +00:00
2a0a999a71 Added bvh nearest neighbour for nearest surface shrinkwrap 2008-05-27 18:32:23 +00:00
83a7fbf499 Another fix for bug #11140: explode modifier was still using more
memory than needed.
2008-05-27 15:36:36 +00:00
056f0564c2 bugfix for zero area faces and adding uv layers was not checking if the
UV layer existed alredy.
2008-05-27 15:14:35 +00:00
Maxime Curioni
58066fd0af soc-2008-mxcurioni: updated SWIG module linking instruction 2008-05-27 14:49:28 +00:00
Maxime Curioni
21c4797896 soc-2008-mxcurioni: Freestyle execution now works flawlessly (Python runtime loads appropriate modules, using SWIG wrapper), but does not render anything yet (render window OpenGL context not used yet). Currently, the SWIG wrapper library needs to be manually compiled (see SWIG section in source/blender/freestyle/SConscript for details). I am missing some knowledge on scons to create it automatically from the SConscript. Once I find that information, I'll make it automatic and for different platforms.
I also corrected a simple GLStrokeRenderer bug for texture loading (not in original Freestyle code). Apparently, IMB_loadiffname doesn't recognize the paper's texture depth so a work-around will have to be found.
2008-05-27 14:13:16 +00:00
db44a4a1a7 Skeleton retargetting - Preliminary commit. Results are encouraging but nothing *that* useful yet
Smarter heuristic noise arc filtering for Reeb graph
2008-05-27 13:33:24 +00:00
0eb8ea7429 bugfix, edges with no faces raised an error. 2008-05-27 13:32:10 +00:00
c25b845abe Fix for bug #12463: hair didn't draw z-buffered in wireframe mode.
Instead of making it an exception compared to other objects which
don't draw z-buffered either, it now draws without lighting in the
wire color like it did before.
2008-05-27 13:26:52 +00:00
1345417f27 Reeb Graph importer (for debuging purpose only) 2008-05-27 13:24:38 +00:00
e70573badd gHash iterator initializer
To be able to have iterators on the stack/reuse iterators
2008-05-27 13:22:17 +00:00
8676e9f44e rebranching for skeleton generation phase 2 2008-05-27 12:38:07 +00:00
4fd54681fc Fix for #12526: still didn't get dupli transform in envmaps correct. 2008-05-27 11:05:33 +00:00
027b9a7e96 Fix for bug #12533: color picker didn't always redraw rgb/hsv/hex values. 2008-05-27 11:01:31 +00:00
be215f74f3 removing this script, should have been removed for 2.46 since the
functionality is avalable in the UV snap menu.
2008-05-27 09:46:35 +00:00
eb26992c25 Fix for bug #12806: compositor nodes with use nodes disabled
didn't properly redraw the node window on changes.
2008-05-27 09:41:43 +00:00
54572ccc22 bugfix for view naming, pressing numpad5 would clear the V3D_OPP_DIRECTION_NAME flag even though it wont switch the view direction. 2008-05-27 08:51:47 +00:00
Maxime Curioni
4245f81605 soc-2008-mxcurioni: PythonInterpreter now properly handles its initialization (in accordance with original Freestyle code). This is achieved by creating a temporary Text structure, adding the required import and appending the necessary Python path. The text is executed using the BPY_txt_do_python_Text command.
When Freestyle is run within Blender, it should not crash; the Python interpreter should report an ImportError on _Freestyle (the SWIG wrapper).
2008-05-27 03:29:43 +00:00
04fb0c6f79 First commit and merge from trunk for testing.
Merge: 14970-14988
2008-05-26 23:04:37 +00:00
4383743ace Fixed some compile erros under msvc (thanks lguillaume)
Fixed object dependency (thanks ZanQdo for pointing it out)
Make some code cleaner
(preparing for adding bvh trees on nearest surface)
2008-05-26 21:57:53 +00:00
c0a40125bb bugfix, copy posebone constraints didnt update properly, canceling transform would not reset the bone back to its original state. need to set teh flag "ob->pose->flag |=
POSE_RECALC", which is alredy done on adding a constraint.
back 
to
2008-05-26 20:43:35 +00:00
Maxime Curioni
373d42dbea soc-2008-mxcurioni: PythonInterpreter works, using Blender's Python functions. The drawing still does not produce anything because the SWIG module wrapper is missing 2008-05-26 19:52:55 +00:00
Maxime Curioni
fc8cd192a3 soc-2008-mxcurioni: Freestyle compiles but crashes at runtime because of the Python environment.
I analyzed the crash with gdb and PyImport_AddModule ("__main__") in Python/import.c:320 seems responsible for the crash: apparently, "__main__" is not found and causes the error "No such file or directory".

I have to figure out what's wrong with the current configuration, especially whether Freestyle's PythonInterpreter can be used as is. I am going to see whether it's just quicker to use Blender's functions.
2008-05-26 16:19:30 +00:00
Stephen Swaney
a2298cb980 bugfix for crasher from Cedric Paille via bf-committers. 2008-05-26 15:12:20 +00:00
ae2a0bb273 Bug fix
Force proportional editing flag off in object mode.

While it didn't have any effect on objects themselves, it could display the falloff mode (Smooth) in the header. The bug was purely cosmetic.
2008-05-26 12:52:28 +00:00
3b4873250e when cyclic is enabled the knots would always be generated with uniform nurbs but after, cyclic nurbs would be incorrect if the bezier or endpoint u/v was set.
also replaced some numbers with constants.
2008-05-26 12:50:00 +00:00
391c7615d1 -= Collisions =-
1. fix for collisions (were working better with selfcolls enabled, now generally better)
2008-05-26 10:36:14 +00:00
0a90a52442 * The displist would be uninitialized when nurbs bezieru/v was set and the order wasnt 3 or 4. add a function that checks nurbs can produce a valid line. check_valid_nurb_u/v
* when check_valid_nurb_u/v fails, no curve is allocated or drawn.
* knotsu/v could be NULL but some functions didn't check for this, make sure this is checked for everywhere.
* The interface didnt change check the order when the bezier u/v flag was set, added functions clamp_nurb_order_u/v that takes into accound the number of points and the bezier u/v flag.
2008-05-26 09:50:46 +00:00
cb378cbceb -= Cloth =-
1. Fix selfcollisions (reported by nudelZ)
2008-05-26 09:39:32 +00:00
b7c6da39ae the last selected nurbs curve lastnu could become an invalid pointer in places, access this via functions now and store an index
rather then a pointer so if it becomes invalid it will just return a NULL pointer.
2008-05-25 23:05:13 +00:00
5263021aa8 Commit patch #9059 by gsrb3d
Unnecesary include path in Makefile.
2008-05-25 21:11:34 +00:00
7f6fc12d8c Bug fix in X-Mirror for armatures
When a bone in a mirrored chain wasn't named properly, it would leave the head or tail in an invalid state.

Now it applies the mirror to connected joints that are mirrored.
2008-05-25 21:05:13 +00:00
ea760cade7 creating gsoc branch for Ian Thompson 2008-05-25 19:24:46 +00:00
Maxime Curioni
59df5a23b4 soc-2008-mxcurioni: merged changes to revision 14967 2008-05-25 18:28:52 +00:00
Maxime Curioni
8518e500d1 soc-2008-mxcurioni: Big update. Finally works (links and compiles). So far, the following steps work:
1. instantiates the config path, the controller and the view
2. sets the controller’s view
3. loads a 3ds file (right now a fixed file)
4. inserts a style module (right now, also fixed)
5. computes the view map

The next and final step is running the Python script. A lot of information are fixed and should be changed to test the following code: see source/blender/freestyle/app_blender/*.cpp and search for fixed paths (starting in /Users/).

I am currently evaluating whether it's worth making Python run on its own environment (right now, the program crashes because of PyImport_AddModule) or whether it should use Blender's Python capabilities. Also, I need to figure out how to integrate the SWIG wrapper dynamic library into the current scheme.
2008-05-25 17:34:21 +00:00
b306aaccb9 patch [#11491] Fix for bug 11362: Blender.Draw.Image() method does not clip properly
fixing [#11362] Blender.Draw.Image() method does not clip properly
also return silently on zero zoomlevel rather then raising an error, only raise an error on negative values.
2008-05-25 16:39:57 +00:00
20b4bf4aba == Sequencer ==
Fixes
[#12106] Memory leak in sequencer (>10MB/frame)

in parts: inner contents of meta strips are freed up after calculation
making more room for the cache.

Actually have to think of a mechanism, that remembers, which output
frames are asked for and caches only those.
2008-05-25 16:07:32 +00:00
ad3f4c89aa Merge BVH tree fixes from cloth branch
svn merge -r 14954:14963 https://svn.blender.org/svnroot/bf-blender/branches/cloth/blender/source/blender/blenlib/BLI_kdopbvh.h
svn merge -r 14954:14963 https://svn.blender.org/svnroot/bf-blender/branches/cloth/blender/source/blender/blenlib/intern/BLI_kdopbvh.c
2008-05-25 15:47:54 +00:00
ad2fecf266 Added BVH nearest neighbour code, for now only works in 6-dop and finds the node with the nearest bounding volume.
I'll work on making it more generic.
So far it querys faster than kdtree, but building the tree is slower.
And bvhtree NN uses an heuristic based on the last match.

Shrinkwrap (OBCube)24578 over (OBSuzanne)31658
kdtree
build: 30.000000ms
query: 1360.000000ms

bvhtree
build: 140.000000ms
query: 490.000000ms

Shrinkwrap now uses bvhtree (binary tree, 6dop) for nearest vertex.
2008-05-25 15:43:18 +00:00
03ccc38ddf [#11124] Hide Threshold button when Constant QMC sampling enabled
Patch by Olivier Saraja
2008-05-25 14:39:55 +00:00
da1f38f99d Apply BGE patch 11137: Render objects with negative scaling correctly (as in Blender) 2008-05-25 14:37:39 +00:00
2666ff7075 -== kdop ==-
1. fix crash on collision
2008-05-25 14:34:03 +00:00
f680b56ebf [#11119] Tool tips correction
Patch by Olivier Saraja
2008-05-25 14:32:59 +00:00
31ec51df42 Apply BGE patch 12799: Fix quad buffer stereo mode for Windows 2008-05-25 14:32:26 +00:00
cc98ef4012 Merge from trunk
svn merge -r 14843:14954 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-05-25 13:53:58 +00:00
55f1b6baa7 for for [bf-blender-Bug Tracker][11843] 3DS importer imports broken meshes 2008-05-25 13:48:36 +00:00
fd53876faf Merge bvh tree from cloth branch 2008-05-25 13:44:55 +00:00
fcea4573dd -== Cloth / kdop ==-
1. Bugfix for crash on enabling cloth on object
2. Correcting kdop nth element sorting function (fix provided by André Pinto)
2008-05-25 13:15:54 +00:00
e2a9590a15 BGE patch: rename rayCastToEx() to rayCast() - better name 2008-05-24 22:50:31 +00:00
7b069b9b60 -> FLT import: Zero area N-gon bug fix
FLT importer would throw errors when importing ngons with
zero area. These faces are now ignored
2008-05-24 18:43:02 +00:00
cc6dac8c42 BGE patch: add rayCastToEx(), an extended version of rayCastTo() for use in game script 2008-05-24 18:06:58 +00:00
459b4ea5be fix for [#12797] FBX Exporter Exports Incorrect Matterial EmissiveFactor and DiffuseFactor
- own error, swapped diffuse and emit factors
2008-05-24 12:22:53 +00:00
7f10f5f66f fix BGE bug #8646: unusable anaglyph settings
The best rules for stereo rendering are now applied to Blender. Here is the new situation:
1) The focal distance is now settable through the GUI: select the camera (each camera can have a different setting) and go to the camera data (F9): the "Dof Dist" and "Dof Ob" can be used to set the focal distance for that camera. The "Dof Ob" is interesting because it sets the focal distance so that the center this object will appear at the surface of the screen when running the game.
2) The eye separation is automatically set to focal_distance/30, which is considered to be a reasonable value. If you need a different value, you can always use Python scripting. 

Notes: 
- If you switch camera during the game, the focal distance will also change unless you have set the focal distance by scripting, in which case it overwrites the focal distance setting of all cameras.
- If you don't set the focal distance in the camera data or by scripting, the default value will be used. The default value corresponds more of less to the near clipping plane which means that all the objects will be very far with little 3D effect.
- If you don't set the eye separation by scripting, it is automatically computed as focal_distance/30, regardless on how the focal distance was set.
2008-05-24 08:34:04 +00:00
10dde9b7d7 Merging revisions 14838-14945 of https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-05-23 20:36:05 +00:00
4bf01e8162 Commit of selfcollisions using new kdop design. Should result in nice speedup. 2008-05-23 20:20:14 +00:00
5f70682f6a == PyNodes ==
Fixing bug #11737 reported by Daniel Salazar (Zanqdo, thanks!): assigning as pynode a text that failed to parse as a pynode script, then deleting that text would crash Blender.

http://projects.blender.org/tracker/?func=detail&atid=125&aid=11737&group_id=9
2008-05-23 16:31:02 +00:00
18abce25e5 Typos and whitespace tweaks 2008-05-23 11:12:03 +00:00
02c4866d04 Fix for bug #12526: object instancing didn't restore matrices
correct for envmap, could give objects rendering in the wrong
position.
2008-05-23 10:06:06 +00:00
b46bdbcd0f fix for "[#11004] Adding ram sound and alt-U causes ram to look like HD sound and can lead to crash"
Missing call sound_initialize_sounds, cant be added BKE_reset_undo since its in blenderkernel.
2008-05-23 09:58:33 +00:00
b6ab784c12 Fix for bug #12473: crash converting old particle system from
a linked file.
2008-05-23 09:23:57 +00:00
f9e81a6f3a fix for [#12218] Impossible to exit meta strips with hotkey
Only enter mesta's that are active and selected, inconsistent with editmode in the 3D view, but editmode dosnt deal with 
nested data.
2008-05-23 08:58:44 +00:00
99f43e0b07 fix for error when all faces are the same area 2008-05-23 08:39:59 +00:00
b4573a0c4b Bugfix #12508:
Action Editor Border Select Channels no longer selects bones
2008-05-23 04:54:16 +00:00
b7aeda4ff8 Fix for bug #11895: databrowse for image painting clone image didn't work. 2008-05-22 17:32:15 +00:00
7bae2af95c Fix for bug #11698: mesh deform modifier not working on extruded curves.
The modifier work on the tesselated result rather than the curve itself.
2008-05-22 17:06:46 +00:00
1b00877051 Fix for bug #12077: tangent shading (which only affects specular) made
bump mapping not work for diffuse.
2008-05-22 15:30:35 +00:00
5463828bd2 Fix for part of bug #12075: gamma node generated nan's on negative input. 2008-05-22 14:56:32 +00:00
99a2e7e92e Comments!!1 2008-05-22 14:12:09 +00:00
abb247ac35 Fix for bug #11743: incorrect transformation for particle group
visualization DupliGroup option.
2008-05-22 14:08:13 +00:00
be1cb6e5e2 Fix for bug #11758: crash cancelling hair softbody bake.
Fix for bug #11966: crash in hair softbody with hair amount 0.
2008-05-22 13:58:16 +00:00
5cf41da316 Fix for bug #12334: the Disable Tex option didn't disable
textures for the Texface material option.
2008-05-22 13:46:05 +00:00
a4688b24dc Transform Orientations
Normal orientation for editbones (was previously missing)
2008-05-22 09:22:00 +00:00
61fa5f9126 remove module dxfImportObjects.py. It is obsolete since 2.43, then all functions integrated in the main dxf-importer code 2008-05-22 08:29:54 +00:00
02f34de2b9 add missing flags for NLA strips 2008-05-21 19:24:35 +00:00
e1b298cad8 scene frames scene.render.cFrame,sFrame and eFrame were being treated as shorts. (which clamped them to 37856) 2008-05-21 12:14:52 +00:00
adbbc314ba testbreak was not working after the first use 2008-05-21 11:06:49 +00:00
fc56e8d432 Bone Extrusion Bug
Extruding from root would incorrectly set the Connected flag when it wasn't needed.
2008-05-21 10:14:02 +00:00
780c971b53 [#12103] Force field moves when strength changes
Wind effects would modify the center vector, so the limit sphere was drawn from the position of the last "wind ring"
2008-05-21 10:11:10 +00:00
d432eccd14 [#11892] track-to + "around selection" bug
Transform conversion was resetting constraints when used to calculate orbit center.

This is a tentative fix, it fixes this particular case but maybe not all.
2008-05-21 10:07:38 +00:00
68708346de [#11748] Bevel tool not snapping when holding down ctrl and adjusting value
Added proper gear support and fixed some misc errors in the setup of this transformation (negative values hav no effect, so use absolute value and other small things like that)
2008-05-21 10:02:07 +00:00
38ffd41bf0 == Sequencer ==
This fixes:
[#11745] Blender crashes when changing Scenes on Sequencer`s Strips

containing:

- last_seq was set to null by scene-render
- button handling wasn't very robust (didn't check for null)
- REDRAWBUTSSCENE was missing
2008-05-20 21:30:16 +00:00
92c9ae280c replacing epydoc generation script with one copied from bpy docs 2008-05-20 05:55:12 +00:00
195abc755b more updates to docs 2008-05-19 13:34:43 +00:00
Maxime Curioni
8ef2f1d524 soc-2008-mxcurioni: resolved uint issues (replaced with unsigned int). Still NOT linking 2008-05-19 13:15:07 +00:00
f32d99c322 some updates to epy docs 2008-05-19 09:54:38 +00:00
591a478670 == Sequencer ==
This fixes:
[11750] "Translate" stops working when offset > image size
2008-05-19 06:14:57 +00:00
Maxime Curioni
09b36970bb soc-2008-mxcurioni: uploaded missing files. Still NOT linking so do not use this version yet :( 2008-05-19 05:34:31 +00:00
c526b1b2df memory corruption error fix when changing orderU/Vs with curves, this could crash blender or make odd display lists.
the problem was that the buttons would use the first nurb if there was no 'lastnu', but the makeknots function only checked for lastnu. this meant the knots would not get re-allocated on 
values would be written outside the array.
2008-05-18 18:44:02 +00:00
055dc10c14 Last part of the svn release commit. It's now in freeze... unless? 2008-05-18 18:05:55 +00:00
66af413a4c Part one of the 2.46 release commit 2008-05-18 18:05:16 +00:00
24c8d15446 temptative fix for the ndof bug
if vd.dist is null at a wrong time,
retore to last known good value
2008-05-18 16:00:13 +00:00
Maxime Curioni
32918e4523 corrected swig Sconscript to compile on unix-like machines 2008-05-18 14:10:44 +00:00
3effe8060d Fix in mball last May 15th causes a hang (eternal loop) in mball.c,
a division by zero was not handled

(weird though, only shows in OSX PPC. no optimize, debug build.)
2008-05-18 13:57:47 +00:00
Maxime Curioni
55655a0659 soc-2008-mxcurioni: towards Freestyle's first render: controller, config, appglwidget corrected. Freestyle is called but cannot be linked (ImBuf issues). This is an unstable commit. 2008-05-18 13:01:52 +00:00
54be27b40e Bugfix #11738:
PoseLib Preview crashed when there was no active pose as there were no poses at all (i.e. on a newly created Pose Library) .
2008-05-18 10:41:42 +00:00
aba4f31086 Bugfix 11736
CTRL+Click on "load" for image node crashed.
NULL pointer test missing...
2008-05-18 07:30:51 +00:00
d3f7fba472 fix for [#11691] No checks in curve code for "Number of points <= Order U"
added checks for a nurbes orderu being larger then pntsu.
This has the same effect as the curve having only 1 point. (its display list is not generated 
but it is still added but a dummy displist with zero points is made)
memcpy was also being used where the memory overlaped (probably worked in most cases but this is incorrect and valgrind complained), use memmove 
instead.
2008-05-17 22:37:34 +00:00
81dee8e1dd Fix for mistake in recent interface bugfix commit. 2008-05-17 13:41:34 +00:00
bb6c67cc73 Bugfix #11717:
Rendering (Internal/OGL) would crash when StampInfo was on and adding info about the active camera, if there was no camera in the scene.
2008-05-17 00:35:30 +00:00
4100695f38 root level python tree menu's didnt work with seperators, would display SEPR text instead 2008-05-16 21:34:22 +00:00
9b2dcab02d == Sequencer ==
This fixes: [#11642] VSE: crash with Speed Control and play head

Special sequence update (holding down left mouse button on a strip)
could lead to a crash when using the speed control effect, since
we didn't check properly for valid cfras (and therefore if
TStripElem is null... )
2008-05-16 21:04:06 +00:00
bbe32118ef == Nodes ==
- "Memoryblock free: attempt to free NULL pointer" messages related to the Material node (Add->Input->Material). Deleting it and quitting Blender would bring 2 or 3 of these warnings. Trivial fix (check if NULL) in blenkernel/intern/node.c, though Nodes devs may be interested. Found while testing to fix the following bug:

== PyNodes ==

- Bug #11715 reported by Alexanter Feterman:

http://projects.blender.org/tracker/?func=detail&atid=125&aid=11715&group_id=9

Adding a Dynamic node and setting it to a pynode script would crash Blender if no Material Node (MatNode) was present.

Thanks Alexander for reporting and Brecht for assigning it to me.
2008-05-16 20:57:06 +00:00
9ed039efe0 Fix for two UI glitches:
Bug #11711: particle start frame could get NaN value.
Bug #11714: x-axis mirror button didn't work.
2008-05-16 17:36:06 +00:00
952a0042ea [#5743] Rotate dosnt work at high zoom
More precision added to previous fix through linear approximation of the angle at really small angle values.
2008-05-16 13:13:20 +00:00
58e6861aea fix for [#11542] "Add -> Mesh -> Torus" adds corrupt mesh
previous fix only worked in object mode
2008-05-16 13:05:36 +00:00
ff84d868a1 [#11706] Camera IPO Lag
Broken in revision 14473

Camera IPO needs a special exception to be done earlier than others, that was removed in that revision.

I added a better comment to make sure nobody removes it again, unless they really understand what's happening.
2008-05-16 10:20:30 +00:00
1e1ece8025 Fix for bug #11682: active render vertex color not respected correctly. 2008-05-16 09:55:09 +00:00
Ken Hughes
584d84eafd Remove PLATFORM_LINKFLAGS for makesdna, was breaking debug builds with MSVC8. 2008-05-15 23:33:30 +00:00
ec253c3918 own error, off by 1 with string allocation 2008-05-15 23:16:42 +00:00
9df0d227cb Fix for bug #11676: the Spread value for particles does nothing, as
far as I can see it would only do something if child particles could
be emitted from volume, so removed the button for now.
2008-05-15 20:45:02 +00:00
7df859fb95 Fix for bug #11389: edgesplit modifier crash after subsurf when
no edges were being split.
2008-05-15 20:07:07 +00:00
98c54a91b7 fix for [#11597] 2.46R5 and probably problem of all 2.46Rx - UNPREDICTED DRAW sculpt brush
front and back face test was reversed. This problem still shows up when sculpting from the inside of a mesh, but this 
cant be worked around unless its know which faces are visible or not. (tried some different workarounds but this 
seems acceptable)
2008-05-15 19:49:34 +00:00
cf66596d32 fix for [#11667] Minor problem with lightmap_uvpack, LC is getting out of control but keeping to annoy theeth 2008-05-15 19:44:34 +00:00
a6e18574b8 Fix for bug #11650: removing uv layers in editmode did not work correct.
Fix for bug #11661: bake to viewport uv layer instead of render uv layer.
2008-05-15 19:40:09 +00:00
ad397fa16b -> FLT import bug (loose vertices)
New faceweld code broke the import of meshes with loose
vertices. Also added exception handling to the importer
and exporter so that UI doesnt quite when errors are encountered.
Instead traceback is printed to stderr and control returns to
the script UI
2008-05-15 19:35:17 +00:00
ba6c6854ed Last bug fix of #10999. This should finaly work (tested by jesterking). 2008-05-15 19:30:30 +00:00
6e7744451b Sculpt buttons had their events set to zero, this mean clicking on buttons would pass through to 3D view and sculpt, use B_NOP instead.
Opening many panels would print an error in the console, show an error message now so users dont get confused.
2008-05-15 14:44:39 +00:00
20ff5bdc34 changing between libraries with the append/link library selector didnt re-read a new blend file when it alredy had one loaded.
it looks like this only ever worked for the first library selected.
2008-05-15 13:18:56 +00:00
2f1cca9528 Bugfix #11293: IPO-Driver Links Lost on Renaming Bones
IPO's were not being checked for drivers that linked to bones that were renamed when fixing dependencies after renaming bones. Note: PyDrivers will not benefit from this.
2008-05-15 08:05:56 +00:00
34a1d92579 == FFMPEG ==
Added additional entry, so that ffmpeg encoding options can
be added using their name instead of "the menu(tm)".
2008-05-15 06:47:54 +00:00
a6a4b78417 Fix BGE bug #7532: TrackTo Actuator does not work correctly if it has a Vertex Parent. This is only a partial fix: the user must put the parent vertex at the center of the parent object and disable the physics on the tracking object (use empty or collision free object). 2008-05-14 20:22:57 +00:00
c4937891ea Merge from trunk
svn merge -r 14760:14843 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-05-14 20:01:22 +00:00
9f7bc14c57 -> FLT Export bugfix
Export of open faces on export was dropping
the last vertex. Also removed recursion from
function in order to make it safe for large polygons.
2008-05-14 19:29:33 +00:00
859a05864c I'm considering using bvhtree for shrinkwrap but the build was considerable slower than kdtree
as so i've made some improvements

So basicly theres no shrinkwrap improvements for now...
2008-05-14 18:25:23 +00:00
d1b04a3a9d forgot to use the thread setting function for rendering. (was only used for baking) 2008-05-14 16:49:33 +00:00
540c0e0795 uvcalc_lightmap would raise an error on meshes with no faces.
auto-threads wasnt working for baking.
2008-05-14 16:40:25 +00:00
b64eeda588 svn merge -r 14810:14838 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-05-14 16:14:40 +00:00
4d8b5587b8 Pre merge commit (includes commented moving stuff) 2008-05-14 16:09:56 +00:00
b65d4f95fc Missing hotkey in menu for Align to Transform Orientation 2008-05-14 14:53:12 +00:00
7806a44134 Minor particle system fixes:
- Changed some tooltips.
- Refresh with reactors and shared particle settings.
- Copying of child particles.
2008-05-14 13:30:36 +00:00
d1e1332e07 Final fix fo revision 14827
Fixing UV Quad Constraint when cancelling transform. Also, transdata conversion is a bit faster for all UV transforms.

Patch by Cambo, reviewed and revised.
2008-05-14 12:24:38 +00:00
c56f484da8 == Transform orientation bugfix ==
Fallback to global if the selected orientation doesn't exists.

This only happens when switching between scenes or screens(orientations are per view3d)
2008-05-14 09:30:27 +00:00
9fdb4965a3 NLA and IPO now have the "AfterTrans Keyframe" option that prevents the creation of duplicate keyframes after transform. 2008-05-14 09:00:22 +00:00
83c2acccfb stupid me - i left the wrong line in. 2008-05-13 22:30:59 +00:00
3bb43aaaaf bug in bvhkdop (bad diff merged, pointed out by jaguarandi) 2008-05-13 22:29:50 +00:00
f98085bd7e == FFMPEG ==
Not all versions of ffmpeg seem to have av_find_opt. Added my own version... grmbl.
2008-05-13 20:32:52 +00:00
2c4fd39142 Todo [#5743] Rotate dosnt work at high zoom
Fixed by only conditionally resetting the start of the triangle used to calculate the angle to when an angle is actually measured (so really small angle don't result in continuous deltas of 0 degree).

However, the smallest rotation angle is still limited by the precision of the acos function (here: 0.02 degrees, 0.02 / 30 with Shift pressed).
2008-05-13 13:20:47 +00:00
b303fa96ac canceling UV transform would still run the be_square function 2008-05-13 10:19:28 +00:00
f4a20f4cc1 [#8146] Objects rotate in wrong direction when using numeric input (R x <num>)
Don't flip axis to face camera on num input.
2008-05-13 10:17:46 +00:00
33120a1825 disabled drawing the 2d image cursor when painting, added copy bevel weight to the edge copy menu. 2008-05-13 10:04:04 +00:00
4e59c3ec53 [#11152] [C] key shortcut is broken in UV/Image Editor
Only allow this inside paint mode.
2008-05-13 06:12:33 +00:00
af30d9b2b0 -> Fix for bug in 'Select Non-Manifold'
Select non-manifold would select stray vertices even when in
non-vertex modes. Fixed.
2008-05-13 02:22:57 +00:00
e02bca73d7 New speed imrovements by Mr. Pinto/jaguarandi 2008-05-13 00:42:51 +00:00
ac71783e8d last commit had a typo, also adjusted teh and colour instances 2008-05-12 21:12:10 +00:00
a0cd3d67ed confined unprofessional print to debug mode ;) 2008-05-12 20:59:46 +00:00
4903751c4d mirror face UVs and color was rotating, shift for alternate axis also wasnt implimented 2008-05-12 18:30:50 +00:00
f44c22e69c Fix for bug #11128: render window shows undithered image. 2008-05-12 17:41:03 +00:00
916120b98c Fix for bug #11114: boids physics went wrong when the distance between
particles was exactly 0.0, for example with emission from verts.
2008-05-12 17:30:32 +00:00
d2fcba7f65 == Ipo ==
This fixes [#11118] Record Mouse in IPO Curve Editor 2.46rc3
and adds thereby a new feature: correct audio sync to IPO mouse recording :)
2008-05-12 17:16:54 +00:00
c471b6db74 Bug fix of #10999. mbproc->start was useless. 2008-05-12 16:22:49 +00:00
db3712a2d8 svn merge -r 14721:14810 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-05-12 12:24:52 +00:00
2c9e8e7593 Fix for bug #11140: explode modifier could run out of memory quite
quickly because it allocated a totvert*totvert size array, now uses
edgehash instead.
2008-05-12 11:48:55 +00:00
97dd2fe33e == FFMPEG ==
Added (disabled) MKV support. Might come handy later, if someone finds
out, why it instantly crashes after 2 frames.

Made it impossible to set min_rate higher than max_rate in render buttons
panel.
2008-05-12 09:01:15 +00:00
b01e2c4a84 swapped the order of the UV snap menu so Cursor->Selection the 4th, as with the 3d view. 2008-05-12 07:32:46 +00:00
3fd3571964 Bugfix for Separate Armatures:
Constraint relinking now works correctly for this tool, so it should be safe to be used by users now.
2008-05-12 04:25:53 +00:00
Ken Hughes
e9706d6f0d Move variable declaration, wouldn't compiler with MSVC (reports by jms). 2008-05-11 22:51:56 +00:00
Maxime Curioni
29b2db8518 soc-2008-mxcurioni: swig SConscript updated to compile under all configs except Win32 (where binary is copied to build directory) 2008-05-11 21:49:04 +00:00
Maxime Curioni
6069124ac9 soc-2008-mxcurioni: lib3ds SConscript updated to compile under Win32 configs 2008-05-11 21:13:54 +00:00
c8673be3d6 == FFMPEG ==
Add ffmpeg expert option (meaning _all_ ffmpeg option) to render dialog
using properties.

Also adds: H264 preset, that doesn't screw up output.
2008-05-11 20:40:55 +00:00
Maxime Curioni
c785d7493e soc-2008-mxcurioni: merged changes to revision 14798, compilation works for rendering/ directry. Still needs to figure out how to compile on non-Unix machines. 2008-05-11 20:28:47 +00:00
e459d5518e transform manipulator didnt follow the active face in some cases, also rotate about active mixed with normal did not work as it did in 2.45, where the active edge could be used
as a rotation 
axis (this is quite useful)
2008-05-11 19:58:46 +00:00
96486b356f fix BGE bug #8668: Behavior of os.getcwd() is not consistent between operating systems
Add a function GameLogic.expandPath() that works like Blender.sys.expandpath() and is also available in the BlenderPlayer.
Fix the game actuator in the BlenderPlayer to work like in Blender: 
- try first to load the .blend from the current working directory
- if not found, try to load from the startup .blend or runtime base directory
2008-05-11 18:45:30 +00:00
6da415d406 bad mistake in last commit, though it still worked. 2008-05-11 14:29:11 +00:00
360e2f091e protecting by #ifdef0 debug prints for ndof 2008-05-11 13:33:27 +00:00
50a282559c revealing selected faces in the UV window with sync selection disabled and when both UV and editmode were are in face-sel-mode would result in selected faces having unselected
edges.
2008-05-11 13:28:57 +00:00
e969685df4 Bias for irregular lamp buffers now allow minimum of 0.001.
For larger architecture environments it was proved to be necessary.
2008-05-11 13:27:22 +00:00
9bf4e60cb8 Shift+H in editmode with only faces selected would result in selected faces having unselected edges. 2008-05-11 13:10:56 +00:00
97e72570d1 NLA Transform Bugfixes:
* Scaling NLA-strips now resets their scale setting correctly at all times
* Added safe-guards against negative scaling being created through the use of the transform tools.

Note: at scale 0 or thereabouts, there will still be a little blip, when keyframes are scaled as if scale were 1.0f. It's quite harmless.
2008-05-11 13:07:40 +00:00
2d96d1189f Fix compiler warnings in particle.c and editface.c.
* unitialised/unused vars
2008-05-11 12:57:01 +00:00
b9c66e88ea added encoding "# coding: utf-8" to the headers of scripts that python would not run with execfile('....'), python would also riase the error, though there is no practicle use
for running these scripts outside blender.

The error looked like this.
SyntaxError: Non-ASCII character '\xe4' in file ./3ds_export.py on line 10, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
2008-05-11 12:41:12 +00:00
50bbc0ff23 More bugfixes for Armature Separation/Joining:
* Move armatures out of posemode before joining/separating, so that bones don't mysteriously disappear after the operation
* Added an undo push and fixed up hotkey access for armature separation
2008-05-11 12:34:56 +00:00
7cceaf13ea Anticipating the final final final rc build #5! 2008-05-11 12:34:39 +00:00
cfc767d981 Bugfix:
Found a little bug in the Armature Joining code due to the 'imat' var being defined twice and used for two different things. This was brought to light by Valgrind output (thanks Campbell)
2008-05-11 12:17:52 +00:00
1decc569dd Separating armatures should now be more stable than it was, but is still too unstable to enable for release. So for now, the old warning stands. 2008-05-11 11:53:12 +00:00
a2528b4123 fix for [#11136] Segmentation fault when copying objects with hairs 2008-05-11 11:34:39 +00:00
Stephen Swaney
aa471f6a80 fix compiler warnings.
tsk tsk - implicit declaration of functions.
2008-05-11 06:11:23 +00:00
Stephen Swaney
a2c10ff1e7 Initial commit for BPy Particle patch #8557 from Cedric Paille
Thanks, Cedric!

*** WARNING ****   This is a Work In Progress   *** Warning ****
2008-05-11 04:15:21 +00:00
33568c3f24 =BPy bugfix=
Little python bugfix, events were never sent to space handlers when using the
manipulator.  This is necessary for e.g. movable pivot pyconstraints.
2008-05-11 02:28:01 +00:00
5122cae732 fix for [#11121] mouse wheel dont work when playing animation 2008-05-10 19:05:46 +00:00
Chris Want
5e5dc2e938 Reverting vrml97_export.py to it's state at revision 14751 because:
1) Bug #6692 is actually a feature request. While I do think that
Michalis' patch is a worthy change, we don't have time to test
this at this stage in the release cycle (and svn is supposedly
closed to new features anyways). I'm sorry Michalis, this will
have to wait until after release.

2) I have looked at bug #8814 a while ago, but I have not yet found
a good solution (and perhaps the solution is to *not* export faces 
without materials assigned). I don't have time to assess whether
revision 14774 presents a worthwhile change or not, and I have no
time to test before release. Also I don't like that the 'fix' for
#8814 is mixed with a fix for a previous faulty commit.

3) Again, another commit to a script I maintain without consulting
me first. Not cool!

Chris
2008-05-10 14:05:35 +00:00
a404e4aead added access to object alpha since there is alredy ipo access 2008-05-10 13:09:34 +00:00
3870080d3f sequencer non-square-pixel display didnt offset correctly, also made this only work with images. (not luma waveforms etc) 2008-05-10 12:43:53 +00:00
0bc5855e5d Fix for second part of bug #11107: physics systems were referring to
vertex groups with a number, but this got out of sync if any vertex
group was deleted, now it properly updates it.
2008-05-10 12:33:15 +00:00
639ea26638 fix for [#1473] align camera to view : no IPO update 2008-05-10 10:57:22 +00:00
cc279a3aa0 fix for [#8814] VRML 97 Exporter bug (empty coordIndex [] indexes) Blender V2.45
null materials were not exported, but would also mess up the assignment of materials for any valid materials after the empty slots.
also made a mistake last recently that Michalis Kamburelis pointed out, changing the default orientation incorrectly. this is now set 
back to what it was in Michalis's patch.
2008-05-10 07:58:10 +00:00
Maxime Curioni
fd9ad58298 soc-2008-mxcurioni: towards Freestyle compilation, removing Qt's QString and QImage dependencies. Up to this commit, the following directories compile well (and without any warning): system, image, geometry, graph, winged_edge, view_map, stroke.
Modified code is commented by //soc and unused variables by //soc unused
2008-05-09 23:06:28 +00:00
76c13cc0f7 fix for [#8359] Sequencer image preview: HOME hotkey zooming at output res, not at "full view"
also made image and sequencer account for aspect ratio and added numpad 1,2,4,8 keys for zooming.
2008-05-09 20:08:28 +00:00
a7a9c74ccb This is patch: [#9050] Single step .svn dir removal for Makefile (release)
From gsr.

It cleans up removing .svn dirs from the directorys that get copied over.

Kent
2008-05-09 20:00:18 +00:00
f115a5f789 fix for [#6104] CR generates space at String Creation
replace windows line endings (\r\n) with \n rather then inserting spaces.
2008-05-09 17:37:01 +00:00
694dce0e63 render layer saving script assumed scriptsdir existed.
apply def script assumed the mesh had all the objects vertex groups.
2008-05-09 17:13:03 +00:00
a9d5f74f4b Fix for bug #7030: extrude region doesn't correctly compute
the average normal.
2008-05-09 15:51:20 +00:00
90420a15ef Fix for bug #7068: displace node crashes with procedural
texture input as vectors.
2008-05-09 15:32:55 +00:00
f7173498f3 missed modifier.c last commit, made explode copy some settings.
added back zr's depth buffer wire stuff, but only when wire is being drawn over solid mode. normal wire objects  will still display correctly.
2008-05-09 15:21:23 +00:00
4fa0ba06d6 partial fix for [#11107] two problems with explode modifier and vertex group
tooltip patch from olivs - [#10218] Corrected a few tooltips in shading buttons
2008-05-09 13:59:03 +00:00
7e93f5569d Fix for bug #10475: added more dependencies for physics systems
with deflectors and fields for proper dependency graph updates.
2008-05-09 13:04:36 +00:00
6a97a2ab33 Fix for bug #8919: uv shadow mesh doesn't update without 3d view
open. Made it so that the dependency graph besides the visible
layers, also updates the edited object.
2008-05-09 12:39:56 +00:00
8f6eda7e5d need to recalc normals for meshes added in object mode 2008-05-09 12:37:26 +00:00
53e08925b5 Merge from trunk
svn merge -r 14692:14760 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-05-09 11:57:52 +00:00
8d6857b915 Fix for bug #10894: objects used as particle duplis couldn't be
transformed properly anymore if they had ipo's, same issue also
fixed for dupliframes.
2008-05-09 10:26:49 +00:00
55cbcd125d [#10998] Sequencer: some new features missing from the menu items
also added Shift+H for muting unselected and fixed a problem with marker selection not working in the sequencer (shift+rmb logic was reversed)
2008-05-09 08:01:27 +00:00
9fb7381d2e chris want corrected some of the last commits changes 2008-05-09 06:02:39 +00:00
cfcdf36cd8 fix for [#10330] Can't import packages or modules from a user defined script path in 2.46rc3, works in 2.45 (Windows) 2008-05-08 22:07:00 +00:00
1d043ddf19 Fixes wrong menu entry text - fix provided by nudelZ 2008-05-08 21:39:08 +00:00
5d8178a120 Potential bug fix of #10999. 2008-05-08 21:33:15 +00:00
7be03f2ae5 == bugfix ==
fix for [#10284] Activate International font hiding text in bookmark window in image browser
- use same font handling for bookmarks as for the regular files.
2008-05-08 20:55:16 +00:00
71fbf87304 fix for [#6692] vrml (.wrl) export bug in V2.44 release
patch from Michalis Kamburelis with some minor edits
2008-05-08 20:51:22 +00:00
3331bfae48 Bugfix: unwrap pinning did not work correct with aspect ratio option. 2008-05-08 20:38:38 +00:00
7a58893bf2 fix for [#10581] 2.46 RC3 Sequence editor on OSX renders PNG files as black/empty
use BLI_join_dirfile which makes sure the slashes are there.
2008-05-08 20:10:50 +00:00
ad38297a08 Fix for bug #11005: hue-sat-value node was doing unnecessary
clamping, which not only is suboptimal for working with hdr
images, it was also doing the clamping incorrect.
2008-05-08 19:57:10 +00:00
Maxime Curioni
64e4a3ec9a soc-2008-mxcurioni: merged changes to revision 14747, cosmetic changes for source/blender/freestyle 2008-05-08 19:16:40 +00:00
106974a9d2 Fixing up the webplugin defines for the Makefiles.
Now you can do one of the following to disable it:
export NAN_NO_PLUGIN=true
export WITH_BF_WEBPLUGIN=false

or
export WITH_BF_WEBPLUGIN=true to enable building it.
(Its set to false by default)

Kent
2008-05-08 18:38:21 +00:00
8fdc367e0d 2.46 todo item, added back seam marking tools from UV-face mode.
Since these conflict with loop select its now an option from the mesh tools panel. also made it possible to alt+rmb and alt+shift+rmb to mark other edge flags (creases, 
bevel weights, sharp edges)
2008-05-08 16:33:55 +00:00
3faf127707 DXF-importer prepared for ProE files, which are outside of DXF-specification. 2008-05-08 15:58:00 +00:00
e71a6bd79e NLA - Bugfix:
Scale and Repeat fields in NLA Transform Properties panel will now ignore negative values instead of clamping them to a near-zero value, which can easily be confused with the strip being 'destroyed'. This shouldn't affect other interface elements, as this change has only been used here. 

(Note: negative scaling should be avoided)
2008-05-08 08:59:36 +00:00
205d06f5f4 Fix for bug #11002: particle ipo clump did not allow negative values
like the button in the user interface.
2008-05-08 08:41:56 +00:00
18b20396bc this script isnt needed anymore thanks to stivs and gsr 2008-05-08 07:33:20 +00:00
Stephen Swaney
12715ec0fa more shell script tweaking.
Thanks to gsrb3d for hints.
2008-05-07 22:46:20 +00:00
44cdc480de Fix BGE bug #6054: Camera actuator crashes Blender. The crash occurs when min,max << height (bad practice anyway). 2008-05-07 22:32:45 +00:00
2a8caaa6a0 [#10996] Wrong tooltip in "Fields" panel
Also fixed typo and insuficiant length of label Longitudinal
2008-05-07 22:26:47 +00:00
Stephen Swaney
1c7c37deb7 modify script to use long opts; --name vs -n, for example.
This makes epy_docgen.sh compatible with epy_docgen-3.sh.

I am not sure why we would need both scripts.  Perhaps 
someone with epdoc version 3 can test.
2008-05-07 21:21:15 +00:00
a68c03e409 Reason of all this work: Commiting my work-in-progress on reviewed collision system (better + general access to kdop, uses less memory, put it into BLI_* namespace and usage defined like existing BLI_kdtree_*). Deleted old kdop.c 2008-05-07 20:42:16 +00:00
48f6c5b05f was missing depgraph update for centering objects in editmode if they were unselected.
ctrl+num keys for switching subsurf didnt work in editmode if the object wasnt selected. changed this to only operate on the editmode object. also 
disallow ctrl+num to change layers for values above 4.
2008-05-07 20:34:34 +00:00
3527c10065 Fix for bug #10932: area light bug, points behind the lamp could
also get lit.
2008-05-07 20:24:06 +00:00
96408da81a Added bullet back to branch, compiling works again 2008-05-07 20:22:28 +00:00
3a36304bd9 Resolved other bad files in branch, had to kick old bullet, will have to copy from trunk 2008-05-07 20:06:28 +00:00
1584d6a006 Possible fix for #9691: blender failing to allocate memory when rendering
particles on windows, now allocates smaller chunks of memory.
2008-05-07 19:25:43 +00:00
5da47ddd02 fps timer was starting off at 0 fps 2008-05-07 18:33:10 +00:00
57932e1752 svn merge -r 13452:14721 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-05-07 17:44:46 +00:00
ad5579ec92 Fix for bug #9676: added warning that particles on multires are
not supported on anything else than the first level.
2008-05-07 16:31:49 +00:00
bda4e3d19f * added support for exporting dupli objects
* option to export modifier applied objects
* option to export quads as tri's
* added back compress option (will default to enabled if you use .x3dz as the extension)
2008-05-07 15:38:40 +00:00
529a8bb949 Fix for bug #10990: edge render AA issue. 2008-05-07 14:58:33 +00:00
50acbe29d1 Normal projection:
+added option to remove faces where all vertices got unprojected

Nearest surface point
+15% faster closest point on point-tri function
(archived by projecting the point on tri-plane and solving the problem on 2D)
(its still using bruteforce on triangles.. I'll add the right data structure later)
2008-05-07 12:45:02 +00:00
fa9b01908f Bugfix: modified the tooltip to indicate that the maximum length option
for particle paths applies to children.
2008-05-07 12:23:51 +00:00
5e493eeb19 Setting frame in python allowed negative numbers (was casting to a short with no clamping!)
disable capslock option isnt used anywhere.
2008-05-07 07:57:18 +00:00
Maxime Curioni
cf2e1e2857 soc=2008-mxcurioni: reverted back to compiling swig as a binary, instead of as a library 2008-05-07 03:37:16 +00:00
4aa8dd0b63 fix for [#10290] Wire object hid in the back of soled obj.
reverse wire draworder logic from r4059, wire-only meshes were not using a depth buffer which meant they would not be visible at 
all, if they were after an overlapping solid object in the scene (had this problem for peach too).
2008-05-07 00:37:38 +00:00
7d2e366e8f fix for [#10180] File Browser buttons disappear after clicking on Window Type button
Spent some time looking into what this could break and it seems like a safe change.
2008-05-06 23:58:15 +00:00
881802d8a3 BGE patch #10492 approved: getLinearVelocity() now can provide local velocity as well. This patch is harmless and backward compatible; it can go safely into 2.46 release 2008-05-06 20:55:55 +00:00
917865b504 == bugfix ==
[#10312] Append Link (image browser) bug if combined with Open window
The only place where the special handling in newspace is relevenant is when
opening it with the windowtype_pupmenu. All other overlaying windows( render in image space, scriptspace)
should leave imagebrowser/filebrowser space alone.
2008-05-06 19:29:37 +00:00
c0d981f6db patches
[#10529] -p command line option fix
[#8844] Glossy controls Python API
2008-05-06 18:57:24 +00:00
4255f3c7ab made python add mesh module respect blenders user settings for editmode and view align.
added sys.cleanpath() was a patch in the tracker but blender's internal path cleaning is now more general and can be used from 
python.
2008-05-06 17:54:55 +00:00
Maxime Curioni
959f1a0f92 soc-2008-mxcurioni: swig compiles as independent library 2008-05-06 17:23:27 +00:00
722f24d153 Fix for bug: drawing x-ray and transparency with sets didn't
work well, now it draws those type of objects from sets also
at the end.
2008-05-06 15:31:17 +00:00
3ba9069c04 Fixes Makefiles for mac_compat_glext.h by updating some include paths.
Kent
2008-05-06 09:43:28 +00:00
04d2a8badc Fix for bug #10734: mirror modifier crash with no axis
enabled for mirroring around.
2008-05-06 08:35:19 +00:00
ee87af1e16 Bugfixes:
* NLA scaling was being incorrectly handled with fractional values. This was caused by clamping to integers instead of floats when making sure the scale value was positive. 

* Added checks to help prevent some weird cases that may sometimes occur and cause problems
2008-05-06 07:10:30 +00:00
2b1797d07b == FFMPEG ==
Fixes: [#10703] loading an .avi captured by dosbox causes a segfault
We shouldn't try to close a codec, if we haven't managed to open one... :)
2008-05-05 22:08:50 +00:00
1989e757b0 Add support for GLEXT in MSVC project files - continued: also support BlenderPlayer and release config 2008-05-05 21:33:06 +00:00
b6f5679cf5 Fix for bug #10542: changing particle visualisation type from object to
something else didn't work correct.
Fix for bug #10478: particle system point cache problem.
2008-05-05 21:10:32 +00:00
Maxime Curioni
914a4d1a6c soc-2008-mxcurioni: lib3ds compiles as an external library 2008-05-05 19:26:10 +00:00
95ed34be4a Fix for bug #10444: environment map crash with qmc. 2008-05-05 17:43:13 +00:00
d5ffcda5dc Fix for bug #10347: particles reset with orbit around selection
option, was doing unnecessary dependency graph calls.
2008-05-05 17:41:14 +00:00
0b7ab2f8ec Merge from trunk
svn merge -r 14626:14692 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-05-05 17:30:33 +00:00
b36fe51c7d Fixed some indentation, I stumbled across (spaces vs tabs)
and also removed return 0 from a void stub.

Kent
2008-05-05 17:29:11 +00:00
Maxime Curioni
102868467b lib3ds, swig added to extern/freestyle 2008-05-05 17:28:14 +00:00
4c0bcbf4da fix for bad indexing found by Cyril Brulebois
Its making the identity matrix so I just removed the initalizing values
that were out of bounds.

Kent
2008-05-05 17:26:33 +00:00
Maxime Curioni
ec90691384 merge to 14689, Freestyle library changes, SConscript start 2008-05-05 16:56:44 +00:00
945a083e70 Bugfix:
IPO-Smooth should now give better results. It uses a moving-window approach, which looks at two points on either side of the point in interest (a total of 5 in optimal conditions), and does a weighted average on it.
2008-05-05 06:38:19 +00:00
02afc94932 fix for [#10458] Rc4 Blender crash when activate playback FPS than Alt+A to play animation. 2008-05-05 06:30:19 +00:00
65b2f4397c matt ebb found a case where removing the "Real" world button was bad. 2008-05-05 01:46:35 +00:00
Ken Hughes
17db1906c8 Fix potential buffer overflow (found by Cyril Brulebois). 2008-05-05 00:42:18 +00:00
da3b15be00 BGE patch: add support for GLEXT in MSVC project files. User must update glext.h in SDK directory: C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\gl\glxext.h. Get the latest glext.h from http://www.opengl.org/registry/ 2008-05-04 21:20:22 +00:00
cf654b44b6 Fix BGE bug in patch #8724 (memory optimization): serious problem with alpha texture when Use Blender Material is active and several objects have same texture. This bug messes up greatly with OpenGL texture. The GE is not usable without this fix. 2008-05-04 21:14:38 +00:00
32099649e3 == Sequencer ==
Added the missing directory selector button for proxy custom storage...
2008-05-04 17:03:10 +00:00
c734c0b199 hopefully the last one... 2008-05-04 15:56:59 +00:00
175a0c34f7 == Sequencer ==
Fixed order of operation in 3-way color corrector according to

http://rebelsguide.com/forum/viewtopic.php?t=810

Thanks to mindrones for pointing this out.
2008-05-04 15:39:27 +00:00
6c05a92fe1 missed out on some BLI_convertstringcode's, also found that playing relative quicktime paths from the python api never worked, was using the 'Scene' type cast to a char. 2008-05-04 15:02:48 +00:00
4983308a38 svn merge -r 14649:14676 https://svn.blender.org/svnroot/bf-blender/trunk/blender (sorry - forgot half of the commits last time) 2008-05-04 14:14:54 +00:00
Ken Hughes
7aa6833499 More compiler fixes for BLI_convertstringcode calls 2008-05-04 14:14:09 +00:00
e6be454787 More compiler fixes for BLI_convertstringcode calls 2008-05-04 11:09:30 +00:00
5e3f871f65 also look for ndof plugin in $HOME/.blender/plugins/3DxNdofBlender.plug, for linux distro's where blender is installed in /usr/bin/blender, installing plugins in /usr/bin/plugins would not be acceptable. 2008-05-04 11:00:33 +00:00
0dfd373c39 More fixes for compiling 2008-05-04 10:48:45 +00:00
b7de3918fb Fix for compiling with FFMPEG enabled due to BLI_convertstringcode 2008-05-04 10:28:10 +00:00
110f927c63 Changed frame numbering to only alter hashes if they are in the filename (not the directory name) to fix bug [#10566] File Open Dialog replaces '#' with '0' in directory names.
removed frame numbering from BLI_convertstringcode into its own function (BLI_convertstringframe), many uses of BLI_convertstringcode were passing dummy frames values anyway.
in cases where adding the current frame number to a filename is needed run BLI_convertstringframe(...) after BLI_convertstringcode(...)

There are some cases Im not sure BLI_convertstringframe is needed, these have been commented as todo, but at least have the same functionality they used to.
2008-05-04 09:41:15 +00:00
f95c1141db change default for darwin for better compatibility with gcc4.0 2008-05-03 17:04:28 +00:00
275f1b6f49 own error assigning a value out of array bounds thanks Cyril Brulebois for pointing this out. 2008-05-03 09:35:20 +00:00
f190e4e0e2 Added missing menu entries for Preview Range tools 2008-05-03 02:50:07 +00:00
2b5432e6bb Added control over distance to kept form target mesh
Quad bug was fixed by splitting the quads that are feed to RayTree
2008-05-02 22:09:01 +00:00
5ad6b3f8dd == PyNodes ==
More bug fixing, reports by Juho (bebraw) Vepsalainen (thanks!)

#10340: a recent fix I made broke handling of pynodes with buggy scripts when loaded from a .blend. (This may have been the reason for #10341, too, caused by saving buggy typeinfo.)

http://projects.blender.org/tracker/?func=detail&atid=125&aid=10340&group_id=9
2008-05-02 20:41:33 +00:00
e7a106625c BGE bug fix: set parent actuator change the orientation of object 2008-05-02 17:22:28 +00:00
f0a41d9d97 Partially revert BGE bug fix #8863: don't send keyboard sensor positive pulse on level, this would badly interfere with keyboard sensors controlling set scene/restart scene actuators. Only send negative pulse on level to stop actuators after scene suspend 2008-05-02 15:47:08 +00:00
b846e7a3bf fix for #7314
solution provided by Leandro Inocencio
2008-05-02 15:45:15 +00:00
e1090eed41 Fix for bug #8825. find_first_point() finds first points of implicite surface in better way now. It goes
from center of every metalement to 26 directions and try to find every place, where implicite function 
crosses zero value. Size of step is size of polygonization cube. It can be proofed, that smaller size of step 
is useless.
2008-05-02 12:43:46 +00:00
caa7566ee2 wizard_curve2tree was opening FBX wiki docs. leaf dupliface object was being offset each time the script ran. 2008-05-02 12:27:05 +00:00
ac634f565a remove a debug print 2008-05-02 10:48:14 +00:00
273829de61 fix for #10080 copy/paste operations were
broken after first on os X
2008-05-02 10:38:50 +00:00
da509d33c7 used fixed width font, set the command history to ignore dupes when pressing up/down 2008-05-02 10:33:32 +00:00
71284880d3 Bugfix: reading in function pointers from a 64 bit .blend on 32 bit
gave "memory block reconstruct: end corrupt" errors. This bug was
harmless, just gave ugly error messages.
2008-05-02 10:22:44 +00:00
9026559ded +normal projection optimized with RayTree (RE_raytrace.h)
+control for normal projection direction (default,inverted,both)

There are some bugs on projection over quads.. it seems to work 100% on fully triangulized meshs
2008-05-02 00:16:48 +00:00
9ea5788c37 == PyNodes ==
Bug #10104 reported by bebraw: missing check for how many node sockets were being created by a pynode script. Too many (more than MAX_SOCKET == 64) would crash Blender.

http://projects.blender.org/tracker/?func=detail&atid=125&aid=10104&group_id=9

Notes: moved the MAX_SOCKET define from node.c to BKE_node.h so I could use it in Node.c. Also improved error reporting in pynodes when errors occur in the init stage.

Thanks Juho (bebraw), Tom (assigned the bug to me) and Brecht (mentioned the MAX_SOCKET define).
2008-05-01 22:28:18 +00:00
d99ddc5cf8 Fix BGE bug #8863: Keyboard Sensor does not send negative pulse if key released while scene suspended. The fix covers keyboard and mouse sensor 2008-05-01 20:43:18 +00:00
57b819301c stop centering objects from moving children 2008-05-01 20:31:57 +00:00
ca83969287 deleting a vertex group didn't update the buttons window when the 3d view wasnt open. it also didn't update the 3dview weight paint colors.
copying a group kept appending "_copy" and rose an error when the string was too long. now just add one _copy prefix and number uniquely.
2008-05-01 19:46:05 +00:00
Ken Hughes
a87d82023a Add library.name attribute, which returns the actual library name used by blender (this may be different from the library.filename attribute). 2008-05-01 18:52:26 +00:00
3eac2b2faa fix for [#10148] 3D preview render does not update on mouse rotate and pan
(own fault when replacing magic numbers)
2008-05-01 18:46:50 +00:00
Nathan Letwory
be303d0f8e * add MSVC9 check for lib_vs2008. (CMake users, please verify. Provided by zebulon). 2008-05-01 18:20:00 +00:00
8c1b594ed3 Surface bugfix (reported by jms on the french newsgroup)
Adding Donut or Sphere surfaces with the Align to View option turned on added broken surfaces.

Those two surface type were always aligned in the past and their creation method were not made to deal with this. Fixed now (that is, they are aligned to view and created correctly if the option is on).

There might be other cases of this bug elsewhere.
2008-05-01 18:16:21 +00:00
0d1aa8d7bf Fix for bug #10144: "set editable" on a disabled particle system
could cause crashes.
Fix related to bug #10198: particle mode didn't respect undo steps
set to 0.

Also made the memory statistics print (ctrl+alt+shift+q) use the
more human readable form to give an overview, instead of printing
out a python script.
2008-05-01 17:31:01 +00:00
31adad5b4d Fix BGE bug: dynamic-but-not-rigid objects are added as rigid body during the game. 2008-05-01 16:00:59 +00:00
09e102fd01 [#8397] "playback fps' jumps all over the map
average over the last 8 times to reduce flickering. ideally this would show how many frames were drawn in the last second. but I think this is good enough just to get an idea how fast the animation is playing without annoying flicker.
2008-05-01 14:51:06 +00:00
Stephen Swaney
6613ac0d88 Change plugin.def to pluging.DEF for case sensitive operating systems.
File is source/blender/blenpluginapi/plugin.DEF
2008-05-01 14:22:21 +00:00
Nathan Letwory
4e9cbe2ac7 * copy plugin header stuffies too. 2008-05-01 13:54:25 +00:00
eef2b7e125 Complement to bug fix #8869: crash with alpha mesh 2008-05-01 12:35:21 +00:00
Nathan Letwory
5fc05184c8 * remove redundant line. 2008-05-01 11:33:52 +00:00
Nathan Letwory
0b3118980f * add missing int rel to BPy_Library and BPy_LibraryData 2008-05-01 08:11:08 +00:00
Ken Hughes
3d2758a3bd Add support to bpy.library module for relative paths. 2008-05-01 05:52:35 +00:00
64f5d1bdf3 Nearest-vertex mode optimized with kdtrees
currently uses the kdtree code avaible on blender
2008-05-01 01:00:01 +00:00
Nathan Letwory
ada5f0403e * Fix Verse bug [#8959] Clients doesn't connect if libverse.a is compiled with -O2
Merged from Verse SVN (r4524). See Verse bug tracker for bug report.
2008-04-30 22:42:12 +00:00
5fef83b0ce fix for bugs
[bf-blender-Bug Tracker][6693] x3d export bug in V2.44 release
[bf-blender-Bug Tracker][7773] .x3d exporter problems (moving meshes away)
Updated how objects are transformed, and use Mesh rather then NMesh.
also removed vertex color saving since it was really slow and vcolors are stored per face in blender.
2008-04-30 22:30:52 +00:00
3a430c33d2 fix BGE bug #8869: Added objects are not lit correctly
The current layer information is now stored in KX_GameObject and inherited from the parent object when dynamically added. This information is used during the rendering the select the lamps. As the selected lamps are always coming from active layers, their position and orientation are correct.
2008-04-30 19:58:44 +00:00
27afa69c9a svn merge -r 14561:14627 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-04-30 18:30:11 +00:00
10ce8e3281 Merge trunk with branch
svn merge -r 14551:14626 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-04-30 18:14:27 +00:00
29f0f74b05 Changed a bit of code structure to make method optimization easier 2008-04-30 17:55:26 +00:00
Maxime Curioni
1cf3378793 Added Freestyle to extern/ directory 2008-04-30 15:41:54 +00:00
93ba2dd6a1 Fix for bug #9867: issues with making particle systems local. 2008-04-30 13:29:57 +00:00
e997e6b1fc Fix for bug #8963: there was still an issue with SSS and transparency
in the shading because of ramps.
2008-04-30 12:02:09 +00:00
b1d841f2c4 == bugfix ==
fix for [#6580] invalid file names not handled consistently when saving
only affects windows, where invisible file stream could be created if filename contains ':'
2008-04-29 21:43:17 +00:00
4be6ef5758 Fix for bug #8910: FSA + spotlight halo not working correct together. 2008-04-29 19:51:23 +00:00
e7c3ff6458 == mmap for win32 ==
replacement for mmap/munmap on Windows.
Implemented using CreateFileMapping/MapViewOfFile.
2008-04-29 18:41:34 +00:00
391bd70d42 Fix for bug #9014: crash saving the depth pass with openexr or hdr,
both file formats crashed on saving images with less than 4 channels.
2008-04-29 16:57:39 +00:00
b6a6507ddf getting ARB shaders working again in GE.
This is is a kludge, and only to get a release
working. later solution is to use glew
2008-04-29 16:22:13 +00:00
17d83bfefb Fix for octree filling print when rendering, the counter was per object,
now counts all faces as it did before.
2008-04-29 15:19:58 +00:00
d5bfb1b6d9 Fix for bug #8949: diffuse tangent shading did not use correctly
normalized normal. Patch by André Pinto, thanks!
2008-04-29 13:51:47 +00:00
8370991710 Fix for bug #9657: ipo's on the object in particle object visualisation
didn't always get correct time.
2008-04-29 09:56:52 +00:00
db9c14a574 fix gcc warnings 2008-04-29 08:24:33 +00:00
cc22fddec8 Bugfix #9676; Assigning Driver to Own Object when Pinning IPO Editor
When the IPO Editor is pinned, drivers will now be handled as if they belonged to the object that the ipo-belonged to when the ipo was pinned. This behaviour is more predictable than using the active object.
2008-04-29 03:19:11 +00:00
Nathan Letwory
484a00a817 * make makesdna dependant on DNA header files too, instead of relying on makesdna dependency only.
Fix through pointer by jaguarandi. Thanks!
2008-04-28 22:19:03 +00:00
723397bb91 running scripts in background mode would crash blender when checking a scriptspace areas 2008-04-28 21:54:03 +00:00
96cec2e99b if a blend file was opened with /./ in the path (for example "some/./path/to/./model.blend" ) the relative paths from created from that location would be incorrect. This results in linked library paths being loaded incorrectly. 2008-04-28 21:29:15 +00:00
082b706e8d Fix for bug #8865: on mac os x, with certain processors (I'm guessing
Intel Xeon only), doing a lot of mutex locking is really slow. Getting
the image  buffer for each texture read then made using more threads
actually slow down the render. Now I've split up the function in two
parts, one parts that checks if the image is available, and another
that does a mutex lock and loading if needed.

Changes quite a lot of code, so hopefully doesn't break stuff, but it
seemed to survive test with rendering a number of frames using all
image types and many threads, though this kind of threading problem
only happens once in a while .. so hard to test for.
2008-04-28 20:57:03 +00:00
Nathan Letwory
7d1b40d890 * improve the clean code. Instead of doing it the dumb way, do it smarter. 2008-04-28 19:48:44 +00:00
Maxime Curioni
f12cf0e250 Merged changes from trunk to soc-2008-mxcurioni, to revision 14603 2008-04-28 19:21:51 +00:00
34c1699e7e fix for [#9649] svg2obj.py needs a patch,
slight change to the fix suggested, the svg imported was assuming that
"fill:" and "#" being in a string meant there was "fill:#", but the # could be used for other properties.
2008-04-28 19:13:38 +00:00
d6400179d2 vertex parents to a mesh that no verts would crash blender 2008-04-28 17:14:56 +00:00
Nathan Letwory
a9ab9f4bde * make sure makesdna executable gets removed on scons clean. 2008-04-28 17:14:20 +00:00
23660800b6 Cloth: Old RC1 and RC2 files with cloth should open again and not crash (after the DNA rearrangement to fix a bug yesterday). But be carefull your settings get lost. Best thing to do: 1. write settings down, 2. open blend in new (>=17 subversion) blender and just save the file (and ignore warnings on the command line.) Take this as a good example why not to use svn blender versions for production purposes ;) 2008-04-28 17:02:55 +00:00
Maxime Curioni
812a0eb1fb Merged changes from trunk to soc-2008-mxcurioni: svn merge -r 14534:14595 https://svn.blender.org/svnroot/bf-blender/trunk/blender/ 2008-04-28 16:21:26 +00:00
Ken Hughes
2a3d159b06 Add BF_X264_CONFIG and BF_XVIDCORE_CONFIG flags to scons, to allow passing
configuration info for cross-compiling to ./configure scripts.  Also let
makesdna use PLATFORM_LINKFLAGS.
2008-04-28 16:14:31 +00:00
c6554898cc fix for [#9651] raw_export.py tooltip outdated?
own error, bpath looper was trying to free NULL pointer,
added fromOrig to python mtex api
made FromOrig and FromDupli tooltips be understandable
2008-04-28 16:09:17 +00:00
ae4179e704 Fix for displacement baking when it doesn't find a hit. Instead
of writing 0.0 it now writes the neutral value of 0.5.
2008-04-28 14:54:24 +00:00
a0b2195a8d Fix for bug #9652: "draw zbuffer values" in the image editor did
not work correct.
2008-04-28 13:33:52 +00:00
514580d39d Bugfix:
Restored Border-Select in the Action Editor for Action Channels. Was removed when doing the recode and never added back, hence a regression.
2008-04-28 12:26:41 +00:00
3fcc7095e8 Fix for bug #9687: crash with FSA when compiling with openexr support.
FSA requires exr, so I've disabled the buttons too in that case. I also
noticed CMake doesn't enable openexr by default, but a lot of the render
code relies on it, so I've enabled it by default now.
2008-04-28 12:14:30 +00:00
dfbc6213b5 == Action Editor - Group Colors ==
Made option to show group colors the default. If this is too colourful for you, disable it in the View menu.
2008-04-28 11:40:38 +00:00
2706c62231 Fix for bug #9504: compile error with verse on mingw, also fixed
in verse svn.
2008-04-28 11:05:01 +00:00
Nathan Letwory
8188fd9b97 * try/except block around import of BoolOption, to make sure one can use scons-0.98.2 to compile with. 2008-04-28 10:47:45 +00:00
de8b30a424 Bugfix #8937: Action constraint for non-armatures shows lag on clear transform
The problem here was that the owner instead of the workob was being used to find the effect of the action constraint.
2008-04-28 10:35:51 +00:00
Nathan Letwory
7a54b35a3e * add small bit of docs about BF_CONFIG 2008-04-28 09:41:51 +00:00
9455275490 == Action Editor - Action Groups finishing touches ==
* Added a new tool "Synchronise with Armature" (found under Channels->Grouping), which synchronises the grouping of action-channels and the grouping of their relevant bones. 

This only works when the active object is an armature, and the action isn't pinned. All of the action's action-channels are removed from their groups, and are added back into groups according to the current grouping of their corresponding bones. 

A bit of testing for weird cases is needed.


* Group colours are now not drawn if the group originally was using the 'default' colour-set.
2008-04-28 07:38:06 +00:00
cf84cf5f21 Bugfix:
The Outliner was being built incorrectly, leading to fake "IPO-Driver"-linked objects being shown under IPO's. These were caused by a missing break statement, which lead to the IPO case flowing on to the Action case. This could cause crashes with undo on some computers.
2008-04-28 05:14:26 +00:00
5b691071cf Assorted tidy-ups for keyframing (including auto-keying), while trying to track down a bug. 2008-04-28 04:46:28 +00:00
961d8c5cd4 Adding new poses to a PoseLib also creates Action Groups in the PoseLib, just like for keyframing. 2008-04-28 00:51:31 +00:00
1b45506f0a Compiler warning fixes:
* in scene.c in blenkernel, set_last_seq (defined in src - editseq.c) is called... this may/may not need some stubs for game-engine stuff
* removed unused vars due to old particle-effects stuff
2008-04-28 00:40:38 +00:00
8a44cfb217 Subversion bump because of big cloth struct change 2008-04-27 22:34:19 +00:00
0d39ee1e76 follow-up for the universal darwin config.py
also added bal level call stub for set_last_seq,
player building was broken by recent commit
2008-04-27 22:05:53 +00:00
3a3ff9c9dc Bugfix: 32bit cloth files were loaded bad in 64bit blenders and the way arround. The e.g. GUI-only variable 'mass' was reseted to 0. Problem: makesdna doesn't cry out on compile - I wonder why this differences could happen. Solution: Rearange cloth DNA, resort things, clear up and bug was gone - weird. Problem left: Every file having cloth enabled before this revision is incompatible with this version. If anyone know a better solution, please go ahead 2008-04-27 22:04:47 +00:00
5add2d8c3e take 2, disable enter editmode and enter editmode in .B.blend, commited rev 14289 but had to be reverted because other changes were made. 2008-04-27 21:44:28 +00:00
7c99131ece attempt for an universal Os X config file
should work both on intel and powerpc
from 10.36 (ppc only) to 10.5

please test
2008-04-27 21:21:21 +00:00
9101d5689f * Group unlinking wasnt removing groups from particle systems, or render layers light overrid.
* BPath sequencer strip looper was only operating on the active scene, now look through all scenes.
* The active sequence strip wasnt being reset when scenes switched, so you could see the previous scenes strip when switching to a new scene.
2008-04-27 20:43:25 +00:00
Nathan Letwory
1da7742b8a * change BF_CONFIG so that it is understood as 'user-config.py' instead of config/platform-config.py it tried to do before. If defined, it overrides the search (and potential use) of user-config.py.
It didn't work before anyway, so this change should affect nobody.
   usage: scons BF_CONFIG=someconfigfile
2008-04-27 20:17:14 +00:00
Nathan Letwory
ec02fff2aa * make sure BF_CONFIG is an accepted ARGUMENT 2008-04-27 19:51:49 +00:00
928b676b99 Implemented shrink modes are now:
+ Nearest surface point
+ Normal projection
+ Nearest vertex (gives similar results to nearest surface if the target mesh has many vertexs and is a lot faster to calculate)
^^ all bruteforce calculation for now

+ fixed matrix order multiplication
+ request for CD_MDEDEFORMVERT
2008-04-27 19:29:40 +00:00
Ken Hughes
e10cb55936 Make "scons clean" remove config files for ffmpeg, x264, xvidcore. Also
replace tabs with spaces.
2008-04-27 19:20:35 +00:00
Nathan Letwory
6553b71271 * let's copy *all* FFMPEG libraries, shall we? 2008-04-27 19:13:40 +00:00
7f985f3399 == Multires ==
Fixed bug #9680, Crash on render

Caused by multires sometimes looking at editmesh data rather than mesh data during render
2008-04-27 18:26:43 +00:00
57c1fbe557 remove old particle system.
also removed quat, dquat, and sumohandle from the Object struct since they aren't used anywhere.
2008-04-27 18:26:20 +00:00
9ea254ca34 == imagebrowser ==
fix international font handling, filenames weren't displayed due to lack of utf8 conversion. Works like in filesel now.

For future release, iconv library (for Windows) needs to be updated to support locale_charset for getting the current system charset settings.
2008-04-27 18:25:52 +00:00
0b7900d081 this commit allow to pass custom compile flags
to all ffmpeg related libs

ffmpeg use it own build system and dont respect 
the flags in config.py

define BF_FFMPEG_EXTRA in config.py to pass 
those flags.

I use this on Os X to pass the SDK vars :
-isysroot
-mmacosx-version-min
2008-04-27 18:22:07 +00:00
31fffd00d3 svn merge -r 14505:14561 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-04-27 17:22:57 +00:00
Nathan Letwory
7e7118aebb * copy FFMPEG libraries on Windows to BF_INSTALLDIR when done. 2008-04-27 17:00:22 +00:00
2740bbc89c Update MSVC project files to support ffmpeg. Make sure you do svn update in lib/windows to link with latest ffmpeg libraries 2008-04-27 15:02:37 +00:00
8207e6174f Make apply size/rot take children into account (apricot request) 2008-04-27 14:29:49 +00:00
db18b47be5 fix for own error when trying to fix python command line crash,
was calling screenmain() before executing the python script which meant it was never executed (therefore no crash :) )

Moved screenmain() back to the the end of main() and added a TESTBASELIB_BGMODE which checks for G.vd and uses the scene layer if its not there. Of course python should not be running stuff that uses G.vd :/

Also made python scripts stay attached to screens when LOAD UI is disabled. This means you can load a new blend file and the python console can stay open, has been tested for a while in the apricot branch.
2008-04-27 11:37:57 +00:00
bc059cb8b2 BGE bug: crash when an object being tracked-to is deleted (bad practice anyway). Fix by creating a generic cross reference between actuators (only TrackTo uses it at the moment) and objects so that the actuator is informed when the target object is deleted 2008-04-26 20:41:25 +00:00
c8376869b1 BLI_split_dirfile was being used in cases it should not have been,
Added BLI_split_dirfile_basic, that only splits the path into directory and file. without checking the dir exists or creating it, without changing the original string that is passed to it.
2008-04-26 13:08:57 +00:00
19985ae918 Fix for bug #9664: switching to particle edit mode with ctrl+shift+tab
from paint modes didn't work correct.
2008-04-25 20:52:40 +00:00
Ken Hughes
bc18e9e290 Suggestion by GSR; move "extern C" into header file, remove "_" from
utf8towchar function name.
2008-04-25 19:18:24 +00:00
7374d23b61 Merge trunk with branch
svn merge -r 14529:14551 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-04-25 18:28:59 +00:00
a0add959ff Shrinkwrap skeleton code
+vertex weights supported
+target object now saves to file: load/save works :)

for now simple moves objects vertexs to the nearest vertexs on target object
(so that I can test if its working correctly with the modifier API)
2008-04-25 18:22:20 +00:00
2a72b986d4 removed BLI_split_dirfile, it dosnt work with relative paths.
it also makes a directory if its not there, need to look into other uses of this function.
2008-04-25 17:52:25 +00:00
Ken Hughes
f4cb93bf1f Remove redundant utf8towchar() from FTGL code. 2008-04-25 17:11:37 +00:00
3a4f23aa78 == PyNodes ==
1) Added support for a var called "__node__" in pynode scripts, that can be used to point to the desired pynode object, to make sure it is chosen.

2) Fixed a semi-obscure crash that could happen when reparsing a pynode script that was used by multiple nodes in different scenes. Memory corruption would happen if the reparsing failed during the recreation of the pynode object, not when executing it.
2008-04-25 16:35:52 +00:00
feb440c2cd added sequencer paths to bpath iterator, This needed to use get/set filename callbacks internally because the sequencer stores dir/file separately.
This means when moving large projects with many images/videos/sounds is possible with 'File, External Data, Find Missing Files'.
- needed so we can put peach animatic, glrenders & testrenders on the dvd.
also datatoc.c - brecht's fixes from apricot.
2008-04-25 16:09:16 +00:00
b94f3d0fcb fix/workaround for blender crashing when running python runs text.clear() in background mode. ideally python api would not use this function. 2008-04-25 10:12:32 +00:00
Ken Hughes
33bbe7f340 Fix compiler warning about nested C comments. 2008-04-24 21:35:56 +00:00
9b9359120f BGE bug: fix a crash at game exit caused by inconsistent controller map after object deletion. The bug became apparent since the memory leaks have been fixed. 2008-04-24 21:26:39 +00:00
Ken Hughes
4d1d60e236 Duplicating UTF-8 changes from Revision 14536 in another place in the source tree. Pointed out in IRC by Kent. 2008-04-24 20:10:01 +00:00
003b7cc1fe == cmake win32 ==
- fixed CMAKE files for Win32 for new ffmpeg libs
- ignore libc in debug build. 
TODO: debug build with OpenEXR still fails with unresolved externals due to /MTd flag.
2008-04-24 19:18:46 +00:00
Ken Hughes
28c2d1b2ae Interface
---------
Bugfix #9222.  Conversion from UTF-8 to wchar for international fonts did not
check for valid encodings, so user strings with containing invalid characters
could cause crashes.
2008-04-24 18:54:59 +00:00
f4cc03b0f1 Better fix for BGE bug #7892: dRot is reversed on dynamic objects. Make sure that graphic, Bullet and Sumo(deprecated) objects rotate the same way. This fix reverses the rotation of non-dynamic objects compared to 2.45: you will need to change the sign of dRot in 2.45 games for them to work correctly in 2.46 2008-04-23 21:48:17 +00:00
408fcd6a33 disallow changes to linked groups 2008-04-23 21:17:47 +00:00
b0db68ccb0 == PyNodes ==
Finishing a few needed things before the release: changed ShadeInput vars access from a single getAttribute function to individual methods, one for each var, for faster access (needed, since these are accessed over and over during rendering).

Very repetitive code, so I used a few macros to write it. Compiles w/o warnings here (linux, gcc 4.3.0), please report any problems.

This is just an internal change, the Python API is still the same.
2008-04-23 20:06:25 +00:00
4f49a3b906 added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
149f7f07d2 Merge trunk with branch
svn merge -r 14521:head https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-04-23 13:06:53 +00:00
087c66fd29 Added simple UI to configure some shrinkwrap modifier properties (simple commit to try svn) 2008-04-23 12:44:10 +00:00
2fb9b30485 Creating GSoC branch for mxcurioni 2008-04-23 02:20:01 +00:00
3552afeef2 Added missing redraws for Outliner after transforming and Object/Bone with AutoKey on.
This doesn't fix the problems with the corrupted IPO-driver channels in the Outliner after AutoKeying though. I'm not sure what's causing them, but I cannot even seem to be able to disable those channels.
2008-04-23 02:00:27 +00:00
Chris Want
71a2bd140a Creating GSoC branch for jaguarandi 2008-04-22 22:13:06 +00:00
c3d36b0a4b Fix for bug #9654: point cache was being reset too often, made
transforming unrelated objects slow.
2008-04-22 21:53:30 +00:00
ff26d59577 WITH_BULLET wasn't working for Makefiles.
I changed it so its tests are more inline with other defines.
Jesterking said this shouldn't affect scons so yell at him if it does. ;)

Kent
2008-04-22 19:14:33 +00:00
fa27b5bcc7 Script templates, metaball creation script from forTe, and camera script from macouno 2008-04-22 15:37:54 +00:00
20f2607c3a Patch from Paprmh (Rob)
forgot to update the check for valid sequence plugin version #
(The version bump didn't affect sequence plugins so missed it)

This patch also brought the plugin includes back inline with
imbuf stuff.  I'm putting it on my todo to see if we can't
remove this duplication so that this is not a reoccuring issue.

Kent
2008-04-22 14:53:15 +00:00
6672bb16cf use detectable autorepeat for X11,
this way, holding a key will only give multiple down events, father then down,up,down,up.... etc.
This is needed for apricot so they can play games in blenders :)
2008-04-22 14:32:45 +00:00
bee5b1137e Fix for bug #9489: particle uv coordinates were not correct
for children from particles on subsurf.
2008-04-22 10:34:41 +00:00
ea8ffd8201 Fix for bug #9491: cancelling bake didn't reset the simulation properly,
now it also keeps the already baked frames in the cache up to the point
is was cancelled.
2008-04-22 10:08:00 +00:00
d186ba591a == FFMPEG ==
Forgot to set audio_codec correctly on output. Shame on me.
2008-04-22 07:40:04 +00:00
fddb50d2b5 Added a check to make sure repeat value isn't 0. 2008-04-22 03:43:14 +00:00
65ca9c204c bpy sequencer api can add color strips, changing strip length wasnt re-allocating stripdata which was causing memory free errors, added proxy options, directort read/write and some more flags. 2008-04-21 22:17:49 +00:00
a1b1cfdc38 Cloth: Fix point cache memory leak when duplicating cloth 2008-04-21 22:02:15 +00:00
c9c3c41815 svn merge -r 14236:14505 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-04-21 21:30:50 +00:00
e2cac820f9 Update of the Urainian translation
Submitted by: Serhij Dubyk 

Kent
2008-04-21 20:57:23 +00:00
2a7fa9e147 == SCONS ==
added new ffmpeg libraries to scons win32  msvc build.
2008-04-21 19:24:30 +00:00
46847c8a84 Bug fix for 8634, 6708, and 5989
This replaces the hard-coded '%PROFILE%\Application Data\..." path 
with the correct language-dependant CSIDL_APPDATA.

PLEASE NOTE!

Checks for the previous location have now been REMOVED. Any data
saved in the old hard-coded location will no longer be found by 
Blender (this will only affect users of non-english windows.)

The installer has been updated to help the user to migrate their data
to the new location of their choice, if necessary.

Order of preference for .blender on windows is now the following:

1) %HOME% environment var
2) Installation Directory (location of blender.exe)
3) "Current User" (CSIDL_APPDATA)
4) "All Users" (CSIDL_COMMON_APPDATA)
2008-04-21 15:53:32 +00:00
b818118379 Fix for bug #9487: converting particle system with dupliverts
to the new system didn't work correct.
2008-04-21 10:15:01 +00:00
7c68038353 Fix for bug #9093: array modifier merging didn't work
entirely correct after a recent bugfix.
2008-04-21 09:24:04 +00:00
Chris Want
4ca900bcec Small fix from GSR for using pkg-config to find OpenEXR libraries 2008-04-21 03:55:39 +00:00
d71d1f2568 Chance wind scaling to be the same as particles 2008-04-20 21:56:49 +00:00
9098de4479 second attempt to fix compilation problem with 2D shaders on systems without GLExt or without shader support: use GL_ARB_shader_objects to conditionally compile the 2D shader code 2008-04-20 21:01:13 +00:00
8ac1330b74 Patch from Mario Lapin, fixes [#7394] 3ds File Import is broken 2008-04-20 19:27:48 +00:00
7fb4c95503 Cloth: Wind was working the way arround due to wrong formula, reported by nudel 2008-04-20 19:25:23 +00:00
86725b0e8c deleting an ipo vert didnt update the object/bones position 2008-04-20 18:34:30 +00:00
7032029b47 missing check for NULL 2008-04-20 18:19:15 +00:00
f80089c753 == FFMPEG / mp3lame ==
Added libmp3lame to extern. (Ton that was the last one for this release,
promised :) )
2008-04-20 16:28:21 +00:00
9629d8e561 The mdd exporter was skipping the first frame, fix from bill nieuwendorp (slow67) 2008-04-20 16:18:43 +00:00
b43f24a944 Reverting new epsilons since they had bad global impact - instead just remove the problematic normalize() call 2008-04-20 09:57:28 +00:00
f265eeed8a Fix for bug #9081: SSS preprocess should not use material or
light overrides, since it works independent of render layers.
2008-04-19 21:59:15 +00:00
f3c3da530c Fix for bug #8963: area light + cubic shading became darker
for values > 1.0, luckily for peach this bug was not present
for other light types.
2008-04-19 21:58:11 +00:00
bdf5c0689b BGE bug fix: crash at exit when object with Radar/Near sensor has debug properties 2008-04-19 21:15:37 +00:00
b0049e6088 fix BGE bug #8094: Collision sensor on child object makes the object rotate or move very fast. Collision sensor can now be set on child object without side effect. 2008-04-19 21:09:40 +00:00
eb7edc4cba bug since 2.45 nobody noticed, canceling retopo would move the vert. 2008-04-19 19:50:46 +00:00
0a31175101 fix for own error - [#9481] Active faces won't go away. 2008-04-19 19:19:39 +00:00
bb2f837907 Removing wrong checks before NDofTransform call.
This would cause a very tiny inconvenience where ndof transform wouldn't work if there wasn't an active object (so, only a problem after you delete something and then select objects without setting active).
2008-04-19 17:55:35 +00:00
0441b5354d [#6932] Cal3D Exporter Distort Vertex
Removing cal3d importer, since the soya3d maintain their own and I could not fix a bug in weird bone exporting.
2008-04-19 17:38:40 +00:00
c870ed1236 fix for [#7430] No way to back out of a PupStrInput() dialog 2008-04-19 11:44:09 +00:00
8a888dbdc7 bugfix for [#8256] Creating proxy from linked mesh object removes materials 2008-04-19 11:23:50 +00:00
d00a0e56f6 fix for [#8236] Lens Change by driver won't update in 3d View
Lamps would not update either.
2008-04-19 02:19:46 +00:00
92f15c7c0c applied patch from Boris van Schooten, [#8148] Animation bugfix for md2_export script
made some other small fixes while testing. (divide by zero errors)
2008-04-18 23:04:54 +00:00
1fc1fb117e BGE: fix compilation error with 2D filters on System without GL extenstion: add conditional compile statements 2008-04-18 22:22:50 +00:00
10a396d4b7 bugfix from Teppo Känsälä, makes moving textures up/down also move their enabled state.
bug: [#9437] Moving texture up/down bug
patch: [#8938] Moving texture up/down to also move 'enabled/disabled'-status of texture
2008-04-18 22:13:22 +00:00
7ca3a1e135 Blenderstorm: idea #164: Hide useless World Shading buttons
Simple button change
2008-04-18 21:59:54 +00:00
55620ca5d1 ipo transform didnt take NLA scaling into account when getting the boundbox 2008-04-18 20:55:29 +00:00
981d380fc4 This is an expanded patch of this:
[#8067] external texture plugin thread-safe modifications
Submitted By: David Anderson (davywavy)

It makes it so the "result" array is passed in, instead of a global var.
I expanded the patch so it will play nice with older plugins  that are not
thread safe as well.

I also updated the existing plugins in the release, so they are thread safe.

---------------  What do people think of this.... ------------------
This should maybe be talked about in the functionality board or something,
but what do people think of adding in default texture/sequence plugins.
or making a seperate tree like lib for plugins.

The reason I ask is we have had a couple of upgrades to the plugin system.
(supporting float buffers for sequencer, and this one for textures)

http://www.cs.umn.edu/~mein/blender/plugins does not store revisions of 
plugins I just make sure they work with the latest version.  This is
getting messy.  I haven't upgraded a lot of them to use floats (I know,
I'm lazy, and now this will also make modifications to the plugins)
It would be nice to have some of the standard ones under revision control.

We also seem to be having an explosion of platforms supported.  It would
be nice to have platform maintainers compiling plugins as well for releases.
(Its getting to be more work for me to keep up with things...)

I'll go back to my corner now and be quite. ;)

Kent
2008-04-18 19:10:03 +00:00
4147a5a33d Fluid: got to the real problem of the issue --> wrong float epsilon resulted in normalizing a vector to fail, reverted other change from today 2008-04-18 18:25:11 +00:00
23016d59d4 Yesterday was not my day. Forgot about end of string.
Kent
2008-04-18 14:25:36 +00:00
2318e47ae9 Fluid bugfix [#8395] [#6200]: this should solve the popping/inconsistency/flickering issue with fluids, please give feedback :) 2008-04-18 14:12:42 +00:00
Ken Hughes
60de9d9b2f More changes to GET_INT_FROM_POINTER and SET_INT_IN_POINTER to get rid of
other warnings that only occurred with 64bit systems.  Wish I'd known about
these macros earlier!
2008-04-18 00:21:40 +00:00
be0b8ccfaa Used GET_INT_FROM_POINTER to get rid of many warnings that only occurred with 64bit os's
Also use Py_ssize_t which we might need to define for older python's
2008-04-17 21:14:55 +00:00
45dee507aa I can't spell ;)
(typo fix in the comments)

Kent
2008-04-17 20:29:57 +00:00
9a19ab21b5 milkshape3d model importer, can import a textured model with materials and animation 2008-04-17 20:15:37 +00:00
Ken Hughes
a1689a5e9a Change scons so OpenMP library is appended at end of linkage line with other
libraries (fixes a problem with statically linking OpenMP).
2008-04-17 19:01:00 +00:00
0ecf7a6f5b My last commit for the sscanf buffer overflow did not really fix the
problem.  Now the fixed length strings are limited in the sscanf so
it should be much better now.

Kent
2008-04-17 15:41:06 +00:00
da3c44958e Bugfix for [#8962] Blender crashes on joining meshes with python
blenders screen needs initializing before running python scripts when not in background mode.
2008-04-17 14:10:40 +00:00
13b9b0ae03 Fix for bug #9075: the crash with stars rendering was not
completely fixed yet.
2008-04-17 12:11:15 +00:00
3175ecbcc0 Mot importer from ZanQdo 2008-04-17 08:43:22 +00:00
Chris Want
5d0a207ecb Patch from GSR that a) fixes a whole bunch of GPL/BL license
blocks that were previously missed; and b) greatly increase my
ohloh stats!
2008-04-16 22:40:48 +00:00
3a9624fd77 ZanQdo fixed exporting of mot files 2008-04-16 20:03:59 +00:00
c24e1896bc BGE: SetCamera actuator tool tip updated to reflect new feature: ...Leave empty to refer to self object 2008-04-16 18:58:11 +00:00
35e655cd5a BGE: Fix restitution: object will now bounce according to material restitution setting 2008-04-16 18:47:36 +00:00
db86a05173 This is a patch from the FreeBSD people:
http://www.freebsd.org/cgi/cvsweb.cgi/ports/graphics/blender/files/patch-source_blender_blenlib_intern-storage.c

Kent
2008-04-16 17:53:09 +00:00
867e12836b This patch spawns from this game engine issue:
[#7113] GE crash pressing as soon as P on 64 bit


Note:         glext.h has been removed from the source
        If you get errors compiling with it you have 2 options
                download/install 	glext.h        (preferred method)
                or set WITH_BF_GLEXT=false
        If your a user and having problems with game engine try
                setting the env var: WITHOUT_GLEXT 1

Kent
2008-04-16 17:40:59 +00:00
d482b3285c == Action Editor - Group Colours for Channels ==
It is now possible for Action Channels to be displayed using the colour of its group. The colour for an Action Group is only set when it is auto-created by keyframing (controls to tweak this may/may-not be added, time permitting). 

To enable the display of these colours, the View -> 'Use Group Colors' must be enabled. However, this is disabled by default.
2008-04-16 11:02:08 +00:00
68418a9bce Fix for bug #9017: crash in stars rendering. 2008-04-16 09:08:02 +00:00
83c5401896 replace magic numbers with constants for (G.vd->persp), view naming was also using persp as a flag which worked but isnt correct. 2008-04-16 08:48:49 +00:00
6b2a65a3b6 Bugfix #8948: Transformation constraint - destination rotation is in radians
Unfortunately, my previous fixes here to get gears working resulted in this problem. The flip side of that was that gears worked for quite a few cases. 

Alas, it is not to be... The bug is now fixed, but gears no longer work any more. Sadly, there is not much I can do about this.
2008-04-16 07:33:54 +00:00
190c18a62a mistake in adding Ipo Extend mode menu 2008-04-16 07:27:42 +00:00
d5c1042ed8 Bugfix: editmode mesh transform was doing slow x-axis mirror
computations with the option disabled. Also small memory usage
optimization for vertex groups.
2008-04-15 18:07:04 +00:00
6e6a6cdf55 This fixes a Buffer Overflow Vulnerability reported by
Secunia Research

SAID: SA29818 (http://secunia.com/advisories/29818/)
Credit: Stefan Cornelius, Secunia Research

The old code trys to do a sscanf %s %d %s %d from a line in the
image file.

Now it copies over that line to a max buffer of size 540 chars before doing
the sscanf.  
(I just picked a constant that was siginficatly large)

It also checks to see if it gets all 4 values if not return NULL.

Kent
2008-04-15 15:52:18 +00:00
e971f84927 lock view area wasnt working when all bones were de-selected 2008-04-15 15:29:32 +00:00
0346ed80bd added a E as a key shortcut to IPO Extend Mode 2008-04-15 14:34:57 +00:00
67e2d05dcd Ipo View Option - Loc View Area - stops using each ipo's view area when changing ipo's. 2008-04-15 14:15:56 +00:00
13ec85aeb5 Bug #8950: dependency cycles weren't always printed correct. For
debugging, also added a name for each dependency relation, and when
a cycle is detected it now prints the full cycle to the console.
2008-04-15 13:07:56 +00:00
2147e74bc5 made sculpt axis locking use local/global space (using the transform space)
also added some checks for sculpt mixing with other modes (was possible to mix sculpt+posemode)
2008-04-15 09:20:13 +00:00
6bb327badc BGE fix: keep reference count consist on source object when replicating property copy actuator 2008-04-14 22:45:28 +00:00
815791920f terrain sculpting enhancements, axis locking and brush strength multiply by grid 2008-04-14 21:37:23 +00:00
566053319a fix BGE bug #8309: After Parent Object added to the visual layer, Child Camera won't follow.
This bug fix is made of two parts:
1) It's now possible to dynamically add a camera.
2) Empty camera name on a SetCamera actuator now points to the actuator's parent object if this object is a camera. 
This trick is useful to make current a dynamically created camera: just add a SetCamera actuator on the camera itself and leave the name empty. Later, when the camera is added in the scene with an AddObject actuator, either directly or via a parent object, you just need to activate the actuator to make the newly created camera current. If you set a name on a SetCamera actuator, it will always point to the original camera, even after replication.
2008-04-14 20:54:20 +00:00
0b8b4369c9 Patch #8034: "soft" option for halos, which avoids ugly intersections
with geometry, and makes halos look more volumetric.

Patch contributed by Markus Ilmola, thanks!
2008-04-14 19:48:14 +00:00
7eb1b45281 Fix for bug #7903 and #8960: arealight giving black borders and not
working correct with translucency. Removed a check that presumably
is an optimization, but can't work correct and also gives no noticable
performance difference in my tests.
2008-04-14 15:40:32 +00:00
f8a29350ad Fix for bug #8957: undo lost scenes assigned to screens. 2008-04-14 13:09:08 +00:00
6da7b60cd3 Attempted fix for bug #8349: QMC raytracing being very slow on some
computers, probably due to slow multithreaded malloc. Now each render
thread keeps a list of qmc samplers that it fills as needed while
rendering (since it is hard to predict the actual amount needed in
advance due to ray recursion).
2008-04-14 10:14:59 +00:00
3dcb3cc4cd Bugfix: modifier buttons in the particle panel were locked unnecessarily
with edited hair.
2008-04-14 10:09:44 +00:00
ca5821af25 minor output button layout changes for touch/no overwrite/extension/set 2008-04-14 08:51:10 +00:00
7b0cd8a71f == Transform ==
adding missing init on handleEvent callback
2008-04-13 20:09:44 +00:00
ebae9b1a88 UV Editing
* Changed default UV wire drawing do be a grey line with a black outline, highlighting aroudn selected points.
* Moved some draw options out of the View menu into the View panel.
* Changed header buttons to make Vert/Face modes less confusing.
2008-04-13 19:42:39 +00:00
4e40e6becc == FFMPEG ==
Added flash video menu entries. (Encoder was compiled in anyways)
2008-04-13 18:50:16 +00:00
4fc95e77b1 == FFMPEG ==
Added XVid to trunk. Again: only works with scons.
2008-04-13 17:45:56 +00:00
747b31385a == FFMPEG ==
Added H264-encoding support using libx264.

Beware: it currently only works with scons and it needs nasm or yasm as
an additional dependency!
2008-04-13 15:17:06 +00:00
6b81045bc3 * Made Armature auto name L/R, Top/Bot, Fr/Bk remove existing, known extensions.
* Added fromDupli MTex setting to python api
* Shift+RMB was setting the active face in the UV view.
* Armature scripts menu was broken
2008-04-13 15:14:32 +00:00
209ff9e663 -> Bevel transform crash fix
Transinfo transform event callback is not cleared once
a transform event is over, this casued handleEventBevel
to dereference a null pointer. Added a check for this,
but it seems the callbacks should be set to NULL when
transform loop is done?
2008-04-13 05:51:13 +00:00
e17b13d9d2 Made octree size always available since its used for baking.
Documented obscure environment variables
2008-04-12 22:17:23 +00:00
d0d4604dad Fix for bug #8927: halo blending with solid has poor antialiasing,
which as far as I can see is an old issue, but with FSA it is quite
simple to do better.
2008-04-12 21:44:08 +00:00
dfd7387641 fix BGE bug #8880: blenderplayer closing when esc is pressed
ESC now quits the game by default in all modes unless a keyboard sensor is set on ESC. 
In this case, the game designer must arrange for an alternative way to quit the game.
2008-04-12 21:18:58 +00:00
6b94db570f error in last commit. also use smaller fonts in the sequencer for frame numbers, number string was too long. 2008-04-12 20:36:35 +00:00
ad6b1e16a5 active face can now be unselected, also extrude and copy keep the active face. 2008-04-12 19:56:53 +00:00
f8d1bc8ee7 Fix for bug #8463: object texture mapping for duplis was changed to
act as if the object was in its original position, instead of being
different for all instances. However, this is desired behavior in
some cases and so breaks compatibility. Now it only does the new
behavior when enabling the "From Original" option.
2008-04-12 18:44:03 +00:00
ea4a315f3d Fix for bug #8936: particle system crash with vertex groups and
zero vertices in a mesh.
2008-04-12 18:15:10 +00:00
98741e0392 Fix for bug #7100: when rendering on solaris, pressing esc could
kill the process. Some time ago SIGVTALRM was replaced with SIGALRM
to solve issues on linux, but this signal can kill the process on
solaris, so now it uses SIGVTALRM again there.
2008-04-12 17:34:48 +00:00
f810245076 Fix or bug #8712: transparency + sss gave too bright results. 2008-04-12 16:31:29 +00:00
0ec76c6dcf removed blenders backup feature.
sprintf(str, "/bin/su root -c 'cd %s; /bin/tar cf - \"%s\" | (/bin/cd %s; /bin/tar xf -)'", from, file, to);
 return system(str);

This would ask for a password in blenders terminal, in ubuntu there is no root user...
If this feature is added back it should be written in a much nicer way.

Also made HKey toggle hidden files in the file selector.
2008-04-12 15:03:47 +00:00
165bfce94e Fix for bug #8934: parenting or connecting armature bones didn't really
sync tip and root selection intuitively.
2008-04-12 14:53:29 +00:00
0b60ff01b4 Fix for bug #6753: metaballs instanced by a particle system did not
refresh properly, also fixed a memory leak.
2008-04-12 14:30:17 +00:00
ff77d00544 Fix for bug #5862: crash rendering to quicktime h.264. This would need
an upgrade to the new quicktime api to work, but that's not really
compatible with rendering out frames sequentially. For now it sets the
compression to minimum quality, which doesn't need seeking forward and
backwards.
2008-04-12 13:49:00 +00:00
8355a71365 Fix for bug #8932: crash converting old particle system. 2008-04-12 13:00:01 +00:00
6b02c7b12d Fix for bug #8930: issue removing temporary pointcache directory on windows. 2008-04-12 12:56:49 +00:00
1886872089 simple fix for "Unable to make version backup" warning when saving files. missing a return.
For *nix sustems, recent physics pointcache refactor uses stdio.h's remove() rather then system("rm -f ...") for removing files, since it was a lot slower for removing pointcache.

Ton used the system command because there was some problem using remove() ~6years back, but he cant remember why, (maybe its not a problem now)

Simple error, remove wasn't returning a value, but keep an eye out for problems removing files, and if anyone can reproduce the "Unable to make version backup" problem when saving, we should look into it.

Also added a note about using # in the output path for blenders command line help text.
2008-04-12 10:55:10 +00:00
4bab327c1b fix BGE patch #7892: dRot motion is reversed on non-dynamic objects
Positive dRot motion actuator will now make the dynamic and non-dynamic objects rotate counter-clock wise.
2008-04-11 21:19:00 +00:00
Chris Want
8f6a16c12e Moved initialization of vertex flags up a bit in the subdivide
routine because they were trumping a fix I had made earlier
to deal with subdivide smooth and mirror modifiers.

Campbell, could you please check that this commit is compatible
with the results you were expecting from commit 14227? Here
is the log of that commit:

http://projects.blender.org/plugins/scmsvn/viewcvs.php/trunk/blender/source/blender/src/editmesh_tools.c?root=bf-blender&view=log#rev14227
2008-04-11 20:46:12 +00:00
Chris Want
16edba2962 Make blenderplayer link to binreloc on linux. 2008-04-11 19:58:54 +00:00
c92660b18c This is patch [#8531] Change gamma node max value
Submitted By:
Stephane SOPPERA (soppera)

It just increases the max value for gamma correction to 10f.  Which
as noted in the patch is the same as the Gimp's color level tool.

Kent
2008-04-11 18:07:27 +00:00
f057a38e98 Changed BLI_convertstringcode to replace any number of hashes with the frame number.
somefile_##.png -> somefile_01.png
somefile_########-image.png -> somefile_00000001-image.png

Before, A hash at the end of the string would be replaced by a number with 4 characters. This is still default if no #'s are in the string, so nothing has changed.

To use this function from the python api use scene.render.getFrameFilename()
2008-04-11 15:47:21 +00:00
a02937d86c Fix for bug #8920: particles reactor crash and memory leak. 2008-04-11 12:29:29 +00:00
716f400182 Constraints-UI:
* Fixed typo in tooltip for IK Constraint
* Beautified Limit Distance constraint a little bit
2008-04-11 07:27:52 +00:00
539ff57015 fix BGE bug #8813: new rayCastTo() function hits near sensor collision box 2008-04-10 20:17:12 +00:00
0e8a6448dd Little cloth code cleanup needed because of from new cache code merge 2008-04-10 18:00:59 +00:00
f95f4ac8b4 2nd Part: Partial commit of patch #8812 (static caused problems on sunOS) 2008-04-10 16:42:19 +00:00
bdafa1dd91 Partial commit of patch #8812 (fixing inlining on sunOS) 2008-04-10 16:36:46 +00:00
7751a18c0b Fix for mistake in pointcache refactor commit. 2008-04-10 13:20:36 +00:00
8b2b470d44 Fix for bug #8898: QMC AO not working correct on objects pointing
directly at the camera in some cases.
2008-04-10 12:52:48 +00:00
1fe5302cce Point Cache Refactoring
=======================

Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.

Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).

Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.

Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.

Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.

Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
36288dabb8 Fix for render scemode in the python api, forgot to commit this file
when i changed it from a short to an int.
2008-04-10 11:34:36 +00:00
b955a53425 Cloth bugfix for new timescaling feature 2008-04-09 19:10:03 +00:00
ec1262944e Bugfix: scaling images anti-aliased with either the width or height
staying the same did not work correct (showed up in the sequencer).
2008-04-09 17:14:02 +00:00
906666a4d8 Cloth enhancement for upcomming cache changes: support different speed using clmd->sim_parms->timescale 2008-04-09 16:38:26 +00:00
235f793f28 Made aspx/y into floats so we can render precise regions (for apricot terrain baking) 2008-04-09 15:46:26 +00:00
9f6080cf1b Cloth/Collision modifier now gets add to the tail of the modifier stack as that is normal behaviour for all other modifiers, too. 2008-04-09 15:28:46 +00:00
e324cbd1e1 Action Editor - Renamed 'AfterTrans Delete Dupli-Frames' to 'AutoMerge Keys' for 2008-04-09 10:33:15 +00:00
Stephen Swaney
d30cc5f2d8 API Doc for new Object attributes trackAxis and upAxis.
contributed by Cedric Paille.  Thanks!

Fix broken indentation in Constraint doc.
2008-04-09 07:27:37 +00:00
9aa985abe6 minor edit to last commit, fixed a possible python error 2008-04-08 20:08:46 +00:00
b96b7ab83d -> Fix for last commit on FLT exporter
Forgot to change some dictionary keys in source which
would break export. Fixed
2008-04-08 19:35:53 +00:00
dba13f922a use mkdtemp for the scons tempfile path rather then '.sconf_temp', this way 2 blenders can be compiled at once from the same path. (debug and release for instance, as long as they build in their own dir) 2008-04-08 17:01:11 +00:00
006d4d1176 This version now includes the fluid control sources, however the Blender
interface for it is still missing. Right now there is only a simple hard coded
example, that moves a single control particle with strong attraction
and velocity forces through the domain.

I added more detailed information about the control code to the wiki
http://wiki.blender.org/index.php/SoCFluidDevelDoc#The_Fluid-Control_Branch ,
together with some thoughts on how a Blender integration could be done.
2008-04-08 16:56:43 +00:00
Stephen Swaney
daeedc1144 fix compiler warnings - deja vu all over again.
buttons_object.c:2326: warning: too many arguments for format 
buttonns_object.c:3829: warning: ordered comparison of pointer with integer zero
2008-04-08 16:50:20 +00:00
61bbccaee7 Optimization for the sequencer wipe effect, was doing a lot of unnecessary
computations for each pixel making it quite slow.
2008-04-08 16:28:55 +00:00
fa5d0309b2 setting the blend value for a sequencer strip would crash when the strip had both char and float buffers. 2008-04-08 15:07:40 +00:00
ca982d2a23 Proper fix for camera transform with snap.
Please email me or report a bug when such problem arise, it's simpler if done properly the first time.
2008-04-08 13:40:05 +00:00
589e641f97 Sorry, reverting bad things in modifier.c 2008-04-08 12:58:25 +00:00
fef157ac07 Cloth bugfix: used old dm instead of new created result derivedmesh; Code cleanup + deactivation of unsued selfcollision code in kdop.c + little speedup there 2008-04-08 12:55:35 +00:00
2af8964d7c moving the camera on the local Z axis while in the camera view didn't work when snapping was enabled (even though the CTRL key was not pressed) 2008-04-08 11:57:10 +00:00
aed7f950d0 bug fix
UI panel issues with soft bodies 
code cleaning .. remove some G.rt code
2008-04-07 21:58:12 +00:00
79ed118fd4 Potential fix for [#8113] Blender.Registry segfault when no permission to write
This converts exceptions in Warning in selected points of the registry module.

While I couldn't reproduce the segfault ( I received the Py error as expected), this isn't a bad idea anyway, since the BPy C counterpart was discarding the error anyway, making it a warning is a bit more inline with its meaning.

The exception is not preventable nor fixable from a script's point of view, so better to silence it and print a warning to the console instead.
2008-04-07 20:56:45 +00:00
6dec5db1e6 Fix for bug #8073: texture nodes connected to a viewer could crash.
Also fixed a bug where procedural buffers did not convert correctly
to different buffer types (e.g. value -> rgba would give red).
2008-04-07 15:21:25 +00:00
Stephen Swaney
77639a5cde Doh! Typo - replace [Y] with [Z]. 2008-04-07 14:16:26 +00:00
7c15baff16 added an optional arg for object.getBoundBox(worldspace) - so you can get localspace boundboxes, this is useful when getting a dipli's boundbox where the objects worldspace matrix has no useful meaning. 2008-04-07 13:16:56 +00:00
66e74e6057 annoyance with python api, Blender.Library.Datablocks should always return an empty list, rather then None when there is no datablocks. 2008-04-07 10:12:21 +00:00
391191a7e3 Silly copypaste mistake. Thanks for noticing! 2008-04-07 05:54:19 +00:00
e4d25da698 fix for [#6342] Collada 1.4 import (of perhaps corrupt collada files) leads to a complete crash of Blender 2.43 under Windows XP
NMesh wasnt checking 16max material limit, also made collada import work with the user scripts dir.
2008-04-06 20:13:14 +00:00
34771ef405 add KX_GameObject::rayCastTo() PyDoc 2008-04-06 20:02:41 +00:00
88ce1c0638 Removed my own patch #8208: export SCA_ISensor::Evaluate() to Python. It was only useful for the ray sensor and the new rayCastTo() function provides better functionality 2008-04-06 19:14:04 +00:00
108bed660a reversing 14289, it included Ton's homedir as a default path and disabled scriptlinks by default 2008-04-06 19:04:17 +00:00
e7384c9dd2 Commit patch #8799: Realtime SetParent function in the BGE
This patch consists in new KX_GameObject::SetParent() and KX_GameObject::RemoveParent() functions to create and destroy parent relation during game. These functions are accessible through python and through a new actuator KX_ParentActuator. Function documentation in PyDoc.
The object keeps its orientation, position and scale when it is parented but will further rotate, move and scale with its parent from that point on. When the parent relation is broken, the object keeps the orientation, position and scale it had at that time.
The function has no effect if any of the X/Y/Z scale of the object or its new parent are below Epsilon.
2008-04-06 18:30:52 +00:00
711306c2ba added a help link to wiki docs for curve2tree, fixed some bugs in flt_toolbar 2008-04-06 17:11:14 +00:00
Stephen Swaney
6c3bd2a02d fix compiler warnings.
I'm not sure about the intent for this one:

warning: too many arguments for format:
 sprintf(md->name, "FluidParticleSystem", BLI_countlist(&ob->particlesystem));

Something for Janne ?
2008-04-06 13:44:50 +00:00
9edb6c7510 Patch #8740: enable negative axis radar sensor 2008-04-05 22:08:15 +00:00
Stephen Swaney
6e5984ce39 Python API - read access to Track and Up axis attributes for Object.
Part of Patch 8557.  Contributed by Cedric Paille.  Thanks!

Still waiting for API doc for new attributes.  Finger is poised
over Revert button...
2008-04-05 21:33:06 +00:00
83906a614b bug fix soft body can resume with point cache
sneak in .. springs preload
2008-04-05 21:29:17 +00:00
Stephen Swaney
d0004bed8c fix compiler warning: comparison between signed and unsigned 2008-04-05 14:49:41 +00:00
cc33fcfe7b Commit patch #2439: Mesh replacement in BGE will react properly to armature deform
Changing the mesh of an object that has a deform controller (armature) is now properly handled. The new mesh must have vertex groups matching the armature bones. In simple terms, the new mesh must deform correctly when you assign it to the object in Blender and you test the action. It will deform the same when you replace the object mesh during the game.
2008-04-05 13:33:08 +00:00
0eb018919a fix for wrong rotation between branch joins 2008-04-05 10:55:18 +00:00
8fdfd4cc4c PyAPI - setting a buttons string value crashed. suspect this is a 64bit problem since replacing the string length of int, with Py_ssize_t or long prevented the crash. worked around the problem by removing the PyString_AsStringAndSize command.
wizard_curve2tree - removing id properties didnt work. exit button used a callback it didnt need to.
2008-04-04 23:12:20 +00:00
c3905009c4 No need for unions in transform code.
Unneeded size optimisation.

There's much better way to tackle this if it really is a problem.
2008-04-04 22:21:24 +00:00
1bdc909555 BGE bug [#4839] fixed: joystick keeps working after an overlay scene is removed 2008-04-04 20:39:31 +00:00
b46ef6ecb3 fix own bug with scripts drawing, could crash when a script failed 2008-04-04 16:32:13 +00:00
5b06c03884 selecting a new scripts dir didnt rebuild the menu's 2008-04-04 16:11:27 +00:00
dd944e88ee wire was being drawn for solid curve objects in editmode when it should not have been. 2008-04-04 15:57:13 +00:00
e8e1007386 moved some duplicate lines into their own function 2008-04-04 15:22:19 +00:00
6b6e5eb4c9 Restore bezier handles to their original flag if the transform is canceled, for IPO's and curve edit mode.
Also retopo was running of curve transform was canceled.
2008-04-04 15:06:50 +00:00
eb667866df Fix for bug #8870: crash converting curve to mesh. The object was being
used for curve deform, but after conversion wasn't a curve anymore, and
there was no check for this.
2008-04-04 12:33:01 +00:00
4574dbea98 Bugfix: crash with strand surface AAO and layer ipo's. 2008-04-03 00:40:53 +00:00
feb603248e Fix for bug: [#8610] Hair Particle 'cut' edit mode not respecting backface culling / z-depth
-Cut-brush didn't use depth testing at all, now it does, but unfortunately this changes the behavior of the brush so that cutting is not perfect for hairs that are partly visible from behind an edge of the emitter (this change effects the brush only when z-buf clipping is used of course)
2008-04-02 23:59:25 +00:00
78b250f693 Fix for bug: [#8576] Heir always in the back 2008-04-02 23:12:05 +00:00
5dbe42af07 Fix to make grass render the same on solaris as linux, by doing
pointer comparisons in qsort. This works for glibc according to
the documentation, and appears to work on solaris too.
2008-04-02 22:18:32 +00:00
49c65433cc Fix for bug: [#8117] Particles with fluid broken
-Handling of fluid particles was not coded at all
-Now things should work properly, but as fluid particles are not very familiar to me I'd appreciate some thorough testing
2008-04-02 17:48:46 +00:00
bab535ce1a removed printf 2008-04-02 16:22:43 +00:00
8a6f9f2a88 Sculpts calc_area_normal() could result in a zero length vector if all faces were pointing away from the view.
deal with this by making 2 average vectors, one for front pointing faces, and another for back pointing faces,
also removed an unneeded acos().
2008-04-02 16:19:12 +00:00
b73ba9c181 This commit reverts the #include <mesa/glu.h>
stuff used for peach to the standard <GL/glu.h>
the mesa stuff was needed for the machines for peach but its
not the stanard location of the headers, now that its not
needed were switching it back.

Kent
2008-04-02 15:03:03 +00:00
04be9955d0 dpx saving would fail if there was no float buffer, which is a problem when rendering from the sequencer because a float buffer can be generated for some frames but not others depending on their contents. 2008-04-02 12:56:23 +00:00
17cb235f91 Small last-minute peach feature: loading an image into the image node
now automatically detects if a sequence of images is selected, and sets
the frames and image type to sequence.
2008-04-02 12:03:31 +00:00
64201b0f24 Whitespace commit for editarmature.c while I try to find the cause of some bugs here. 2008-04-02 04:31:41 +00:00
65a4f5c556 BUGFIX8847 Multires didn't free some memory.fixed 2008-04-02 03:17:52 +00:00
53e91df196 Fix for bug #7875: node editor creates links to nowhere, fixes at
least one instance where it happens, when dragging a link onto an
already taken socket, and the existing link being moved to a hidden
socket. Couldn't find other cases in testing, so assuming it's
fixed unless another case pops up.
2008-04-01 22:28:00 +00:00
c68588ea98 Fix for bug #7368: flipping issue with dual quaternions and scaled bones. 2008-04-01 21:16:24 +00:00
cf12557c5b BUGFIX 8824: RGB Curves now work correctly with "use clipping" option
on  with maximum values greater than 1.
2008-04-01 21:09:50 +00:00
eec6454335 Fix for #8806: strand shadow bug, only showed up on windows. 2008-04-01 21:07:32 +00:00
51ea7645e2 Fix BGE bug: BGE will crash if objects with display debug property is deleted (bad practice anyway). The actual deletion is now postponed until end of scene 2008-04-01 20:46:20 +00:00
82e816eb1a added a sloppy option for getting the active face, which returns the last selected if none is active, made the uv calculation aspect correction use the active faces image rather then the last used image viewports. 2008-04-01 13:35:52 +00:00
7d6e7c716f function for getting object texspace settings, without dealing with curve/mball/mesh separately. 2008-04-01 11:14:34 +00:00
22149c95ba Bugfix: the defocus node "no zbuffer" settings was automatically set
if there was no zbuffer input. However this means a user settings can
be permanently changed without a user knowing. Now it just runs as if
this option is set if there is no zbuffer, but doesn't change the
setting.
2008-04-01 11:08:48 +00:00
4f6493d1a7 Fix for bug #8629: python object.boundingBox was not in worldspace
anymore for meshes due to a bugfix. The python code assumed ob->bb
was in worldspace while it isn't, also meant metaball bounding boxes
were wrong.
2008-04-01 10:15:39 +00:00
5c9a729734 add a button for object color access, previously could only be accessed via Ipos 2008-04-01 10:10:37 +00:00
e9b7ce9f22 fix for [bf-blender-Bug Tracker][8833] View selected in UV editor 2008-04-01 10:06:06 +00:00
3932c747d6 Fix for bug: [#8810] Sticky button in particle effector menu creates unexpected effect
-Particle dietime was calculated wrong when a collision killed particles before their natural death
-Collision code still had some issues with object vs. global space
2008-04-01 00:40:28 +00:00
c10ba357ca Fix for bug: [#8816] File saved with Explode modifier crashes blender
-Explode modifier didn't check for empty psmd->dm at file loading
2008-03-31 22:11:10 +00:00
fd46b91650 Fix for bug: [#8817] Particleradius doesn't update until changing the amount of particles
-Reactor particles didn't initialize their birth times etc. properly when cache was cleared
2008-03-31 21:51:46 +00:00
0ce8fe1ec4 Fix for bug: [#8818] Particle reflecting strange from a simple plane 2008-03-31 20:54:00 +00:00
0efe0aa27b Bugfix: world exposure and range settings were applied twice to SSS materials. 2008-03-31 20:02:27 +00:00
5e3ff914cb Fix for bug: [#8302] Particle atributes (Materials) wrong behavior
-Particle texture calculations weren't using the mtex->def_var properly
-Texture buttons didn't set proper update flags for hair
2008-03-31 19:57:40 +00:00
1ccf92aecd Fix for bug: [#8782] particle mode issues 2008-03-31 19:03:18 +00:00
e16a766620 I let a sqrtf in by accident when commiting this patch.
converted to sqrt for solaris and other platforms.

Kent
2008-03-31 17:01:08 +00:00
fe2d134a07 fix for odd error with image loading broke normal file loading 2008-03-31 14:57:09 +00:00
009e5d00cb TimeLine PyType was not getting initialized, causing auto-completion in the interactive console to crash. 2008-03-31 14:29:40 +00:00
8f48888bff fix for [#8795] Unable to load an image into Image Texture Type 2008-03-31 08:30:10 +00:00
5b73d96fd5 == Armature Tools - Separate (not yet functional) ==
Initial commit of Separate tool for Armatures. Currently, the functionality is hidden behind a temporary patch, as there are still issues to be worked out (crashes under certain conditions and a re-linking issue). It may remain like this for the release if I can't get it to work correctly.

Note:
- Hotkey for separate is Ctrl-Shift-P (it's a bit clumsy, and isn't consistent with P for separate for meshes, but Select Parent(s) is better as P)
2008-03-31 03:40:47 +00:00
bdfe2a6e0a Fix for change in default behaviour of adding objects: (commit oct 2007)
- The new default remains to add not aligned, not in editmode.
  But, this is only for new users (in .B.blend default)
- It's nicer  we don't change this for everyone automatic.

  Means: people who like the new options have to set the buttons in user
  menu and save .B.blend.
2008-03-30 18:08:55 +00:00
e433465fc6 Fix for crash with UV unwrap without an image window open. It really
shouldn't be using the image window but for now this fixes the crash.
2008-03-30 17:54:06 +00:00
8c3c1c4a0b The next testing build, the 2.45-16, nicked "Gamera". :)
(Also: removed the ugly arbitrary 2 x rgb color hack that tried to make
shadeless color "useful" in opengl solid mode. Without overflowing
color it at least now shows the color you created.)
2008-03-30 17:29:32 +00:00
d9de141077 == bugfix ==
fix for [#6950] Blender crashes when .blog file top line is 160 characters or more
- made sure BLI_convertstringcode doesn't return more than 240 chars 
- went through all callers and fixed places where string passed to BLI_convertstringcode was too short
- TODO: look into increasing sample->name and sound->name too, I prevented crashes, but filename might get shortened.
2008-03-30 16:18:01 +00:00
cc4858cde0 == Sequencer ==
Added IPO-support to color strip.
2008-03-30 14:23:15 +00:00
0eda26d126 == Sequencer ==
This fixes: [#8792] unable to de-assign ipo's from sequence-strips
2008-03-30 09:06:56 +00:00
3c0466ed31 [#8796] 2.46RC1 -- Incorrect Tool Tip on Ray Transp Gloss Button 2008-03-30 01:53:05 +00:00
2f1420301d [#7289] Orbit around selected in edit mode goes crazy with no verts selected
[#8784] orbiting around selection bug + a few kind of a must features (partial fix)

As suggested by Ton, keep last center and use that when nothing selected.

I don't really like it though as it wouldn't work ok when changing scene  or when using a different 3D view and is somewhat non trivial to explain (it's not the last selection, it's the last used orbiting center).
2008-03-30 01:47:06 +00:00
68f1f2b08d own typo in py api 2008-03-29 15:20:41 +00:00
73ca8a6fbf with displacement baking, white should be high 2008-03-29 15:16:33 +00:00
8960f53676 some fixes for python baking function
needed to add a small value to the baking distance for it to include faces of that distance (maybe should make this happen from the user interface too)
2008-03-29 14:50:05 +00:00
3ac7a415f7 Minor tweaks to action-groups code, while trying to track down some bug for broken. 2008-03-29 10:23:51 +00:00
0010f33bdb -> FLT I/O: UI now undo safe
Both the FLT importer and exporter now store and retrieve
their settings from the blender python registry making
them safe for use with global undo.
2008-03-28 23:06:00 +00:00
5fa49b5947 -> FLT I/O: LOD hiding on import
LODS were not getting hidden correctly on import.
Fixed now.
2008-03-28 21:04:27 +00:00
b766441658 -> FLT I/O: Hierarchy order fixed on export
Hierarchy was getting reversed on import/export cycle
for FLT files. Fixed now.
2008-03-28 19:45:07 +00:00
Ken Hughes
4c2b6c4bee Tools
-----
Bugfix #6961: in certain circumstances, array modifier would use deleted
copies of merged vertices, resulting in memory corruption and crashes.
2008-03-28 17:03:34 +00:00
967917ace9 This is patch:
[#8766] Scons build does not take into account WITH_BF_OPENEXR for 
	source/creator
Submitted By: Stephane SOPPERA

Fixes -F EXR on the commandline...

Kent
2008-03-28 14:55:49 +00:00
35db540b49 This is patches:
[#8578] imbuf for DDS textures: minor bugs fixed 
	(syncing with upstream nvidia texture tools)
[#8727] imbuf for DDS textures: fix for DXT5 alpha channel corruption

Submitted by our DDS person, Amorilia

Kent
2008-03-28 14:44:31 +00:00
d32ec4297d -> Double Sided Faces fix for FLT import
Faces marked as double sided in FLT file were
not getting the proper face flags on import to blender.
Fixed.
2008-03-28 00:30:46 +00:00
812af46d41 -> Double Sided Faces fix for FLT import
Faces marked as double sided in FLT file were
not getting the proper face flags on import to blender.
Fixed.
2008-03-28 00:26:48 +00:00
3b36c10702 -> Extension Node attribute support for FLT I/O
Extension node attributes are now read and stored as ID
props for the following Node types:

-Object Nodes
-Group Nodes
-LOD Nodes
-DOF Nodes
-Inline Light Point Nodes


The extension data is written back out on export.

Note that this commit only adds support for attribute extensions.
Completely new node types via the extension record are still
unsupported.
2008-03-28 00:08:41 +00:00
e7651c53c3 baking normals could crash in rare cases because the intersection data wasn't copied when the lambda was bigger then the previous or initialized.
python baking script had a simple error.
2008-03-27 16:28:21 +00:00
08bc0efecb made editmode only force smooth shading when vcols are present (as joe suggested)
pythons api's image.unpack() was broken
2008-03-27 11:52:58 +00:00
c2ae2b51cf Fix for bug #8769: SSS materials were sometimes not rendered with nodes
due to recent bugfix.
2008-03-27 11:44:36 +00:00
4dee3dc0ef Fix for bug #8771: hide deselected in particle editmode didn't work
correct. Also made it not do a depth test when editing in wire mode,
was using outdated depth buffer even.
2008-03-27 11:10:18 +00:00
bc518579a6 Fixed compiler warnings. (unused vars) 2008-03-27 05:12:14 +00:00
09e48b406b == Sculpt ==
Removed Painting Mask button from view3d header when in sculpt mode.
2008-03-27 01:11:48 +00:00
5b6763fec3 Fix for bug #8595: texture mipmaps with gauss filter didn't work correct,
gave black borders.
2008-03-26 22:14:40 +00:00
Nathan Letwory
4e941b2eb7 * add stub for GLUByte stipple_quarttone[]; 2008-03-26 21:31:33 +00:00
5183788fd6 Fix for bug #8746: the fake user button for datablocks was not a toggle
button, while it should be.
2008-03-26 20:17:50 +00:00
0599a56468 make solid faces draw vertex colors in editmode (they used to use only one of the faces colors per face) 2008-03-26 20:17:20 +00:00
87b5701b26 resetting defaults didnt set the some colors, added face dot size and color as uv/image theme options 2008-03-26 19:38:59 +00:00
750836ec7d Fix for bug #8609: radius setting for hair child particles not symmetrical.
Bug might have actually caused more issues, there were some assumptions
that ParticleCacheKey and ParticleKey structs had members in the same order,
but the rotation was in a different place.
2008-03-26 18:34:24 +00:00
b37cf7d75d Fix for bug #8407: merging vertices at first/last did not
preserve UVs correct.
2008-03-26 17:56:14 +00:00
Ken Hughes
2976a38fd9 Python API
----------
Bugfix #8615: NMesh.update() did not check if faces had less than 3 vertices, so would create bogus faces.  

Also discovered in the process that documentation and error message for Mesh.assignVertsToGroup() was wrong.
2008-03-26 17:29:20 +00:00
972b0a5218 Fix for bug #8713: edge loop delete did an undo push too much. 2008-03-26 16:46:04 +00:00
d94038342c -> Slight fix for Face Weld code in FLT importer
Slight fix for welding of faces that only share one vertex
2008-03-26 16:45:18 +00:00
4197e37200 made editmode face copy menu appier with when there is no active face (without options that required an active face)
active face drawing didnt always work since it used the last selected element for drawing.
moved stipple into glutil.c rather then using 128 bytes in the stack for each stipple draw.
2008-03-26 16:06:25 +00:00
b46bad83bf -> New face weld code for FLT importer
Replaced the use of remove doubles with some new custom 'face welding'
code that wil clean up meshes on import.This will not remove any faces
or do any edge collapse and so is a more suitable method of cleaning
up imported meshes. This same code could potentially be of use when
importing other formats as well (such as DXF...)
2008-03-26 15:59:56 +00:00
2af78ac944 Fix for bug #8750: depremul in the image texture code should check
with an epsilon rather than 0.0f, could give random spots otherwise
with e.g. calcalpha + negalpha.
2008-03-26 15:25:56 +00:00
ba1f58ea73 Fix for bug #8747: normal map tangents didn't work correct with
splitting of non-flat quads.
2008-03-26 14:58:34 +00:00
5fa576a89f UV Unwrap (lscm, project from view, cube etc) now default to correcting for the active images aspect ratio.
This is now default but can be disabled in the UV Calculation panel. At the moment its called "Image Aspect" but another name could be better.
2008-03-26 14:50:29 +00:00
6184c07474 fix for [#8732] Unwrap Project from View not matching View
the active face could be unselected. now unwrapping with no UV layer will assign the current image to the selected faces.
2008-03-26 11:56:41 +00:00
2a47d02975 Bugfix: selecting or muting an ipo curve in the action editor
would be undone on redraw with an ipo window open in editmode,
or with show keys enabled in the ipo window.
2008-03-26 11:27:52 +00:00
192021f068 check for null data when using ffmpegs swscale (for corrupt/partially corrupt videos) 2008-03-25 20:30:33 +00:00
4bf152fbcd lib error message was inconsistent when changing texture channels, enabled it for texture colorbands 2008-03-25 19:27:49 +00:00
1b94e21f9c selecting similar edges (Shift+G in edge mode) didnt flush selection from edges to faces, so you could have all edges of a face selected without the face being selected. 2008-03-25 16:16:11 +00:00
5606cb156e creating branch for Nils 2008-03-25 13:18:13 +00:00
74e835342e Two constraints related fixes
* Bugfix #8599d: 
When using the ChildOf constraint on bones without parents, with cyclic-offset in action the effect of the cyclic-offset was applied twice. Added a bone option to make the effect of cyclic-offset not be applied to rootbones which have the option 'enabled'. 

In the UI, this is presented in the opposite way. It is represented by the 'Offs' button beside the parent-bone selector in the Armature Bones panel when in EditMode.

* Head/Tail setting and Constraint Channels:
Added back in checks to see if the head/tail IPO-curves for Constraint Channels can get applied for the target constraint. I had removed these when applying the patch, but I'd overlooked the fact that users could add an IPO-curve for this from the IPO-editor, potentially mucking up the behaviour of some constraints.
2008-03-25 10:36:36 +00:00
34494425fa Raise the limit for long filenames.
a few times peach guys have had the play button fail with "stack smash" warnings in the terminal and play button not working.

This fixes a reproducible crash where blender would segfault when pressing play on long filenames, and hopefully fixes odd user reports where pressing play quits X11 or reboots their system.
2008-03-25 09:40:06 +00:00
8c46419f3b Bugfix:
Resizing two text windows stacked one over the other, crashed in certain cases (i.e.  when dragging the border between them down to the header of the bottom one). Was caused by division by zero, resulting in a SIGFPE (floating point exception).
2008-03-25 09:17:58 +00:00
662c57d63e fix for [bf-blender-Bug Tracker][8739] image selector never exits.
This fix was made to the file selector weren't applied to the image selector.
Made file and image selector use same python api function.
2008-03-25 09:00:00 +00:00
a2dd82570a patch only to redraw on mouse move, broke continues zoom. 2008-03-25 08:30:39 +00:00
753a0e9746 Tweaks to labels on brightness/contrast node 2008-03-25 06:10:03 +00:00
88c2358f4f Bugfix #8736: Follow Path constraints does not work for Bones
This appears to be a long-standing bug, and it only affected the Follow-Path constraint as it was the only one which was dependant on time-based changes. An oversight in the depsgraph code meant that Follow-Path constraints on armature bones were not evaluated, unless there was an Action or some NLA-Strips for that armature. 

I've added a new flag to pose->flag (POSE_CONSTRAINTS_TIMEDEPEND) which only gets set/cleared by update_pose_constraint_flags. This flag indicates that the depsgraph needs to do an update for such cases, and will require going in/out of EditMode to set this for old files. 
It's been implemented as such to avoid having costly searches when trying to run animations realtime (as is done for modifiers).
2008-03-25 05:32:04 +00:00
7de584337f == Sequencer ==
Forgot directory in input panel for sound files...
2008-03-24 21:01:36 +00:00
8d2a0a566f == Sequencer ==
A lot of fixes for anim_startofs / anim_endofs:
* crashed when striplen was 0 and startstill / endstill still in use
* made it work for Audio (HD and RAM)
* made it work for Image Sequences
* added a new cutting tool, that uses anim_startofs / endofs instead of
  startofs / endofs. This is now the default and called "hard cut"
* moved old cutting method to "Shift-K" and renamed it "soft cut"
2008-03-24 17:35:01 +00:00
2b7e4f4d4a subdivide would give weired results especially when used after proportional edit mode because vertex temp flags wernt zero'd 2008-03-24 11:55:43 +00:00
659db30d50 Fix for transforming constraint-channel keys that appeared in a group-channel, but belonged to constraint channels that were collapsed and/or hidden. 2008-03-24 11:28:49 +00:00
186320f458 Peach Request: Fix for little bug in Action Editor
Quick patch for action-filtering system, so that the IKEY (Insert Key) -> "Key Only Selected" doesn't key in channels that are hidden. Documented the convoulted logic there a bit. 

Note: constraint channel keys in group channels seems to have become broken again at some point before this commit
2008-03-24 11:25:34 +00:00
dbd64ac751 uv stretch display respect image aspect ratio,
tooltip correction (bug #8660)
ghostwinlay.c was missing string.h include
2008-03-24 09:00:39 +00:00
b20f6e27ff Commit patch #8724:
This patch modifies the BL_ConvertMesh method from the data conversion module in order to reduce the number of polygon
material objects that are created.

Normally, there should be only one material object for each material bucket(the group of meshes that are rendered together
with a single material). However, the number of materials that are created right now in the converter is much higher
and eats a lot of memory in scenes with large polygon counts. This patch deletes those material objects(KX_BlenderMaterial)
that are used only temporarily in the converter(and are now deleted only when the converter is destroyed, at the end
of the game).

For a cube that's subdivided 7 times(90+ k polygons) I get 200 MB usage in the game engine in 2.45 and 44 MB with a
svn build with this patch applied if the "Use Blender Materials" option is activated in the Game menu.
2008-03-23 23:12:40 +00:00
f162428bd2 [#8717] ZOOM with CTRL+mouse drag (consumes all cpu)
patch from André Pinto to stop zoom from redrawing when the mouse didnt move.
2008-03-23 18:53:45 +00:00
0f8fee26cf == Sequencer ==
Additional fixes to metastrip handling. The code is now even shorter :)
2008-03-23 18:32:20 +00:00
a572fb0e45 Fixed bug #6079, sculpt mode thin mesh problem
Calculating the area normal now checks each normal against the angle of the camera. If the normal is pointing away from the camera, it is ignored.
2008-03-23 18:08:20 +00:00
c52695bafe == Sequencer / ImBuf ==
Fixed a long standing bug in IMB_dupImBuf: refcounter should be better 0
within the duplicated ImBuf...

Finally removed this strange STRIPELEM_META mumbo jumbo.

On a way to asset management: made METAs behave like true input strips:
* proxying should work
* input filter options should work (including transform and color balance :)
* IPOs now work in replace mode
2008-03-23 17:56:44 +00:00
096fcb3c8f fixed UV selection hide/reveal in the UV window. 2008-03-23 16:27:34 +00:00
4a6d75af27 added support for linux on pa-risc 2008-03-23 12:59:26 +00:00
fa2d6c195e Bugfix #8710:
Typo fix in PyConstraint template
2008-03-23 02:28:24 +00:00
cd3cf57842 Collision Modifier: 1. Bugfix: Enable hiding in modifier stack again, 2. Bugfix: Recalculate bounding volume if GUI setting changed 2008-03-22 22:08:46 +00:00
7e69e77609 lasso select for nodes 2008-03-22 20:54:09 +00:00
6615f8b74f BGE correction: AddRef() on source object of property actuator to protect against crash if the source object is deleted (bad game design anyway) 2008-03-22 14:47:42 +00:00
1d0e1d5406 [#8693] Align view to selected works differently called from menue then from shortcut
The header menu was sending the wrong axis (off by one) to the tool.
2008-03-22 13:27:34 +00:00
95e781c601 == Action Editor - Preview Range (Ctrl-Alt-P) ==
Quick feature for setting Preview Range in Action Editor: the hotkey Ctrl-Alt-P sets the Preview Range so that it matches the extents of the active action.
2008-03-22 11:06:51 +00:00
a7ee2674db added stdio.h includes, gcc-4.3 is picky 2008-03-22 10:53:35 +00:00
126ab7974d NDOF support added to trunk from ndof branch.
The latter is now obsolete and will be soon 
removed.

Some tiny build tweaks for darwin committed
in preparation of bigger changes for proper
SDK suport both on intel and ppc
2008-03-22 01:39:11 +00:00
1930a925c8 Removing some compiler warnings.
(Note to who-ever made all the changes referring to r.scemode:
r.scemode is an int, not a short!)
2008-03-21 23:10:23 +00:00
76f34bcdd9 Fixed bug #8597, Subsurf error
This was actually an error with the array modifier. Merging vertices would sometimes create degenerate faces (e.g. face.v1 == face.v3)
2008-03-21 23:06:15 +00:00
7e031b7a39 Correction on BGE fixes:
- check that an object has been created before setting the physics environment
- check that there is an active camera before using it
- when a camera is deleted, remove it from m_cameras list
2008-03-21 22:44:12 +00:00
4e8f06604f This commit disables fix for revision 14202 effectively.
The claim was:
Bugfix: don't do full sample merging on re-rendered layers in
the compositor.

But result was that rendering didn't happen at all for scenes
with a composite.

I also don't understand the commit, seems like it's incomplete?
2008-03-21 22:26:26 +00:00
4c29f3cf09 added camera shiftx/y for the UVProject modifier 2008-03-21 21:03:31 +00:00
c49316a9eb Bugfix: don't do full sample merging on re-rendered layers in
the compositor.
2008-03-21 17:37:24 +00:00
d3116dd4d2 use Z depth for the ortho border zoom also, if there is no depth values set then fallback to previous method. 2008-03-21 17:13:35 +00:00
2f4ca518ea svn merge -r 13415:13452 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-01-29 16:42:57 +00:00
5da7f4df47 -= Cloth cleanup =-
Fixes:
- Cloth event refactor to solve 2 unknown cache bugs
- Cloth vgroup refactor (faster + scalable stinnes now working)
- Cloth + Collision modifier on one object crash
- Editmode + faceextrude on baked cloth crash
- Stiffness groups would get pinned
- Correct scaled stiffness calculation
- Fixes freeing error under some circumstances
- Deactivating reset/cache freeing when in editmode
- Autobaking setting doesn't get screwed up anymore
- More than 1 collision object in a scene could explode
- Pinning + not protected cache didn't reset cloth
- Start simulation on first frame and not on 2nd
- Maximum structstiff now correct (copy-paste error)
- Loading file with baked cloth calculate the spring length correctly 
- Loading file behaviour improved with cache
- Collision object is evaluated first (untested)
- Debug output activated with rt>0

Be carefull: Files with some cloth cache or something should be 
regenerated.
2008-01-29 16:32:42 +00:00
9c1fa1ff4d WIP commit, many debug outputs, extensive log comes after bug is killed 2008-01-29 02:24:37 +00:00
1f0e182f35 svn merge -r 13382:13415 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-01-26 21:54:09 +00:00
a1a9e011b8 untested fixes for vgroups 2008-01-25 21:47:43 +00:00
a01a606b1f Weekend commit -> New: 3rd tab for advanced users mit many things to play with. Fixed: Free modifier correctly when deactivating cloth on panel, be carefull: could eventually put weird values on the GUI due to changed DNA 2008-01-25 16:14:54 +00:00
589870100d Fix: clear cache button works again even with protected cache, edited cache doesn't get saved to wrong frame anymore when moving frames forward in editmode 2008-01-25 10:33:19 +00:00
e7f5d07781 New: load cached data on file load; Fixed: Don't destroy cache on fileload, calculate normals correctly, don't reset all data when pressing partial free, making also cache free buttons available when cache is protected, duplicating cloth with shift-d should work properly now 2008-01-25 08:55:27 +00:00
7054664d2a svn merge -r 13357:13382 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-01-24 10:53:16 +00:00
c5dc7c7b02 New: Editable cache. Fixed: Don't clear cache on e.g. lamp moving. Changed: Switched to another modifier type to be more flexible (allows tearing later) 2008-01-24 10:43:12 +00:00
576a7f623c fix for collision modifier not reseted after first run + made the pushpin more like one 2008-01-23 17:58:09 +00:00
4b1b749130 Enabled first + last simulation frame, hopefully fixed some cache problems, changed 3d view ball to a pushpin layout -feel free to enhance in drawobject.c line 5440 2008-01-23 15:30:23 +00:00
6490b2b29a Made GUI even more intuitive with explanations why something is not available etc., fixed some uninitialized variable. NEW: show pinned verts as big red balls in 3dview - please tell me how to improve that visual feedback :) 2008-01-23 13:24:44 +00:00
ab7b4bb892 (hopefully) fixed huge problem with cache/cloth reset. 2008-01-22 23:17:10 +00:00
d623e52afd svn merge -r 13323:13357 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-01-22 20:35:37 +00:00
35c93b07bd GUI cloth panel refactor, also made many code rearrangements, cleared DNA up 2008-01-22 20:28:12 +00:00
3db5a4e8dc First successfull use of collision modifier. Means: Collision with cloth are enabled using the 'Deflection' panel from now on 2008-01-22 00:34:28 +00:00
3759c772fd Speedup spring creation again, was lost during merge 2008-01-21 10:55:46 +00:00
ddef077b38 svn merge -r 13240:13323 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-01-21 02:42:42 +00:00
530039a429 Restructured many collision things again, GUI cleanup 2008-01-21 02:23:03 +00:00
2d06f79ff9 svn merge -r 13177:13240 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-01-15 13:00:29 +00:00
43cd8a9f71 svn merge -r 13148:13177 https://svn.blender.org/svnroot/bf-blender/trunk/blender + fixed one crash on enabling deflection 2008-01-09 12:04:54 +00:00
86d8ef3f91 svn merge -r 13095:13148 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-01-07 03:25:11 +00:00
8d6bbf7635 Merged back with last version where collisions worked at least a bit (rev 12296). Also merged fixes (hopefully). 2008-01-07 03:20:43 +00:00
a9c36825aa svn merge -r 12937:13095 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-01-02 14:36:46 +00:00
5b9a06e041 Pre merge commit, only added debug output so far 2008-01-02 13:51:44 +00:00
9e96ac11bb WIP commit, just to have a nice return from holidays :) 2007-12-21 01:24:09 +00:00
a8a5776160 svn merge -r 12856:12937 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-12-18 17:29:35 +00:00
3bf1536f5e Some User UI changes: a) Don't ask the user anymore if he wants to overwrite the file when he's doing a simple ctrl-s/ctrl-w; b) Ask for saving on exit when a file has changed, ontheless quit.blend is saved anyway. --> All branch changes, not likely to go into trunk 2007-12-18 16:54:12 +00:00
cf59579d44 svn merge -r 12716:12856 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-12-12 17:58:06 +00:00
42637b7252 Fixed preconditioned conjugate to some degree but some issues left for stiffness>1000 (disabled therefore). There's also some issue with the springs function (some springs seem to be missing/not created) 2007-12-12 17:33:59 +00:00
e9c9bf5bdb svn merge -r 12691:12716 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-11-29 12:40:53 +00:00
543f38c20a Fix: GUI cache reset should work again, same goes for collision modifier (enabled through 'deflection' panel 2007-11-29 12:29:32 +00:00
087a549e55 svn merge -r 12684:12691 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-11-27 13:25:07 +00:00
41745b8a50 Particle merge: svn merge -r 12653:12664 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-11-26 23:11:07 +00:00
db57ad68cd Code got unreadble due to copy-paste (hint for me: revert point) 2007-11-26 14:59:58 +00:00
f50c70bc7d Segfault revert, MT should work fine again for subdiv fluids 2007-11-26 14:50:27 +00:00
3da8fbb53e New feature: Fluids internal subdiv (level >=2) uses OpenMP now 2007-11-26 02:41:06 +00:00
68e1c73126 Reverted to rev 12673 + test for ccherett 2007-11-26 01:04:01 +00:00
c1724d3ca1 Insert revert point (segfault) 2007-11-26 00:57:46 +00:00
bc2c9336fd ccherrett pre-alpha subsurf openmp code 2007-11-26 00:26:29 +00:00
c8a412cdcb Commit of fluid fix for 32/64bit and max 2.5gb ram issue 2007-11-25 21:14:52 +00:00
b5974a0586 little debug output for MT fluid 2007-11-25 03:46:41 +00:00
531787e089 svn merge -r 12653:12664 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-11-24 22:49:56 +00:00
638b95634e svn merge -r 12607:12653 https://svn.blender.org/svnroot/bf-blender/trunk/blender + add OpenMP for msvc/gcc to scons, cmake and Makefiles (libs + compiler flags are still missing in Makefiles) 2007-11-22 20:28:24 +00:00
83c1dd78a6 Fixed numerical issues, hardened it again. 2007-11-22 17:02:37 +00:00
4cb5470f82 WIP commit to be able to revert later (known bug: unstable without sse enabled - weird) 2007-11-21 08:13:00 +00:00
f28ab5de21 Bugfix: scaling/rotation/translation works again 2007-11-19 23:45:26 +00:00
b2705bbe5c #ifdef sse headers 2007-11-19 00:27:25 +00:00
14de7f4a2b fixed sse copy-paste glitch + #define __SSE3__ thanks to Lynx3d 2007-11-19 00:01:33 +00:00
04e3046824 svn merge -r 12496:12607 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-11-16 14:41:07 +00:00
057060967e Fixed DNA issue, some optional SSE stuff in (experimental, only 2 functions => not likely to be ever in trunk), BE AWARE: not compatible with old cloth files, many fixes in general, deactivated selfcollisions due to WIP 2007-11-16 14:24:43 +00:00
d4e881761d Introduced a selfmade AIMEX (adaptive implicit-explicit condition into force calculation for jacobi matrices -->results in ca. 15% speedup 2007-11-08 03:31:52 +00:00
e14457b921 updated bullet to version 2.64 and hopefully didn't break too much things in CcdPhysicsEnvironment.cpp, but it compiles and works for me 2007-11-06 14:27:06 +00:00
c5d4e8a137 updating bullet 2007-11-06 14:26:08 +00:00
e057b56d3b svn merge -r 12478:12495 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-11-06 12:10:59 +00:00
b37bbe9024 New: pointcache integrated with cloth. Maybe some little glitches left there 2007-11-06 12:08:39 +00:00
cbc941e342 Merged pointcache from particles branch, but is not used in the moment 2007-11-06 09:44:09 +00:00
47c62453db Bugfix for wrong springs (resulted in weird behaviour), Implemented two speedups: One for small bending/wrinkle values (1/3 speedup), another speedup is that cloth get automatically in sleep mode but wakes up every frame ([quality-1]/quality speedup) 2007-11-06 02:30:53 +00:00
873a26ff84 best part (file) was missing 2007-11-05 19:29:14 +00:00
0a1be3e2ce Fun commit: I put some 3-liner verlet integrator in, to activate it, set clmd->sim_parms.solver_type in cloth_init to 1 - bugs in there 2007-11-05 19:28:38 +00:00
7a6b3a63fa svn merge -r 12419:12478 https://svn.blender.org/svnroot/bf-blender/trunk/blender -- old cloth files with activated modifier won't work, please deactivate modifier before 2007-11-04 22:20:02 +00:00
8c0968a013 Kicked my own cache code, will use point cache in the near feature 2007-11-04 22:11:00 +00:00
01d19261bb Implemented simple selfcollisions with use of OpenMP (WITH_BF_OPENMP = 'true' - for NEW compilers like gcc 4.2.0 and MSVC prof) 2007-11-04 21:02:37 +00:00
5f4323d2b1 svn merge -r 12391:12419 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-10-28 19:12:08 +00:00
67f8ca0b66 Fixed typo which resulted in jumping cloth when collisions where enabled, fixed collision list memory leak. Ready to put real collision detection/response in. 2007-10-28 19:07:51 +00:00
4f72523654 Weekend commit: Enabled bounding box check for cloth again, but there's a bug in it (no collisions detected) 2007-10-26 15:13:50 +00:00
a61fb914ec Fixed compiling errors + introduced old speedup for springs again 2007-10-26 10:46:40 +00:00
f59a4c2215 Fixing some goal problem 2007-10-25 23:10:42 +00:00
096a1e87fc Fixed all known crashers, still have to verify a few things, and compiling works on gxx too, now 2007-10-25 22:09:06 +00:00
f310214cc5 reverted part of cloth.c and modifier.c back to old code before switch to use "deform_only" modifier (not tested, needs cleanup but compiles) 2007-10-25 21:17:55 +00:00
f2cbe4e76b svn merge -r 12382:12391 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-10-25 16:42:17 +00:00
41b1505f83 svn merge -r 12347:12382 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-10-24 17:20:53 +00:00
916cd17778 Fixed some bugs in bounding volumes, still some crasher in new cloth modifier 2007-10-24 17:13:13 +00:00
8bca9e5977 Another WIP commit. Building up bounding volume API 2007-10-23 22:38:07 +00:00
0a0b976b41 svn merge -r 12294:12347 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-10-22 23:05:09 +00:00
5a6ffd8441 WIP commit, (just in case my HD breaks down). Don't expect anything to work. Code crashes and sim doesn't work ;) 2007-10-22 22:50:32 +00:00
dfd9c71b56 Code comments add to collision interface 2007-10-21 17:20:31 +00:00
5bd2f5b08e Fixed read/writing of blendfiles with collision modifier (saving not supported itm), also changed naming 2007-10-21 16:53:25 +00:00
c8fe3c95a3 Forgot some new file for seperated collisions 2007-10-21 16:39:07 +00:00
8dbc71020c Disabled Cloth collision detection because of almost complete rewrite/seperation of the collision system like we discussed on the sprint. You can enable position caching/collision object now then enableing it as an deflection object. Problem: Some GUI glitch in the modifier stack, please help :) 2007-10-21 16:38:13 +00:00
f44b09b7eb svn merge -r 12208:12294 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-10-18 23:27:31 +00:00
5b019072a8 Springs are in a dynamic list now, New function cloth_add_spring() for easier access to spring handling, cleared up names, functions, code. Collisions can be enabled/disabled for cloth objects now 2007-10-18 23:12:30 +00:00
e59bf9fa6f initial splitting of egde/face response 2007-10-10 09:33:34 +00:00
0efce1fa79 Merge with trunk: svn merge -r 12182:12207 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-10-04 11:22:54 +00:00
626edd8de8 New: Collision detection for inter-timestep-collisions for edge-edge contacts. 2007-10-04 00:19:59 +00:00
265572744e New: Collision detection for inter-timestep-collisions for triangle-point contacts. No response yet though. 2007-10-03 22:43:26 +00:00
62107985dd Recoded cache, fixed some crashes there 2007-10-03 13:58:05 +00:00
179a1b5bbc Compile fix for bug on OSX reported by Jens Verwiebe 2007-10-02 16:55:10 +00:00
a5db16f913 Fixed crash with ipo'ed collision object 2007-10-02 09:47:08 +00:00
b91cb25986 Merge with trunk: svn merge -r 12151:12179 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-10-01 21:36:39 +00:00
777c16d444 Bullet is back, but now generalized enough to allow own distance/calculation. Some bullet makefile-fix by 'gsr b3d'- please test it. Also fixed some crasher with cache. Also implemented moving-collisions enabled kdop (response missing in the moment) 2007-10-01 20:19:22 +00:00
6a72fecca7 Some additional wind problems (hopefully) fixed, added force fields, reported by Rui Paulo Sanguinheira Diogo 2007-09-28 11:06:13 +00:00
311694e7a5 Merge with blender svn -> svn merge -r 12064:12150 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-09-26 10:28:30 +00:00
b4fb141ea5 In the middle of switching to own collision detection, WIP commit (don't expect anything to work, but compile) 2007-09-23 17:40:44 +00:00
5b9140a209 Fixed some collision response issues. (weekend commit, some half done work in) 2007-09-21 13:34:19 +00:00
4c7c711b8a Fixed collision object init, New: Apply collision impulses so minimum distance is preserved (friction still missing) 2007-09-19 12:13:16 +00:00
6e755b9089 Fixed wind force direction (reported by mfoxdogg) 2007-09-19 08:07:47 +00:00
98e8486baf Fix: kicked springs caching since it's unused and needs lots of memory 2007-09-18 19:56:58 +00:00
b852223456 arround 50% speedup in calculating spring force using OpenMP 2007-09-18 14:05:36 +00:00
138b436914 Fixed floating point rounding error in goal velocity computation, pointed out my mfoxdogg, additional code cleanup 2007-09-18 11:42:52 +00:00
9dbcffadec Temporary fix for loading crash of .blends with cached frames. Also fixed some goal behavior/init problem to match SB behaviour 2007-09-18 07:16:57 +00:00
f473f4ee79 Fix: No GAMEENGINE=1 needed anymore, only WITH_BF_BULLET=1.
Fix: (Hopefully) some fix for linking openmp
2007-09-17 21:03:45 +00:00
969397ced2 bf-blender/trunk/blender rev 12059 + 12060 + 12064 merged (this commit is only 12059, others are already merged) 2007-09-17 19:57:47 +00:00
deceff52d1 Add WITH_BF_OPENMP for openmp usage, untested on msvc 2007-09-17 19:32:15 +00:00
0e502338fc disable parallel for users 2007-09-17 13:25:29 +00:00
ca6e59bc48 stupid missing ";" 2007-09-17 11:19:07 +00:00
26a0473c8c compile fix from elubie
special request from mfoxdogg: place modifier where you want
2007-09-17 11:18:04 +00:00
4036412001 Marge with trunk: svn merge -r 12050:12057 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2007-09-17 11:10:23 +00:00
7c05d8eb2b Fixed 2 crashers when activating collision object; Also put some additional openMP code in (doesn't hurt since #pragma gets ignored if no openMP available) 2007-09-17 10:41:20 +00:00
1138bd3014 New: Min & MaxFrame of simulation; Fixed: Many reset problems gone 2007-09-16 23:19:02 +00:00
9d0420c1ac Little project: Getting fluidsim multithreaded.
Can be actuvated by adding "PARALLEL" to compiler flags in elbeem folder.
-----
Code already works for MAX_THREADS=1 so there seems to be some bug in openMP code in paraloopstart.h

Help appeciated :)
2007-09-16 16:33:42 +00:00
cd998aaadd Initial checkin of cloth files + changes 2007-09-16 16:23:21 +00:00
2594 changed files with 176257 additions and 70532 deletions

View File

@@ -38,6 +38,10 @@ MACRO(BLENDERLIB
ENDMACRO(BLENDERLIB)
MACRO(SETUP_LIBDIRS)
# see "cmake --help-policy CMP0003"
if(COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
LINK_DIRECTORIES(${PYTHON_LIBPATH} ${SDL_LIBPATH} ${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${ICONV_LIBPATH} ${OPENEXR_LIBPATH} ${QUICKTIME_LIBPATH} ${FFMPEG_LIBPATH})
IF(WITH_INTERNATIONAL)
LINK_DIRECTORIES(${GETTEXT_LIBPATH})

View File

@@ -1,13 +1,10 @@
# $Id$
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +22,7 @@
#
# Contributor(s): Jacques Beaurain.
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
#-----------------------------------------------------------------------------
# We don't allow in-source builds. This causes no end of troubles because
@@ -63,11 +60,11 @@ OPTION(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
OPTION(WITH_VERSE "Enable Verse (http://verse.blender.org)" OFF)
OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" ON)
OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" OFF)
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
OPTION(YESIAMSTUPID "Enable execution on 64-bit platforms" OFF)
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Mozilla-Unix only)" OFF)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -145,6 +142,7 @@ IF(UNIX)
/opt/local/include/freetype2
/opt/csw/include/freetype2
/opt/include/freetype2
NO_DEFAULT_PATH
)
SET(FREETYPE_LIB freetype)
@@ -185,9 +183,9 @@ IF(UNIX)
SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++")
IF(WITH_OPENMP)
SET(LLIBS "${LLIBS} -lgomp ")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
SET(LLIBS "${LLIBS} -lgomp")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(WITH_OPENMP)
@@ -199,10 +197,17 @@ IF(UNIX)
ENDIF(UNIX)
IF(WIN32)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
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(CMAKE_CL_64)
SET(PYTHON ${LIBDIR}/python)
SET(PYTHON_VERSION 2.5)
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
@@ -216,12 +221,20 @@ IF(WIN32)
SET(OPENAL_LIB openal_static)
SET(OPENAL_LIBPATH ${OPENAL}/lib)
SET(PNG_LIB libpng_st)
IF(CMAKE_CL_64)
SET(PNG_LIB libpng)
ELSE(CMAKE_CL_64)
SET(PNG_LIB libpng_st)
ENDIF(CMAKE_CL_64)
SET(JPEG_LIB libjpeg)
SET(ZLIB ${LIBDIR}/zlib)
SET(ZLIB_INC ${ZLIB}/include)
SET(ZLIB_LIB libz)
IF(CMAKE_CL_64)
SET(ZLIB_LIB zlib)
ELSE(CMAKE_CL_64)
SET(ZLIB_LIB libz)
ENDIF(CMAKE_CL_64)
SET(ZLIB_LIBPATH ${ZLIB}/lib)
SET(PTHREADS ${LIBDIR}/pthreads)
@@ -236,7 +249,11 @@ IF(WIN32)
SET(GETTEXT ${LIBDIR}/gettext)
SET(GETTEXT_INC ${GETTEXT}/include)
SET(GETTEXT_LIB gnu_gettext)
IF(CMAKE_CL_64)
SET(GETTEXT_LIB gettextlib)
ELSE(CMAKE_CL_64)
SET(GETTEXT_LIB gnu_gettext)
ENDIF(CMAKE_CL_64)
SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
SET(FREETYPE ${LIBDIR}/freetype)
@@ -252,6 +269,10 @@ IF(WIN32)
ELSE (MSVC80)
SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
ENDIF(MSVC80)
IF (MSVC90)
SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008)
ENDIF(MSVC90)
SET(QUICKTIME ${LIBDIR}/QTDevWin)
SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)
@@ -260,10 +281,15 @@ IF(WIN32)
SET(FFMPEG ${LIBDIR}/ffmpeg)
SET(FFMPEG_INC ${FFMPEG}/include)
SET(FFMPEG_LIB avcodec-51 avformat-51 avutil-49)
SET(FFMPEG_LIB avcodec-51 avformat-52 avdevice-52 avutil-49 swscale-0)
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
IF(CMAKE_CL_64)
SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
ELSE(CMAKE_CL_64)
SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
ENDIF(CMAKE_CL_64)
IF(WITH_OPENAL)
SET(LLIBS ${LLIBS} dxguid)
ENDIF(WITH_OPENAL)
@@ -300,8 +326,12 @@ IF(WIN32)
SET(WINTAB_INC ${LIBDIR}/wintab/include)
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib ")
IF(CMAKE_CL_64)
SET(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
ELSE(CMAKE_CL_64)
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
ENDIF(CMAKE_CL_64)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
ENDIF(WIN32)
IF(APPLE)
@@ -427,6 +457,13 @@ SUBDIRS(
# Blender Application
SUBDIRS(source/creator)
#-----------------------------------------------------------------------------
# Blender WebPlugin
IF(WITH_WEBPLUGIN)
SET(MOZILLA_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
SET(WITH_PLAYER ON)
ENDIF(WITH_WEBPLUGIN)
#-----------------------------------------------------------------------------
# Blender Player
IF(WITH_PLAYER)

View File

@@ -1,14 +1,11 @@
# $Id$
#
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +23,7 @@
#
# Contributor(s): Hans Lambermont
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
#
# Toplevel Makefile for blender. Bounces make to subdirectories.
# Available targets: 'all' 'debug' 'release'

14
README
View File

@@ -24,22 +24,22 @@ dir to one of these locations (your home directory being recommended).
-------------------------------------Links--------------------------------------
Getting Involved:
http://www.blender.org/docs/get_involved.html
http://www.blender.org/community/get-involved
Community:
http://www.blender3d.org/Community/
http://www.blender.org/Community
Main blender development site:
http://www.blender.org/
http://www.blender.org
The Blender project homepage:
http://projects.blender.org/projects/bf-blender/
http://projects.blender.org/projects/bf-blender
Documentation:
http://www.blender.org/modules.php?op=modload&name=documentation&file=index
http://www.blender.org/education-help
Bug tracker:
http://projects.blender.org/tracker/?atid=125&group_id=9&func=browse
http://www.blender.org/development/report-a-bug
Feature request tracker:
http://projects.blender.org/tracker/?atid=128&group_id=9&func=browse
http://wiki.blender.org/index.php/Requests

View File

@@ -1,14 +1,11 @@
#!/usr/bin/env python
# $Id$
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +23,7 @@
#
# Contributor(s): Nathan Letwory.
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
#
# Main entry-point for the SCons building system
# Set up some custom actions and target/argument handling
@@ -39,6 +36,7 @@ import string
import shutil
import glob
import re
from tempfile import mkdtemp
import tools.Blender
import tools.btools
@@ -145,7 +143,7 @@ if crossbuild and platform!='win32':
env['OURPLATFORM'] = platform
configfile = B.arguments.get('BF_CONFIG', 'config'+os.sep+platform+'-config.py')
configfile = 'config'+os.sep+platform+'-config.py'
if os.path.exists(configfile):
print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
@@ -159,13 +157,14 @@ if crossbuild and env['PLATFORM'] != 'win32':
# Needed for gui programs, console programs should do without it
env.Append(LINKFLAGS=['-mwindows'])
userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
# first read platform config. B.arguments will override
optfiles = [configfile]
if os.path.exists('user-config.py'):
print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + 'user-config.py'
optfiles += ['user-config.py']
if os.path.exists(userconfig):
print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
optfiles += [userconfig]
else:
print B.bc.WARNING + 'user-config.py' + " not found, no user overrides" + B.bc.ENDC
print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
opts = btools.read_opts(optfiles, B.arguments)
opts.Update(env)
@@ -180,21 +179,21 @@ if env['BF_NO_ELBEEM'] == 1:
env['CCFLAGS'].append('-DDISABLE_ELBEEM')
if env['WITH_BF_OPENMP'] == 1:
if env['OURPLATFORM']=='win32-vc':
env['CCFLAGS'].append('/openmp')
env['CPPFLAGS'].append('/openmp')
env['CXXFLAGS'].append('/openmp')
else:
if env['CC'] == 'icc':
env.Append(LINKFLAGS=['-openmp', '-static-intel'])
env['CCFLAGS'].append('-openmp')
env['CPPFLAGS'].append('-openmp')
env['CXXFLAGS'].append('-openmp')
else:
env.Append(LINKFLAGS=['-lgomp'])
env['CCFLAGS'].append('-fopenmp')
env['CPPFLAGS'].append('-fopenmp')
env['CXXFLAGS'].append('-fopenmp')
if env['OURPLATFORM']=='win32-vc':
env['CCFLAGS'].append('/openmp')
env['CPPFLAGS'].append('/openmp')
env['CXXFLAGS'].append('/openmp')
else:
if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
env.Append(LINKFLAGS=['-openmp', '-static-intel'])
env['CCFLAGS'].append('-openmp')
env['CPPFLAGS'].append('-openmp')
env['CXXFLAGS'].append('-openmp')
else:
env.Append(CCFLAGS=['-fopenmp'])
env.Append(CPPFLAGS=['-fopenmp'])
env.Append(CXXFLAGS=['-fopenmp'])
# env.Append(LINKFLAGS=['-fprofile-generate'])
#check for additional debug libnames
@@ -224,22 +223,31 @@ if env['OURPLATFORM'] == 'linux2' :
return result
env2 = env.Copy( LIBPATH = env['BF_OPENAL'] )
conf = Configure( env2, {'CheckFreeAlut' : CheckFreeAlut}, '.sconf_temp', '/dev/null' )
sconf_temp = mkdtemp()
conf = Configure( env2, {'CheckFreeAlut' : CheckFreeAlut}, sconf_temp, '/dev/null' )
if conf.CheckFreeAlut( env2 ):
env['BF_OPENAL_LIB'] += ' alut'
del env2
for root, dirs, files in os.walk('.sconf_temp', topdown=False):
root = ''
for root, dirs, files in os.walk(sconf_temp, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
os.rmdir(root)
if root: os.rmdir(root)
if len(B.quickdebug) > 0 and printdebug != 0:
print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
for l in B.quickdebug:
print "\t" + l
# remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
if env['WITH_BF_STATICCXX']:
if 'stdc++' in env['LLIBS']:
env['LLIBS'] = env['LLIBS'].replace('stdc++', ' ')
else:
print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
# check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
if 'blenderplayer' in B.targets:
env['WITH_BF_PLAYER'] = True
@@ -247,6 +255,31 @@ if 'blenderplayer' in B.targets:
if 'blendernogame' in B.targets:
env['WITH_BF_GAMEENGINE'] = False
if 'blenderlite' in B.targets:
env['WITH_BF_GAMEENGINE'] = False
env['WITH_BF_OPENAL'] = False
env['WITH_BF_OPENEXR'] = False
env['WITH_BF_ICONV'] = False
env['WITH_BF_INTERNATIONAL'] = False
env['WITH_BF_OPENJPEG'] = False
env['WITH_BF_FFMPEG'] = False
env['WITH_BF_QUICKTIME'] = False
env['WITH_BF_YAFRAY'] = False
env['WITH_BF_REDCODE'] = False
env['WITH_BF_FTGL'] = False
env['WITH_BF_DDS'] = False
env['WITH_BF_ZLIB'] = False
env['WITH_BF_SDL'] = False
env['WITH_BF_JPEG'] = False
env['WITH_BF_PNG'] = False
env['WITH_BF_ODE'] = False
env['WITH_BF_BULLET'] = False
env['WITH_BF_BINRELOC'] = False
env['BF_BUILDINFO'] = False
env['BF_NO_ELBEEM'] = True
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
#B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
B.root_build_dir = env['BF_BUILDDIR']
@@ -264,10 +297,18 @@ if not quickie and do_clean:
if os.path.exists(B.root_build_dir):
print B.bc.HEADER+'Cleaning...'+B.bc.ENDC
dirs = os.listdir(B.root_build_dir)
for dir in dirs:
if os.path.isdir(B.root_build_dir + dir) == 1:
print "clean dir %s"%(B.root_build_dir+dir)
shutil.rmtree(B.root_build_dir+dir)
for entry in dirs:
if os.path.isdir(B.root_build_dir + entry) == 1:
print "clean dir %s"%(B.root_build_dir+entry)
shutil.rmtree(B.root_build_dir+entry)
else: # remove file
print "remove file %s"%(B.root_build_dir+entry)
os.remove(B.root_build_dir+entry)
for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
'extern/xvidcore/build/generic/platform.inc']:
if os.path.exists(confile):
print "clean file %s"%confile
os.remove(confile)
print B.bc.OKGREEN+'...done'+B.bc.ENDC
else:
print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
@@ -350,33 +391,56 @@ else:
blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
#-- .blender
#- dont do .blender and scripts for darwin, it is already in the bundle
dotblendlist = []
dottargetlist = []
for dp, dn, df in os.walk('bin/.blender'):
if 'CVS' in dn:
dn.remove('CVS')
if '.svn' in dn:
dn.remove('.svn')
for f in df:
dotblendlist.append(dp+os.sep+f)
dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
dotblenderinstall = []
for targetdir,srcfile in zip(dottargetlist, dotblendlist):
td, tf = os.path.split(targetdir)
dotblenderinstall.append(env.Install(dir=td, source=srcfile))
#-- .blender/scripts
scriptinstall = []
scriptpath='release/scripts'
for dp, dn, df in os.walk(scriptpath):
if 'CVS' in dn:
dn.remove('CVS')
if '.svn' in dn:
dn.remove('.svn')
dir=env['BF_INSTALLDIR']+'/.blender/scripts'+dp[len(scriptpath):]
source=[dp+os.sep+f for f in df]
scriptinstall.append(env.Install(dir=dir,source=source))
if env['OURPLATFORM']!='darwin':
for dp, dn, df in os.walk('bin/.blender'):
if 'CVS' in dn:
dn.remove('CVS')
if '.svn' in dn:
dn.remove('.svn')
for f in df:
dotblendlist.append(dp+os.sep+f)
dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
dotblenderinstall = []
for targetdir,srcfile in zip(dottargetlist, dotblendlist):
td, tf = os.path.split(targetdir)
dotblenderinstall.append(env.Install(dir=td, source=srcfile))
#-- .blender/scripts
scriptpath='release/scripts'
for dp, dn, df in os.walk(scriptpath):
if 'CVS' in dn:
dn.remove('CVS')
if '.svn' in dn:
dn.remove('.svn')
dir=env['BF_INSTALLDIR']+'/.blender/scripts'+dp[len(scriptpath):]
source=[dp+os.sep+f for f in df]
scriptinstall.append(env.Install(dir=dir,source=source))
#-- icons
if env['OURPLATFORM']=='linux2':
iconlist = []
icontargetlist = []
for tp, tn, tf in os.walk('release/freedesktop/icons'):
if 'CVS' in tn:
tn.remove('CVS')
if '.svn' in tn:
tn.remove('.svn')
for f in tf:
print ">>>", env['BF_INSTALLDIR'], tp, f
iconlist.append(tp+os.sep+f)
icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f)
iconinstall = []
for targetdir,srcfile in zip(icontargetlist, iconlist):
td, tf = os.path.split(targetdir)
iconinstall.append(env.Install(dir=td, source=srcfile))
#-- plugins
pluglist = []
@@ -387,9 +451,26 @@ for tp, tn, tf in os.walk('release/plugins'):
if '.svn' in tn:
tn.remove('.svn')
for f in tf:
print ">>>", env['BF_INSTALLDIR'], tp, f
pluglist.append(tp+os.sep+f)
plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
# header files for plugins
pluglist.append('source/blender/blenpluginapi/documentation.h')
plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'documentation.h')
pluglist.append('source/blender/blenpluginapi/externdef.h')
plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'externdef.h')
pluglist.append('source/blender/blenpluginapi/floatpatch.h')
plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'floatpatch.h')
pluglist.append('source/blender/blenpluginapi/iff.h')
plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'iff.h')
pluglist.append('source/blender/blenpluginapi/plugin.h')
plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'plugin.h')
pluglist.append('source/blender/blenpluginapi/util.h')
plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'util.h')
pluglist.append('source/blender/blenpluginapi/plugin.DEF')
plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep + 'plugin.def')
plugininstall = []
for targetdir,srcfile in zip(plugtargetlist, pluglist):
td, tf = os.path.split(targetdir)
@@ -407,7 +488,12 @@ for tp, tn, tf in os.walk('release/text'):
textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
if env['OURPLATFORM']=='darwin':
allinstall = [blenderinstall, plugininstall, textinstall]
elif env['OURPLATFORM']=='linux2':
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
else:
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
@@ -427,10 +513,17 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
dllsources += ['${LCGDIR}/pthreads/lib/pthreadVC2.dll']
if env['WITH_BF_ICONV']:
dllsources += ['${LCGDIR}/iconv/lib/iconv.dll']
# if env['WITH_BF_FFMPEG']:
# dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
# '${LCGDIR}/ffmpeg/lib/avformat-51.dll',
# '${LCGDIR}/ffmpeg/lib/avutil-49.dll']
if env['WITH_BF_FFMPEG']:
dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
'${LCGDIR}/ffmpeg/lib/avformat-52.dll',
'${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
'${LCGDIR}/ffmpeg/lib/avutil-49.dll',
'${LCGDIR}/ffmpeg/lib/libfaad-0.dll',
'${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
'${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
'${LCGDIR}/ffmpeg/lib/libx264-59.dll',
'${LCGDIR}/ffmpeg/lib/xvidcore.dll',
'${LCGDIR}/ffmpeg/lib/swscale-0.dll']
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
allinstall += windlls
@@ -449,12 +542,16 @@ if not env['WITH_BF_GAMEENGINE']:
blendernogame = env.Alias('blendernogame', B.program_list)
Depends(blendernogame,installtarget)
if 'blenderlite' in B.targets:
blenderlite = env.Alias('blenderlite', B.program_list)
Depends(blenderlite,installtarget)
Depends(nsiscmd, allinstall)
Default(B.program_list)
if not env['WITHOUT_BF_INSTALL']:
Default(installtarget)
Default(installtarget)
#------------ RELEASE
# TODO: zipup the installation

View File

@@ -9,14 +9,15 @@ French:fr_FR
Spanish:es_ES
Catalan:ca_ES
Czech:cs_CZ
Brazilian Portuguese:pt_br
Brazilian Portuguese:pt_BR
Simplified Chinese:zh_CN
Russian:ru_RU
Croatian:hr_HR
Serbian:sr
Ukrainian:uk
Ukrainian:uk_UA
Polish:pl_PL
Romanian:ro
Arabic:ar
Bulgarian:bg
Greek:el
Korean:kr

View File

@@ -1,13 +1,10 @@
# $Id$
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +22,7 @@
#
# Contributor(s): Jacques Beaurain.
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
MESSAGE(STATUS "Configuring blenderplayer")
@@ -35,6 +32,11 @@ IF(WITH_QUICKTIME)
ADD_DEFINITIONS(-DWITH_QUICKTIME)
ENDIF(WITH_QUICKTIME)
IF(LINUX)
ADD_DEFINITIONS(-DWITH_BINRELOC)
INCLUDE_DIRECTORIES(${BINRELOC_INC})
endif(LINUX)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
@@ -53,6 +55,10 @@ FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} gp_common gp_ghost blenkernel_blc)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(UNIX)
# Sort libraries
SET(BLENDER_SORTED_LIBS
@@ -80,10 +86,12 @@ IF(UNIX)
bf_oglrasterizer
bf_expressions
bf_scenegraph
bf_IK
bf_moto
bf_soundsystem
bf_kernel
bf_nodes
bf_gpu
bf_imbuf
bf_avi
kx_network
@@ -101,6 +109,8 @@ IF(UNIX)
bf_readblenfile
blenkernel_blc
bf_quicktime
extern_binreloc
extern_glew
)
FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})

View File

@@ -1,10 +1,48 @@
LCGDIR = '#../../trunk/lib/darwin-6.1-powerpc'
#
# Note : if you want to alter this file
# copy it as a whole in the upper folder
# as user-config.py
# dont create a new file with only some
# vars changed.
import commands
# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
USE_SDK='true'
BF_PYTHON_VERSION = '2.3'
cmd = 'uname -p'
MAC_PROC=commands.getoutput(cmd)
cmd = 'uname -r'
cmd_res=commands.getoutput(cmd)
if cmd_res[0]=='7':
MAC_CUR_VER='10.3'
elif cmd_res[0]=='8':
MAC_CUR_VER='10.4'
else:
MAC_CUR_VER='10.5'
if MAC_PROC == 'powerpc':
LCGDIR = '#../lib/darwin-6.1-powerpc'
else :
LCGDIR = '#../lib/darwin-8.x.i386'
LIBDIR = '${LCGDIR}'
if MAC_PROC== 'powerpc' and BF_PYTHON_VERSION == '2.3':
MAC_MIN_VERS = '10.3'
MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
else:
MAC_MIN_VERS = '10.4'
MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
# enable ffmpeg support
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
BF_FFMPEG = LIBDIR +'/ffmpeg'
BF_FFMPEG_INC = '#extern/ffmpeg/include'
BF_FFMPEG = "#extern/ffmpeg"
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
if USE_SDK=='true':
BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
#BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
#BF_FFMPEG_LIB = 'avformat.a avcodec.a avutil.a'
@@ -14,30 +52,53 @@ BF_VERSE_LIBPATH = "${BF_BUILDDIR}/extern/verse/dist"
BF_VERSE_INCLUDE = BF_VERSE
BF_VERSE_LIBS = "libverse"
# python.org libs install in /library
BF_PYTHON_VERSION = '2.5'
# python.org libs install in /library we want to use that for 2.5
#
# if you want py2.5 on leopard without installing
# change value to BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
# BEWARE: in that case it will work only on leopard
if BF_PYTHON_VERSION=='2.3':
BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
else:
BF_PYTHON = '/Library/Frameworks/Python.framework'
BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
BF_PYTHON_INC = '${BF_PYTHON}/Headers'
BF_PYTHON_BINARY = '${BF_PYTHON}/python'
BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = ''
BF_PYTHON_LIBPATH = '${BF_PYTHON}/Versions/${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
#BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
BF_PYTHON_LINKFLAGS = '-u __dummy -u _PyMac_Error -framework System -framework Python'
BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
BF_PYTHON_LINKFLAGS = '-u _PyMac_Error -framework System -framework Python'
if MAC_CUR_VER=='10.3' or MAC_CUR_VER=='10.4':
BF_PYTHON_LINKFLAGS ='-u __dummy '+BF_PYTHON_LINKFLAGS
BF_QUIET = '1'
WITH_BF_OPENMP = '0'
WITH_BF_OPENAL = 'true'
# Note : should be true, but openal simply dont work on intel
if MAC_PROC == 'i386':
WITH_BF_OPENAL = 'false'
else:
WITH_BF_OPENAL = 'true'
#different lib must be used following version of gcc
# for gcc 3.3
#BF_OPENAL = LIBDIR + '/openal'
# for gcc 3.4
BF_OPENAL = '#../../trunk/lib/darwin-8.0.0-powerpc/openal'
# for gcc 3.4 and ulterior
if MAC_PROC == 'powerpc':
BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
else :
BF_OPENAL = LIBDIR + '/openal'
WITH_BF_STATICOPENAL = 'false'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
@@ -49,10 +110,13 @@ WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
BF_OPENEXR = '${LCGDIR}/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'
@@ -89,7 +153,7 @@ BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='true'
WITH_BF_PLAYER='false'
WITH_BF_PLAYER='true'
WITH_BF_ODE = 'false'
BF_ODE = LIBDIR + '/ode'
@@ -132,11 +196,11 @@ BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'true' # -DWITH_QUICKTIME
WITH_BF_ICONV = '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'
#BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'true'
@@ -144,20 +208,41 @@ BF_OPENGL_LIB = 'GL GLU'
BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
BF_OPENGL_LINKFLAGS = '-framework OpenGL'
##
##CC = gcc
##CCC = g++
##ifeq ($CPU),alpha)
## CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -mieee
CFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
CFLAGS = ['-pipe','-fPIC','-funsigned-char']
CPPFLAGS = ['-fpascal-strings']
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-fpascal-strings']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-fpascal-strings']
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fpascal-strings']
CXXFLAGS = [ '-pipe','-fPIC','-funsigned-char', '-fpascal-strings']
PLATFORM_LINKFLAGS = '-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime'
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
LLIBS = 'stdc++ SystemStubs'
# some flags shuffling for different Os versions
if MAC_MIN_VERS == '10.3':
CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
PLATFORM_LINKFLAGS = '-fuse-cxa-atexit '+PLATFORM_LINKFLAGS
LLIBS = LLIBS + ' crt3.o'
if USE_SDK=='true':
SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS]
PLATFORM_LINKFLAGS = '-mmacosx-version-min='+MAC_MIN_VERS+ ' -Wl,-syslibroot,' + MACOSX_SDK+" "+PLATFORM_LINKFLAGS
CCFLAGS=SDK_FLAGS+CCFLAGS
CXXFLAGS=SDK_FLAGS+CXXFLAGS
# you can add -mssse3 if gcc >= 4.2
if MAC_PROC == 'i386':
REL_CFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
REL_CCFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
else:
CFLAGS = CFLAGS+['-fno-strict-aliasing']
CCFLAGS = CCFLAGS+['-fno-strict-aliasing']
CXXFLAGS = CXXFLAGS+['-fno-strict-aliasing']
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##
##AR = ar
@@ -172,7 +257,6 @@ CC_WARN = ' -Wall -Wno-long-double'
##FIX_STUBS_WARNINGS = -Wno-unused
LLIBS = 'stdc++ SystemStubs'
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)

View File

@@ -6,18 +6,28 @@ BF_VERSE_INCLUDE = "#extern/verse/dist"
BF_PYTHON = '/usr'
BF_PYTHON_VERSION = '2.5'
WITH_BF_STATICPYTHON = 'false'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic']
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION}.a'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
BF_OPENAL = '/usr'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# some distros have a separate libalut
# if you get linker complaints, you need to uncomment the line below
# BF_OPENAL_LIB = 'openal alut'
# BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a ${BF_OPENAL}/lib/libalut.a'
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
BF_SDL = '/usr' #$(shell sdl-config --prefix)
@@ -28,14 +38,17 @@ WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
BF_OPENEXR = '/usr'
# when compiling with your own openexr lib you might need to set...
# BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR ${BF_OPENEXR}/include'
BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
WITH_BF_DDS = 'true'
WITH_BF_JPEG = 'true'
@@ -130,6 +143,24 @@ BF_FFMPEG_LIB = ''
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
WITH_BF_OPENJPEG = 'true'
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
# Uncomment the following two lines to use system's ffmpeg
# BF_FFMPEG = '/usr'
# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_REDCODE = 'false'
BF_REDCODE = '#extern/libredcode'
BF_REDCODE_LIB = ''
# Uncomment the following two lines to use system's ffmpeg
# BF_FFMPEG = '/usr'
# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
BF_REDCODE_INC = '${BF_REDCODE}/include'
BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'false'
BF_OPENGL = '/usr'
@@ -148,8 +179,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
CPPFLAGS = ['-DXP_UNIX']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
REL_CFLAGS = ['-O3']
REL_CCFLAGS = ['-O3']
##BF_DEPEND = 'true'
##
##AR = ar

View File

@@ -14,10 +14,18 @@ BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal_static'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
BF_SDL = LIBDIR + '/sdl'
@@ -34,10 +42,13 @@ WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
BF_OPENEXR = LIBDIR + '/gcc/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Half IlmImf Iex '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'

View File

@@ -9,10 +9,12 @@ BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}/config'
WITH_BF_OPENAL = 'false'
# WITH_BF_STATICOPENAL = 'false'
#BF_OPENAL = LIBDIR + '/openal'
#BF_OPENAL_INC = '${BF_OPENAL}/include'
#BF_OPENAL_LIB = 'openal'
#BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
#BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
WITH_BF_SDL = 'true'
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
@@ -24,9 +26,12 @@ WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'false'
WITH_BF_STATICOPENEXR = 'false'
BF_OPENEXR = '/usr/local'
BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'

View File

@@ -9,10 +9,18 @@ BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_
BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic']
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
BF_OPENAL = '/usr/local'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
BF_OPENAL_LIB = 'openal'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
@@ -24,10 +32,13 @@ WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
BF_OPENEXR = '/usr/local'
BF_OPENEXR_INC = ['${BF_OPENEXR}/include', '${BF_OPENEXR}/include/OpenEXR' ]
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'

View File

@@ -12,10 +12,13 @@ BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'dxguid openal_static'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
WITH_BF_FFMPEG = 'false'
BF_FFMPEG_LIB = 'avformat swscale avcodec avutil xvidcore x264'
@@ -37,10 +40,13 @@ WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
BF_OPENEXR = LIBDIR + '/gcc/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Half IlmImf Iex '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'

View File

@@ -9,7 +9,7 @@ WITH_BF_FFMPEG = 'false' # -DWITH_FFMPEG
BF_FFMPEG = LIBDIR +'/ffmpeg'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avformat-51.lib avcodec-51.lib avutil-49.lib'
BF_FFMPEG_LIB = 'avformat-52.lib avcodec-51.lib avdevice-52.lib avutil-49.lib swscale-0.lib'
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '2.5'
@@ -19,10 +19,18 @@ BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include ${BF_OPENAL}/include/AL '
BF_OPENAL_LIB = 'dxguid openal_static'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# TODO - are these useful on win32?
# BF_CXX = '/usr'
# WITH_BF_STATICCXX = 'false'
# BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_ICONV = 'true'
BF_ICONV = LIBDIR + '/iconv'
@@ -45,10 +53,13 @@ WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib_msvc'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'
@@ -157,7 +168,7 @@ REL_CCFLAGS = ['-O2', '-DNDEBUG']
C_WARN = []
CC_WARN = []
LLIBS = 'ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid'
LLIBS = 'ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid'
PLATFORM_LINKFLAGS = '''
/SUBSYSTEM:CONSOLE
@@ -170,7 +181,6 @@ PLATFORM_LINKFLAGS = '''
/NODEFAULTLIB:"libcd.lib"
/NODEFAULTLIB:"libcpd.lib"
/NODEFAULTLIB:"libcp.lib"
/NODEFAULTLIB:"libcmtd.lib"
'''
BF_BUILDDIR = '..\\build\\win32-vc'

View File

@@ -1,6 +1,8 @@
$Id$
Note: The current official release of SCons is 0.97
Note: The current official release of SCons is 0.98, but
our system still works for 0.97. However, this will be fixed
soon.
Blenders SCons build scripts
============================
@@ -76,6 +78,11 @@ $Id$
likings. Any value set here will override the ones from the
(platform)-config.py.
You can use BF_CONFIG argument to override the default user-config.py
check. This is just like the user-config.py, but just with another name:
% scons BF_CONFIG=myownsettings
If you want to quickly test a new setting, you can give the option
also on the command-line:

12
extern/CMakeLists.txt vendored
View File

@@ -1,13 +1,10 @@
# $Id$
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +22,7 @@
#
# Contributor(s): Jacques Beaurain.
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
IF(WITH_GAMEENGINE)
SUBDIRS(qhull solid)
@@ -46,3 +43,6 @@ ENDIF(WITH_VERSE)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SUBDIRS(binreloc)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SUBDIRS(glew)

11
extern/Makefile vendored
View File

@@ -1,14 +1,11 @@
# $Id$
#
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,14 +23,14 @@
#
# Contributor(s): none yet.
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
# Bounces make to subdirectories. Also installs after succesful all target.
include nan_definitions.mk
SOURCEDIR = extern
DIR = $(OCGDIR)/extern
DIRS = qhull/src solid
DIRS = qhull/src solid glew/src
ifeq ($(WITH_FREETYPE2), true)
DIRS += bFTGL/src

15
extern/SConscript vendored
View File

@@ -2,6 +2,8 @@
Import('env')
SConscript(['glew/SConscript'])
if env['WITH_BF_GAMEENGINE']:
SConscript(['qhull/SConscript',
'solid/SConscript'])
@@ -16,7 +18,16 @@ if env['WITH_BF_VERSE']:
SConscript(['verse/dist/SConstruct'])
if env['WITH_BF_FFMPEG'] and env['BF_FFMPEG_LIB'] == '':
SConscript(['ffmpeg/SConscript']);
SConscript(['x264/SConscript'])
SConscript(['libmp3lame/SConscript'])
SConscript(['xvidcore/SConscript'])
SConscript(['ffmpeg/SConscript'])
if env['WITH_BF_OPENJPEG'] and env['BF_OPENJPEG_LIB'] == '':
SConscript(['libopenjpeg/SConscript'])
if env['WITH_BF_REDCODE'] and env['BF_REDCODE_LIB'] == '':
SConscript(['libredcode/SConscript'])
if env['OURPLATFORM'] == 'linux2':
SConscript(['binreloc/SConscript']);
SConscript(['binreloc/SConscript']);

View File

@@ -1,13 +1,10 @@
# $Id$
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +22,7 @@
#
# Contributor(s): Jacques Beaurain.
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
SET(INC include src ${FREETYPE_INC})

0
extern/bFTGL/README.txt vendored Executable file → Normal file
View File

View File

@@ -22,7 +22,7 @@ Import('env')
#ftgl_env.Append (CPPDEFINES = defines)
incs = 'include src ' + env['BF_FREETYPE_INC']
incs = 'include src ' + env['BF_FREETYPE_INC'] + ' ' + env['BF_OPENGL_INC']
defs = ''
sources = env.Glob('src/*.cpp')

0
extern/bFTGL/include/FTBBox.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTBitmapGlyph.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTBufferGlyph.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTFace.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTFont.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTGLBitmapFont.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTGLBufferFont.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTGLOutlineFont.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTGLPixmapFont.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTGLPolygonFont.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTGLTextureFont.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTGlyph.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTGlyphContainer.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTLibrary.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTPixmapGlyph.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTPoint.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTSize.h vendored Executable file → Normal file
View File

0
extern/bFTGL/include/FTTextureGlyph.h vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTBitmapGlyph.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTBufferGlyph.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTFace.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTFont.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTGLBitmapFont.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTGLBufferFont.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTGLOutlineFont.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTGLPixmapFont.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTGLPolygonFont.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTGLTextureFont.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTGlyph.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTGlyphContainer.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTLibrary.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTPixmapGlyph.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTPoint.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTSize.cpp vendored Executable file → Normal file
View File

0
extern/bFTGL/src/FTTextureGlyph.cpp vendored Executable file → Normal file
View File

View File

@@ -1,15 +1,12 @@
#
# $Id$
#
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,7 +24,7 @@
#
# Contributor(s): none yet.
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
#
#

View File

@@ -1,13 +1,10 @@
# $Id$
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +22,7 @@
#
# Contributor(s): Jacques Beaurai, Erwin Coumans
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
SET(INC . src)
@@ -38,6 +35,7 @@ FILE(GLOB SRC
src/BulletDynamics/ConstraintSolver/*.cpp
src/BulletDynamics/Vehicle/*.cpp
src/BulletDynamics/Dynamics/*.cpp
src/BulletSoftBody/*.cpp
)
ADD_DEFINITIONS(-D_LIB)

View File

@@ -1,15 +1,12 @@
#
# $Id$
#
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,7 +24,7 @@
#
# Contributor(s):
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
# ***** END GPL LICENSE BLOCK *****
LIBNAME = bullet2
include nan_definitions.mk
SOURCEDIR = extern/$(LIBNAME)
@@ -43,7 +40,8 @@ BulletCollision/NarrowPhaseCollision \
BulletCollision//CollisionDispatch \
BulletDynamics/ConstraintSolver \
BulletDynamics/Vehicle \
BulletDynamics/Dynamics
BulletDynamics/Dynamics \
BulletSoftBody
include nan_subdirs.mk

View File

@@ -58,9 +58,11 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\C
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Vehicle MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletSoftBody MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include
XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
XCOPY /Y ..\..\src\BulletSoftBody\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\BulletCollision\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
@@ -394,12 +396,24 @@ ECHO Done
<File
RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSequentialImpulseConstraintSolver.h">
</File>
<File
RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSliderConstraint.cpp">
</File>
<File
RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSliderConstraint.h">
</File>
<File
RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSolve2LinearConstraint.cpp">
</File>
<File
RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSolve2LinearConstraint.h">
</File>
<File
RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSolverBody.h">
</File>
<File
RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btSolverConstraint.h">
</File>
<File
RelativePath="..\..\src\BulletDynamics\ConstraintSolver\btTypedConstraint.cpp">
</File>
@@ -410,6 +424,12 @@ ECHO Done
<Filter
Name="Dynamics"
Filter="">
<File
RelativePath="..\..\src\BulletDynamics\Dynamics\btContinuousDynamicsWorld.cpp">
</File>
<File
RelativePath="..\..\src\BulletDynamics\Dynamics\btContinuousDynamicsWorld.h">
</File>
<File
RelativePath="..\..\src\BulletDynamics\Dynamics\btDiscreteDynamicsWorld.cpp">
</File>
@@ -482,18 +502,45 @@ ECHO Done
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btCollisionAlgorithm.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btDbvt.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btDbvt.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btDbvtBroadphase.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btDbvtBroadphase.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btDispatcher.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btDispatcher.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btMultiSapBroadphase.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btMultiSapBroadphase.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btOverlappingPairCache.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btOverlappingPairCache.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btOverlappingPairCallback.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btQuantizedBvh.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btQuantizedBvh.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\BroadphaseCollision\btSimpleBroadphase.cpp">
</File>
@@ -534,6 +581,12 @@ ECHO Done
<File
RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkEpa.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkEpa2.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkEpa2.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\NarrowPhaseCollision\btGjkEpaPenetrationDepthSolver.cpp">
</File>
@@ -589,6 +642,21 @@ ECHO Done
<Filter
Name="CollisionDispatch"
Filter="">
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btBoxBoxCollisionAlgorithm.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btBoxBoxCollisionAlgorithm.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btBoxBoxDetector.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btBoxBoxDetector.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCollisionConfiguration.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btCollisionCreateFunc.h">
</File>
@@ -628,6 +696,18 @@ ECHO Done
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btConvexConvexAlgorithm.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btConvexPlaneCollisionAlgorithm.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btConvexPlaneCollisionAlgorithm.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btDefaultCollisionConfiguration.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btDefaultCollisionConfiguration.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionDispatch\btEmptyCollisionAlgorithm.cpp">
</File>
@@ -731,6 +811,12 @@ ECHO Done
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexHullShape.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexInternalShape.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexInternalShape.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btConvexShape.cpp">
</File>
@@ -761,12 +847,21 @@ ECHO Done
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btHeightfieldTerrainShape.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btMaterial.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btMinkowskiSumShape.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btMinkowskiSumShape.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btMultimaterialTriangleMeshShape.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btMultimaterialTriangleMeshShape.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btMultiSphereShape.cpp">
</File>
@@ -785,6 +880,18 @@ ECHO Done
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btPolyhedralConvexShape.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btScaledBvhTriangleMeshShape.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btScaledBvhTriangleMeshShape.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btShapeHull.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btShapeHull.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btSphereShape.cpp">
</File>
@@ -827,6 +934,12 @@ ECHO Done
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleIndexVertexArray.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleIndexVertexMaterialArray.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleIndexVertexMaterialArray.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleMesh.cpp">
</File>
@@ -842,6 +955,12 @@ ECHO Done
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btTriangleShape.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btUniformScalingShape.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\CollisionShapes\btUniformScalingShape.h">
</File>
</Filter>
</Filter>
<Filter
@@ -859,6 +978,12 @@ ECHO Done
<File
RelativePath="..\..\src\LinearMath\btAlignedObjectArray.h">
</File>
<File
RelativePath="..\..\src\LinearMath\btConvexHull.cpp">
</File>
<File
RelativePath="..\..\src\LinearMath\btConvexHull.h">
</File>
<File
RelativePath="..\..\src\LinearMath\btDefaultMotionState.h">
</File>
@@ -868,6 +993,9 @@ ECHO Done
<File
RelativePath="..\..\src\LinearMath\btGeometryUtil.h">
</File>
<File
RelativePath="..\..\src\LinearMath\btHashMap.h">
</File>
<File
RelativePath="..\..\src\LinearMath\btIDebugDraw.h">
</File>
@@ -886,6 +1014,9 @@ ECHO Done
<File
RelativePath="..\..\src\LinearMath\btPoint3.h">
</File>
<File
RelativePath="..\..\src\LinearMath\btPoolAllocator.h">
</File>
<File
RelativePath="..\..\src\LinearMath\btQuadWord.h">
</File>
@@ -904,9 +1035,6 @@ ECHO Done
<File
RelativePath="..\..\src\LinearMath\btScalar.h">
</File>
<File
RelativePath="..\..\src\LinearMath\btSimdMinMax.h">
</File>
<File
RelativePath="..\..\src\LinearMath\btStackAlloc.h">
</File>
@@ -920,6 +1048,58 @@ ECHO Done
RelativePath="..\..\src\LinearMath\btVector3.h">
</File>
</Filter>
<Filter
Name="BulletSoftBody"
Filter="">
<File
RelativePath="..\..\src\BulletSoftBody\btSoftBody.cpp">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftBody.h">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftBodyConcaveCollisionAlgorithm.cpp">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftBodyConcaveCollisionAlgorithm.h">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftBodyHelpers.cpp">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftBodyHelpers.h">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftBodyInternals.h">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftBodyRigidBodyCollisionConfiguration.cpp">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftBodyRigidBodyCollisionConfiguration.h">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftRigidCollisionAlgorithm.cpp">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftRigidCollisionAlgorithm.h">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftRigidDynamicsWorld.cpp">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftRigidDynamicsWorld.h">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftSoftCollisionAlgorithm.cpp">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSoftSoftCollisionAlgorithm.h">
</File>
<File
RelativePath="..\..\src\BulletSoftBody\btSparseSDF.h">
</File>
</Filter>
</Filter>
</Files>
<Globals>

View File

@@ -1,3 +1,8 @@
***
Apply bullet_compound_raycast.patch if not already applied in Bullet source
This patch is needed to return correct raycast results on compound shape.
/ben
*** These files in extern/bullet2 are NOT part of the Blender build yet ***

View File

@@ -23,15 +23,153 @@ subject to the following restrictions:
#ifndef BULLET_C_API_H
#define BULLET_C_API_H
#define PL_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
#ifdef BT_USE_DOUBLE_PRECISION
typedef double plReal;
#else
typedef float plReal;
#endif
typedef plReal plVector3[3];
typedef plReal plQuaternion[4];
#ifdef __cplusplus
extern "C" {
#endif
double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3]);
/* Particular physics SDK */
PL_DECLARE_HANDLE(plPhysicsSdkHandle);
/* Dynamics world, belonging to some physics SDK */
PL_DECLARE_HANDLE(plDynamicsWorldHandle);
/* Rigid Body that can be part of a Dynamics World */
PL_DECLARE_HANDLE(plRigidBodyHandle);
/* Collision Shape/Geometry, property of a Rigid Body */
PL_DECLARE_HANDLE(plCollisionShapeHandle);
/* Constraint for Rigid Bodies */
PL_DECLARE_HANDLE(plConstraintHandle);
/* Triangle Mesh interface */
PL_DECLARE_HANDLE(plMeshInterfaceHandle);
/* Broadphase Scene/Proxy Handles */
PL_DECLARE_HANDLE(plCollisionBroadphaseHandle);
PL_DECLARE_HANDLE(plBroadphaseProxyHandle);
PL_DECLARE_HANDLE(plCollisionWorldHandle);
/*
Create and Delete a Physics SDK
*/
extern plPhysicsSdkHandle plNewBulletSdk(); //this could be also another sdk, like ODE, PhysX etc.
extern void plDeletePhysicsSdk(plPhysicsSdkHandle physicsSdk);
/* Collision World, not strictly necessary, you can also just create a Dynamics World with Rigid Bodies which internally manages the Collision World with Collision Objects */
typedef void(*btBroadphaseCallback)(void* clientData, void* object1,void* object2);
extern plCollisionBroadphaseHandle plCreateSapBroadphase(btBroadphaseCallback beginCallback,btBroadphaseCallback endCallback);
extern void plDestroyBroadphase(plCollisionBroadphaseHandle bp);
extern plBroadphaseProxyHandle plCreateProxy(plCollisionBroadphaseHandle bp, void* clientData, plReal minX,plReal minY,plReal minZ, plReal maxX,plReal maxY, plReal maxZ);
extern void plDestroyProxy(plCollisionBroadphaseHandle bp, plBroadphaseProxyHandle proxyHandle);
extern void plSetBoundingBox(plBroadphaseProxyHandle proxyHandle, plReal minX,plReal minY,plReal minZ, plReal maxX,plReal maxY, plReal maxZ);
/* todo: add pair cache support with queries like add/remove/find pair */
extern plCollisionWorldHandle plCreateCollisionWorld(plPhysicsSdkHandle physicsSdk);
/* todo: add/remove objects */
/* Dynamics World */
extern plDynamicsWorldHandle plCreateDynamicsWorld(plPhysicsSdkHandle physicsSdk);
extern void plDeleteDynamicsWorld(plDynamicsWorldHandle world);
extern void plStepSimulation(plDynamicsWorldHandle, plReal timeStep);
extern void plAddRigidBody(plDynamicsWorldHandle world, plRigidBodyHandle object);
extern void plRemoveRigidBody(plDynamicsWorldHandle world, plRigidBodyHandle object);
/* Rigid Body */
extern plRigidBodyHandle plCreateRigidBody( void* user_data, float mass, plCollisionShapeHandle cshape );
extern void plDeleteRigidBody(plRigidBodyHandle body);
/* Collision Shape definition */
extern plCollisionShapeHandle plNewSphereShape(plReal radius);
extern plCollisionShapeHandle plNewBoxShape(plReal x, plReal y, plReal z);
extern plCollisionShapeHandle plNewCapsuleShape(plReal radius, plReal height);
extern plCollisionShapeHandle plNewConeShape(plReal radius, plReal height);
extern plCollisionShapeHandle plNewCylinderShape(plReal radius, plReal height);
extern plCollisionShapeHandle plNewCompoundShape();
extern void plAddChildShape(plCollisionShapeHandle compoundShape,plCollisionShapeHandle childShape, plVector3 childPos,plQuaternion childOrn);
extern void plDeleteShape(plCollisionShapeHandle shape);
/* Convex Meshes */
extern plCollisionShapeHandle plNewConvexHullShape();
extern void plAddVertex(plCollisionShapeHandle convexHull, plReal x,plReal y,plReal z);
/* Concave static triangle meshes */
extern plMeshInterfaceHandle plNewMeshInterface();
extern void plAddTriangle(plMeshInterfaceHandle meshHandle, plVector3 v0,plVector3 v1,plVector3 v2);
extern plCollisionShapeHandle plNewStaticTriangleMeshShape(plMeshInterfaceHandle);
extern void plSetScaling(plCollisionShapeHandle shape, plVector3 scaling);
/* SOLID has Response Callback/Table/Management */
/* PhysX has Triggers, User Callbacks and filtering */
/* ODE has the typedef void dNearCallback (void *data, dGeomID o1, dGeomID o2); */
/* typedef void plUpdatedPositionCallback(void* userData, plRigidBodyHandle rbHandle, plVector3 pos); */
/* typedef void plUpdatedOrientationCallback(void* userData, plRigidBodyHandle rbHandle, plQuaternion orientation); */
/* get world transform */
extern void plGetOpenGLMatrix(plRigidBodyHandle object, plReal* matrix);
extern void plGetPosition(plRigidBodyHandle object,plVector3 position);
extern void plGetOrientation(plRigidBodyHandle object,plQuaternion orientation);
/* set world transform (position/orientation) */
extern void plSetPosition(plRigidBodyHandle object, const plVector3 position);
extern void plSetOrientation(plRigidBodyHandle object, const plQuaternion orientation);
extern void plSetEuler(plReal yaw,plReal pitch,plReal roll, plQuaternion orient);
typedef struct plRayCastResult {
plRigidBodyHandle m_body;
plCollisionShapeHandle m_shape;
plVector3 m_positionWorld;
plVector3 m_normalWorld;
} plRayCastResult;
extern int plRayCast(plDynamicsWorldHandle world, const plVector3 rayStart, const plVector3 rayEnd, plRayCastResult res);
/* Sweep API */
/* extern plRigidBodyHandle plObjectCast(plDynamicsWorldHandle world, const plVector3 rayStart, const plVector3 rayEnd, plVector3 hitpoint, plVector3 normal); */
/* Continuous Collision Detection API */
// needed for source/blender/blenkernel/intern/collision.c
double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3]);
#ifdef __cplusplus
}
#endif
#endif //BULLET_C_API_H

View File

@@ -21,640 +21,18 @@
#include <assert.h>
#ifdef DEBUG_BROADPHASE
#include <stdio.h>
void btAxisSweep3::debugPrintAxis(int axis, bool checkCardinality)
btAxisSweep3::btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned short int maxHandles, btOverlappingPairCache* pairCache)
:btAxisSweep3Internal<unsigned short int>(worldAabbMin,worldAabbMax,0xfffe,0xffff,maxHandles,pairCache)
{
int numEdges = m_pHandles[0].m_maxEdges[axis];
printf("SAP Axis %d, numEdges=%d\n",axis,numEdges);
int i;
for (i=0;i<numEdges+1;i++)
{
Edge* pEdge = m_pEdges[axis] + i;
Handle* pHandlePrev = getHandle(pEdge->m_handle);
int handleIndex = pEdge->IsMax()? pHandlePrev->m_maxEdges[axis] : pHandlePrev->m_minEdges[axis];
char beginOrEnd;
beginOrEnd=pEdge->IsMax()?'E':'B';
printf(" [%c,h=%d,p=%x,i=%d]\n",beginOrEnd,pEdge->m_handle,pEdge->m_pos,handleIndex);
}
if (checkCardinality)
assert(numEdges == m_numHandles*2+1);
}
#endif //DEBUG_BROADPHASE
btBroadphaseProxy* btAxisSweep3::createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask)
{
(void)shapeType;
BP_FP_INT_TYPE handleId = addHandle(min,max, userPtr,collisionFilterGroup,collisionFilterMask);
Handle* handle = getHandle(handleId);
return handle;
}
void btAxisSweep3::destroyProxy(btBroadphaseProxy* proxy)
{
Handle* handle = static_cast<Handle*>(proxy);
removeHandle(handle->m_handleId);
}
void btAxisSweep3::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
{
Handle* handle = static_cast<Handle*>(proxy);
updateHandle(handle->m_handleId,aabbMin,aabbMax);
}
btAxisSweep3::btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, int maxHandles)
:btOverlappingPairCache()
{
m_invalidPair = 0;
//assert(bounds.HasVolume());
// 1 handle is reserved as sentinel
btAssert(maxHandles > 1 && maxHandles < BP_MAX_HANDLES);
// init bounds
m_worldAabbMin = worldAabbMin;
m_worldAabbMax = worldAabbMax;
btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin;
BP_FP_INT_TYPE maxInt = BP_HANDLE_SENTINEL;
m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(maxInt)) / aabbSize;
// allocate handles buffer and put all handles on free list
m_pHandles = new Handle[maxHandles];
m_maxHandles = maxHandles;
m_numHandles = 0;
// handle 0 is reserved as the null index, and is also used as the sentinel
m_firstFreeHandle = 1;
{
for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < maxHandles; i++)
m_pHandles[i].SetNextFree(i + 1);
m_pHandles[maxHandles - 1].SetNextFree(0);
}
{
// allocate edge buffers
for (int i = 0; i < 3; i++)
m_pEdges[i] = new Edge[maxHandles * 2];
}
//removed overlap management
// make boundary sentinels
m_pHandles[0].m_clientObject = 0;
for (int axis = 0; axis < 3; axis++)
{
m_pHandles[0].m_minEdges[axis] = 0;
m_pHandles[0].m_maxEdges[axis] = 1;
m_pEdges[axis][0].m_pos = 0;
m_pEdges[axis][0].m_handle = 0;
m_pEdges[axis][1].m_pos = BP_HANDLE_SENTINEL;
m_pEdges[axis][1].m_handle = 0;
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis);
#endif //DEBUG_BROADPHASE
}
btAssert(maxHandles > 1 && maxHandles < 32767);
}
btAxisSweep3::~btAxisSweep3()
bt32BitAxisSweep3::bt32BitAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned int maxHandles , btOverlappingPairCache* pairCache )
:btAxisSweep3Internal<unsigned int>(worldAabbMin,worldAabbMax,0xfffffffe,0x7fffffff,maxHandles,pairCache)
{
for (int i = 2; i >= 0; i--)
delete[] m_pEdges[i];
delete[] m_pHandles;
}
void btAxisSweep3::quantize(BP_FP_INT_TYPE* out, const btPoint3& point, int isMax) const
{
btPoint3 clampedPoint(point);
clampedPoint.setMax(m_worldAabbMin);
clampedPoint.setMin(m_worldAabbMax);
btVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize;
out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getX() & BP_HANDLE_MASK) | isMax);
out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getY() & BP_HANDLE_MASK) | isMax);
out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getZ() & BP_HANDLE_MASK) | isMax);
}
BP_FP_INT_TYPE btAxisSweep3::allocHandle()
{
assert(m_firstFreeHandle);
BP_FP_INT_TYPE handle = m_firstFreeHandle;
m_firstFreeHandle = getHandle(handle)->GetNextFree();
m_numHandles++;
return handle;
}
void btAxisSweep3::freeHandle(BP_FP_INT_TYPE handle)
{
assert(handle > 0 && handle < m_maxHandles);
getHandle(handle)->SetNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle;
m_numHandles--;
}
BP_FP_INT_TYPE btAxisSweep3::addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask)
{
// quantize the bounds
BP_FP_INT_TYPE min[3], max[3];
quantize(min, aabbMin, 0);
quantize(max, aabbMax, 1);
// allocate a handle
BP_FP_INT_TYPE handle = allocHandle();
assert(handle!= 0xcdcd);
Handle* pHandle = getHandle(handle);
pHandle->m_handleId = handle;
//pHandle->m_pOverlaps = 0;
pHandle->m_clientObject = pOwner;
pHandle->m_collisionFilterGroup = collisionFilterGroup;
pHandle->m_collisionFilterMask = collisionFilterMask;
// compute current limit of edge arrays
BP_FP_INT_TYPE limit = m_numHandles * 2;
// insert new edges just inside the max boundary edge
for (BP_FP_INT_TYPE axis = 0; axis < 3; axis++)
{
m_pHandles[0].m_maxEdges[axis] += 2;
m_pEdges[axis][limit + 1] = m_pEdges[axis][limit - 1];
m_pEdges[axis][limit - 1].m_pos = min[axis];
m_pEdges[axis][limit - 1].m_handle = handle;
m_pEdges[axis][limit].m_pos = max[axis];
m_pEdges[axis][limit].m_handle = handle;
pHandle->m_minEdges[axis] = limit - 1;
pHandle->m_maxEdges[axis] = limit;
}
// now sort the new edges to their correct position
sortMinDown(0, pHandle->m_minEdges[0], false);
sortMaxDown(0, pHandle->m_maxEdges[0], false);
sortMinDown(1, pHandle->m_minEdges[1], false);
sortMaxDown(1, pHandle->m_maxEdges[1], false);
sortMinDown(2, pHandle->m_minEdges[2], true);
sortMaxDown(2, pHandle->m_maxEdges[2], true);
return handle;
}
void btAxisSweep3::removeHandle(BP_FP_INT_TYPE handle)
{
Handle* pHandle = getHandle(handle);
//explicitly remove the pairs containing the proxy
//we could do it also in the sortMinUp (passing true)
//todo: compare performance
removeOverlappingPairsContainingProxy(pHandle);
// compute current limit of edge arrays
int limit = m_numHandles * 2;
int axis;
for (axis = 0;axis<3;axis++)
{
m_pHandles[0].m_maxEdges[axis] -= 2;
}
// remove the edges by sorting them up to the end of the list
for ( axis = 0; axis < 3; axis++)
{
Edge* pEdges = m_pEdges[axis];
BP_FP_INT_TYPE max = pHandle->m_maxEdges[axis];
pEdges[max].m_pos = BP_HANDLE_SENTINEL;
sortMaxUp(axis,max,false);
BP_FP_INT_TYPE i = pHandle->m_minEdges[axis];
pEdges[i].m_pos = BP_HANDLE_SENTINEL;
sortMinUp(axis,i,false);
pEdges[limit-1].m_handle = 0;
pEdges[limit-1].m_pos = BP_HANDLE_SENTINEL;
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis,false);
#endif //DEBUG_BROADPHASE
}
// free the handle
freeHandle(handle);
}
extern int gOverlappingPairs;
void btAxisSweep3::refreshOverlappingPairs()
{
}
void btAxisSweep3::processAllOverlappingPairs(btOverlapCallback* callback)
{
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
m_overlappingPairArray.heapSort(btBroadphasePairSortPredicate());
//remove the 'invalid' ones
#ifdef USE_POPBACK_REMOVAL
while (m_invalidPair>0)
{
m_invalidPair--;
m_overlappingPairArray.pop_back();
}
#else
m_overlappingPairArray.resize(m_overlappingPairArray.size() - m_invalidPair);
m_invalidPair = 0;
#endif
int i;
btBroadphasePair previousPair;
previousPair.m_pProxy0 = 0;
previousPair.m_pProxy1 = 0;
previousPair.m_algorithm = 0;
for (i=0;i<m_overlappingPairArray.size();i++)
{
btBroadphasePair& pair = m_overlappingPairArray[i];
bool isDuplicate = (pair == previousPair);
previousPair = pair;
bool needsRemoval = false;
if (!isDuplicate)
{
bool hasOverlap = testOverlap(pair.m_pProxy0,pair.m_pProxy1);
if (hasOverlap)
{
needsRemoval = callback->processOverlap(pair);
} else
{
needsRemoval = true;
}
} else
{
//remove duplicate
needsRemoval = true;
//should have no algorithm
btAssert(!pair.m_algorithm);
}
if (needsRemoval)
{
cleanOverlappingPair(pair);
// m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
// m_overlappingPairArray.pop_back();
pair.m_pProxy0 = 0;
pair.m_pProxy1 = 0;
m_invalidPair++;
gOverlappingPairs--;
}
}
}
bool btAxisSweep3::testOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
const Handle* pHandleA = static_cast<Handle*>(proxy0);
const Handle* pHandleB = static_cast<Handle*>(proxy1);
//optimization 1: check the array index (memory address), instead of the m_pos
for (int axis = 0; axis < 3; axis++)
{
if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] ||
pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis])
{
return false;
}
}
return true;
}
bool btAxisSweep3::testOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB)
{
//optimization 1: check the array index (memory address), instead of the m_pos
for (int axis = 0; axis < 3; axis++)
{
if (axis != ignoreAxis)
{
if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] ||
pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis])
{
return false;
}
}
}
//optimization 2: only 2 axis need to be tested (conflicts with 'delayed removal' optimization)
/*for (int axis = 0; axis < 3; axis++)
{
if (m_pEdges[axis][pHandleA->m_maxEdges[axis]].m_pos < m_pEdges[axis][pHandleB->m_minEdges[axis]].m_pos ||
m_pEdges[axis][pHandleB->m_maxEdges[axis]].m_pos < m_pEdges[axis][pHandleA->m_minEdges[axis]].m_pos)
{
return false;
}
}
*/
return true;
}
void btAxisSweep3::updateHandle(BP_FP_INT_TYPE handle, const btPoint3& aabbMin,const btPoint3& aabbMax)
{
// assert(bounds.IsFinite());
//assert(bounds.HasVolume());
Handle* pHandle = getHandle(handle);
// quantize the new bounds
BP_FP_INT_TYPE min[3], max[3];
quantize(min, aabbMin, 0);
quantize(max, aabbMax, 1);
// update changed edges
for (int axis = 0; axis < 3; axis++)
{
BP_FP_INT_TYPE emin = pHandle->m_minEdges[axis];
BP_FP_INT_TYPE emax = pHandle->m_maxEdges[axis];
int dmin = (int)min[axis] - (int)m_pEdges[axis][emin].m_pos;
int dmax = (int)max[axis] - (int)m_pEdges[axis][emax].m_pos;
m_pEdges[axis][emin].m_pos = min[axis];
m_pEdges[axis][emax].m_pos = max[axis];
// expand (only adds overlaps)
if (dmin < 0)
sortMinDown(axis, emin);
if (dmax > 0)
sortMaxUp(axis, emax);
// shrink (only removes overlaps)
if (dmin > 0)
sortMinUp(axis, emin);
if (dmax < 0)
sortMaxDown(axis, emax);
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis);
#endif //DEBUG_BROADPHASE
}
}
// sorting a min edge downwards can only ever *add* overlaps
void btAxisSweep3::sortMinDown(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pPrev = pEdge - 1;
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pEdge->m_pos < pPrev->m_pos)
{
Handle* pHandlePrev = getHandle(pPrev->m_handle);
if (pPrev->IsMax())
{
// if previous edge is a maximum check the bounds and add an overlap if necessary
if (updateOverlaps && testOverlap(axis,pHandleEdge, pHandlePrev))
{
addOverlappingPair(pHandleEdge,pHandlePrev);
//AddOverlap(pEdge->m_handle, pPrev->m_handle);
}
// update edge reference in other handle
pHandlePrev->m_maxEdges[axis]++;
}
else
pHandlePrev->m_minEdges[axis]++;
pHandleEdge->m_minEdges[axis]--;
// swap the edges
Edge swap = *pEdge;
*pEdge = *pPrev;
*pPrev = swap;
// decrement
pEdge--;
pPrev--;
}
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis);
#endif //DEBUG_BROADPHASE
}
// sorting a min edge upwards can only ever *remove* overlaps
void btAxisSweep3::sortMinUp(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pNext = pEdge + 1;
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos))
{
Handle* pHandleNext = getHandle(pNext->m_handle);
if (pNext->IsMax())
{
// if next edge is maximum remove any overlap between the two handles
if (updateOverlaps)
{
/*
Handle* handle0 = getHandle(pEdge->m_handle);
Handle* handle1 = getHandle(pNext->m_handle);
btBroadphasePair tmpPair(*handle0,*handle1);
removeOverlappingPair(tmpPair);
*/
}
// update edge reference in other handle
pHandleNext->m_maxEdges[axis]--;
}
else
pHandleNext->m_minEdges[axis]--;
pHandleEdge->m_minEdges[axis]++;
// swap the edges
Edge swap = *pEdge;
*pEdge = *pNext;
*pNext = swap;
// increment
pEdge++;
pNext++;
}
}
// sorting a max edge downwards can only ever *remove* overlaps
void btAxisSweep3::sortMaxDown(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pPrev = pEdge - 1;
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pEdge->m_pos < pPrev->m_pos)
{
Handle* pHandlePrev = getHandle(pPrev->m_handle);
if (!pPrev->IsMax())
{
// if previous edge was a minimum remove any overlap between the two handles
if (updateOverlaps)
{
//this is done during the overlappingpairarray iteration/narrowphase collision
/*
Handle* handle0 = getHandle(pEdge->m_handle);
Handle* handle1 = getHandle(pPrev->m_handle);
btBroadphasePair* pair = findPair(handle0,handle1);
//assert(pair);
if (pair)
{
removeOverlappingPair(*pair);
}
*/
}
// update edge reference in other handle
pHandlePrev->m_minEdges[axis]++;;
}
else
pHandlePrev->m_maxEdges[axis]++;
pHandleEdge->m_maxEdges[axis]--;
// swap the edges
Edge swap = *pEdge;
*pEdge = *pPrev;
*pPrev = swap;
// decrement
pEdge--;
pPrev--;
}
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis);
#endif //DEBUG_BROADPHASE
}
// sorting a max edge upwards can only ever *add* overlaps
void btAxisSweep3::sortMaxUp(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pNext = pEdge + 1;
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos))
{
Handle* pHandleNext = getHandle(pNext->m_handle);
if (!pNext->IsMax())
{
// if next edge is a minimum check the bounds and add an overlap if necessary
if (updateOverlaps && testOverlap(axis, pHandleEdge, pHandleNext))
{
Handle* handle0 = getHandle(pEdge->m_handle);
Handle* handle1 = getHandle(pNext->m_handle);
addOverlappingPair(handle0,handle1);
}
// update edge reference in other handle
pHandleNext->m_minEdges[axis]--;
}
else
pHandleNext->m_maxEdges[axis]--;
pHandleEdge->m_maxEdges[axis]++;
// swap the edges
Edge swap = *pEdge;
*pEdge = *pNext;
*pNext = swap;
// increment
pEdge++;
pNext++;
}
// 1 handle is reserved as sentinel
btAssert(maxHandles > 1 && maxHandles < 2147483647);
}

View File

@@ -19,34 +19,26 @@
#ifndef AXIS_SWEEP_3_H
#define AXIS_SWEEP_3_H
#include "../../LinearMath/btPoint3.h"
#include "../../LinearMath/btVector3.h"
#include "LinearMath/btPoint3.h"
#include "LinearMath/btVector3.h"
#include "btOverlappingPairCache.h"
#include "btBroadphaseInterface.h"
#include "btBroadphaseProxy.h"
//Enable BP_USE_FIXEDPOINT_INT_32 if you need more then 32767 objects
//#define BP_USE_FIXEDPOINT_INT_32 1
#ifdef BP_USE_FIXEDPOINT_INT_32
#define BP_FP_INT_TYPE unsigned int
#define BP_MAX_HANDLES 1500000 //arbitrary maximum number of handles
#define BP_HANDLE_SENTINEL 0x7fffffff
#define BP_HANDLE_MASK 0xfffffffe
#else
#define BP_FP_INT_TYPE unsigned short int
#define BP_MAX_HANDLES 32767
#define BP_HANDLE_SENTINEL 0xffff
#define BP_HANDLE_MASK 0xfffe
#endif //BP_USE_FIXEDPOINT_INT_32
#include "btOverlappingPairCallback.h"
//#define DEBUG_BROADPHASE 1
#define USE_OVERLAP_TEST_ON_REMOVES 1
/// btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase.
/// It uses arrays rather then lists for storage of the 3 axis. Also it operates using integer coordinates instead of floats.
/// The testOverlap check is optimized to check the array index, rather then the actual AABB coordinates/pos
class btAxisSweep3 : public btOverlappingPairCache
/// The internal templace class btAxisSweep3Internal implements the sweep and prune broadphase.
/// It uses quantized integers to represent the begin and end points for each of the 3 axis.
/// Dont use this class directly, use btAxisSweep3 or bt32BitAxisSweep3 instead.
template <typename BP_FP_INT_TYPE>
class btAxisSweep3Internal : public btBroadphaseInterface
{
protected:
BP_FP_INT_TYPE m_bpHandleMask;
BP_FP_INT_TYPE m_handleSentinel;
public:
@@ -57,47 +49,57 @@ public:
BP_FP_INT_TYPE m_pos; // low bit is min/max
BP_FP_INT_TYPE m_handle;
BP_FP_INT_TYPE IsMax() const {return m_pos & 1;}
BP_FP_INT_TYPE IsMax() const {return static_cast<BP_FP_INT_TYPE>(m_pos & 1);}
};
public:
class Handle : public btBroadphaseProxy
class Handle : public btBroadphaseProxy
{
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
// indexes into the edge arrays
BP_FP_INT_TYPE m_minEdges[3], m_maxEdges[3]; // 6 * 2 = 12
BP_FP_INT_TYPE m_handleId;
// BP_FP_INT_TYPE m_uniqueId;
BP_FP_INT_TYPE m_pad;
//void* m_pOwner; this is now in btBroadphaseProxy.m_clientObject
inline void SetNextFree(BP_FP_INT_TYPE next) {m_minEdges[0] = next;}
inline BP_FP_INT_TYPE GetNextFree() const {return m_minEdges[0];}
SIMD_FORCE_INLINE void SetNextFree(BP_FP_INT_TYPE next) {m_minEdges[0] = next;}
SIMD_FORCE_INLINE BP_FP_INT_TYPE GetNextFree() const {return m_minEdges[0];}
}; // 24 bytes + 24 for Edge structures = 44 bytes total per entry
private:
protected:
btPoint3 m_worldAabbMin; // overall system bounds
btPoint3 m_worldAabbMax; // overall system bounds
btVector3 m_quantize; // scaling factor for quantization
BP_FP_INT_TYPE m_numHandles; // number of active handles
int m_maxHandles; // max number of handles
BP_FP_INT_TYPE m_maxHandles; // max number of handles
Handle* m_pHandles; // handles pool
BP_FP_INT_TYPE m_firstFreeHandle; // free handles list
Edge* m_pEdges[3]; // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries)
void* m_pEdgesRawPtr[3];
int m_invalidPair;
btOverlappingPairCache* m_pairCache;
///btOverlappingPairCallback is an additional optional user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache.
btOverlappingPairCallback* m_userPairCallback;
bool m_ownsPairCache;
int m_invalidPair;
// allocation/deallocation
BP_FP_INT_TYPE allocHandle();
void freeHandle(BP_FP_INT_TYPE handle);
bool testOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB);
bool testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1);
#ifdef DEBUG_BROADPHASE
void debugPrintAxis(int axis,bool checkCardinality=true);
@@ -108,29 +110,803 @@ private:
void quantize(BP_FP_INT_TYPE* out, const btPoint3& point, int isMax) const;
void sortMinDown(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps = true);
void sortMinUp(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps = true);
void sortMaxDown(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps = true);
void sortMaxUp(int axis, BP_FP_INT_TYPE edge, bool updateOverlaps = true);
void sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps );
void sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps );
void sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps );
void sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps );
public:
btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, int maxHandles = 16384);
virtual ~btAxisSweep3();
virtual void refreshOverlappingPairs();
btAxisSweep3Internal(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE maxHandles = 16384, btOverlappingPairCache* pairCache=0);
virtual ~btAxisSweep3Internal();
BP_FP_INT_TYPE getNumHandles() const
{
return m_numHandles;
}
virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
BP_FP_INT_TYPE addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask);
void removeHandle(BP_FP_INT_TYPE handle);
void updateHandle(BP_FP_INT_TYPE handle, const btPoint3& aabbMin,const btPoint3& aabbMax);
inline Handle* getHandle(BP_FP_INT_TYPE index) const {return m_pHandles + index;}
BP_FP_INT_TYPE addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy);
void removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher);
void updateHandle(BP_FP_INT_TYPE handle, const btPoint3& aabbMin,const btPoint3& aabbMax,btDispatcher* dispatcher);
SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const {return m_pHandles + index;}
void processAllOverlappingPairs(btOverlapCallback* callback);
//Broadphase Interface
virtual btBroadphaseProxy* createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
virtual void destroyProxy(btBroadphaseProxy* proxy);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
bool testOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy);
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher);
bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
btOverlappingPairCache* getOverlappingPairCache()
{
return m_pairCache;
}
const btOverlappingPairCache* getOverlappingPairCache() const
{
return m_pairCache;
}
void setOverlappingPairUserCallback(btOverlappingPairCallback* pairCallback)
{
m_userPairCallback = pairCallback;
}
const btOverlappingPairCallback* getOverlappingPairUserCallback() const
{
return m_userPairCallback;
}
///getAabb returns the axis aligned bounding box in the 'global' coordinate frame
///will add some transform later
virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const
{
aabbMin = m_worldAabbMin;
aabbMax = m_worldAabbMax;
}
virtual void printStats()
{
/* printf("btAxisSweep3.h\n");
printf("numHandles = %d, maxHandles = %d\n",m_numHandles,m_maxHandles);
printf("aabbMin=%f,%f,%f,aabbMax=%f,%f,%f\n",m_worldAabbMin.getX(),m_worldAabbMin.getY(),m_worldAabbMin.getZ(),
m_worldAabbMax.getX(),m_worldAabbMax.getY(),m_worldAabbMax.getZ());
*/
}
};
////////////////////////////////////////////////////////////////////
#ifdef DEBUG_BROADPHASE
#include <stdio.h>
template <typename BP_FP_INT_TYPE>
void btAxisSweep3<BP_FP_INT_TYPE>::debugPrintAxis(int axis, bool checkCardinality)
{
int numEdges = m_pHandles[0].m_maxEdges[axis];
printf("SAP Axis %d, numEdges=%d\n",axis,numEdges);
int i;
for (i=0;i<numEdges+1;i++)
{
Edge* pEdge = m_pEdges[axis] + i;
Handle* pHandlePrev = getHandle(pEdge->m_handle);
int handleIndex = pEdge->IsMax()? pHandlePrev->m_maxEdges[axis] : pHandlePrev->m_minEdges[axis];
char beginOrEnd;
beginOrEnd=pEdge->IsMax()?'E':'B';
printf(" [%c,h=%d,p=%x,i=%d]\n",beginOrEnd,pEdge->m_handle,pEdge->m_pos,handleIndex);
}
if (checkCardinality)
assert(numEdges == m_numHandles*2+1);
}
#endif //DEBUG_BROADPHASE
template <typename BP_FP_INT_TYPE>
btBroadphaseProxy* btAxisSweep3Internal<BP_FP_INT_TYPE>::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy)
{
(void)shapeType;
BP_FP_INT_TYPE handleId = addHandle(aabbMin,aabbMax, userPtr,collisionFilterGroup,collisionFilterMask,dispatcher,multiSapProxy);
Handle* handle = getHandle(handleId);
return handle;
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
{
Handle* handle = static_cast<Handle*>(proxy);
removeHandle(static_cast<BP_FP_INT_TYPE>(handle->m_uniqueId), dispatcher);
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher)
{
Handle* handle = static_cast<Handle*>(proxy);
updateHandle(static_cast<BP_FP_INT_TYPE>(handle->m_uniqueId), aabbMin, aabbMax,dispatcher);
}
template <typename BP_FP_INT_TYPE>
btAxisSweep3Internal<BP_FP_INT_TYPE>::btAxisSweep3Internal(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE userMaxHandles, btOverlappingPairCache* pairCache )
:m_bpHandleMask(handleMask),
m_handleSentinel(handleSentinel),
m_pairCache(pairCache),
m_userPairCallback(0),
m_ownsPairCache(false),
m_invalidPair(0)
{
BP_FP_INT_TYPE maxHandles = static_cast<BP_FP_INT_TYPE>(userMaxHandles+1);//need to add one sentinel handle
if (!m_pairCache)
{
void* ptr = btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16);
m_pairCache = new(ptr) btHashedOverlappingPairCache();
m_ownsPairCache = true;
}
//assert(bounds.HasVolume());
// init bounds
m_worldAabbMin = worldAabbMin;
m_worldAabbMax = worldAabbMax;
btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin;
BP_FP_INT_TYPE maxInt = m_handleSentinel;
m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(maxInt)) / aabbSize;
// allocate handles buffer, using btAlignedAlloc, and put all handles on free list
m_pHandles = new Handle[maxHandles];
m_maxHandles = maxHandles;
m_numHandles = 0;
// handle 0 is reserved as the null index, and is also used as the sentinel
m_firstFreeHandle = 1;
{
for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < maxHandles; i++)
m_pHandles[i].SetNextFree(static_cast<BP_FP_INT_TYPE>(i + 1));
m_pHandles[maxHandles - 1].SetNextFree(0);
}
{
// allocate edge buffers
for (int i = 0; i < 3; i++)
{
m_pEdgesRawPtr[i] = btAlignedAlloc(sizeof(Edge)*maxHandles*2,16);
m_pEdges[i] = new(m_pEdgesRawPtr[i]) Edge[maxHandles * 2];
}
}
//removed overlap management
// make boundary sentinels
m_pHandles[0].m_clientObject = 0;
for (int axis = 0; axis < 3; axis++)
{
m_pHandles[0].m_minEdges[axis] = 0;
m_pHandles[0].m_maxEdges[axis] = 1;
m_pEdges[axis][0].m_pos = 0;
m_pEdges[axis][0].m_handle = 0;
m_pEdges[axis][1].m_pos = m_handleSentinel;
m_pEdges[axis][1].m_handle = 0;
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis);
#endif //DEBUG_BROADPHASE
}
}
template <typename BP_FP_INT_TYPE>
btAxisSweep3Internal<BP_FP_INT_TYPE>::~btAxisSweep3Internal()
{
for (int i = 2; i >= 0; i--)
{
btAlignedFree(m_pEdgesRawPtr[i]);
}
delete [] m_pHandles;
if (m_ownsPairCache)
{
m_pairCache->~btOverlappingPairCache();
btAlignedFree(m_pairCache);
}
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::quantize(BP_FP_INT_TYPE* out, const btPoint3& point, int isMax) const
{
btPoint3 clampedPoint(point);
clampedPoint.setMax(m_worldAabbMin);
clampedPoint.setMin(m_worldAabbMax);
btVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize;
out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getX() & m_bpHandleMask) | isMax);
out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getY() & m_bpHandleMask) | isMax);
out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getZ() & m_bpHandleMask) | isMax);
}
template <typename BP_FP_INT_TYPE>
BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::allocHandle()
{
assert(m_firstFreeHandle);
BP_FP_INT_TYPE handle = m_firstFreeHandle;
m_firstFreeHandle = getHandle(handle)->GetNextFree();
m_numHandles++;
return handle;
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::freeHandle(BP_FP_INT_TYPE handle)
{
assert(handle > 0 && handle < m_maxHandles);
getHandle(handle)->SetNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle;
m_numHandles--;
}
template <typename BP_FP_INT_TYPE>
BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy)
{
// quantize the bounds
BP_FP_INT_TYPE min[3], max[3];
quantize(min, aabbMin, 0);
quantize(max, aabbMax, 1);
// allocate a handle
BP_FP_INT_TYPE handle = allocHandle();
Handle* pHandle = getHandle(handle);
pHandle->m_uniqueId = static_cast<int>(handle);
//pHandle->m_pOverlaps = 0;
pHandle->m_clientObject = pOwner;
pHandle->m_collisionFilterGroup = collisionFilterGroup;
pHandle->m_collisionFilterMask = collisionFilterMask;
pHandle->m_multiSapParentProxy = multiSapProxy;
// compute current limit of edge arrays
BP_FP_INT_TYPE limit = static_cast<BP_FP_INT_TYPE>(m_numHandles * 2);
// insert new edges just inside the max boundary edge
for (BP_FP_INT_TYPE axis = 0; axis < 3; axis++)
{
m_pHandles[0].m_maxEdges[axis] += 2;
m_pEdges[axis][limit + 1] = m_pEdges[axis][limit - 1];
m_pEdges[axis][limit - 1].m_pos = min[axis];
m_pEdges[axis][limit - 1].m_handle = handle;
m_pEdges[axis][limit].m_pos = max[axis];
m_pEdges[axis][limit].m_handle = handle;
pHandle->m_minEdges[axis] = static_cast<BP_FP_INT_TYPE>(limit - 1);
pHandle->m_maxEdges[axis] = limit;
}
// now sort the new edges to their correct position
sortMinDown(0, pHandle->m_minEdges[0], dispatcher,false);
sortMaxDown(0, pHandle->m_maxEdges[0], dispatcher,false);
sortMinDown(1, pHandle->m_minEdges[1], dispatcher,false);
sortMaxDown(1, pHandle->m_maxEdges[1], dispatcher,false);
sortMinDown(2, pHandle->m_minEdges[2], dispatcher,true);
sortMaxDown(2, pHandle->m_maxEdges[2], dispatcher,true);
return handle;
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher)
{
Handle* pHandle = getHandle(handle);
//explicitly remove the pairs containing the proxy
//we could do it also in the sortMinUp (passing true)
//todo: compare performance
if (!m_pairCache->hasDeferredRemoval())
{
m_pairCache->removeOverlappingPairsContainingProxy(pHandle,dispatcher);
}
// compute current limit of edge arrays
int limit = static_cast<int>(m_numHandles * 2);
int axis;
for (axis = 0;axis<3;axis++)
{
m_pHandles[0].m_maxEdges[axis] -= 2;
}
// remove the edges by sorting them up to the end of the list
for ( axis = 0; axis < 3; axis++)
{
Edge* pEdges = m_pEdges[axis];
BP_FP_INT_TYPE max = pHandle->m_maxEdges[axis];
pEdges[max].m_pos = m_handleSentinel;
sortMaxUp(axis,max,dispatcher,false);
BP_FP_INT_TYPE i = pHandle->m_minEdges[axis];
pEdges[i].m_pos = m_handleSentinel;
sortMinUp(axis,i,dispatcher,false);
pEdges[limit-1].m_handle = 0;
pEdges[limit-1].m_pos = m_handleSentinel;
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis,false);
#endif //DEBUG_BROADPHASE
}
// free the handle
freeHandle(handle);
}
extern int gOverlappingPairs;
//#include <stdio.h>
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::calculateOverlappingPairs(btDispatcher* dispatcher)
{
if (m_pairCache->hasDeferredRemoval())
{
btBroadphasePairArray& overlappingPairArray = m_pairCache->getOverlappingPairArray();
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
m_invalidPair = 0;
int i;
btBroadphasePair previousPair;
previousPair.m_pProxy0 = 0;
previousPair.m_pProxy1 = 0;
previousPair.m_algorithm = 0;
for (i=0;i<overlappingPairArray.size();i++)
{
btBroadphasePair& pair = overlappingPairArray[i];
bool isDuplicate = (pair == previousPair);
previousPair = pair;
bool needsRemoval = false;
if (!isDuplicate)
{
bool hasOverlap = testAabbOverlap(pair.m_pProxy0,pair.m_pProxy1);
if (hasOverlap)
{
needsRemoval = false;//callback->processOverlap(pair);
} else
{
needsRemoval = true;
}
} else
{
//remove duplicate
needsRemoval = true;
//should have no algorithm
btAssert(!pair.m_algorithm);
}
if (needsRemoval)
{
m_pairCache->cleanOverlappingPair(pair,dispatcher);
// m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
// m_overlappingPairArray.pop_back();
pair.m_pProxy0 = 0;
pair.m_pProxy1 = 0;
m_invalidPair++;
gOverlappingPairs--;
}
}
///if you don't like to skip the invalid pairs in the array, execute following code:
#define CLEAN_INVALID_PAIRS 1
#ifdef CLEAN_INVALID_PAIRS
//perform a sort, to sort 'invalid' pairs to the end
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
m_invalidPair = 0;
#endif//CLEAN_INVALID_PAIRS
//printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size());
}
}
template <typename BP_FP_INT_TYPE>
bool btAxisSweep3Internal<BP_FP_INT_TYPE>::testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
const Handle* pHandleA = static_cast<Handle*>(proxy0);
const Handle* pHandleB = static_cast<Handle*>(proxy1);
//optimization 1: check the array index (memory address), instead of the m_pos
for (int axis = 0; axis < 3; axis++)
{
if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] ||
pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis])
{
return false;
}
}
return true;
}
template <typename BP_FP_INT_TYPE>
bool btAxisSweep3Internal<BP_FP_INT_TYPE>::testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1)
{
//optimization 1: check the array index (memory address), instead of the m_pos
if (pHandleA->m_maxEdges[axis0] < pHandleB->m_minEdges[axis0] ||
pHandleB->m_maxEdges[axis0] < pHandleA->m_minEdges[axis0] ||
pHandleA->m_maxEdges[axis1] < pHandleB->m_minEdges[axis1] ||
pHandleB->m_maxEdges[axis1] < pHandleA->m_minEdges[axis1])
{
return false;
}
return true;
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::updateHandle(BP_FP_INT_TYPE handle, const btPoint3& aabbMin,const btPoint3& aabbMax,btDispatcher* dispatcher)
{
// assert(bounds.IsFinite());
//assert(bounds.HasVolume());
Handle* pHandle = getHandle(handle);
// quantize the new bounds
BP_FP_INT_TYPE min[3], max[3];
quantize(min, aabbMin, 0);
quantize(max, aabbMax, 1);
// update changed edges
for (int axis = 0; axis < 3; axis++)
{
BP_FP_INT_TYPE emin = pHandle->m_minEdges[axis];
BP_FP_INT_TYPE emax = pHandle->m_maxEdges[axis];
int dmin = (int)min[axis] - (int)m_pEdges[axis][emin].m_pos;
int dmax = (int)max[axis] - (int)m_pEdges[axis][emax].m_pos;
m_pEdges[axis][emin].m_pos = min[axis];
m_pEdges[axis][emax].m_pos = max[axis];
// expand (only adds overlaps)
if (dmin < 0)
sortMinDown(axis, emin,dispatcher,true);
if (dmax > 0)
sortMaxUp(axis, emax,dispatcher,true);
// shrink (only removes overlaps)
if (dmin > 0)
sortMinUp(axis, emin,dispatcher,true);
if (dmax < 0)
sortMaxDown(axis, emax,dispatcher,true);
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis);
#endif //DEBUG_BROADPHASE
}
}
// sorting a min edge downwards can only ever *add* overlaps
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pPrev = pEdge - 1;
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pEdge->m_pos < pPrev->m_pos)
{
Handle* pHandlePrev = getHandle(pPrev->m_handle);
if (pPrev->IsMax())
{
// if previous edge is a maximum check the bounds and add an overlap if necessary
const int axis1 = (1 << axis) & 3;
const int axis2 = (1 << axis1) & 3;
if (updateOverlaps && testOverlap2D(pHandleEdge, pHandlePrev,axis1,axis2))
{
m_pairCache->addOverlappingPair(pHandleEdge,pHandlePrev);
if (m_userPairCallback)
m_userPairCallback->addOverlappingPair(pHandleEdge,pHandlePrev);
//AddOverlap(pEdge->m_handle, pPrev->m_handle);
}
// update edge reference in other handle
pHandlePrev->m_maxEdges[axis]++;
}
else
pHandlePrev->m_minEdges[axis]++;
pHandleEdge->m_minEdges[axis]--;
// swap the edges
Edge swap = *pEdge;
*pEdge = *pPrev;
*pPrev = swap;
// decrement
pEdge--;
pPrev--;
}
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis);
#endif //DEBUG_BROADPHASE
}
// sorting a min edge upwards can only ever *remove* overlaps
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pNext = pEdge + 1;
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos))
{
Handle* pHandleNext = getHandle(pNext->m_handle);
if (pNext->IsMax())
{
Handle* handle0 = getHandle(pEdge->m_handle);
Handle* handle1 = getHandle(pNext->m_handle);
const int axis1 = (1 << axis) & 3;
const int axis2 = (1 << axis1) & 3;
// if next edge is maximum remove any overlap between the two handles
if (updateOverlaps
#ifdef USE_OVERLAP_TEST_ON_REMOVES
&& testOverlap2D(handle0,handle1,axis1,axis2)
#endif //USE_OVERLAP_TEST_ON_REMOVES
)
{
m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher);
if (m_userPairCallback)
m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher);
}
// update edge reference in other handle
pHandleNext->m_maxEdges[axis]--;
}
else
pHandleNext->m_minEdges[axis]--;
pHandleEdge->m_minEdges[axis]++;
// swap the edges
Edge swap = *pEdge;
*pEdge = *pNext;
*pNext = swap;
// increment
pEdge++;
pNext++;
}
}
// sorting a max edge downwards can only ever *remove* overlaps
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pPrev = pEdge - 1;
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pEdge->m_pos < pPrev->m_pos)
{
Handle* pHandlePrev = getHandle(pPrev->m_handle);
if (!pPrev->IsMax())
{
// if previous edge was a minimum remove any overlap between the two handles
Handle* handle0 = getHandle(pEdge->m_handle);
Handle* handle1 = getHandle(pPrev->m_handle);
const int axis1 = (1 << axis) & 3;
const int axis2 = (1 << axis1) & 3;
if (updateOverlaps
#ifdef USE_OVERLAP_TEST_ON_REMOVES
&& testOverlap2D(handle0,handle1,axis1,axis2)
#endif //USE_OVERLAP_TEST_ON_REMOVES
)
{
//this is done during the overlappingpairarray iteration/narrowphase collision
m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher);
if (m_userPairCallback)
m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher);
}
// update edge reference in other handle
pHandlePrev->m_minEdges[axis]++;;
}
else
pHandlePrev->m_maxEdges[axis]++;
pHandleEdge->m_maxEdges[axis]--;
// swap the edges
Edge swap = *pEdge;
*pEdge = *pPrev;
*pPrev = swap;
// decrement
pEdge--;
pPrev--;
}
#ifdef DEBUG_BROADPHASE
debugPrintAxis(axis);
#endif //DEBUG_BROADPHASE
}
// sorting a max edge upwards can only ever *add* overlaps
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps)
{
Edge* pEdge = m_pEdges[axis] + edge;
Edge* pNext = pEdge + 1;
Handle* pHandleEdge = getHandle(pEdge->m_handle);
while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos))
{
Handle* pHandleNext = getHandle(pNext->m_handle);
const int axis1 = (1 << axis) & 3;
const int axis2 = (1 << axis1) & 3;
if (!pNext->IsMax())
{
// if next edge is a minimum check the bounds and add an overlap if necessary
if (updateOverlaps && testOverlap2D(pHandleEdge, pHandleNext,axis1,axis2))
{
Handle* handle0 = getHandle(pEdge->m_handle);
Handle* handle1 = getHandle(pNext->m_handle);
m_pairCache->addOverlappingPair(handle0,handle1);
if (m_userPairCallback)
m_userPairCallback->addOverlappingPair(handle0,handle1);
}
// update edge reference in other handle
pHandleNext->m_minEdges[axis]--;
}
else
pHandleNext->m_maxEdges[axis]--;
pHandleEdge->m_maxEdges[axis]++;
// swap the edges
Edge swap = *pEdge;
*pEdge = *pNext;
*pNext = swap;
// increment
pEdge++;
pNext++;
}
}
////////////////////////////////////////////////////////////////////
/// The btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase.
/// It uses arrays rather then lists for storage of the 3 axis. Also it operates using 16 bit integer coordinates instead of floats.
/// For large worlds and many objects, use bt32BitAxisSweep3 or btDbvtBroadphase instead. bt32BitAxisSweep3 has higher precision and allows more then 16384 objects at the cost of more memory and bit of performance.
class btAxisSweep3 : public btAxisSweep3Internal<unsigned short int>
{
public:
btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned short int maxHandles = 16384, btOverlappingPairCache* pairCache = 0);
};
/// The bt32BitAxisSweep3 allows higher precision quantization and more objects compared to the btAxisSweep3 sweep and prune.
/// This comes at the cost of more memory per handle, and a bit slower performance.
/// It uses arrays rather then lists for storage of the 3 axis.
class bt32BitAxisSweep3 : public btAxisSweep3Internal<unsigned int>
{
public:
bt32BitAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned int maxHandles = 1500000, btOverlappingPairCache* pairCache = 0);
};

View File

@@ -20,20 +20,34 @@ subject to the following restrictions:
struct btDispatcherInfo;
class btDispatcher;
struct btBroadphaseProxy;
#include "../../LinearMath/btVector3.h"
#include "btBroadphaseProxy.h"
class btOverlappingPairCache;
///BroadphaseInterface for aabb-overlapping object pairs
#include "LinearMath/btVector3.h"
///The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs.
///Some implementations for this broadphase interface include btAxisSweep3, bt32BitAxisSweep3 and btDbvtBroadphase.
///The actual overlapping pair management, storage, adding and removing of pairs is dealt by the btOverlappingPairCache class.
class btBroadphaseInterface
{
public:
virtual ~btBroadphaseInterface() {}
virtual btBroadphaseProxy* createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask) =0;
virtual void destroyProxy(btBroadphaseProxy* proxy)=0;
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)=0;
virtual void cleanProxyFromPairs(btBroadphaseProxy* proxy)=0;
virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy) =0;
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)=0;
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher)=0;
///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb
virtual void calculateOverlappingPairs(btDispatcher* dispatcher)=0;
virtual btOverlappingPairCache* getOverlappingPairCache()=0;
virtual const btOverlappingPairCache* getOverlappingPairCache() const =0;
///getAabb returns the axis aligned bounding box in the 'global' coordinate frame
///will add some transform later
virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const =0;
virtual void printStats() = 0;
};

View File

@@ -16,7 +16,8 @@ subject to the following restrictions:
#ifndef BROADPHASE_PROXY_H
#define BROADPHASE_PROXY_H
#include "../../LinearMath/btScalar.h" //for SIMD_FORCE_INLINE
#include "LinearMath/btScalar.h" //for SIMD_FORCE_INLINE
#include "LinearMath/btAlignedAllocator.h"
/// btDispatcher uses these types
@@ -38,6 +39,7 @@ IMPLICIT_CONVEX_SHAPES_START_HERE,
CONE_SHAPE_PROXYTYPE,
CONVEX_SHAPE_PROXYTYPE,
CYLINDER_SHAPE_PROXYTYPE,
UNIFORM_SCALING_SHAPE_PROXYTYPE,
MINKOWSKI_SUM_SHAPE_PROXYTYPE,
MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE,
//concave shapes
@@ -50,6 +52,8 @@ CONCAVE_SHAPES_START_HERE,
TERRAIN_SHAPE_PROXYTYPE,
///Used for GIMPACT Trimesh integration
GIMPACT_SHAPE_PROXYTYPE,
///Multimaterial mesh
MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE,
EMPTY_SHAPE_PROXYTYPE,
STATIC_PLANE_PROXYTYPE,
@@ -57,13 +61,18 @@ CONCAVE_SHAPES_END_HERE,
COMPOUND_SHAPE_PROXYTYPE,
SOFTBODY_SHAPE_PROXYTYPE,
MAX_BROADPHASE_COLLISION_TYPES
};
///btBroadphaseProxy
struct btBroadphaseProxy
///The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
///It stores collision shape type information, collision filter information and a client object, typically a btCollisionObject or btRigidBody.
ATTRIBUTE_ALIGNED16(struct) btBroadphaseProxy
{
BT_DECLARE_ALIGNED_ALLOCATOR();
///optional filtering to cull potential collisions
enum CollisionFilterGroups
@@ -73,44 +82,60 @@ struct btBroadphaseProxy
KinematicFilter = 4,
DebrisFilter = 8,
SensorTrigger = 16,
AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorTrigger
AllFilter = -1 //all bits sets: DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorTrigger
};
//Usually the client btCollisionObject or Rigidbody class
void* m_clientObject;
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
//used for memory pools
btBroadphaseProxy() :m_clientObject(0){}
void* m_multiSapParentProxy;
btBroadphaseProxy(void* userPtr,short int collisionFilterGroup, short int collisionFilterMask)
int m_uniqueId;//m_uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc.
SIMD_FORCE_INLINE int getUid() const
{
return m_uniqueId;
}
//used for memory pools
btBroadphaseProxy() :m_clientObject(0),m_multiSapParentProxy(0)
{
}
btBroadphaseProxy(void* userPtr,short int collisionFilterGroup, short int collisionFilterMask,void* multiSapParentProxy=0)
:m_clientObject(userPtr),
m_collisionFilterGroup(collisionFilterGroup),
m_collisionFilterMask(collisionFilterMask)
{
m_multiSapParentProxy = multiSapParentProxy;
}
static inline bool isPolyhedral(int proxyType)
static SIMD_FORCE_INLINE bool isPolyhedral(int proxyType)
{
return (proxyType < IMPLICIT_CONVEX_SHAPES_START_HERE);
}
static inline bool isConvex(int proxyType)
static SIMD_FORCE_INLINE bool isConvex(int proxyType)
{
return (proxyType < CONCAVE_SHAPES_START_HERE);
}
static inline bool isConcave(int proxyType)
static SIMD_FORCE_INLINE bool isConcave(int proxyType)
{
return ((proxyType > CONCAVE_SHAPES_START_HERE) &&
(proxyType < CONCAVE_SHAPES_END_HERE));
}
static inline bool isCompound(int proxyType)
static SIMD_FORCE_INLINE bool isCompound(int proxyType)
{
return (proxyType == COMPOUND_SHAPE_PROXYTYPE);
}
static inline bool isInfinite(int proxyType)
static SIMD_FORCE_INLINE bool isInfinite(int proxyType)
{
return (proxyType == STATIC_PLANE_PROXYTYPE);
}
@@ -124,8 +149,9 @@ struct btBroadphaseProxy;
/// contains a pair of aabb-overlapping objects
struct btBroadphasePair
///The btBroadphasePair class contains a pair of aabb-overlapping objects.
///A btDispatcher can search a btCollisionAlgorithm that performs exact/narrowphase collision detection on the actual collision shapes.
ATTRIBUTE_ALIGNED16(struct) btBroadphasePair
{
btBroadphasePair ()
:
@@ -136,6 +162,8 @@ struct btBroadphasePair
{
}
BT_DECLARE_ALIGNED_ALLOCATOR();
btBroadphasePair(const btBroadphasePair& other)
: m_pProxy0(other.m_pProxy0),
m_pProxy1(other.m_pProxy1),
@@ -181,6 +209,7 @@ SIMD_FORCE_INLINE bool operator<(const btBroadphasePair& a, const btBroadphasePa
*/
class btBroadphasePairSortPredicate
{
public:

View File

@@ -18,6 +18,6 @@ subject to the following restrictions:
btCollisionAlgorithm::btCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
{
m_dispatcher = ci.m_dispatcher;
m_dispatcher = ci.m_dispatcher1;
}

View File

@@ -16,7 +16,8 @@ subject to the following restrictions:
#ifndef COLLISION_ALGORITHM_H
#define COLLISION_ALGORITHM_H
#include "../../LinearMath/btScalar.h"
#include "LinearMath/btScalar.h"
#include "LinearMath/btAlignedObjectArray.h"
struct btBroadphaseProxy;
class btDispatcher;
@@ -25,21 +26,22 @@ class btCollisionObject;
struct btDispatcherInfo;
class btPersistentManifold;
typedef btAlignedObjectArray<btPersistentManifold*> btManifoldArray;
struct btCollisionAlgorithmConstructionInfo
{
btCollisionAlgorithmConstructionInfo()
:m_dispatcher(0),
:m_dispatcher1(0),
m_manifold(0)
{
}
btCollisionAlgorithmConstructionInfo(btDispatcher* dispatcher,int temp)
:m_dispatcher(dispatcher)
:m_dispatcher1(dispatcher)
{
(void)temp;
}
btDispatcher* m_dispatcher;
btDispatcher* m_dispatcher1;
btPersistentManifold* m_manifold;
int getDispatcherId();
@@ -71,6 +73,7 @@ public:
virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) = 0;
virtual void getAllContactManifolds(btManifoldArray& manifoldArray) = 0;
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,547 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2007 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
///btDbvtBroadphase implementation by Nathanael Presson
#include "btDbvtBroadphase.h"
//
// Profiling
//
#if DBVT_BP_PROFILE||DBVT_BP_ENABLE_BENCHMARK
#include <stdio.h>
#endif
#if DBVT_BP_PROFILE
struct ProfileScope
{
__forceinline ProfileScope(btClock& clock,unsigned long& value) :
m_clock(&clock),m_value(&value),m_base(clock.getTimeMicroseconds())
{
}
__forceinline ~ProfileScope()
{
(*m_value)+=m_clock->getTimeMicroseconds()-m_base;
}
btClock* m_clock;
unsigned long* m_value;
unsigned long m_base;
};
#define SPC(_value_) ProfileScope spc_scope(m_clock,_value_)
#else
#define SPC(_value_)
#endif
//
// Helpers
//
//
template <typename T>
static inline void listappend(T* item,T*& list)
{
item->links[0]=0;
item->links[1]=list;
if(list) list->links[0]=item;
list=item;
}
//
template <typename T>
static inline void listremove(T* item,T*& list)
{
if(item->links[0]) item->links[0]->links[1]=item->links[1]; else list=item->links[1];
if(item->links[1]) item->links[1]->links[0]=item->links[0];
}
//
template <typename T>
static inline int listcount(T* root)
{
int n=0;
while(root) { ++n;root=root->links[1]; }
return(n);
}
//
template <typename T>
static inline void clear(T& value)
{
static const struct ZeroDummy : T {} zerodummy;
value=zerodummy;
}
//
// Colliders
//
/* Tree collider */
struct btDbvtTreeCollider : btDbvt::ICollide
{
btDbvtBroadphase* pbp;
btDbvtProxy* proxy;
btDbvtTreeCollider(btDbvtBroadphase* p) : pbp(p) {}
void Process(const btDbvtNode* na,const btDbvtNode* nb)
{
if(na!=nb)
{
btDbvtProxy* pa=(btDbvtProxy*)na->data;
btDbvtProxy* pb=(btDbvtProxy*)nb->data;
#if DBVT_BP_SORTPAIRS
if(pa>pb) btSwap(pa,pb);
#endif
pbp->m_paircache->addOverlappingPair(pa,pb);
++pbp->m_newpairs;
}
}
void Process(const btDbvtNode* n)
{
Process(n,proxy->leaf);
}
};
//
// btDbvtBroadphase
//
//
btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache)
{
m_deferedcollide = true;//false;
m_needcleanup = true;
m_releasepaircache = (paircache!=0)?false:true;
m_prediction = 1/(btScalar)2;
m_stageCurrent = 0;
m_fixedleft = 0;
m_fupdates = 1;
m_dupdates = 0;
m_cupdates = 10;
m_newpairs = 1;
m_updates_call = 0;
m_updates_done = 0;
m_updates_ratio = 0;
m_paircache = paircache?
paircache :
new(btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16)) btHashedOverlappingPairCache();
m_gid = 0;
m_pid = 0;
m_cid = 0;
for(int i=0;i<=STAGECOUNT;++i)
{
m_stageRoots[i]=0;
}
#if DBVT_BP_PROFILE
clear(m_profiling);
#endif
}
//
btDbvtBroadphase::~btDbvtBroadphase()
{
if(m_releasepaircache)
{
m_paircache->~btOverlappingPairCache();
btAlignedFree(m_paircache);
}
}
//
btBroadphaseProxy* btDbvtBroadphase::createProxy( const btVector3& aabbMin,
const btVector3& aabbMax,
int /*shapeType*/,
void* userPtr,
short int collisionFilterGroup,
short int collisionFilterMask,
btDispatcher* dispatcher,
void* /*multiSapProxy*/)
{
btDbvtProxy* proxy=new(btAlignedAlloc(sizeof(btDbvtProxy),16)) btDbvtProxy( userPtr,
collisionFilterGroup,
collisionFilterMask);
proxy->aabb = btDbvtVolume::FromMM(aabbMin,aabbMax);
proxy->stage = m_stageCurrent;
proxy->m_uniqueId = ++m_gid;
proxy->leaf = m_sets[0].insert(proxy->aabb,proxy);
listappend(proxy,m_stageRoots[m_stageCurrent]);
if(!m_deferedcollide)
{
btDbvtTreeCollider collider(this);
collider.proxy=proxy;
btDbvt::collideTV(m_sets[0].m_root,proxy->aabb,collider);
}
return(proxy);
}
//
void btDbvtBroadphase::destroyProxy( btBroadphaseProxy* absproxy,
btDispatcher* dispatcher)
{
btDbvtProxy* proxy=(btDbvtProxy*)absproxy;
if(proxy->stage==STAGECOUNT)
m_sets[1].remove(proxy->leaf);
else
m_sets[0].remove(proxy->leaf);
listremove(proxy,m_stageRoots[proxy->stage]);
m_paircache->removeOverlappingPairsContainingProxy(proxy,dispatcher);
btAlignedFree(proxy);
m_needcleanup=true;
}
//
void btDbvtBroadphase::setAabb( btBroadphaseProxy* absproxy,
const btVector3& aabbMin,
const btVector3& aabbMax,
btDispatcher* /*dispatcher*/)
{
btDbvtProxy* proxy=(btDbvtProxy*)absproxy;
ATTRIBUTE_ALIGNED16(btDbvtVolume) aabb=btDbvtVolume::FromMM(aabbMin,aabbMax);
#if DBVT_BP_PREVENTFALSEUPDATE
if(NotEqual(aabb,proxy->leaf->volume))
#endif
{
bool docollide=false;
if(proxy->stage==STAGECOUNT)
{/* fixed -> dynamic set */
m_sets[1].remove(proxy->leaf);
proxy->leaf=m_sets[0].insert(aabb,proxy);
docollide=true;
}
else
{/* dynamic set */
++m_updates_call;
if(Intersect(proxy->leaf->volume,aabb))
{/* Moving */
const btVector3 delta=aabbMin-proxy->aabb.Mins();
btVector3 velocity(aabb.Extents()*m_prediction);
if(delta[0]<0) velocity[0]=-velocity[0];
if(delta[1]<0) velocity[1]=-velocity[1];
if(delta[2]<0) velocity[2]=-velocity[2];
if (
#ifdef DBVT_BP_MARGIN
m_sets[0].update(proxy->leaf,aabb,velocity,DBVT_BP_MARGIN)
#else
m_sets[0].update(proxy->leaf,aabb,velocity)
#endif
)
{
++m_updates_done;
docollide=true;
}
}
else
{/* Teleporting */
m_sets[0].update(proxy->leaf,aabb);
++m_updates_done;
docollide=true;
}
}
listremove(proxy,m_stageRoots[proxy->stage]);
proxy->aabb = aabb;
proxy->stage = m_stageCurrent;
listappend(proxy,m_stageRoots[m_stageCurrent]);
if(docollide)
{
m_needcleanup=true;
if(!m_deferedcollide)
{
btDbvtTreeCollider collider(this);
btDbvt::collideTT(m_sets[1].m_root,proxy->leaf,collider);
btDbvt::collideTT(m_sets[0].m_root,proxy->leaf,collider);
}
}
}
}
//
void btDbvtBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
{
collide(dispatcher);
#if DBVT_BP_PROFILE
if(0==(m_pid%DBVT_BP_PROFILING_RATE))
{
printf("fixed(%u) dynamics(%u) pairs(%u)\r\n",m_sets[1].m_leaves,m_sets[0].m_leaves,m_paircache->getNumOverlappingPairs());
unsigned int total=m_profiling.m_total;
if(total<=0) total=1;
printf("ddcollide: %u%% (%uus)\r\n",(50+m_profiling.m_ddcollide*100)/total,m_profiling.m_ddcollide/DBVT_BP_PROFILING_RATE);
printf("fdcollide: %u%% (%uus)\r\n",(50+m_profiling.m_fdcollide*100)/total,m_profiling.m_fdcollide/DBVT_BP_PROFILING_RATE);
printf("cleanup: %u%% (%uus)\r\n",(50+m_profiling.m_cleanup*100)/total,m_profiling.m_cleanup/DBVT_BP_PROFILING_RATE);
printf("total: %uus\r\n",total/DBVT_BP_PROFILING_RATE);
const unsigned long sum=m_profiling.m_ddcollide+
m_profiling.m_fdcollide+
m_profiling.m_cleanup;
printf("leaked: %u%% (%uus)\r\n",100-((50+sum*100)/total),(total-sum)/DBVT_BP_PROFILING_RATE);
printf("job counts: %u%%\r\n",(m_profiling.m_jobcount*100)/((m_sets[0].m_leaves+m_sets[1].m_leaves)*DBVT_BP_PROFILING_RATE));
clear(m_profiling);
m_clock.reset();
}
#endif
}
//
void btDbvtBroadphase::collide(btDispatcher* dispatcher)
{
SPC(m_profiling.m_total);
/* optimize */
m_sets[0].optimizeIncremental(1+(m_sets[0].m_leaves*m_dupdates)/100);
if(m_fixedleft)
{
const int count=1+(m_sets[1].m_leaves*m_fupdates)/100;
m_sets[1].optimizeIncremental(1+(m_sets[1].m_leaves*m_fupdates)/100);
m_fixedleft=btMax<int>(0,m_fixedleft-count);
}
/* dynamic -> fixed set */
m_stageCurrent=(m_stageCurrent+1)%STAGECOUNT;
btDbvtProxy* current=m_stageRoots[m_stageCurrent];
if(current)
{
btDbvtTreeCollider collider(this);
do {
btDbvtProxy* next=current->links[1];
listremove(current,m_stageRoots[current->stage]);
listappend(current,m_stageRoots[STAGECOUNT]);
#if DBVT_BP_ACCURATESLEEPING
m_paircache->removeOverlappingPairsContainingProxy(current,dispatcher);
collider.proxy=current;
btDbvt::collideTV(m_sets[0].m_root,current->aabb,collider);
btDbvt::collideTV(m_sets[1].m_root,current->aabb,collider);
#endif
m_sets[0].remove(current->leaf);
current->leaf = m_sets[1].insert(current->aabb,current);
current->stage = STAGECOUNT;
current = next;
} while(current);
m_fixedleft=m_sets[1].m_leaves;
m_needcleanup=true;
}
/* collide dynamics */
{
btDbvtTreeCollider collider(this);
if(m_deferedcollide)
{
SPC(m_profiling.m_fdcollide);
btDbvt::collideTT(m_sets[0].m_root,m_sets[1].m_root,collider);
}
if(m_deferedcollide)
{
SPC(m_profiling.m_ddcollide);
btDbvt::collideTT(m_sets[0].m_root,m_sets[0].m_root,collider);
}
}
/* clean up */
if(m_needcleanup)
{
SPC(m_profiling.m_cleanup);
btBroadphasePairArray& pairs=m_paircache->getOverlappingPairArray();
if(pairs.size()>0)
{
const int ci=pairs.size();
int ni=btMin(ci,btMax<int>(m_newpairs,(ci*m_cupdates)/100));
for(int i=0;i<ni;++i)
{
btBroadphasePair& p=pairs[(m_cid+i)%ci];
btDbvtProxy* pa=(btDbvtProxy*)p.m_pProxy0;
btDbvtProxy* pb=(btDbvtProxy*)p.m_pProxy1;
if(!Intersect(pa->leaf->volume,pb->leaf->volume))
{
#if DBVT_BP_SORTPAIRS
if(pa>pb) btSwap(pa,pb);
#endif
m_paircache->removeOverlappingPair(pa,pb,dispatcher);
--ni;--i;
}
}
if(pairs.size()>0) m_cid=(m_cid+ni)%pairs.size(); else m_cid=0;
}
}
++m_pid;
m_newpairs=1;
m_needcleanup=false;
if(m_updates_call>0)
{ m_updates_ratio=m_updates_done/(btScalar)m_updates_call; }
else
{ m_updates_ratio=0; }
m_updates_done/=2;
m_updates_call/=2;
}
//
void btDbvtBroadphase::optimize()
{
m_sets[0].optimizeTopDown();
m_sets[1].optimizeTopDown();
}
//
btOverlappingPairCache* btDbvtBroadphase::getOverlappingPairCache()
{
return(m_paircache);
}
//
const btOverlappingPairCache* btDbvtBroadphase::getOverlappingPairCache() const
{
return(m_paircache);
}
//
void btDbvtBroadphase::getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const
{
ATTRIBUTE_ALIGNED16(btDbvtVolume) bounds;
if(!m_sets[0].empty())
if(!m_sets[1].empty()) Merge( m_sets[0].m_root->volume,
m_sets[1].m_root->volume,bounds);
else
bounds=m_sets[0].m_root->volume;
else if(!m_sets[1].empty()) bounds=m_sets[1].m_root->volume;
else
bounds=btDbvtVolume::FromCR(btVector3(0,0,0),0);
aabbMin=bounds.Mins();
aabbMax=bounds.Maxs();
}
//
void btDbvtBroadphase::printStats()
{}
//
#if DBVT_BP_ENABLE_BENCHMARK
struct btBroadphaseBenchmark
{
struct Experiment
{
const char* name;
int object_count;
int update_count;
int spawn_count;
int iterations;
btScalar speed;
btScalar amplitude;
};
struct Object
{
btVector3 center;
btVector3 extents;
btBroadphaseProxy* proxy;
btScalar time;
void update(btScalar speed,btScalar amplitude,btBroadphaseInterface* pbi)
{
time += speed;
center[0] = btCos(time*(btScalar)2.17)*amplitude+
btSin(time)*amplitude/2;
center[1] = btCos(time*(btScalar)1.38)*amplitude+
btSin(time)*amplitude;
center[2] = btSin(time*(btScalar)0.777)*amplitude;
pbi->setAabb(proxy,center-extents,center+extents,0);
}
};
static int UnsignedRand(int range=RAND_MAX-1) { return(rand()%(range+1)); }
static btScalar UnitRand() { return(UnsignedRand(16384)/(btScalar)16384); }
static void OutputTime(const char* name,btClock& c,unsigned count=0)
{
const unsigned long us=c.getTimeMicroseconds();
const unsigned long ms=(us+500)/1000;
const btScalar sec=us/(btScalar)(1000*1000);
if(count>0)
printf("%s : %u us (%u ms), %.2f/s\r\n",name,us,ms,count/sec);
else
printf("%s : %u us (%u ms)\r\n",name,us,ms);
}
};
void btDbvtBroadphase::benchmark(btBroadphaseInterface* pbi)
{
static const btBroadphaseBenchmark::Experiment experiments[]=
{
{"1024o.10%",1024,10,0,8192,(btScalar)0.005,(btScalar)100},
/*{"4096o.10%",4096,10,0,8192,(btScalar)0.005,(btScalar)100},
{"8192o.10%",8192,10,0,8192,(btScalar)0.005,(btScalar)100},*/
};
static const int nexperiments=sizeof(experiments)/sizeof(experiments[0]);
btAlignedObjectArray<btBroadphaseBenchmark::Object*> objects;
btClock wallclock;
/* Begin */
for(int iexp=0;iexp<nexperiments;++iexp)
{
const btBroadphaseBenchmark::Experiment& experiment=experiments[iexp];
const int object_count=experiment.object_count;
const int update_count=(object_count*experiment.update_count)/100;
const int spawn_count=(object_count*experiment.spawn_count)/100;
const btScalar speed=experiment.speed;
const btScalar amplitude=experiment.amplitude;
printf("Experiment #%u '%s':\r\n",iexp,experiment.name);
printf("\tObjects: %u\r\n",object_count);
printf("\tUpdate: %u\r\n",update_count);
printf("\tSpawn: %u\r\n",spawn_count);
printf("\tSpeed: %f\r\n",speed);
printf("\tAmplitude: %f\r\n",amplitude);
srand(180673);
/* Create objects */
wallclock.reset();
objects.reserve(object_count);
for(int i=0;i<object_count;++i)
{
btBroadphaseBenchmark::Object* po=new btBroadphaseBenchmark::Object();
po->center[0]=btBroadphaseBenchmark::UnitRand()*50;
po->center[1]=btBroadphaseBenchmark::UnitRand()*50;
po->center[2]=btBroadphaseBenchmark::UnitRand()*50;
po->extents[0]=btBroadphaseBenchmark::UnitRand()*2+2;
po->extents[1]=btBroadphaseBenchmark::UnitRand()*2+2;
po->extents[2]=btBroadphaseBenchmark::UnitRand()*2+2;
po->time=btBroadphaseBenchmark::UnitRand()*2000;
po->proxy=pbi->createProxy(po->center-po->extents,po->center+po->extents,0,po,1,1,0,0);
objects.push_back(po);
}
btBroadphaseBenchmark::OutputTime("\tInitialization",wallclock);
/* First update */
wallclock.reset();
for(int i=0;i<objects.size();++i)
{
objects[i]->update(speed,amplitude,pbi);
}
btBroadphaseBenchmark::OutputTime("\tFirst update",wallclock);
/* Updates */
wallclock.reset();
for(int i=0;i<experiment.iterations;++i)
{
for(int j=0;j<update_count;++j)
{
objects[j]->update(speed,amplitude,pbi);
}
pbi->calculateOverlappingPairs(0);
}
btBroadphaseBenchmark::OutputTime("\tUpdate",wallclock,experiment.iterations);
/* Clean up */
wallclock.reset();
for(int i=0;i<objects.size();++i)
{
pbi->destroyProxy(objects[i]->proxy,0);
delete objects[i];
}
objects.resize(0);
btBroadphaseBenchmark::OutputTime("\tRelease",wallclock);
}
}
#else
void btDbvtBroadphase::benchmark(btBroadphaseInterface*)
{}
#endif
#if DBVT_BP_PROFILE
#undef SPC
#endif

View File

@@ -0,0 +1,117 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2007 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
///btDbvtBroadphase implementation by Nathanael Presson
#ifndef BT_DBVT_BROADPHASE_H
#define BT_DBVT_BROADPHASE_H
#include "BulletCollision/BroadphaseCollision/btDbvt.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
//
// Compile time config
//
#define DBVT_BP_PROFILE 0
#define DBVT_BP_SORTPAIRS 1
#define DBVT_BP_PREVENTFALSEUPDATE 0
#define DBVT_BP_ACCURATESLEEPING 0
#define DBVT_BP_ENABLE_BENCHMARK 0
#define DBVT_BP_MARGIN (btScalar)0.05
#if DBVT_BP_PROFILE
#define DBVT_BP_PROFILING_RATE 256
#include "LinearMath/btQuickprof.h"
#endif
//
// btDbvtProxy
//
struct btDbvtProxy : btBroadphaseProxy
{
/* Fields */
btDbvtAabbMm aabb;
btDbvtNode* leaf;
btDbvtProxy* links[2];
int stage;
/* ctor */
btDbvtProxy(void* userPtr,short int collisionFilterGroup, short int collisionFilterMask) :
btBroadphaseProxy(userPtr,collisionFilterGroup,collisionFilterMask)
{
links[0]=links[1]=0;
}
};
typedef btAlignedObjectArray<btDbvtProxy*> btDbvtProxyArray;
///The btDbvtBroadphase implements a broadphase using two dynamic AABB bounding volume hierarchies/trees (see btDbvt).
///One tree is used for static/non-moving objects, and another tree is used for dynamic objects. Objects can move from one tree to the other.
///This is a very fast broadphase, especially for very dynamic worlds where many objects are moving. Its insert/add and remove of objects is generally faster than the sweep and prune broadphases btAxisSweep3 and bt32BitAxisSweep3.
struct btDbvtBroadphase : btBroadphaseInterface
{
/* Config */
enum {
DYNAMIC_SET = 0, /* Dynamic set index */
FIXED_SET = 1, /* Fixed set index */
STAGECOUNT = 2 /* Number of stages */
};
/* Fields */
btDbvt m_sets[2]; // Dbvt sets
btDbvtProxy* m_stageRoots[STAGECOUNT+1]; // Stages list
btOverlappingPairCache* m_paircache; // Pair cache
btScalar m_prediction; // Velocity prediction
int m_stageCurrent; // Current stage
int m_fupdates; // % of fixed updates per frame
int m_dupdates; // % of dynamic updates per frame
int m_cupdates; // % of cleanup updates per frame
int m_newpairs; // Number of pairs created
int m_fixedleft; // Fixed optimization left
unsigned m_updates_call; // Number of updates call
unsigned m_updates_done; // Number of updates done
btScalar m_updates_ratio; // m_updates_done/m_updates_call
int m_pid; // Parse id
int m_cid; // Cleanup index
int m_gid; // Gen id
bool m_releasepaircache; // Release pair cache on delete
bool m_deferedcollide; // Defere dynamic/static collision to collide call
bool m_needcleanup; // Need to run cleanup?
bool m_initialize; // Initialization
#if DBVT_BP_PROFILE
btClock m_clock;
struct {
unsigned long m_total;
unsigned long m_ddcollide;
unsigned long m_fdcollide;
unsigned long m_cleanup;
unsigned long m_jobcount;
} m_profiling;
#endif
/* Methods */
btDbvtBroadphase(btOverlappingPairCache* paircache=0);
~btDbvtBroadphase();
void collide(btDispatcher* dispatcher);
void optimize();
/* btBroadphaseInterface Implementation */
btBroadphaseProxy* createProxy(const btVector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy);
void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher);
void calculateOverlappingPairs(btDispatcher* dispatcher);
btOverlappingPairCache* getOverlappingPairCache();
const btOverlappingPairCache* getOverlappingPairCache() const;
void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const;
void printStats();
static void benchmark(btBroadphaseInterface*);
};
#endif

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef _DISPATCHER_H
#define _DISPATCHER_H
#include "../../LinearMath/btScalar.h"
#include "LinearMath/btScalar.h"
class btCollisionAlgorithm;
struct btBroadphaseProxy;
@@ -43,7 +43,9 @@ struct btDispatcherInfo
m_useContinuous(false),
m_debugDraw(0),
m_enableSatConvex(false),
m_enableSPU(false),
m_enableSPU(true),
m_useEpa(true),
m_allowedCcdPenetration(btScalar(0.04)),
m_stackAllocator(0)
{
@@ -51,17 +53,19 @@ struct btDispatcherInfo
btScalar m_timeStep;
int m_stepCount;
int m_dispatchFunc;
btScalar m_timeOfImpact;
mutable btScalar m_timeOfImpact;
bool m_useContinuous;
class btIDebugDraw* m_debugDraw;
bool m_enableSatConvex;
bool m_enableSPU;
bool m_useEpa;
btScalar m_allowedCcdPenetration;
btStackAlloc* m_stackAllocator;
};
/// btDispatcher can be used in combination with broadphase to dispatch overlapping pairs.
/// For example for pairwise collision detection or user callbacks (game logic).
///The btDispatcher interface class can be used in combination with broadphase to dispatch calculations for overlapping pairs.
///For example for pairwise collision detection, calculating contact points stored in btPersistentManifold or user callbacks (game logic).
class btDispatcher
{
@@ -81,12 +85,18 @@ public:
virtual bool needsResponse(btCollisionObject* body0,btCollisionObject* body1)=0;
virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)=0;
virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) =0;
virtual int getNumManifolds() const = 0;
virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0;
virtual btPersistentManifold** getInternalManifoldPointer() = 0;
virtual void* allocateCollisionAlgorithm(int size) = 0;
virtual void freeCollisionAlgorithm(void* ptr) = 0;
};

View File

@@ -0,0 +1,466 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "btMultiSapBroadphase.h"
#include "btSimpleBroadphase.h"
#include "LinearMath/btAabbUtil2.h"
#include "btQuantizedBvh.h"
/// btSapBroadphaseArray m_sapBroadphases;
/// btOverlappingPairCache* m_overlappingPairs;
extern int gOverlappingPairs;
/*
class btMultiSapSortedOverlappingPairCache : public btSortedOverlappingPairCache
{
public:
virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
return btSortedOverlappingPairCache::addOverlappingPair((btBroadphaseProxy*)proxy0->m_multiSapParentProxy,(btBroadphaseProxy*)proxy1->m_multiSapParentProxy);
}
};
*/
btMultiSapBroadphase::btMultiSapBroadphase(int /*maxProxies*/,btOverlappingPairCache* pairCache)
:m_overlappingPairs(pairCache),
m_optimizedAabbTree(0),
m_ownsPairCache(false),
m_invalidPair(0)
{
if (!m_overlappingPairs)
{
m_ownsPairCache = true;
void* mem = btAlignedAlloc(sizeof(btSortedOverlappingPairCache),16);
m_overlappingPairs = new (mem)btSortedOverlappingPairCache();
}
struct btMultiSapOverlapFilterCallback : public btOverlapFilterCallback
{
virtual ~btMultiSapOverlapFilterCallback()
{}
// return true when pairs need collision
virtual bool needBroadphaseCollision(btBroadphaseProxy* childProxy0,btBroadphaseProxy* childProxy1) const
{
btBroadphaseProxy* multiProxy0 = (btBroadphaseProxy*)childProxy0->m_multiSapParentProxy;
btBroadphaseProxy* multiProxy1 = (btBroadphaseProxy*)childProxy1->m_multiSapParentProxy;
bool collides = (multiProxy0->m_collisionFilterGroup & multiProxy1->m_collisionFilterMask) != 0;
collides = collides && (multiProxy1->m_collisionFilterGroup & multiProxy0->m_collisionFilterMask);
return collides;
}
};
void* mem = btAlignedAlloc(sizeof(btMultiSapOverlapFilterCallback),16);
m_filterCallback = new (mem)btMultiSapOverlapFilterCallback();
m_overlappingPairs->setOverlapFilterCallback(m_filterCallback);
// mem = btAlignedAlloc(sizeof(btSimpleBroadphase),16);
// m_simpleBroadphase = new (mem) btSimpleBroadphase(maxProxies,m_overlappingPairs);
}
btMultiSapBroadphase::~btMultiSapBroadphase()
{
if (m_ownsPairCache)
{
m_overlappingPairs->~btOverlappingPairCache();
btAlignedFree(m_overlappingPairs);
}
}
void btMultiSapBroadphase::buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax)
{
m_optimizedAabbTree = new btQuantizedBvh();
m_optimizedAabbTree->setQuantizationValues(bvhAabbMin,bvhAabbMax);
QuantizedNodeArray& nodes = m_optimizedAabbTree->getLeafNodeArray();
for (int i=0;i<m_sapBroadphases.size();i++)
{
btQuantizedBvhNode node;
btVector3 aabbMin,aabbMax;
m_sapBroadphases[i]->getBroadphaseAabb(aabbMin,aabbMax);
m_optimizedAabbTree->quantize(&node.m_quantizedAabbMin[0],aabbMin,0);
m_optimizedAabbTree->quantize(&node.m_quantizedAabbMax[0],aabbMax,1);
int partId = 0;
node.m_escapeIndexOrTriangleIndex = (partId<<(31-MAX_NUM_PARTS_IN_BITS)) | i;
nodes.push_back(node);
}
m_optimizedAabbTree->buildInternal();
}
btBroadphaseProxy* btMultiSapBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* /*ignoreMe*/)
{
//void* ignoreMe -> we could think of recursive multi-sap, if someone is interested
void* mem = btAlignedAlloc(sizeof(btMultiSapProxy),16);
btMultiSapProxy* proxy = new (mem)btMultiSapProxy(aabbMin, aabbMax,shapeType,userPtr, collisionFilterGroup,collisionFilterMask);
m_multiSapProxies.push_back(proxy);
///this should deal with inserting/removal into child broadphases
setAabb(proxy,aabbMin,aabbMax,dispatcher);
return proxy;
}
void btMultiSapBroadphase::destroyProxy(btBroadphaseProxy* /*proxy*/,btDispatcher* /*dispatcher*/)
{
///not yet
btAssert(0);
}
void btMultiSapBroadphase::addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase)
{
void* mem = btAlignedAlloc(sizeof(btBridgeProxy),16);
btBridgeProxy* bridgeProxyRef = new(mem) btBridgeProxy;
bridgeProxyRef->m_childProxy = childProxy;
bridgeProxyRef->m_childBroadphase = childBroadphase;
parentMultiSapProxy->m_bridgeProxies.push_back(bridgeProxyRef);
}
bool boxIsContainedWithinBox(const btVector3& amin,const btVector3& amax,const btVector3& bmin,const btVector3& bmax);
bool boxIsContainedWithinBox(const btVector3& amin,const btVector3& amax,const btVector3& bmin,const btVector3& bmax)
{
return
amin.getX() >= bmin.getX() && amax.getX() <= bmax.getX() &&
amin.getY() >= bmin.getY() && amax.getY() <= bmax.getY() &&
amin.getZ() >= bmin.getZ() && amax.getZ() <= bmax.getZ();
}
//#include <stdio.h>
void btMultiSapBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher)
{
btMultiSapProxy* multiProxy = static_cast<btMultiSapProxy*>(proxy);
multiProxy->m_aabbMin = aabbMin;
multiProxy->m_aabbMax = aabbMax;
// bool fullyContained = false;
// bool alreadyInSimple = false;
struct MyNodeOverlapCallback : public btNodeOverlapCallback
{
btMultiSapBroadphase* m_multiSap;
btMultiSapProxy* m_multiProxy;
btDispatcher* m_dispatcher;
MyNodeOverlapCallback(btMultiSapBroadphase* multiSap,btMultiSapProxy* multiProxy,btDispatcher* dispatcher)
:m_multiSap(multiSap),
m_multiProxy(multiProxy),
m_dispatcher(dispatcher)
{
}
virtual void processNode(int /*nodeSubPart*/, int broadphaseIndex)
{
btBroadphaseInterface* childBroadphase = m_multiSap->getBroadphaseArray()[broadphaseIndex];
int containingBroadphaseIndex = -1;
//already found?
for (int i=0;i<m_multiProxy->m_bridgeProxies.size();i++)
{
if (m_multiProxy->m_bridgeProxies[i]->m_childBroadphase == childBroadphase)
{
containingBroadphaseIndex = i;
break;
}
}
if (containingBroadphaseIndex<0)
{
//add it
btBroadphaseProxy* childProxy = childBroadphase->createProxy(m_multiProxy->m_aabbMin,m_multiProxy->m_aabbMax,m_multiProxy->m_shapeType,m_multiProxy->m_clientObject,m_multiProxy->m_collisionFilterGroup,m_multiProxy->m_collisionFilterMask, m_dispatcher,m_multiProxy);
m_multiSap->addToChildBroadphase(m_multiProxy,childProxy,childBroadphase);
}
}
};
MyNodeOverlapCallback myNodeCallback(this,multiProxy,dispatcher);
m_optimizedAabbTree->reportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax);
int i;
for ( i=0;i<multiProxy->m_bridgeProxies.size();i++)
{
btVector3 worldAabbMin,worldAabbMax;
multiProxy->m_bridgeProxies[i]->m_childBroadphase->getBroadphaseAabb(worldAabbMin,worldAabbMax);
bool overlapsBroadphase = TestAabbAgainstAabb2(worldAabbMin,worldAabbMax,multiProxy->m_aabbMin,multiProxy->m_aabbMax);
if (!overlapsBroadphase)
{
//remove it now
btBridgeProxy* bridgeProxy = multiProxy->m_bridgeProxies[i];
btBroadphaseProxy* childProxy = bridgeProxy->m_childProxy;
bridgeProxy->m_childBroadphase->destroyProxy(childProxy,dispatcher);
multiProxy->m_bridgeProxies.swap( i,multiProxy->m_bridgeProxies.size()-1);
multiProxy->m_bridgeProxies.pop_back();
}
}
/*
if (1)
{
//find broadphase that contain this multiProxy
int numChildBroadphases = getBroadphaseArray().size();
for (int i=0;i<numChildBroadphases;i++)
{
btBroadphaseInterface* childBroadphase = getBroadphaseArray()[i];
btVector3 worldAabbMin,worldAabbMax;
childBroadphase->getBroadphaseAabb(worldAabbMin,worldAabbMax);
bool overlapsBroadphase = TestAabbAgainstAabb2(worldAabbMin,worldAabbMax,multiProxy->m_aabbMin,multiProxy->m_aabbMax);
// fullyContained = fullyContained || boxIsContainedWithinBox(worldAabbMin,worldAabbMax,multiProxy->m_aabbMin,multiProxy->m_aabbMax);
int containingBroadphaseIndex = -1;
//if already contains this
for (int i=0;i<multiProxy->m_bridgeProxies.size();i++)
{
if (multiProxy->m_bridgeProxies[i]->m_childBroadphase == childBroadphase)
{
containingBroadphaseIndex = i;
}
alreadyInSimple = alreadyInSimple || (multiProxy->m_bridgeProxies[i]->m_childBroadphase == m_simpleBroadphase);
}
if (overlapsBroadphase)
{
if (containingBroadphaseIndex<0)
{
btBroadphaseProxy* childProxy = childBroadphase->createProxy(aabbMin,aabbMax,multiProxy->m_shapeType,multiProxy->m_clientObject,multiProxy->m_collisionFilterGroup,multiProxy->m_collisionFilterMask, dispatcher);
childProxy->m_multiSapParentProxy = multiProxy;
addToChildBroadphase(multiProxy,childProxy,childBroadphase);
}
} else
{
if (containingBroadphaseIndex>=0)
{
//remove
btBridgeProxy* bridgeProxy = multiProxy->m_bridgeProxies[containingBroadphaseIndex];
btBroadphaseProxy* childProxy = bridgeProxy->m_childProxy;
bridgeProxy->m_childBroadphase->destroyProxy(childProxy,dispatcher);
multiProxy->m_bridgeProxies.swap( containingBroadphaseIndex,multiProxy->m_bridgeProxies.size()-1);
multiProxy->m_bridgeProxies.pop_back();
}
}
}
///If we are in no other child broadphase, stick the proxy in the global 'simple' broadphase (brute force)
///hopefully we don't end up with many entries here (can assert/provide feedback on stats)
if (0)//!multiProxy->m_bridgeProxies.size())
{
///we don't pass the userPtr but our multisap proxy. We need to patch this, before processing an actual collision
///this is needed to be able to calculate the aabb overlap
btBroadphaseProxy* childProxy = m_simpleBroadphase->createProxy(aabbMin,aabbMax,multiProxy->m_shapeType,multiProxy->m_clientObject,multiProxy->m_collisionFilterGroup,multiProxy->m_collisionFilterMask, dispatcher);
childProxy->m_multiSapParentProxy = multiProxy;
addToChildBroadphase(multiProxy,childProxy,m_simpleBroadphase);
}
}
if (!multiProxy->m_bridgeProxies.size())
{
///we don't pass the userPtr but our multisap proxy. We need to patch this, before processing an actual collision
///this is needed to be able to calculate the aabb overlap
btBroadphaseProxy* childProxy = m_simpleBroadphase->createProxy(aabbMin,aabbMax,multiProxy->m_shapeType,multiProxy->m_clientObject,multiProxy->m_collisionFilterGroup,multiProxy->m_collisionFilterMask, dispatcher);
childProxy->m_multiSapParentProxy = multiProxy;
addToChildBroadphase(multiProxy,childProxy,m_simpleBroadphase);
}
*/
//update
for ( i=0;i<multiProxy->m_bridgeProxies.size();i++)
{
btBridgeProxy* bridgeProxyRef = multiProxy->m_bridgeProxies[i];
bridgeProxyRef->m_childBroadphase->setAabb(bridgeProxyRef->m_childProxy,aabbMin,aabbMax,dispatcher);
}
}
bool stopUpdating=false;
class btMultiSapBroadphasePairSortPredicate
{
public:
bool operator() ( const btBroadphasePair& a1, const btBroadphasePair& b1 )
{
btMultiSapBroadphase::btMultiSapProxy* aProxy0 = a1.m_pProxy0 ? (btMultiSapBroadphase::btMultiSapProxy*)a1.m_pProxy0->m_multiSapParentProxy : 0;
btMultiSapBroadphase::btMultiSapProxy* aProxy1 = a1.m_pProxy1 ? (btMultiSapBroadphase::btMultiSapProxy*)a1.m_pProxy1->m_multiSapParentProxy : 0;
btMultiSapBroadphase::btMultiSapProxy* bProxy0 = b1.m_pProxy0 ? (btMultiSapBroadphase::btMultiSapProxy*)b1.m_pProxy0->m_multiSapParentProxy : 0;
btMultiSapBroadphase::btMultiSapProxy* bProxy1 = b1.m_pProxy1 ? (btMultiSapBroadphase::btMultiSapProxy*)b1.m_pProxy1->m_multiSapParentProxy : 0;
return aProxy0 > bProxy0 ||
(aProxy0 == bProxy0 && aProxy1 > bProxy1) ||
(aProxy0 == bProxy0 && aProxy1 == bProxy1 && a1.m_algorithm > b1.m_algorithm);
}
};
///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb
void btMultiSapBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
{
// m_simpleBroadphase->calculateOverlappingPairs(dispatcher);
if (!stopUpdating && getOverlappingPairCache()->hasDeferredRemoval())
{
btBroadphasePairArray& overlappingPairArray = getOverlappingPairCache()->getOverlappingPairArray();
// quicksort(overlappingPairArray,0,overlappingPairArray.size());
overlappingPairArray.quickSort(btMultiSapBroadphasePairSortPredicate());
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
// overlappingPairArray.heapSort(btMultiSapBroadphasePairSortPredicate());
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
m_invalidPair = 0;
int i;
btBroadphasePair previousPair;
previousPair.m_pProxy0 = 0;
previousPair.m_pProxy1 = 0;
previousPair.m_algorithm = 0;
for (i=0;i<overlappingPairArray.size();i++)
{
btBroadphasePair& pair = overlappingPairArray[i];
btMultiSapProxy* aProxy0 = pair.m_pProxy0 ? (btMultiSapProxy*)pair.m_pProxy0->m_multiSapParentProxy : 0;
btMultiSapProxy* aProxy1 = pair.m_pProxy1 ? (btMultiSapProxy*)pair.m_pProxy1->m_multiSapParentProxy : 0;
btMultiSapProxy* bProxy0 = previousPair.m_pProxy0 ? (btMultiSapProxy*)previousPair.m_pProxy0->m_multiSapParentProxy : 0;
btMultiSapProxy* bProxy1 = previousPair.m_pProxy1 ? (btMultiSapProxy*)previousPair.m_pProxy1->m_multiSapParentProxy : 0;
bool isDuplicate = (aProxy0 == bProxy0) && (aProxy1 == bProxy1);
previousPair = pair;
bool needsRemoval = false;
if (!isDuplicate)
{
bool hasOverlap = testAabbOverlap(pair.m_pProxy0,pair.m_pProxy1);
if (hasOverlap)
{
needsRemoval = false;//callback->processOverlap(pair);
} else
{
needsRemoval = true;
}
} else
{
//remove duplicate
needsRemoval = true;
//should have no algorithm
btAssert(!pair.m_algorithm);
}
if (needsRemoval)
{
getOverlappingPairCache()->cleanOverlappingPair(pair,dispatcher);
// m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
// m_overlappingPairArray.pop_back();
pair.m_pProxy0 = 0;
pair.m_pProxy1 = 0;
m_invalidPair++;
gOverlappingPairs--;
}
}
///if you don't like to skip the invalid pairs in the array, execute following code:
#define CLEAN_INVALID_PAIRS 1
#ifdef CLEAN_INVALID_PAIRS
//perform a sort, to sort 'invalid' pairs to the end
//overlappingPairArray.heapSort(btMultiSapBroadphasePairSortPredicate());
overlappingPairArray.quickSort(btMultiSapBroadphasePairSortPredicate());
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
m_invalidPair = 0;
#endif//CLEAN_INVALID_PAIRS
//printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size());
}
}
bool btMultiSapBroadphase::testAabbOverlap(btBroadphaseProxy* childProxy0,btBroadphaseProxy* childProxy1)
{
btMultiSapProxy* multiSapProxy0 = (btMultiSapProxy*)childProxy0->m_multiSapParentProxy;
btMultiSapProxy* multiSapProxy1 = (btMultiSapProxy*)childProxy1->m_multiSapParentProxy;
return TestAabbAgainstAabb2(multiSapProxy0->m_aabbMin,multiSapProxy0->m_aabbMax,
multiSapProxy1->m_aabbMin,multiSapProxy1->m_aabbMax);
}
void btMultiSapBroadphase::printStats()
{
/* printf("---------------------------------\n");
printf("btMultiSapBroadphase.h\n");
printf("numHandles = %d\n",m_multiSapProxies.size());
//find broadphase that contain this multiProxy
int numChildBroadphases = getBroadphaseArray().size();
for (int i=0;i<numChildBroadphases;i++)
{
btBroadphaseInterface* childBroadphase = getBroadphaseArray()[i];
childBroadphase->printStats();
}
*/
}

View File

@@ -0,0 +1,144 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BT_MULTI_SAP_BROADPHASE
#define BT_MULTI_SAP_BROADPHASE
#include "btBroadphaseInterface.h"
#include "LinearMath/btAlignedObjectArray.h"
#include "btOverlappingPairCache.h"
class btBroadphaseInterface;
class btSimpleBroadphase;
typedef btAlignedObjectArray<btBroadphaseInterface*> btSapBroadphaseArray;
///The btMultiSapBroadphase is a broadphase that contains multiple SAP broadphases.
///The user can add SAP broadphases that cover the world. A btBroadphaseProxy can be in multiple child broadphases at the same time.
///A btQuantizedBvh acceleration structures finds overlapping SAPs for each btBroadphaseProxy.
///See http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=328
///and http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1329
class btMultiSapBroadphase :public btBroadphaseInterface
{
btSapBroadphaseArray m_sapBroadphases;
btSimpleBroadphase* m_simpleBroadphase;
btOverlappingPairCache* m_overlappingPairs;
class btQuantizedBvh* m_optimizedAabbTree;
bool m_ownsPairCache;
btOverlapFilterCallback* m_filterCallback;
int m_invalidPair;
struct btBridgeProxy
{
btBroadphaseProxy* m_childProxy;
btBroadphaseInterface* m_childBroadphase;
};
public:
struct btMultiSapProxy : public btBroadphaseProxy
{
///array with all the entries that this proxy belongs to
btAlignedObjectArray<btBridgeProxy*> m_bridgeProxies;
btVector3 m_aabbMin;
btVector3 m_aabbMax;
int m_shapeType;
/* void* m_userPtr;
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
*/
btMultiSapProxy(const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask)
:btBroadphaseProxy(userPtr,collisionFilterGroup,collisionFilterMask),
m_aabbMin(aabbMin),
m_aabbMax(aabbMax),
m_shapeType(shapeType)
{
m_multiSapParentProxy =this;
}
};
protected:
btAlignedObjectArray<btMultiSapProxy*> m_multiSapProxies;
public:
btMultiSapBroadphase(int maxProxies = 16384,btOverlappingPairCache* pairCache=0);
btSapBroadphaseArray& getBroadphaseArray()
{
return m_sapBroadphases;
}
const btSapBroadphaseArray& getBroadphaseArray() const
{
return m_sapBroadphases;
}
virtual ~btMultiSapBroadphase();
virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy);
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher);
void addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase);
///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb
virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
virtual btOverlappingPairCache* getOverlappingPairCache()
{
return m_overlappingPairs;
}
virtual const btOverlappingPairCache* getOverlappingPairCache() const
{
return m_overlappingPairs;
}
///getAabb returns the axis aligned bounding box in the 'global' coordinate frame
///will add some transform later
virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const
{
aabbMin.setValue(-1e30f,-1e30f,-1e30f);
aabbMax.setValue(1e30f,1e30f,1e30f);
}
void buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax);
virtual void printStats();
void quicksort (btBroadphasePairArray& a, int lo, int hi);
};
#endif //BT_MULTI_SAP_BROADPHASE

View File

@@ -1,4 +1,3 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
@@ -21,44 +20,43 @@ subject to the following restrictions:
#include "btDispatcher.h"
#include "btCollisionAlgorithm.h"
#include <stdio.h>
int gOverlappingPairs = 0;
btOverlappingPairCache::btOverlappingPairCache():
m_blockedForChanges(false),
m_overlapFilterCallback(0)
//m_NumOverlapBroadphasePair(0)
int gRemovePairs =0;
int gAddedPairs =0;
int gFindPairs =0;
btHashedOverlappingPairCache::btHashedOverlappingPairCache():
m_overlapFilterCallback(0),
m_blockedForChanges(false)
{
int initialAllocatedSize= 2;
m_overlappingPairArray.reserve(initialAllocatedSize);
growTables();
}
btOverlappingPairCache::~btOverlappingPairCache()
btHashedOverlappingPairCache::~btHashedOverlappingPairCache()
{
//todo/test: show we erase/delete data, or is it automatic
}
void btOverlappingPairCache::removeOverlappingPair(btBroadphasePair& findPair)
{
int findIndex = m_overlappingPairArray.findLinearSearch(findPair);
if (findIndex < m_overlappingPairArray.size())
{
gOverlappingPairs--;
btBroadphasePair& pair = m_overlappingPairArray[findIndex];
cleanOverlappingPair(pair);
m_overlappingPairArray.swap(findIndex,m_overlappingPairArray.size()-1);
m_overlappingPairArray.pop_back();
}
}
void btOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair)
void btHashedOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher)
{
if (pair.m_algorithm)
{
{
delete pair.m_algorithm;;
pair.m_algorithm->~btCollisionAlgorithm();
dispatcher->freeCollisionAlgorithm(pair.m_algorithm);
pair.m_algorithm=0;
}
}
@@ -67,60 +65,20 @@ void btOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair)
void btOverlappingPairCache::addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
//don't add overlap with own
assert(proxy0 != proxy1);
if (!needsBroadphaseCollision(proxy0,proxy1))
return;
btBroadphasePair pair(*proxy0,*proxy1);
m_overlappingPairArray.push_back(pair);
gOverlappingPairs++;
}
///this findPair becomes really slow. Either sort the list to speedup the query, or
///use a different solution. It is mainly used for Removing overlapping pairs. Removal could be delayed.
///we could keep a linked list in each proxy, and store pair in one of the proxies (with lowest memory address)
///Also we can use a 2D bitmap, which can be useful for a future GPU implementation
btBroadphasePair* btOverlappingPairCache::findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
if (!needsBroadphaseCollision(proxy0,proxy1))
return 0;
btBroadphasePair tmpPair(*proxy0,*proxy1);
int findIndex = m_overlappingPairArray.findLinearSearch(tmpPair);
if (findIndex < m_overlappingPairArray.size())
{
//assert(it != m_overlappingPairSet.end());
btBroadphasePair* pair = &m_overlappingPairArray[findIndex];
return pair;
}
return 0;
}
void btOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy)
void btHashedOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
{
class CleanPairCallback : public btOverlapCallback
{
btBroadphaseProxy* m_cleanProxy;
btOverlappingPairCache* m_pairCache;
btDispatcher* m_dispatcher;
public:
CleanPairCallback(btBroadphaseProxy* cleanProxy,btOverlappingPairCache* pairCache)
CleanPairCallback(btBroadphaseProxy* cleanProxy,btOverlappingPairCache* pairCache,btDispatcher* dispatcher)
:m_cleanProxy(cleanProxy),
m_pairCache(pairCache)
m_pairCache(pairCache),
m_dispatcher(dispatcher)
{
}
virtual bool processOverlap(btBroadphasePair& pair)
@@ -128,22 +86,23 @@ void btOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy)
if ((pair.m_pProxy0 == m_cleanProxy) ||
(pair.m_pProxy1 == m_cleanProxy))
{
m_pairCache->cleanOverlappingPair(pair);
m_pairCache->cleanOverlappingPair(pair,m_dispatcher);
}
return false;
}
};
CleanPairCallback cleanPairs(proxy,this);
CleanPairCallback cleanPairs(proxy,this,dispatcher);
processAllOverlappingPairs(&cleanPairs);
processAllOverlappingPairs(&cleanPairs,dispatcher);
}
void btOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy)
void btHashedOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
{
class RemovePairCallback : public btOverlapCallback
@@ -166,12 +125,346 @@ void btOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseP
RemovePairCallback removeCallback(proxy);
processAllOverlappingPairs(&removeCallback);
processAllOverlappingPairs(&removeCallback,dispatcher);
}
void btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback)
btBroadphasePair* btHashedOverlappingPairCache::findPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
{
gFindPairs++;
if(proxy0>proxy1) btSwap(proxy0,proxy1);
int proxyId1 = proxy0->getUid();
int proxyId2 = proxy1->getUid();
/*if (proxyId1 > proxyId2)
btSwap(proxyId1, proxyId2);*/
int hash = static_cast<int>(getHash(static_cast<unsigned int>(proxyId1), static_cast<unsigned int>(proxyId2)) & (m_overlappingPairArray.capacity()-1));
if (hash >= m_hashTable.size())
{
return NULL;
}
int index = m_hashTable[hash];
while (index != BT_NULL_PAIR && equalsPair(m_overlappingPairArray[index], proxyId1, proxyId2) == false)
{
index = m_next[index];
}
if (index == BT_NULL_PAIR)
{
return NULL;
}
btAssert(index < m_overlappingPairArray.size());
return &m_overlappingPairArray[index];
}
//#include <stdio.h>
void btHashedOverlappingPairCache::growTables()
{
int newCapacity = m_overlappingPairArray.capacity();
if (m_hashTable.size() < newCapacity)
{
//grow hashtable and next table
int curHashtableSize = m_hashTable.size();
m_hashTable.resize(newCapacity);
m_next.resize(newCapacity);
int i;
for (i= 0; i < newCapacity; ++i)
{
m_hashTable[i] = BT_NULL_PAIR;
}
for (i = 0; i < newCapacity; ++i)
{
m_next[i] = BT_NULL_PAIR;
}
for(i=0;i<curHashtableSize;i++)
{
const btBroadphasePair& pair = m_overlappingPairArray[i];
int proxyId1 = pair.m_pProxy0->getUid();
int proxyId2 = pair.m_pProxy1->getUid();
/*if (proxyId1 > proxyId2)
btSwap(proxyId1, proxyId2);*/
int hashValue = static_cast<int>(getHash(static_cast<unsigned int>(proxyId1),static_cast<unsigned int>(proxyId2)) & (m_overlappingPairArray.capacity()-1)); // New hash value with new mask
m_next[i] = m_hashTable[hashValue];
m_hashTable[hashValue] = i;
}
}
}
btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
{
if(proxy0>proxy1) btSwap(proxy0,proxy1);
int proxyId1 = proxy0->getUid();
int proxyId2 = proxy1->getUid();
/*if (proxyId1 > proxyId2)
btSwap(proxyId1, proxyId2);*/
int hash = static_cast<int>(getHash(static_cast<unsigned int>(proxyId1),static_cast<unsigned int>(proxyId2)) & (m_overlappingPairArray.capacity()-1)); // New hash value with new mask
btBroadphasePair* pair = internalFindPair(proxy0, proxy1, hash);
if (pair != NULL)
{
return pair;
}
/*for(int i=0;i<m_overlappingPairArray.size();++i)
{
if( (m_overlappingPairArray[i].m_pProxy0==proxy0)&&
(m_overlappingPairArray[i].m_pProxy1==proxy1))
{
printf("Adding duplicated %u<>%u\r\n",proxyId1,proxyId2);
internalFindPair(proxy0, proxy1, hash);
}
}*/
int count = m_overlappingPairArray.size();
int oldCapacity = m_overlappingPairArray.capacity();
void* mem = &m_overlappingPairArray.expand();
int newCapacity = m_overlappingPairArray.capacity();
if (oldCapacity < newCapacity)
{
growTables();
//hash with new capacity
hash = static_cast<int>(getHash(static_cast<unsigned int>(proxyId1),static_cast<unsigned int>(proxyId2)) & (m_overlappingPairArray.capacity()-1));
}
pair = new (mem) btBroadphasePair(*proxy0,*proxy1);
// pair->m_pProxy0 = proxy0;
// pair->m_pProxy1 = proxy1;
pair->m_algorithm = 0;
pair->m_userInfo = 0;
m_next[count] = m_hashTable[hash];
m_hashTable[hash] = count;
return pair;
}
void* btHashedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1,btDispatcher* dispatcher)
{
gRemovePairs++;
if(proxy0>proxy1) btSwap(proxy0,proxy1);
int proxyId1 = proxy0->getUid();
int proxyId2 = proxy1->getUid();
/*if (proxyId1 > proxyId2)
btSwap(proxyId1, proxyId2);*/
int hash = static_cast<int>(getHash(static_cast<unsigned int>(proxyId1),static_cast<unsigned int>(proxyId2)) & (m_overlappingPairArray.capacity()-1));
btBroadphasePair* pair = internalFindPair(proxy0, proxy1, hash);
if (pair == NULL)
{
return 0;
}
cleanOverlappingPair(*pair,dispatcher);
void* userData = pair->m_userInfo;
btAssert(pair->m_pProxy0->getUid() == proxyId1);
btAssert(pair->m_pProxy1->getUid() == proxyId2);
int pairIndex = int(pair - &m_overlappingPairArray[0]);
btAssert(pairIndex < m_overlappingPairArray.size());
// Remove the pair from the hash table.
int index = m_hashTable[hash];
btAssert(index != BT_NULL_PAIR);
int previous = BT_NULL_PAIR;
while (index != pairIndex)
{
previous = index;
index = m_next[index];
}
if (previous != BT_NULL_PAIR)
{
btAssert(m_next[previous] == pairIndex);
m_next[previous] = m_next[pairIndex];
}
else
{
m_hashTable[hash] = m_next[pairIndex];
}
// We now move the last pair into spot of the
// pair being removed. We need to fix the hash
// table indices to support the move.
int lastPairIndex = m_overlappingPairArray.size() - 1;
// If the removed pair is the last pair, we are done.
if (lastPairIndex == pairIndex)
{
m_overlappingPairArray.pop_back();
return userData;
}
// Remove the last pair from the hash table.
const btBroadphasePair* last = &m_overlappingPairArray[lastPairIndex];
/* missing swap here too, Nat. */
int lastHash = static_cast<int>(getHash(static_cast<unsigned int>(last->m_pProxy0->getUid()), static_cast<unsigned int>(last->m_pProxy1->getUid())) & (m_overlappingPairArray.capacity()-1));
index = m_hashTable[lastHash];
btAssert(index != BT_NULL_PAIR);
previous = BT_NULL_PAIR;
while (index != lastPairIndex)
{
previous = index;
index = m_next[index];
}
if (previous != BT_NULL_PAIR)
{
btAssert(m_next[previous] == lastPairIndex);
m_next[previous] = m_next[lastPairIndex];
}
else
{
m_hashTable[lastHash] = m_next[lastPairIndex];
}
// Copy the last pair into the remove pair's spot.
m_overlappingPairArray[pairIndex] = m_overlappingPairArray[lastPairIndex];
// Insert the last pair into the hash table
m_next[pairIndex] = m_hashTable[lastHash];
m_hashTable[lastHash] = pairIndex;
m_overlappingPairArray.pop_back();
return userData;
}
//#include <stdio.h>
void btHashedOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback,btDispatcher* dispatcher)
{
int i;
// printf("m_overlappingPairArray.size()=%d\n",m_overlappingPairArray.size());
for (i=0;i<m_overlappingPairArray.size();)
{
btBroadphasePair* pair = &m_overlappingPairArray[i];
if (callback->processOverlap(*pair))
{
removeOverlappingPair(pair->m_pProxy0,pair->m_pProxy1,dispatcher);
gOverlappingPairs--;
} else
{
i++;
}
}
}
void* btSortedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1, btDispatcher* dispatcher )
{
if (!hasDeferredRemoval())
{
btBroadphasePair findPair(*proxy0,*proxy1);
int findIndex = m_overlappingPairArray.findLinearSearch(findPair);
if (findIndex < m_overlappingPairArray.size())
{
gOverlappingPairs--;
btBroadphasePair& pair = m_overlappingPairArray[findIndex];
void* userData = pair.m_userInfo;
cleanOverlappingPair(pair,dispatcher);
m_overlappingPairArray.swap(findIndex,m_overlappingPairArray.capacity()-1);
m_overlappingPairArray.pop_back();
return userData;
}
}
return 0;
}
btBroadphasePair* btSortedOverlappingPairCache::addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
//don't add overlap with own
assert(proxy0 != proxy1);
if (!needsBroadphaseCollision(proxy0,proxy1))
return 0;
void* mem = &m_overlappingPairArray.expand();
btBroadphasePair* pair = new (mem) btBroadphasePair(*proxy0,*proxy1);
gOverlappingPairs++;
gAddedPairs++;
return pair;
}
///this findPair becomes really slow. Either sort the list to speedup the query, or
///use a different solution. It is mainly used for Removing overlapping pairs. Removal could be delayed.
///we could keep a linked list in each proxy, and store pair in one of the proxies (with lowest memory address)
///Also we can use a 2D bitmap, which can be useful for a future GPU implementation
btBroadphasePair* btSortedOverlappingPairCache::findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
if (!needsBroadphaseCollision(proxy0,proxy1))
return 0;
btBroadphasePair tmpPair(*proxy0,*proxy1);
int findIndex = m_overlappingPairArray.findLinearSearch(tmpPair);
if (findIndex < m_overlappingPairArray.size())
{
//assert(it != m_overlappingPairSet.end());
btBroadphasePair* pair = &m_overlappingPairArray[findIndex];
return pair;
}
return 0;
}
//#include <stdio.h>
void btSortedOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback,btDispatcher* dispatcher)
{
int i;
@@ -182,9 +475,9 @@ void btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callb
btBroadphasePair* pair = &m_overlappingPairArray[i];
if (callback->processOverlap(*pair))
{
cleanOverlappingPair(*pair);
cleanOverlappingPair(*pair,dispatcher);
m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
m_overlappingPairArray.swap(i,m_overlappingPairArray.capacity()-1);
m_overlappingPairArray.pop_back();
gOverlappingPairs--;
} else
@@ -194,3 +487,93 @@ void btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callb
}
}
btSortedOverlappingPairCache::btSortedOverlappingPairCache():
m_blockedForChanges(false),
m_hasDeferredRemoval(true),
m_overlapFilterCallback(0)
{
int initialAllocatedSize= 2;
m_overlappingPairArray.reserve(initialAllocatedSize);
}
btSortedOverlappingPairCache::~btSortedOverlappingPairCache()
{
//todo/test: show we erase/delete data, or is it automatic
}
void btSortedOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher)
{
if (pair.m_algorithm)
{
{
pair.m_algorithm->~btCollisionAlgorithm();
dispatcher->freeCollisionAlgorithm(pair.m_algorithm);
pair.m_algorithm=0;
gRemovePairs--;
}
}
}
void btSortedOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
{
class CleanPairCallback : public btOverlapCallback
{
btBroadphaseProxy* m_cleanProxy;
btOverlappingPairCache* m_pairCache;
btDispatcher* m_dispatcher;
public:
CleanPairCallback(btBroadphaseProxy* cleanProxy,btOverlappingPairCache* pairCache,btDispatcher* dispatcher)
:m_cleanProxy(cleanProxy),
m_pairCache(pairCache),
m_dispatcher(dispatcher)
{
}
virtual bool processOverlap(btBroadphasePair& pair)
{
if ((pair.m_pProxy0 == m_cleanProxy) ||
(pair.m_pProxy1 == m_cleanProxy))
{
m_pairCache->cleanOverlappingPair(pair,m_dispatcher);
}
return false;
}
};
CleanPairCallback cleanPairs(proxy,this,dispatcher);
processAllOverlappingPairs(&cleanPairs,dispatcher);
}
void btSortedOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
{
class RemovePairCallback : public btOverlapCallback
{
btBroadphaseProxy* m_obsoleteProxy;
public:
RemovePairCallback(btBroadphaseProxy* obsoleteProxy)
:m_obsoleteProxy(obsoleteProxy)
{
}
virtual bool processOverlap(btBroadphasePair& pair)
{
return ((pair.m_pProxy0 == m_obsoleteProxy) ||
(pair.m_pProxy1 == m_obsoleteProxy));
}
};
RemovePairCallback removeCallback(proxy);
processAllOverlappingPairs(&removeCallback,dispatcher);
}

View File

@@ -1,4 +1,3 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
@@ -20,9 +19,13 @@ subject to the following restrictions:
#include "btBroadphaseInterface.h"
#include "btBroadphaseProxy.h"
#include "../../LinearMath/btPoint3.h"
#include "../../LinearMath/btAlignedObjectArray.h"
#include "btOverlappingPairCallback.h"
#include "LinearMath/btPoint3.h"
#include "LinearMath/btAlignedObjectArray.h"
class btDispatcher;
typedef btAlignedObjectArray<btBroadphasePair> btBroadphasePairArray;
struct btOverlapCallback
{
@@ -30,6 +33,7 @@ struct btOverlapCallback
{}
//return true for deletion of the pair
virtual bool processOverlap(btBroadphasePair& pair) = 0;
};
struct btOverlapFilterCallback
@@ -40,38 +44,261 @@ struct btOverlapFilterCallback
virtual bool needBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const = 0;
};
///btOverlappingPairCache maintains the objects with overlapping AABB
extern int gRemovePairs;
extern int gAddedPairs;
extern int gFindPairs;
const int BT_NULL_PAIR=0xffffffff;
///The btOverlappingPairCache provides an interface for overlapping pair management (add, remove, storage), used by the btBroadphaseInterface broadphases.
///The btHashedOverlappingPairCache and btSortedOverlappingPairCache classes are two implementations.
class btOverlappingPairCache : public btOverlappingPairCallback
{
public:
virtual ~btOverlappingPairCache() {} // this is needed so we can get to the derived class destructor
virtual btBroadphasePair* getOverlappingPairArrayPtr() = 0;
virtual const btBroadphasePair* getOverlappingPairArrayPtr() const = 0;
virtual btBroadphasePairArray& getOverlappingPairArray() = 0;
virtual void cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher) = 0;
virtual int getNumOverlappingPairs() const = 0;
virtual void cleanProxyFromPairs(btBroadphaseProxy* proxy,btDispatcher* dispatcher) = 0;
virtual void setOverlapFilterCallback(btOverlapFilterCallback* callback) = 0;
virtual void processAllOverlappingPairs(btOverlapCallback*,btDispatcher* dispatcher) = 0;
virtual btBroadphasePair* findPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1) = 0;
virtual bool hasDeferredRemoval() = 0;
};
/// Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.box2d.org, and Pierre Terdiman, Codercorner, http://codercorner.com
class btHashedOverlappingPairCache : public btOverlappingPairCache
{
btBroadphasePairArray m_overlappingPairArray;
btOverlapFilterCallback* m_overlapFilterCallback;
bool m_blockedForChanges;
public:
btHashedOverlappingPairCache();
virtual ~btHashedOverlappingPairCache();
void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
virtual void* removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,btDispatcher* dispatcher);
SIMD_FORCE_INLINE bool needsBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const
{
if (m_overlapFilterCallback)
return m_overlapFilterCallback->needBroadphaseCollision(proxy0,proxy1);
bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0;
collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask);
return collides;
}
// Add a pair and return the new pair. If the pair already exists,
// no new pair is created and the old one is returned.
virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
gAddedPairs++;
if (!needsBroadphaseCollision(proxy0,proxy1))
return 0;
return internalAddPair(proxy0,proxy1);
}
void cleanProxyFromPairs(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
virtual void processAllOverlappingPairs(btOverlapCallback*,btDispatcher* dispatcher);
virtual btBroadphasePair* getOverlappingPairArrayPtr()
{
return &m_overlappingPairArray[0];
}
const btBroadphasePair* getOverlappingPairArrayPtr() const
{
return &m_overlappingPairArray[0];
}
btBroadphasePairArray& getOverlappingPairArray()
{
return m_overlappingPairArray;
}
const btBroadphasePairArray& getOverlappingPairArray() const
{
return m_overlappingPairArray;
}
void cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher);
btBroadphasePair* findPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1);
int GetCount() const { return m_overlappingPairArray.size(); }
// btBroadphasePair* GetPairs() { return m_pairs; }
btOverlapFilterCallback* getOverlapFilterCallback()
{
return m_overlapFilterCallback;
}
void setOverlapFilterCallback(btOverlapFilterCallback* callback)
{
m_overlapFilterCallback = callback;
}
int getNumOverlappingPairs() const
{
return m_overlappingPairArray.size();
}
private:
btBroadphasePair* internalAddPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
void growTables();
SIMD_FORCE_INLINE bool equalsPair(const btBroadphasePair& pair, int proxyId1, int proxyId2)
{
return pair.m_pProxy0->getUid() == proxyId1 && pair.m_pProxy1->getUid() == proxyId2;
}
/*
// Thomas Wang's hash, see: http://www.concentric.net/~Ttwang/tech/inthash.htm
// This assumes proxyId1 and proxyId2 are 16-bit.
SIMD_FORCE_INLINE int getHash(int proxyId1, int proxyId2)
{
int key = (proxyId2 << 16) | proxyId1;
key = ~key + (key << 15);
key = key ^ (key >> 12);
key = key + (key << 2);
key = key ^ (key >> 4);
key = key * 2057;
key = key ^ (key >> 16);
return key;
}
*/
SIMD_FORCE_INLINE unsigned int getHash(unsigned int proxyId1, unsigned int proxyId2)
{
int key = static_cast<int>(((unsigned int)proxyId1) | (((unsigned int)proxyId2) <<16));
// Thomas Wang's hash
key += ~(key << 15);
key ^= (key >> 10);
key += (key << 3);
key ^= (key >> 6);
key += ~(key << 11);
key ^= (key >> 16);
return static_cast<unsigned int>(key);
}
SIMD_FORCE_INLINE btBroadphasePair* internalFindPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1, int hash)
{
int proxyId1 = proxy0->getUid();
int proxyId2 = proxy1->getUid();
#if 0 // wrong, 'equalsPair' use unsorted uids, copy-past devil striked again. Nat.
if (proxyId1 > proxyId2)
btSwap(proxyId1, proxyId2);
#endif
int index = m_hashTable[hash];
while( index != BT_NULL_PAIR && equalsPair(m_overlappingPairArray[index], proxyId1, proxyId2) == false)
{
index = m_next[index];
}
if ( index == BT_NULL_PAIR )
{
return NULL;
}
btAssert(index < m_overlappingPairArray.size());
return &m_overlappingPairArray[index];
}
virtual bool hasDeferredRemoval()
{
return false;
}
public:
btAlignedObjectArray<int> m_hashTable;
btAlignedObjectArray<int> m_next;
};
///btSortedOverlappingPairCache maintains the objects with overlapping AABB
///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase
class btOverlappingPairCache : public btBroadphaseInterface
class btSortedOverlappingPairCache : public btOverlappingPairCache
{
protected:
//avoid brute-force finding all the time
btAlignedObjectArray<btBroadphasePair> m_overlappingPairArray;
btBroadphasePairArray m_overlappingPairArray;
//during the dispatch, check that user doesn't destroy/create proxy
bool m_blockedForChanges;
///by default, do the removal during the pair traversal
bool m_hasDeferredRemoval;
//if set, use the callback instead of the built in filter in needBroadphaseCollision
btOverlapFilterCallback* m_overlapFilterCallback;
public:
btOverlappingPairCache();
virtual ~btOverlappingPairCache();
btSortedOverlappingPairCache();
virtual ~btSortedOverlappingPairCache();
virtual void processAllOverlappingPairs(btOverlapCallback*);
virtual void processAllOverlappingPairs(btOverlapCallback*,btDispatcher* dispatcher);
void removeOverlappingPair(btBroadphasePair& pair);
void* removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,btDispatcher* dispatcher);
void cleanOverlappingPair(btBroadphasePair& pair);
void cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher);
void addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
btBroadphasePair* findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
void cleanProxyFromPairs(btBroadphaseProxy* proxy);
void cleanProxyFromPairs(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy);
void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
inline bool needsBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const
@@ -84,10 +311,19 @@ class btOverlappingPairCache : public btBroadphaseInterface
return collides;
}
btBroadphasePairArray& getOverlappingPairArray()
{
return m_overlappingPairArray;
}
const btBroadphasePairArray& getOverlappingPairArray() const
{
return m_overlappingPairArray;
}
virtual void refreshOverlappingPairs() =0;
btBroadphasePair* getOverlappingPairArrayPtr()
{
@@ -114,7 +350,88 @@ class btOverlappingPairCache : public btBroadphaseInterface
m_overlapFilterCallback = callback;
}
virtual bool hasDeferredRemoval()
{
return m_hasDeferredRemoval;
}
};
///btNullPairCache skips add/removal of overlapping pairs. Userful for benchmarking and testing.
class btNullPairCache : public btOverlappingPairCache
{
btBroadphasePairArray m_overlappingPairArray;
public:
virtual btBroadphasePair* getOverlappingPairArrayPtr()
{
return &m_overlappingPairArray[0];
}
const btBroadphasePair* getOverlappingPairArrayPtr() const
{
return &m_overlappingPairArray[0];
}
btBroadphasePairArray& getOverlappingPairArray()
{
return m_overlappingPairArray;
}
virtual void cleanOverlappingPair(btBroadphasePair& /*pair*/,btDispatcher* /*dispatcher*/)
{
}
virtual int getNumOverlappingPairs() const
{
return 0;
}
virtual void cleanProxyFromPairs(btBroadphaseProxy* /*proxy*/,btDispatcher* /*dispatcher*/)
{
}
virtual void setOverlapFilterCallback(btOverlapFilterCallback* /*callback*/)
{
}
virtual void processAllOverlappingPairs(btOverlapCallback*,btDispatcher* /*dispatcher*/)
{
}
virtual btBroadphasePair* findPair(btBroadphaseProxy* /*proxy0*/, btBroadphaseProxy* /*proxy1*/)
{
return 0;
}
virtual bool hasDeferredRemoval()
{
return true;
}
virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* /*proxy0*/,btBroadphaseProxy* /*proxy1*/)
{
return 0;
}
virtual void* removeOverlappingPair(btBroadphaseProxy* /*proxy0*/,btBroadphaseProxy* /*proxy1*/,btDispatcher* /*dispatcher*/)
{
return 0;
}
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy* /*proxy0*/,btDispatcher* /*dispatcher*/)
{
}
};
#endif //OVERLAPPING_PAIR_CACHE_H

View File

@@ -0,0 +1,40 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef OVERLAPPING_PAIR_CALLBACK_H
#define OVERLAPPING_PAIR_CALLBACK_H
class btDispatcher;
struct btBroadphasePair;
///The btOverlappingPairCallback class is an additional optional broadphase user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache.
class btOverlappingPairCallback
{
public:
virtual ~btOverlappingPairCallback()
{
}
virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) = 0;
virtual void* removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,btDispatcher* dispatcher) = 0;
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy0,btDispatcher* dispatcher) = 0;
};
#endif //OVERLAPPING_PAIR_CALLBACK_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,486 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef QUANTIZED_BVH_H
#define QUANTIZED_BVH_H
//#define DEBUG_CHECK_DEQUANTIZATION 1
#ifdef DEBUG_CHECK_DEQUANTIZATION
#ifdef __SPU__
#define printf spu_printf
#endif //__SPU__
#include <stdio.h>
#include <stdlib.h>
#endif //DEBUG_CHECK_DEQUANTIZATION
#include "LinearMath/btVector3.h"
#include "LinearMath/btAlignedAllocator.h"
//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/vclrf__m128.asp
//Note: currently we have 16 bytes per quantized node
#define MAX_SUBTREE_SIZE_IN_BYTES 2048
// 10 gives the potential for 1024 parts, with at most 2^21 (2097152) (minus one
// actually) triangles each (since the sign bit is reserved
#define MAX_NUM_PARTS_IN_BITS 10
///btQuantizedBvhNode is a compressed aabb node, 16 bytes.
///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range).
ATTRIBUTE_ALIGNED16 (struct) btQuantizedBvhNode
{
BT_DECLARE_ALIGNED_ALLOCATOR();
//12 bytes
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
//4 bytes
int m_escapeIndexOrTriangleIndex;
bool isLeafNode() const
{
//skipindex is negative (internal node), triangleindex >=0 (leafnode)
return (m_escapeIndexOrTriangleIndex >= 0);
}
int getEscapeIndex() const
{
btAssert(!isLeafNode());
return -m_escapeIndexOrTriangleIndex;
}
int getTriangleIndex() const
{
btAssert(isLeafNode());
// Get only the lower bits where the triangle index is stored
return (m_escapeIndexOrTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS)));
}
int getPartId() const
{
btAssert(isLeafNode());
// Get only the highest bits where the part index is stored
return (m_escapeIndexOrTriangleIndex>>(31-MAX_NUM_PARTS_IN_BITS));
}
}
;
/// btOptimizedBvhNode contains both internal and leaf node information.
/// Total node size is 44 bytes / node. You can use the compressed version of 16 bytes.
ATTRIBUTE_ALIGNED16 (struct) btOptimizedBvhNode
{
BT_DECLARE_ALIGNED_ALLOCATOR();
//32 bytes
btVector3 m_aabbMinOrg;
btVector3 m_aabbMaxOrg;
//4
int m_escapeIndex;
//8
//for child nodes
int m_subPart;
int m_triangleIndex;
int m_padding[5];//bad, due to alignment
};
///btBvhSubtreeInfo provides info to gather a subtree of limited size
ATTRIBUTE_ALIGNED16(class) btBvhSubtreeInfo
{
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
//12 bytes
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
//4 bytes, points to the root of the subtree
int m_rootNodeIndex;
//4 bytes
int m_subtreeSize;
int m_padding[3];
btBvhSubtreeInfo()
{
//memset(&m_padding[0], 0, sizeof(m_padding));
}
void setAabbFromQuantizeNode(const btQuantizedBvhNode& quantizedNode)
{
m_quantizedAabbMin[0] = quantizedNode.m_quantizedAabbMin[0];
m_quantizedAabbMin[1] = quantizedNode.m_quantizedAabbMin[1];
m_quantizedAabbMin[2] = quantizedNode.m_quantizedAabbMin[2];
m_quantizedAabbMax[0] = quantizedNode.m_quantizedAabbMax[0];
m_quantizedAabbMax[1] = quantizedNode.m_quantizedAabbMax[1];
m_quantizedAabbMax[2] = quantizedNode.m_quantizedAabbMax[2];
}
}
;
class btNodeOverlapCallback
{
public:
virtual ~btNodeOverlapCallback() {};
virtual void processNode(int subPart, int triangleIndex) = 0;
};
#include "LinearMath/btAlignedAllocator.h"
#include "LinearMath/btAlignedObjectArray.h"
///for code readability:
typedef btAlignedObjectArray<btOptimizedBvhNode> NodeArray;
typedef btAlignedObjectArray<btQuantizedBvhNode> QuantizedNodeArray;
typedef btAlignedObjectArray<btBvhSubtreeInfo> BvhSubtreeInfoArray;
///The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU.
///It is used by the btBvhTriangleMeshShape as midphase, and by the btMultiSapBroadphase.
///It is recommended to use quantization for better performance and lower memory requirements.
ATTRIBUTE_ALIGNED16(class) btQuantizedBvh
{
protected:
NodeArray m_leafNodes;
NodeArray m_contiguousNodes;
QuantizedNodeArray m_quantizedLeafNodes;
QuantizedNodeArray m_quantizedContiguousNodes;
int m_curNodeIndex;
//quantization data
bool m_useQuantization;
btVector3 m_bvhAabbMin;
btVector3 m_bvhAabbMax;
btVector3 m_bvhQuantization;
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
enum btTraversalMode
{
TRAVERSAL_STACKLESS = 0,
TRAVERSAL_STACKLESS_CACHE_FRIENDLY,
TRAVERSAL_RECURSIVE
};
protected:
btTraversalMode m_traversalMode;
BvhSubtreeInfoArray m_SubtreeHeaders;
//This is only used for serialization so we don't have to add serialization directly to btAlignedObjectArray
int m_subtreeHeaderCount;
///two versions, one for quantized and normal nodes. This allows code-reuse while maintaining readability (no template/macro!)
///this might be refactored into a virtual, it is usually not calculated at run-time
void setInternalNodeAabbMin(int nodeIndex, const btVector3& aabbMin)
{
if (m_useQuantization)
{
quantize(&m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMin[0] ,aabbMin,0);
} else
{
m_contiguousNodes[nodeIndex].m_aabbMinOrg = aabbMin;
}
}
void setInternalNodeAabbMax(int nodeIndex,const btVector3& aabbMax)
{
if (m_useQuantization)
{
quantize(&m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMax[0],aabbMax,1);
} else
{
m_contiguousNodes[nodeIndex].m_aabbMaxOrg = aabbMax;
}
}
btVector3 getAabbMin(int nodeIndex) const
{
if (m_useQuantization)
{
return unQuantize(&m_quantizedLeafNodes[nodeIndex].m_quantizedAabbMin[0]);
}
//non-quantized
return m_leafNodes[nodeIndex].m_aabbMinOrg;
}
btVector3 getAabbMax(int nodeIndex) const
{
if (m_useQuantization)
{
return unQuantize(&m_quantizedLeafNodes[nodeIndex].m_quantizedAabbMax[0]);
}
//non-quantized
return m_leafNodes[nodeIndex].m_aabbMaxOrg;
}
void setInternalNodeEscapeIndex(int nodeIndex, int escapeIndex)
{
if (m_useQuantization)
{
m_quantizedContiguousNodes[nodeIndex].m_escapeIndexOrTriangleIndex = -escapeIndex;
}
else
{
m_contiguousNodes[nodeIndex].m_escapeIndex = escapeIndex;
}
}
void mergeInternalNodeAabb(int nodeIndex,const btVector3& newAabbMin,const btVector3& newAabbMax)
{
if (m_useQuantization)
{
unsigned short int quantizedAabbMin[3];
unsigned short int quantizedAabbMax[3];
quantize(quantizedAabbMin,newAabbMin,0);
quantize(quantizedAabbMax,newAabbMax,1);
for (int i=0;i<3;i++)
{
if (m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMin[i] > quantizedAabbMin[i])
m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMin[i] = quantizedAabbMin[i];
if (m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMax[i] < quantizedAabbMax[i])
m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMax[i] = quantizedAabbMax[i];
}
} else
{
//non-quantized
m_contiguousNodes[nodeIndex].m_aabbMinOrg.setMin(newAabbMin);
m_contiguousNodes[nodeIndex].m_aabbMaxOrg.setMax(newAabbMax);
}
}
void swapLeafNodes(int firstIndex,int secondIndex);
void assignInternalNodeFromLeafNode(int internalNode,int leafNodeIndex);
protected:
void buildTree (int startIndex,int endIndex);
int calcSplittingAxis(int startIndex,int endIndex);
int sortAndCalcSplittingIndex(int startIndex,int endIndex,int splitAxis);
void walkStacklessTree(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
void walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, int startNodeIndex,int endNodeIndex) const;
void walkStacklessQuantizedTree(btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax,int startNodeIndex,int endNodeIndex) const;
///tree traversal designed for small-memory processors like PS3 SPU
void walkStacklessQuantizedTreeCacheFriendly(btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax) const;
///use the 16-byte stackless 'skipindex' node tree to do a recursive traversal
void walkRecursiveQuantizedTreeAgainstQueryAabb(const btQuantizedBvhNode* currentNode,btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax) const;
///use the 16-byte stackless 'skipindex' node tree to do a recursive traversal
void walkRecursiveQuantizedTreeAgainstQuantizedTree(const btQuantizedBvhNode* treeNodeA,const btQuantizedBvhNode* treeNodeB,btNodeOverlapCallback* nodeCallback) const;
#define USE_BANCHLESS 1
#ifdef USE_BANCHLESS
//This block replaces the block below and uses no branches, and replaces the 8 bit return with a 32 bit return for improved performance (~3x on XBox 360)
SIMD_FORCE_INLINE unsigned testQuantizedAabbAgainstQuantizedAabb(unsigned short int* aabbMin1,unsigned short int* aabbMax1,const unsigned short int* aabbMin2,const unsigned short int* aabbMax2) const
{
return static_cast<unsigned int>(btSelect((unsigned)((aabbMin1[0] <= aabbMax2[0]) & (aabbMax1[0] >= aabbMin2[0])
& (aabbMin1[2] <= aabbMax2[2]) & (aabbMax1[2] >= aabbMin2[2])
& (aabbMin1[1] <= aabbMax2[1]) & (aabbMax1[1] >= aabbMin2[1])),
1, 0));
}
#else
SIMD_FORCE_INLINE bool testQuantizedAabbAgainstQuantizedAabb(unsigned short int* aabbMin1,unsigned short int* aabbMax1,const unsigned short int* aabbMin2,const unsigned short int* aabbMax2) const
{
bool overlap = true;
overlap = (aabbMin1[0] > aabbMax2[0] || aabbMax1[0] < aabbMin2[0]) ? false : overlap;
overlap = (aabbMin1[2] > aabbMax2[2] || aabbMax1[2] < aabbMin2[2]) ? false : overlap;
overlap = (aabbMin1[1] > aabbMax2[1] || aabbMax1[1] < aabbMin2[1]) ? false : overlap;
return overlap;
}
#endif //USE_BANCHLESS
void updateSubtreeHeaders(int leftChildNodexIndex,int rightChildNodexIndex);
public:
btQuantizedBvh();
virtual ~btQuantizedBvh();
///***************************************** expert/internal use only *************************
void setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.0));
QuantizedNodeArray& getLeafNodeArray() { return m_quantizedLeafNodes; }
///buildInternal is expert use only: assumes that setQuantizationValues and LeafNodeArray are initialized
void buildInternal();
///***************************************** expert/internal use only *************************
void reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
void reportRayOverlappingNodex (btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget) const;
void reportBoxCastOverlappingNodex(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin,const btVector3& aabbMax) const;
SIMD_FORCE_INLINE void quantize(unsigned short* out, const btVector3& point,int isMax) const
{
btAssert(m_useQuantization);
btAssert(point.getX() <= m_bvhAabbMax.getX());
btAssert(point.getY() <= m_bvhAabbMax.getY());
btAssert(point.getZ() <= m_bvhAabbMax.getZ());
btAssert(point.getX() >= m_bvhAabbMin.getX());
btAssert(point.getY() >= m_bvhAabbMin.getY());
btAssert(point.getZ() >= m_bvhAabbMin.getZ());
btVector3 v = (point - m_bvhAabbMin) * m_bvhQuantization;
///Make sure rounding is done in a way that unQuantize(quantizeWithClamp(...)) is conservative
///end-points always set the first bit, so that they are sorted properly (so that neighbouring AABBs overlap properly)
///todo: double-check this
if (isMax)
{
out[0] = (unsigned short) (((unsigned short)(v.getX()+btScalar(1.)) | 1));
out[1] = (unsigned short) (((unsigned short)(v.getY()+btScalar(1.)) | 1));
out[2] = (unsigned short) (((unsigned short)(v.getZ()+btScalar(1.)) | 1));
} else
{
out[0] = (unsigned short) (((unsigned short)(v.getX()) & 0xfffe));
out[1] = (unsigned short) (((unsigned short)(v.getY()) & 0xfffe));
out[2] = (unsigned short) (((unsigned short)(v.getZ()) & 0xfffe));
}
#ifdef DEBUG_CHECK_DEQUANTIZATION
btVector3 newPoint = unQuantize(out);
if (isMax)
{
if (newPoint.getX() < point.getX())
{
printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n",newPoint.getX()-point.getX(), newPoint.getX(),point.getX());
}
if (newPoint.getY() < point.getY())
{
printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n",newPoint.getY()-point.getY(), newPoint.getY(),point.getY());
}
if (newPoint.getZ() < point.getZ())
{
printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n",newPoint.getZ()-point.getZ(), newPoint.getZ(),point.getZ());
}
} else
{
if (newPoint.getX() > point.getX())
{
printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n",newPoint.getX()-point.getX(), newPoint.getX(),point.getX());
}
if (newPoint.getY() > point.getY())
{
printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n",newPoint.getY()-point.getY(), newPoint.getY(),point.getY());
}
if (newPoint.getZ() > point.getZ())
{
printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n",newPoint.getZ()-point.getZ(), newPoint.getZ(),point.getZ());
}
}
#endif //DEBUG_CHECK_DEQUANTIZATION
}
SIMD_FORCE_INLINE void quantizeWithClamp(unsigned short* out, const btVector3& point2,int isMax) const
{
btAssert(m_useQuantization);
btVector3 clampedPoint(point2);
clampedPoint.setMax(m_bvhAabbMin);
clampedPoint.setMin(m_bvhAabbMax);
quantize(out,clampedPoint,isMax);
}
SIMD_FORCE_INLINE btVector3 unQuantize(const unsigned short* vecIn) const
{
btVector3 vecOut;
vecOut.setValue(
(btScalar)(vecIn[0]) / (m_bvhQuantization.getX()),
(btScalar)(vecIn[1]) / (m_bvhQuantization.getY()),
(btScalar)(vecIn[2]) / (m_bvhQuantization.getZ()));
vecOut += m_bvhAabbMin;
return vecOut;
}
///setTraversalMode let's you choose between stackless, recursive or stackless cache friendly tree traversal. Note this is only implemented for quantized trees.
void setTraversalMode(btTraversalMode traversalMode)
{
m_traversalMode = traversalMode;
}
SIMD_FORCE_INLINE QuantizedNodeArray& getQuantizedNodeArray()
{
return m_quantizedContiguousNodes;
}
SIMD_FORCE_INLINE BvhSubtreeInfoArray& getSubtreeInfoArray()
{
return m_SubtreeHeaders;
}
/////Calculate space needed to store BVH for serialization
unsigned calculateSerializeBufferSize();
/// Data buffer MUST be 16 byte aligned
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian);
///deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'
static btQuantizedBvh *deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian);
static unsigned int getAlignmentSerializationPadding();
SIMD_FORCE_INLINE bool isQuantized()
{
return m_useQuantization;
}
private:
// Special "copy" constructor that allows for in-place deserialization
// Prevents btVector3's default constructor from being called, but doesn't inialize much else
// ownsMemory should most likely be false if deserializing, and if you are not, don't call this (it also changes the function signature, which we need)
btQuantizedBvh(btQuantizedBvh &other, bool ownsMemory);
}
;
#endif //QUANTIZED_BVH_H

View File

@@ -14,83 +14,84 @@ subject to the following restrictions:
*/
#include "btSimpleBroadphase.h"
#include <BulletCollision/BroadphaseCollision/btDispatcher.h>
#include <BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h>
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "LinearMath/btVector3.h"
#include "LinearMath/btTransform.h"
#include "LinearMath/btMatrix3x3.h"
#include <new>
extern int gOverlappingPairs;
void btSimpleBroadphase::validate()
{
for (int i=0;i<m_numProxies;i++)
for (int i=0;i<m_numHandles;i++)
{
for (int j=i+1;j<m_numProxies;j++)
for (int j=i+1;j<m_numHandles;j++)
{
assert(m_pProxies[i] != m_pProxies[j]);
btAssert(&m_pHandles[i] != &m_pHandles[j]);
}
}
}
btSimpleBroadphase::btSimpleBroadphase(int maxProxies)
:btOverlappingPairCache(),
m_firstFreeProxy(0),
m_numProxies(0),
m_maxProxies(maxProxies)
btSimpleBroadphase::btSimpleBroadphase(int maxProxies, btOverlappingPairCache* overlappingPairCache)
:m_pairCache(overlappingPairCache),
m_ownsPairCache(false),
m_invalidPair(0)
{
m_proxies = new btSimpleBroadphaseProxy[maxProxies];
m_freeProxies = new int[maxProxies];
m_pProxies = new btSimpleBroadphaseProxy*[maxProxies];
if (!overlappingPairCache)
{
void* mem = btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16);
m_pairCache = new (mem)btHashedOverlappingPairCache();
m_ownsPairCache = true;
}
// allocate handles buffer and put all handles on free list
m_pHandlesRawPtr = btAlignedAlloc(sizeof(btSimpleBroadphaseProxy)*maxProxies,16);
m_pHandles = new(m_pHandlesRawPtr) btSimpleBroadphaseProxy[maxProxies];
m_maxHandles = maxProxies;
m_numHandles = 0;
m_firstFreeHandle = 0;
int i;
for (i=0;i<m_maxProxies;i++)
{
m_freeProxies[i] = i;
for (int i = m_firstFreeHandle; i < maxProxies; i++)
{
m_pHandles[i].SetNextFree(i + 1);
m_pHandles[i].m_uniqueId = i+2;//any UID will do, we just avoid too trivial values (0,1) for debugging purposes
}
m_pHandles[maxProxies - 1].SetNextFree(0);
}
}
btSimpleBroadphase::~btSimpleBroadphase()
{
delete[] m_proxies;
delete []m_freeProxies;
delete [] m_pProxies;
btAlignedFree(m_pHandlesRawPtr);
/*int i;
for (i=m_numProxies-1;i>=0;i--)
if (m_ownsPairCache)
{
BP_Proxy* proxy = m_pProxies[i];
destroyProxy(proxy);
m_pairCache->~btOverlappingPairCache();
btAlignedFree(m_pairCache);
}
*/
}
btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* /*dispatcher*/,void* multiSapProxy)
{
if (m_numProxies >= m_maxProxies)
if (m_numHandles >= m_maxHandles)
{
assert(0);
btAssert(0);
return 0; //should never happen, but don't let the game crash ;-)
}
assert(min[0]<= max[0] && min[1]<= max[1] && min[2]<= max[2]);
assert(aabbMin[0]<= aabbMax[0] && aabbMin[1]<= aabbMax[1] && aabbMin[2]<= aabbMax[2]);
int freeIndex= m_freeProxies[m_firstFreeProxy];
btSimpleBroadphaseProxy* proxy = new (&m_proxies[freeIndex])btSimpleBroadphaseProxy(min,max,shapeType,userPtr,collisionFilterGroup,collisionFilterMask);
m_firstFreeProxy++;
btSimpleBroadphaseProxy* proxy1 = &m_proxies[0];
int index = int(proxy - proxy1);
btAssert(index == freeIndex);
m_pProxies[m_numProxies] = proxy;
m_numProxies++;
//validate();
int newHandleIndex = allocHandle();
btSimpleBroadphaseProxy* proxy = new (&m_pHandles[newHandleIndex])btSimpleBroadphaseProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,multiSapProxy);
return proxy;
}
@@ -124,34 +125,19 @@ protected:
};
};
void btSimpleBroadphase::destroyProxy(btBroadphaseProxy* proxyOrg)
void btSimpleBroadphase::destroyProxy(btBroadphaseProxy* proxyOrg,btDispatcher* dispatcher)
{
int i;
btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(proxyOrg);
btSimpleBroadphaseProxy* proxy1 = &m_proxies[0];
int index = int(proxy0 - proxy1);
btAssert (index < m_maxProxies);
m_freeProxies[--m_firstFreeProxy] = index;
freeHandle(proxy0);
m_pairCache->removeOverlappingPairsContainingProxy(proxyOrg,dispatcher);
removeOverlappingPairsContainingProxy(proxyOrg);
for (i=0;i<m_numProxies;i++)
{
if (m_pProxies[i] == proxyOrg)
{
m_pProxies[i] = m_pProxies[m_numProxies-1];
break;
}
}
m_numProxies--;
//validate();
}
void btSimpleBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
void btSimpleBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* /*dispatcher*/)
{
btSimpleBroadphaseProxy* sbp = getSimpleProxyFromProxy(proxy);
sbp->m_min = aabbMin;
@@ -186,37 +172,129 @@ public:
}
};
void btSimpleBroadphase::refreshOverlappingPairs()
void btSimpleBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
{
//first check for new overlapping pairs
int i,j;
for (i=0;i<m_numProxies;i++)
if (m_numHandles >= 0)
{
btBroadphaseProxy* proxy0 = m_pProxies[i];
for (j=i+1;j<m_numProxies;j++)
{
btBroadphaseProxy* proxy1 = m_pProxies[j];
btSimpleBroadphaseProxy* p0 = getSimpleProxyFromProxy(proxy0);
btSimpleBroadphaseProxy* p1 = getSimpleProxyFromProxy(proxy1);
if (aabbOverlap(p0,p1))
for (i=0;i<m_numHandles;i++)
{
btSimpleBroadphaseProxy* proxy0 = &m_pHandles[i];
for (j=i+1;j<m_numHandles;j++)
{
if ( !findPair(proxy0,proxy1))
btSimpleBroadphaseProxy* proxy1 = &m_pHandles[j];
btAssert(proxy0 != proxy1);
btSimpleBroadphaseProxy* p0 = getSimpleProxyFromProxy(proxy0);
btSimpleBroadphaseProxy* p1 = getSimpleProxyFromProxy(proxy1);
if (aabbOverlap(p0,p1))
{
addOverlappingPair(proxy0,proxy1);
if ( !m_pairCache->findPair(proxy0,proxy1))
{
m_pairCache->addOverlappingPair(proxy0,proxy1);
}
} else
{
if (!m_pairCache->hasDeferredRemoval())
{
if ( m_pairCache->findPair(proxy0,proxy1))
{
m_pairCache->removeOverlappingPair(proxy0,proxy1,dispatcher);
}
}
}
}
}
if (m_ownsPairCache && m_pairCache->hasDeferredRemoval())
{
btBroadphasePairArray& overlappingPairArray = m_pairCache->getOverlappingPairArray();
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
m_invalidPair = 0;
btBroadphasePair previousPair;
previousPair.m_pProxy0 = 0;
previousPair.m_pProxy1 = 0;
previousPair.m_algorithm = 0;
for (i=0;i<overlappingPairArray.size();i++)
{
btBroadphasePair& pair = overlappingPairArray[i];
bool isDuplicate = (pair == previousPair);
previousPair = pair;
bool needsRemoval = false;
if (!isDuplicate)
{
bool hasOverlap = testAabbOverlap(pair.m_pProxy0,pair.m_pProxy1);
if (hasOverlap)
{
needsRemoval = false;//callback->processOverlap(pair);
} else
{
needsRemoval = true;
}
} else
{
//remove duplicate
needsRemoval = true;
//should have no algorithm
btAssert(!pair.m_algorithm);
}
if (needsRemoval)
{
m_pairCache->cleanOverlappingPair(pair,dispatcher);
// m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
// m_overlappingPairArray.pop_back();
pair.m_pProxy0 = 0;
pair.m_pProxy1 = 0;
m_invalidPair++;
gOverlappingPairs--;
}
}
///if you don't like to skip the invalid pairs in the array, execute following code:
#define CLEAN_INVALID_PAIRS 1
#ifdef CLEAN_INVALID_PAIRS
//perform a sort, to sort 'invalid' pairs to the end
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
m_invalidPair = 0;
#endif//CLEAN_INVALID_PAIRS
}
}
CheckOverlapCallback checkOverlap;
processAllOverlappingPairs(&checkOverlap);
}
bool btSimpleBroadphase::testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
btSimpleBroadphaseProxy* p0 = getSimpleProxyFromProxy(proxy0);
btSimpleBroadphaseProxy* p1 = getSimpleProxyFromProxy(proxy1);
return aabbOverlap(p0,p1);
}

View File

@@ -24,35 +24,69 @@ struct btSimpleBroadphaseProxy : public btBroadphaseProxy
{
btVector3 m_min;
btVector3 m_max;
int m_nextFree;
// int m_handleId;
btSimpleBroadphaseProxy() {};
btSimpleBroadphaseProxy(const btPoint3& minpt,const btPoint3& maxpt,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask)
:btBroadphaseProxy(userPtr,collisionFilterGroup,collisionFilterMask),
btSimpleBroadphaseProxy(const btPoint3& minpt,const btPoint3& maxpt,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,void* multiSapProxy)
:btBroadphaseProxy(userPtr,collisionFilterGroup,collisionFilterMask,multiSapProxy),
m_min(minpt),m_max(maxpt)
{
(void)shapeType;
}
SIMD_FORCE_INLINE void SetNextFree(int next) {m_nextFree = next;}
SIMD_FORCE_INLINE int GetNextFree() const {return m_nextFree;}
};
///SimpleBroadphase is a brute force aabb culling broadphase based on O(n^2) aabb checks
class btSimpleBroadphase : public btOverlappingPairCache
///The SimpleBroadphase is just a unit-test for btAxisSweep3, bt32BitAxisSweep3, or btDbvtBroadphase, so use those classes instead.
///It is a brute force aabb culling broadphase based on O(n^2) aabb checks
class btSimpleBroadphase : public btBroadphaseInterface
{
protected:
btSimpleBroadphaseProxy* m_proxies;
int* m_freeProxies;
int m_firstFreeProxy;
btSimpleBroadphaseProxy** m_pProxies;
int m_numProxies;
int m_numHandles; // number of active handles
int m_maxHandles; // max number of handles
btSimpleBroadphaseProxy* m_pHandles; // handles pool
void* m_pHandlesRawPtr;
int m_firstFreeHandle; // free handles list
int allocHandle()
{
btAssert(m_numHandles < m_maxHandles);
int freeHandle = m_firstFreeHandle;
m_firstFreeHandle = m_pHandles[freeHandle].GetNextFree();
m_numHandles++;
return freeHandle;
}
void freeHandle(btSimpleBroadphaseProxy* proxy)
{
int handle = int(proxy-m_pHandles);
btAssert(handle >= 0 && handle < m_maxHandles);
proxy->SetNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle;
m_numHandles--;
}
btOverlappingPairCache* m_pairCache;
bool m_ownsPairCache;
int m_invalidPair;
int m_maxProxies;
inline btSimpleBroadphaseProxy* getSimpleProxyFromProxy(btBroadphaseProxy* proxy)
@@ -67,26 +101,48 @@ protected:
protected:
virtual void refreshOverlappingPairs();
public:
btSimpleBroadphase(int maxProxies=16384);
btSimpleBroadphase(int maxProxies=16384,btOverlappingPairCache* overlappingPairCache=0);
virtual ~btSimpleBroadphase();
static bool aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1);
virtual btBroadphaseProxy* createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy);
virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
virtual void destroyProxy(btBroadphaseProxy* proxy);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher);
btOverlappingPairCache* getOverlappingPairCache()
{
return m_pairCache;
}
const btOverlappingPairCache* getOverlappingPairCache() const
{
return m_pairCache;
}
bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
///getAabb returns the axis aligned bounding box in the 'global' coordinate frame
///will add some transform later
virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const
{
aabbMin.setValue(-1e30f,-1e30f,-1e30f);
aabbMax.setValue(1e30f,1e30f,1e30f);
}
virtual void printStats()
{
// printf("btSimpleBroadphase.h\n");
// printf("numHandles = %d, maxHandles = %d\n",m_numHandles,m_maxHandles);
}
};

View File

@@ -5,56 +5,149 @@ ${BULLET_PHYSICS_SOURCE_DIR}/src }
ADD_LIBRARY(LibBulletCollision
BroadphaseCollision/btAxisSweep3.cpp
BroadphaseCollision/btAxisSweep3.h
BroadphaseCollision/btBroadphaseProxy.cpp
BroadphaseCollision/btBroadphaseProxy.h
BroadphaseCollision/btCollisionAlgorithm.cpp
BroadphaseCollision/btCollisionAlgorithm.h
BroadphaseCollision/btDispatcher.cpp
BroadphaseCollision/btDispatcher.h
BroadphaseCollision/btDbvtBroadphase.cpp
BroadphaseCollision/btDbvtBroadphase.h
BroadphaseCollision/btDbvt.cpp
BroadphaseCollision/btDbvt.h
BroadphaseCollision/btMultiSapBroadphase.cpp
BroadphaseCollision/btMultiSapBroadphase.h
BroadphaseCollision/btOverlappingPairCache.cpp
BroadphaseCollision/btOverlappingPairCache.h
BroadphaseCollision/btOverlappingPairCallback.h
BroadphaseCollision/btQuantizedBvh.cpp
BroadphaseCollision/btQuantizedBvh.h
BroadphaseCollision/btSimpleBroadphase.cpp
BroadphaseCollision/btSimpleBroadphase.h
CollisionDispatch/btCollisionDispatcher.cpp
CollisionDispatch/btCollisionDispatcher.h
CollisionDispatch/btCollisionObject.cpp
CollisionDispatch/btCollisionObject.h
CollisionDispatch/btCollisionWorld.cpp
CollisionDispatch/btCollisionWorld.h
CollisionDispatch/btCompoundCollisionAlgorithm.cpp
CollisionDispatch/btCompoundCollisionAlgorithm.h
CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
CollisionDispatch/btConvexConcaveCollisionAlgorithm.h
CollisionDispatch/btDefaultCollisionConfiguration.cpp
CollisionDispatch/btDefaultCollisionConfiguration.h
CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp
CollisionDispatch/btSphereSphereCollisionAlgorithm.h
CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp
CollisionDispatch/btBoxBoxCollisionAlgorithm.h
CollisionDispatch/btBoxBoxDetector.cpp
CollisionDispatch/btBoxBoxDetector.h
CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp
CollisionDispatch/btSphereBoxCollisionAlgorithm.h
CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp
CollisionDispatch/btConvexPlaneCollisionAlgorithm.h
CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp
CollisionDispatch/btSphereTriangleCollisionAlgorithm.h
CollisionDispatch/btConvexConvexAlgorithm.cpp
CollisionDispatch/btConvexConvexAlgorithm.h
CollisionDispatch/btEmptyCollisionAlgorithm.cpp
CollisionDispatch/btEmptyCollisionAlgorithm.h
CollisionDispatch/btManifoldResult.cpp
CollisionDispatch/btManifoldResult.h
CollisionDispatch/btSimulationIslandManager.cpp
CollisionDispatch/btSimulationIslandManager.h
CollisionDispatch/btUnionFind.cpp
CollisionDispatch/btUnionFind.h
CollisionDispatch/SphereTriangleDetector.cpp
CollisionDispatch/SphereTriangleDetector.h
CollisionShapes/btBoxShape.cpp
CollisionShapes/btBoxShape.h
CollisionShapes/btBvhTriangleMeshShape.cpp
CollisionShapes/btBvhTriangleMeshShape.h
CollisionShapes/btCapsuleShape.cpp
CollisionShapes/btCapsuleShape.h
CollisionShapes/btCollisionShape.cpp
CollisionShapes/btCollisionShape.h
CollisionShapes/btCompoundShape.cpp
CollisionShapes/btCompoundShape.h
CollisionShapes/btConcaveShape.cpp
CollisionShapes/btConcaveShape.h
CollisionShapes/btConeShape.cpp
CollisionShapes/btConeShape.h
CollisionShapes/btConvexHullShape.cpp
CollisionShapes/btConvexHullShape.h
CollisionShapes/btConvexShape.cpp
CollisionShapes/btConvexShape.h
CollisionShapes/btConvexInternalShape.cpp
CollisionShapes/btConvexInternalShape.h
CollisionShapes/btConvexTriangleMeshShape.cpp
CollisionShapes/btConvexTriangleMeshShape.h
CollisionShapes/btCylinderShape.cpp
CollisionShapes/btCylinderShape.h
CollisionShapes/btEmptyShape.cpp
CollisionShapes/btEmptyShape.h
CollisionShapes/btHeightfieldTerrainShape.cpp
CollisionShapes/btHeightfieldTerrainShape.h
CollisionShapes/btMinkowskiSumShape.cpp
CollisionShapes/btMinkowskiSumShape.h
CollisionShapes/btMaterial.h
CollisionShapes/btMultimaterialTriangleMeshShape.cpp
CollisionShapes/btMultimaterialTriangleMeshShape.h
CollisionShapes/btMultiSphereShape.cpp
CollisionShapes/btMultiSphereShape.h
CollisionShapes/btOptimizedBvh.cpp
CollisionShapes/btOptimizedBvh.h
CollisionShapes/btPolyhedralConvexShape.cpp
CollisionShapes/btPolyhedralConvexShape.h
CollisionShapes/btScaledBvhTriangleMeshShape.cpp
CollisionShapes/btScaledBvhTriangleMeshShape.h
CollisionShapes/btTetrahedronShape.cpp
CollisionShapes/btTetrahedronShape.h
CollisionShapes/btSphereShape.cpp
CollisionShapes/btSphereShape.h
CollisionShapes/btShapeHull.h
CollisionShapes/btShapeHull.cpp
CollisionShapes/btStaticPlaneShape.cpp
CollisionShapes/btStaticPlaneShape.h
CollisionShapes/btStridingMeshInterface.cpp
CollisionShapes/btStridingMeshInterface.h
CollisionShapes/btTriangleCallback.cpp
CollisionShapes/btTriangleCallback.h
CollisionShapes/btTriangleBuffer.cpp
CollisionShapes/btTriangleBuffer.h
CollisionShapes/btTriangleIndexVertexArray.cpp
CollisionShapes/btTriangleIndexVertexArray.h
CollisionShapes/btTriangleIndexVertexMaterialArray.h
CollisionShapes/btTriangleIndexVertexMaterialArray.cpp
CollisionShapes/btTriangleMesh.cpp
CollisionShapes/btTriangleMesh.h
CollisionShapes/btTriangleMeshShape.cpp
CollisionShapes/btTriangleMeshShape.h
CollisionShapes/btUniformScalingShape.cpp
CollisionShapes/btUniformScalingShape.h
NarrowPhaseCollision/btContinuousConvexCollision.cpp
NarrowPhaseCollision/btContinuousConvexCollision.h
NarrowPhaseCollision/btGjkEpa.cpp
NarrowPhaseCollision/btGjkEpa.h
NarrowPhaseCollision/btGjkEpa2.cpp
NarrowPhaseCollision/btGjkEpa2.h
NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp
NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h
NarrowPhaseCollision/btConvexCast.cpp
NarrowPhaseCollision/btConvexCast.h
NarrowPhaseCollision/btGjkConvexCast.cpp
NarrowPhaseCollision/btGjkConvexCast.h
NarrowPhaseCollision/btGjkPairDetector.cpp
NarrowPhaseCollision/btGjkPairDetector.h
NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp
NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h
NarrowPhaseCollision/btPersistentManifold.cpp
NarrowPhaseCollision/btPersistentManifold.h
NarrowPhaseCollision/btRaycastCallback.cpp
NarrowPhaseCollision/btRaycastCallback.h
NarrowPhaseCollision/btSubSimplexConvexCast.cpp
NarrowPhaseCollision/btSubSimplexConvexCast.h
NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
NarrowPhaseCollision/btVoronoiSimplexSolver.h
)

View File

@@ -26,7 +26,7 @@ m_triangle(triangle)
}
void SphereTriangleDetector::getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw)
void SphereTriangleDetector::getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults)
{
(void)debugDraw;
@@ -42,7 +42,16 @@ void SphereTriangleDetector::getClosestPoints(const ClosestPointInput& input,Res
if (collide(sphereInTr.getOrigin(),point,normal,depth,timeOfImpact))
{
output.addContactPoint(transformB.getBasis()*normal,transformB*point,depth);
if (swapResults)
{
btVector3 normalOnB = transformB.getBasis()*normal;
btVector3 normalOnA = -normalOnB;
btVector3 pointOnA = transformB*point+normalOnB*depth;
output.addContactPoint(normalOnA,pointOnA,depth);
} else
{
output.addContactPoint(transformB.getBasis()*normal,transformB*point,depth);
}
}
}
@@ -53,6 +62,8 @@ void SphereTriangleDetector::getClosestPoints(const ClosestPointInput& input,Res
// See also geometrictools.com
// Basic idea: D = |p - (lo + t0*lv)| where t0 = lv . (p - lo) / lv . lv
btScalar SegmentSqrDistance(const btVector3& from, const btVector3& to,const btVector3 &p, btVector3 &nearest);
btScalar SegmentSqrDistance(const btVector3& from, const btVector3& to,const btVector3 &p, btVector3 &nearest) {
btVector3 diff = p - from;
btVector3 v = to - from;

View File

@@ -16,8 +16,8 @@ subject to the following restrictions:
#ifndef SPHERE_TRIANGLE_DETECTOR_H
#define SPHERE_TRIANGLE_DETECTOR_H
#include "../NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
#include "../../LinearMath/btPoint3.h"
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
#include "LinearMath/btPoint3.h"
class btSphereShape;
@@ -28,7 +28,7 @@ class btTriangleShape;
/// sphere-triangle to match the btDiscreteCollisionDetectorInterface
struct SphereTriangleDetector : public btDiscreteCollisionDetectorInterface
{
virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw);
virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false);
SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triangle);

View File

@@ -0,0 +1,85 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "btBoxBoxCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "btBoxBoxDetector.h"
#define USE_PERSISTENT_CONTACTS 1
btBoxBoxCollisionAlgorithm::btBoxBoxCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* obj0,btCollisionObject* obj1)
: btCollisionAlgorithm(ci),
m_ownManifold(false),
m_manifoldPtr(mf)
{
if (!m_manifoldPtr && m_dispatcher->needsCollision(obj0,obj1))
{
m_manifoldPtr = m_dispatcher->getNewManifold(obj0,obj1);
m_ownManifold = true;
}
}
btBoxBoxCollisionAlgorithm::~btBoxBoxCollisionAlgorithm()
{
if (m_ownManifold)
{
if (m_manifoldPtr)
m_dispatcher->releaseManifold(m_manifoldPtr);
}
}
void btBoxBoxCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
{
if (!m_manifoldPtr)
return;
btCollisionObject* col0 = body0;
btCollisionObject* col1 = body1;
btBoxShape* box0 = (btBoxShape*)col0->getCollisionShape();
btBoxShape* box1 = (btBoxShape*)col1->getCollisionShape();
/// report a contact. internally this will be kept persistent, and contact reduction is done
resultOut->setPersistentManifold(m_manifoldPtr);
#ifndef USE_PERSISTENT_CONTACTS
m_manifoldPtr->clearManifold();
#endif //USE_PERSISTENT_CONTACTS
btDiscreteCollisionDetectorInterface::ClosestPointInput input;
input.m_maximumDistanceSquared = 1e30f;
input.m_transformA = body0->getWorldTransform();
input.m_transformB = body1->getWorldTransform();
btBoxBoxDetector detector(box0,box1);
detector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
#ifdef USE_PERSISTENT_CONTACTS
// refreshContactPoints is only necessary when using persistent contact points. otherwise all points are newly added
if (m_ownManifold)
{
resultOut->refreshContactPoints();
}
#endif //USE_PERSISTENT_CONTACTS
}
btScalar btBoxBoxCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* /*body0*/,btCollisionObject* /*body1*/,const btDispatcherInfo& /*dispatchInfo*/,btManifoldResult* /*resultOut*/)
{
//not yet
return 1.f;
}

View File

@@ -0,0 +1,66 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BOX_BOX__COLLISION_ALGORITHM_H
#define BOX_BOX__COLLISION_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
class btPersistentManifold;
///box-box collision detection
class btBoxBoxCollisionAlgorithm : public btCollisionAlgorithm
{
bool m_ownManifold;
btPersistentManifold* m_manifoldPtr;
public:
btBoxBoxCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
: btCollisionAlgorithm(ci) {}
virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
btBoxBoxCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1);
virtual ~btBoxBoxCollisionAlgorithm();
virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
{
if (m_manifoldPtr && m_ownManifold)
{
manifoldArray.push_back(m_manifoldPtr);
}
}
struct CreateFunc :public btCollisionAlgorithmCreateFunc
{
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
{
int bbsize = sizeof(btBoxBoxCollisionAlgorithm);
void* ptr = ci.m_dispatcher1->allocateCollisionAlgorithm(bbsize);
return new(ptr) btBoxBoxCollisionAlgorithm(0,ci,body0,body1);
}
};
};
#endif //BOX_BOX__COLLISION_ALGORITHM_H

View File

@@ -0,0 +1,683 @@
/*
* Box-Box collision detection re-distributed under the ZLib license with permission from Russell L. Smith
* Original version is from Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.
* All rights reserved. Email: russ@q12.org Web: www.q12.org
Bullet Continuous Collision Detection and Physics Library
Bullet is Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
///ODE box-box collision detection is adapted to work with Bullet
#include "btBoxBoxDetector.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include <float.h>
#include <string.h>
btBoxBoxDetector::btBoxBoxDetector(btBoxShape* box1,btBoxShape* box2)
: m_box1(box1),
m_box2(box2)
{
}
// given two boxes (p1,R1,side1) and (p2,R2,side2), collide them together and
// generate contact points. this returns 0 if there is no contact otherwise
// it returns the number of contacts generated.
// `normal' returns the contact normal.
// `depth' returns the maximum penetration depth along that normal.
// `return_code' returns a number indicating the type of contact that was
// detected:
// 1,2,3 = box 2 intersects with a face of box 1
// 4,5,6 = box 1 intersects with a face of box 2
// 7..15 = edge-edge contact
// `maxc' is the maximum number of contacts allowed to be generated, i.e.
// the size of the `contact' array.
// `contact' and `skip' are the contact array information provided to the
// collision functions. this function only fills in the position and depth
// fields.
struct dContactGeom;
#define dDOTpq(a,b,p,q) ((a)[0]*(b)[0] + (a)[p]*(b)[q] + (a)[2*(p)]*(b)[2*(q)])
#define dInfinity FLT_MAX
/*PURE_INLINE btScalar dDOT (const btScalar *a, const btScalar *b) { return dDOTpq(a,b,1,1); }
PURE_INLINE btScalar dDOT13 (const btScalar *a, const btScalar *b) { return dDOTpq(a,b,1,3); }
PURE_INLINE btScalar dDOT31 (const btScalar *a, const btScalar *b) { return dDOTpq(a,b,3,1); }
PURE_INLINE btScalar dDOT33 (const btScalar *a, const btScalar *b) { return dDOTpq(a,b,3,3); }
*/
static btScalar dDOT (const btScalar *a, const btScalar *b) { return dDOTpq(a,b,1,1); }
static btScalar dDOT44 (const btScalar *a, const btScalar *b) { return dDOTpq(a,b,4,4); }
static btScalar dDOT41 (const btScalar *a, const btScalar *b) { return dDOTpq(a,b,4,1); }
static btScalar dDOT14 (const btScalar *a, const btScalar *b) { return dDOTpq(a,b,1,4); }
#define dMULTIPLYOP1_331(A,op,B,C) \
{\
(A)[0] op dDOT41((B),(C)); \
(A)[1] op dDOT41((B+1),(C)); \
(A)[2] op dDOT41((B+2),(C)); \
}
#define dMULTIPLYOP0_331(A,op,B,C) \
{ \
(A)[0] op dDOT((B),(C)); \
(A)[1] op dDOT((B+4),(C)); \
(A)[2] op dDOT((B+8),(C)); \
}
#define dMULTIPLY1_331(A,B,C) dMULTIPLYOP1_331(A,=,B,C)
#define dMULTIPLY0_331(A,B,C) dMULTIPLYOP0_331(A,=,B,C)
typedef btScalar dMatrix3[4*3];
void dLineClosestApproach (const btVector3& pa, const btVector3& ua,
const btVector3& pb, const btVector3& ub,
btScalar *alpha, btScalar *beta);
void dLineClosestApproach (const btVector3& pa, const btVector3& ua,
const btVector3& pb, const btVector3& ub,
btScalar *alpha, btScalar *beta)
{
btVector3 p;
p[0] = pb[0] - pa[0];
p[1] = pb[1] - pa[1];
p[2] = pb[2] - pa[2];
btScalar uaub = dDOT(ua,ub);
btScalar q1 = dDOT(ua,p);
btScalar q2 = -dDOT(ub,p);
btScalar d = 1-uaub*uaub;
if (d <= btScalar(0.0001f)) {
// @@@ this needs to be made more robust
*alpha = 0;
*beta = 0;
}
else {
d = 1.f/d;
*alpha = (q1 + uaub*q2)*d;
*beta = (uaub*q1 + q2)*d;
}
}
// find all the intersection points between the 2D rectangle with vertices
// at (+/-h[0],+/-h[1]) and the 2D quadrilateral with vertices (p[0],p[1]),
// (p[2],p[3]),(p[4],p[5]),(p[6],p[7]).
//
// the intersection points are returned as x,y pairs in the 'ret' array.
// the number of intersection points is returned by the function (this will
// be in the range 0 to 8).
static int intersectRectQuad2 (btScalar h[2], btScalar p[8], btScalar ret[16])
{
// q (and r) contain nq (and nr) coordinate points for the current (and
// chopped) polygons
int nq=4,nr=0;
btScalar buffer[16];
btScalar *q = p;
btScalar *r = ret;
for (int dir=0; dir <= 1; dir++) {
// direction notation: xy[0] = x axis, xy[1] = y axis
for (int sign=-1; sign <= 1; sign += 2) {
// chop q along the line xy[dir] = sign*h[dir]
btScalar *pq = q;
btScalar *pr = r;
nr = 0;
for (int i=nq; i > 0; i--) {
// go through all points in q and all lines between adjacent points
if (sign*pq[dir] < h[dir]) {
// this point is inside the chopping line
pr[0] = pq[0];
pr[1] = pq[1];
pr += 2;
nr++;
if (nr & 8) {
q = r;
goto done;
}
}
btScalar *nextq = (i > 1) ? pq+2 : q;
if ((sign*pq[dir] < h[dir]) ^ (sign*nextq[dir] < h[dir])) {
// this line crosses the chopping line
pr[1-dir] = pq[1-dir] + (nextq[1-dir]-pq[1-dir]) /
(nextq[dir]-pq[dir]) * (sign*h[dir]-pq[dir]);
pr[dir] = sign*h[dir];
pr += 2;
nr++;
if (nr & 8) {
q = r;
goto done;
}
}
pq += 2;
}
q = r;
r = (q==ret) ? buffer : ret;
nq = nr;
}
}
done:
if (q != ret) memcpy (ret,q,nr*2*sizeof(btScalar));
return nr;
}
#define M__PI 3.14159265f
// given n points in the plane (array p, of size 2*n), generate m points that
// best represent the whole set. the definition of 'best' here is not
// predetermined - the idea is to select points that give good box-box
// collision detection behavior. the chosen point indexes are returned in the
// array iret (of size m). 'i0' is always the first entry in the array.
// n must be in the range [1..8]. m must be in the range [1..n]. i0 must be
// in the range [0..n-1].
void cullPoints2 (int n, btScalar p[], int m, int i0, int iret[]);
void cullPoints2 (int n, btScalar p[], int m, int i0, int iret[])
{
// compute the centroid of the polygon in cx,cy
int i,j;
btScalar a,cx,cy,q;
if (n==1) {
cx = p[0];
cy = p[1];
}
else if (n==2) {
cx = btScalar(0.5)*(p[0] + p[2]);
cy = btScalar(0.5)*(p[1] + p[3]);
}
else {
a = 0;
cx = 0;
cy = 0;
for (i=0; i<(n-1); i++) {
q = p[i*2]*p[i*2+3] - p[i*2+2]*p[i*2+1];
a += q;
cx += q*(p[i*2]+p[i*2+2]);
cy += q*(p[i*2+1]+p[i*2+3]);
}
q = p[n*2-2]*p[1] - p[0]*p[n*2-1];
a = 1.f/(btScalar(3.0)*(a+q));
cx = a*(cx + q*(p[n*2-2]+p[0]));
cy = a*(cy + q*(p[n*2-1]+p[1]));
}
// compute the angle of each point w.r.t. the centroid
btScalar A[8];
for (i=0; i<n; i++) A[i] = btAtan2(p[i*2+1]-cy,p[i*2]-cx);
// search for points that have angles closest to A[i0] + i*(2*pi/m).
int avail[8];
for (i=0; i<n; i++) avail[i] = 1;
avail[i0] = 0;
iret[0] = i0;
iret++;
for (j=1; j<m; j++) {
a = btScalar(j)*(2*M__PI/m) + A[i0];
if (a > M__PI) a -= 2*M__PI;
btScalar maxdiff=1e9,diff;
#if defined(DEBUG) || defined (_DEBUG)
*iret = i0; // iret is not allowed to keep this value
#endif
for (i=0; i<n; i++) {
if (avail[i]) {
diff = btFabs (A[i]-a);
if (diff > M__PI) diff = 2*M__PI - diff;
if (diff < maxdiff) {
maxdiff = diff;
*iret = i;
}
}
}
#if defined(DEBUG) || defined (_DEBUG)
btAssert (*iret != i0); // ensure iret got set
#endif
avail[*iret] = 0;
iret++;
}
}
int dBoxBox2 (const btVector3& p1, const dMatrix3 R1,
const btVector3& side1, const btVector3& p2,
const dMatrix3 R2, const btVector3& side2,
btVector3& normal, btScalar *depth, int *return_code,
int maxc, dContactGeom * /*contact*/, int /*skip*/,btDiscreteCollisionDetectorInterface::Result& output);
int dBoxBox2 (const btVector3& p1, const dMatrix3 R1,
const btVector3& side1, const btVector3& p2,
const dMatrix3 R2, const btVector3& side2,
btVector3& normal, btScalar *depth, int *return_code,
int maxc, dContactGeom * /*contact*/, int /*skip*/,btDiscreteCollisionDetectorInterface::Result& output)
{
const btScalar fudge_factor = btScalar(1.05);
btVector3 p,pp,normalC;
const btScalar *normalR = 0;
btScalar A[3],B[3],R11,R12,R13,R21,R22,R23,R31,R32,R33,
Q11,Q12,Q13,Q21,Q22,Q23,Q31,Q32,Q33,s,s2,l;
int i,j,invert_normal,code;
// get vector from centers of box 1 to box 2, relative to box 1
p = p2 - p1;
dMULTIPLY1_331 (pp,R1,p); // get pp = p relative to body 1
// get side lengths / 2
A[0] = side1[0]*btScalar(0.5);
A[1] = side1[1]*btScalar(0.5);
A[2] = side1[2]*btScalar(0.5);
B[0] = side2[0]*btScalar(0.5);
B[1] = side2[1]*btScalar(0.5);
B[2] = side2[2]*btScalar(0.5);
// Rij is R1'*R2, i.e. the relative rotation between R1 and R2
R11 = dDOT44(R1+0,R2+0); R12 = dDOT44(R1+0,R2+1); R13 = dDOT44(R1+0,R2+2);
R21 = dDOT44(R1+1,R2+0); R22 = dDOT44(R1+1,R2+1); R23 = dDOT44(R1+1,R2+2);
R31 = dDOT44(R1+2,R2+0); R32 = dDOT44(R1+2,R2+1); R33 = dDOT44(R1+2,R2+2);
Q11 = btFabs(R11); Q12 = btFabs(R12); Q13 = btFabs(R13);
Q21 = btFabs(R21); Q22 = btFabs(R22); Q23 = btFabs(R23);
Q31 = btFabs(R31); Q32 = btFabs(R32); Q33 = btFabs(R33);
// for all 15 possible separating axes:
// * see if the axis separates the boxes. if so, return 0.
// * find the depth of the penetration along the separating axis (s2)
// * if this is the largest depth so far, record it.
// the normal vector will be set to the separating axis with the smallest
// depth. note: normalR is set to point to a column of R1 or R2 if that is
// the smallest depth normal so far. otherwise normalR is 0 and normalC is
// set to a vector relative to body 1. invert_normal is 1 if the sign of
// the normal should be flipped.
#define TST(expr1,expr2,norm,cc) \
s2 = btFabs(expr1) - (expr2); \
if (s2 > 0) return 0; \
if (s2 > s) { \
s = s2; \
normalR = norm; \
invert_normal = ((expr1) < 0); \
code = (cc); \
}
s = -dInfinity;
invert_normal = 0;
code = 0;
// separating axis = u1,u2,u3
TST (pp[0],(A[0] + B[0]*Q11 + B[1]*Q12 + B[2]*Q13),R1+0,1);
TST (pp[1],(A[1] + B[0]*Q21 + B[1]*Q22 + B[2]*Q23),R1+1,2);
TST (pp[2],(A[2] + B[0]*Q31 + B[1]*Q32 + B[2]*Q33),R1+2,3);
// separating axis = v1,v2,v3
TST (dDOT41(R2+0,p),(A[0]*Q11 + A[1]*Q21 + A[2]*Q31 + B[0]),R2+0,4);
TST (dDOT41(R2+1,p),(A[0]*Q12 + A[1]*Q22 + A[2]*Q32 + B[1]),R2+1,5);
TST (dDOT41(R2+2,p),(A[0]*Q13 + A[1]*Q23 + A[2]*Q33 + B[2]),R2+2,6);
// note: cross product axes need to be scaled when s is computed.
// normal (n1,n2,n3) is relative to box 1.
#undef TST
#define TST(expr1,expr2,n1,n2,n3,cc) \
s2 = btFabs(expr1) - (expr2); \
if (s2 > 0) return 0; \
l = btSqrt((n1)*(n1) + (n2)*(n2) + (n3)*(n3)); \
if (l > 0) { \
s2 /= l; \
if (s2*fudge_factor > s) { \
s = s2; \
normalR = 0; \
normalC[0] = (n1)/l; normalC[1] = (n2)/l; normalC[2] = (n3)/l; \
invert_normal = ((expr1) < 0); \
code = (cc); \
} \
}
// separating axis = u1 x (v1,v2,v3)
TST(pp[2]*R21-pp[1]*R31,(A[1]*Q31+A[2]*Q21+B[1]*Q13+B[2]*Q12),0,-R31,R21,7);
TST(pp[2]*R22-pp[1]*R32,(A[1]*Q32+A[2]*Q22+B[0]*Q13+B[2]*Q11),0,-R32,R22,8);
TST(pp[2]*R23-pp[1]*R33,(A[1]*Q33+A[2]*Q23+B[0]*Q12+B[1]*Q11),0,-R33,R23,9);
// separating axis = u2 x (v1,v2,v3)
TST(pp[0]*R31-pp[2]*R11,(A[0]*Q31+A[2]*Q11+B[1]*Q23+B[2]*Q22),R31,0,-R11,10);
TST(pp[0]*R32-pp[2]*R12,(A[0]*Q32+A[2]*Q12+B[0]*Q23+B[2]*Q21),R32,0,-R12,11);
TST(pp[0]*R33-pp[2]*R13,(A[0]*Q33+A[2]*Q13+B[0]*Q22+B[1]*Q21),R33,0,-R13,12);
// separating axis = u3 x (v1,v2,v3)
TST(pp[1]*R11-pp[0]*R21,(A[0]*Q21+A[1]*Q11+B[1]*Q33+B[2]*Q32),-R21,R11,0,13);
TST(pp[1]*R12-pp[0]*R22,(A[0]*Q22+A[1]*Q12+B[0]*Q33+B[2]*Q31),-R22,R12,0,14);
TST(pp[1]*R13-pp[0]*R23,(A[0]*Q23+A[1]*Q13+B[0]*Q32+B[1]*Q31),-R23,R13,0,15);
#undef TST
if (!code) return 0;
// if we get to this point, the boxes interpenetrate. compute the normal
// in global coordinates.
if (normalR) {
normal[0] = normalR[0];
normal[1] = normalR[4];
normal[2] = normalR[8];
}
else {
dMULTIPLY0_331 (normal,R1,normalC);
}
if (invert_normal) {
normal[0] = -normal[0];
normal[1] = -normal[1];
normal[2] = -normal[2];
}
*depth = -s;
// compute contact point(s)
if (code > 6) {
// an edge from box 1 touches an edge from box 2.
// find a point pa on the intersecting edge of box 1
btVector3 pa;
btScalar sign;
for (i=0; i<3; i++) pa[i] = p1[i];
for (j=0; j<3; j++) {
sign = (dDOT14(normal,R1+j) > 0) ? btScalar(1.0) : btScalar(-1.0);
for (i=0; i<3; i++) pa[i] += sign * A[j] * R1[i*4+j];
}
// find a point pb on the intersecting edge of box 2
btVector3 pb;
for (i=0; i<3; i++) pb[i] = p2[i];
for (j=0; j<3; j++) {
sign = (dDOT14(normal,R2+j) > 0) ? btScalar(-1.0) : btScalar(1.0);
for (i=0; i<3; i++) pb[i] += sign * B[j] * R2[i*4+j];
}
btScalar alpha,beta;
btVector3 ua,ub;
for (i=0; i<3; i++) ua[i] = R1[((code)-7)/3 + i*4];
for (i=0; i<3; i++) ub[i] = R2[((code)-7)%3 + i*4];
dLineClosestApproach (pa,ua,pb,ub,&alpha,&beta);
for (i=0; i<3; i++) pa[i] += ua[i]*alpha;
for (i=0; i<3; i++) pb[i] += ub[i]*beta;
{
//contact[0].pos[i] = btScalar(0.5)*(pa[i]+pb[i]);
//contact[0].depth = *depth;
btVector3 pointInWorld;
#ifdef USE_CENTER_POINT
for (i=0; i<3; i++)
pointInWorld[i] = (pa[i]+pb[i])*btScalar(0.5);
output.addContactPoint(-normal,pointInWorld,-*depth);
#else
output.addContactPoint(-normal,pb,-*depth);
#endif //
*return_code = code;
}
return 1;
}
// okay, we have a face-something intersection (because the separating
// axis is perpendicular to a face). define face 'a' to be the reference
// face (i.e. the normal vector is perpendicular to this) and face 'b' to be
// the incident face (the closest face of the other box).
const btScalar *Ra,*Rb,*pa,*pb,*Sa,*Sb;
if (code <= 3) {
Ra = R1;
Rb = R2;
pa = p1;
pb = p2;
Sa = A;
Sb = B;
}
else {
Ra = R2;
Rb = R1;
pa = p2;
pb = p1;
Sa = B;
Sb = A;
}
// nr = normal vector of reference face dotted with axes of incident box.
// anr = absolute values of nr.
btVector3 normal2,nr,anr;
if (code <= 3) {
normal2[0] = normal[0];
normal2[1] = normal[1];
normal2[2] = normal[2];
}
else {
normal2[0] = -normal[0];
normal2[1] = -normal[1];
normal2[2] = -normal[2];
}
dMULTIPLY1_331 (nr,Rb,normal2);
anr[0] = btFabs (nr[0]);
anr[1] = btFabs (nr[1]);
anr[2] = btFabs (nr[2]);
// find the largest compontent of anr: this corresponds to the normal
// for the indident face. the other axis numbers of the indicent face
// are stored in a1,a2.
int lanr,a1,a2;
if (anr[1] > anr[0]) {
if (anr[1] > anr[2]) {
a1 = 0;
lanr = 1;
a2 = 2;
}
else {
a1 = 0;
a2 = 1;
lanr = 2;
}
}
else {
if (anr[0] > anr[2]) {
lanr = 0;
a1 = 1;
a2 = 2;
}
else {
a1 = 0;
a2 = 1;
lanr = 2;
}
}
// compute center point of incident face, in reference-face coordinates
btVector3 center;
if (nr[lanr] < 0) {
for (i=0; i<3; i++) center[i] = pb[i] - pa[i] + Sb[lanr] * Rb[i*4+lanr];
}
else {
for (i=0; i<3; i++) center[i] = pb[i] - pa[i] - Sb[lanr] * Rb[i*4+lanr];
}
// find the normal and non-normal axis numbers of the reference box
int codeN,code1,code2;
if (code <= 3) codeN = code-1; else codeN = code-4;
if (codeN==0) {
code1 = 1;
code2 = 2;
}
else if (codeN==1) {
code1 = 0;
code2 = 2;
}
else {
code1 = 0;
code2 = 1;
}
// find the four corners of the incident face, in reference-face coordinates
btScalar quad[8]; // 2D coordinate of incident face (x,y pairs)
btScalar c1,c2,m11,m12,m21,m22;
c1 = dDOT14 (center,Ra+code1);
c2 = dDOT14 (center,Ra+code2);
// optimize this? - we have already computed this data above, but it is not
// stored in an easy-to-index format. for now it's quicker just to recompute
// the four dot products.
m11 = dDOT44 (Ra+code1,Rb+a1);
m12 = dDOT44 (Ra+code1,Rb+a2);
m21 = dDOT44 (Ra+code2,Rb+a1);
m22 = dDOT44 (Ra+code2,Rb+a2);
{
btScalar k1 = m11*Sb[a1];
btScalar k2 = m21*Sb[a1];
btScalar k3 = m12*Sb[a2];
btScalar k4 = m22*Sb[a2];
quad[0] = c1 - k1 - k3;
quad[1] = c2 - k2 - k4;
quad[2] = c1 - k1 + k3;
quad[3] = c2 - k2 + k4;
quad[4] = c1 + k1 + k3;
quad[5] = c2 + k2 + k4;
quad[6] = c1 + k1 - k3;
quad[7] = c2 + k2 - k4;
}
// find the size of the reference face
btScalar rect[2];
rect[0] = Sa[code1];
rect[1] = Sa[code2];
// intersect the incident and reference faces
btScalar ret[16];
int n = intersectRectQuad2 (rect,quad,ret);
if (n < 1) return 0; // this should never happen
// convert the intersection points into reference-face coordinates,
// and compute the contact position and depth for each point. only keep
// those points that have a positive (penetrating) depth. delete points in
// the 'ret' array as necessary so that 'point' and 'ret' correspond.
btScalar point[3*8]; // penetrating contact points
btScalar dep[8]; // depths for those points
btScalar det1 = 1.f/(m11*m22 - m12*m21);
m11 *= det1;
m12 *= det1;
m21 *= det1;
m22 *= det1;
int cnum = 0; // number of penetrating contact points found
for (j=0; j < n; j++) {
btScalar k1 = m22*(ret[j*2]-c1) - m12*(ret[j*2+1]-c2);
btScalar k2 = -m21*(ret[j*2]-c1) + m11*(ret[j*2+1]-c2);
for (i=0; i<3; i++) point[cnum*3+i] =
center[i] + k1*Rb[i*4+a1] + k2*Rb[i*4+a2];
dep[cnum] = Sa[codeN] - dDOT(normal2,point+cnum*3);
if (dep[cnum] >= 0) {
ret[cnum*2] = ret[j*2];
ret[cnum*2+1] = ret[j*2+1];
cnum++;
}
}
if (cnum < 1) return 0; // this should never happen
// we can't generate more contacts than we actually have
if (maxc > cnum) maxc = cnum;
if (maxc < 1) maxc = 1;
if (cnum <= maxc) {
// we have less contacts than we need, so we use them all
for (j=0; j < cnum; j++) {
//AddContactPoint...
//dContactGeom *con = CONTACT(contact,skip*j);
//for (i=0; i<3; i++) con->pos[i] = point[j*3+i] + pa[i];
//con->depth = dep[j];
btVector3 pointInWorld;
for (i=0; i<3; i++)
pointInWorld[i] = point[j*3+i] + pa[i];
output.addContactPoint(-normal,pointInWorld,-dep[j]);
}
}
else {
// we have more contacts than are wanted, some of them must be culled.
// find the deepest point, it is always the first contact.
int i1 = 0;
btScalar maxdepth = dep[0];
for (i=1; i<cnum; i++) {
if (dep[i] > maxdepth) {
maxdepth = dep[i];
i1 = i;
}
}
int iret[8];
cullPoints2 (cnum,ret,maxc,i1,iret);
for (j=0; j < maxc; j++) {
// dContactGeom *con = CONTACT(contact,skip*j);
// for (i=0; i<3; i++) con->pos[i] = point[iret[j]*3+i] + pa[i];
// con->depth = dep[iret[j]];
btVector3 posInWorld;
for (i=0; i<3; i++)
posInWorld[i] = point[iret[j]*3+i] + pa[i];
output.addContactPoint(-normal,posInWorld,-dep[iret[j]]);
}
cnum = maxc;
}
*return_code = code;
return cnum;
}
void btBoxBoxDetector::getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* /*debugDraw*/,bool /*swapResults*/)
{
const btTransform& transformA = input.m_transformA;
const btTransform& transformB = input.m_transformB;
int skip = 0;
dContactGeom *contact = 0;
dMatrix3 R1;
dMatrix3 R2;
for (int j=0;j<3;j++)
{
R1[0+4*j] = transformA.getBasis()[j].x();
R2[0+4*j] = transformB.getBasis()[j].x();
R1[1+4*j] = transformA.getBasis()[j].y();
R2[1+4*j] = transformB.getBasis()[j].y();
R1[2+4*j] = transformA.getBasis()[j].z();
R2[2+4*j] = transformB.getBasis()[j].z();
}
btVector3 normal;
btScalar depth;
int return_code;
int maxc = 4;
dBoxBox2 (transformA.getOrigin(),
R1,
2.f*m_box1->getHalfExtentsWithMargin(),
transformB.getOrigin(),
R2,
2.f*m_box2->getHalfExtentsWithMargin(),
normal, &depth, &return_code,
maxc, contact, skip,
output
);
}

View File

@@ -0,0 +1,44 @@
/*
* Box-Box collision detection re-distributed under the ZLib license with permission from Russell L. Smith
* Original version is from Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.
* All rights reserved. Email: russ@q12.org Web: www.q12.org
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BOX_BOX_DETECTOR_H
#define BOX_BOX_DETECTOR_H
class btBoxShape;
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
/// btBoxBoxDetector wraps the ODE box-box collision detector
/// re-distributed under the Zlib license with permission from Russell L. Smith
struct btBoxBoxDetector : public btDiscreteCollisionDetectorInterface
{
btBoxShape* m_box1;
btBoxShape* m_box2;
public:
btBoxBoxDetector(btBoxShape* box1,btBoxShape* box2);
virtual ~btBoxBoxDetector() {};
virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false);
};
#endif //BT_BOX_BOX_DETECTOR_H

View File

@@ -0,0 +1,47 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BT_COLLISION_CONFIGURATION
#define BT_COLLISION_CONFIGURATION
struct btCollisionAlgorithmCreateFunc;
class btStackAlloc;
class btPoolAllocator;
///btCollisionConfiguration allows to configure Bullet collision detection
///stack allocator size, default collision algorithms and persistent manifold pool size
///todo: describe the meaning
class btCollisionConfiguration
{
public:
virtual ~btCollisionConfiguration()
{
}
///memory pools
virtual btPoolAllocator* getPersistentManifoldPool() = 0;
virtual btPoolAllocator* getCollisionAlgorithmPool() = 0;
virtual btStackAlloc* getStackAllocator() = 0;
virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1) =0;
};
#endif //BT_COLLISION_CONFIGURATION

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef COLLISION_CREATE_FUNC
#define COLLISION_CREATE_FUNC
#include "../../LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btAlignedObjectArray.h"
typedef btAlignedObjectArray<class btCollisionObject*> btCollisionObjectArray;
class btCollisionAlgorithm;
class btCollisionObject;

View File

@@ -19,69 +19,39 @@ subject to the following restrictions:
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
#include "LinearMath/btPoolAllocator.h"
#include "BulletCollision/CollisionDispatch/btCollisionConfiguration.h"
int gNumManifold = 0;
#ifdef BT_DEBUG
#include <stdio.h>
#endif
btCollisionDispatcher::btCollisionDispatcher(bool noDefaultAlgorithms):
m_count(0),
m_useIslands(true),
m_convexConvexCreateFunc(0),
m_convexConcaveCreateFunc(0),
m_swappedConvexConcaveCreateFunc(0),
m_compoundCreateFunc(0),
m_swappedCompoundCreateFunc(0),
m_emptyCreateFunc(0)
{
(void)noDefaultAlgorithms;
int i;
setNearCallback(defaultNearCallback);
m_emptyCreateFunc = new btEmptyAlgorithm::CreateFunc;
for (i=0;i<MAX_BROADPHASE_COLLISION_TYPES;i++)
{
for (int j=0;j<MAX_BROADPHASE_COLLISION_TYPES;j++)
{
m_doubleDispatch[i][j] = m_emptyCreateFunc;
}
}
}
//if you want to not link with the default collision algorithms, you can
//define BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION
//in your Bullet library build system
#ifndef BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION
btCollisionDispatcher::btCollisionDispatcher ():
btCollisionDispatcher::btCollisionDispatcher (btCollisionConfiguration* collisionConfiguration):
m_count(0),
m_useIslands(true)
m_useIslands(true),
m_staticWarningReported(false),
m_collisionConfiguration(collisionConfiguration)
{
int i;
setNearCallback(defaultNearCallback);
//default CreationFunctions, filling the m_doubleDispatch table
m_convexConvexCreateFunc = new btConvexConvexAlgorithm::CreateFunc;
m_convexConcaveCreateFunc = new btConvexConcaveCollisionAlgorithm::CreateFunc;
m_swappedConvexConcaveCreateFunc = new btConvexConcaveCollisionAlgorithm::SwappedCreateFunc;
m_compoundCreateFunc = new btCompoundCollisionAlgorithm::CreateFunc;
m_swappedCompoundCreateFunc = new btCompoundCollisionAlgorithm::SwappedCreateFunc;
m_emptyCreateFunc = new btEmptyAlgorithm::CreateFunc;
m_collisionAlgorithmPoolAllocator = collisionConfiguration->getCollisionAlgorithmPool();
m_persistentManifoldPoolAllocator = collisionConfiguration->getPersistentManifoldPool();
for (i=0;i<MAX_BROADPHASE_COLLISION_TYPES;i++)
{
for (int j=0;j<MAX_BROADPHASE_COLLISION_TYPES;j++)
{
m_doubleDispatch[i][j] = internalFindCreateFunc(i,j);
m_doubleDispatch[i][j] = m_collisionConfiguration->getCollisionAlgorithmCreateFunc(i,j);
assert(m_doubleDispatch[i][j]);
}
}
@@ -89,8 +59,6 @@ btCollisionDispatcher::btCollisionDispatcher ():
};
#endif //BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION
void btCollisionDispatcher::registerCollisionCreateFunc(int proxyType0, int proxyType1, btCollisionAlgorithmCreateFunc *createFunc)
{
@@ -99,12 +67,6 @@ void btCollisionDispatcher::registerCollisionCreateFunc(int proxyType0, int prox
btCollisionDispatcher::~btCollisionDispatcher()
{
delete m_convexConvexCreateFunc;
delete m_convexConcaveCreateFunc;
delete m_swappedConvexConcaveCreateFunc;
delete m_compoundCreateFunc;
delete m_swappedCompoundCreateFunc;
delete m_emptyCreateFunc;
}
btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1)
@@ -117,7 +79,18 @@ btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1)
btCollisionObject* body0 = (btCollisionObject*)b0;
btCollisionObject* body1 = (btCollisionObject*)b1;
btPersistentManifold* manifold = new btPersistentManifold (body0,body1);
void* mem = 0;
if (m_persistentManifoldPoolAllocator->getFreeCount())
{
mem = m_persistentManifoldPoolAllocator->allocate(sizeof(btPersistentManifold));
} else
{
mem = btAlignedAlloc(sizeof(btPersistentManifold),16);
}
btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0);
manifold->m_index1a = m_manifoldsPtr.size();
m_manifoldsPtr.push_back(manifold);
return manifold;
@@ -137,13 +110,19 @@ void btCollisionDispatcher::releaseManifold(btPersistentManifold* manifold)
//printf("releaseManifold: gNumManifold %d\n",gNumManifold);
clearManifold(manifold);
///todo: this can be improved a lot, linear search might be slow part!
int findIndex = m_manifoldsPtr.findLinearSearch(manifold);
if (findIndex < m_manifoldsPtr.size())
int findIndex = manifold->m_index1a;
btAssert(findIndex < m_manifoldsPtr.size());
m_manifoldsPtr.swap(findIndex,m_manifoldsPtr.size()-1);
m_manifoldsPtr[findIndex]->m_index1a = findIndex;
m_manifoldsPtr.pop_back();
manifold->~btPersistentManifold();
if (m_persistentManifoldPoolAllocator->validPtr(manifold))
{
m_manifoldsPtr.swap(findIndex,m_manifoldsPtr.size()-1);
m_manifoldsPtr.pop_back();
delete manifold;
m_persistentManifoldPoolAllocator->freeMemory(manifold);
} else
{
btAlignedFree(manifold);
}
}
@@ -152,99 +131,19 @@ void btCollisionDispatcher::releaseManifold(btPersistentManifold* manifold)
btCollisionAlgorithm* btCollisionDispatcher::findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold)
{
#ifdef USE_DISPATCH_REGISTRY_ARRAY
btCollisionAlgorithmConstructionInfo ci;
ci.m_dispatcher = this;
ci.m_dispatcher1 = this;
ci.m_manifold = sharedManifold;
btCollisionAlgorithm* algo = m_doubleDispatch[body0->getCollisionShape()->getShapeType()][body1->getCollisionShape()->getShapeType()]
->CreateCollisionAlgorithm(ci,body0,body1);
#else
btCollisionAlgorithm* algo = internalFindAlgorithm(body0,body1);
#endif //USE_DISPATCH_REGISTRY_ARRAY
btCollisionAlgorithm* algo = m_doubleDispatch[body0->getCollisionShape()->getShapeType()][body1->getCollisionShape()->getShapeType()]->CreateCollisionAlgorithm(ci,body0,body1);
return algo;
}
#ifndef BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION
btCollisionAlgorithmCreateFunc* btCollisionDispatcher::internalFindCreateFunc(int proxyType0,int proxyType1)
{
if (btBroadphaseProxy::isConvex(proxyType0) && btBroadphaseProxy::isConvex(proxyType1))
{
return m_convexConvexCreateFunc;
}
if (btBroadphaseProxy::isConvex(proxyType0) && btBroadphaseProxy::isConcave(proxyType1))
{
return m_convexConcaveCreateFunc;
}
if (btBroadphaseProxy::isConvex(proxyType1) && btBroadphaseProxy::isConcave(proxyType0))
{
return m_swappedConvexConcaveCreateFunc;
}
if (btBroadphaseProxy::isCompound(proxyType0))
{
return m_compoundCreateFunc;
} else
{
if (btBroadphaseProxy::isCompound(proxyType1))
{
return m_swappedCompoundCreateFunc;
}
}
//failed to find an algorithm
return m_emptyCreateFunc;
}
#endif //BT_EXCLUDE_DEFAULT_COLLISIONALGORITHM_REGISTRATION
#ifndef USE_DISPATCH_REGISTRY_ARRAY
btCollisionAlgorithm* btCollisionDispatcher::internalFindAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold)
{
m_count++;
btCollisionAlgorithmConstructionInfo ci;
ci.m_dispatcher = this;
if (body0->getCollisionShape()->isConvex() && body1->getCollisionShape()->isConvex() )
{
return new btConvexConvexAlgorithm(sharedManifold,ci,body0,body1);
}
if (body0->getCollisionShape()->isConvex() && body1->getCollisionShape()->isConcave())
{
return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,false);
}
if (body1->getCollisionShape()->isConvex() && body0->getCollisionShape()->isConcave())
{
return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,true);
}
if (body0->getCollisionShape()->isCompound())
{
return new btCompoundCollisionAlgorithm(ci,body0,body1,false);
} else
{
if (body1->getCollisionShape()->isCompound())
{
return new btCompoundCollisionAlgorithm(ci,body0,body1,true);
}
}
//failed to find an algorithm
return new btEmptyAlgorithm(ci);
}
#endif //USE_DISPATCH_REGISTRY_ARRAY
bool btCollisionDispatcher::needsResponse(btCollisionObject* body0,btCollisionObject* body1)
{
@@ -264,13 +163,19 @@ bool btCollisionDispatcher::needsCollision(btCollisionObject* body0,btCollisionO
bool needsCollision = true;
//broadphase filtering already deals with this
if ((body0->isStaticObject() || body0->isKinematicObject()) &&
(body1->isStaticObject() || body1->isKinematicObject()))
#ifdef BT_DEBUG
if (!m_staticWarningReported)
{
printf("warning btCollisionDispatcher::needsCollision: static-static collision!\n");
//broadphase filtering already deals with this
if ((body0->isStaticObject() || body0->isKinematicObject()) &&
(body1->isStaticObject() || body1->isKinematicObject()))
{
m_staticWarningReported = true;
printf("warning btCollisionDispatcher::needsCollision: static-static collision!\n");
}
}
#endif //BT_DEBUG
if ((!body0->isActive()) && (!body1->isActive()))
needsCollision = false;
else if (!body0->checkCollideWith(body1))
@@ -286,23 +191,25 @@ bool btCollisionDispatcher::needsCollision(btCollisionObject* body0,btCollisionO
///this is useful for the collision dispatcher.
class btCollisionPairCallback : public btOverlapCallback
{
btDispatcherInfo& m_dispatchInfo;
const btDispatcherInfo& m_dispatchInfo;
btCollisionDispatcher* m_dispatcher;
public:
btCollisionPairCallback(btDispatcherInfo& dispatchInfo,btCollisionDispatcher* dispatcher)
btCollisionPairCallback(const btDispatcherInfo& dispatchInfo,btCollisionDispatcher* dispatcher)
:m_dispatchInfo(dispatchInfo),
m_dispatcher(dispatcher)
{
}
btCollisionPairCallback& operator=(btCollisionPairCallback& other)
/*btCollisionPairCallback& operator=(btCollisionPairCallback& other)
{
m_dispatchInfo = other.m_dispatchInfo;
m_dispatcher = other.m_dispatcher;
return *this;
}
*/
virtual ~btCollisionPairCallback() {}
@@ -316,13 +223,14 @@ public:
};
void btCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)
void btCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher)
{
//m_blockedForChanges = true;
btCollisionPairCallback collisionCallback(dispatchInfo,this);
pairCache->processAllOverlappingPairs(&collisionCallback);
pairCache->processAllOverlappingPairs(&collisionCallback,dispatcher);
//m_blockedForChanges = false;
@@ -332,7 +240,7 @@ void btCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPairCache* pa
//by default, Bullet will use this near callback
void btCollisionDispatcher::defaultNearCallback(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, btDispatcherInfo& dispatchInfo)
void btCollisionDispatcher::defaultNearCallback(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, const btDispatcherInfo& dispatchInfo)
{
btCollisionObject* colObj0 = (btCollisionObject*)collisionPair.m_pProxy0->m_clientObject;
btCollisionObject* colObj1 = (btCollisionObject*)collisionPair.m_pProxy1->m_clientObject;
@@ -365,3 +273,26 @@ void btCollisionDispatcher::defaultNearCallback(btBroadphasePair& collisionPair,
}
}
void* btCollisionDispatcher::allocateCollisionAlgorithm(int size)
{
if (m_collisionAlgorithmPoolAllocator->getFreeCount())
{
return m_collisionAlgorithmPoolAllocator->allocate(size);
}
//warn user for overflow?
return btAlignedAlloc(static_cast<size_t>(size), 16);
}
void btCollisionDispatcher::freeCollisionAlgorithm(void* ptr)
{
if (m_collisionAlgorithmPoolAllocator->validPtr(ptr))
{
m_collisionAlgorithmPoolAllocator->freeMemory(ptr);
} else
{
btAlignedFree(ptr);
}
}

View File

@@ -16,17 +16,18 @@ subject to the following restrictions:
#ifndef COLLISION__DISPATCHER_H
#define COLLISION__DISPATCHER_H
#include "../BroadphaseCollision/btDispatcher.h"
#include "../NarrowPhaseCollision/btPersistentManifold.h"
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
#include "../CollisionDispatch/btManifoldResult.h"
#include "BulletCollision/CollisionDispatch/btManifoldResult.h"
#include "../BroadphaseCollision/btBroadphaseProxy.h"
#include "../../LinearMath/btAlignedObjectArray.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "LinearMath/btAlignedObjectArray.h"
class btIDebugDraw;
class btOverlappingPairCache;
class btPoolAllocator;
class btCollisionConfiguration;
#include "btCollisionCreateFunc.h"
@@ -34,7 +35,7 @@ class btOverlappingPairCache;
class btCollisionDispatcher;
///user can override this nearcallback for collision filtering and more finegrained control over collision detection
typedef void (*btNearCallback)(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, btDispatcherInfo& dispatchInfo);
typedef void (*btNearCallback)(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, const btDispatcherInfo& dispatchInfo);
///btCollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs.
@@ -46,26 +47,22 @@ class btCollisionDispatcher : public btDispatcher
btAlignedObjectArray<btPersistentManifold*> m_manifoldsPtr;
bool m_useIslands;
bool m_staticWarningReported;
btManifoldResult m_defaultManifoldResult;
btNearCallback m_nearCallback;
btPoolAllocator* m_collisionAlgorithmPoolAllocator;
btPoolAllocator* m_persistentManifoldPoolAllocator;
btCollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLLISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES];
btCollisionAlgorithmCreateFunc* internalFindCreateFunc(int proxyType0,int proxyType1);
//default CreationFunctions, filling the m_doubleDispatch table
btCollisionAlgorithmCreateFunc* m_convexConvexCreateFunc;
btCollisionAlgorithmCreateFunc* m_convexConcaveCreateFunc;
btCollisionAlgorithmCreateFunc* m_swappedConvexConcaveCreateFunc;
btCollisionAlgorithmCreateFunc* m_compoundCreateFunc;
btCollisionAlgorithmCreateFunc* m_swappedCompoundCreateFunc;
btCollisionAlgorithmCreateFunc* m_emptyCreateFunc;
btCollisionConfiguration* m_collisionConfiguration;
#ifndef USE_DISPATCH_REGISTRY_ARRAY
btCollisionAlgorithm* internalFindAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold = 0);
#endif //USE_DISPATCH_REGISTRY_ARRAY
public:
@@ -92,11 +89,7 @@ public:
return m_manifoldsPtr[index];
}
///the default constructor creates/register default collision algorithms, for convex, compound and concave shape support
btCollisionDispatcher ();
///a special constructor that doesn't create/register the default collision algorithms
btCollisionDispatcher(bool noDefaultAlgorithms);
btCollisionDispatcher (btCollisionConfiguration* collisionConfiguration);
virtual ~btCollisionDispatcher();
@@ -114,7 +107,7 @@ public:
virtual bool needsResponse(btCollisionObject* body0,btCollisionObject* body1);
virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo);
virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) ;
void setNearCallback(btNearCallback nearCallback)
{
@@ -127,7 +120,26 @@ public:
}
//by default, Bullet will use this near callback
static void defaultNearCallback(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, btDispatcherInfo& dispatchInfo);
static void defaultNearCallback(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, const btDispatcherInfo& dispatchInfo);
virtual void* allocateCollisionAlgorithm(int size);
virtual void freeCollisionAlgorithm(void* ptr);
btCollisionConfiguration* getCollisionConfiguration()
{
return m_collisionConfiguration;
}
const btCollisionConfiguration* getCollisionConfiguration() const
{
return m_collisionConfiguration;
}
void setCollisionConfiguration(btCollisionConfiguration* config)
{
m_collisionConfiguration = config;
}
};

View File

@@ -13,18 +13,25 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
#include "btCollisionObject.h"
btCollisionObject::btCollisionObject()
: m_broadphaseHandle(0),
m_collisionShape(0),
m_collisionFlags(0),
m_rootCollisionShape(0),
m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT),
m_islandTag1(-1),
m_companionId(-1),
m_activationState1(1),
m_deactivationTime(btScalar(0.)),
m_friction(btScalar(0.5)),
m_restitution(btScalar(0.)),
m_userObjectPointer(0),
m_internalType(CO_COLLISION_OBJECT),
m_hitFraction(btScalar(1.)),
m_ccdSweptSphereRadius(btScalar(0.)),
m_ccdSquareMotionThreshold(btScalar(0.)),
m_ccdMotionThreshold(btScalar(0.)),
m_checkCollideWith(false)
{
@@ -55,3 +62,4 @@ void btCollisionObject::activate(bool forceActivation)
}

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef COLLISION_OBJECT_H
#define COLLISION_OBJECT_H
#include "../../LinearMath/btTransform.h"
#include "LinearMath/btTransform.h"
//island management, m_activationState1
#define ACTIVE_TAG 1
@@ -27,7 +27,8 @@ subject to the following restrictions:
struct btBroadphaseProxy;
class btCollisionShape;
#include "../../LinearMath/btMotionState.h"
#include "LinearMath/btMotionState.h"
#include "LinearMath/btAlignedAllocator.h"
@@ -50,6 +51,11 @@ protected:
btVector3 m_interpolationAngularVelocity;
btBroadphaseProxy* m_broadphaseHandle;
btCollisionShape* m_collisionShape;
///m_rootCollisionShape is temporarily used to store the original collision shape
///The m_collisionShape might be temporarily replaced by a child collision shape during collision detection purposes
///If it is NULL, the m_collisionShape is not temporarily replaced.
btCollisionShape* m_rootCollisionShape;
int m_collisionFlags;
@@ -65,8 +71,9 @@ protected:
///users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPointer
void* m_userObjectPointer;
///m_internalOwner is reserved to point to Bullet's btRigidBody. Don't use this, use m_userObjectPointer instead.
void* m_internalOwner;
///m_internalType is reserved to distinguish Bullet's btCollisionObject, btRigidBody, btSoftBody etc.
///do not assign your own m_internalType unless you write a new dynamics object class.
int m_internalType;
///time of impact calculation
btScalar m_hitFraction;
@@ -74,21 +81,23 @@ protected:
///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
btScalar m_ccdSweptSphereRadius;
/// Don't do continuous collision detection if square motion (in one step) is less then m_ccdSquareMotionThreshold
btScalar m_ccdSquareMotionThreshold;
/// Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold
btScalar m_ccdMotionThreshold;
/// If some object should have elaborate collision filtering by sub-classes
bool m_checkCollideWith;
char m_pad[7];
virtual bool checkCollideWithOverride(btCollisionObject* co)
virtual bool checkCollideWithOverride(btCollisionObject* /* co */)
{
return true;
}
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
enum CollisionFlags
{
CF_STATIC_OBJECT= 1,
@@ -97,29 +106,35 @@ public:
CF_CUSTOM_MATERIAL_CALLBACK = 8//this allows per-triangle material (friction/restitution)
};
enum CollisionObjectTypes
{
CO_COLLISION_OBJECT =1,
CO_RIGID_BODY,
CO_SOFT_BODY
};
inline bool mergesSimulationIslands() const
SIMD_FORCE_INLINE bool mergesSimulationIslands() const
{
///static objects, kinematic and object without contact response don't merge islands
return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE) )==0);
}
inline bool isStaticObject() const {
SIMD_FORCE_INLINE bool isStaticObject() const {
return (m_collisionFlags & CF_STATIC_OBJECT) != 0;
}
inline bool isKinematicObject() const
SIMD_FORCE_INLINE bool isKinematicObject() const
{
return (m_collisionFlags & CF_KINEMATIC_OBJECT) != 0;
}
inline bool isStaticOrKinematicObject() const
SIMD_FORCE_INLINE bool isStaticOrKinematicObject() const
{
return (m_collisionFlags & (CF_KINEMATIC_OBJECT | CF_STATIC_OBJECT)) != 0 ;
}
inline bool hasContactResponse() const {
SIMD_FORCE_INLINE bool hasContactResponse() const {
return (m_collisionFlags & CF_NO_CONTACT_RESPONSE)==0;
}
@@ -131,20 +146,35 @@ public:
void setCollisionShape(btCollisionShape* collisionShape)
{
m_collisionShape = collisionShape;
m_rootCollisionShape = collisionShape;
}
const btCollisionShape* getCollisionShape() const
SIMD_FORCE_INLINE const btCollisionShape* getCollisionShape() const
{
return m_collisionShape;
}
btCollisionShape* getCollisionShape()
SIMD_FORCE_INLINE btCollisionShape* getCollisionShape()
{
return m_collisionShape;
}
SIMD_FORCE_INLINE const btCollisionShape* getRootCollisionShape() const
{
return m_rootCollisionShape;
}
SIMD_FORCE_INLINE btCollisionShape* getRootCollisionShape()
{
return m_rootCollisionShape;
}
///Avoid using this internal API call
///internalSetTemporaryCollisionShape is used to temporary replace the actual collision shape by a child collision shape.
void internalSetTemporaryCollisionShape(btCollisionShape* collisionShape)
{
m_collisionShape = collisionShape;
}
int getActivationState() const { return m_activationState1;}
@@ -186,14 +216,9 @@ public:
}
///reserved for Bullet internal usage
void* getInternalOwner()
int getInternalType() const
{
return m_internalOwner;
}
const void* getInternalOwner() const
{
return m_internalOwner;
return m_internalType;
}
btTransform& getWorldTransform()
@@ -243,6 +268,15 @@ public:
m_interpolationWorldTransform = trans;
}
void setInterpolationLinearVelocity(const btVector3& linvel)
{
m_interpolationLinearVelocity = linvel;
}
void setInterpolationAngularVelocity(const btVector3& angvel)
{
m_interpolationAngularVelocity = angvel;
}
const btVector3& getInterpolationLinearVelocity() const
{
@@ -307,16 +341,22 @@ public:
m_ccdSweptSphereRadius = radius;
}
btScalar getCcdMotionThreshold() const
{
return m_ccdMotionThreshold;
}
btScalar getCcdSquareMotionThreshold() const
{
return m_ccdSquareMotionThreshold;
return m_ccdMotionThreshold*m_ccdMotionThreshold;
}
/// Don't do continuous collision detection if square motion (in one step) is less then m_ccdSquareMotionThreshold
void setCcdSquareMotionThreshold(btScalar ccdSquareMotionThreshold)
/// Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold
void setCcdMotionThreshold(btScalar ccdMotionThreshold)
{
m_ccdSquareMotionThreshold = ccdSquareMotionThreshold;
m_ccdMotionThreshold = ccdMotionThreshold*ccdMotionThreshold;
}
///users can point to their objects, userPointer is not used by Bullet
@@ -331,6 +371,7 @@ public:
m_userObjectPointer = userPointer;
}
inline bool checkCollideWith(btCollisionObject* co)
{
if (m_checkCollideWith)
@@ -338,9 +379,6 @@ public:
return true;
}
}
;
};
#endif //COLLISION_OBJECT_H

View File

@@ -4,8 +4,8 @@ Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
@@ -18,59 +18,57 @@ subject to the following restrictions:
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h" //for raycasting
#include "BulletCollision/CollisionShapes/btTriangleMeshShape.h" //for raycasting
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h" //for raycasting
#include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h"
#include "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
#include "LinearMath/btAabbUtil2.h"
#include "LinearMath/btQuickprof.h"
#include "LinearMath/btStackAlloc.h"
//When the user doesn't provide dispatcher or broadphase, create basic versions (and delete them in destructor)
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h"
#include "BulletCollision/CollisionDispatch/btCollisionConfiguration.h"
btCollisionWorld::btCollisionWorld(btDispatcher* dispatcher,btOverlappingPairCache* pairCache, int stackSize)
btCollisionWorld::btCollisionWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache, btCollisionConfiguration* collisionConfiguration)
:m_dispatcher1(dispatcher),
m_broadphasePairCache(pairCache),
m_ownsDispatcher(false),
m_ownsBroadphasePairCache(false)
m_debugDrawer(0)
{
m_stackAlloc = new btStackAlloc(stackSize);
m_stackAlloc = collisionConfiguration->getStackAllocator();
m_dispatchInfo.m_stackAllocator = m_stackAlloc;
}
btCollisionWorld::~btCollisionWorld()
{
m_stackAlloc->destroy();
delete m_stackAlloc;
//clean up remaining objects
int i;
for (i=0;i<m_collisionObjects.size();i++)
{
btCollisionObject* collisionObject= m_collisionObjects[i];
btBroadphaseProxy* bp = collisionObject->getBroadphaseHandle();
if (bp)
{
//
// only clear the cached algorithms
//
getBroadphase()->cleanProxyFromPairs(bp);
getBroadphase()->destroyProxy(bp);
getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(bp,m_dispatcher1);
getBroadphase()->destroyProxy(bp,m_dispatcher1);
}
}
if (m_ownsDispatcher)
delete m_dispatcher1;
if (m_ownsBroadphasePairCache)
delete m_broadphasePairCache;
}
@@ -105,66 +103,105 @@ void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,sho
type,
collisionObject,
collisionFilterGroup,
collisionFilterMask
collisionFilterMask,
m_dispatcher1,0
)) ;
}
void btCollisionWorld::updateAabbs()
{
BT_PROFILE("updateAabbs");
btTransform predictedTrans;
for ( int i=0;i<m_collisionObjects.size();i++)
{
btCollisionObject* colObj = m_collisionObjects[i];
//only update aabb of active objects
if (colObj->isActive())
{
btPoint3 minAabb,maxAabb;
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
//need to increase the aabb for contact thresholds
btVector3 contactThreshold(gContactBreakingThreshold,gContactBreakingThreshold,gContactBreakingThreshold);
minAabb -= contactThreshold;
maxAabb += contactThreshold;
btBroadphaseInterface* bp = (btBroadphaseInterface*)m_broadphasePairCache;
//moving objects should be moderately sized, probably something wrong if not
if ( colObj->isStaticObject() || ((maxAabb-minAabb).length2() < btScalar(1e12)))
{
bp->setAabb(colObj->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
} else
{
//something went wrong, investigate
//this assert is unwanted in 3D modelers (danger of loosing work)
colObj->setActivationState(DISABLE_SIMULATION);
static bool reportMe = true;
if (reportMe && m_debugDrawer)
{
reportMe = false;
m_debugDrawer->reportErrorWarning("Overflow in AABB, object removed from simulation");
m_debugDrawer->reportErrorWarning("If you can reproduce this, please email bugs@continuousphysics.com\n");
m_debugDrawer->reportErrorWarning("Please include above information, your Platform, version of OS.\n");
m_debugDrawer->reportErrorWarning("Thanks.\n");
}
}
}
}
}
void btCollisionWorld::performDiscreteCollisionDetection()
{
BT_PROFILE("performDiscreteCollisionDetection");
btDispatcherInfo& dispatchInfo = getDispatchInfo();
BEGIN_PROFILE("perform Broadphase Collision Detection");
updateAabbs();
//update aabb (of all moved objects)
btVector3 aabbMin,aabbMax;
for (int i=0;i<m_collisionObjects.size();i++)
{
m_collisionObjects[i]->getCollisionShape()->getAabb(m_collisionObjects[i]->getWorldTransform(),aabbMin,aabbMax);
m_broadphasePairCache->setAabb(m_collisionObjects[i]->getBroadphaseHandle(),aabbMin,aabbMax);
BT_PROFILE("calculateOverlappingPairs");
m_broadphasePairCache->calculateOverlappingPairs(m_dispatcher1);
}
m_broadphasePairCache->refreshOverlappingPairs();
END_PROFILE("perform Broadphase Collision Detection");
BEGIN_PROFILE("performDiscreteCollisionDetection");
btDispatcher* dispatcher = getDispatcher();
if (dispatcher)
dispatcher->dispatchAllCollisionPairs(m_broadphasePairCache,dispatchInfo);
END_PROFILE("performDiscreteCollisionDetection");
{
BT_PROFILE("dispatchAllCollisionPairs");
if (dispatcher)
dispatcher->dispatchAllCollisionPairs(m_broadphasePairCache->getOverlappingPairCache(),dispatchInfo,m_dispatcher1);
}
}
void btCollisionWorld::removeCollisionObject(btCollisionObject* collisionObject)
{
//bool removeFromBroadphase = false;
{
btBroadphaseProxy* bp = collisionObject->getBroadphaseHandle();
if (bp)
{
//
// only clear the cached algorithms
//
getBroadphase()->cleanProxyFromPairs(bp);
getBroadphase()->destroyProxy(bp);
getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(bp,m_dispatcher1);
getBroadphase()->destroyProxy(bp,m_dispatcher1);
collisionObject->setBroadphaseHandle(0);
}
}
@@ -181,172 +218,412 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
btCollisionObject* collisionObject,
const btCollisionShape* collisionShape,
const btTransform& colObjWorldTransform,
RayResultCallback& resultCallback,short int collisionFilterMask)
RayResultCallback& resultCallback)
{
btSphereShape pointShape(btScalar(0.0));
pointShape.setMargin(0.f);
const btConvexShape* castShape = &pointShape;
objectQuerySingle(&pointShape,rayFromTrans,rayToTrans,
collisionObject,
collisionShape,
colObjWorldTransform,
resultCallback,collisionFilterMask);
if (collisionShape->isConvex())
{
btConvexCast::CastResult castResult;
castResult.m_fraction = resultCallback.m_closestHitFraction;
btConvexShape* convexShape = (btConvexShape*) collisionShape;
btVoronoiSimplexSolver simplexSolver;
#define USE_SUBSIMPLEX_CONVEX_CAST 1
#ifdef USE_SUBSIMPLEX_CONVEX_CAST
btSubsimplexConvexCast convexCaster(castShape,convexShape,&simplexSolver);
#else
//btGjkConvexCast convexCaster(castShape,convexShape,&simplexSolver);
//btContinuousConvexCollision convexCaster(castShape,convexShape,&simplexSolver,0);
#endif //#USE_SUBSIMPLEX_CONVEX_CAST
if (convexCaster.calcTimeOfImpact(rayFromTrans,rayToTrans,colObjWorldTransform,colObjWorldTransform,castResult))
{
//add hit
if (castResult.m_normal.length2() > btScalar(0.0001))
{
if (castResult.m_fraction < resultCallback.m_closestHitFraction)
{
#ifdef USE_SUBSIMPLEX_CONVEX_CAST
//rotate normal into worldspace
castResult.m_normal = rayFromTrans.getBasis() * castResult.m_normal;
#endif //USE_SUBSIMPLEX_CONVEX_CAST
castResult.m_normal.normalize();
btCollisionWorld::LocalRayResult localRayResult
(
collisionObject,
0,
castResult.m_normal,
castResult.m_fraction
);
bool normalInWorldSpace = true;
resultCallback.addSingleResult(localRayResult, normalInWorldSpace);
}
}
}
} else {
if (collisionShape->isConcave())
{
if (collisionShape->getShapeType()==TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
///optimized version for btBvhTriangleMeshShape
btBvhTriangleMeshShape* triangleMesh = (btBvhTriangleMeshShape*)collisionShape;
btTransform worldTocollisionObject = colObjWorldTransform.inverse();
btVector3 rayFromLocal = worldTocollisionObject * rayFromTrans.getOrigin();
btVector3 rayToLocal = worldTocollisionObject * rayToTrans.getOrigin();
//ConvexCast::CastResult
struct BridgeTriangleRaycastCallback : public btTriangleRaycastCallback
{
btCollisionWorld::RayResultCallback* m_resultCallback;
btCollisionObject* m_collisionObject;
btTriangleMeshShape* m_triangleMesh;
BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,
btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh):
btTriangleRaycastCallback(from,to),
m_resultCallback(resultCallback),
m_collisionObject(collisionObject),
m_triangleMesh(triangleMesh)
{
}
virtual btScalar reportHit(const btVector3& hitNormalLocal, btScalar hitFraction, int partId, int triangleIndex )
{
btCollisionWorld::LocalShapeInfo shapeInfo;
shapeInfo.m_shapePart = partId;
shapeInfo.m_triangleIndex = triangleIndex;
btCollisionWorld::LocalRayResult rayResult
(m_collisionObject,
&shapeInfo,
hitNormalLocal,
hitFraction);
bool normalInWorldSpace = false;
return m_resultCallback->addSingleResult(rayResult,normalInWorldSpace);
}
};
BridgeTriangleRaycastCallback rcb(rayFromLocal,rayToLocal,&resultCallback,collisionObject,triangleMesh);
rcb.m_hitFraction = resultCallback.m_closestHitFraction;
triangleMesh->performRaycast(&rcb,rayFromLocal,rayToLocal);
} else
{
btTriangleMeshShape* triangleMesh = (btTriangleMeshShape*)collisionShape;
btTransform worldTocollisionObject = colObjWorldTransform.inverse();
btVector3 rayFromLocal = worldTocollisionObject * rayFromTrans.getOrigin();
btVector3 rayToLocal = worldTocollisionObject * rayToTrans.getOrigin();
//ConvexCast::CastResult
struct BridgeTriangleRaycastCallback : public btTriangleRaycastCallback
{
btCollisionWorld::RayResultCallback* m_resultCallback;
btCollisionObject* m_collisionObject;
btTriangleMeshShape* m_triangleMesh;
BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,
btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh):
btTriangleRaycastCallback(from,to),
m_resultCallback(resultCallback),
m_collisionObject(collisionObject),
m_triangleMesh(triangleMesh)
{
}
virtual btScalar reportHit(const btVector3& hitNormalLocal, btScalar hitFraction, int partId, int triangleIndex )
{
btCollisionWorld::LocalShapeInfo shapeInfo;
shapeInfo.m_shapePart = partId;
shapeInfo.m_triangleIndex = triangleIndex;
btCollisionWorld::LocalRayResult rayResult
(m_collisionObject,
&shapeInfo,
hitNormalLocal,
hitFraction);
bool normalInWorldSpace = false;
return m_resultCallback->addSingleResult(rayResult,normalInWorldSpace);
}
};
BridgeTriangleRaycastCallback rcb(rayFromLocal,rayToLocal,&resultCallback,collisionObject,triangleMesh);
rcb.m_hitFraction = resultCallback.m_closestHitFraction;
btVector3 rayAabbMinLocal = rayFromLocal;
rayAabbMinLocal.setMin(rayToLocal);
btVector3 rayAabbMaxLocal = rayFromLocal;
rayAabbMaxLocal.setMax(rayToLocal);
triangleMesh->processAllTriangles(&rcb,rayAabbMinLocal,rayAabbMaxLocal);
}
} else {
//todo: use AABB tree or other BVH acceleration structure!
if (collisionShape->isCompound())
{
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(collisionShape);
int i=0;
for (i=0;i<compoundShape->getNumChildShapes();i++)
{
btTransform childTrans = compoundShape->getChildTransform(i);
const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
btTransform childWorldTrans = colObjWorldTransform * childTrans;
// replace collision shape so that callback can determine the triangle
btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
collisionObject->internalSetTemporaryCollisionShape((btCollisionShape*)childCollisionShape);
rayTestSingle(rayFromTrans,rayToTrans,
collisionObject,
childCollisionShape,
childWorldTrans,
resultCallback);
// restore
collisionObject->internalSetTemporaryCollisionShape(saveCollisionShape);
}
}
}
}
}
void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const btTransform& rayFromTrans,const btTransform& rayToTrans,
void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const btTransform& convexFromTrans,const btTransform& convexToTrans,
btCollisionObject* collisionObject,
const btCollisionShape* collisionShape,
const btTransform& colObjWorldTransform,
RayResultCallback& resultCallback,short int collisionFilterMask)
ConvexResultCallback& resultCallback, btScalar allowedPenetration)
{
if (collisionShape->isConvex())
{
btConvexCast::CastResult castResult;
castResult.m_allowedPenetration = allowedPenetration;
castResult.m_fraction = btScalar(1.);//??
btConvexShape* convexShape = (btConvexShape*) collisionShape;
btVoronoiSimplexSolver simplexSolver;
btGjkEpaPenetrationDepthSolver gjkEpaPenetrationSolver;
btContinuousConvexCollision convexCaster1(castShape,convexShape,&simplexSolver,&gjkEpaPenetrationSolver);
//btGjkConvexCast convexCaster2(castShape,convexShape,&simplexSolver);
//btSubsimplexConvexCast convexCaster3(castShape,convexShape,&simplexSolver);
btConvexCast* castPtr = &convexCaster1;
if (castPtr->calcTimeOfImpact(convexFromTrans,convexToTrans,colObjWorldTransform,colObjWorldTransform,castResult))
{
//add hit
if (castResult.m_normal.length2() > btScalar(0.0001))
{
btConvexCast::CastResult castResult;
castResult.m_fraction = btScalar(1.);//??
btConvexShape* convexShape = (btConvexShape*) collisionShape;
btVoronoiSimplexSolver simplexSolver;
btSubsimplexConvexCast convexCaster(castShape,convexShape,&simplexSolver);
//GjkConvexCast convexCaster(castShape,convexShape,&simplexSolver);
//ContinuousConvexCollision convexCaster(castShape,convexShape,&simplexSolver,0);
if (convexCaster.calcTimeOfImpact(rayFromTrans,rayToTrans,colObjWorldTransform,colObjWorldTransform,castResult))
if (castResult.m_fraction < resultCallback.m_closestHitFraction)
{
//add hit
if (castResult.m_normal.length2() > btScalar(0.0001))
{
castResult.m_normal.normalize();
if (castResult.m_fraction < resultCallback.m_closestHitFraction)
{
btCollisionWorld::LocalRayResult localRayResult
castResult.m_normal.normalize();
btCollisionWorld::LocalConvexResult localConvexResult
(
collisionObject,
collisionObject,
0,
castResult.m_normal,
castResult.m_hitPoint,
castResult.m_fraction
);
resultCallback.AddSingleResult(localRayResult);
bool normalInWorldSpace = true;
resultCallback.addSingleResult(localConvexResult, normalInWorldSpace);
}
}
}
}
else
}
} else {
if (collisionShape->isConcave())
{
if (collisionShape->getShapeType()==TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
if (collisionShape->isConcave())
{
btBvhTriangleMeshShape* triangleMesh = (btBvhTriangleMeshShape*)collisionShape;
btTransform worldTocollisionObject = colObjWorldTransform.inverse();
btVector3 convexFromLocal = worldTocollisionObject * convexFromTrans.getOrigin();
btVector3 convexToLocal = worldTocollisionObject * convexToTrans.getOrigin();
// rotation of box in local mesh space = MeshRotation^-1 * ConvexToRotation
btTransform rotationXform = btTransform(worldTocollisionObject.getBasis() * convexToTrans.getBasis());
btTriangleMeshShape* triangleMesh = (btTriangleMeshShape*)collisionShape;
btTransform worldTocollisionObject = colObjWorldTransform.inverse();
//ConvexCast::CastResult
struct BridgeTriangleConvexcastCallback : public btTriangleConvexcastCallback
{
btCollisionWorld::ConvexResultCallback* m_resultCallback;
btCollisionObject* m_collisionObject;
btTriangleMeshShape* m_triangleMesh;
btVector3 rayFromLocal = worldTocollisionObject * rayFromTrans.getOrigin();
btVector3 rayToLocal = worldTocollisionObject * rayToTrans.getOrigin();
//ConvexCast::CastResult
struct BridgeTriangleRaycastCallback : public btTriangleRaycastCallback
BridgeTriangleConvexcastCallback(const btConvexShape* castShape, const btTransform& from,const btTransform& to,
btCollisionWorld::ConvexResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh, const btTransform& triangleToWorld):
btTriangleConvexcastCallback(castShape, from,to, triangleToWorld, triangleMesh->getMargin()),
m_resultCallback(resultCallback),
m_collisionObject(collisionObject),
m_triangleMesh(triangleMesh)
{
btCollisionWorld::RayResultCallback* m_resultCallback;
btCollisionObject* m_collisionObject;
btTriangleMeshShape* m_triangleMesh;
BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,
btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh):
btTriangleRaycastCallback(from,to),
m_resultCallback(resultCallback),
m_collisionObject(collisionObject),
m_triangleMesh(triangleMesh)
{
}
virtual btScalar reportHit(const btVector3& hitNormalLocal, btScalar hitFraction, int partId, int triangleIndex )
{
btCollisionWorld::LocalShapeInfo shapeInfo;
shapeInfo.m_shapePart = partId;
shapeInfo.m_triangleIndex = triangleIndex;
btCollisionWorld::LocalRayResult rayResult
(m_collisionObject,
&shapeInfo,
hitNormalLocal,
hitFraction);
return m_resultCallback->AddSingleResult(rayResult);
}
};
BridgeTriangleRaycastCallback rcb(rayFromLocal,rayToLocal,&resultCallback,collisionObject,triangleMesh);
rcb.m_hitFraction = resultCallback.m_closestHitFraction;
btVector3 rayAabbMinLocal = rayFromLocal;
rayAabbMinLocal.setMin(rayToLocal);
btVector3 rayAabbMaxLocal = rayFromLocal;
rayAabbMaxLocal.setMax(rayToLocal);
triangleMesh->processAllTriangles(&rcb,rayAabbMinLocal,rayAabbMaxLocal);
} else
{
//todo: use AABB tree or other BVH acceleration structure!
if (collisionShape->isCompound())
{
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(collisionShape);
int i=0;
for (i=0;i<compoundShape->getNumChildShapes();i++)
{
btTransform childTrans = compoundShape->getChildTransform(i);
const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
btTransform childWorldTrans = colObjWorldTransform * childTrans;
objectQuerySingle(castShape, rayFromTrans,rayToTrans,
collisionObject,
childCollisionShape,
childWorldTrans,
resultCallback, collisionFilterMask);
}
}
virtual btScalar reportHit(const btVector3& hitNormalLocal, const btVector3& hitPointLocal, btScalar hitFraction, int partId, int triangleIndex )
{
btCollisionWorld::LocalShapeInfo shapeInfo;
shapeInfo.m_shapePart = partId;
shapeInfo.m_triangleIndex = triangleIndex;
if (hitFraction <= m_resultCallback->m_closestHitFraction)
{
btCollisionWorld::LocalConvexResult convexResult
(m_collisionObject,
&shapeInfo,
hitNormalLocal,
hitPointLocal,
hitFraction);
bool normalInWorldSpace = true;
return m_resultCallback->addSingleResult(convexResult,normalInWorldSpace);
}
return hitFraction;
}
};
BridgeTriangleConvexcastCallback tccb(castShape, convexFromTrans,convexToTrans,&resultCallback,collisionObject,triangleMesh, colObjWorldTransform);
tccb.m_hitFraction = resultCallback.m_closestHitFraction;
btVector3 boxMinLocal, boxMaxLocal;
castShape->getAabb(rotationXform, boxMinLocal, boxMaxLocal);
triangleMesh->performConvexcast(&tccb,convexFromLocal,convexToLocal,boxMinLocal, boxMaxLocal);
} else
{
btBvhTriangleMeshShape* triangleMesh = (btBvhTriangleMeshShape*)collisionShape;
btTransform worldTocollisionObject = colObjWorldTransform.inverse();
btVector3 convexFromLocal = worldTocollisionObject * convexFromTrans.getOrigin();
btVector3 convexToLocal = worldTocollisionObject * convexToTrans.getOrigin();
// rotation of box in local mesh space = MeshRotation^-1 * ConvexToRotation
btTransform rotationXform = btTransform(worldTocollisionObject.getBasis() * convexToTrans.getBasis());
//ConvexCast::CastResult
struct BridgeTriangleConvexcastCallback : public btTriangleConvexcastCallback
{
btCollisionWorld::ConvexResultCallback* m_resultCallback;
btCollisionObject* m_collisionObject;
btTriangleMeshShape* m_triangleMesh;
BridgeTriangleConvexcastCallback(const btConvexShape* castShape, const btTransform& from,const btTransform& to,
btCollisionWorld::ConvexResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh, const btTransform& triangleToWorld):
btTriangleConvexcastCallback(castShape, from,to, triangleToWorld, triangleMesh->getMargin()),
m_resultCallback(resultCallback),
m_collisionObject(collisionObject),
m_triangleMesh(triangleMesh)
{
}
virtual btScalar reportHit(const btVector3& hitNormalLocal, const btVector3& hitPointLocal, btScalar hitFraction, int partId, int triangleIndex )
{
btCollisionWorld::LocalShapeInfo shapeInfo;
shapeInfo.m_shapePart = partId;
shapeInfo.m_triangleIndex = triangleIndex;
if (hitFraction <= m_resultCallback->m_closestHitFraction)
{
btCollisionWorld::LocalConvexResult convexResult
(m_collisionObject,
&shapeInfo,
hitNormalLocal,
hitPointLocal,
hitFraction);
bool normalInWorldSpace = false;
return m_resultCallback->addSingleResult(convexResult,normalInWorldSpace);
}
return hitFraction;
}
};
BridgeTriangleConvexcastCallback tccb(castShape, convexFromTrans,convexToTrans,&resultCallback,collisionObject,triangleMesh, colObjWorldTransform);
tccb.m_hitFraction = resultCallback.m_closestHitFraction;
btVector3 boxMinLocal, boxMaxLocal;
castShape->getAabb(rotationXform, boxMinLocal, boxMaxLocal);
btVector3 rayAabbMinLocal = convexFromLocal;
rayAabbMinLocal.setMin(convexToLocal);
btVector3 rayAabbMaxLocal = convexFromLocal;
rayAabbMaxLocal.setMax(convexToLocal);
rayAabbMinLocal += boxMinLocal;
rayAabbMaxLocal += boxMaxLocal;
triangleMesh->processAllTriangles(&tccb,rayAabbMinLocal,rayAabbMaxLocal);
}
} else {
//todo: use AABB tree or other BVH acceleration structure!
if (collisionShape->isCompound())
{
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(collisionShape);
int i=0;
for (i=0;i<compoundShape->getNumChildShapes();i++)
{
btTransform childTrans = compoundShape->getChildTransform(i);
const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
btTransform childWorldTrans = colObjWorldTransform * childTrans;
// replace collision shape so that callback can determine the triangle
btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
collisionObject->internalSetTemporaryCollisionShape((btCollisionShape*)childCollisionShape);
objectQuerySingle(castShape, convexFromTrans,convexToTrans,
collisionObject,
childCollisionShape,
childWorldTrans,
resultCallback, allowedPenetration);
// restore
collisionObject->internalSetTemporaryCollisionShape(saveCollisionShape);
}
}
}
}
}
void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback,short int collisionFilterMask)
void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const
{
btTransform rayFromTrans,rayToTrans;
rayFromTrans.setIdentity();
rayFromTrans.setOrigin(rayFromWorld);
rayToTrans.setIdentity();
rayToTrans.setOrigin(rayToWorld);
/// go over all objects, and if the ray intersects their aabb, do a ray-shape query using convexCaster (CCD)
int i;
for (i=0;i<m_collisionObjects.size();i++)
{
///terminate further ray tests, once the closestHitFraction reached zero
if (resultCallback.m_closestHitFraction == btScalar(0.f))
break;
btCollisionObject* collisionObject= m_collisionObjects[i];
//only perform raycast if filterMask matches
if(collisionObject->getBroadphaseHandle()->m_collisionFilterGroup & collisionFilterMask) {
if(resultCallback.needsCollision(collisionObject->getBroadphaseHandle())) {
//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax);
btScalar hitLambda = btScalar(1.); //could use resultCallback.m_closestHitFraction, but needs testing
btScalar hitLambda = resultCallback.m_closestHitFraction;
btVector3 hitNormal;
if (btRayAabb(rayFromWorld,rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,hitNormal))
{
@@ -355,7 +632,52 @@ void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& r
collisionObject->getCollisionShape(),
collisionObject->getWorldTransform(),
resultCallback);
}
}
}
}
}
void btCollisionWorld::convexSweepTest(const btConvexShape* castShape, const btTransform& convexFromWorld, const btTransform& convexToWorld, ConvexResultCallback& resultCallback) const
{
btTransform convexFromTrans,convexToTrans;
convexFromTrans = convexFromWorld;
convexToTrans = convexToWorld;
btVector3 castShapeAabbMin, castShapeAabbMax;
/* Compute AABB that encompasses angular movement */
{
btVector3 linVel, angVel;
btTransformUtil::calculateVelocity (convexFromTrans, convexToTrans, 1.0, linVel, angVel);
btTransform R;
R.setIdentity ();
R.setRotation (convexFromTrans.getRotation());
castShape->calculateTemporalAabb (R, linVel, angVel, 1.0, castShapeAabbMin, castShapeAabbMax);
}
/// go over all objects, and if the ray intersects their aabb + cast shape aabb,
// do a ray-shape query using convexCaster (CCD)
int i;
for (i=0;i<m_collisionObjects.size();i++)
{
btCollisionObject* collisionObject= m_collisionObjects[i];
//only perform raycast if filterMask matches
if(resultCallback.needsCollision(collisionObject->getBroadphaseHandle())) {
//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax);
AabbExpand (collisionObjectAabbMin, collisionObjectAabbMax, castShapeAabbMin, castShapeAabbMax);
btScalar hitLambda = btScalar(1.); //could use resultCallback.m_closestHitFraction, but needs testing
btVector3 hitNormal;
if (btRayAabb(convexFromWorld.getOrigin(),convexToWorld.getOrigin(),collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,hitNormal))
{
objectQuerySingle(castShape, convexFromTrans,convexToTrans,
collisionObject,
collisionObject->getCollisionShape(),
collisionObject->getWorldTransform(),
resultCallback,
getDispatchInfo().m_allowedCcdPenetration);
}
}
}

View File

@@ -68,12 +68,12 @@ class btStackAlloc;
class btCollisionShape;
class btConvexShape;
class btBroadphaseInterface;
#include "../../LinearMath/btVector3.h"
#include "../../LinearMath/btTransform.h"
#include "LinearMath/btVector3.h"
#include "LinearMath/btTransform.h"
#include "btCollisionObject.h"
#include "btCollisionDispatcher.h" //for definition of btCollisionObjectArray
#include "../BroadphaseCollision/btOverlappingPairCache.h"
#include "../../LinearMath/btAlignedObjectArray.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
#include "LinearMath/btAlignedObjectArray.h"
///CollisionWorld is interface and container for the collision detection
class btCollisionWorld
@@ -90,18 +90,22 @@ protected:
btStackAlloc* m_stackAlloc;
btOverlappingPairCache* m_broadphasePairCache;
bool m_ownsDispatcher;
bool m_ownsBroadphasePairCache;
btBroadphaseInterface* m_broadphasePairCache;
btIDebugDraw* m_debugDrawer;
public:
//this constructor doesn't own the dispatcher and paircache/broadphase
btCollisionWorld(btDispatcher* dispatcher,btOverlappingPairCache* pairCache, int stackSize = 2*1024*1024);
btCollisionWorld(btDispatcher* dispatcher,btBroadphaseInterface* broadphasePairCache, btCollisionConfiguration* collisionConfiguration);
virtual ~btCollisionWorld();
void setBroadphase(btBroadphaseInterface* pairCache)
{
m_broadphasePairCache = pairCache;
}
btBroadphaseInterface* getBroadphase()
{
@@ -110,7 +114,7 @@ public:
btOverlappingPairCache* getPairCache()
{
return m_broadphasePairCache;
return m_broadphasePairCache->getOverlappingPairCache();
}
@@ -119,6 +123,24 @@ public:
return m_dispatcher1;
}
const btDispatcher* getDispatcher() const
{
return m_dispatcher1;
}
virtual void updateAabbs();
virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
{
m_debugDrawer = debugDrawer;
}
virtual btIDebugDraw* getDebugDrawer()
{
return m_debugDrawer;
}
///LocalShapeInfo gives extra information for complex shapes
///Currently, only btTriangleMeshShape is available, so it just contains triangleIndex and subpart
struct LocalShapeInfo
@@ -153,28 +175,43 @@ public:
///RayResultCallback is used to report new raycast results
struct RayResultCallback
{
btScalar m_closestHitFraction;
btCollisionObject* m_collisionObject;
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
virtual ~RayResultCallback()
{
}
btScalar m_closestHitFraction;
bool HasHit()
bool hasHit() const
{
return (m_closestHitFraction < btScalar(1.));
return (m_collisionObject != 0);
}
RayResultCallback()
:m_closestHitFraction(btScalar(1.))
:m_closestHitFraction(btScalar(1.)),
m_collisionObject(0),
m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter)
{
}
virtual btScalar AddSingleResult(LocalRayResult& rayResult) = 0;
virtual bool needsCollision(btBroadphaseProxy* proxy0) const
{
bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
return collides;
}
virtual btScalar addSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace) = 0;
};
struct ClosestRayResultCallback : public RayResultCallback
{
ClosestRayResultCallback(const btVector3& rayFromWorld,const btVector3& rayToWorld)
:m_rayFromWorld(rayFromWorld),
m_rayToWorld(rayToWorld),
m_collisionObject(0)
m_rayToWorld(rayToWorld)
{
}
@@ -183,24 +220,121 @@ public:
btVector3 m_hitNormalWorld;
btVector3 m_hitPointWorld;
btCollisionObject* m_collisionObject;
virtual btScalar AddSingleResult(LocalRayResult& rayResult)
virtual btScalar addSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace)
{
//caller already does the filter on the m_closestHitFraction
assert(rayResult.m_hitFraction <= m_closestHitFraction);
//caller already does the filter on the m_closestHitFraction
btAssert(rayResult.m_hitFraction <= m_closestHitFraction);
m_closestHitFraction = rayResult.m_hitFraction;
m_collisionObject = rayResult.m_collisionObject;
m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal;
if (normalInWorldSpace)
{
m_hitNormalWorld = rayResult.m_hitNormalLocal;
} else
{
///need to transform normal into worldspace
m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal;
}
m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction);
return rayResult.m_hitFraction;
}
};
struct LocalConvexResult
{
LocalConvexResult(btCollisionObject* hitCollisionObject,
LocalShapeInfo* localShapeInfo,
const btVector3& hitNormalLocal,
const btVector3& hitPointLocal,
btScalar hitFraction
)
:m_hitCollisionObject(hitCollisionObject),
m_localShapeInfo(localShapeInfo),
m_hitNormalLocal(hitNormalLocal),
m_hitPointLocal(hitPointLocal),
m_hitFraction(hitFraction)
{
}
btCollisionObject* m_hitCollisionObject;
LocalShapeInfo* m_localShapeInfo;
btVector3 m_hitNormalLocal;
btVector3 m_hitPointLocal;
btScalar m_hitFraction;
};
///RayResultCallback is used to report new raycast results
struct ConvexResultCallback
{
btScalar m_closestHitFraction;
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
ConvexResultCallback()
:m_closestHitFraction(btScalar(1.)),
m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter)
{
}
virtual ~ConvexResultCallback()
{
}
bool hasHit() const
{
return (m_closestHitFraction < btScalar(1.));
}
virtual bool needsCollision(btBroadphaseProxy* proxy0) const
{
bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
return collides;
}
virtual btScalar addSingleResult(LocalConvexResult& convexResult,bool normalInWorldSpace) = 0;
};
struct ClosestConvexResultCallback : public ConvexResultCallback
{
ClosestConvexResultCallback(const btVector3& convexFromWorld,const btVector3& convexToWorld)
:m_convexFromWorld(convexFromWorld),
m_convexToWorld(convexToWorld),
m_hitCollisionObject(0)
{
}
btVector3 m_convexFromWorld;//used to calculate hitPointWorld from hitFraction
btVector3 m_convexToWorld;
btVector3 m_hitNormalWorld;
btVector3 m_hitPointWorld;
btCollisionObject* m_hitCollisionObject;
virtual btScalar addSingleResult(LocalConvexResult& convexResult,bool normalInWorldSpace)
{
//caller already does the filter on the m_closestHitFraction
btAssert(convexResult.m_hitFraction <= m_closestHitFraction);
m_closestHitFraction = convexResult.m_hitFraction;
m_hitCollisionObject = convexResult.m_hitCollisionObject;
if (normalInWorldSpace)
{
m_hitNormalWorld = convexResult.m_hitNormalLocal;
} else
{
///need to transform normal into worldspace
m_hitNormalWorld = m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;
}
m_hitPointWorld = convexResult.m_hitPointLocal;
return convexResult.m_hitFraction;
}
};
int getNumCollisionObjects() const
{
@@ -209,7 +343,12 @@ public:
/// rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback
/// This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback.
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback, short int collisionFilterMask=-1);
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const;
// convexTest performs a swept convex cast on all objects in the btCollisionWorld, and calls the resultCallback
// This allows for several queries: first hit, all hits, any hit, dependent on the value return by the callback.
void convexSweepTest (const btConvexShape* castShape, const btTransform& from, const btTransform& to, ConvexResultCallback& resultCallback) const;
/// rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest.
/// In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape.
@@ -218,16 +357,16 @@ public:
btCollisionObject* collisionObject,
const btCollisionShape* collisionShape,
const btTransform& colObjWorldTransform,
RayResultCallback& resultCallback, short int collisionFilterMask=-1);
RayResultCallback& resultCallback);
/// objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest.
static void objectQuerySingle(const btConvexShape* castShape, const btTransform& rayFromTrans,const btTransform& rayToTrans,
btCollisionObject* collisionObject,
const btCollisionShape* collisionShape,
const btTransform& colObjWorldTransform,
RayResultCallback& resultCallback, short int collisionFilterMask=-1);
ConvexResultCallback& resultCallback, btScalar allowedPenetration);
void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=1,short int collisionFilterMask=1);
void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter);
btCollisionObjectArray& getCollisionObjectArray()
{
@@ -249,6 +388,11 @@ public:
return m_dispatchInfo;
}
const btDispatcherInfo& getDispatchInfo() const
{
return m_dispatchInfo;
}
};

View File

@@ -16,11 +16,17 @@ subject to the following restrictions:
#include "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletCollision/BroadphaseCollision/btDbvt.h"
#include "LinearMath/btIDebugDraw.h"
#include "LinearMath/btAabbUtil2.h"
btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped)
:m_isSwapped(isSwapped)
:btCollisionAlgorithm(ci),
m_isSwapped(isSwapped),
m_sharedManifold(ci.m_manifold)
{
m_ownsManifold = false;
btCollisionObject* colObj = m_isSwapped? body1 : body0;
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
assert (colObj->getCollisionShape()->isCompound());
@@ -32,11 +38,17 @@ btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlg
m_childCollisionAlgorithms.resize(numChildren);
for (i=0;i<numChildren;i++)
{
btCollisionShape* childShape = compoundShape->getChildShape(i);
btCollisionShape* orgShape = colObj->getCollisionShape();
colObj->setCollisionShape( childShape );
m_childCollisionAlgorithms[i] = ci.m_dispatcher->findAlgorithm(colObj,otherObj);
colObj->setCollisionShape( orgShape );
if (compoundShape->getDynamicAabbTree())
{
m_childCollisionAlgorithms[i] = 0;
} else
{
btCollisionShape* tmpShape = colObj->getCollisionShape();
btCollisionShape* childShape = compoundShape->getChildShape(i);
colObj->internalSetTemporaryCollisionShape( childShape );
m_childCollisionAlgorithms[i] = ci.m_dispatcher1->findAlgorithm(colObj,otherObj,m_sharedManifold);
colObj->internalSetTemporaryCollisionShape( tmpShape );
}
}
}
@@ -47,10 +59,109 @@ btCompoundCollisionAlgorithm::~btCompoundCollisionAlgorithm()
int i;
for (i=0;i<numChildren;i++)
{
delete m_childCollisionAlgorithms[i];
if (m_childCollisionAlgorithms[i])
{
m_childCollisionAlgorithms[i]->~btCollisionAlgorithm();
m_dispatcher->freeCollisionAlgorithm(m_childCollisionAlgorithms[i]);
}
}
}
struct btCompoundLeafCallback : btDbvt::ICollide
{
public:
btCollisionObject* m_compoundColObj;
btCollisionObject* m_otherObj;
btDispatcher* m_dispatcher;
const btDispatcherInfo& m_dispatchInfo;
btManifoldResult* m_resultOut;
btCollisionAlgorithm** m_childCollisionAlgorithms;
btPersistentManifold* m_sharedManifold;
btCompoundLeafCallback (btCollisionObject* compoundObj,btCollisionObject* otherObj,btDispatcher* dispatcher,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut,btCollisionAlgorithm** childCollisionAlgorithms,btPersistentManifold* sharedManifold)
:m_compoundColObj(compoundObj),m_otherObj(otherObj),m_dispatcher(dispatcher),m_dispatchInfo(dispatchInfo),m_resultOut(resultOut),
m_childCollisionAlgorithms(childCollisionAlgorithms),
m_sharedManifold(sharedManifold)
{
}
void ProcessChildShape(btCollisionShape* childShape,int index)
{
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(m_compoundColObj->getCollisionShape());
//backup
btTransform orgTrans = m_compoundColObj->getWorldTransform();
btTransform orgInterpolationTrans = m_compoundColObj->getInterpolationWorldTransform();
const btTransform& childTrans = compoundShape->getChildTransform(index);
btTransform newChildWorldTrans = orgTrans*childTrans ;
//perform an AABB check first
btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1;
childShape->getAabb(newChildWorldTrans,aabbMin0,aabbMax0);
m_otherObj->getCollisionShape()->getAabb(m_otherObj->getWorldTransform(),aabbMin1,aabbMax1);
if (TestAabbAgainstAabb2(aabbMin0,aabbMax0,aabbMin1,aabbMax1))
{
m_compoundColObj->setWorldTransform( newChildWorldTrans);
m_compoundColObj->setInterpolationWorldTransform(newChildWorldTrans);
//the contactpoint is still projected back using the original inverted worldtrans
btCollisionShape* tmpShape = m_compoundColObj->getCollisionShape();
m_compoundColObj->internalSetTemporaryCollisionShape( childShape );
if (!m_childCollisionAlgorithms[index])
m_childCollisionAlgorithms[index] = m_dispatcher->findAlgorithm(m_compoundColObj,m_otherObj,m_sharedManifold);
m_childCollisionAlgorithms[index]->processCollision(m_compoundColObj,m_otherObj,m_dispatchInfo,m_resultOut);
if (m_dispatchInfo.m_debugDraw && (m_dispatchInfo.m_debugDraw->getDebugMode() & btIDebugDraw::DBG_DrawAabb))
{
btVector3 worldAabbMin,worldAabbMax;
m_dispatchInfo.m_debugDraw->drawAabb(aabbMin0,aabbMax0,btVector3(1,1,1));
m_dispatchInfo.m_debugDraw->drawAabb(aabbMin1,aabbMax1,btVector3(1,1,1));
}
//revert back transform
m_compoundColObj->internalSetTemporaryCollisionShape( tmpShape);
m_compoundColObj->setWorldTransform( orgTrans );
m_compoundColObj->setInterpolationWorldTransform(orgInterpolationTrans);
}
}
void Process(const btDbvtNode* leaf)
{
int index = leaf->dataAsInt;
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(m_compoundColObj->getCollisionShape());
btCollisionShape* childShape = compoundShape->getChildShape(index);
if (m_dispatchInfo.m_debugDraw && (m_dispatchInfo.m_debugDraw->getDebugMode() & btIDebugDraw::DBG_DrawAabb))
{
btVector3 worldAabbMin,worldAabbMax;
btTransform orgTrans = m_compoundColObj->getWorldTransform();
btTransformAabb(leaf->volume.Mins(),leaf->volume.Maxs(),0.,orgTrans,worldAabbMin,worldAabbMax);
m_dispatchInfo.m_debugDraw->drawAabb(worldAabbMin,worldAabbMax,btVector3(1,0,0));
}
ProcessChildShape(childShape,index);
}
};
void btCompoundCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
{
btCollisionObject* colObj = m_isSwapped? body1 : body0;
@@ -59,33 +170,69 @@ void btCompoundCollisionAlgorithm::processCollision (btCollisionObject* body0,bt
assert (colObj->getCollisionShape()->isCompound());
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
//We will use the OptimizedBVH, AABB tree to cull potential child-overlaps
//If both proxies are Compound, we will deal with that directly, by performing sequential/parallel tree traversals
//given Proxy0 and Proxy1, if both have a tree, Tree0 and Tree1, this means:
//determine overlapping nodes of Proxy1 using Proxy0 AABB against Tree1
//then use each overlapping node AABB against Tree0
//and vise versa.
btDbvt* tree = compoundShape->getDynamicAabbTree();
//use a dynamic aabb tree to cull potential child-overlaps
btCompoundLeafCallback callback(colObj,otherObj,m_dispatcher,dispatchInfo,resultOut,&m_childCollisionAlgorithms[0],m_sharedManifold);
int numChildren = m_childCollisionAlgorithms.size();
int i;
for (i=0;i<numChildren;i++)
if (tree)
{
//temporarily exchange parent btCollisionShape with childShape, and recurse
btCollisionShape* childShape = compoundShape->getChildShape(i);
//backup
btTransform orgTrans = colObj->getWorldTransform();
btCollisionShape* orgShape = colObj->getCollisionShape();
btVector3 localAabbMin,localAabbMax;
btTransform otherInCompoundSpace;
otherInCompoundSpace = colObj->getWorldTransform().inverse() * otherObj->getWorldTransform();
otherObj->getCollisionShape()->getAabb(otherInCompoundSpace,localAabbMin,localAabbMax);
const ATTRIBUTE_ALIGNED16(btDbvtVolume) bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
//process all children, that overlap with the given AABB bounds
tree->collideTV(tree->m_root,bounds,callback);
} else
{
//iterate over all children, perform an AABB check inside ProcessChildShape
int numChildren = m_childCollisionAlgorithms.size();
int i;
for (i=0;i<numChildren;i++)
{
callback.ProcessChildShape(compoundShape->getChildShape(i),i);
}
}
{
//iterate over all children, perform an AABB check inside ProcessChildShape
int numChildren = m_childCollisionAlgorithms.size();
int i;
btManifoldArray manifoldArray;
for (i=0;i<numChildren;i++)
{
if (m_childCollisionAlgorithms[i])
{
btCollisionShape* childShape = compoundShape->getChildShape(i);
//if not longer overlapping, remove the algorithm
btTransform orgTrans = colObj->getWorldTransform();
btTransform orgInterpolationTrans = colObj->getInterpolationWorldTransform();
const btTransform& childTrans = compoundShape->getChildTransform(i);
btTransform newChildWorldTrans = orgTrans*childTrans ;
//perform an AABB check first
btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1;
childShape->getAabb(newChildWorldTrans,aabbMin0,aabbMax0);
otherObj->getCollisionShape()->getAabb(otherObj->getWorldTransform(),aabbMin1,aabbMax1);
if (!TestAabbAgainstAabb2(aabbMin0,aabbMax0,aabbMin1,aabbMax1))
{
m_childCollisionAlgorithms[i]->~btCollisionAlgorithm();
m_dispatcher->freeCollisionAlgorithm(m_childCollisionAlgorithms[i]);
m_childCollisionAlgorithms[i] = 0;
}
}
}
const btTransform& childTrans = compoundShape->getChildTransform(i);
//btTransform newChildWorldTrans = orgTrans*childTrans ;
colObj->setWorldTransform( orgTrans*childTrans );
//the contactpoint is still projected back using the original inverted worldtrans
colObj->setCollisionShape( childShape );
m_childCollisionAlgorithms[i]->processCollision(colObj,otherObj,dispatchInfo,resultOut);
//revert back
colObj->setCollisionShape( orgShape);
colObj->setWorldTransform( orgTrans );
}
}
@@ -117,20 +264,20 @@ btScalar btCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject*
//backup
btTransform orgTrans = colObj->getWorldTransform();
btCollisionShape* orgShape = colObj->getCollisionShape();
const btTransform& childTrans = compoundShape->getChildTransform(i);
//btTransform newChildWorldTrans = orgTrans*childTrans ;
colObj->setWorldTransform( orgTrans*childTrans );
colObj->setCollisionShape( childShape );
btCollisionShape* tmpShape = colObj->getCollisionShape();
colObj->internalSetTemporaryCollisionShape( childShape );
btScalar frac = m_childCollisionAlgorithms[i]->calculateTimeOfImpact(colObj,otherObj,dispatchInfo,resultOut);
if (frac<hitFraction)
{
hitFraction = frac;
}
//revert back
colObj->setCollisionShape( orgShape);
colObj->internalSetTemporaryCollisionShape( tmpShape);
colObj->setWorldTransform( orgTrans);
}
return hitFraction;

View File

@@ -16,22 +16,25 @@ subject to the following restrictions:
#ifndef COMPOUND_COLLISION_ALGORITHM_H
#define COMPOUND_COLLISION_ALGORITHM_H
#include "../BroadphaseCollision/btCollisionAlgorithm.h"
#include "../BroadphaseCollision/btDispatcher.h"
#include "../BroadphaseCollision/btBroadphaseInterface.h"
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
#include "../NarrowPhaseCollision/btPersistentManifold.h"
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
class btDispatcher;
#include "../BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "btCollisionCreateFunc.h"
#include "../../LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btAlignedObjectArray.h"
class btDispatcher;
/// btCompoundCollisionAlgorithm supports collision between CompoundCollisionShapes and other collision shapes
/// Place holder, not fully implemented yet
class btCompoundCollisionAlgorithm : public btCollisionAlgorithm
{
btAlignedObjectArray<btCollisionAlgorithm*> m_childCollisionAlgorithms;
bool m_isSwapped;
class btPersistentManifold* m_sharedManifold;
bool m_ownsManifold;
public:
@@ -43,11 +46,22 @@ public:
btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
{
int i;
for (i=0;i<m_childCollisionAlgorithms.size();i++)
{
if (m_childCollisionAlgorithms[i])
m_childCollisionAlgorithms[i]->getAllContactManifolds(manifoldArray);
}
}
struct CreateFunc :public btCollisionAlgorithmCreateFunc
{
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
{
return new btCompoundCollisionAlgorithm(ci,body0,body1,false);
void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btCompoundCollisionAlgorithm));
return new(mem) btCompoundCollisionAlgorithm(ci,body0,body1,false);
}
};
@@ -55,7 +69,8 @@ public:
{
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
{
return new btCompoundCollisionAlgorithm(ci,body0,body1,true);
void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btCompoundCollisionAlgorithm));
return new(mem) btCompoundCollisionAlgorithm(ci,body0,body1,true);
}
};

View File

@@ -29,7 +29,7 @@ subject to the following restrictions:
btConvexConcaveCollisionAlgorithm::btConvexConcaveCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1,bool isSwapped)
: btCollisionAlgorithm(ci),
m_isSwapped(isSwapped),
m_btConvexTriangleCallback(ci.m_dispatcher,body0,body1,isSwapped)
m_btConvexTriangleCallback(ci.m_dispatcher1,body0,body1,isSwapped)
{
}
@@ -37,6 +37,13 @@ btConvexConcaveCollisionAlgorithm::~btConvexConcaveCollisionAlgorithm()
{
}
void btConvexConcaveCollisionAlgorithm::getAllContactManifolds(btManifoldArray& manifoldArray)
{
if (m_btConvexTriangleCallback.m_manifoldPtr)
{
manifoldArray.push_back(m_btConvexTriangleCallback.m_manifoldPtr);
}
}
btConvexTriangleCallback::btConvexTriangleCallback(btDispatcher* dispatcher,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped):
@@ -79,7 +86,7 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i
//aabb filter is already applied!
btCollisionAlgorithmConstructionInfo ci;
ci.m_dispatcher = m_dispatcher;
ci.m_dispatcher1 = m_dispatcher;
btCollisionObject* ob = static_cast<btCollisionObject*>(m_triBody);
@@ -109,13 +116,11 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i
{
btTriangleShape tm(triangle[0],triangle[1],triangle[2]);
tm.setMargin(m_collisionMarginTriangle);
btCollisionShape* tmpShape = ob->getCollisionShape();
ob->setCollisionShape( &tm );
ob->internalSetTemporaryCollisionShape( &tm );
btCollisionAlgorithm* colAlgo = ci.m_dispatcher->findAlgorithm(m_convexBody,m_triBody,m_manifoldPtr);
btCollisionAlgorithm* colAlgo = ci.m_dispatcher1->findAlgorithm(m_convexBody,m_triBody,m_manifoldPtr);
///this should use the btDispatcher, so the actual registered algorithm is used
// btConvexConvexAlgorithm cvxcvxalgo(m_manifoldPtr,ci,m_convexBody,m_triBody);
@@ -123,12 +128,11 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i
// cvxcvxalgo.setShapeIdentifiers(-1,-1,partId,triangleIndex);
// cvxcvxalgo.processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
colAlgo->processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
delete colAlgo;
ob->setCollisionShape( tmpShape );
colAlgo->~btCollisionAlgorithm();
ci.m_dispatcher1->freeCollisionAlgorithm(colAlgo);
ob->internalSetTemporaryCollisionShape( tmpShape);
}
}
@@ -188,9 +192,10 @@ void btConvexConcaveCollisionAlgorithm::processCollision (btCollisionObject* bod
concaveShape->processAllTriangles( &m_btConvexTriangleCallback,m_btConvexTriangleCallback.getAabbMin(),m_btConvexTriangleCallback.getAabbMax());
resultOut->refreshContactPoints();
}
}
}

Some files were not shown because too many files have changed in this diff Show More