1
1

Compare commits

...

1195 Commits

Author SHA1 Message Date
7da0d1a71e * Fixed a crazy memory leak in voxel data image sequence data source 2009-07-03 11:03:09 +00:00
d5e9eb7d76 * fix for small bug in volume texture stack 2009-06-21 22:17:06 +00:00
3b2ec94977 Voxel data & volume light cache
* Added support for additional file types in the voxel data texture. I added 
support for 8 bit raw files, but most notably for image sequences.

Image sequences generate the voxel grid by stacking layers of image slices on top 
of each other to generate the voxels in the Z axis - the number of slices in the 
sequence is the resolution of the voxel grid's Z axis. 

i.e. http://mke3.net/blender/devel/rendering/volumetrics/skull_layers.jpg

The image sequence option is particularly useful for loading medical data into 
Blender. 3d medical data such as MRIs or CT scans are often stored as DICOM 
format image sequences. It's not in Blender's scope to support the DICOM format, 
but there are plenty of utilities such as ImageMagick, Photoshop or OsiriX that 
can easily convert DICOM files to formats that Blender supports, such as PNG or JPEG.

Here are some example renderings using these file formats to load medical data:
http://vimeo.com/5242961
http://vimeo.com/5242989
http://vimeo.com/5243228

Currently the 8 bit raw and image sequence formats only support the 'still' 
rendering feature.

* Changed the default texture placement to be centred around 0.5,0.5,0.5, rather 
than within the 0.0,1.0 cube. This is more consistent with image textures, and it 
also means you can easily add a voxel data texture to a default cube without 
having to mess around with mapping.

* Added some more extrapolation modes such as Repeat and Extend rather than just clipping

http://mke3.net/blender/devel/rendering/volumetrics/bradybunch.jpg

* Changed the voxel data storage to use MEM_Mapalloc (memory mapped disk cache) 
rather than storing in ram, to help cut down memory usage.

* Refactored and cleaned up the code a lot. Now the access and interpolation code 
is separated into a separate voxel library inside blenlib. This is now properly 
shared between voxel data texture and light cache (previously there was some 
duplicated code).

* Made volume light cache support non-cubic voxel grids. Now the resolution 
specified in the material properties is used for the longest edge of the volume 
object's bounding box, and the shorter edges are proportional (similar to how 
resolution is calculated for fluid sim domains).

This is *much* more memory efficient for squashed volume regions like clouds 
layer bounding boxes, allowing you to raise the resolution considerably while 
still keeping memory usage acceptable.
2009-06-20 06:41:50 +00:00
44cebb39b8 * raised some limits in point density 2009-06-10 07:45:12 +00:00
ffbd75e571 * Fix for simple bug in voxel data texture 2009-05-16 13:17:21 +00:00
e1122a1b67 5th: another compile fix 2009-04-21 10:19:14 +00:00
fc7a561de1 4th: another file corrupted 2009-04-21 09:31:07 +00:00
cf9886b0d0 2nd try to merge sim_physics with trunk rev 19825
Please check if volumetrics are yet working
2009-04-21 08:49:06 +00:00
2d0d06f642 BGE VideoTexture: fix bug with VideoTexture.materialID() since recent commit. 2009-04-20 21:20:33 +00:00
6afaab654d Bugfix for [#18554] Time + Scale Node Crash 2009-04-20 18:31:48 +00:00
449e9a454d Bugfix 18558
In OSX, using spin/extrude etc. buttons, with more than 1 3d window open,
should turn cursor in a Question Mark to indicate you have to tell which
window to use (yes weak, but that's 2.4x!). OSX didn't support that type
of cursor, so no hint happened. Now uses the 'hand' icon for osx... no
nicer one is there afaik.
2009-04-20 18:23:46 +00:00
d76a6f5231 Booleans: Fix for "no faces" error, reported by alxarch, thanks! 2009-04-20 13:18:54 +00:00
dee32d0b3f BGE Python API
- initialize pythons sys.argv in the blenderplayer
- ignore all arguments after a single " - " in the blenderplayer (like in blender), so args can be passed to the game.
- add a utility function PyOrientationTo() - to take a Py euler, quat or 3x3 matrix and convert into a C++ MT_Matrix3x3.
- add utility function ConvertPythonToMesh to get a RAS_MeshObject from a KX_MeshProxy or a name.
- Added error prefix arguments to ConvertPythonToGameObject, ConvertPythonToMesh and PyOrientationTo so the error messages can include what function they came from.
- deprecated brick.getOwner() for the "owner" attribute.
2009-04-20 09:13:59 +00:00
8a0a557294 Hopefully a working merge with trunk (could be one error left in raytrace.c - will check afterwards)
Merging 18706 - 19804
2009-04-20 00:19:16 +00:00
9078ce5da2 Scons epydos changed options
- no source code since this is only useful if the epydocs contain code, ours are only docstrings.
- set inheritance to included so you dont have to search up the classes to find available functions.
- SConstruct, isolate the exception for importing epydoc.
- Added a print to the SConscript files otherwise it looks like nothings happening.
2009-04-19 22:02:48 +00:00
Nathan Letwory
fcdbbee208 SCons / epydoc support
* properly detect if epydoc is installed.
  patch by Brandano
2009-04-19 21:26:29 +00:00
f5fc4ebdd8 BGE Python API
- More verbose error messages.
- BL_Shader wasnt setting error messages on some errors
- FilterNormal depth attribute was checking for float which is bad because scripts often expect ints assigned to float attributes.
- Added a check to PyVecTo for a tuple rather then always using a generic python sequence. On my system this is over 2x faster with an optmized build.
2009-04-19 21:01:12 +00:00
d78eec9319 2009-04-19 20:09:05 +00:00
084efe0703 added a python26.zip file, and also made scons pick which zip to use based on the python version 2009-04-19 19:36:04 +00:00
7144838606 Compile fixed for Win64.
Please check if that also compiles on win32.
2009-04-19 19:31:32 +00:00
b36514a3be Booleans:
- Enable e.g. subsurf before boolean modifier
- Fix editmode crash
2009-04-19 18:18:52 +00:00
904483c96c Booleans: Should work with modifier stack now. Please report (new) problems. Thanks 2009-04-19 17:47:09 +00:00
6bc162e679 BGE Python API
removed redundant (PyObject *self) argument from python functions that are not exposed to python directly.
2009-04-19 17:29:07 +00:00
fe08da3b4c BGE: fix Pyfrom_id to work on w64. 2009-04-19 17:26:03 +00:00
7f15445629 Fix for libopenjpeg to enable win64 compile (is in their tracker and will most likely be included in next release) 2009-04-19 16:35:20 +00:00
7dbc9dc719 BGE Python API cleanup - no functionality changes
- comments to PyObjectPlus.h
- remove unused/commented junk.
- renamed PyDestructor to py_base_dealloc for consistency
- all the PyTypeObject's were still using the sizeof() their class, can use sizeof(PyObjectPlus_Proxy) now which is smaller too.
2009-04-19 14:57:52 +00:00
8d2cb5bea4 BGE Python API
This changes how the BGE classes and Python work together, which hasnt changed since blender went opensource.
The main difference is PyObjectPlus - the base class for most game engine classes, no longer inherit from PyObject, and cannot be cast to a PyObject.

This has the advantage that the BGE does not have to keep 2 reference counts valid for C++ and Python.

Previously C++ classes would never be freed while python held a reference, however this reference could be problematic eg: a GameObject that isnt in a scene anymore should not be used by python, doing so could even crash blender in some cases.

Instead PyObjectPlus has a member "PyObject *m_proxy" which is lazily initialized when python needs it. m_proxy reference counts are managed by python, though it should never be freed while the C++ class exists since it holds a reference to avoid making and freeing it all the time.
When the C++ class is free'd it sets the m_proxy reference to NULL, If python accesses this variable it will raise a RuntimeError, (check the isValid attribute to see if its valid without raising an error).
- This replaces the m_zombie bool and IsZombie() tests added recently.

In python return values that used to be..
 return value->AddRef();
Are now
 return value->GetProxy();
or...
 return value->NewProxy(true); // true means python owns this C++ value which will be deleted when the PyObject is freed
2009-04-19 12:46:39 +00:00
92cea7c1b1 KX_MeshProxy "numPolygons" and "numMaterials" attributes were using the "materials" attribute function, error made recently when converting attributes. 2009-04-19 06:48:27 +00:00
d2ec468cd3 Hidden faces were not rendering displayed in the game engine, only the invisible face flag should be used for this.
Hiding faces is a editing option like selection and should not change rendering, it wasn't even working right because meshes without UVs ignored it.
I thought this was needed for compatibility with old files but just noticed this messes up 2 of the files in demos-2.42.zip
2009-04-19 06:29:15 +00:00
Nathan Letwory
e4611218ab BPy
* access to sample buffers count of Lamp
2009-04-19 00:09:47 +00:00
Nathan Letwory
faef9f0ac7 SCons
* some misc changes, mainly cleaning and style unification that were lying around
2009-04-18 17:16:08 +00:00
53fd3847bc BGE: restore a feature that was lost in 2.48: sharing of display lists between duplicated objects. 2009-04-18 09:14:51 +00:00
df8cf26404 Added m_zombie to the base python class (PyObjectPlus), when this is set all the subclasses will raise an error on access to their members.
Other small changes...
- KX_Camera and KX_Light didnt have get/setitem access in their PyType definition.
- CList.from_id() error checking for a long was checking for -1 against an unsigned value (own fault)
- CValue::SpecialRelease was incrementing an int for no reason.
- renamed m_attrlist to m_attr_dict since its a PyDict type.
- removed custom getattro/setattro functions for KX_Scene and KX_GameObject, use py_base_getattro, py_base_setattro for all subclasses of PyObjectPlus.
- lowercase windows.h in VideoBase.cpp for cross compiling.
2009-04-17 20:06:06 +00:00
90c6cf77f1 Fixing SND_Scene.h missing include problems with cmake + bullet 2009-04-17 13:42:40 +00:00
80e40d504c bugfix #18287
Texture nodes hang when nodes have a cyclic case.

Added a (temp?) provision to tag node->need_exec zero for cyclic
nodes, and added check for this in texture nodes. 
There was also a bug in 'tag changed' for texture nodes, which not
only tagged, but also called the tree exec (should not happen!).

In general the texture exec needs recode; it doesn't use the stacks
as provided per node, but recurses itself to previous nodes, giving
problems like this. Node execs should only do their own bizz, the
node system handles dependency and eval order nicely already.
2009-04-17 10:38:10 +00:00
6761cc00d4 let command line args override the 'blenderlite' target 2009-04-17 10:34:09 +00:00
1dd980768d Missing <stdlib.h> for abs() made this file not compile for me. 2009-04-17 10:24:44 +00:00
aed9f92734 packing from the UV window with margin had a problem with feedback, so running again and again would give different results.
Scale the margin by the combined area of all boxes to give predictable results.
2009-04-17 06:21:49 +00:00
0cda4903b1 [#18533] Little fix in Particle API doc
from Alberto Santos (dnakhain)
2009-04-17 02:33:14 +00:00
2c491b5d2e BGE: slow parent was causing scaling distortion, now use correct quaternion interpolation. 2009-04-16 20:13:13 +00:00
32253dfaaf bpy_internal_import.c should build with py2.3 now, also gave bpy_internal_import functions better names. 2009-04-16 06:24:47 +00:00
bbdaa03d65 BGE bug #18168: Get local orientation of object using game engine python script system. Added localOrientation and worldOrientation. orientation attribute deprecated. Same for position and scaling. World attributes are read-only except for worldPosition. Add systematic check on NULL SGNode in all python functions. This is necessary to handle zombie objects (deleted by the game but kept alive by a reference in a list). 2009-04-15 21:17:08 +00:00
0c1bfa4a37 Merging Shrinkwrap Constraint!
+bvhtree cache (if the derived model doenst gets destroyed then the same BVHtree can be used)
	this was needed to allow shrinkwrap constraint to be usable.

It has been ready for a long time.. but only got merged now, for 2.49.
2009-04-15 19:33:25 +00:00
52a3d5c518 BGE Python API
Free python modules defined within the blendfile between loading scenes since they would end up accessing old GameLogic, Rasterizer modules as well as old game engine data in the module namespace which can cause problems.
2009-04-15 19:20:12 +00:00
b7e40b955f Optional margin for packing UV islands and the 'Pack Islands' menu item. Useful for baking with bleed enabled. 2009-04-15 18:20:19 +00:00
f46f93ea13 This is patch [#18408] Build issues with make on Cygwin hosted MinGW (2.48.1)
submitted by Wayne Dennis

adds an include, changes pythonlib and does a little cleaning of dlltool stuff.

Kent
2009-04-15 16:23:13 +00:00
3616eb9031 Fixing more errors coverity found.
Imagepaint make sure ibuf exists before we use it.  This is CID# 545
editmesh_tools.c make sure were not indexing array with -1 This is CID# 137
	(also removed some trailing whitespace I found)

anim5.c	totlen could be -1 so check its > -1  This is CID# 134

Kent
2009-04-15 16:16:00 +00:00
514c78ba39 BGE MouseFocusSensor
- fix for multiple viewpors broke single viewport (both work now)
- python could get uninitialized values from m_prevTargetPoint and m_prevSourcePoint
- getting the RayDirection for python could crash blender trying to normalize a zero length vector.
- added python attributes
- removed unused canvas from the MouseFocusSensor class
2009-04-15 13:50:56 +00:00
e8f4d93221 Disable using KX_GameObjects in python that have been removed from the scene (zombie objects) by raising a RuntimeError when accessing methods, attributes or passing to a function.
Common cases of this are when python references an object from the AddObject actuator that has ended, or a scene has been loaded and the old objects freed.

This means some scripts will raise errors now in certain cases but better give the error early rather then failing silently with strange hard to track down behavior & crashes.

Added "isValid" attribute for checking objects are in a scene.

At the moment it uses the SceneGraph Node to check of the objects valid but it might be better to do this in a more generic way so scenes, meshes etc also have this check.
2009-04-15 10:57:28 +00:00
19c869ab64 BGE Py Api
importing modules wasnt returning the error from the blender text if it failed.
2009-04-15 08:08:42 +00:00
34a617e308 [#7789] 3DS Import , Mesh not correct since Blender 2.44
There is a problem importing 3ds files where I cant find a way to check if the transforms are applied to the vertex locations or not.
Since 2.44 I made the importer assume they were not since you can manually remove transformations, but not reverse.

Nevertheless most 3ds files have the matrix applied, better not give a bad import by default.
Did some research and other 3ds importers (lib3ds for eg), have the same problem and just assume the transformations applied.

3dsMax imports both correctly so there must be a way to tell but I could not link it to the 3ds version or other mesh options.
Added an option to workaround this problem in rare cases where its needed.

- KX_GameObject.cpp & KX_Scene.cpp, clear the dict before removing the reference in case there is a circular reference.
2009-04-15 07:00:11 +00:00
efb7dd86ff Fix for own recent reference count error.
- The armature weakref list was  being incref'd twice then decrefed twice (incref and decref were used incorrectly), now only once. My 'fix' broke this.
- In bpy_pydriver_create_dict the 2 refs added from running PyDict_SetItemString twice were undone when clearing the dictionary (added comment)
- changed Py_XDECREF to Py_DECREF int BPY_pyconstraint_update and BPY_pyconstraint_target, Py_XDECREF checs for NULL value which would have crashed blender before it got to Py_XDECREF anyway.
- after every error is reported (PyErr_Print), remove sys.last_traceback and clear the error, I found this fixed certain crashes (usually when starting the game engine or exiting blender), so best do this all the time.

- header_text.c, CcdPhysicsEnvironment.cpp, KX_CameraActuator.cpp - remove some warnings.
2009-04-15 04:34:27 +00:00
4fe917ba26 update for DXF-Importer v1.12, DXF-Exporter v1.29 - 2009.04.11 by migius
- added DWG support, adapted Stani Michiels idea for binding an extern DXF-DWG-converter

The external DXF-DWG converter "dconvertcon.exe" 355kb comes from openDesignAlliance www.opendwg.org, is free, but not opensource, not GPL-compatible (can not be bundled with commercial programs), so must be downloaded and installed in Blender script folder by user. It is a DOS console application, can be started in background mode, works on Windows, and in Wine on Linux and OSX. Version 1.0 (2002) supports conversion between DXF<->DWG for autocad release: 2.5, 2.6, 9, 10, 11, 12, 13, 14, 2000, 2002.
2009-04-15 01:37:50 +00:00
a277b979f2 v1.29 - 2008.12.28 by Yorik van Havre
- modif POLYLINE to support bulge segments
2009-04-14 23:57:14 +00:00
494f0fa4e7 BGE bug #18522 fixed: Dupligroup offsets don't work in BGE. 2009-04-14 20:54:04 +00:00
bc355482ab BGE: Keep Sumo and ODE in sync with Bullet at API level, fix a compilation problem in MSVC. 2009-04-14 17:22:14 +00:00
c62dfc498d [#18517] Python scripts segfault on loading
own error, EXPP_incr_ret from a macro was an implicit decloration in BGL.c
For some reason this only crashed on 64bit linux

To my defence the BGE makes so many warnings that they become usless, need to improve the situation here at some point.
2009-04-14 17:19:09 +00:00
bcabc596c9 Bugfix #18108
Another bug in the 'radius per vertex' feature in curves.

If you set front/back face off for curves, and make it bevel or give
depth, the curves should draw as tubes. This feature didn't work in 2.48
either... 

Still unsure about this implementation, campbell can check!
2009-04-14 17:13:21 +00:00
3511f8ef9f BGE Physics
Clamp objects min/max velocity.
Accessed with bullet physics from the advanced button with dynamic and rigid body objects.
- useful for preventing unstable physics in cases where objects move too fast.
- can add linear velocity with the motion actuator to give smooth motion transitions, without moving too fast.
- minimum velocity means objects don't stop moving.
- python scripts can adjust these values speedup or throttle velocity in the existing direction.

Also made copy properties from an object with no properties work (in case you want to clear all props)
2009-04-14 12:34:39 +00:00
1bc31fc7f9 BGE Bugfix
[#17678] "Mouse over" sensor broken when using viewports

Loop over all the scenes camera viewports and check the mouse is inside the viewport before casting a ray.
2009-04-14 03:08:09 +00:00
0b8661ab4d BGE: Occlusion culling and other performance improvements.
Added occlusion culling capability in the BGE. 
More info: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.49/Game_Engine#BGE_Scenegraph_improvement
MSVC, scons, cmake, Makefile updated.

Other minor performance improvements:
- The rasterizer was computing the openGL model matrix of the objects too many times
- DBVT view frustrum culling was not properly culling behind the near plane:
  Large objects behind the camera were sent to the GPU
- Remove all references to mesh split/join feature as it is not yet functional
2009-04-13 20:08:33 +00:00
6f12e584a9 SVN maintenance. 2009-04-13 19:33:22 +00:00
d91d64d807 [#18329] VRML import on indexedfaceset munges some colors (off by one)
Thanks to Ezra Peisach for including a patch in the report.
2009-04-13 06:50:02 +00:00
956d120098 Bullet integration uninitialised values.
Erwin, r16812 "Add Fh/Rot Fh to Bullet" - added this function
  ClosestRayResultCallbackNotMe(rayFromWorld,rayToWorld,body,parentBody)
  
  ...but parentBody was being ignored and the m_parent value wasn't being initialized.


Run memset() on CcdConstructionInfo which had some unset members for CreateSphereController() and CreateConeController().
2009-04-13 04:54:12 +00:00
1b73d3ce05 mesh proxy attributes from andrecastelo 2009-04-13 03:43:16 +00:00
066098dfec this should fix building with mingw 2009-04-12 22:05:09 +00:00
5b07f06136 fix some refcounting issues with PyDict_SetItemString 2009-04-12 20:19:27 +00:00
Dalai Felinto
8664e35adf 2DFilter bugfixes:
[#18154] 2dFilter and motion blur should run only once to all the scenes
[#18504] The GL_PROJECTION matrix is being reset by the 2dfilter.
2009-04-12 19:46:50 +00:00
5b942b9d5b [#18516] Particle children API for python (Complete).
from Alberto Santos (dnakhain) 
----
This patch complete previous one that I submit with new variables relationated with Particle System children (With variables related to Rough, Kink and Branch).
2009-04-12 17:07:40 +00:00
17f35293ee PropertyActuator toggle option didnt run when the Value field was empty. 2009-04-12 16:10:43 +00:00
332032fb99 BGE Python API
Support for assigning any Type to a KX_GameObject

so you can do...
 gameOb.follow = otherGameOb
 gameOb[otherGameOb] = distanceTo
 gameOb["path"] = [(x,y,x), (x,y,x)]
 del gameOb[mesh]


* types that cannot be converted into CValue types are written into the KX_GameObject dict
* the KX_GameObject dict is only initialized when needed
* Python properties in this dict cannot be accessed by logic bricks
* dir(ob) and ob.getPropertyNames() return items from both CValue and Py dictionary properties.

Also found that CType was converting python lists to CType Lists but very buggy, would crash after printing the list most times.
Use python lists instead since logic bricks dont deal with lists.
2009-04-12 14:22:51 +00:00
ee24c829b5 need strtoll defined as _strtoi64 to build on windows 2009-04-12 10:56:36 +00:00
5b306b7541 BGE Python API
added defines PY_SET_ATTR_FAIL, PY_SET_ATTR_MISSING and PY_SET_ATTR_SUCCESS

This is useful when objects that have user defined attributes (GameObject and Scene)
When calling setattr on the parent, a return value of PY_SET_ATTR_FAIL means the attribute exists but failed to be set, so don't set the custom attribute.
2009-04-12 09:56:30 +00:00
55d2b184ec added "toggle" an option for the property actuator.
much less hassle then setting up a property sensor and 2 assignment actuators, or through python.
2009-04-12 07:24:04 +00:00
33170295c8 use long long rather then int for storing game logic properties.
There were also some problems with int to python conversion
- assigning a PyLong to a KX_GameObject from python would raise an error
- PyLong were coerced into floats when used with internal CValue arithmetic

Changes...
- PyLong is converted into CIntValue for coercing and assigning from python
- CValue's generic GetNumber() function returns a double rather then a float.
- Print an error when a PyType cant be coerced into a CValue

Tested with python, expressions and property sensor.
2009-04-12 06:41:01 +00:00
4cd088b105 BGE Py API
- setting the scene attributes would always add to the scenes custom dictionary.
- new CListValue method from_id(id)

so you can store a Game Objects id and use it to get the game object back.

 ob_id = id(gameOb)
 ...
 gameOb = scene.objects.from_id(ob_id)
 
This is useful because names are not always unique.
2009-04-11 20:58:09 +00:00
37e53b2e1f bugfix from Moguri, AddReplica wasnt setting the light layer from the parent 2009-04-11 15:59:11 +00:00
48514b3d52 Fix for: [#18499] Particle size can only be set in steps of 0.1
- Some button settings were wrong.
2009-04-10 21:07:32 +00:00
c1cf50be79 Mesh effector surface option:
- Most mesh particle effectors can now have their effection point taken per particle as the nearest point on the mesh surface.
- This is activated with the "surface" button in the effector field panel.
- Activating the option adds a "surface" entry to the modifier stack where the state of the mesh is read from.

For an example of usage see http://www.youtube.com/watch?v=3XkO1EAmJks.
2009-04-10 19:40:21 +00:00
2fff90bbb4 Added function name to many of the PyArg_ParseTuple calls in gameengine
This way python raises more useful messages.
2009-04-10 16:45:19 +00:00
a412ce0702 strip indentation from lines of OBJ files.
OBJ's from VMD's molecular visualization program had this.
2009-04-10 14:33:52 +00:00
4ff661c989 X3D Import was broken because some arguments from VRML were missing. 2009-04-10 14:09:44 +00:00
6121d4b9fe Particle effector falloff maxdist etc. didn't work like it was supposed to. 2009-04-09 23:43:25 +00:00
5031fe982e BGE API cleanup: ConstraintActuator. 2009-04-09 23:10:12 +00:00
ac45472a17 BGE Bugfix
The End key didn't work work at all for the keyboard sensor.
Removed getEventList() since it was added since 2.48a release.
2009-04-09 22:15:26 +00:00
b0cca7de26 BGE API cleanup: StateActuator. 2009-04-09 21:15:44 +00:00
09a5ffdf07 BGE API cleanup: sound actuator. 2009-04-09 20:40:12 +00:00
4669fa48a8 Added GameKeys.EventToCharacter(event, is_shift) so you can get the character that would be types when pressing a key.
Last commit was made in the pydocs folder only, so this includes changes mentioned in rev 19620.
2009-04-09 16:00:45 +00:00
e14e66f041 BGE Py API
- added keyboard senser attribute "events" to replace getEventList()
- fix 2 memory leaks in the python api (was making a list but not returning it)
- setting readonly attributes didnt give a good error message.
2009-04-09 12:53:56 +00:00
3be2b8995e Remove redundant include GL/glu.h in KX_Dome.cpp. 2009-04-09 10:29:07 +00:00
65f65a729a key logging didnt work for alphanum keys -=_+ and |\ since revision 2 and nobody noticed! 2009-04-09 10:28:14 +00:00
c29d51f1e8 BGE Text - fix for tab drawing as an @ and not adding white space.
Tab width is always space*4.
2009-04-09 10:05:17 +00:00
eacf5b5d6d BGE Text
- multi-line strings for bitmap text 
- keyboard sensor now logs return and pad enter as "\n"

BGE std::vector use in Value.cpp and RAS_MaterialBucket.cpp
The size of a new list is known before making them, reduce re-allocs, though probably not a noticeable speedup.
2009-04-09 09:50:17 +00:00
ba4ad93ead Python 2.3 wouldn't compile with BGL. 2009-04-09 01:52:29 +00:00
5b0d75e831 BGE API cleanup: 2DFilterActuator. 2009-04-08 21:40:55 +00:00
24f1355d4f Fix gcc compiling problem with C++ syntax in KX_Dome.cpp. 2009-04-08 20:10:27 +00:00
1ee970e03b small bge edits
- Only try and remove light objects from the light list.
- Only loop over mesh verts once when getting the bounding box
- dont return None from python attribute localInertia when theres no physics objects. better return a vector still.
- add names to send message PyArg_ParseTuple functions.
2009-04-08 17:40:09 +00:00
db33320df7 BGE patch #18350: Add sendMessage() to GameLogic. Added sendMessage to both GameLogic and KX_GameObject. 2009-04-08 16:57:08 +00:00
370850146f BGE patch #18051: add localInertia attribute to GameObject. 2009-04-08 16:25:00 +00:00
2074128fad Patch #18462: Fisheye (Dome) and Spherical Panoramic mode in BGE.
User guide:
http://wiki.blender.org/index.php/Dev:Source/GameEngine/Fisheye_Dome_Camera

Fixed two bugs from original patch:
- deleting a text will clear the warp field from Game framing settings
- removed spurious black dots along the edge of the cube map in the gameplayer 

Known limitation:
- resizing of the screen doesn't work in the gameplayer

Known bugs:
- Texture with reflexion are not rendered correctly
- Spurious problems with light
2009-04-08 15:06:20 +00:00
4b77f9504c Fixed scons and cmake after BGE scenegraph and culling improvements. 2009-04-08 08:22:03 +00:00
e063682ed3 gcc wouldn't compile using a reference 2009-04-07 23:21:30 +00:00
51b4145841 BGE Scenegraph and View frustrum culling improvement.
This commit contains a number of performance improvements for the
BGE in the Scenegraph (parent relation between objects in the
scene) and view frustrum culling.

The scenegraph improvement consists in avoiding position update
if the object has not moved since last update and the removal
of redundant updates and synchronization with the physics engine.

The view frustrum culling improvement consists in using the DBVT
broadphase facility of Bullet to build a tree of graphical objects
in the scene. The elements of the tree are Aabb boxes (Aligned 
Axis Bounding Boxes) enclosing the objects. This provides good
precision in closed and opened scenes. This new culling system
is enabled by default but just in case, it can be disabled with
a button in the World settings. There is no do_version in this
commit but it will be added before the 2.49 release. For now you
must manually enable the DBVT culling option in World settings
when you open an old file.

The above improvements speed up scenegraph and culling up to 5x.
However, this performance improvement is only visible when
you have hundreds or thousands of objects.

The main interest of the DBVT tree is to allow easy occlusion
culling and automatic LOD system. This will be the object of further
improvements.
2009-04-07 22:14:06 +00:00
486985762a etch-a-ton
Use head not tail normal for bone orientation.
Simplify roll to normal a bit.
2009-04-07 20:05:32 +00:00
14e3b041ba MSVC9 project file update 2009-04-07 19:57:30 +00:00
d012a222a2 Some users have odd joysticks with more then 8 axises, increased to 16 (so 4 joysticks)
Ideally there would be no limit but I dont think its worth the effort.
Also had a bug in last commit for the pytyhon api's "axisSingle" attribute, UI index starts at 1 not zero.
2009-04-07 19:21:48 +00:00
ca1c3be302 BGE Py API
- Added OpenGL access to the game engine as a module so you can import BGL directly.
2009-04-07 18:55:35 +00:00
bdfa61fbbe BGE api added place holder docs and CListValue docs. 2009-04-07 17:54:56 +00:00
afb2670246 Emacs has some rules about where and how to look for settings. 2009-04-07 17:17:47 +00:00
18511c56d3 BGE Python API (small changes)
- Make BGE's ListValue types convert to python lists for printing since the CValue GetText() function didnt work well- printing lists as [,,,,,] for scene objects and mesh materials for eg.
- Check attributes are descriptor types before casting.
- py_getattr_dict use the Type dict rather then Method and Attribute array.
2009-04-07 16:00:32 +00:00
1534eca60f Updated bge_api_validate_py.txt to check for undocumented attributes
All types methods and attributes are now documented (except for some types have no epydoc .py files for at all)
2009-04-07 11:45:48 +00:00
5d64dd019e BGE Python API
Use each types dictionary to store attributes PyAttributeDef's so it uses pythons hash lookup (which it was already doing for methods) rather then doing a string lookup on the array each time.

This also means attributes can be found in the type without having to do a dir() on the instance.
2009-04-07 11:06:35 +00:00
c054ea0203 [#18407] Trouble w/ Bevel_Center.py
add python encoding info
2009-04-07 10:16:26 +00:00
6b1ccddc0d bugfix #18196
Halos for objects (not particles) can get texture color, but they skipped
the alpha mapt-to channel when that was set. Actually bug from ehh 1995!
2009-04-07 07:46:58 +00:00
885fa49aa4 BGE Joystick Sensor
- Raised limit of 2 axis to 4 axis pairs (4==8 joysticks axis pairs)
- Added a new Joystick Sensor type "Single Axis", so you can detect horizontal or vertical movement, rather then just Up/Down/Left/Right
- added Python attribute "axisSingle" so you can get the value from the selected axis (rather then getting it out of the axis list)
- renamed Py attribute "axisPosition" to "axisValues" (was never in a release)

If we need to increase the axis limit again just change JOYAXIS_MAX and the button limits.
2009-04-07 06:23:45 +00:00
816a9f3acb error in last commit 2009-04-07 03:20:59 +00:00
a127f259da Fix for: [#18027] Strange behaviour of Explode modifier in combination with SubSurf
- Explode didn't use the dmcache index for getting the particles emitter position.
- One "tri or quad"-comparison tested the wrong index. Leading to one quad converting into a tri.
2009-04-07 03:00:32 +00:00
7e23b7dc54 Texture effector nabla didn't have a correct initial value and it's button explanation needed some work. 2009-04-07 00:15:58 +00:00
b8270db75c Harmonic effector force wasn't working properly at all. A silly vector normalization where it shouldn't have been. 2009-04-06 23:23:36 +00:00
30ce01f23f Fix for: [#18354] Controlling with a texture the particles DENSITY parameter doesn't work.
If the density texture was taken into account with hair parent particles there were cases when there weren't any parents left to interpolate children from. Now a density texture is only taken into account for hair child particles.
2009-04-06 19:32:23 +00:00
445ca000bc bugfix #18398
When using 'angle' display for camera, the 'lens' ipo didn't update this
button. Implementation still lacks a bit... having both variables in the
camera struct is asking for troubles. Put on the re-think list for 2.5!
2009-04-06 18:08:15 +00:00
46a440c7a5 BGE Python API
- added a module for the BGE - GameTypes, only contains types.
- added KX_PYATTRIBUTE_DUMMY attributes for KX_Light, KX_PolyProxy, KX_VertexProxy, so all types should give correct results from a dir().
- added a script to check for missing methods in the epydocs - bge_api_validate_py.txt
2009-04-06 13:27:28 +00:00
960fa534b7 BGE Epydocs were missing some functions
renamed KX_Light -> KX_LightObject
added some missing controllers
2009-04-06 13:13:25 +00:00
64fe09ab20 - remove debug printf
- remove test for importing the module rather then creating a new one (didnt mean to commit)
- added constants for the mouse sensor to use.
2009-04-06 12:47:15 +00:00
fdceee0088 Bugfix #18266
Mipmap creation for render crashed, in this case:
- use Curves tool on an Image, which is UV mapped on object
- Save the image to disk, under new name
- Render (F12)

This fix is only for the crash, there's something not well coded
for Curves tool, how it manages float buffers. That's for 2.5.
2009-04-06 09:05:37 +00:00
c10d1c2853 Python ref-counting fixes 2009-04-06 08:17:04 +00:00
a95f97cb28 cast needed to get things compiling again on my machine.
Kent
2009-04-06 01:43:01 +00:00
fe562f0dd4 Fix for: [#18482] Mixed object and halo visualization for particles needs "Emitter" to be activated. 2009-04-06 00:43:59 +00:00
ab467e7238 2.4x Bugfix #18279 - Copy Vertex Group Location doesn't work with subsurf modifier 2009-04-06 00:22:58 +00:00
58b1e04fe0 Fix for: [#18371] VParent breaks fur effects.
-Virtual parents were not randomly selected due to optimization in child particle distribution code.
-Wave-kink had a wrong matrix multiplication.
-Amount of virtual parents wasn't scaled properly to the amount of children rendered.
-Calculating virtual parents is now thread safe.
2009-04-06 00:10:52 +00:00
9a1e1912e1 2.4x Bugfix - #18188: "Clear user transform" does not work as described
For the record, "Clear user transform" is supposed to restore selected bones to the transforms defined by Actions/NLA, not back to rest position.
2009-04-06 00:04:04 +00:00
b4e4ccf92d BGE PyAPI can now import text (within the blend-file)
Previously this only worked with the Blender API.
- bpy_internal_import small C file that Blender scripting and the game engine use.
- Tested with blender, blenderplayer, loading files
- Needed to use a hack to override the Main struct since the game engine doesn't set G.main
- when the sandbox is set, only internal scripts can be imported.
2009-04-05 19:37:13 +00:00
3dacfbb231 BGE Python API
- action attribute wasnt checking for NULL (own fault)
- KX_Scene getCamera wasnt checking for NULL
- CListValue had asserts for not yet implimented functionality, this would close blender. Better to print an error if the user manages to run this functions (I managed to by CListValue.count([1,2,3]))
2009-04-05 14:55:50 +00:00
033a63f858 BGE Bugfixes (mostly in the py api)
KX_PolygonMaterial and KX_BlenderMaterial - Added a print function (would raise a python error on printing)

* Crashes *
KX_GameObject SetParent - Disallowed setting a parent to its self, caused a recursion crash.
KX_MeshProxy "materials" attribute was segfaulting because of my recent change - I was wrong, you do need to check material types (no idea why since they are both PyObject * at the base)
KX_VisibilityActuator - Wasn't initialized with PyType_Ready() making it crash on access (own fault) 

* Crashes because of missing NULL checks *
KX_PolygonMaterial's "gl_texture" attribute wasnt checking for a valid m_tface
KX_GameObject - added checks for GetPhysicsController()
KX_RayCast::RayTest - didnt check for a valid physics_environment
KX_SceneActuator's getCamera python function wasnt checking if there was a camera.
2009-04-05 14:01:49 +00:00
7d4dc4f0f5 - fixed errors with bge epydocs
- changed epy_docgen.sh so inherited attributes & methods are included inline for each type, removed source option since its not useful and makes the download bigger.
2009-04-05 10:03:23 +00:00
f8cc272575 added experimental KX_GameObject attributes "sensors", "controllers" and "actuators" 2009-04-05 08:48:51 +00:00
77da8461f3 Make materials use PyAttributeDef's 2009-04-05 07:41:03 +00:00
3fa7717b57 2.4x - Grease Pencil: Swapping the order of args for gpencil_frame_delete_laststroke() to be more consistent with the rest of the Grease Pencil API. 2009-04-05 06:54:47 +00:00
53e721305e BGE Python API
- made camera use PyAttributeDef's
- removed unneeded duplicate matrix type checks
- fixed own bug (added since 2.48a) that broke a converting 4x4 matrix to a PyObject
2009-04-05 06:08:41 +00:00
04ef5a492a Made KX_MeshProxy use PyAttributeDef. simplified getting the 'materials' attribute (no need to differentiate between types)
Added KX_GameObject 'meshes' attribute to replace getMesh(i)
2009-04-04 15:54:07 +00:00
9982217a72 Fix for: [#18273] reactor particle spowns to earlier.
Particle life "rand" value could be set above "1.0" allowing for negative particle lifetimes.
2009-04-04 14:34:39 +00:00
d84dc44835 Fix for [#18017] reactor particles affected by a curve guide emit at a wrong position. 2009-04-04 12:48:40 +00:00
cb26c7e75a BGE Py API, mistake when redoing set action as a static function. 2009-04-04 11:02:13 +00:00
b6114be5e3 include PyObjectPlus method in __dict__ 2009-04-04 09:54:05 +00:00
a35a8f7a38 - should fix compiling with older python versions (<2.5)
- made the isA() function accept python types as well as strings.
- renamed _getattr_dict to py_getattr_dict
2009-04-04 08:20:52 +00:00
c31f806c99 fix for [#18484] Bullet Crash (possibly because of overlapping rigid body balls)
simple missing negative index check.
2009-04-04 04:56:05 +00:00
6be6921184 moved more attributes from getattr into PyAttributeDef's 2009-04-04 02:57:35 +00:00
29f5c7dd5d MSVC9 project file. 2009-04-03 19:19:02 +00:00
07930c0b09 BGE API cleanup: RandomActuator. 2009-04-03 19:09:52 +00:00
3b23224061 Fix for [#18372] object-particle in other layer not editable correctly. 2009-04-03 18:13:51 +00:00
e6985d31b5 Some users could not build with python 2.5, hopefully this fixes it. 2009-04-03 15:08:38 +00:00
bc789af5a9 Cleanup of particle object visualization code. No new features and hopefully no new bugs. 2009-04-03 14:54:29 +00:00
fd2b115678 Python BGE API
- Initialize python types with PyType_Ready, which adds methods to the type dictionary.
- use Pythons get/setattro (uses a python string for the attribute rather then char*). Using basic C strings seems nice but internally python converts them to python strings and discards them for most functions that accept char arrays.
- Method lookups use the PyTypes dictionary (should be faster then Py_FindMethod)
- Renamed __getattr -> py_base_getattro, _getattr -> py_getattro, __repr -> py_base_repr, py_delattro, py_getattro_self etc.

From here is possible to put all the parent classes methods into each python types dictionary to avoid nested lookups (api has 4 levels of lookups in some places), tested this but its not ready yet.

Simple tests for getting a method within a loop show this to be between 0.5 and 3.2x faster then using Py_FindMethod()
2009-04-03 14:51:06 +00:00
e30cb79aaa Major cleanup of particle render & drawing code. No new features and hopefully no new bugs. 2009-04-03 14:50:54 +00:00
5934757089 Bug fix: hair or child particles didn't react to density texture. 2009-04-03 14:41:31 +00:00
60bd7d12fc fix for last commit, needed some additional checks 2009-04-03 04:36:38 +00:00
d573e9c539 BGE Python api
Added the method into the PyType so python knows about the methods (its supposed to work this way).
This means in the future the api can use PyType_Ready() to store the methods in the types dictionary.
Python3 removes Py_FindMethod and we should not be using it anyway since its not that efficient.
2009-04-03 04:12:20 +00:00
Dalai Felinto
0499d98311 Setting ignore_deprecation_warnings as 1 by default in GamePlayer
(in the embed BGE it is still 0)
2009-04-03 03:52:19 +00:00
8ca30120a2 made grease pencil delete a frame if you delete all the strokes in it. 2009-04-03 03:16:31 +00:00
b22705f169 BGE Python
- Bugfix for running dir() on all BGE python objects. was not getting the immediate methods and attributes for each class.
- Use attributes for KX_Scene (so they are included with dir())
- Override __dict__ attributes for KX_Scene and KX_GameObject so custom properties are included with a dir()
2009-04-03 02:16:56 +00:00
2178fcea6e Script written for apricot, poly reduces based on known topologies, keeping edge loops unlike edge collapsing poly reduction.
Example
http://www.graphicall.org/ftp/ideasman42/unsubsurf.gif
2009-04-02 11:30:27 +00:00
da39179afd [#17963] NearSensor segmentation fault
bugfix in bullet
Caused by using the index from closestAxis4 before checking its -1
2009-04-02 08:33:45 +00:00
941a8a2504 [#18472] [patch] Speeding up Blenderplayer's profile drawing
from Mitchell Stokes (moguri)
2009-04-02 06:59:27 +00:00
686b92f7b4 [#18477] Prevent .svn directories being included in OS X app bundles
from James Crosby (sheep)
2009-04-02 06:46:56 +00:00
655177aebd [#18452] Particle children API for python.
from Alberto Santos (dnakhain)

"This patch adds a few new variables relationated with Particle System children such as children amount, render amount,
child clumping..."
2009-04-02 06:39:09 +00:00
fcc23faa3a Added getitem/setitem access for KX_GameObject
ob.someProp = 10
can now be...
ob["someProp"] = 10

For simple get/set test with an objects 10 properties, this is ~30% faster.

Though I like the attribute access, its slower because it needs to lookup BGE attributes and methods (for parent classes as well as KX_GameObject class).

This could also be an advantage if there are collisions between new attributes added for 2.49 and existing properties a game uses.

Made some other small optimizations,
- Getting and setting property can use const char* as well as STR_String (avoids making new STR_Strings just to do the lookup).
- CValue::SetPropertiesModified() and CValue::SetPropertiesModified(), were looping through all items in the std::map, advancing from the beginning each time.
2009-04-02 05:38:05 +00:00
48e4a48340 BGE API cleanup: ReplaceMeshActuator mesh attributes now returns a KX_MeshProxy. Fix a bug in KX_MeshProxy where the Python type was not set right. 2009-04-01 08:59:36 +00:00
1e2f736d3a [#18479] 'Consolidate into one image' does not calculate/use 'pixel margin'
Thanks to Dusan Stevanovic for pointing out the fix.

Also noticed alpha wasn't being rendered, enabled texface alpha.
2009-04-01 07:13:55 +00:00
d1dd9fd9f0 [#18478] Unwrap (smart projections) should accept values grater than 0.25 for island margin (it works just fine when changed in original script)
increased value as suggested.
2009-04-01 02:02:26 +00:00
441f26a170 Clean up for the imminent migration from SVN to GIT. 2009-03-31 22:34:34 +00:00
f6f47a08eb BGE API cleanup: DynamicActuator, ReplaceMeshActuator, TrackToActuator. 2009-03-31 21:03:15 +00:00
1f0e5f5807 [#18455] The new FFMPEG version gives the wrong color
ffmpeg format switched from RGBA32 to BGR32, it's no longer needed to swap color planes.

NOTE: this commit also attempts to fix the big endian case, but since I don't have a machine to test it, I'd appreciate if someone else would.
2009-03-31 19:39:17 +00:00
8518f6e660 BGE API cleanup, patch from Moguri: RaySensor, NetworkMessageActuator, NetworkMessageSensor. 2009-03-31 19:02:01 +00:00
74e6231ff4 == etch-a-ton ==
Correct joint-guided roll to use the previous bone, not the following (that was silly). Also made first bone use view axis (since it has no previous), this is much nicer that using rotation correction only. Using the joint roll option makes it MUCH more orientation independant.
2009-03-31 14:29:58 +00:00
f78ee08b67 [#18473] SCons build fails when linking blender when WITH_BF_OGG enabled
fix for linking on linux
2009-03-31 08:13:21 +00:00
97af551cb7 [#18439] Controlling the bevel shape for a text object with a curve no longer works.
own fault, broke rev16702.
Curves created by fonts didnt have their radius set. Forgot do do this when making radius calculated with the curve (like tilt)
2009-03-31 06:22:25 +00:00
22ad99783a [#18277] Segfault crash by editing mesh with subsurf+ParticleInstance modifiers
Marked as fixed but was still using uninitialized variables.
2009-03-31 00:58:02 +00:00
ac2de0f28d Hide full retarget panels behind rt -1 (not ready for large scale use and not too well documented yet. Doesn't affect etch-a-ton. 2009-03-30 15:26:14 +00:00
c1b41b20b0 r19455 to Re-enable vertex welding for soft-bodies failed even on simple cases like a cube with scrambled mesh data.
Please test before committing.

m_vertexArray has no doubles now and is not aligned to 3, using m_triFaceArray to get the verts for each face.
2009-03-30 00:40:19 +00:00
b182778e71 Applied patch #18446, to do versions on damping
Re-enable vertex welding, only for soft bodies. They require it. Future versions could expose such vertexWeldingThreshold.
2009-03-29 19:54:05 +00:00
30fa7a7286 Only apply advanced setting of angular/linear factor to rigid bodies (with angular rotation). The setting broke 'dynamic'-only objects. 2009-03-29 18:34:35 +00:00
d57811ada1 BGE API cleanup: CDActuator, ParentActuator, VisibilityActuator done. Thanks to Andre. 2009-03-29 15:17:55 +00:00
02191a1d39 Moved EXR settings to OS related zone.
It had its own "which OS" conditionals, so please check the moving did
change the result.
2009-03-28 19:31:22 +00:00
fdc6df9253 game engine compile fix for MSVC, game engine team might want to check. 2009-03-28 11:09:53 +00:00
6fd597b304 removed unneeded arg from makeknots() and replaced some numbers with defines 2009-03-28 05:51:18 +00:00
f61ce664bc Tooltip fix, there is no such thing as "Tadius interpolation" 2009-03-28 04:25:21 +00:00
afec404962 BGE API Cleanup: GameActuator (patch from Andre) 2009-03-27 22:11:30 +00:00
059c2a10c4 BGE API cleanup: AddObject, DeleteObject and Scene actuator added. 2009-03-27 21:54:16 +00:00
e392eb4d9c Fixed a couple of null issues spotted by coverity.
CIDS: 42 and 470

Kent
2009-03-27 16:27:48 +00:00
d585d85cc1 Some small cleanups and reorganization. 2009-03-26 18:45:39 +00:00
bba2bdf41e Added attributes for Ipo Actuator settings (replacing all methods) 2009-03-26 01:42:01 +00:00
Dalai Felinto
c53577a118 scons+msvc update for the FFMpeg recent updates 2009-03-25 23:09:17 +00:00
616897d0db Bad crash in volume snapping code when duplis where involved.
Found out using Coverity's scan report.
2009-03-24 19:39:43 +00:00
6020d2cb45 Changed missing line ending style for TEX_ files
in sculptmode.c move initalization of a var to fix an issue
where index of array could be -1.
Found by coverity.

Kent
2009-03-24 19:39:02 +00:00
c78b460fce Use Benoits attributes in KX_GameObject.
Deprecated..
getPosition, setPosition, getOrientation, setOrientation, getState, setState, getParent, getVisible, getMass

* swapped set/get to get/set in KX_PYATTRIBUTE_RW_FUNCTION macro to match pythons getsetattrs.
* deprecation warnings in the api and notes in epydocs.
* added 'state' attribute
* gameob.mass = 10 # now works because its not checking only for float values.
* dir(gameob) # includes attributes now
2009-03-24 19:37:17 +00:00
5d48e04307 Renumbered the texture nodes because they were clashing with the other nodes.
This will break compatibility with previous texnode testing builds (but not
with any released versions)
2009-03-24 18:51:21 +00:00
ce8badeb18 Fix for bug #18423: BGE lights in overlay scene also affected
other scenes, for texture face / multitexture materials.

Fix for bug #18428: BGE lights on hidden layers were still used,
for all material types, now they have no effect
2009-03-24 15:45:08 +00:00
dbe675195d Fix for bug #18438: TEX_valToNormal.c array size error.
Error pointed out by Dan Eicher, thanks!
2009-03-24 13:39:50 +00:00
688db0f251 [#18260] FMOD Removal
from Jorg Muller (nexyon)

also removed references to CVS in install
2009-03-24 09:09:10 +00:00
5e44eba342 fix for [18443] Object.GetSelected() returns empty when run from command line 2009-03-24 03:53:20 +00:00
80319e5b51 Added BF_PROFILE (same name as in scons files) option.
Set it to true to build with -pg

Also I added CCFLAGS to final link of targets.  Not sure why it wasn't there before.

Kent
2009-03-23 19:52:49 +00:00
617bb7ac45 Another patch by GSR
Just some minor cleanups.

Kent
2009-03-23 18:11:46 +00:00
c561886809 irix/scons: use $LCGDIR/sdl instead of $LCGDIR/SDL.
Fixed bug #18293: SDL files under lib for irix-6.5-mips are included twice
2009-03-23 17:50:41 +00:00
4a07876562 Speedup for bullet physics mesh conversion
Was adding each face with a remove doubles option that made conversion increasingly slower for larger meshes, this would often hang blender when starting with the BGE with larger meshes.

Replace btTriangleMesh()->addTriangle() with btTriangleIndexVertexArray()

YoFrankie level_1_home.blend starts a third faster, level_nut about twice as fast.

- previous commit was also incorrect using the original meshes vert locations rather then the vert locations that came from the derived mesh.
- Softbody is relying on removing doubles at 0.01 to give stable results, this no longer works but seems a bit dodgy anyway. Maybe some post-processing filter could fix up a mesh for bullet softbody.
2009-03-23 06:00:21 +00:00
bd13f30224 MSVC project files updated for ffmpeg 0.5 and armature. You must also update lib/windows. 2009-03-22 23:39:36 +00:00
e3d0dfc9eb BGE API cleanup: add support for attribute set/get through functions only. 2009-03-22 21:36:48 +00:00
fa765a554c only write tex plugin and envmap data to file if texture is the right type. This takes care of lingering errors with missing texture plugins after texture type is changed 2009-03-22 21:06:08 +00:00
1914ed72b2 Speedup for bullet creating convex hull meshes
In a simple test with ~12000 verts, overall BGE startup time went from ~4.5 sec to a bit under a second.

- before adding each vert it did a check for a duplicates.
- Using RAS_Polygon verts can give a lot of duplicates because the verts also store UV's and normals.
- Was increasing the array one item at a time, now resize the array once.
- Use the blender mesh mvert array rather then RAS_TexVert's, so needed to include some DNA headers.
2009-03-22 21:04:28 +00:00
615c5232c7 == FFMPEG ==
Updated ffmpeg to release version 0.5
updated x264 to today's daily build
thanks to ben2610 for first patches (but you got hddaudio.c wrong :)
2009-03-22 19:19:21 +00:00
d5d2d1fece removed edgecode from the game engines RAS_Polygon class since its not used 2009-03-22 17:03:55 +00:00
483ee1157e fixes for...
[18429] Typo in IPO Actuator

[18377] Crash fo yofankie (G.curscreen==NULL)
		/* No screen, happens when saving a blendfile in background mode,
		 * then loading in the game engine
		 * just assume we need the mesh info */
2009-03-20 06:12:22 +00:00
a1e05f4617 patch from Banlu Kemiyatorn
* when joining only 2 faces dont check they are convex
* allow edge rotate for non planer faces
- Both were very annoying especially when sub-surf modeling with edge loops
2009-03-20 02:26:02 +00:00
41b2a2a530 * Volume rendering / multiple scattering - normalisation
This changes the effect of the multiple scattering approximation to be more 
physically plausible (and easier to use) by making it conserve energy. 
Previously, the multiple scattering could show wildly different results 
based on the spread settings, often outputting much more light than was put 
in (via lamps), which is physically incorrect and made it difficult to use 
by requiring a lot of tweaking of the intensity value.

This fixes it to some extent with a simple normalization, where it scales 
the light energy after multiple scattering to be the same as what was
previously there in the light cache via single scattering. This means that 
using the default intensity of 1.0 should give good results by default, 
although you can still use it to tweak the effect.

Note: This will render differently if you've already set up a .blend using
multiple scattering with the old code, so you'll need to tweak older files. 
Setting the intensity back to the default 1.0 should be good though.


* Smaller thing - fixed the camera view vector stuff up a bit in light 
cache, it now gives much more similar results to non-light cache when using 
anisotropic scattering.
2009-03-18 03:52:17 +00:00
2a373f6c44 Fix for bug #18419: game engine debug drawing interfered with alpha blending. 2009-03-17 22:03:21 +00:00
c5bc4e4fb1 New icon and button for Peel Object option for volume snapping.
Use snap point to get default embedding depth (for overlapping volumes).
2009-03-17 21:26:09 +00:00
2b05a83729 Fixed a problem in how volumes were interpreting textures, and removed
associated workarounds in point density texture.
2009-03-17 05:33:05 +00:00
772e5fbfb0 fix crash with missing image sequence 2009-03-16 21:39:12 +00:00
28f6d223d0 This is patch:
[#17974] two small fix for blender 2.48 (memory leak and uninitalized vars)
Submitted By:
Pavel Nemec (nemecp) 

(changes delete to [] and sets to vars to NULL)

Kent
2009-03-16 17:02:19 +00:00
7d2703c805 Merging etch-a-ton branch in trunk.
Slightly out of date documentation in wiki, I'll be updating that tomorrow.

http://wiki.blender.org/index.php/User:Theeth/etch-a-ton
2009-03-16 02:55:42 +00:00
Nathan Letwory
1e1b88c118 BGE
* getting state of RMB was impossible due to wrong check.
2009-03-15 23:40:59 +00:00
e0b629fe71 update v1.12 - 2009.03.14 by migius
d3 removed all set()functions (problem with osx/python<2.4 reported by Blinkozo)
 d3 code-cleaning
 d2 temp patch for noname BLOCKS (*X,*U,*D)
2009-03-13 23:35:15 +00:00
54a55827ec merging trunk 19093:19274 2009-03-13 18:04:38 +00:00
39acb4efa4 Makefiles: fix definitions of NAN_OPENEXR_* variables on linux, patch provided
by GSR
2009-03-13 10:22:49 +00:00
a37cec2802 BGE patch 18368: Modulus (ie %) expression controller in BGE. Implement a cache for the expression for better performance. 2009-03-11 22:11:52 +00:00
ce637a0046 * Patch by Raul F Hernandez
This adds a header to the voxel data texture's data file format, to 
auto-fill the resolution settings upon loading a file. I don't have a data 
file of the right format to test with, so I'll trust it works and wait for 
confirmation!

It also adds a 'still frame' setting, to pause the voxel data sequence on a 
specified frame, throughout the course of the rendered animation.
2009-03-11 05:32:11 +00:00
0ac3e70160 removed extra space in text.
Kent
2009-03-11 02:58:18 +00:00
943d85131a remove decimation and opennl libs from gameengine.
Kent
2009-03-10 16:06:59 +00:00
d17ca2179d Addes libopenjpeg (jpeg2000) support to the Makefiles
Kent
2009-03-10 16:04:29 +00:00
4a089890df [#18388] PLY Import fails if line ending is not \n
bugfix, read the header as ascii text - open(filename, 'rU'), only the body as binary.
2009-03-10 06:58:42 +00:00
06d455f428 Add support to lock individual axis during rigid body simulation, for translation and rotation. This makes it easier to do 1D or 2D physics (tetris, blockout)
todo: create some example/demo.blend.
2009-03-09 07:12:16 +00:00
6e85d00055 Fix: The debug lines of Physics Debug Visualization were drawn incorrectly when using overlay scenes (it was using the wrong camera) 2009-03-09 05:01:16 +00:00
abb338ddf9 upgrade to latest Bullet trunk, fix related to vehicle anti-roll, added constraint visualization.
This commit doesn't add new functionality, but more updates are planned before Blender 2.49 release.
2009-03-09 04:21:28 +00:00
e4ce0d629e BGE patch: undo patch about removing blenderplayer console in Windows: it interferes with scripts that write to the console. Back to previous state: console cannot be disabled in Windows. 2009-03-08 17:23:36 +00:00
78af62bec8 Addes jpeg2000 support to cmake.
I also did some small tweaks.  removed ifdef's for pluginapi
didn't need them there.
Fixed it so the filesel shows jp2 as image files.
(I'm going to do makefiles next)

Kent
2009-03-06 15:46:13 +00:00
51b3bba1c0 Update MSVC9 project file for VideoTexture 2009-03-05 15:35:15 +00:00
ab8e9ba3dd VideoTexture: reactivate VideoTexture for scons/cmake/makefile compilation systems, fix video streaming, fix camera support in Linux, add multi-thread cache service, fix crash when a VideoFFmpeg object could not be created.
The multi-thread cache service is activated only on multi-core processors.
It consists in loading, decoding and caching the video frames in a 
separate thread. The cache size is 5 decoded frames and 30 raw frames.
Note that the opening of video file/stream/camera is not multi-thread:
you will still experience a delay at the VideoFFmpeg object creation.
Processing of the video frame (resize, loading to texture) is still done
in the main thread.  Caching is automatically enabled for video file, 
video streaming and video camera. 

Video streaming now works correctly: the videos frames are loaded
at the correct rate. Network delays and frequency drifts are automatically
compensated. 
Note: an http video source is always treated as a streaming source,
even though the http protocol allows seeking. For the user it means that
he cannot define start/stop range and cannot restart the video except
by reopening the source. Pause/play is however possible.

Video camera is now correctly handled on Linux: it will not slow down the BGE.
A video camera is treated as a streaming source.
2009-03-05 15:16:43 +00:00
7b197fcfdd MSVC9 project file update for Bullet upgrade. 2009-03-05 09:50:16 +00:00
151317e990 Fix build: don't use Character stuff, it wasn't meant to be included in Blender/extern/bullet2 distro. 2009-03-03 14:31:10 +00:00
982a5cc60d Upgraded to Bullet 2.74. The upgrade introduced a few bugs, which need to be fixed before Blender 2.49.
In particular, the Bullet vehicle seems broken, and some soft-body demos don't work.
No new features or benefits are added yet, but a few improvements are planned before Blender 2.49 release.

Please update the build systems, and add those 3 files:
extern/bullet2/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp
extern/bullet2/src/BulletCollision/CollisionDispatch/btGhostObject.cpp
extern/bullet2/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp

I'll watch the Blender mailing list, in case this commit causes some issues.
2009-03-03 03:41:24 +00:00
f8ef887880 minor update to be compatible with Bullet 2.74 physics:
btPoint3 has been deprecated, it was already a typedef to btVector3
replace std::vector by btAlignedObjectArray when storing Bullet objects, because MSVC STL implementation has some bugs, preventing to contain aligned objects
(btVector3 is 16-byte aligned, to allow SIMD)
2009-03-02 17:43:35 +00:00
Nathan Letwory
cc2e3980f8 * fix linking problem when building WITH_BF_PLAYER=True 2009-03-01 21:23:04 +00:00
892a667959 Limit cascading rotations (rotation on each child of a chain) to Individual Center mode, as I thought I had done at first. :| 2009-03-01 15:03:45 +00:00
d4adc43fc1 BGE patch #18309 commited: Add an addObject() method to KX_Scene. 2009-02-28 22:25:23 +00:00
56977d62d4 BGE patch #18181 commited: Fixing some blenderplayer arguments (-c, -w, -f). 2009-02-28 21:44:24 +00:00
9265150942 MSVC9 project file: add ffmpeg avdevice lib to linker for the blenderplayer. 2009-02-28 21:37:49 +00:00
6c409ed541 BGE API cleanup: apply patch from Moguri: Near, Radar, Touch sensor updated. 2009-02-28 21:00:27 +00:00
541d49bc2c * blender doesn't need the -w anymore to start in a window
* NULL can be used instead of () args for calling python functions from C.
2009-02-28 09:25:42 +00:00
8d3dcfb104 BGE Python API
* Scene's and GameObjects can now be printed (raised an exception)
* Added GameLogic.getSceneList()
2009-02-27 23:53:09 +00:00
e872843c85 blender.desktop file from Rudolf Kastl 2009-02-27 18:49:25 +00:00
Nathan Letwory
c9653cc083 [18327] Fix crash when activating nodes
- faulty linking and header file lead to crashing whenever nodes were used.
2009-02-27 00:08:16 +00:00
4d92526401 build blenderplayer without opennl and decimation 2009-02-26 12:43:24 +00:00
fd1adb58eb better remove t1_generate_luts.c rather then in scons. 2009-02-26 09:14:10 +00:00
c785532bec Py BGE API
Python dir(ob) for game types now includes attributes names,
* Use "__dict__" rather then "__methods__" attribute to be Python 3.0 compatible
* Added _getattr_dict() for getting the method and attribute names from a PyObject, rather then building it in the macro.
* Added place holder *::Attribute array, needed for the _getattr_up macro.
2009-02-26 09:04:06 +00:00
936a6eeda8 small errors in touch sensor and gameObject 2009-02-26 05:17:54 +00:00
f87194820b openjpeg contained a C file with a main() function, user reported it was overriding blenderplayers.
remove this file from building, other build systems should do this too.
2009-02-26 04:40:00 +00:00
6bfb8ca6b0 - Attributes for the collision sensor: propertyName, materialCheck, pulseCollisions, objectHit and objectHitList.
Removed a check in Python API touch.setProperty() for the property name on the sensor owner before allowing the name to be set - it makes no sense and isnt checked when creating the sensor.
- SCA_DelaySensor.py indent error making epydoc fail.
2009-02-26 04:17:23 +00:00
8fa180a9b1 * Fix for a small bug where multiple scattering wasn't being enabled properly.
* Also a MSVC compile fix
2009-02-26 00:13:40 +00:00
dff781c2a8 Continue snapping cleaning job.
Snap to armature correctly in edit mode and when posed.
Merge snap and embed in skeleton sketching. Ctrl key does both, depends on the snap mode (volume or other). Snaps to other strokes in all snapping mode except Volume.
2009-02-25 20:07:45 +00:00
97e70ef3c4 forgot this file- remove Sumo from the menu if its disabled. 2009-02-25 17:20:41 +00:00
a4ad52f1aa New Pulse option for the collision sensor (off by default wont change existing logic)
Previously only the first collision would trigger an event (no collisions a negative event ofcourse)

With the Pulse option enabled, any change to the set of colliding objects will trigger an event.

Added this because there was no way to count how many sheep were on a platform in YoFrankie without running a script periodically.

Changes in collision are detected by comparing the number of objects colliding with the last event, as well as a hash made from the object pointers.

Also changed the touch sensors internal list of colliding objects to only contain objects that match the property or material.

- pulse isnt a great name, could change this.
2009-02-25 17:19:30 +00:00
7fffb0b630 Building the game engine with Solid/Sumo is now optional for scons using WITH_BF_SOLID.
Now Sumo is has been deprecated for a while we might want to remove it for 2.5.
2009-02-25 12:07:51 +00:00
c77af31166 Minor speedups for the BGE
* Where possible use vec.setValue(x,y,z) to assign values to a vector instead of vec= MT_Vector3(x,y,z), for MT_Point and MT_Matrix types too.
* Comparing TexVerts was creating 10 MT_Vector types - instead compare as floats.
* Added SG_Spatial::SetWorldFromLocalTransform() since the local transform is use for world transform in some cases.
* removed some unneeded vars from UpdateChildCoordinates functions 
* Py API - Mouse, Ray, Radar sensors - use PyObjectFrom(vec) rather then filling the lists in each function. Use METH_NOARGS for get*() functions.
2009-02-25 06:43:03 +00:00
2eb85c01f3 remove warnings for the BGE
- variables that shadow vers declared earlier
- Py_Fatal print an error to the stderr
- gcc was complaining about the order of initialized vars (for classes)
- const return values for ints and bools didnt do anything.
- braces for ambiguous if  statements
2009-02-25 03:26:02 +00:00
aa7c45c190 Snaping cleanup, removing a lot of duplicate code.
Snapping to armatures: non-editmode armatures only, rest pose only, ... (this is mostly work in progress code).
2009-02-24 21:25:36 +00:00
56e9c87309 building the game engine without SDL works again 2009-02-24 17:34:41 +00:00
adaa4b0fd0 Making KX_GameObject names read only.
This was committed in revision 2832 but never accounted for existing object name hashes which existed since revision 2.

Its possible to update the names elsewhere but unlikely anyone ever used this successfully so removing.
2009-02-24 12:38:56 +00:00
33aee345ed fix for segfault when the replace mesh actuator references a mesh that has no object in the current scene. 2009-02-24 09:49:28 +00:00
6c7c38a4e4 BGE Py API
* Made GameLogic.addActiveActuator(actu, bool) to raise an error if the actuator is not in the list. Before it would allow any value as the actuator and fail silently (makes debugging scripts more difficult).

* Allow the actuator to be a string which is convenient if you dont want to change the settings of the actuator.
* Added activate/deactivate functions to the controller, this is more logical since the GameLogic.addActiveActuator() function is running through the controller anyway.

GameLogic.addActiveActuator(controller.getActuator("SomeAct"), True)
...can be replaced with...
controller.activate("SomeAct")
2009-02-24 05:50:45 +00:00
394d893e13 compile scripts when converting controllers to give more predictable performance and print syntax errors early on rather then when the script is first executed. 2009-02-24 03:29:31 +00:00
57c7200a65 Merging volume embedding and transform snapping.
- Volume embed is available as a transform snap option (need new icon). Not as "continuous" as stroke embed, will have to be fixed somehow.
- Transform snaps work in armature edit mode (only snap to mesh, not other armatures, for now). Adding to other edit data type should be easy.
- Strokes can use all the transform snap options plus volume embed.

Bug fix: added small threshold to face snap (and volume embed) to prevent slipping in cracks between faces. More tweaking needed but this now takes care of all the worst cases.
2009-02-24 00:45:40 +00:00
7c830b75f1 merging trunk 17520:19093 2009-02-23 21:00:42 +00:00
334da0fa57 [#18291] Viewing muliple object UV's in the UV/Image editor
patch from Chris and Guillermo S. Romero.
2009-02-23 12:35:16 +00:00
373d4fe6d3 [#18323] VRML import will not import colors if pervertexcolors set (comparison reversed)
thanks to Ezra Peisach for fixing.
2009-02-23 12:17:34 +00:00
5488175d0b BGE Python API
* fixed segfaults in CListValue.index(val) and CListValue.count(val) when the pyTypes could not be converted into a CValue.
* added scene.objects to replace scene.getObjectList()
* added function names to PyArg_ParseTuple() so errors will include the function names 
* removed cases of PyArg_ParseTuple(args,"O",&pyobj) where METH_O ensures a single argument.
* Made PyObjectFrom use ugly python api rather then Py_BuildValue(), approx %40 speedup for functions that return Python vector and matrix types like ob.orientation.
2009-02-23 06:41:10 +00:00
Nathan Letwory
1c088b454d SCons
* I accidently broke the scons bit by chopping the node libs into pieces. I forgot that trunk hasn't had the nice scons cleanout I did in Blender 2.5 branch. Now everything should compile again.
  It took a while because I tried to quickly do the same cleanup, but src/ is just not cooperating, neither is stock mingw (no @commands.txt tempfilemunge goodies)
2009-02-22 20:44:36 +00:00
Nathan Letwory
3408d9022a SCons
* chop nodes library into smaller parts to have scons/mingw not puke over long command-lines (the texture nodes pushed the limits).
2009-02-22 15:02:23 +00:00
570b48aae6 BGE Py API
print filename:line with ShowDeprecationWarning().
Typo in scripttemplate_gamelogic.py
removed 2 unneeded typedefs
2009-02-22 10:22:49 +00:00
9d5c2af1d1 * removed typedefs that were not used (from anonymous enums and structs)
* Missed some cases of using a 'char *' as an attribute
* replace BGE's Py_Return macro with Pythons Py_RETURN_NONE
* other minor warnings removed
2009-02-21 12:43:24 +00:00
a3b684d698 [#18277] Segfault crash by editing mesh with subsurf+ParticleInstance modifiers
particleInstanceModifier_applyModifier uses getVertCo,which is not implemented by ccgDM.

getVertCo was used to simply perform a min/max, so it was fixed to use the apropriate min/max
		dm->getMinMax(dm, min_r, max_r);


Maybe the fact ccgDM doesn't implements getVertCo/getVertNo is a bug, since it implements every
other DM function and its strange those are left out.
2009-02-21 12:15:57 +00:00
f87a399978 [#18058] Black dots appear when blender renders with multi-thread and material nodes
Without thread locking the function that allocates new threads, black dots appear in renders.

This wont affect composite nodes,
Ton/Brecht - this is possibly too many lock/unlocks but I timed the render from the bug report and it didn't make a noticeable difference.
2009-02-21 04:42:46 +00:00
7260e8fe29 bugfix [#17941] Attempting to change path of audio to relative fails. 2009-02-21 03:02:39 +00:00
95f91f2a46 MSVC9 project files: reactivate VideoTexture module in BGE; it that was disabled for some reason. 2009-02-19 23:15:27 +00:00
d3e7b37fff BGE API Cleanup: distinction between array and list of values in KX_PYATTRIBUTE macros. Fix compilation problem under Windows with strcasecmp: define it as stricmp 2009-02-19 23:13:41 +00:00
cdec2b3d15 BGE Python API
Use 'const char *' rather then the C++ 'STR_String' type for the attribute identifier of python attributes.

Each attribute and method access from python was allocating and freeing the string.
A simple test with getting an attribute a loop shows this speeds up attribute lookups a bit over 2x.
2009-02-19 13:42:07 +00:00
c597863783 "object" and "objectLastCreated" attribute for actuators, deprecates getObject/setObject() & getLastCreatedObject()
also removed some warnings
2009-02-19 10:34:51 +00:00
92d4ef0939 Accept negative indices's for ListValues
scene.getObjectList()[-1] works like a python sequence.

removed some STR_String creation that was only used to do comparisons, in a simple expressions benchmark this made logic use 4% less overall.
2009-02-19 07:01:49 +00:00
7d2582de09 more uninitialized variables and auto-complete could copy a string over its self. 2009-02-18 05:49:51 +00:00
21925c6f47 uninitialized variable used in mesh_foreachScreenVert__mapFunc 2009-02-18 04:43:12 +00:00
7a96881795 disable texture clamping while painting. 2009-02-18 03:56:16 +00:00
f6b0b76fea [#18159] Path -> toggle cyclic -> toggle cyclic again == path corrupted
was not recalculating the knots when the cyclic flag was disabled so the endpoint flag was being ignored until recalculating (extrude for eg).

Also removed unneeded re-allocation of curve knots which are always reallocated by makeknots.

Fixed another bug with which recalculating knots with the Python surface api. (mixed up u/v args to makeknots(..) )
2009-02-18 03:13:57 +00:00
28245a754e python api bugfix,
forgot to remove the cast from short to long when making x,y aspect floats.
2009-02-17 14:41:36 +00:00
def36ce180 fix for [#17972] Saving/Loading Radiance HDR changes colors
removed HDR loop that loaded 8bit color channels (which was incorrect)
and added a call to IMB_rect_from_float at the end.

This also means that char buffers wont be created if they are not needed.
2009-02-17 04:32:49 +00:00
e5a5399c33 [#17991] Anim rendered in BMP format won't play back
fix from Sebastian Kochman (raiq)  - [#18022]
2009-02-17 04:11:20 +00:00
25ab515951 bugfix [#18003] Rev-17473: Scene sets doesn't work in links 2009-02-17 03:43:56 +00:00
Nathan Letwory
c3d74547be SCons:
* giving compileflags, cc_compileflags and cxx_compileflags to BlenderLib() now actually overrides any other setting (so there's no unclarity when ie. conflicting options are being specified in REL_CFLAGS et al). These are set after either release or debug flags, but before any *_WARN flags (so those stay maintained).
* add cxx_compileflags for GE parts on win32-vc to have better performance.
* NOTE: if platform maintainers (OSX and Linux) could check and do the same for their systems. Not vital, but probably very, very much welcomed by GE users.
2009-02-15 23:26:00 +00:00
915baae622 BGE bug #18137 fixed: When two actors collide in this blend file the blender crashes. 2009-02-15 19:07:27 +00:00
b052ae4cdb [#18209] 3 VSE crash bugs with .blends (all left click and move mouse over Metastrip/Blend Mode related)
Workaround for a bug where dragging the playhead over a metastrip with blending on it could segfault blender.
Tried to figure out why the imbuf rect is not set, but for now a NULL check stops the crash.
2009-02-13 06:24:15 +00:00
64d2984aa0 add some more modifier types and access to shrink wrap target object (but no other shrink wrap settings) 2009-02-12 16:27:19 +00:00
c12149cf26 According to Amir Ebrahimi, fbx vertex color is supposed to be between 0.0 and 1.0 rather then 0-255
At the moment I dont have a way to test this.
2009-02-12 01:46:38 +00:00
fec8107281 Once a linked image was selected, from a texture there was no way to switch to a local image because the dropdown was blocked with a linked library error message.
Remove linked library checking from this image selector, this isn't quite correct since the texture could be linked too, however there is no access to the texture data (or other users) when this button is drawn.
2009-02-11 08:16:42 +00:00
227c84f64e dpx/cineon was using the OUTPUT settings when loading DPX - white point, blackpoint, gamma, log.
Allow DPX's with different color channel types to load, even if they are unsupported.

Saving log DPX's is broken, the header will always be written with log off because dpxCreate is called before the image presets are set. However there is no access to image presets before running dpxCreate() so log data is written but the header always sets it off.
Made a fix for this but couldn't test because it seems loading log images is also broken.

Enable verbose DPX output when '-d' debug flag is used.
2009-02-10 02:43:35 +00:00
41a7b23c41 - Py seq API - Added an option for seq_strip.update() to run update_changed_seq_and_deps and new_tstripdata
- Render stamp sequencer option wasn't ignoring muted strips.
2009-02-09 04:18:30 +00:00
ecf5250cf3 == Sequencer ==
Fix for the transform fix. It's getting late...
2009-02-08 19:54:11 +00:00
7877fb2f83 == Sequencer ==
Fixed proxy scale problems in transform effect
2009-02-08 19:28:12 +00:00
270b724b8d == REDCODE ==
Fixed 64bit issues. sizeof(unsigned long) = 8 on 64 bit machines, 
shame on me...
2009-02-08 19:13:29 +00:00
0039da6ed8 == REDCODE ==
* Fixed ntohl dependency (and hopefully 64bit issues)
* Video length detection fixed (tests for picture presence)
2009-02-08 09:07:36 +00:00
4f3768af49 Update MSVC9 project files 2009-02-07 20:47:23 +00:00
59e96a2831 BGE Py API cleanup: Camera Actuator. 2009-02-07 20:35:16 +00:00
e40803a5b3 Fix for bug #18228: OpenGL specular did not get the correct view
vector in perspective mode. This is default OpenGL behavior, but
by now this optimization is really insignificant. Works in both
the 3d view and game engine.
2009-02-06 19:21:24 +00:00
09099111e3 Added Scale, fixed bugs incl. patch #18037 2009-02-06 18:09:35 +00:00
86c25491e1 [#18257] Workaround for bug in freealut 1.1.0
by Jörg Müller (nexyon) 

Since this area is not maintained, I can only say it works on my system (linux/32bit)
And nexyon assured me he checked over this patch well.
Blender using the deprecated function is not great, but nexyon's bugfix would not be available until the next version of freealut so better to work around it by using the new function.

Please test game sounds play back on win32 and Mac, in cases that it worked in the first place.
2009-02-06 16:38:53 +00:00
8f70b93124 2.4x Sequencer Python API
- add metastrips now possible
- access to speed options
- access to wipe options
- added seq.startDisp seq.endDisp seq.update()
2009-02-06 14:03:29 +00:00
6a669d00b2 Patch #18015, adds "Value to Normal" node 2009-02-06 01:21:38 +00:00
fbdd75a475 Added compose/decompose, fixed bugs. 2009-02-06 00:55:38 +00:00
e25318ebef Rename correlation subdividing method into adaptative subdividing method, since that's what it's trying to do and much more understandable from a user's pov. 2009-02-04 21:38:03 +00:00
8837d69ed3 Bugfix #18251
Patch from Konrad Kleine

After read-home file (or restore factory settings) the opengl
lights have to be reset.
2009-02-04 17:56:31 +00:00
fe1c4ecd89 Relative option for the blur node only applied when the UI updated.
This meant that changing the image size later on would still use the old size.

Set the relative blur size when executing the node too.
2009-02-04 06:41:48 +00:00
4286730d34 dropdown for bone creation method and swap params in panel instead of having all of them visible all the time. 2009-02-04 02:55:24 +00:00
08b1d58738 Allow enter/exit editmode in background mode. (asking for trouble doing this but the checks are simple) 2009-02-03 12:31:40 +00:00
7c48f1994a patch for paths_svg2obj.py by author jms:
This patch solves some major problems of the svg script :
- reading of the inkscape svg format
- parsing of the scientific numbers
- redundant arc data in the same path for only one command "a"
- blending of curves after several files import and at the end a more correct management of the current point.
2009-02-02 00:31:46 +00:00
c63fcd2799 Fix revision: 18690, bug #17850
The problem was that Qt convert the text to the type
STRING or UTF8, that is why Blender can't get the text,
now should be work fine.
2009-01-30 21:01:18 +00:00
0409977aa8 [#18241] Very minor bugfix and typo correction for wavefront obj exporter and importer python scripts
from Michael Judd.

Also removed .keys() for a loop in impor_obj.py since its the default dictionary iterator.
2009-01-30 02:01:16 +00:00
1cec028c91 fix remaining bug in straighten command
restrict snapping to exact (poly) points when snapping to the currently drawn stroke.
2009-01-29 22:45:59 +00:00
56d2dc7e7f bug fix softbody wind
-compensating factor 1000 that comes from 
pdDoEffectors() since Aug 2008
-give  particles and soft body vertices the same 
polarity on force fields.
2009-01-28 12:34:22 +00:00
561a9b3d4c svn merge -r 17502:18705 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2009-01-28 00:43:46 +00:00
7eae2080f2 Fix for bug #18087: Editing of object name and modifiers did not
work in editing buttons if the object data was linked.
2009-01-27 22:09:23 +00:00
5542f25331 Fix for bug #18167: setting Constraint.Settings.SCRIPT checked for type
Object rather than Text so did not work when assigning a text to it.
2009-01-27 21:26:31 +00:00
a21cdd9369 Fix for bug #18183: crash when using "Bake Constraints" script. The constraint
remove function was not working correct, this code uses a pretty bad hack, did
not clean it up, but at least it should work now.
2009-01-27 21:19:19 +00:00
2e610b3fb2 Fix for bug #17961: crash with material copy/past and GLSL. 2009-01-27 20:17:32 +00:00
4977609832 Fix for bug #18066: made UV Unwrap > Reset same as the default UV
coordinates when creating a new layer.
2009-01-27 19:59:12 +00:00
d95d110d8d [#17850] Copying text from Eric4 to Blender crashes Blender
The crash is caused by calling XGetWindowProperty when xevent.xselection.property is zero.
Not a proper fix because clipboard can paste the data without trouble.
2009-01-27 08:17:35 +00:00
a17eade622 - Made embbed point rely on last embbed preview (when holding down shift and moving mouse around) for finding the proper depth. This makes it much easier to do polylines on partially occluded areas: just shift-hover a visible section than move to where you want along the volume before clicking to place a point (this sounds complicated but it isn't).
- Replace Cutout command by Straighten. Fonctionnality is the same except that it now keeps points in between cuts, just straightens them.
2009-01-26 22:43:12 +00:00
9146687ffc let the game engine compile, if WITH_FFPEG is not defined (so we don't have video textures in that case) 2009-01-26 06:31:06 +00:00
1ed26fffb8 Volume rendering: multiple scattering
This is mostly a contribution from Raul 'farsthary' Hernandez - an approximation for 
multiple scattering within volumes. Thanks, Raul! Where single scattering considers 
the path from the light to a point in the volume, and to the eye, multiple scattering 
approximates the interactions of light as it bounces around randomly within the 
volume, before eventually reaching the eye.

It works as a diffusion process that effectively blurs the lighting information 
that's already stored within the light cache.

A cloudy sky setup, with single scattering, and multiple scattering:
http://mke3.net/blender/devel/rendering/volumetrics/vol_sky_ss_ms.jpg
http://mke3.net/blender/devel/rendering/volumetrics/sky_ms.blend

To enable it, there is a menu in the volume panel (which needs a bit of cleanup, for 
later), that lets you choose between self-shading methods:

* None: No attenuation of the light source by the volume - light passes straight 
through at full strength
* Single Scattering: (same as previously, with 'self-shading' enabled)
* Multiple Scattering: Uses multiple scattering only for shading information
* Single + Multiple: Adds the multiple scattering lighting on top of the existing 
single scattered light - this can be useful to tweak the strength of the effect, 
while still retaining details in the lighting.

An example of how the different scattering methods affect the visual result:
http://mke3.net/blender/devel/rendering/volumetrics/ss_ms_comparison.jpg
http://mke3.net/blender/devel/rendering/volumetrics/ss_ms_comparison.blend


The multiple scattering methods introduce 3 new controls when enabled:
* Blur: A factor blending between fully diffuse/blurred lighting, and sharper
* Spread: The range that the diffuse blurred lighting spreads over - similar to a 
blur width. The higher the spread, the slower the processing time.
* Intensity: A multiplier for the multiple scattering light brightness

Here's the effect of multiple scattering on a tight beam (similar to a laser). The 
effect of the 'spread' value is pretty clear here:
http://mke3.net/blender/devel/rendering/volumetrics/ms_spread_laser.jpg

Unlike the rest of the system so far, this part of the volume rendering engine isn't 
physically based, and currently it's not unusual to get non-physical results (i.e. 
much more light being scattered out then goes in via lamps or emit). To counter this, 
you can use the intensity slider to tweak the brightness - on the todo, perhaps there is a more automatic method we can work on for this later on. I'd also like to check 
on speeding this up further with threading too.
2009-01-26 02:42:17 +00:00
99e549480b == Python: Space Handler Scriptlinks ==
Bugfix (patch #18216)

I made a mistake on my previous try to fix this. I fixed something, tested, decided I should move the call to run spacehandlers to a better place, but missed removing the old call (ugh). Thanks Steven Truppe (rocketmagnet) for emailing me about it and for the patch.
2009-01-25 17:49:39 +00:00
f1948b363d BGE patch 18211: Bug Fix for: [#18175] error on anaglyph view of a splitted viewport. 2009-01-24 21:19:35 +00:00
Nathan Letwory
ca5fe954f4 * make sure openjpeg stuff compiles and links properly.
- since we use this only as statically linked, I took out
    some confusing #ifdefs.
2009-01-24 18:09:03 +00:00
10e39a2331 jpeg2000 commit missed the 2 most important files. 2009-01-24 10:19:29 +00:00
fc7af897b7 Prevent overdrawing to trigger when starting a stroke by snapping to an existing point.
Overdrawing copies point type from start and end point (better for polyline)
misc renaming some structs and vars (cleanup mostly)
2009-01-23 21:34:51 +00:00
55150edc92 [#18164] jpeg2000 patch, with some fixes from Peter too.
Support for jpeg2000 and writing DCI Cinema standard files.

Notes
* 12 and 16bit channel depths are converted from/to blenders float buffer.
* Grayscale/RGB with alpha supported.
* Theres an option to save color channels as YCC rather then RGB.
* Quality 100 saves lossless
* The UI is a bit weired because of the DCI standards need to be given to the encoder.
2009-01-23 21:08:01 +00:00
8a95c67a50 BGE API cleanup: shape action actuator. 2009-01-22 17:40:47 +00:00
c6715de1e9 misc bug fixes and display adjustments 2009-01-21 22:20:16 +00:00
73cffd9aad == Scripts ==
- Scripts Help Browser: error parsing doc info wrapped in triple single quotes, like done in the 3ds importer. Thanks Jean-Michel (jms) for informing me about it.
2009-01-21 15:45:31 +00:00
8bd7aa0a01 BGE API cleanup: action actuator. 2009-01-21 13:54:53 +00:00
ff52dcbf0d Bugfix: Transform Snap
Would crash if snapping from a mesh in edit mode to a group instance including that same mesh.

Reported by UncleZeiv on IRC
2009-01-18 22:09:29 +00:00
16aa62e058 Command Gesture - Polygonize
New command option to turn continuous strokes into polylines.
2009-01-16 20:24:31 +00:00
bae2de3f1a minor corrections 2009-01-16 10:51:30 +00:00
ce3dca24d1 have had few requests to use blender for performing background tasks
- visualizing data, rendering scenes automatically and character rendering on a server.

This example script shows how you can run blender in background mode, parse arguments from the command line to generate a simple scene and render/save it.
2009-01-15 22:16:29 +00:00
c0ecbfce0e blender was crashing if no argument was given after '-t'
mesh.faces.deltete(...) with an empty list no longer returns an error.
2009-01-15 18:06:06 +00:00
509ca83ef1 BGE patch 18065: gameobj mass writeable + setmass actuator. This patch allows to change the mass of a dynamic or rigid body object during the game. Two methods are available: in a Python script by setting the mass attribute of the game object; by logic brick with the Edit Object->Dynamics->Set Mass actuator. The mass can only be set on dynamic objects and must be a positive floating point value. 2009-01-14 22:33:39 +00:00
00c12e0906 BGE patch: dynamically update the coumpound parent shape when parenting to a compound object.
This patch modifies the way the setParent actuator and KX_GameObject::setParent() function
works when parenting to a compound object: the collision shape of the object being parented
is dynamically added to the coumpound shape. 
Similarly, unparenting an object from a compound object will cause the child collision shape
to be dynamically removed from the parent shape provided that is was previously added with 
setParent.

Note: * This also works if the object is parented to a child of a compound object: the
        collision shape is added to the compound shape of the top parent.
      * The collision shape is added with the transformation (position, scale and orientation)
        it had at the time of the parenting.
      * The child shape is rigidly attached to the compound shape, the transformation is not
        affected by any further change in position/scale/orientation of the child object.
      * While the child shape is added to the compound shape, the child object is removed from
        the dynamic world to avoid superposition of shapes (one for the object itself and
        one for the compound child shape). This means that collision sensors on the child
        object are disabled while the child object is parent to a compound object.
      * There is no difference when setParent is used on a non-compound object: the child
        object is automatically changed to a static ghost object to avoid bad interaction
        with the parent shape; collision sensors on the child object continue to be active
        while the object is parented.
      * The child shape dynamically added to a compound shape modifies the inertia of the
        compound object but not the mass. It participates to collision detection as any other
        "static" child shape.
2009-01-13 22:59:18 +00:00
7f5073729f Bullet bug fix: bad pointer in btCompoundShape::addChildShape() - patch submited to Bullet forum. This bug fix is needed in preparation of the setparent coumpound shape patch. 2009-01-13 22:21:04 +00:00
b71bc3a2f3 patch from Thomas Dinges, update URLs in help scripts 2009-01-13 15:48:27 +00:00
0066b6a8aa fix for big in yesterdays commit, color values were not initialized 2009-01-13 05:55:48 +00:00
6cfbb0017a * Little feature, blend texture can have extrapolation modes (like repeat).
This should probably go in trunk, but I'll stay away for now with all the 2.5 work on.
2009-01-13 02:39:46 +00:00
d0b953d860 can now add sequencer effects with the python api
also fixed crashes when incorrect args were used

cross = 13; track= 5; frame = 1 # no effect constants 
scene.sequence.new((cross, seq1, seq2), frame, track)
2009-01-12 15:58:32 +00:00
ae15fc5e46 [#18082] make uvcalc_follow_active_coords.py bypass the gui and accept arguments when called from another script
from Bill N (slow67)

Also made uvcalc_quad_clickproj.py and uvcalc_follow_active_coords.py add UV's if they didn't exist.
2009-01-12 04:07:06 +00:00
278d6758ea == Scripts ==
- Scripts Help Browser: Brendon Murphy requested and Kevin Morgan implemented a "run script" button.
- AC3D importer: option to store emis color from .ac file in mirror color in Blender (the exporter has the option to export mirror color as emis). Patch by Francesco Brisa.

Thanks for the contributions.
2009-01-11 16:13:00 +00:00
9f742a0ba1 Don't change point type on overdrawn when there's only one. 2009-01-09 22:13:59 +00:00
07599ab3b2 limit overdraw to at least start or end near another stroke (otherwise, all strokes that crossed others replace them entirely). 2009-01-09 20:50:13 +00:00
7e76ce5d67 missing test for start of line caused crashes. 2009-01-09 20:35:37 +00:00
f1c4b4e7c5 Last version of overdraw didn't work great with polylines. Fix this and misc wrong initial values. 2009-01-09 19:25:10 +00:00
0572f1a5f6 * fixed an incredibly silly typo-bug in light cache 2009-01-08 22:49:03 +00:00
133ddcff04 display overdrawn stroke in gray, to easily see what is being replaced. 2009-01-08 18:23:48 +00:00
1240b0272d adjust strokes by redrawing over them
(has to be turned on in the panel because it can give unexpected results sometimes right now)

http://vimeo.com/2753749

http://blenderartists.org/~theeth/bf/etch-a-ton/adjust.ogv
2009-01-07 21:46:10 +00:00
fc12ec2317 don't raise exceptions on some errors unless debugging 2009-01-07 11:27:17 +00:00
5296928728 confusion between Inline and externproto nodes 2009-01-07 03:34:12 +00:00
9b3727b5e0 Fix crasher on non-reset pointer. Mostly happened panning view while drawing. 2009-01-06 19:00:22 +00:00
f6f309d2d1 In the panel, next to the number of joints, display the name of the current bone while sketching joints. Displays "Bone offset" when the next bone is not connected. Displays "Done" when all joints have been draw (note: you can draw more joints then needed, the retargetting algo will use the most useful ones).
Convert gesture is back. This time, it's a 3 straight line that cross itself once gesture (like drawing a triangle and recrossing the first line).
2009-01-06 18:10:13 +00:00
70c5417ed6 Added support for EXTERNPROTO's and fixed a bug where relative Inline URL's that included a path didn't load 2009-01-06 12:30:28 +00:00
823aa30cba string extraction wasnt working + minor changes 2009-01-06 08:58:45 +00:00
49b5edddd4 left testing lines uncommitted by mistake 2009-01-05 10:54:26 +00:00
ee7a52b7fe added static python option for mingw 2009-01-05 03:26:18 +00:00
e64b8599e1 C files reference "libredcode/format.h", which only exist in extern/libredcodec/format.h, so for now adding "extern/" as an include when redcode is enabled lets it compile,
noticed there are some win32 ifdef's that don't do anything.

should be fixed properly but this at least compiles for now.
2009-01-04 07:56:51 +00:00
92ab0c0369 [#18142] Blender FBX export outputs broken vertex colors when using vertex paint
from Kevin Hsu (caywen) 
use fix suggested in report
2009-01-03 14:02:14 +00:00
9ce30005de BGE bug #18070 fixed: 2dFilter actuator is always pulsed. 2009-01-02 22:15:05 +00:00
10702bf93f BGE API cleanup: more bricks converted to attributes. 2009-01-02 22:09:57 +00:00
cc569504d0 BGE API Cleanup: update the python attribute definition framework.
* Value clamping to min/max is now supported as an option for integer, float 
  and string attribute (for string clamping=trim to max length)
* Post check function now take PyAttributeDef parameter so that more 
  generic function can be written.
* Definition of SCA_ILogicBrick::CheckProperty() function to check that
  a string attribute contains a valid property name of the parent game object.
* Definition of enum attribute vi KX_PYATTRIBUTE_ENUM... macros. 
  Enum are handled just like integer but to be totally paranoid, the sizeof()
  of the enum member is check at run time to match integer size.
* More bricks updated to use the framework.
2009-01-02 17:43:56 +00:00
abd4934d1a fix for a memory leak in NMesh (deprecated api) while looking at bug report...
[#18139] Memory Leaks while using Py_BuildValue
2009-01-01 16:18:54 +00:00
2dfd34994f BGE API cleanup: introduction of a generic framework to link Python attributes to logic brick class member. See KX_PYATTRIBUTE macros in PyObjectPlus.h. 2008-12-31 20:35:20 +00:00
834fda50d9 Volume rendering
* Fixed an old problem where if both the camera and a solid surface were 
inside a volume, the volume wouldn't attenuate in front of the surface (was 
visible in the blender conference art festival clouds animation:

http://mke3.net/blender/devel/rendering/volumetrics/vol_shade_cam_inside.mov

* Initial support for refracting solids inside volumes. I might be able to 
make this work better, but not sure at the moment. It's a bit dodgy, 
limited by the code that does the recursive ray shading - it's really not 
set up for this kind of thing and could use a refactor very much.
2008-12-31 05:08:04 +00:00
eee013d9b9 use higher precession pi 2008-12-31 02:13:38 +00:00
cbceb6c8b2 BGE API cleanup: more consistent type check on set attribute (mouse and keyboard so far). Check type after name so that the user get a type error when assigning a wrong type to a built-in attribute. 2008-12-30 16:44:34 +00:00
cbc3c7e878 script was adding UV's rather then vertex Colors (this was correct before uv & vcol layers existed) 2008-12-30 08:25:36 +00:00
bd97dd0846 mistake in previous commit, stopped CurNurbs from appending 2008-12-30 05:00:19 +00:00
1c663bbc7e First batch of GE API cleanup.
The principle is to replace most get/set methods of logic bricks by direct property access. 
To make porting of game code easier, the properties have usually the same type and use than
the return values/parameters of the get/set methods. 
More details on http://wiki.blender.org/index.php/GameEngineDev/Python_API_Clean_Up

Old methods are still available but will produce deprecation warnings on the console: 

"<method> is deprecated, use the <property> property instead"

You can avoid these messages by turning on the "Ignore deprecation warnings" option in Game menu.

PyDoc is updated to include the new properties and display a deprecation warning
for the get/set methods that are being deprecated.
2008-12-29 16:36:58 +00:00
d91daaa5f6 MSVC project file update for ffmpeg device lib, release build 2008-12-29 14:26:36 +00:00
aa56346b12 * disable back buffer selection drawing while projection painting (was redoing for every update while painting)
* remove unneeded return from game engines py api - ConvertPythonToGameObject
2008-12-24 21:53:15 +00:00
cbebe4ad46 * bpy curve api wouldn't give correct errors for bad arguments when appending nurbs.
* the radius on the curves first point was ignored. 
* mesh_edges2curves.py was giving all points a tilt of 1.0
2008-12-24 15:46:26 +00:00
3a4ead8f0f fix for own mistake - [#18119] Texture Paint: "clone from layer" button not drawn in buttons window 2008-12-24 02:06:34 +00:00
5a96981cc6 improved PROTO support, works for many testfiles now. 2008-12-23 06:47:43 +00:00
be1d06a2c5 Volume rendering:
* Multithreaded volume light cache

While the render process itself is multithreaded, the light cache pre-process 
previously wasn't (painfully noticed this the other week rendering on some 
borrowed octocore nodes!). This commit adds threading, similar to the tiled render - 
it divides the light cache's voxel grid into 3d parts and renders them with the 
available threads.

This makes the most significant difference on shots where the light cache pre-
process is the bottleneck, so shots with either several lights, or a high res light 
cache, or both. On this file (3 lights, light cache res 120), on my Core 2 Duo it now 
renders in 27 seconds compared to 49 previously.

http://mke3.net/blender/devel/rendering/volumetrics/threaded_cache.jpg
2008-12-22 20:28:02 +00:00
05fc2aa9da pose_grab_with_ik_clear(): fix bug with memory used after being freed. 2008-12-22 16:56:14 +00:00
6158762797 WIP - support for VRML PROTO's 2008-12-22 15:05:07 +00:00
601fb5e6fa Bugfix - Fixed crashes in Action Editor on Ctrl-L due to missing NULL checks. 2008-12-22 10:52:17 +00:00
f288a43457 define WITH_CCGSUBSURF isnt used anymore 2008-12-21 03:11:32 +00:00
eb1d0e139f Bugfix since rev 2, BLO_setversionnumber() was using sizeof(array), which gives the sizeof the pointer, not the array.
On a 64bit system I assume this would set 8 chars of a 4 char array.

Turns out this isnt such a problem since BLO_setversionnumber isn't used anymore but way as well commit.
2008-12-20 17:09:45 +00:00
c67d26602f id prop update function was receiving a tuple when it only needed a single arg 2008-12-20 08:41:46 +00:00
630c16feb7 patch [#18110] [patch] Update blenderplayer.exe -h text
from Mitchell Stokes (moguri)
2008-12-20 07:12:38 +00:00
5881922bc5 Add G_FILE_IGNORE_DEPRECATION_WARNINGS option to G.fileflags in preparation of BGE python API cleanup 2008-12-19 20:35:53 +00:00
4a3630751d Cleaner code for gestures.
Command gesture (for flatten and cutout) now needs to intersect a line in two points and end in a pig tail (loop and intersect itself).

This is easier than the cross three times and self interesect once of before.
2008-12-19 19:47:25 +00:00
3c9ae035fb Typo was making actuator.getExecutePriority() crash 2008-12-19 03:26:41 +00:00
a755342b14 Bugfix for crash with loading fluidsim files, reported by Gimble3d and nudelZ 2008-12-18 22:08:57 +00:00
04ef5be177 FFmpeg upgrade to revision 12758 (avformat version 52.13): support libavdevice for video capture in VideoTexture module (BGE). Makefile, CMake, scons updated. FFmpeg binaries will have to be rebuilt for certain OS (irix), win32 binaries already up to date. You MUST do a clean rebuild after this patch. Scons users: pay attention that the config/<os>-config.py files have changed, adapt your user-config.py in consequence 2008-12-17 20:52:39 +00:00
Nathan Letwory
3c886d7c38 * commit r17900 by Genscher was wrong.
- Instead of defining such defines for the entire codebase in Blender.py, add
    the right checks and definitions to the places where it matters.
  - Only check+set WITH_BULLET instead of also GAMEBLENDER=1
  - NOTE: No global defines allowed in BlenderLib.
2008-12-17 05:40:40 +00:00
9776749438 Reverting revision 17417 which broke cloth collisions which check also in blenkernel/intern for WITH_BULLET 2008-12-17 00:41:07 +00:00
7714f17eca Applying scons compiling fix for windows/mingw (to get compiler warnings to show up). This has already been applied in other branches too 2008-12-16 22:57:15 +00:00
0611154cfe Flatten and Cut Out tools for correcting errors in strokes.
Ogg Video: http://blenderartists.org/~theeth/bf/etch-a-ton/gesture_command.ogv
Vimeo: http://vimeo.com/2546077
2008-12-16 21:07:12 +00:00
882d85a968 Patch from Banlu Kemiyatorn
replace VecMulf(var,-1) with new VecNegf(var) function.
2008-12-16 12:32:10 +00:00
4da3c4b9d5 fix for [bf-blender-Bug Tracker][18089] scons compiling bug
and removed unused vars
2008-12-16 11:26:55 +00:00
Chris Want
024b4b3dda B
Linking of blenderplayer was failing with unresolved symbols
(initVideoTexture) when building without FFMPEG. Needs
testing with SCons and Makefiles.
2008-12-15 20:53:45 +00:00
Chris Want
b99f74c8e8 Make sure that WITH_OPENEXR is defined when sources are configured
with OpenEXR in the CMake system. This is a compilation fix from
Miguel A. Figueroa Villanueva for building Debug versions of Blender
using OpenEXR (thanks!).
2008-12-15 17:47:57 +00:00
4d21036829 bugfix #17989
Patch from Xavier Thomas.

Compositor, filter node, had shifted output when used on single-value
buffers.
2008-12-15 08:37:39 +00:00
d99686a783 Touch/NoOverwrite options were not disabled for video. 2008-12-15 08:29:31 +00:00
7124d321d8 * msvc compile fix 2008-12-15 05:49:56 +00:00
Ken Hughes
ba6972eb4d Python API
----------
Bugfix #18044: missing return statements in getter for displacement modifier
caused incorrect values to be returned.
2008-12-15 05:30:09 +00:00
e7c0666d96 DXF exporter, dxf-library.py updated
v1.28 - 2008.12.13 by Steeve/BlenderArtists
- bugfix for EXTMIN/EXTMAX to suit Cycas-CAD
2008-12-14 21:26:24 +00:00
c794e13ba3 bugfix in pickMeshRayFaceWeight() in bpymodules/BPyMesh.py 2008-12-14 18:39:58 +00:00
5f55aa43d0 * Compile fixes for voxeldata.c (thanks jms)
* Fixed a typo in the patch that made trilinear interpolation really slow

* Replaced the patch's trilinear interpolation code with the existing trilinear code from pbrt / light cache (first stage of unifying this voxel interpolation code)
2008-12-14 02:22:29 +00:00
ba8ea9ec63 2008-12-13 23:11:12 +00:00
b9713d19e4 adding hint
Building on NSIS_Installer fails when path to NSIS tools is not set
2008-12-13 23:04:36 +00:00
f8aa295596 projection paint cleanup (nothing to see here)
* BarycentricWeightsPersp2f was calling BarycentricWeights2f, and re-weighting. Changed so the re-weighting isnt needed.
* replaced tri_depth_2d with VecZDepthOrtho and VecZDepthPersp
* project_paint_occlude_ptv_clip now calls project_paint_occlude_ptv to remove duplicate code.
2008-12-13 16:11:52 +00:00
c2f037da07 and the new voxel data files.. 2008-12-13 05:43:10 +00:00
92f5c719ae * Volume Rendering: Voxel data
This commit introduces a new texture ('Voxel Data'), used to load up saved voxel 
data sets for rendering, contributed by Raúl 'farsthary' Fernández Hernández 
with some additional tweaks. Thanks, Raúl!

The texture works similar to the existing point density texture, currently it 
only provides intensity information, which can then be mapped (for example) to 
density in a volume material. This is an early version, intended to read the 
voxel format saved by Raúl's command line simulators, in future revisions 
there's potential for making a more full-featured 'Blender voxel file format', 
and also for supporting other formats too.

Note: Due to some subtleties in Raúl's existing released simulators, in  order 
to load them correctly the voxel data texture, you'll need to raise the 
'resolution' value by 2. So if you baked out the simulation at resolution 50, 
enter 52 for the resolution in the texture panel. This can possibly be fixed in 
the simulator later on.

Right now, the way the texture is mapped is just in the space 0,0,0 <-> 1,1,1 
and it can appear rotated 90 degrees incorrectly. This will be tackled, for now, 
probably the easiest way to map it is with and empty, using Map Input -> Object.

Smoke test: http://www.vimeo.com/2449270

One more note, trilinear interpolation seems a bit slow at the moment, we'll 
look into this.

For curiosity, while testing/debugging this, I made a script that exports a mesh 
to voxel data. Here's a test of grogan (www.kajimba.com) converted to voxels, 
rendered as a volume: http://www.vimeo.com/2512028

The script is available here: http://mke3.net/projects/bpython/export_object_voxeldata.py

* Another smaller thing, brought back early ray termination (was disabled 
previously for debugging) and made it user configurable. It now appears as a new 
value in the volume material: 'Depth Cutoff'. For some background info on what 
this does, check:
http://farsthary.wordpress.com/2008/12/11/cutting-down-render-times/

* Also some disabled work-in-progess code for light cache
2008-12-13 05:41:34 +00:00
aa40953210 Projection Painting, merge from branch
Additions/Features...
 - Painting onto multiple images at once.
 - Clone with an offset similar to the gimp, also an option to clone between UV layers, (not both offset and between layers atm)
 - Stencil layer, similar to The Gimp's quickmask.
 - Face mask mode - (painting onto only selected faces).
 - Texture brushes (so image and texture-node brushes too)
 - Seam bleed so you don't see gaps when painting over UV seams (new option set in the panit panel)
 - Occlusion (only point onto the first face under the paintbrush, can also be used for masking out parts of the model to paint onto) - (new option set in the paint panel)
 - Muti-threaded, each thread operates on its own bucket.
 - Support partial updates to speedup OpenGL texture refreshing.
 - Support tile based multiple undo's
 - Support float image buffers.
 - Backface culling (new option set in the paint panel)
 - All color blending modes - Add/Multiply.. etc.
 - Airbrush rate. (used to be broken) 
 - Improve the way paint is mixed when painting, so painting with 0.2 alpha will not accumulate above 0.2 alpha on the image as you paint.
 - Option to use normals to fade out strokes on the edge of a surface to avoid ugly edges. (same as Vertex Paints "Normal" option) 

Known Problems
 - Not directly related to painting but changes in selection flags are not updated on the final derived mesh.
 - Smear tool has some distortion when in perspective mode. 
 - While in perspective view any faces with 1 vert behind the viewpoint, will be completely ignored.
 - Painting can be initially slow while buckets are being initialized, a number of solutions exist.
 - Size 1 brushes don't work yet.
 - When painting onto large faces its still possible to get artifacts.
 - Spatial optimizations are needed to skip occluded faces and test pixel occlusion. (will look into using blenders BVH )
2008-12-12 18:59:17 +00:00
696ef1afd2 minor changes 2008-12-12 18:31:34 +00:00
6f78cdd79f view.c
* Renamed view_autodist to view_mouse_depth
 * Accept args for mouse location and pixel distance around the hotspot used to lookup the depth.
 * removed persp(PERSP_VIEW) within this function, since it didnt set the view back.

imagepaint.c
 * normal falloff now works as Brecht suggests. Normal limit of 80 will blend between 80 and 85deg,  70deg limit blends between 70-80deg.
 * convert normal falloff to radians on initializing rather then on every comparison.
 * Ctrl+Click setting the cursor in its own function.
 * projection painting wasnt accounting for an exception for too high pressure values on first touch in windows for some tablets.
 * removed grease pencil benchmark function
2008-12-12 17:56:19 +00:00
e94dae4c03 VRML/X3D
* Improved compatibility with VRML files
* Extract strings so they dont get modified for parsing, filename URL's with {} [] dont break importing anymore.
* Cameras were rotated incorrectly
* inline files were not opened with GZip
* Animation Support - currently only loc/scale/rot (scale untested)
* Lists of image URLs now use the first image from the list since there is no support for dynamic switching.
* use imagemagick to convert GIF's so they load in linux. (WIP - could be extended, At least it should not break anything)

BPyMathutils angle2ToLength function could be simplified (pointed out by brecht)
2008-12-12 05:46:07 +00:00
1ecf855276 VideoTexture.ImageMirror: if the mirror is horizontal in mesh coord, take the Y axis as the up direction for the UV map. If the mirror is not perfectly vertical(horizontal), the projection of the Z(Y) axis on the mirror plane is the mirror Up direction. 2008-12-11 23:02:33 +00:00
6dc2714c78 fix for [18069] open nurbs curve snaps end to centerpoint
made nurbs surface curves use the same number of points as nurbs curves.
2008-12-10 11:42:26 +00:00
2ef5af67ca merge from trunk - r17500 to HEAD 2008-12-10 09:45:48 +00:00
2f39ae3b2e move the paint buttons from the image view and buttons window into one function. 2008-12-10 05:41:21 +00:00
ce5b9d21a7 tweaks to brush falloff and alpha, giving nicer looking strokes. 2008-12-10 03:13:48 +00:00
6651af413d When not using quick mode, automatically select the last drawn stroke. 2008-12-09 21:25:30 +00:00
2b9a6251d1 Reeb graph filtering
Add exception to normal nodes preservation when that node is the root node. In that case, pruning the arc is A-OK and in fact needed.
2008-12-09 20:46:25 +00:00
42f792309f bugfix - [#18063] Projection paint branch: draw tool "drops out" when model extends beyond view borders
reported by michael williamson.

Was caused by point inside triangle test using an error limit that didnt adjust for different size triangles.
2008-12-09 14:30:05 +00:00
cd47292745 ImageMirror: add clip attribute to limit clipping distance of mirror rendering 2008-12-09 14:16:10 +00:00
4251912b54 * tablet pressure changing opacity while painting didnt work
* pixels with <= the current opacity are not painted onto, speeds up painting especially with low spacing. (only when airbrush is disabled)
* use qsort rather then own crufty sorting function
* grouped projection painting functions together.
2008-12-09 08:21:53 +00:00
aef61a7000 wip commit to work on at home, nothing to see 2008-12-09 07:19:55 +00:00
12fbd936dd Fix mistake in last commit.. it's pic + 1 ;) 2008-12-09 04:57:42 +00:00
9e1da805e1 * Added back the GR: field for volume materials, limiting lighting to a certain group 2008-12-09 04:27:34 +00:00
1adb5b5442 patch from Mitchell Stokes
#18045] [patch] A patch that exposes the rest of the motion functions of KX_GameObject to Python.

*applyForce	=> setForce
*applyTorque	=> setTorque
*applyRotation	=> setDRot
*applyMovement	=> setDLoc
2008-12-09 04:13:23 +00:00
cac797eff6 Commit patch [#18057] by Dalai Felinto (dfelinto)
This implement the option of playback an animation using the
step value in the render panel (or -a -j).

Tested here and work fine, about the ffmpeg/avi bug it's my
fault, I don't think in "step + video format", so now it's
in my todo-list :)
2008-12-09 04:02:18 +00:00
93efabc0d9 Off by one error at the end of reeb and sketch iterators causing despair and dismay. 2008-12-09 00:46:05 +00:00
caf58fe4b2 == Python Space Handlers ==
- Old feature request: now space handlers can report release events, too. For that a new space handler type was added, here's the header for it:

# SPACEHANDLER.VIEW3D.EVENT.ALL

These scripts report both "presses and releases". For release events, Blender.eventValue is zero and Blender.link == Blender.SpaceHandlers.VIEW3D_EVENT_RELEASE. Check the API_related bpy doc for more info.

- Bug fix: left mouse clicks could be reported twice.

Important: for both the feature and the fix, to make the code nicer and to let space handlers become available in more situations, I moved the check for space handlers in space.c. Now it happens before checks for grease pencil, sculpt and left/right mouse button swapping. If this causes any problem (it shouldn't), please report.

PS: Thanks to Steven Truppe, who asked for this and even sent me a patch, but to preserve compatibility with existing event space handler scripts I did things in a different way.
2008-12-09 00:18:30 +00:00
69298b7b76 * layer mask (similar to the gimp), uses a UV layer's image as mask for painting.
* cloning between layers was broken
* Added buttons for selecting the souce clone/mask layer in the UV layer list.
2008-12-07 19:24:41 +00:00
00cc0f6852 split code for applying each paint tool into its own function. 2008-12-07 08:54:42 +00:00
6d8a2dd9ef * added an option not to use projection painting (use existing 3D paint)
* further tweak limits to get rid of some face clipping problems.
2008-12-06 19:19:54 +00:00
d138a6d43c * fixed crash when a mesh with no UVs was painted.
* fixed more bugs in face clipping, clip_line wasnt working when the line was horiz/vertical. unning exactly on the clipping rectangle bounds.
* testing if a point was inside a triangle didnt work if the point was touching the triangles edge, added IsectPT2Df_limit(...) for this rather then using 3 point/line intersection checks.
...Cant find anymore bugs in face clipping now :)
2008-12-06 17:53:08 +00:00
2b7098820d * Patch from Michael Fox to set the normal angle (was fixed at 80 before)
* Fixed another face clipping bug (some artifacts still when using screen aligned faces)
* Removed Soften and Warp buttons on the panit panel since they are not used for projection painting
* added do_versions to initialize bleed and normal values
2008-12-06 13:42:55 +00:00
5a5ae824ce WIP fixes, still need to tidy up more.
* fix from last commit, threaded memarena wasnt used currectly in one case. (crashing blender)
* add a remove doubles and point on line test to face poly clipping function (fixes some cases where buckets are aligned with faces)
2008-12-06 01:21:42 +00:00
2746034295 BGE bug #17731 fixed: No sleeping Button disables dynamics of an object if it's parented+unparented 2008-12-05 23:13:23 +00:00
1159ccfd4d Use MEM_*alloc for some of the main arrays rather then MemArena (was waisting too much memory) 2008-12-05 13:00:14 +00:00
1b9eabeef6 * Added other noise basis types to point density turbulence
* Fixed a bug in 'ignoring volumes in AAO'
2008-12-05 04:06:41 +00:00
149d231d69 VideoTexture: new ImageMirror class for easy mirror (and portal) creation
The new class VideoTexture.ImageMirror() is available to perform
automatic mirror rendering.

Constructor:

  VideoTexture.ImageMirror(scene,observer,mirror,material)
    scene:    reference to the scene that will be rendered.
              Both observer and mirror must be part of that scene.
    observer: reference to a game object used as view point for
              mirror rendering: the scene will be rendered through
              the mirror as if the active camera was at the observer 
              location. Usually the observer is the active camera
              but you can use any game obejct.
    mirror:   reference to the mesh object holding the mirror.
    material: material ID of the mirror texture as returned by 
              VideoTexture.materialID(). The mirror is formed by 
              the polygons mapped to that material.

There are no specific methods or attributes. ImageMirror inherits 
all methods and attributes from ImageRender. You must refresh the
parent VideoTexture.Texture object regularly to update the mirror 
rendering.

Guidelines on how to create a working mirror:
- Use a texture that is specific to the mirror so that the mirror 
  rendering only appears on the mirror.
- The mirror must be planar; the algorithm works well only for planar
  or quasi planar mirror. For spherical mirror, you will get better
  results with ImageRender and a camera at the center of the mirror. 
  ImageMirror automatically computes the mirror orientation and 
  position. The mirror doesn't need to be rectangular, it can be 
  circular or take any form provided it is planar.
- The mirror up direction must be along the Z axis in local mesh
  coordinates. If the mirror is not vertical, ImageMirror will 
  compute the up direction as being the projection of the Z axis
  on the mirror plane.
- UV mapping must be set right to get correct mirror rendering:
  - make a planar projection of the mirror polygons (Unwrap or projection from view)
  - eventually rotate the projection so that UV up direction corresponds to the mesh Z axis
  - scale the projection so that the extreme points touch the border of the texture
  - flip the UV projection horizontally (scale -1 on X axis). This is needed
    because the mirror texture is rendered from the back of the mirror and
    thus is reversed from the view point of the observer. Horizontal flip 
    in the UV map restores the correct orientation.

Besides these simple rules, the mirror rendering is completely automatic. 
In particular, you don't need to allocate a camera for the rendering, 
ImageMirror creates dynamically a camera for that. The reflection is correct
even on large angles. The mirror can be a dynamic and moving object, the 
algorithm always computes the correct camera position based on observer 
relative position. You don't have to worry about mirror position in the scene: 
the algorithm automatically computes the camera frustum so that any object 
behind the mirror is not rendered.

Warnings:
- observer and mirror are references to game objects. ImageMirror keeps
  a pointer to them but does not increment the reference count. You must ensure 
  that these game objects are not deleted as long as you refresh() the ImageMirror
  object. You must release the ImageMirror object before you delete the game
  objects. To release the ImageMirror object (normally stored in GameLogic),
  just assign it to None.
- Mirror rendering is automatically skipped when the observer is behind the mirror
  but it is not disabled when the mirror is out of sight of the observer.
  You should only refresh the mirror when you know that the observer is likely to see it.
  For example, no need to refresh a car inner mirror when the player is not in the car.

Example:

  contr = GameLogic.getCurrentController()
  # object holding the mirror
  mirror = contr.getOwner()
  scene = GameLogic.getCurrentScene()
  # observer will be the active camere
  camera = scene.getObjectList()['OBCamera']
  matID = VideoTexture.materialID(mirror, 'IMmirror.png')
  GameLogic.mirror = VideoTexture.Texture(mirror, matID)
  GameLogic.mirror.source = VideoTexture.ImageMirror(scene,camera,mirror,matID)
  # to render the mirror, just call GameLogic.mirror.refresh(True) on each frame.

You can download a demo game (with a video file) here:

  http://home.scarlet.be/~tsi46445/blender/VideoTextureDemo.zip

For those who have already downloaded the demo, you can just update the blend file:

  http://home.scarlet.be/~tsi46445/blender/MirrorTextureDemo.blend
2008-12-04 16:07:46 +00:00
a9529ea727 * added uvco_to_wrapped_pxco to get the pixel x/y from a UV that could be outside 0-1 range.
* use 80deg rather then 90 for the "Normal" painting option, since painting faces that are very close to 90d to the view gives some artifacts.
* Brecht modified the Barycentric weights function to use a signed area. so BarycentricWeightsSimplePersp2f and BarycentricWeightsSimple2f these funcs are not needed anymore.

2 bugs with seams fixed
* triangle faces seams were not being filled correctly - causing visible seams
* the pretend 3D location for seam pixels was too close to the face edge - causing some pixels to be occluded by the adjacent face.
2008-12-03 17:36:50 +00:00
f8afbdce4f * remove warnings
* style fits with blenders more
* use rctf and rcti and rctf types rather then float[4]
* some loops were confusing, use for loops rather then while or do/while
2008-12-03 16:17:59 +00:00
f4c581aa01 missed saving a small change 2008-12-03 07:51:12 +00:00
cefae5e1b4 fix for [#18040] FBX writes incorrect relative paths.
http://projects.blender.org/tracker/index.php?func=detail&aid=18040&group_id=9&atid=125
2008-12-03 07:45:52 +00:00
aed82a1863 Added Blender.sys.relpath(path, start='//')
similar to os.path.relpath but uses blendfile path rather then the current working directory.

Also use python exceptions rather then providing our own ones.
2008-12-03 06:09:07 +00:00
2acd106492 added a function to resolve case insensitive paths in BPySys and an option to use it in BPyImage
- Useful when loading files with saved in windows on a *nix system.
2008-12-03 02:03:51 +00:00
28786f55e6 Retarget bug: missing angle cost on last bone. 2008-12-02 21:29:31 +00:00
e2fb12ea18 Step 3/3, merging subdivision/bone creation methods using iterators
This also adds a special Embedding option called "Peel Objects". This option makes the embedding snap consider objects as whole, taking the first and last hit of each of them to calculate the embedding point (instead of peeling with first/second, third/fourth and so on). This option is useful if you have mecanical pieces with lots of details (as single objects) and want to put bones in the middle (think of adding bones to a mecha, for example).
2008-11-29 20:37:10 +00:00
6fbeed1355 Changed vector math to use library functions. 2008-11-29 16:52:06 +00:00
bdf6711b70 * Some extra sanity checks for point density 2008-11-28 07:12:32 +00:00
d9950d2fd4 minor changes, (some comments and less warnings) 2008-11-26 23:57:44 +00:00
6a51ba54cd VideoTexture: new ImageRender class for Render To Texture
The new class VideoTexture.ImageRender() is available to perform
render to texture in the GE.

Constructor:

  VideoTexture.ImageRender(scene,cam)
    cam  : camera object that will be used for the render.
           It must be an inactive camera.
    scene: reference to the scene that will be rendered.
           The camera must be part of that scene.
  Returns an object that can be used as a source of a VideoTexture.Texture object

Methods: none

Attributes:

  background: 
     4-tuple representing the background color of the rendering
     as RGBA color components, each component being an integer 
     between 0 and 255. 
     Default value = [0,0,255,255] (=saturated blue)
     Note: athough the alpha component can be specified, it is not
           supported at the moment, the alpha channel of the rendered
           texture will always be 255. You can however introduce an
           alpha channel by appending a FilterBlueScreen() filter, it
           will set the alpha to 0 (transparent) on all pixels that were
           not rendered.

  capsize:
     2-tuple representing the size of the render area as [x,y] number of pixels.
     Default value = largest rectangle with power of 2 dimensions that fits in the canvas 
     You may want to reduce the render area to increase performance. For example,
     a render area of [256,128] is probably sufficient to implement a car inner mirror.
     For best performance, use power of 2 dimensions and don't set any filter: this
     allows direct transfer between the GPU frame buffer and texture memory
     without going through the host.

  alpha: 
     Boolean indicating if the render alpha channel should be copied to the texture.
     Default value: False
     Experimental, do not use.

  whole:
     Boolean indicating if the entire canvas should be used for the rendering. 
     Default value: False
     Note: There is no reason to set this attribute to True: the rendering will
           in any case be scaled down to the largest rectangle with power of 2
           dimensions before transfering to the texture.

Attributes inherited from the ImageBase class:

  image : image binary data, read-only
  size  : [x,y] size of the texture, read-only
  scale : set to True for fast scale down in case the render area dimensions are not power of 2
  flip  : set to True for vertical flip. 
  filter: set a post-processing filter on the render.

Notes:

* Aspect Ratio
For consistent results in Blender and Blenderplayer, the same aspect ratio used
by Blender to draw the camera viewport (Scene(F10)->Format tab->Size X/Size Y) 
is also used during the rendering. You can control the portion of the scene that
will be rendered by "looking through the camera": the zone inside the outer dotted 
rectangle will be rendered to the texture.
In order to reproduce the scene without X/Y distortion, you must apply the texture
on an object or portion of object that has the same aspect ratio.

* Order of rendering
The rendereing is performed when you call the refresh() method of the parent 
Texture object. This happens outside the normal frame rendering and will have no 
effect on it.
However, if you want to use ImageViewport and ImageRender at the same time, be 
sure to refresh the viewport texture before the render texture because the latter
will destroy the frame buffer that is used by the former to update the texture.

* Scene status
The meshes are not updated during the render to texture: the rendered texture
is one frame late to the rendered frame with regards to mesh deformation.

* Example:

  cont = GameLogic.getCurrentController()
  # object that receives the texture
  obj = contr.getOwner()
  scene = GameLogic.getCurrentScene()
  # camera used for the render
  tvcam = scene.getObjectList()['OBtvcam']
  # assume obj has some faces UV assigned to tv.png
  matID = VideoTexture.materialID(obj, 'IMtv.png')
  GameLogic.tv = VideoTexture.Texture(obj, matID)
  GameLogic.tv.source = VideoTexture.ImageRender(scene,tvcam)
  GameLogic.tv.source.capsize = [256,256]
  # to render the texture, just call GameLogic.tv.refresh(True) on each frame.

You can download a demo game (with a video file) here:

  http://home.scarlet.be/~tsi46445/blender/VideoTextureDemo.zip

For those who have already downloaded the demo, you can just update the blend file:

  http://home.scarlet.be/~tsi46445/blender/VideoTextureDemo.blend
2008-11-26 17:47:42 +00:00
15e193f253 BGE update: helper functions for VideoTexture render to texture feature. 2008-11-26 17:38:54 +00:00
650ac62919 BGE bug fix: culling algorithm didn't used the correct camera. 2008-11-26 17:35:53 +00:00
e988a9276c MSVC9 project file update for TEX nodes 2008-11-26 17:34:10 +00:00
c508db5659 MSVC9 project file update for blenderplayer 2008-11-26 17:23:22 +00:00
402fbd95cc 2 things:
* Patch #17998
* tex_input_vec now takes 3-vector as first argument (was 4-vector).
2008-11-26 13:07:24 +00:00
d6ba347266 * Added a new Timeline menu entry: Playback -> Sync Playback to Frames/Sec. It's
more convenient and sensible to find this feature, than over in the audio settings 
(dropping frames in playback is not just for audio!)
2008-11-26 00:47:38 +00:00
00fae51fc1 * Added 'Particle System' entries as children of particle system modifiers in the
outliner. Clicking on one activates it and takes you to the object buttons - it's a 
lot better to see what's going on than a little < 1 Part 5 > that gives very little 
indication.
2008-11-25 23:14:00 +00:00
376ba4ac14 * fix path to openexr on irix
* added missing define in storage.c
2008-11-25 12:53:13 +00:00
Nathan Letwory
cac2a438ae * make sure Bullet is enabled when WITH_BF_BULLET=True 2008-11-25 08:00:58 +00:00
96d3d8426e use const where possible and removed some unneeded args (4.3% speedup) 2008-11-25 03:39:30 +00:00
9efb9adac7 minor changes
* less calls to BKE_image_get_ibuf when switching between images
* remove thread debug prints
* use own pixel blending funcs (IMB_blend_color isnt needed in some cases), slightly faster without this.
2008-11-24 22:06:09 +00:00
d467158158 Second step out of three for merging sketching subdivision methods with graph subdivision methods.
Graph subdivision uses graph arc iterators.
2008-11-24 19:24:49 +00:00
933ac8db12 Link pole controls to the parent of the bone with the IK constraint.
Presumably, this should give better result, but tests where not conclusive.
2008-11-24 17:48:40 +00:00
f1474648d3 patch #8583: Add support for gcc on irix
to compile blender with gcc on IRIX, IRIX_USE_GCC needs to be set to true in
user-def.mk.

Other changes related to irix:
 * compile solid from extern/
 * don't build plugins (yet) with "make release" when using gcc (the shell
   script used assumes MIPSpro is installed)
 * use statvfs instead of statfs on irix, like done on solaris
 * use external libs from $(LCGDIR) instead of /usr/freeware
 * use glew header files from $(LCGDIR)/glew instead of the ones installed on
   the system (this applies to other platforms as well)
 * ffmpeg support currently is disabled on irix
2008-11-24 14:15:05 +00:00
360d9acc0b backface culling wasnt working as it should in perspective view with the "Normal" option enabled. 2008-11-24 07:08:51 +00:00
a51f17bc30 painting onto faces was broken when the UV's or faces were flipped, reversing the order that LSCM and many other tools give. 2008-11-24 05:58:00 +00:00
5a87cfe4f8 * changed "Normal" falloff to only fade out at more extreme normals
* tooltip was wrong
2008-11-24 03:06:27 +00:00
6adeff5778 * brush and airbrush match The Gimp, where the total color applied to a pixel during a stroke is limited by the brush opacity. With the airbrush option enabled it will accumulation over the opacity level (as it did before, irrespective of the settings).
* float buffer support for all painting operation and undo.
* only run brush_sample_tex() for textures brushes.
* redraw the brush outline even when nothing is painted.
2008-11-24 02:13:24 +00:00
0cf9844d00 Only paint in the view clipped area when view clip is enabled (space defined by Alt+B). 2008-11-23 17:06:35 +00:00
1a28bf797e [#18021] Rotating gets locked to axis after trackball rotate mode is entered
Reset transform restriction flags when switching to other transformations while running.

Also don't draw constraint if no constraint flag is on (old annoyance).
2008-11-23 15:27:53 +00:00
8a4a2d96d0 Fix bug with name templating text buttons (wrong event). 2008-11-22 22:22:38 +00:00
6ae70999b9 Cache the armature template graph while in editmode.
Display the number of joints in the selected template in the sketch panel
When using selected bones as template, turn off Connected if bone has a parent that is not copied.
2008-11-22 17:58:49 +00:00
f747629133 maximum polyline between clipped rectangle and triangle was 6, but in some cases 7 points were set. set the maximum size of the polyline at 8 to be safe. 2008-11-22 15:09:16 +00:00
923fb888d6 fix for painting onto faces from a side view in perspective mode, they would have jaggie clipping applied that looked bad.
The reason for this was with transforming screenspace points outside the face into UV space and when the bucket bounds was enough outside the face.
For faces viewed side on, this transformation would be applied incorrectly (a bit like trying to apply a projection matrix to a point behind the view), the buckets UV space coords would be incorrect and the wrong pixels would be initialized for that face.

solution is to clip the screenspace face with the bucket before getting the UVs. This should also be a bit faster since the clipped polyline will have a smaller bounding box.
2008-11-22 14:54:49 +00:00
1dca0e1c46 This is patch [#17896] Irix Build Files
Submitted By:
Timothy Baldridge (tbaldridge)

Add's scons support for irix.

Kent
2008-11-21 17:22:17 +00:00
bef72facd5 * smudge tool wanst working (forgot to set the precious mouse location)
* VecWeightf and Vec2Weightf didnt have return types defined.
2008-11-21 06:17:26 +00:00
ecfeed042d * added option "Normal", same as the vpaint option, gives more natural looking brush strokes.
* faces that were ignored were also not taken into acount when checking UV seams - causng bleed not to work properly in some cases.
* commented early pixel filling loop exit that fails in some cases.
2008-11-21 03:09:48 +00:00
c6ff0ec49d Change name templating to &S and &N (less potential bugs).
It now also accepts lower case versions (&s and &n).
2008-11-20 22:23:01 +00:00
0f3e985aca merging trunk 17485:17520 2008-11-20 21:57:21 +00:00
520a5b0926 Crasher fix.
If vertex groups had % in them, the function making the menu string would crash (in release only).
2008-11-20 21:45:22 +00:00
935ed8a53b commit yesterday broke scaling in the sequencer (dumb mistake)
also changed 3 if's into a switch statement for selecting the interpolation.
2008-11-20 00:34:24 +00:00
6df8cf842a * Allow for light linking/overrides in volume materials 2008-11-19 23:27:47 +00:00
9bb9859753 draft for arc iterators to unify code.
Just moving code to work home, nothing to see here.
2008-11-19 20:01:13 +00:00
28da9ad12e svn merge -r 17201:17502 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-11-19 19:28:12 +00:00
5ab1256f5b * use utility function brush_painter_paint that runs the project_paint_op in a callback, (hopefully making tablets work properly)
* removed own interpolation function, use bilinear_interpolation_color instead.
2008-11-19 07:57:25 +00:00
14a0718a8a * fix - constant colour output in point density wasn't working 2008-11-19 05:30:52 +00:00
e6a4f4cf29 svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17471:HEAD 2008-11-19 03:43:03 +00:00
f8e56e96bf Split up the following imbuf functions in 2...
void bicubic_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
void neareast_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
void bilinear_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);

Added...
void bicubic_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);
void neareast_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);
void bilinear_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);

This is needed so for projection painting but generally useful if you want to get the interpolated color of a pixel in an image without having a destination imbuf.

While editing these I noticed the functons are a bit dodgy, they assume the input ImBuf has matching float/chr buffer to the output.
2008-11-19 03:28:07 +00:00
a4776347ea bicubic_interpolation - dont use pow(val, 3.0f) at all, do (val*val*val) instead,
Tested overall speedup is about 5x when scaling 4096x4096 -> 4000x4000 in the sequencer.

There were some artifacts in the resulting image but double checked and the old code gives the same problems.
Added back old code with #if 0's since its a bit more readable.
2008-11-19 02:07:23 +00:00
5c6fd58a79 Some improvements brecht suggested, only noticable change is faster multithreading
General optimizations
* Precompute 1/x when dividing by x multiple times.
* Use float constants like 0.0f instead of 0.0, avoids conversions from float to doubles and back.

ProjectPixel
* make pixel (and similar pointers elsewhere) a union with a float and unsigned int pointer to reduce the number of casts a little. generally there are a lot of casts going on in the code, makes it hard to read.

project_paint_begin()
* the perspective case checks with (*projScreenCo)[3] > 0.001) for faces behind the view. - Changed to use the clip start from get_view3d_viewplane 
* removed arbitrary check for brush size to disable threads.

imapaint_paint_sub_stroke_project()
* Make clone tool use IMB_blend_color to reduce the code and support blend modes.

imapaint_paint_sub_stroke_project_mt()
* Make threaded and non threaded mode use same function (just dont start threads when its set to 1)
* removed PIL_sleep_ms, was not needed and slowed down threading (my bad!, was copied from bake code).
2008-11-18 13:51:51 +00:00
bbc00befe7 some scons command line args were not working since recent changes-
scons CCFLAGS="-O0 -ggdp3" 
for example would pass on the args including the "'s to scons, causing the build to fail.
2008-11-18 05:47:19 +00:00
52ab2f5200 Added option to use another UV layer as a clone source, to paint from one uv layer's image and UVs into the active layer. 2008-11-18 03:28:50 +00:00
e5b51109e9 * Exclude volume materials from AO 2008-11-18 01:53:52 +00:00
a54dc97c13 * Added buttons for accessing options "occlude", "backface cull" and "bleed", note that bleed is 0.0 by default, before it was always 2.0;
* use a faster method of getting a pixels screenspace location.
* check if its possible to break out of pixel to bucket/face intersection early - ~7% overall speedup (ignoring redraw time).
* removed scanline intersection function (added back incase they were needed but it looks like there not)
* speedup for painting with only 1 image (use a loop without context switching checks)
* more commenting + cleanup
2008-11-18 00:17:13 +00:00
9ba822c4d7 Fix leak on exit (it's not a real fix, still uses silly global mem) 2008-11-17 23:02:53 +00:00
c08d374df2 merging trunk 17457:17485 2008-11-17 22:19:05 +00:00
826c6d935d QuatOne was so wrong is would make Hamilton cry.
Thankfully, very little code used it, the only exception being the retarget code in etch-a-ton.
2008-11-17 22:13:45 +00:00
2d0a005aaa Template retarget now works with normal conversion (not in Quick mode that is). 2008-11-17 21:11:12 +00:00
497c9b4ce7 Use grease pencil manhattan distance threshold for strokes. 2008-11-17 21:03:41 +00:00
139f6bb1aa New option for roll correction.
Calculate new roll based on the angle to the normal of the joint (cross produce of the two bones).

This works best in some cases but not in others, so it's an option for now.

I'll have to see if I can iron the left over kinks, then it can be made the default (with Align to view an added option).
2008-11-17 20:38:04 +00:00
3a1cfa5015 Added BF_PROFILE_LINKFLAGS, Compiling with BF_PROFILE=1 was also throwing a python error. 2008-11-17 10:43:12 +00:00
0bee65b624 Fix compilation on OS X
Patch by dfelinto
2008-11-17 00:54:45 +00:00
3a44c76246 DXF-Importer: updated version v1.12 - 2008.11.16 by migius
- remove try_finally: cause not supported in python <2.5
 - add Bezier curves bevel radius support (default 1.0)
2008-11-16 23:52:29 +00:00
a10d4192b5 disabled painting to offscreen buckets, was causing priblems when zooming in on large models. also simplified backface test. 2008-11-16 18:25:15 +00:00
a0a7018363 * fix "dot drawing" problem - draw lines inbetween updates when redrawing the view like how existing painting works. (this means slow systems wont have the problems when they would only see dots as they dragged their mouse around)
* bucket resolution is now set from the brush size so there is around 9 buckets under the brush - (previously was fixed to 128x128).
* brush sizes below 40 disable multithreading, since threads only speeds up cases where each bucket has enough pixels in it for each core to spend some time.
* make smear use bicubic pixel lookups so a low Spacing value works as expected.
* smear tool was darkening pixels a tiny bit.
* fix for simple mistake causing ProjectPaintImage arrays not to be thread safe.
2008-11-16 15:26:15 +00:00
63d3829144 svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17443:HEAD 2008-11-15 16:55:37 +00:00
db434c3434 * clone tool didnt work when the object was not at the center point.
* added clone button to the paint editbuttons (was only in the image window before)
* ctrl+clicking to set the 3d cursor also sets its depth to the face its over (much more useful when cloning and rotating the view)
* support for painting and cloning for tiled textures (for UV's outside 0-1)
* more consistant veriable names, merged image arrays into a ProjectPaintImage type to be less confusing.
2008-11-15 16:20:37 +00:00
da1738377f 17973Patch by dfelinto, and also fixed a bug in 2d-filters 2008-11-15 12:10:16 +00:00
e6a903c06e cleaned some code and split volume precaching into a new file 2008-11-15 04:16:46 +00:00
a92969e8f1 made undo on multiple images works 2008-11-15 02:58:47 +00:00
d2023e070c Pkey toggle sketching panel
(it used to do select parent, but that's already done with [ and ] for children, no need for a second key).
2008-11-14 17:33:15 +00:00
1462aa4bc3 tile based undo's now works while projection painting.
TODO - float buffer support & for some reason painting on multiple images at once dosnt restore the tiles to the right image then undoing.
2008-11-14 17:30:55 +00:00
6eda50f8d9 Merging trunk 17342:17457 2008-11-14 16:09:23 +00:00
59ac45dd12 Reset max cost to FLT_MAX (this fixes a bug with early culling)
Optimization when number of buckets == number of joints
2008-11-14 15:46:51 +00:00
8d5c14b20d Volume rendering:
* Use a slightly better (but still not exact) approximation for the view
vector when pre-shading the light cache. This still doesn't give exactly the
same results as non-light-cache shading, but it's better. Will investigate
getting a better view vector when there's more time - or if anyone has a
simple formula to derive shi->view from shi->co that would be great to 
hear about too :)
2008-11-14 06:01:06 +00:00
9c30c74bd5 Stroke conversion wasn't quite ok with unaligned armatures.
Last bugfix before sleep I swear.
2008-11-14 03:52:04 +00:00
7cce946de7 copy over pthread dll to the install dir with cross compiling,
eventually should copy more libs but for now this makes blenderlite work 
- (used for automatic blender builds on graphicall)
2008-11-14 03:21:06 +00:00
7401c57fb3 Transform Roll Fixes for editbone. Special case for rotation, we don't need to guess in those case and the result is better if we use the real rotation. 2008-11-14 03:13:40 +00:00
fece3f5e97 Bugfix:
Grease Pencil crashed after duplicating a screen-area, and deleting a layer from the original screen-area. The duplication code was not reassigning some pointers.
2008-11-14 02:13:10 +00:00
ff0c599c4b update for compiling cross compiling win32 on linux, had a lot of trouble with makesdna, the only way I could build and link was as a
win32 binary.
Still unable to link blender.exe
and run with wine.
2008-11-13 23:12:38 +00:00
dc4ef17eea ==Armature==
Fix the roll mess in transform. Since roll is based on an automatically calculated up axis, transforming bones would mess up bone orientation. This code automatically adjusts the roll value to keep bone orientation as consistant as possible. That works all around in transform for all transformations.

Doesn't work with x-axis mirror though as that doesn't use transform elements (fixing it would be nice for later)

Most interesting is that it works with the mirror tool (obviously), so you don't have to fix all the rolls after mirroring one side of an armature.

It could be made an option if someone presents a good enough point for that, but I can't see why you'd want the previous mess instead.

NB: this also ports a utility fonction from etch-a-ton to set bone roll from an up axis.
2008-11-13 22:35:40 +00:00
e76f7e7930 Normal Orientation on EditBones uses roll for Z axis. 2008-11-13 21:44:32 +00:00
3d6be3536f Fix saving and loading of the template variable (it incorrectedly counted as a user). 2008-11-13 18:57:10 +00:00
bb6d39687a svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17405:HEAD 2008-11-13 13:34:43 +00:00
1f3e4771b1 simple workaround slowdown with painting onto multiple parts of an image at once, just use a grid of boundboxes per image.
was also running undo calls when it shouldnt,
2008-11-13 13:17:04 +00:00
fb4ff9e514 * use the existing function to only update a part of the image, should increase speed a lot, except when painting on seams from opposite parts of the image. - can speed this up with multiple boundboxes - TODO.
* use brush spacing and airbrush settings
* draw a circle while in texture paint mode.
2008-11-13 11:30:34 +00:00
a2da0911a6 * Fixed a float -> int conversion rounding error in volume rendering,
which was manifesting in little dark dots
2008-11-13 10:43:02 +00:00
c838ee9592 Removed support for nested texture trees, minor ui enhancements 2008-11-13 09:57:11 +00:00
934b21f5d9 for scons on linux and other *nux systems
only install locale data if international is enabled, only install fonts if freetype is enabled.
2008-11-13 02:18:35 +00:00
a35345f8ba 2 utility functions added for projection painting.
* BLI_linklist_index() - to get an items index in a  LinkList
* BLI_memarena_use_malloc() - BLI_memarena_use_calloc alredy existed but there was no way to switch back to malloc.

also added texnodes to cmake
2008-11-12 22:35:58 +00:00
8449f0d776 == MSVC projectfiles ==
update for texture nodes
2008-11-12 21:03:42 +00:00
ae3bb90975 fix bad level call in texture nodes
BIF_preview_changed wasn't needed after all.
2008-11-12 21:02:45 +00:00
bc53b942fe Added stubs to fix linker errors in texnodes 2008-11-12 20:11:54 +00:00
913fd3c730 Sensible defaults with do_version
Auto names for name templating. When turned on, N will be incremented everytime (after a stroke has been converted) and S will be set to "l" or "r" (or "L or "R" if it already contains a capital L or R) depending on which side of the X axis the stroke started on. Experimental, there might be some bugs left.
2008-11-12 19:16:46 +00:00
0509409c6b Bah, two more files! 2008-11-12 19:14:46 +00:00
8030cb03fd Patch #7897 Texture Nodes!
Robin (Frrr) Allen did a decent job on this, so we can also welcome him
as a member in the svn committers team to maintain it!

I do the first commit with some minor fixes:
- get Makefiles work
- fix rounding issue with tiles on unit faces
- removed UI includes from tex node

A nice doc in wiki is here:
http://wiki.blender.org/index.php/User:Frr/TexnodeManual

On the todo for Robin is:
- When using one or more Texture-input nodes, you cannot edit them by activating
  (as works now for Material nodes).
- The new "output node" option fails on the default case, when only one
  output node is active. It then shows often a blank menu. Will get fixed asap.
- When using a NodeTree-Texture as input node, the menu for 'active output'
  should not show. NodeTree should ignore other nodetrees to keep things sane
  for now.
- On a future todo is proper usage of "Dxt" and "Dyt" texture vectors for
  superior antialising of checkers/bricks.

General note; I know people are dying to get a full integrated shader system
with nodes. In theory we could merge this with Material Nodetrees... but I 
rather wait for a solid and very well thought out design proposal for this, 
also including design ideas for unifying with a shader language (GPU, CPU).
For the time being this is a nice extension of current textures. :)
2008-11-12 19:03:50 +00:00
Nathan Letwory
3fd3a13efc set default path to the version that creates a working binary of Blender, when building with mingw. Now there is no need to do extra copying/config changing 2008-11-12 16:04:14 +00:00
Nathan Letwory
999f312d62 Change the LCG_DIR usage to BF_name_LIBPATH where possible. FFMPEG can't be done like that yet, needs some extra thought to handle differences between vc and mingw setup 2008-11-12 07:48:53 +00:00
c63c99d49e Option to have painting multi-threaded.
Each thread process the next free bucket the brush is over until they are all done.
2008-11-12 05:56:37 +00:00
bf747a30af * Added a button to the volume material controls 'Alpha' to generate an
alpha channel based on the volume's transmission properties, allowing you
to use it in comp etc.

I'd rather not have this button at all, and make it just work properly 
by default, however it causes problems with overlapping volumes when 
'premul' is on (stoopid thing..) so for the time being, there's the 
button. I'll try and fix this up later on when I have more time.
2008-11-11 23:24:10 +00:00
Nathan Letwory
b8fb31e236 Remove BGE defines from highest level and define only there where needed. This prevents scons from doing complete rebuilds when toggling BGE related options. 2008-11-11 22:48:47 +00:00
Nathan Letwory
7e4db234ce previous commits showed that the absolute path problem was even deeper. This should fix yet again some of the problems with giving them to BF_BUILDDIR 2008-11-11 21:37:53 +00:00
Nathan Letwory
418ee26c0e spaces -> tabs 2008-11-11 20:47:45 +00:00
Nathan Letwory
7850320ed2 fix for another place where absolute paths for BF_BUILDDIR where a problem (generating results in the wrong place) 2008-11-11 20:46:46 +00:00
Nathan Letwory
7f3b158030 fix problem with giving absolute paths to BF_BUILDDIR 2008-11-11 20:26:53 +00:00
Nathan Letwory
2961cdcdea Fix typo that prevented CC_WARN from being added to build commands 2008-11-11 20:01:45 +00:00
6b86f835f8 MSVC90 project files: Tune projects build order to allow error-free build from clean state. 2008-11-11 16:48:34 +00:00
483136c8e4 Adjusted scons files so disabling quicktime, python and sdl also removes their includes when building.
writefile.c had usless include.
2008-11-11 14:14:22 +00:00
58b861170c svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17335:HEAD 2008-11-11 12:56:57 +00:00
aac928d5bc last commit before some optimizations.
setting RT to 123 will paint from grease pencil (for benchmarking).
2008-11-11 12:35:52 +00:00
8a61376c65 wasnt setting the struct size for normal brush types (was testing smear + clone but not paint)
some disabled WIP too
2008-11-11 09:24:34 +00:00
5161c2ee3a attempt to make executing an external command work with python 2.4 & 2.5, it seems that only py 2.6 wanted list args for subprocess.Popen 2008-11-11 08:21:09 +00:00
db67426dbf fix for [#17959] NURBS Circle: pie-shaped deformation, sticking to object origin 2008-11-11 05:03:03 +00:00
13fe65cf46 removed some warnings 2008-11-11 04:42:15 +00:00
a331848092 * float image buffer support
* bicubic interpolation for the clone tool
2008-11-11 03:43:21 +00:00
8b32ad784b Median center didn't use TD_NOCENTER properly, making it work incorrectly with hinge bones (and with chain rotations). 2008-11-11 03:12:31 +00:00
a00e63a542 bicubic_interpolation function was re-calculating a variable it didnt need to - (was calling 32 pow()'s per pixel, now only 8 - approx 3-4x speedup on my system). 2008-11-11 01:13:05 +00:00
773824bbea VideoTexture: support VideoTexture in blenderplayer 2008-11-10 22:17:40 +00:00
3c69864540 Chain rotations for objects and pose bones (for teamto)
This commit adds an exception for rotations (standard rotation and tracball) to still work on children of transformed objects and bones in an expected fashion. That is, you can select a chain of finger bones and rotate to flex them all at once.

Notes:
[1] This could be expended to other transformations if needed.
[2] Center of transformation is determined using the same principle as hinge bones (transformed children aren't taken into account)
2008-11-10 21:23:54 +00:00
61a83d2fba Add MSVC90 project files - part 3. Extern and Intern projects are merged in projectfiles_vc9\blender\blender.sln solution, you just need to open that solution to compile everything with VS2008. 2008-11-10 21:22:22 +00:00
5443d2d86b Dual Links for control bones: Control bones that start and end on specific joints will do the same after retarget.
Template Renaming: Fix renaming to handle contraints properly

Template Renaming with Action constraints video available online: http://vimeo.com/2206779 and http://blenderartists.org/~theeth/bf/etch-a-ton/retarget_fingers_action.ogv
2008-11-10 19:43:11 +00:00
c27a8da6dd Add MSVC90 project files - part 2. 2008-11-10 16:09:25 +00:00
8eec6cecc0 Add MSVC90 project files - part 1. 2008-11-10 15:36:58 +00:00
d63f1d6ab9 missing comma made scons arg BF_CXX_LIB_STATIC not work 2008-11-10 13:36:44 +00:00
8fc7d4640c Bugfix #17965
Most Surface (NURBS) tools in buttons didn't add undo pushes.
2008-11-10 10:05:09 +00:00
ac224d0b89 Patch #17971 by Nathan Vegdahl:
Makes colorband GUI display proper color interpolation

(for real this time)
2008-11-10 05:42:07 +00:00
3b2f996c25 Point Density
* Fixed a stupid crash caused by last commit that worked fine on the mac
(but never should have...)

* Fix for using child particles with the new particle age color options
2008-11-10 00:14:35 +00:00
2de476c88f VideoTexture: Preserve alpha channel if present in video, images and sequences. Better detection of end of video. 2008-11-09 21:42:30 +00:00
Nathan Letwory
0a8e8c8c9e * add Brecht's small patch to make values to BF_QUICK and BF_QUICKDEBUG function as partial search entries.
- this means you can do BF_QUICK=bf_ and it would build all libs that contain bf_ in their name. This makes
    it easier to use, since you don't have to remember the exact names

* Update documentation to mention scons-local.
2008-11-09 21:00:49 +00:00
16443062a9 * clone tool didnt work when objects center was not 0,0,0
* made backface culling work as expected in perspective view.
2008-11-09 14:34:32 +00:00
4caedd34d7 Perspective mode painting works again
SeamBleed in perspective mode mostly working (some small artifacts but generally looks ok)

Added BarycentricWeightsPersp2f and BarycentricWeightsSimplePersp2f for getting weights from verts with perspective matrix applied.
2008-11-09 12:59:01 +00:00
7403fc923f triangles were could not be painted onto at all (serves me right for testing with subsurf) 2008-11-09 04:08:08 +00:00
74d1a04f30 changes to projection painting
* initializing a bucket only initializes pixels from that bucket (was initializing all pixels in intersecting faces before which made large faces slow to paint onto)
* removed scanline functions, they are not as useful when initializing small areas. 
* UV seam checking also sets the seam flag on the adjacent face to avoid double lookups.

TODO - uv seam bleed doesn't work in perspective mode.
2008-11-09 02:47:30 +00:00
a972107b03 Point Density texture: colouring
This introduces a few new ways of modifying the intensity and colour output 
generated by the Point Density texture. Previously, the texture only output 
intensity information, but now you can map it to colours along a gradient 
ramp, based on information coming out of a particle system.

This lets you do things like colour a particle system based on the individual 
particles' age - the main reason I need it is to fade particles out over time.

The colorband influences both the colour and intensity (using the colorband's 
alpha value), which makes it easy to map a single point density texture to 
both intensity values in the Map To panel (such as density or emit) and colour 
values (such as absorb col or emit col). This is how the below examples are 
set up, an example .blend file is available here:

http://mke3.net/blender/devel/rendering/volumetrics/pd_test4.blend

The different modes:

* Constant
No modifications to intensity or colour (pure white)

* Particle Age
Maps the color ramp along the particles' lifetimes:
http://mke3.net/blender/devel/rendering/volumetrics/pd_mod_partage.mov

* Particle Speed
Maps the color ramp to the particles' absolute speed per frame (in Blender 
units). There's an additional scale parameter that you can use to bring this 
speed into a 0.0 - 1.0 range, if your particles are travelling too faster or 
slower than 0-1.
http://mke3.net/blender/devel/rendering/volumetrics/pd_mod_speed.mov

* Velocity -> RGB
Outputs the particle XYZ velocity vector as RGB colours. This may be useful 
for comp work, or maybe in the future things like displacement. Again, there's 
a scale parameter to control it.
http://mke3.net/blender/devel/rendering/volumetrics/pd_mod_velrgb.mov
2008-11-09 01:16:12 +00:00
f0a23dce9a Generalized unique_editbone_name to be useable if a name change after the bone has been added to the list (this could probably simplify some code in editarmature, I haven't done that yet).
First pass for retargetting template's renaming magic. For now, in new retargetted bone's name: %S (side) and %N (number) will be replaced by user defined strings.

Will need to experiment on how useful that is and how it could be better.
2008-11-08 22:05:11 +00:00
Nathan Letwory
d5ae032a60 * typo fix 2008-11-08 13:39:37 +00:00
Nathan Letwory
d1248ff6d8 === BPy API ===
* add two optional arguments to control click step and precision of Number buttons.
2008-11-08 13:38:21 +00:00
Nathan Letwory
fecdd60453 * use msvc proposed names when building on win32 2008-11-08 12:01:55 +00:00
e3ca8765be VideoTexture: forgot to commit MSVC project file, strange that nobody noticed... 2008-11-07 20:13:07 +00:00
Nathan Letwory
0a825b4d72 * fix typo found by brecht 2008-11-07 19:49:55 +00:00
4114ce7407 Correct stroke normal alignment for retargetting (transform into edit armature local space) 2008-11-07 19:44:02 +00:00
37c1fd2303 [#17958] Windows path fix for image_edit.py script.
Modified to work in linux too,  on my system subprocess.Popen(appstring) only works when appstring is a list.

Blenders __import__ didnt support keywords like pythons causing the subprocess module to fail for me.
added keywords to blenders c/api import to match pythons.
2008-11-07 15:16:30 +00:00
8b2811d9d5 VideoTexture: VideoTexture.materialID() can now take texture image name.
You can specify a image name (starting with 'IM') instead of a material
name in VideoTexture.materialID() and return the material ID matching
this texture.
The advantage of this method is that is works with blender material
and UV texture. In case of UV texture, it grabs the internal material
corresponding to the faces that are assigned to this texture. In case
of blender material, it grabs the material that has an image texture
matching the name as first texture channel.
In both cases, the texture id used in VideoTexture.Texture() should be 0.

Ex:

matID = VideoTexture.materialID(obj,'IMvideo.png')
GameLogic.video = VideoTexture.Texture(obj, matID, 0)
2008-11-07 10:54:32 +00:00
f7135d981a simple mistake broke clone tool. 2008-11-07 06:50:19 +00:00
5567f3dded VideoTexture: comment was misplaced after previous commit. 2008-11-06 23:52:47 +00:00
7b15e8cd64 Bugfix #17524
The problem is that the audio_fill_seq function try to load the hd file
if the sequence don't have it, but it join the two string (directory path +
file path) without the / (Linux... \ Windows), so the result is a wrong path.

 I change the the strncpy and strncat function for a BLI_join_dirfile (like
the reload_sequence_new_file) and all work fine now.

 Also note that the "them go" that Luca report is (or what happen here) the
ctrl+z function, and now both case work fine here.

(interesting.. date from Feb 05.. 2006 ;)
2008-11-06 18:49:53 +00:00
87538be426 VideoTexture: fix compile error when FFmpeg is disabled. 2008-11-06 16:01:17 +00:00
4d460369c0 WIP commit before some optimizations,
fix for possible divide by zero.
added BarryCentricWeights2f(), returns weights for points outside the triangle.
2008-11-06 08:01:11 +00:00
e76e271e29 Sketch Retargetting: template selection from dropdown (listing all other armatures) instead of silly object name input. 2008-11-06 03:31:25 +00:00
f018a3b5bb added support for smear brush type 2008-11-06 02:08:41 +00:00
d99550e35e merging 17300:17342 2008-11-06 01:30:24 +00:00
Nathan Letwory
f3d1be5638 * While making changes to btools.py and Blender.py, I completely forgot about the name changes.
Here they are.

  Platform managers, double check that the compiler flag options still work.
2008-11-06 00:28:26 +00:00
5b6708c278 support for brush blend modes (Mix, Multiply, Darken etc) 2008-11-05 23:24:52 +00:00
Nathan Letwory
76320b76ad Change remaining Copy() to Clone() 2008-11-05 23:23:04 +00:00
769a43d3c0 painting onto multiple images wasnt working, faces with different images are treated as seams even if their UV's match. 2008-11-05 22:27:45 +00:00
ce1625ebc0 VideoTexture: new VideoTexture.ImageFFmpeg to load and reload images.
The FFmpeg library allows to load image files. Although it is possible
to load images using the VideoFFmpeg class, it is not very efficient.
The new class VideoTexture.ImageFFmpeg is dedicated to image management.

Constructor:
-----------
VideoTexture.ImageFFmpeg('image_file_name')
  Opens the file but does not load the texture yet.
  The file name can also be a network address. It can also be a video
  file name; in that case only the first image is loaded.

Methods:
-------
refresh(True)
  Loads the image to texture. 
  You just need to call it once, the file is automatically closed after
  that and calling refresh() again will have no effect.

reload('new_file_name')
  Reloads the image (if new_file_name is omitted) or loads a new image.
  The file is opened but the texture is not updated yet, you need
  to call refresh() once to load the texture.

Attributes:
----------
status
  returns the image status:
    2 : file opened, texture not loaded
    3 : file closed, texture loaded

image
  returns the image data as a string of RGBA pixel

size
  returns the image size [x,y]

scale
  get/set the scale flag. 
  If the scale flag is False, the image is rescale to texture format
  using gluScaleImage() function, slow but good quality.
  If the scale flag is True, the image is rescaled using a fast but
  less accurate algorithm.

flip
  get/set Y-flip flag.
  Set to True by default as FFmpeg always provides the image upside down

filter
  get/set filter(s) on the image.

Example:
2008-11-05 21:53:22 +00:00
a405ed75fe Sketch retargetting. Templating from other armature objects.
Moving stuff home, saving doesn't work ok yet, will finish this later today, demo video when done.

Also a couple of bug fixes for crashing and some text reformulation and the like.
2008-11-05 20:15:32 +00:00
0ade815aff VideoTexture: fixing a crash when loading an image as a video file - yes it works, provided that you don't set repeat and also no need to refresh all the time. 2008-11-05 17:38:31 +00:00
aa1ba2f3fb svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17279:HEAD
somehow scripts line endings change is messing things up, these changes wont be included
error is:
svn: File 'release/scripts/scripttemplate_metaball_create.py' has inconsistent newlines
svn: Inconsistent line ending style
svn: Error reading spooled REPORT request response
2008-11-05 15:11:40 +00:00
b98b4e8be8 projection painting clone tool - gives a similar work flow to cloning in the gimp, Ctrl+Click to set the cursor source, then paint from this location.
todo...
* pixel interpolation.
* clone option can currently only be set from the image paint panel.
* only initialize clone pixels under the mouse.
* overlap between source/target while painting could cause problems. need to look into this.

also fixed some cashes in painting normally.
2008-11-05 14:45:54 +00:00
8916f84622 VideoTexture: Add support for GLSL. FIx small printout bug in Exception printout 2008-11-05 13:22:10 +00:00
3b2a07a866 uniform end-of-line format and set svn:eol-style property to "native" for all scripts 2008-11-05 11:42:34 +00:00
ea168748eb error in last commit, scanlines had extra offset causing overlapping lines between faces without seams 2008-11-05 05:08:07 +00:00
633e3e1323 * Updated the 'Consolidate into one image' script to support alpha 2008-11-05 04:48:08 +00:00
b1653b5f98 fix for pixels not being drawn in 2 cases.
1 issue was caused by detecting 2d horizontal line intersections for lines that had points equal to the horizontal Y value -  solved by detecting point on line cases.
Another was because the 2D bounding box for painting could have faces edges running along it - solved by adding a small margin to the bounding box.
2008-11-05 03:12:59 +00:00
Nathan Letwory
f59f5e67a5 * doing some warning cleaning
* accidently left priority tests around.
2008-11-04 23:46:01 +00:00
Nathan Letwory
beea73b110 * enable openjpeg building for win32/msvc
* add support for building redcode on win32/msvc, but disabled for now, as there are linking problems
  - I cleaned the redcode sconscript - the copying of headers within the source tree is not a clean solution
    This needs to be fixed later on. For now, lets use redcode from extern/ until a better way is found.
2008-11-04 23:04:15 +00:00
Nathan Letwory
2d80262759 === SCons ===
* BlenderLib now expects lists for all compiler related flags (release, profile, debug, warn).
  I changed the default config files, but do double-check your user-config files, esp. if you did
  a full copy of an old default platform config
2008-11-04 22:46:43 +00:00
a19366f34a * Changed the constant colorband interpolation to work left->right,
rather than right -> left. This is how it works now:

http://mke3.net/blender/etc/constant_ss.png
2008-11-04 22:16:57 +00:00
Nathan Letwory
9196723581 * remove redundant comment 2008-11-04 21:14:54 +00:00
571520e976 Properly unselect copied bones (it wasn't clearing active flag)
Remove double undo push
2008-11-04 19:10:54 +00:00
1886b7bf52 VideoTexture: fix RGB/BGR confusion, make code compatible with big endian CPU, add RGBA source filter. 2008-11-04 12:04:59 +00:00
aa7357b692 perspective mode now works with seam bleeding. 2008-11-04 10:17:43 +00:00
6eb3bf53dd VideoTexture: Bug report #17946: add (char*) casting to fix compile error with Python get-set method and module object. 2008-11-04 09:21:27 +00:00
c00b7f33e5 optional uv seem bleed so painting across seams wont give artifacts (like with baking), no UI yet, set to 2 by default.
Does not work yet with perspective view yet, there are still some issue with pixel alignment.
2008-11-04 05:29:36 +00:00
f5f0c8fb37 * Fixed a strange problem with the way textures are interpreted - was causing weird things with point density turbulence on
* Reverted the spin field once more..
2008-11-04 05:17:02 +00:00
ca80578e4e Simple warning fixes 2008-11-04 01:05:44 +00:00
1f83dffeb4 Added a new interpolation type for colorbands: Constant
This can be useful for toon shading etc.

Example: http://mke3.net/blender/etc/constant_ss.png
2008-11-04 00:15:27 +00:00
b7fdf2ab50 Add's GSR's INT64_C fix and removes dos line endings...
Kent
2008-11-03 23:35:41 +00:00
ec462b8cea Added Lattice vgroup support to shrinkwrap and simple deform modifier. 2008-11-03 23:17:36 +00:00
5be471d29c fix for compile error in last commit + some WIP functions. 2008-11-03 22:27:55 +00:00
86e8d54dcb Sketch Retargetting: Rolling bone perpendicular to stroke's normal is now optional.
Normal pointer added to reeb nodes (the last bone in a chain needs it and can't get it from the embedding).
2008-11-03 17:54:12 +00:00
6cc1466c61 Moving silence_log_ffmpeg to imbuf (it fits better there and fixes the link error in blenderplayer) 2008-11-03 13:33:11 +00:00
858e2ec776 Bugfix #17921
ALT+select face-loop on mesh with hidden faces ignored the hidden part.
Also caused errors on deleting faces that way.
2008-11-03 13:00:39 +00:00
8cecbf9cbd last commit broke projection painting in perspective mode. 2008-11-03 11:06:22 +00:00
2ff6d5c06e made scanling creation into its own function project_face_scanline,
speedup adding ProjectPixel's by interpolating the screen coords rather then getting the pixels worldcoord and projecting it into screenspace.
2008-11-03 09:59:08 +00:00
389588bb4f Reverted to the previous, more hackish version of the spin field.
There has to be a better way of doing this though... jahka? :)
2008-11-02 23:25:21 +00:00
336ae14ba9 merging trunk 17221:17300 2008-11-02 19:44:18 +00:00
17296efd62 VideoTexture: fix compile error with GLint in ImageViewport under osx, part 2 2008-11-02 18:41:24 +00:00
7d63f5a7fe VideoTexture: fix compile error with GLint in ImageViewport under osx. 2008-11-02 18:31:54 +00:00
db24487449 Makefile fixes for compiling with new videotexture code.
Also: buttons for logic, controllers, didn't line up correct when 
multiple objects were selected (too little space)
2008-11-02 18:12:45 +00:00
a775719e23 Bugfix #17942
Python dict error: when trying to access a Bone via a key, and the key
was not found, a wrong error message got printed. Fix provided by
reporter Gregor Riepl. Thanks!
2008-11-02 18:05:11 +00:00
2973bd8ea2 VideoTexture: use PyObjectPlus.h instead of Python.h for compatibility with Python2.3 2008-11-02 18:02:31 +00:00
d7aad35599 Sketch Retargetting:
Use stroke normal to align roll of the retargetted bones.

Unlike stroke conversion, the final roll is not forced to point exactly to the normal. Rather, It tries to align the X or Z axis of the bones (whichever is closest) to the stroke normal. Forcing the roll can invert knees while this rightly only makes one of the joints rotation axis perpendicular.
2008-11-02 17:43:55 +00:00
f180702a12 Quiet ffmpeg log by default. No more ugly stream info in console.
Starting Blender with -d turns info logging back on.
2008-11-02 16:28:34 +00:00
719e30f70a Disable completely OpenAL if WITH_OPENAL is OFF 2008-11-02 15:16:17 +00:00
407e38a744 Added bf_videotex to unix libraries (linking error) 2008-11-02 14:54:44 +00:00
12b2f1c83c Include path for numpy no longer needed. 2008-11-02 14:36:32 +00:00
fdc1ef2c25 Bugfix #17902
Black dots appearing in mirroring 3d beveled curves, when using orco
texture coords. Appeared there was memory read just outside of the 
allocation.
2008-11-02 14:03:47 +00:00
752920c531 python25.zip wasn't copied using cmake. Should fix win64 python e.g. "import random" problem 2008-11-02 12:50:11 +00:00
30016909c7 Bugfix #17920
When entering a wrong expression (or garbish) in a Nkey panel button,
the cursor jumps to the place where the button was clicked. On failure
the button could return a B_NOP, not a 0
2008-11-02 12:27:25 +00:00
a4f8f06479 Fix for two proxy + undo related crashes:
* When making a proxy, the lib linked IPO driver was also changed to
  point to the proxy object, and after undo this local proxy object
  was replaced so the pointer became invalid. In fact it is not needed
  at all to change this because the IPO code maps the pointer to the
  local proxy object already.
* Undoing the make proxy operation would crash because the proxy_from
  pointer in the library linked object would still point to the removed
  object. Now it clears all these pointers before undo, because on each
  undo memory file read they will be set again anyway.
2008-11-02 00:25:39 +00:00
68f50e0c6b VideoTexture: remove numpy dependency. 2008-11-01 22:28:27 +00:00
3c9520f92f svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17236:HEAD 2008-11-01 22:04:41 +00:00
e72d6c7bfa VideoTexture: fix NULL pointer crash when material name is not found. 2008-11-01 20:18:15 +00:00
b24c6ef70d Adding include path for numpy to sconscript. There must be a better way to do this. 2008-11-01 17:44:12 +00:00
19cdef1f71 VideoTexture: typo in linux code 2008-11-01 17:26:34 +00:00
e6a2ab319f VideoTexture: AVFormatContext::pb is not a pointer for avformat library older than 52 (linux uses 51) 2008-11-01 17:15:17 +00:00
4870db578b Bug #17912: fix for some SSS floating point precision issues, and also
fix a divide by zero in the subsurf code found in the process.
2008-11-01 17:07:24 +00:00
58d0dc21aa Getting video texture closer to compiling under linux 2008-11-01 17:06:36 +00:00
0aff409d54 Bugfix #17913
Bah... fix for envmaps just before 2.48 release gave good looking envmaps 
only when there was no sky involved...

The alpha in environment maps should be reset to 255... something that was 
never done before, but also didn't show errors until other fixes in image 
rendering were done.
2008-11-01 16:09:36 +00:00
bd81d96b78 Video Texture: missing newlines at the end of several files. 2008-11-01 15:58:49 +00:00
5cb16c2d03 Video Texture: remove support for capture device, the linux ffmpeg repository is not ready yet. 2008-11-01 15:42:03 +00:00
5b205ce852 Speedup collecting pixels from a faces UV, was using 'point-in-tri' (IsectPQ2Df) for every pixel in the UV Bounds of a face, replace this with intersection tests that use scanlines to get the x-range of pixels for each Y increment. 2008-11-01 15:35:07 +00:00
00b02f055a Patch 17909: 2D Filter texture coordinates changes, by Dalai Felinto:
* The second opengl texture coordinate (gl_TexCoord[1]) are now filled
  in as well, and will give canvas coordinates from 0.0 to 1.0. The
  first texture coordinates still give the coordinates in the texture
  that is being used, which may not match the canvas exactly, so both
  coordinates are needed.
* Also optimization to allow using smaller texture sizes with multiple
  smaller viewports.
* Print the detailed GLSL shader errors (once), for easier debugging.
2008-11-01 14:00:16 +00:00
54401d36aa BGE Video Texture: fix constant initializer problem with Exception description. Uniformized the line ending. 2008-11-01 12:48:46 +00:00
5cdbbe3a92 * Tweaked the spin force field a bit. It worked great for its purpose
before, but wasn't playing nice with the other force fields (was 
overwriting the velocity rather than acting as a force). This version is 
slightly different, but will work a lot better with other force fields too.
2008-11-01 12:45:19 +00:00
b590b121d3 fix a bug in matrix.invert() for 2x2 matrices
reported by Hans in http://blenderartists.org/forum/showthread.php?t=139748
2008-11-01 11:35:08 +00:00
48fb0edc78 Fix Cmake for MSVC 32bit 2008-11-01 11:15:13 +00:00
a8c4eef326 VideoTexture module.
The only compilation system that works for sure is the MSVC project files. I've tried my best to
update the other compilation system but I count on the community to check and fix them.
 
This is Zdeno Miklas video texture plugin ported to trunk. 
The original plugin API is maintained (can be found here http://home.scarlet.be/~tsi46445/blender/blendVideoTex.html)
EXCEPT for the following:

The module name is changed to VideoTexture (instead of blendVideoTex).

A new (and only) video source is now available: VideoFFmpeg()
You must pass 1 to 4 arguments when you create it (you can use named arguments):

VideoFFmpeg(file) : play a video file
VideoFFmpeg(file, capture, rate, width, height) : start a live video capture

file:
In the first form, file is a video file name, relative to startup directory.
It can also be a URL, FFmpeg will happily stream a video from a network source.
In the second form, file is empty or is a hint for the format of the video capture.
In Windows, file is ignored and should be empty or not specified.
In Linux, ffmpeg supports two types of device: VideoForLinux and DV1394. 
The user specifies the type of device with the file parameter:
   [<device_type>][:<standard>]
   <device_type> : 'v4l' for VideoForLinux, 'dv1394' for DV1394; default to 'v4l'
   <standard>    : 'pal', 'secam' or 'ntsc', default to 'ntsc'
The driver name is constructed automatically from the device types:
   v4l   : /dev/video<capture>
   dv1394: /dev/dv1394/<capture>
If you have different driver name, you can specify the driver name explicitely 
instead of device type. Examples of valid file parameter:
   /dev/v4l/video0:pal
   /dev/ieee1394/1:ntsc
   dv1394:ntsc
   v4l:pal
   :secam

capture: 
Defines the index number of the capture source, starting from 0. The first capture device is always 0.
The VideoTexutre modules knows that you want to start a live video capture when you set this parameter to a number >= 0. Setting this parameter < 0 indicates a video file playback. Default value is -1.

rate: 
the capture frame rate, by default 25 frames/sec

width: 
height: 
Width and height of the video capture in pixel, default value 0.
In Windows you must specify these values and they must fit with the capture device capability. 
For example, if you have a webcam that can capture at 160x120, 320x240 or 640x480, 
you must specify one of these couple of values or the opening of the video source will fail.
In Linux, default values are provided by the VideoForLinux driver if you don't specify width and height.

Simple example
**************
1. Texture definition script:

import VideoTexture

contr = GameLogic.getCurrentController()
obj = contr.getOwner()
if not hasattr(GameLogic, 'video'):
	matID = VideoTexture.materialID(obj, 'MAVideoMat')
	GameLogic.video = VideoTexture.Texture(obj, matID)
	GameLogic.vidSrc = VideoTexture.VideoFFmpeg('trailer_400p.ogg')
	# Streaming is also possible:
	#GameLogic.vidSrc = VideoTexture.VideoFFmpeg('http://10.32.1.10/trailer_400p.ogg')
	GameLogic.vidSrc.repeat = -1
	# If the video dimensions are not a power of 2, scaling must be done before
	# sending the texture to the GPU. This is done by default with gluScaleImage()
	# but you can also use a faster, but less precise, scaling by setting scale
	# to True. Best approach is to convert the video offline and set the dimensions right.
	GameLogic.vidSrc.scale = True
	# FFmpeg always delivers the video image upside down, so flipping is enabled automatically
	#GameLogic.vidSrc.flip = True

if contr.getSensors()[0].isPositive():
	GameLogic.video.source = GameLogic.vidSrc
	GameLogic.vidSrc.play()


2. Texture refresh script:

obj = GameLogic.getCurrentController().getOwner()
if hasattr(GameLogic, 'video') != 0:
  GameLogic.video.refresh(True)

You can download this demo here: 
http://home.scarlet.be/~tsi46445/blender/VideoTextureDemo.blend
http://home.scarlet.be/~tsi46445/blender/trailer_400p.ogg
2008-10-31 22:35:52 +00:00
77b4c66cc3 Preparation to VideoTexture: everything but the VideoTexture module itself.
Rename PHY_GetActiveScene() to KX_GetActiveScene(): more logical name
Add KX_GetActiveEngine()

new KX_KetsjiEngine::GetClockTime(void) to return current 
render frame time: if the CPU does not keep up with the 
frame rate, up to 5 consecutive logic frames are processed 
between each render frame, so that the logic system stays 
accurate even if the graphic system is slow. For the video 
texture module, it is important to stay in sync with the
render frame: no need to update the texture for logic frame.

BL_Texture::swapTexture(): texture id manipulation
BL_Texture::getTex() : return material texture

Enable video support in ffmpeg for Linux.
2008-10-31 21:06:48 +00:00
8585813693 Update MSVC project files 2008-10-31 20:50:07 +00:00
Nathan Letwory
44efce4f66 * remove unreferenced var 2008-10-31 20:47:30 +00:00
Nathan Letwory
3f7535d3c3 * silence compiler about warnings for C++ files a bit more.
- from what I can see now, the larger part of warnings is now about conversions "possible loss of data" (ie. double to float, etc).
2008-10-31 20:35:14 +00:00
81dd05fd55 speedup occlusion by removing octree raytracing method and use the bucket's face list. 2008-10-31 17:12:45 +00:00
Nathan Letwory
027d86b9ff * doc update 2008-10-31 16:33:42 +00:00
25a2753877 This is coverity issue CID: 456
fixes a buffer overrun issue.

Kent
2008-10-31 14:15:35 +00:00
68cde07b99 corrections to the C_WARN and CC_WARN variables for scons config. I didn't actually changed what the flags were, just the format, but Platform Maintainers, please check. 2008-10-31 13:58:59 +00:00
80971310a3 paint onto the final derived mesh rather then the original mesh data, so painting onto a modified mesh (subsurf, mirror etc) works as expected. 2008-10-31 10:30:30 +00:00
d996f4e0b7 basic projection painting - should work without crashing and not be too slow.
does not use any opengl for calculations (2.5 friendly!) and free from screen pixel artifacts. raytracing is used for occlusion.
Details
* Uses a 2D screenspace bucket grid that store intersecting faces and a list of UV pixels to optimize lookups between the brush rectangle UV pixels
* Buckets and faces are initialized when a brush first touches them.
* on initializing all the faces used have their UV pixels are converted into screenspace and copied into the buckets for painting (if the pixel is not occluded by a ray cast).

still a lot to do - blend modes, float buffer, image wrapping, image texture filtering.

Add feature requests here
http://wiki.blender.org/index.php/Wahooney_re/Paint_Branch_Proposals
2008-10-31 05:51:16 +00:00
15579884b1 * Added a new turbulence type: Time. It's not entirely well tested, but so far working ok. It's smoother looking than 'velocity' but may need more in depth investigation. 2008-10-31 05:29:54 +00:00
457b1118a2 Fix compile flags in linux config to fit Nathan's changes.
Warning to others: Those flags are lists now, be careful and update other configs if needed.
2008-10-31 00:23:01 +00:00
Nathan Letwory
0bd7934be7 * Minimum SCons version is now 1.0.0
- Code has been changed to reflect this (ie. deprecated functions are not anymore used)
* clean up the C and C++ compiler flags mess.
  - in the environment construction of BlenderLib all the compile flag governing options have been split in the *C*, *CC* and *CXX* containing equivalents.
    C is for C compiler only flags. CC is for C and C++ compiler flags and CXX is for C++ compiler only flags.
    All the platform default config files need to be double checked and fixed wherever it looks necessary. Either DIY, or send me a note with needed changes.
  - a start for the BlenderLib parameter list has been made - all the SConscripts need to be checked and modified to hand in flags properly.
* A theeth request: make -jN settable in the config file.
  - I give you BF_NUMJOBS, which is set to 1 by default. In your user-config.py, set BF_NUMJOBS=4 to have 4 parallel jobs handled. Yay.
2008-10-30 23:55:07 +00:00
cfee0079d2 Lots of code cleanup and some new features.
Clean and split editbone duplication methods for easy reuse.

Copy and retarget selected bones to stroke conversion method.

This is the start of the infamous templating system.

A simple demo video is available: http://blenderartists.org/~theeth/bf/etch-a-ton/retarget.ogv and http://vimeo.com/2111535 (for those who dislike ogg/theora)
2008-10-30 19:58:11 +00:00
Nathan Letwory
dca18fc332 * Build aborts when giving options on command-line when WITH_BF_DOCS=True
- make sure epydoc generation doesn't get a fit over options given on scons command-line -> don't use arguments from command-line.
2008-10-30 18:56:20 +00:00
00f3021b68 Build fix (C90): Declaration after statement 2008-10-30 16:38:32 +00:00
baf98b098c Fix for dependency graph cycle print, regular "Parent" relation was
incorrectly printed as "Curve Parent".
2008-10-30 16:03:38 +00:00
4f39255759 Bugfix for [#17879] Speed vectors/velocity data not working on ALL fluids. 2008-10-30 11:51:15 +00:00
5fb8debada * Added a new, slightly experimental force field type: 'Spin'.
It works similarly to Vortex, but it's a more controllable - it 
doesn't send the particles off accelerating into space, but 
keeps them spinning around the Z axis of the force field object.

This is safe in the branch, but Jahka if you have any feedback, 
I'd be curious to hear :)
2008-10-30 09:26:30 +00:00
1a7bc63933 moving stuff home. first draft for template retargetting 2008-10-29 21:49:58 +00:00
0a8498953c merge trunk 17213:17221 2008-10-29 19:14:59 +00:00
35680bbda6 EditVert hash *is* used elsewhere in the code, so just to be safe, use a scratch array instead.
This is actually much safer than juggling values in the tmp union all the time.
2008-10-29 18:57:28 +00:00
4cee77b822 This is a fix for coverity issue CID: 517
Basically the code was referencing var[-1] it wasn't using it
but also did not need to be set in those cases.  So I moved
the assignments so it skips the -1 case.

Kent
2008-10-29 17:45:02 +00:00
22bcbc5742 fix for more disable python defines,
FTOCHAR didnt have brackets around the value. FTOCHAR(a+b) didnt work, FTOCHAR((a+b)) did.
2008-10-29 16:49:51 +00:00
19094597b3 merge trunk 17122:17213 2008-10-29 00:11:58 +00:00
481831bd27 merging harmonic-skeleton branch into trunk. All changes are hidden behind a disabled define, nothing to see here 2008-10-28 22:53:48 +00:00
4baa2d7800 merge 17206:17211 2008-10-28 20:26:38 +00:00
07a1971ced error in DISABLE_PYTHON defines 2008-10-28 20:19:25 +00:00
dca5192974 Fixes blenderplayer for dds stuff
Kent
2008-10-28 19:53:54 +00:00
ac4ff83ca6 added scons option BF_WITH_PYTHON (defined as DISABLE_PYTHON) 2008-10-28 18:47:13 +00:00
025e4b046a merge 17122:17206 2008-10-28 18:47:01 +00:00
d1e90606c7 Add compile time define to disable skeleton generation and retargetting UI (disabled by default).
This is done to make merging make in trunk painless.
2008-10-28 18:33:53 +00:00
705a248c75 Updated cmake so it has the option to use WITH_DDS
Kent
2008-10-28 18:33:34 +00:00
c71430d072 bpy access to image premul was missing. 2008-10-28 02:03:13 +00:00
Ken Hughes
5cd569ed0e Python API
----------
Bugfix #17911: Mesh.getFromObject() incorrectly decremented the mesh's
material user refcount when the material was linked to the object.
2008-10-28 00:01:20 +00:00
3db27c9acb Sketching: Gesture to flip stroke (circular arc intersecting the stroke twice).
Some name cleanup.
2008-10-27 23:25:08 +00:00
258784ae4b svn merge -r 17042:17201 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-10-27 20:14:45 +00:00
2e96728843 face transp option CLIP wasnt added to the py api.
added gameObject.replaceMesh(meshname)  - needed this for an automatically generated scene where 100's of objects would have needed logic bricks automatically added. Quicker to run replace mesh on all of them from 1 script.
2008-10-27 15:47:58 +00:00
71260b6603 Fix for crash reading a peach file, chubbychestnut.blend. A do_versions
conversion was reading the mtex array in a library linked material. It
is however not guaranteed that direct_link_* was called  on the material
yet, so the array pointer is not always valid and it can crash.
2008-10-27 15:22:55 +00:00
780a5438a2 Bugfixes:
* #17900 - IK Constraint was not included regardless of what Visual-Keying method was used
* Deleting a Bone Group now corrects indices of those groups that occurred after the one that was deleted
* No more click-a-mania - Delete all vertex groups from a Mesh (Ctrl-Shift-G menu)
2008-10-26 09:41:59 +00:00
0dc22dc65e fix for [#17895] Python-generated Curves can't be beveled
radius and weight's values were not initialized for nurbs curves

for 2.48a just use set radius from curve specials menu to work around this.
2008-10-26 08:06:48 +00:00
deea0fa2e7 * More improvements for light cache
Previously when using light cache, there could be artifacts caused when 
voxel points that were sampled outside the volume object's geometry got 
interpolated into the rest of the volume. This commit adds a (similar 
to a dilate) filter pass after creating the light cache, that fills 
these empty areas with the average of their surrounding voxels.

http://mke3.net/blender/devel/rendering/volumetrics/vol_lightcache_filter.jpg
2008-10-23 03:50:56 +00:00
ba829e5c36 Debugging tests paid off, fixed a ridiculously silly bug
that was preventing light cache from working on some 
people's systems (but went just fine on both my windows pc 
and mac). I have no idea how the original code even worked 
at all, it really shouldn't have.

But fixed now anyway! Thanks a bunch to Zanqdo for patience
in helping me pinpoint this.
2008-10-23 02:15:36 +00:00
ffe81354f8 removed debug stuff 2008-10-23 02:03:54 +00:00
5fabc7781b and more debugging 2008-10-23 01:52:04 +00:00
ee1a143947 more testing code 2008-10-23 01:40:49 +00:00
3a347c1caf Just adding some temporary testing code to help try and find a bug. 2008-10-23 01:14:30 +00:00
42075d5229 Snapping sketch to bone was using untransformed head/tail. Fixed. 2008-10-22 20:30:02 +00:00
229ae0275f Gesture for delete selected (experimental): figure 8 (gesture crossing on itself twice) 2008-10-22 20:17:11 +00:00
0033293b1e Correct handler for floating panel (close button wouldn't work)
Redraw event on floating panel buttons
Correct limit for Number of Fixed subdivision button
Fix off by one error in fixed subdivision loop.
2008-10-22 18:08:06 +00:00
c11c299d59 default opengl static locations was to try /usr/libGL.a, use the oprngl lib path instead - /usr/X11R6/lib/libGL.a 2008-10-22 16:43:38 +00:00
f005bb1a2a Missing NULL check causes crash on Ikey when no active object.
Error is bad enough to go for a retag... hrmf!

Report from Ernesto (der|kunstler) Mndez in irc. Thanks a lot!
2008-10-22 16:13:30 +00:00
fbecf0cadc New splash c file (now gimp png) and bumped version to 2.48.1 to make it
even a bit more clear.

After this commit we'll tag svn (gasp!) and then go build!
2008-10-22 11:50:12 +00:00
d4e2c48faa Part one of the release update commit 2008-10-22 11:48:26 +00:00
Nathan Letwory
2ecf987dc6 * Minor cleanup of SCons files
- cleanup of boolean usage - use True and False now instead of 'true'/'false' or 0/1
- changed SConscripts accordingly
2008-10-22 11:28:10 +00:00
8a6c82684f * Did some small tweaks to how density is used with light
cache - it makes some very good improvements clearing up artifacts:

http://mke3.net/blender/devel/rendering/volumetrics/vol_lc_fixed.jpg
2008-10-22 09:26:18 +00:00
688cc11302 added an option for python Draw.UIBlock(func, mouse_exit) so moving the mouse outside the popup wont close it.
Stops FBX Export and OBJ I/O from flickering a lot.
2008-10-22 08:21:43 +00:00
69c6bd604c make sure BPY_Err_Handle clears python errors, even if the exception cant be printed. Added PyErr_Clear() incase there are other references to exception data (sys.exc_info() from python) 2008-10-22 07:09:15 +00:00
Nathan Letwory
5987488fd0 * comment fix 2008-10-22 07:02:30 +00:00
c62c61a413 * Fixed a bug in copying (making single user) a point density texture 2008-10-22 06:10:16 +00:00
09e4bb058c 2008-10-22 05:35:23 +00:00
0026247ee2 2008-10-22 05:33:45 +00:00
876368d859 * fix for point density - particle systems weren't being
deformed by lattices
2008-10-22 05:24:41 +00:00
18f2d484d9 missing undo for vgroup operations, countall was running twice from select/deselect and DAG_object_flush_update isnt needed for changed selections. 2008-10-22 04:42:00 +00:00
59a30d822f fix for [#17878] Scripts operating on blender objects don't clear memory after a crash
This is an interesting bug since it is likely the cause of many other suspicious python crashes in blender.

sys.last_traceback would store references to PyObjects at the point of the crash.
it would only free these when sys.last_traceback was set again or on exit.

This caused many crashes in the BGE while testing since python would end up freeing invalid game objects -
When running scripts with errors, Blender would crash every 2-5 runs - in my test just now it crashed after 4 trys.

It could also segfault blender, when (for eg) you run a script that has objects referenced. then load a new file and run another script that raises an error.
In this case all the invalid Blender-Object's user counts would be decremented, even though none of the pointers were still valid.
2008-10-22 03:10:00 +00:00
febcbdcfcd Tweaked rendering inside a volume to always return alpha 1.0.
This fixes an issue which darkened the render from inside a 
volume with sky or premul on. Still need to find a good way to
get an alpha value back into the shader (for compositing etc)
without getting the render distorted by premul.
2008-10-22 02:59:33 +00:00
652e4b5225 Point Density:
Replaced 'Sharp' falloff with 'Soft'. This falloff type has 
a variable softness, and can get some quite smooth results. 
It can be useful to get smooth transitions in density when 
you're using particles on a large scale:

http://mke3.net/blender/devel/rendering/volumetrics/pd_falloff_soft.jpg

Also removed 'angular velocity' turbulence source - it
wasn't doing anything useful atm
2008-10-22 01:31:46 +00:00
6f656f6482 fix for a compile error with msvc 2008-10-22 00:26:19 +00:00
094fda8cd9 * Fixed a crash with using light cache on a plane (which doesn't really make sense, but shouldn't crash at least) 2008-10-22 00:09:12 +00:00
4936e09cdf add a way for external scripts to call X3D/VRML importer and deal with unknown node types. 2008-10-21 23:14:40 +00:00
Nathan Letwory
71206c9337 Patch from Timothy Baldridge
* add irix6 to GHOST windowing system (same as linux2 et al)
* fix faulty return lines in shrinkwrap.c
2008-10-21 23:07:09 +00:00
a96863b65c Fixed Subdivision method (subdivide in a set number of bones).
Subdivision method cleanup (reuse more code)
2008-10-21 22:38:32 +00:00
7c1639f032 Auto Roll:
Bone roll to face the screen on painted strokes.
2008-10-21 17:59:56 +00:00
62c708624d Draw subdivision preview for quick strokes and selected strokes (those that would be converted).
Preview can be slightly off for quick strokes since subdivision will be affected by stroke smoothing applied only when a continuous stroke is finished.
2008-10-21 16:40:42 +00:00
7a4e9d97ff Fix for bug #17881: with SSS disabled, SSS materials didn't
render textures, related to other recent bugfix for baking.
2008-10-21 14:46:00 +00:00
Nathan Letwory
b32bd5e8af * improvement for CSizeof
- instead of fiddling around with strings, just compare pointers. (It's a good thing we have ideasman_42)
2008-10-21 10:38:24 +00:00
1df683a38b more python 2.3 compat, should be the last of it. 2008-10-21 09:08:46 +00:00
f99c02a06b Duplicating bones in EditMode didn't set the custom-shape and bone-groups too. 2008-10-21 08:53:39 +00:00
a7d7acf601 Bugfix:
"Warning: binarysearch_bezt_index encountered invalid array" errors were being displayed in the console. Was caused by 3d-view show-keyframe for infostring stuff, when an IPO being checked had no keyframes.
2008-10-21 08:30:02 +00:00
Nathan Letwory
27b90f2c66 * Add some missing docu for Blender.Types
* Fix potential crash in CSizeof()
2008-10-21 08:27:38 +00:00
b12d9bfa9c * reimplemented some things, hopefully may fix some problems zanqdo was having 2008-10-21 08:21:36 +00:00
8977ccafbb Bugfixes:
- Adding constraint using button in panel still didn't update Armature Editing buttons properly.
- Minor code tidying of earlier bugfix for armatures
- 'For Transform' option for Limit constraints is now only taken into account for constraints that are enabled.
2008-10-21 08:00:19 +00:00
97a7b05068 fixed a crash in volume shadows 2008-10-21 06:10:36 +00:00
d335c2dfcf * fixed a memory leak that was happening during preview render 2008-10-21 02:04:29 +00:00
3ac142e654 #17873: "switch direction" for bones can cause infinite loop
Second attempt at fixing this bug. Previous fix caused segfault when all bones in a chain are selected. Now it should segments which are selected (i.e. get swapped) will get unparented from segments that aren't (i.e. aren't swapped, so are still in old orientation)
2008-10-21 01:40:47 +00:00
11afafb01e [#17873] "switch direction" for bones can cause infinite loop
Stop the infinite loop, but it could be loosing parent relations that it kept before. Aligorith needs to review.
2008-10-21 01:11:18 +00:00
ff2fcdf34e py 2.3 compat for lightwave_import and wizard_curve2tree 2008-10-21 00:21:02 +00:00
bc55102eac renamed WITH_BF_BPYDOC to WITH_BF_DOCS, added SConscript for building BGE docs too. 2008-10-20 23:21:01 +00:00
07f072457d * fix for crash after latest light cache commit 2008-10-20 23:12:42 +00:00
0107b2729a Add undo push for quick strokes conversion 2008-10-20 20:16:33 +00:00
ff3924ce2f Quick Strokes option
When turned on, edit mode armature act as usual, but LMB can be directly used to paint strokes or poly lines which will be directly converted to bones once ended (with RMB).

Esc now cancels the current stroke instead of ending it (more useful with quick strokes).

Video online:

http://blenderartists.org/~theeth/bf/etch-a-ton/quick_strokes.ogv
2008-10-20 18:55:09 +00:00
fd1dcada60 fix for [#17871] PLY file import: blender seems to loose vertex color information
use Mesh rather then NMesh
2008-10-20 13:36:18 +00:00
Nathan Letwory
47345cfd78 === Blender Python API ===
After some discussion with Campbell, changed the way cstruct sizeof is fetched.

Moved DataSize() to Blender.Types.CSizeof(Blendertype). Supported types return sizeof(data struct), otherwise -1.

To quickly check what types are supported:

import Blender.Types as bt
x = dir(bt)
for t in x:
	if t[0] != '_':
		s = 'bt.CSizeof(bt.' + t + ')'
		print t,"=", eval(s)
2008-10-20 12:33:31 +00:00
25859cf1f7 Another constraint panel (in Armature Editing Panels) bugfix. This time, when adding a new constraint using vertical layout. 2008-10-20 09:35:07 +00:00
81c21128bb A few warnings missed in previous sweep 2008-10-20 09:24:25 +00:00
9d2fc97827 New volume rendering feature: Light Cache
This was a bit complicated to do, but is working pretty well now, and can make shading significantly faster to render.

This option pre-calculates self-shading information into a 
3d voxel grid before rendering, then uses and interpolates
that data during the main rendering phase, rather than 
calculating shading for each sample. It's an approximation
and isn't as accurate as getting the lighting directly, 
but in many cases it looks very similar and renders much faster.
The voxel grid covers the object's 3D screen-aligned bounding box
so this may not be that useful for large volume regions like a
big range of cloud cover, since you'll need a lot of resolution.

The render time speaks for itself here:
http://mke3.net/blender/devel/rendering/volumetrics/vol_light_cache_interpolation.jpg

The resolution is set in the volume panel - it's the resolution
of one edge of the voxel grid. Keep in mind that the higher the
resolution, the more memory needed, like in fluid sim. The
memory requirements increase with the cube of the edge 
resolution so be careful. I might try and add a little memory 
calculator thing like fluid sim has there later.

The voxels are interpolated using trilinear interpolation - 
here's a comparison image I made during testing:
http://mke3.net/blender/devel/rendering/volumetrics/vol_light_cache_compare.jpg

There might still be a couple of little tweaks I can do to 
improve the visual quality, I'll see.
2008-10-20 07:08:06 +00:00
63f6932fa5 Reduced number of MSVC compiler warnings (mostly just casting issues). 2008-10-20 06:39:08 +00:00
67e3ac0edf - Bugfix: 'Hide' button for PoseMode bones (in Editing Buttons) was setting the 'Mult' flag instead
- Tidied up comments in Action Editor code a bit
2008-10-20 04:53:49 +00:00
a806c1eb7f merge 16951:17122 2008-10-20 00:48:10 +00:00
f1faacd7e1 Merge 16964:17122 2008-10-20 00:27:33 +00:00
1e17953d68 Adding undo push and redraw for convert calls. 2008-10-20 00:04:40 +00:00
90721f3f83 Fixed overlapping panels in Armature Buttons that resulted after adding a constraint/IK using the hotkeys. 2008-10-19 23:52:28 +00:00
Nathan Letwory
036c4f6434 === Blender Python API ===
* add DataSize() to module level
  with this one can get datablock struct size.
2008-10-19 23:20:17 +00:00
Nathan Letwory
ae9953bb87 forgot to add removeRenderLayer() documentation 2008-10-19 22:09:45 +00:00
Nathan Letwory
f1f27c0350 === SCons ===
[#17867] Adds option to SCONS to generate Python API documentation

Added patch from Brandano with some small improvements (BF_DOCDIR, clean) by yours truly.

To use make sure you have epydoc installed. Enable with WITH_BF_BPYDOC=1.
2008-10-19 22:01:46 +00:00
Nathan Letwory
3544a4bd36 === Blender Python API ===
* fix two typos in RenderLayer API (renderosiy -> renderosity in two places. Will break .py's saved with render_save_layers.py, just fix passRadiosiy and passRadiosiyXOR)
* add some docs on RenderLayer API
* fix some copy/paste leftover in render_save_layers.py
2008-10-19 21:39:50 +00:00
Ken Hughes
a6b1c0a8cc Added WITH_BF_NOBLENDER to scons so that blenderplayer can be compiler by itself (false by default). Also added dependency for 'blender' on command line; seems 'blender' was intended to be a target, but would give the error "Do not know how to make target `blender' ". 2008-10-19 21:25:17 +00:00
18072f5583 modified OBJ import and export UI's to be less confusing with nicer layout. removed an unneeded workaround in fbx export. 2008-10-19 15:53:22 +00:00
Nathan Letwory
4d4fd5687f * small code change from Split to env.Glob() 2008-10-19 13:51:52 +00:00
Nathan Letwory
f76a742dc0 === BPy API ===
* Add read access for octree resolution
2008-10-19 13:48:37 +00:00
49aa7edb77 Another WIP commit, nothing to see yet. 2008-10-19 08:25:10 +00:00
c6d1ac3af8 only set the SDL audio driver to alsa when not running in background mode and when blender is compiled with SDL. 2008-10-19 06:12:11 +00:00
42e287af1c source/blender/blenloader/intern/readfile.c - use memmove rather then strncpy for overlapping strings.
source/blender/blenlib/intern/fileops.c - zero length strings would check for a slash before the strings first char.
source/gameengine/GameLogic/SCA_JoystickSensor.cpp - m_istrig_prev was not initialized
source/blender/src/editmesh.c - active face pointer was not set to NULL in free_editMesh()
2008-10-19 04:02:37 +00:00
72e5ede546 Few tiny cleanups in Action Editor code (comments only) 2008-10-19 03:41:49 +00:00
ba72ff005c Self intersection detection for gestures.
Two new gestures:

- Merge: remove cuts on a stroke (gesture is a circle around the cuts to remove). The encircled points are changed to continuous points.
- Convert: convert selected strokes to bones (gesture is a stroke that loops back on itself once).

Note that all those different gestures are experimental. First, to get a good hang on recognition. Second, to try different things.
2008-10-19 03:33:53 +00:00
96f524ee98 Alt-C and Del/X for convert and delete (no confirmation, no undo, LIVE ON THE EDGE!)
Fix bug with mouse selection (would selected last stroke when clicking in empty space).
2008-10-19 00:35:00 +00:00
7d108a30ee Delete Gesture:
2 segments gesture, going back and forth over a stroke (intersecting twice, angle between segments > 120). Can delete more than one stroke at once. Stroke crossed only once are not deleted.
2008-10-18 23:54:09 +00:00
9dc10efa15 Gesture recognition:
- straight segments are extracted from the strock
- Cut gesture is now on straight strokes only

Trim Gesture:
- Two segments gesture. First segment indicates where the cut is, second indicates which side to trim.

Gesture / Stroke intersection bugfix: better code to deal with perspective (this is very brute force still).
2008-10-18 22:16:42 +00:00
a71cb63ce6 BGE bug #17858 fixed: [SHOWSTOPPER] BGE Memory leak. The memory leak has been identified and fixed in bullet. 2008-10-18 18:37:58 +00:00
e96a5bd05b patch [#17856] Correction on docs for Ipo module. from Lucas Vella (lvella) + some other minor changes. 2008-10-18 13:33:27 +00:00
03d5780b76 Added joystick epydocs, only changed incorrect docstrings in SCA_JoystickSensor.cpp
patch [#17857] HotKeys Update by dfelinto - SmoothStroke and Anchored.
	Made own edits, removed videoscape and added curve and armature specials.
2008-10-18 13:23:30 +00:00
1be4da60a2 * Fixed eekadoodle problem where faces with a zero index vert in the wrong place would reotate the UVs and VCols incorrectly
* Fixed an error that made IndexedLineSet and IndexedPointSet not load for x3d's
* Added support for opening gzip x3d/wrl files
2008-10-18 09:04:25 +00:00
0f49fd401f Skeleton Sketching
Cut gesture: drawing a line with RMB adds exact points (joints in the final skeleton) on strokes. Can cut multiple strokes at once as long as it cuts each one only once (this could be changed).

Shape of the gesture doesn't matter, but eventually it would be straight lines shapes for cuts.
2008-10-17 21:52:50 +00:00
efdbf4b1fc x3d and vrml importer for loading thes files as static scenes. x3d needs a full python install. VRML97 files can be imported without python.
for details on what is supported see
http://wiki.blender.org/index.php/Scripts/Manual/Import/X3D_VRML97#Compatibility
2008-10-17 19:06:24 +00:00
2158fbf9e3 Fix for bug #17829: with ATI drivers, GLSL shadows crashed on physics
'show pivot' drawing in the viewport. Also added checks for some other
cases where this could happen.
2008-10-17 13:36:40 +00:00
6ff2110edc Fix for imagepaint soften tool giving a bit too dark results,
due to poor float-to-char conversion.
2008-10-17 13:34:20 +00:00
bf0440add8 BGE bug fix (continuation of previous bug fix):
- Forgot to make SCA_ISensor::UnregisterToManager() virtual to intercept active-inactive transition on collision sensor to clear colliders reference.
- Don't record collision on inactive sensor. 
  This situation occurs when an object with an inactive collision sensor collides with an object with an active collision sensor: the collision handler triggers both sensors.
  The result of this bug was pending references that eventually cause temporary memory leak (until the sensor is reactivated).
2008-10-17 09:24:35 +00:00
b3000c5529 non-working WIP commit to continue coding at home.
nothing to see here, move along!
2008-10-17 05:54:42 +00:00
16aaefb5c3 Bugfixes for sketching with multiple 3d view (correct update and poly line preview in all views).
Fixed a bug with correlation conversion (matrix application wasn't done at the correct place).
2008-10-17 04:17:16 +00:00
c119fb6e51 BGE showstopper bug fix:
- Reset hit object pointer at end of frame of touch sensor to avoid returning invalid pointer to getHitObject().
- Clear all references in KX_TouchSensor::m_colliders when the sensor is disabled to avoid loose references. 
- Test GetSGNode() systematically for all KX_GameObject functions that can be called from python in case a python controller keeps a reference in GameLogic (bad practice anyway).
2008-10-16 23:33:40 +00:00
265dc12d0a First draft for sketching gestures.
Destures are done with RMB drag
ESC can now also be used to end a polyline.
2008-10-16 21:48:35 +00:00
d8d2358ab2 [#17845] View Snapping causes background grid confusion
view needs to be reset while moving to take care of view snapping properly.
2008-10-16 21:43:25 +00:00
005d7a2a9b Color fade out to indicate the direction of a stroke. 2008-10-15 21:25:42 +00:00
9dec209b7e Subdivision schemes for continuous strokes:
Subdivide in equal length bones
Subdivide by correlation (linearity limits)

Code borrowed in parts from the skeleton generator. Will be eventually reuse code more efficiently.
2008-10-15 19:31:32 +00:00
58ce460cf7 vrml exporting with images was broken. 2008-10-14 23:43:08 +00:00
8fcaa1782d cleanup epydoc errors 2008-10-14 22:31:10 +00:00
dcda0b9d86 == windows installer ==
small update for release 2.48 - no need to re-tag
2008-10-14 20:27:37 +00:00
718c0d5d70 Convert and Delete only selected strokes.
Convert no longer remove converted strokes.
Akey -> select all/deselect all strokes
2008-10-14 20:03:21 +00:00
Nathan Letwory
c6e2684c60 === Installer (win32) ===
* Fix for [#17651] Silent Install Issue
  - make sure silent install is really silent ( /S on command-line)
* Improve installer to check for msvc90.dll
* Improve installer to check for py 25 install (using registry)
2008-10-14 16:24:27 +00:00
55dafc125b resaved in the gimp, now loads with libpng 1.2.30 2008-10-14 14:10:49 +00:00
6773d41daa Bugfix #17832
Particle system crashed in convertblender, missing NULL check.
This fixes crash, render survives, but I doubt it was meant so...

Will leave it Janne to evaluate later.
2008-10-14 12:16:12 +00:00
e1aff849e4 Collisions: CollisionModifier needs to be resetted for every loop 2008-10-14 11:54:07 +00:00
af7b777d22 Bugfix for regression from 2.46 on cloth collisions reported by Daniel Salazar via IRC 2008-10-14 11:50:30 +00:00
b0b37252da Bugfix on IRC report. Luckily Daniel Salazar *does* carefully check our
regression files, it showed small dark outline errors on envmap.

This commit rewinds bugfix #8437, which actually had to be fixed on
another location in code, which was done a few weeks ago. :)
2008-10-14 11:42:53 +00:00
028a10769b Bugreport in IRC: Area lamp, "Constant jitterred" had wrong alignment
code, causing the "SamplesY" button to overlap others.
2008-10-14 10:55:18 +00:00
882997ddff Bugfix #17830
Index OB pass didn't support FSA for Ztransp.
Also made buttons to set black/white for non-RGBA images hide in Image Window,
the Curves color code only supports 4 channels atm.
2008-10-14 10:44:22 +00:00
0196890ebf Action Editor - Grease Pencil Bugfix:
When Action Editor was maximised, Grease Pencil data disappeared. This was due to the screen-swapping that went on. Now, it uses the old-screen that was stored in the maximised Action Editor's screen (should be safe...)
2008-10-14 10:11:01 +00:00
8fa76a3c43 Grease Pencil Bugfixes:
* Onion-skinning with GStep > 0 was not showing enough of a noticable difference between ghosts. Improved method of calculating this.

* Clicking in a Grease-Pencil datablock channel in the Action Editor would crash
2008-10-14 09:36:08 +00:00
c515395067 bugfix: copy/paste bug merged from Bullet main repo into Blender, hope it still can make 2.48 2008-10-14 06:14:25 +00:00
e9b4080354 Embed point looks at last point, whether it was part of a continuous stroke or not (gives better results for poly lines)
Stroke selection (LMB and Shift-LMB).
	Selected strokes drawn in red.
	Eventually convert and delete will work on selection.
2008-10-14 01:25:30 +00:00
af73c8ef42 Skeleton Sketching
- Delete Sketch button
- During continuous strokes, when moving out from and back into an embeding, interpolate depth of the stroke like is done when snapping
2008-10-13 23:41:38 +00:00
f02f984142 Part two of the 2.48 release preparation!
(After this svn tag)
2008-10-13 10:03:17 +00:00
570c64474c Part one of the release 2.48 commit. 2008-10-13 10:01:52 +00:00
51d51991e5 * Added support for solid objects casting shadows within a volume.
Currently it only supports solid shadows - if it's a solid object, it will cast 
100% shadow. Support for transparent shadows can potentially be added down the
track.

http://mke3.net/blender/devel/rendering/volumetrics/vol_shad_internal.jpg
2008-10-13 06:46:23 +00:00
d6808c2b4b * Raytraced shadow casting for volumes
This is a first version and still has a couple of things undefined or
unimplemented, such as external objects casting shadows on or within volumes, 
however volume->solid shadows are going ok.

http://mke3.net/blender/devel/rendering/volumetrics/shadows_test_02.mov
http://mke3.net/blender/devel/rendering/volumetrics/vol_test_shad3.blend

As with other transparent raytraced shadows in Blender ,in order to make it work,
you must enable 'TraShad' on the material *receiving* the shadow. It would be 
nice to make this a bit easier to use, since there's not much chance you want a
volume material to be casting solid shadows, but that's a bigger issue in the 
renderer outside this scope.

The volume shadows are working from the same physical basis of absorption, and 
support coloured absorption:

http://mke3.net/blender/devel/rendering/volumetrics/vol_shad_absorption.png

They also work properly with multi-sampled (i.e. QMC) soft shadows:

http://mke3.net/blender/devel/rendering/volumetrics/vol_shad_sharp.png
http://mke3.net/blender/devel/rendering/volumetrics/vol_shad_soft.png

And by popular request the test file:
http://mke3.net/blender/devel/rendering/volumetrics/vol_test_shad_clouds.blend
2008-10-13 05:22:31 +00:00
602c784de3 missing calls to countall() on switching scenes in the outliner. 2008-10-13 03:55:59 +00:00
c0ddd5fd49 * New option for step size: Randomized
This is on by default, and trades random noise for banding. It jitters
the step size from 75% to 125% of its original amount, and since it
uses the threaded random seeds, shouldn't flicker during animation.

These two images took roughly the same time to render:
http://mke3.net/blender/devel/rendering/volumetrics/vol_stepsize_randomized.jpg
2008-10-13 00:35:58 +00:00
a6bd4480ee * A few volume rendering tweaks:
- modified point density so that it returns a more consistent 
density with regards to search radius. Previously larger radii 
would give much higher density but this is equalised out now.

- Added a new volume material option 'density scale'. This is an 
overall scale multiplier for density, allowing you to (for 
example) crank down the density to a more desirable range if 
you're working at a large physical scale. Volume rendering is 
fundamentally scale dependant so this lets you correct to get the 
right visual result.

- Also tweaked a few constants, old files won't render exactly 
the same, just minor things though.
2008-10-12 23:39:52 +00:00
84cf941c29 Added a -noglsl option to disable GLSL from the command line. 2008-10-12 18:32:26 +00:00
4e7b736097 Multiply by armature inverse matrix to make sure converted bones are where they should be. 2008-10-12 17:54:47 +00:00
6d7353321e First draft for converting sketches to armature.
- New Convert button in the bone sketching float panel
- Only adds straight bones between exact points (not continuous strokes) for now.
2008-10-12 17:33:03 +00:00
1a92054d57 hard limit in for bpy material was wrong 2008-10-12 15:35:17 +00:00
2202cd8781 correction to epydoc 2008-10-12 14:27:30 +00:00
96e9debe1f - Fix for bug #17825: baking SSS is not supported, but it didn't give
proper results, should bake as if SSS was disabled.
- Fix for GLSL to handle failing shadow buffer creation better.
- Fix for sky/atmosphere version patch, was not doing files from 2.46
  and newer.
2008-10-12 13:32:28 +00:00
23a02bbead Bugfix, studio report by Pablo Venomgfx
- insert key crashed when object ipo was in action, but action got unlinked
  from object
2008-10-12 13:16:23 +00:00
2211b46084 svn merge -r 16866:17042 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-10-12 12:17:57 +00:00
3110f63162 == Sequencer ==
This fixes (works around):
[#13598] LOAD / SAVE: Segfault after attempting to load surround encoded file
2008-10-12 12:00:26 +00:00
21075b1a17 Using quad trees instead of binary ones give another 10% speedup 2008-10-12 11:38:28 +00:00
f8d6057808 in rare cases the screen cant be found for BPy's file/image selector 2008-10-12 11:31:11 +00:00
a146614a5c Small fix, ancient issue:
drawing object names in 3d window, zbuffered mode, didn't show up.
2008-10-12 11:13:35 +00:00
2ee4feda26 c3d_import needed encoding defined for python 2.5+ to run.
wav file reading minor fix checking array bounds.
2008-10-12 10:39:45 +00:00
167676dbfe read wave files block align value, rather then assuming 2 or 4. 2008-10-12 07:58:05 +00:00
4022186473 * Patch #17729 from Dalai Felinto
Additional sculpt mode hotkeys to toggle Smooth stroke (Shift S) and Anchored brush (Shift A) . Menus are updated with hotkeys too. This is a real last minute one, but it was given the ok previously, and I've just had time to commit this for him.
2008-10-12 06:39:47 +00:00
012a98988f Bugfix:
Grease Pencil panel in Sequencer and Nodes were not able to be minimised.
2008-10-12 00:59:58 +00:00
0d71c0a9af fix for [#17783] problem when packing wav
"data" is aligned differently in this wave file and the buffer was read past its allocated length.

Fix this by searching for the buffer in increments of 2 (this finds the "data" for the wav file)
added a check not to allow the search to go past the buffer length, so corrupt wave files should not crash.
2008-10-12 00:51:55 +00:00
d241d0a379 Fix for opengl errors being thrown when creating textures, it was
setting the magnification to GL_LINEAR_MIPMAP_NEAREST but that is
only valid for minifaction, should be GL_LINEAR instead. OpenGL
driver should refuse setting this so should be harmless, but better
to fix it anyway.
2008-10-12 00:41:28 +00:00
78cc88e041 Grease Pencil Bugfixs:
- Eraser now works in Sequence Editor. Cleaned up the code that handles Sequencer coordinate-conversions so that it should be a bit faster (doesn't need to recalculate offsets+scaling for every point that is made).

- Fixed mistake made in previous commit that made the pressure value (for tablets) an integer instead or a float. This should solve some of the reports of bits of strokes being missed on tablets.
2008-10-12 00:13:25 +00:00
513b544bbc Fix for two more game engine issues:
* Debug text drawing didn't disable textures correct leaving
  texture state invalid, quite old issue.
* Multitexture materials didn't get enabled correct, recent bug.

Both pointed out by José Ignacio Romero, thanks!
2008-10-11 23:48:37 +00:00
d3c661e682 Fix crash in game engine IPO code, got out of sync after IPO cleanup, removed the duplicated function declarations. 2008-10-11 22:29:50 +00:00
c646a80b53 Actual fix for bug #17819, that doesn't disable the functionality, crash with tiled image textures in the game engine. 2008-10-11 22:16:39 +00:00
ffa67424a9 prevent crash in gpu_draw.c, so tilemode might not have GLSL/GPU features
/* for tiles, copy only part of image into buffer */
	if (GTS.tilemode) {
		return 0; //disabled for now, it causes crashes
	
See tracker issue here:
http://projects.blender.org/tracker/index.php?func=detail&aid=17819&group_id=9&atid=125
2008-10-11 20:54:18 +00:00
3cac11a3a2 Last (hopefully) soft body fixes:
Enable soft body collision clusters by default.
Add option to 'disable collision' button between soft body and rigid body connected by constraint (option was already available between two rigid bodies)
2008-10-11 20:19:04 +00:00
0de3899639 Bone sketching clean up
Armature edit mode only (panel accessible in Armature header menu)
Can be turned on or off
Ctrl also snaps to edit bones' head and tail
2008-10-11 19:53:39 +00:00
b79063bd57 Fix for bug #17794: GLSL didn't take into account normal maps
for Nor texture inputs.
2008-10-11 19:34:48 +00:00
64a0bcd10a remove constraints from world, if not done yet 2008-10-11 19:32:53 +00:00
c40dfaa531 Fix for recent commit, should only do glFinish() on Windows. 2008-10-11 18:58:07 +00:00
5bd1bb4899 Fix for bug #17809: crash with glsl materials and nodes refresh,
didn't attach to the right materials to the lamp.
2008-10-11 18:52:36 +00:00
ec7407f942 Fix for bug #17793: the glFinish() call in ghost that was disabled in a previous commit, because it was causing performance issues for the game engine, apparently still is needed to solved issues with FSAA. Now instead it will still call this for blender but not anymore for blenderplayer. 2008-10-11 16:03:17 +00:00
b2a179c2ac Updated python license, this is compatible with current 2.5 and older.
http://www.python.org/download/releases/2.5.2/license/
2008-10-11 15:55:22 +00:00
5df66e0865 Bugfix #17810: Blender crashes when constraint-keys are moved in NLA
Copy and paste error. Was using ob-ipo instead of conchan->ipo
2008-10-11 12:23:56 +00:00
f691752a34 Quick PyAPI patch:
Now it is possible to clean IPO-curves using the call:
icu.clean()
There's an optional value to specify the threshold to use for cleaning. 

This just wraps the internal clean_ipo_curve() function.
2008-10-11 12:17:16 +00:00
d35178ee61 Grease Pencil Bugfixes:
* Fix for #17808: Can't compile using SunCC - gpencil.c uses DOS line endings. 
Added some svn-properties on gpencil files and also keyframing ones that I added, so that this shouldn't be a problem anymore.

* In Node Editor, it is now possible to close an open Grease Pencil panel when there is no node-tree being shown (i.e. after switching between node editing modes)
2008-10-11 11:07:25 +00:00
ac5c48d186 removed warning in fluidsim.c
fixed tooltip for delay sensor - delay is in tics not frames
2008-10-11 04:30:09 +00:00
9b948cad08 Fix for a relative paths issue in the game engine. G.sce was being
kept as the original file, but that can't work correct for solving
relative paths once a .blend in another directory is loaded. The
reason it went OK with the apricot tech demo is that the images there
were lib linked into the level file, which still worked.

Now it sets G.sce to the current loaded .blend file. Note that the
python config file path still uses the first loaded .blend file so it
looks in the same location each time.

Also added some NULL pointer checks in the joystick code because it
was crashing there on Mac, there's similar checks in related functions
so I'm assuming this was just a missed case.
2008-10-11 00:56:49 +00:00
c3aef29ab7 Bugfix #17802: Grease Pencil still draws when not shown in Image Editor
Added missing check for this case.
2008-10-10 22:49:17 +00:00
69cf55a7d4 Sketch Embed: fix bug when used in edit mode. It's not supposed to be used in mesh edit mode, but at least now it doesn't crash. 2008-10-10 20:23:49 +00:00
2f9e0ec154 This commit fixes bug: [#17770] Texture Plugins do not work. (on windows)
Thanks to Lguillaume for helping with this one.


Had to go back to bug: [#17631] PIL_dynlib_get_error_as_string() returns NULL, causes crash

and revert the fix and make some new updates.
function needs to return NULL so fix the functions that were assuming it
always returns a string.

Kent
2008-10-10 17:52:25 +00:00
d99fd92ffa Missing include, apparently only scons+mingw suffers this, strange. 2008-10-10 14:22:54 +00:00
2cfd53a76d Continuous Embedded Stroke: First point was incorrectly embedded because of missing variable assign. 2008-10-10 13:36:05 +00:00
3fd204312f BGE bug #17789 fixed: Lock Active Camera and Layer to Scene doesn't work in BGE. This bug fix applies only to games started from the 3D view. Now the BGE will use the layer and camera selected in the 3d viewport under the mouse when the user presses P. Note that there is still a problem with the restart game actuator but that's another bug. 2008-10-10 07:20:42 +00:00
7995395fd2 fix: leave default behaviour the same to be backward compatible with previous rigid body constraints: No Collision between linked objects if button is pressed. 2008-10-10 05:32:04 +00:00
3c27b8034b use BLI_strcasecmp instead of strcasecmp so it actually links under Windows 2008-10-10 05:17:47 +00:00
0749bf7be7 Fix bug in rigid body constraint buttons drawing, and while we are at it, add 'Collision' button to disable collisions between bodies, linked between constraint. 2008-10-10 05:12:57 +00:00
de4ed8ed56 Stroke embedding. When doing continuous strokes, use the depth hit closests to last, so you can start on a limb and then continue drawing inside it even if things overlap. 2008-10-10 02:59:09 +00:00
41ad6f9d0a fix for [#12255] Rename the File at File Window,the file is deleted
renaming a file on win32 would delete it because it didnt test if the 2 filenames were the same (case insensitive), and remove the 'to' file to make way for the 'from' file.
2008-10-09 22:44:52 +00:00
e5d1c5a176 == Python ==
Bug: [#17734] Loading a python script's help dosn't work

reported by Rian Tut (thanks).

Actual problem: scripts with spaces in their filenames were not supported by the code that registers scripts in menus and runs them. Added support w/o breaking eventual, rare scripts that parse the Bpymenus file. They will still need an update to support filenames with spaces, like done here for these scripts: Scripts Help Browser and Scripts Config Editor.

PS: tested on Linux. Please test on other platforms: just make sure scripts still appear in menus (the File->Export, for example), even after re-registering them (Scripts window -> Scripts Menu -> Update Menus) and that the Scripts Help Browser still works.
2008-10-09 22:28:44 +00:00
915377060f - Filter continuous strokes as they are drawn instead of only when ending a line.
- Pair depth hits per object, to stay consistent if you have an object instead another one (say, if you're drawing on a coat and at one point the hand starts, you don't want to pair the first hit on the coat with the first hit on the hand).
2008-10-09 21:39:26 +00:00
bf3e539865 Sketching embedding.
Hold down Shift to embed points inside a mesh (or on a mesh, if there's no volume).

Done by gathering all the ray hits under mouse, sorting by depth and using the first two. Eventually could probably use hardware based depth peeling. Ray hit method could use bvh or some other accelerator too.

Eventually, will have a mechanism to keep consistent depth while painting continuous lines (painting over a partly obscured mesh shouldn't jump to the top one).
2008-10-09 20:45:33 +00:00
0d23e34362 Reverted bugfix #17709
I misread report, didn't know vertex bevel weights existed even!
2008-10-09 17:18:33 +00:00
c58e94daec bugfix #17709
SHIFT+CTRL+E 'bevel weight' didn't support vertex selection mode yet.
2008-10-09 17:00:53 +00:00
46ee3ee54c Bugfix #11712
Definitely one of the oldest bugs ever (1995 or so). 
Case is a path (child on path, or deformer, or motion modifier) where the
child is far away from path (300 units or so). In that case you can see
the path jumping to another position a bit after a few frames.

Reason:
For interpolating path positions, I was using bspline code still having a 
very ancient constant 0.1666f. 
Floats have higher precision, like 0.16666666. That solved it :)
2008-10-09 14:28:17 +00:00
44c01e2621 Bugfix for [#17333] Fluid bake memory issues provided by Andre Pinto 2008-10-09 12:19:16 +00:00
158d8022bc Bugfix #8911
Image counter can be set to zero when unlinking images, whilst they can
be in use for texture. This is a temporary solution to prevent errors!

(Now image unlinking doesn't set zero users anymore)
2008-10-09 10:59:48 +00:00
9ca5b78d1a BGE bug fix: fix several bugs and inconsistencies in sound actuator:
- support stopping of loop sound
- support stopping by python
- keep state of actuator in sync with audio device. 
  The lack of state sync was causing several other problems:
  - actuator stop playing the sound
  - sound chopped before the end
  - not possible to pause sound
2008-10-09 06:06:11 +00:00
4bd7fa9e2e This is patch [#17773] seq plugin crash -> use not converted to float with ibuf1 & ibuf2
Submitted by Rob Hausauer (paprmh) 

See the link for details:
https://projects.blender.org/tracker/index.php?func=detail&aid=17773&group_id=9&atid=127

Kent
2008-10-09 04:11:33 +00:00
837211077c * fix for silly bug in point density with no object in the object field 2008-10-09 01:15:54 +00:00
2e9d07b33b Grease Pencil:
Added comments a few + stroke simplification code (hidden behind rt and userpref, adapted from theeth's etch-a-ton code). This shouldn't have any other adverse effects.
2008-10-08 23:42:00 +00:00
b613eb2e21 Sketching snapping.
Hold Ctrl to snap to an exact point (black dots). Continuous strokes are extrapolated between the depth difference of both end points when snapping.
2008-10-08 20:54:19 +00:00
Chris Want
890b9f26f7 Patch #7065, from Stephane SOPPERA, part two: improvements when using
the commandline 'nmake' to build blender on windows -- please test!
2008-10-08 19:58:57 +00:00
Chris Want
495eab6709 Patch #7065, from Stephane SOPPERA, part one: define macro WITH_OPENEXR
when the sources are configured with OpenEXR support.
2008-10-08 19:56:41 +00:00
4a4f7c802a Bugfix #17784
Playanim now works for:

- tiff, cineon, dpx, hdr, exr

Only multilayer not, that's too much for a bugfix. Multilayer is a totally
different image format, handled separately.

ALso removed redundant printing for dpx/cineon.
And fixed crash in cineon when G.scene doesnt exist. Bad bad, should
not be there!
2008-10-08 18:35:41 +00:00
9cbb1745c2 Bugfix #17784
libtiff init was missing on "Play anim", causing it to not read tiffs.
2008-10-08 18:15:19 +00:00
d8facbd45e Bugfix #17785
Fixed tooltip for "double sided" so it clearly denotes it's about light. :)
2008-10-08 17:34:26 +00:00
56295f9688 own error, bvh import would always miss the last frame.
thanks ppClarity for picking up on this.
2008-10-08 17:07:32 +00:00
63fb586496 Bugfix #17778
COmpositor: Multilayer images in Image input node could crash on 
making icon previews for the browse menu.
2008-10-08 16:50:06 +00:00
Ken Hughes
5fd6e7e1b7 Python API
----------
Add optional string argument to Object.newParticleSystem() method, so that
objects can link to existing particle systems (if the name of the particle
system is known).  Also cleans up some code in Object.c which accesses the
particle sys listbase.
2008-10-08 16:37:33 +00:00
bfe2759ceb Bugfix #17767
NULL check missing in particle bvhtree testing.
2008-10-08 16:29:09 +00:00
9ebcaad82f Bugfix #17769
Someone managed to write over the protected part of ID name (python???).
This crashes blender in unexpted place, added error print for this.
2008-10-08 15:42:49 +00:00
75f458022e my changes broke the "level" option for joystick keys being held between states 2008-10-08 11:40:39 +00:00
53e046157d fix for a bug where getting ID props would rename the datablock (including its type), then crash.
http://blenderartists.org/forum/showthread.php?p=1228670#post1228670
2008-10-08 09:27:26 +00:00
a75dbcae8d Fixed a tooltip typo
Kent
2008-10-08 09:15:16 +00:00
30208e1790 Error about "max open floating panels" used wrong math. 2008-10-08 08:08:58 +00:00
ce4162c9a1 * Joystick sensor is now only triggered from events of the selected type.
* Keyboard sensor - added (back?) support for qualifiers (Hold buttons in the UI)
2008-10-08 03:16:19 +00:00
b8c294d323 bugfix: missing attributes from shrinkwrap copy function.
Reported by Bassam on IRC
2008-10-08 01:04:07 +00:00
33065932f9 First sketching draft code.
Left Click and drag for continuous strokes, left click for exact points, Right click to end strokes.

The view can be manipulated while drawing a stroke (between exact point).

Sketching is turned on all the time, this is mainly useful for testing, do not use seriously, nothing is saved, it gives memory errors on exit, yada yada
2008-10-07 22:04:00 +00:00
8b2f089c6e DXF-Exporter update
v1.27 - 2008.10.07 by migius
- exclude Stani's DXF-Library to extern module
- add "hidden mode" substitut: back-faces removal
- add support for mesh ->POLYFACE
- optimized code for "Flat" procedure
- modif FACE class for r12
- add mesh-polygon -> Bezier-curve converter (Yorik's code)
- add support for curves ->POLYLINEs
- add "3d-View to Flat" - geometry projection to XY-plane
2008-10-07 20:34:24 +00:00
d8758e32a0 WebPlugin
fix:
* web plugin works on opera too

sandboxing:
* added AppArmor configuration
* enabled privilege separation for the web plugin: the blender player can run as a lower privileged user, xauth token is generated on the fly .

testing:
* web plugin tested on ubuntu 32/64bit, fedora and FreeBSD

Changed only cmake build script: AppArmor is enabled by default, if you want to enable privilege separation instead, you have to change the cmake variable WEBPLUGIN_SANDBOX_MODE to privsep (or none to 
disable it).

Warning: source/gameengine/GamePlayer/xembed/blenderplayer-wrapper.c must be setuid root in order to change user successfully
2008-10-07 17:13:35 +00:00
94a9fa4711 Fix for bug #13363: ray (qmc) shadows had some light leaking issues,
due to jittering of the start position for antialiasing in a pixel.

Now it distributes the start position over the fixed osa sample
positions, instead of of random positions in space. The ugly bit is
that a custom ordering was defined for osa 8/11/16 to ensure that the
first 4 are distributed relatively fair for adaptive sampling to decide
if more samples need to be taken.
2008-10-07 15:01:44 +00:00
0d7d520ffa Bugreport in irc, alxarch report:
Fgon flushing for EM_selectmode_flush() should not happen in face select
mode. That prevents 'select swap' or deselecting fgons.
2008-10-07 14:24:08 +00:00
dc14259c83 own error moving macro to function, double checked and its correct now. 2008-10-07 08:19:48 +00:00
77484d28d5 joystick update
* use SDL events to trigger the sensor, trigger was being forced every tick. removed workaround for this problem.
* added "All Events" option, similar to all keys in the keyboard sensor.
  This means every event from the joystick will trigger the sensor, however only events from the selected type (axis/button/hat) is used to set the positive state of the sensor.
* Added python function sens_joy.GetButtonValues(), returns a list of pressed button indicies.
* Removed pressed/released option for joystick buttons, it was the same as the invert option.
2008-10-07 05:09:24 +00:00
8c3e960dd4 * Fix for silly crash in point density UI, showed up in files with an existing empty texture. 2008-10-06 22:39:06 +00:00
8d73ea72a7 Comments for text editor functions. More to come tomorrow. 2008-10-06 22:08:14 +00:00
160609bce8 Grease Pencil Bugfix
When converting to armature, don't flag the first bone of each stroke as connected.
2008-10-06 21:41:20 +00:00
64527fa81d patch [#17772] Fluid solver not built with OpenMP in Makefile build system
Submitted By: gsr

Kent
2008-10-06 19:57:42 +00:00
d16a8649ff merge runk 16887:16950 2008-10-06 17:37:03 +00:00
Chris Want
de6a9d0194 Use xrange() rather than range() for loop iterations. 2008-10-06 17:11:10 +00:00
Chris Want
d5f647a221 A fix for bug #8814:
http://projects.blender.org/tracker/?func=detail&atid=125&aid=8814&group_id=9

Smarter handling of faces that have a material index that points
to a null material.
2008-10-06 17:06:13 +00:00
25ece3ba2f * New point density update: Turbulence
This addition allows you to perturb the point density with noise, to give 
the impression of more resolution. It's a quick way to add detail, without 
having to use large, complex, and slower to render particle systems.

Rather than just overlaying noise, like you might do by adding a secondary 
clouds texture, it uses noise to perturb the actual coordinate looked up 
in the density evaluation. This gives a much better looking result, as it 
actually alters the original density.

Comparison of the particle cloud render without, and with added turbulence 
(the render with turbulence only renders slightly more slowly):
http://mke3.net/blender/devel/rendering/volumetrics/pd_turbulence.jpg

Using the same constant noise function/spatial coordinates will give a 
static appearance. This is fine (and quicker) if the particles aren't 
moving, but on animated particle systems, it looks bad, as if the 
particles are moving through a static noise field. To overcome this, there 
are additional options for particle systems, to influence the turbulence 
with the particles' average velocity, or average angular velocity. This 
information is only available for particle systems at the present.

Here you can see the (dramatic) difference between no turbulence, static 
turbulence, and turbulence influenced by particle velocity:
http://mke3.net/blender/devel/rendering/volumetrics/turbu_compare.mov
2008-10-06 12:25:22 +00:00
16f199bda3 one-liner fix for id property duplication bug 2008-10-06 10:24:32 +00:00
ba720030be * dont change handle types when adjusting the radius or tilt of a curve handel.
* dont take the handles into account for the manipulator center when they are not drawn.
2008-10-06 09:17:49 +00:00
bd81616ac6 Bugfix:
Grease Pencil sketches in OGL-render should only show up if they were enabled for the original 3d-view.
2008-10-06 08:29:15 +00:00
c9634ce5b4 fix for [#17560] Error in BPY_run_python_script
any path starting with a '.' on win32 would be replaced with C:\ (or the default root)
this was added rev 6568 so the file selector would replace "." with C:\. should be moved to fileselector but for now compare with "." rather then checking the first char.

header_view3d.c - prop edit and render were aligning in curve edit mode.
2008-10-06 08:02:35 +00:00
6c2738ef48 fix for own bugs in curves.
- the number of segments was always 1 too many on cyclic curves.
- [#17739] - normals were not being calculated when rendering curves.

Replaced macro DL_SURFINDEX with a function. it that assumes variable names and could break from the loop that called it.
2008-10-06 06:10:14 +00:00
002725d72a use uint8_t and uint32_t rather then Uint8 and Uint32, (mingw didnt know about Uint's) 2008-10-06 01:59:11 +00:00
Nathan Letwory
5d92376ef4 === SCons ===
* small doc update
2008-10-05 19:07:09 +00:00
34399546b7 == FFMPEG ==
Added optional OGG / theora / vorbis support.
(OGG-format encoding is currently disabled, since the bundled ffmpeg version
is broken here)

Fixed a bug with PTS-encoding, to make theora work.

You have to explicitly enable it and currently only scons is supported.

Otherwise: enjoy! :)
2008-10-05 17:31:33 +00:00
Ken Hughes
e99ff615d7 Python API
----------
Change documentation for Object.getSize(), Object.getEuler(), Object.getLocation() to clear up confusion about 'localspace' parameter.
2008-10-05 14:31:40 +00:00
333b7c3668 * Grease Pencil - changed defaulted for sensitivity userprefs. Will overwrite old settings too (to keep users less confused about this).
* Removed some unneeded funcs (compiler warnings)
2008-10-05 12:06:55 +00:00
86560d6b3f Bugfix #8908
Using shapekeys, you get corruptions in other shapes when you undo into
a previous editmode session. The "key index" values become invalid.
Now, if you have shape keys, entering editmode will clear the previously 
stored undos.
2008-10-05 12:02:36 +00:00
5c74db4e4e Grease Pencil:
* Separated duplicate methods out into several functions

* Added copy/paste for gp-frames in Action Editor. Only strokes that are appropriate for the spacetype that the destination layer belongs to will be added to avoid wasted memory usage. Otherwise, was impossible to move sketches between views/layers (which was intended for PyAPI access that didn't get done).

Note: there will currently still be an extra gp-frame created, even if the current no strokes got pasted. There's commented out code which would delete it, but somehow that causes errors, so better to be safe for now.
2008-10-05 11:49:09 +00:00
af7033bae4 Bugfix:
Reordering Grease-Pencil frames in the Action Editor after transforms was not working at all. Seems I forgot to fix this part after changing what the 'Grease Pencil' editing mode in Action Editor showed.
2008-10-05 10:48:07 +00:00
1695b07bac Fix for [#17758] Particle Caching Problem
-A line initializing particles from pre-cache days was still in place causing the wrong behavior.
2008-10-05 09:44:46 +00:00
c1223f2459 Bugfix #17750
Wrap text and moving cursor with a selection still crashed.
Thanks Zanqdo! :)

(Also cleaned code layout to use same convention as it was)
2008-10-05 09:27:14 +00:00
2ad7aa100d Fix for bug #17762: id property double type did not get copied correct. 2008-10-05 01:15:58 +00:00
6800c5725f Fix for bug #17761: small GLSL update tweak, switching ray and
buffer shadow didn't update the viewport correct.
2008-10-05 00:21:43 +00:00
1e0f02c2ef Fix for bug #17684: GLSL bug with shadows and material nodes,
missed unbinding a texture giving extremely slow frontbuffer
drawing.
2008-10-04 22:21:46 +00:00
639a4ff436 Fix for part of bug #17759: point cache clearing did too much, also
clearing other physics systems on the same object.
2008-10-04 21:26:48 +00:00
04226f6f3f Bugfix for [#17748] "Copy and paste under window since rev 16769"
Now actually copies to the clipboard on copy/cut when editing UI fields.
2008-10-04 21:04:16 +00:00
7d77b58900 Fix wrong result for GLSL material node with only diffuse output
and shadeless material.
2008-10-04 20:22:43 +00:00
7fae6345ab Fix for bug #17752: the particle modifier convert button didn't
do anything for dupli objects and groups, which could already
be converted with ctrl+shift+A, but convert can do it as well.
2008-10-04 19:58:08 +00:00
32d7a06131 Bugfix: modified game material settings in blender didn't get
taken into account when loading a new .blend.
2008-10-04 17:04:23 +00:00
d7589d8bc8 Game player: preserve material, debug settings, between .blend files. 2008-10-04 16:42:36 +00:00
a7a4c4113e Bugfix #17753
Fix for rev 16702 commit to better support per-vertex radius in curves.
It caused the directional lines for 3d curves to not draw correct.
2008-10-04 15:02:40 +00:00
324e1d57ac Bugfix #17750
Texteditor misses NULL checks in 'wrap text' code, moving cursur while
text is selected.
2008-10-04 13:42:45 +00:00
f8d7da21b1 Bugfix #17746
Curve deform did not work yet on Text and Curve objects, this because it
was not providing the entire array of vertices, for a proper detection of
min/max bounds of the full input.
2008-10-04 12:31:54 +00:00
67a9d4154d * New volumetrics feature: scattering types
Otherwise known as a phase function, this determines in which directions 
the light is scattered in the volume. Until now it's been isotropic 
scattering, meaning that the light gets scattered equally in all 
directions. This adds some new types for anisotropic scattering, to 
scatter light more forwards or backwards towards the viewing direction, 
which can be more similar to how light is scattered by particles in nature.

Here's a diagram of how light is scattered isotropically and anisotropically:
http://mke3.net/blender/devel/rendering/volumetrics/phase_diagram.png

The new additions are:
- Rayleigh
describes scattering by very small particles in the atmosphere.
- Mie Hazy / Mie Murky
more generalised, describes scattering from large particle sizes.
- Henyey-Greenstein
a very flexible formula, that can be used to simulate a wide range of 
scattering. It uses an additional 'Asymmetry' slider, ranging from -1.0 
(backward scattering) to 1.0 (forward scattering) to control the 
direction of scattering.
- Schlick
an approximation of Henyey-Greenstein, working similarly but faster.

And a description of how they look visually (just an omnidirectional lamp 
inside a volume box)
http://mke3.net/blender/devel/rendering/volumetrics/phasefunctions.jpg


* Sun/sky integration

Volumes now correctly render in front of the new physical sky. Atmosphere 
still doesn't work correctly with volumes, due to something that i hope 
can be fixed in the atmosphere rendering, but the sky looks quite good.

http://mke3.net/blender/devel/rendering/volumetrics/sky_clouds.png

This also works very nicely with the anisotropic scattering, giving 
clouds their signature bright halos when the sun is behind them:

http://mke3.net/blender/devel/rendering/volumetrics/phase_cloud.mov

in comparison here's a render with isotropic scattering:

http://mke3.net/blender/devel/rendering/volumetrics/phase_cloud_isotropic.png


* Added back the max volume depth tracing limit, as a hard coded value - 
fixes crashes with weird geometry, like the overlapping faces around 
suzanne's eyes. As a general note, it's always best to use volume 
materials on airtight geometry, without intersecting or overlapping faces.
2008-10-04 12:23:57 +00:00
046810929e Bugfix #17720
Retopo crashed on undo-redo, caused by bad copying of data for undo stack.
I solved crash or corruptions, but it still is pretty weak code here.
2008-10-04 11:04:09 +00:00
1513e96857 fix conflict in merged file. weird, it compiled ok wednesday. 2008-10-03 23:36:02 +00:00
5298e26b76 More cosmetic changes to the bullet buttons: move most common soft body buttons to main panel, only leave advanced settings in advanced panel. Reduce size of advance panel. 2008-10-03 21:50:42 +00:00
17c391b429 bugfix: add Ghost support for soft bodies, so that they don't collide with ghosts, and can be ghost themselves. 2008-10-03 21:42:19 +00:00
56b560bb6c Move the Solaris workaround in btScalar behind the sun define, to only make sun and apple ppc slower:
#if defined (__sun) || defined (__sun__) || defined (__sparc) || (defined (__APPLE__) && ! defined (__i386__))
Also includes a fix to uninitialized variable (can cause failing collisions).

If possible, report all changes to extern/bullet2 to http://code.google.com/p/bullet/issues/list
2008-10-03 20:51:56 +00:00
f80d6efb3b BGE patch: some cosmetic change in the bullet buttons:
- Bring Actor button back in main panel: makes the users
  life easier to identify which object is visible to 
  near and radar sensors.
- Give more space to the Advanced Settings panel.
- Display radius control button even for static objects
  if sphere bound shape is selected. Same for displaying
  the radius in the 3D view.
2008-10-03 20:17:05 +00:00
5574655dad Fix for part of bug #17464, though not the original issue yet. A GLSL
shadow drawing fix also affected 3d view opengl render, hiding armatures,
now there's separate flags for it.
2008-10-03 19:34:49 +00:00
128ee40d60 Small fix for (harmless) use of uninitialized memory. 2008-10-03 19:30:45 +00:00
0eaccf881b Solaris was having problems with sqrtf and friends again.
I changed sqrtf to sqrt in elbeem
in bullet2 I added defines found in floatpatch.h eventually
we should make a "floatpatch.h" that all of blender can use.

Kent
2008-10-03 13:16:10 +00:00
59dbf08253 Bugfix for fluidsim UI inconsistencies, please check your settings in old files 2008-10-03 13:02:34 +00:00
87b4037733 More Grease Pencil touchups:
* Eraser size is now UserPref. This way it is more easily tweaked than using layer stroke-thickness squared, but it is less accessible.
 
* Restored stroke 'smoothing' (post-conversion) option as UserPref option. Off by default.

* Fixed bug with convert tools. Was adding an extra datablock everytime, that wasn't being used (and was subsequently dicarded).

* Moved pressure vars from paint-loop to temp-struct (during painting). Also, moved the macro which tests for converting straight lines.
2008-10-03 11:56:11 +00:00
df00a4b878 interpreted request from Carsten - make message sensor work.
object message actuators needed the prefix OB when sending a message to a specific object.--This line, and those below, will be ignored--

M    source/gameengine/Converter/KX_ConvertActuators.cpp
M    source/blender/blenkernel/BKE_blender.h
M    source/blender/src/buttons_logic.c
M    source/blender/blenloader/intern/readfile.c
2008-10-03 09:51:43 +00:00
ae63fcc905 Grease Pencil bugfix:
Disabled fancy 'dot' drawing for Image Editor. This is still just a quick-fix (like for fancy strokes), and it would be nice to get the scaling right someday.
2008-10-03 09:40:48 +00:00
a618708f48 Blender works with python 2.6, our own import functions that replace pythons internal function needed updating for an extra in argument in 2.6.
if importing is not working blender should not crash (was crashing on exit)
2008-10-03 06:27:41 +00:00
365282e5c8 error with GameLogic.globalDict loading. It would replace the dictionary rather then updating it.
This meant the BGE would load in an old dictonary replacing the loaded dict, loosing settings.

was also missing a decref for marshal data
2008-10-03 04:41:02 +00:00
5f7bd14073 Added back a few lines that were accidentally chopped out when fixing pad0 view feature. This means that the grid is drawn correctly (i.e. not shown) when the view is rotated using the numpad up/down/left/right keys. 2008-10-03 03:29:34 +00:00
1ce81854f7 Fix for bug #17722: sun light in the texture viewmode was broken. 2008-10-02 23:04:28 +00:00
60e32f69b9 Fix for bug #17735: vertex color render layer got invalid value
when switching to weight paint mode.
2008-10-02 22:55:25 +00:00
c35a2d6ea9 merge trunk 16118 -> 116886 2008-10-02 20:39:57 +00:00
06c43148a1 transform snap bugfix: correctly ignore hidden elements when snapping to edit mode mesh 2008-10-02 17:20:58 +00:00
0fcd017031 missing ; in last commit
radius was not being calculated on curves that had a bevel object
2008-10-02 17:11:49 +00:00
1b3e2d7c02 blender would crash if the "sys" module didnt import, now just give a warning and continue. 2008-10-02 16:59:08 +00:00
0110133cf7 Maybe not needed, I was running into some problems though
and noticed dos line endings in a bunch of files so ran
dos2unix on everything in bullet2.

Erwin,  I noticed there are a few files that do not have
license info in them, couple of quick examples are: btDefaultMotionState.h
btHashMap.h btQuickprof.cpp
could you take a look at add where needed?   If you want I can give a list
of files I think should get it added  and or just add the standard one
say the one in src/btBulletCollisionCommon.h 

Kent
2008-10-02 16:52:39 +00:00
575b4743ed Bugfix #17723
Clipboard copy/paste error, missing NULL check caused crashes.
2008-10-02 12:29:45 +00:00
Nathan Letwory
7ba46c70ad * return the right error code
* print error message when something goes wrong with nsis installer creation
2008-10-02 08:46:04 +00:00
f66ae0daca Keyframe Checking (i.e. does given frame have a keyframe) is now implemented in the keyframing api.
Replaced the method used in to check if there's a keyframe on the current frame, when drawing the active object name / frame number info with this new code. 
- It should in theory be faster than the previous code, as it doesn't have to build an entire list everytime of all keyframes, and also uses more efficient search method.
- Added some settings to control what sources of animation data are used (per 3d-view). Can be found in the View Properties panel.

This should be stable... release builders should ignore this commit for now (to avoid having differences between release candidates).
2008-10-02 08:39:30 +00:00
Nathan Letwory
7e704c8c03 * use release flags as default, except for openmp support 2008-10-02 06:22:36 +00:00
Nathan Letwory
59eaf36f97 * make sure we link against proper openmp library when using msvc
* return error code from makensis process instead of 0
2008-10-02 06:11:47 +00:00
e114d194ae * Re-coded the point density range checking to be a bit cleaner, and
not necessary to modify the BVH functions.
2008-10-02 01:38:12 +00:00
3659b390bf only paint onto selected faces when painting mask is enabled. (request from Carsten) 2008-10-02 01:12:37 +00:00
3ec4f674d0 Python 2.4 should build with the game engine now, no thanks to python for switching from char to const char 2008-10-02 00:22:28 +00:00
c2b8702a83 BGE patch: add frameProp to Ipo actuator (Carsten's request). 2008-10-01 21:17:00 +00:00
8550c2b594 BGE patch: new force field constraint actuator
A new type of constraint actuator is available: Force field.
It provides a very similar service to the Fh material feature
but with some specificities:
- It is defined at the object level: each object can have 
  different settings and you don't need to use material.
- It can be applied in all 6 directions and not just -Z.
- It can be enabled/disabled easily (it's an actuator).
- You can have multiple force fields active at the same time
  on the same object in different direction (think of a 
  space ship in a tunnel with a repulsive force field
  on each wall).
- You can have a different damping for the rotation.

Besides that it provides the same dynamic behavior and the 
parameters are self explanatory.
It works by adapting the linear and angular velocity: the
dynamic is independent of the mass. It is compatible with
all other motion actuators.

Note: linear and anysotropic friction is not yet implemented,
the only friction will come from the object damping parameters. 
Support for friction will be added in a future revision.
2008-10-01 19:16:13 +00:00
39e66e4d6f Bug fixing
It helps if the fonction to wait on all threads actual does that.

Use user parameter for number of threads (this is really looking like it should be in the userprefs and not render params).
2008-10-01 18:00:13 +00:00
611b4b383a Disable building of fftw 2008-10-01 17:02:38 +00:00
76658ef1a8 svn merge -r 16741:16866 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-10-01 16:22:28 +00:00
0caa92a49c General tidying of Grease Pencil code... 2008-10-01 08:23:08 +00:00
949b6ca80f BGE bug #17688 fixed: Near Sensor Reset not working (for Gamekit)
Implementation of the PHY_IPhysicsController::SetMargin(),
GetMargin(), SetRadius() and GetRadius() for Bullet and Sumo
to allow resetting the Near sensor radius. For bullet use 
the new setUnscaledRadius() function to change sphere radius.

In pPreparation of a Fh constraint actuator:
- Add KX_IPhysicsController::GetRadius()
- Fix implementation of KX_BulletPhysicsController::GetVelocity()
  (velocity at a point in geometric coordinate)
- Don't try to set velocity on static object (Bullet will assert)
- Add KX_GameObject::GetVelocity() for C access to local velocity
2008-10-01 07:55:02 +00:00
2745517ecd Added 'Object Location' option to 'object vertices' mode in Point
Density. This brings it consistent with the 'particle system' 
mode, and allows silly things like this a bit easier (especially 
after the last fix and BVH improvements!):

http://mke3.net/blender/devel/rendering/volumetrics/pd_objectloc.mov
2008-10-01 07:30:56 +00:00
25236b56a6 * Fix for volumetric rendering. It previously wasn't multiplying
the emission component by the density at the current point, which 
made the volume too bright in less dense areas. This made it look 
too rough, as opposed to smooth as it should be. This makes the 
particle rendering look *much* better, thanks a bunch to ZanQdo for 
complaining and kicking my butt to make me realise the error.

Here's an example of how smooth it looks now:
http://mke3.net/blender/devel/rendering/volumetrics/smoke_test03.mov
http://mke3.net/blender/devel/rendering/volumetrics/smoke_test03.blend

Settings in existing files will have to be tweaked a bit, since 
what they were set up for before, was incorrect.

* Added two new interpolation types to Point Density: Constant and 
Root. These work similarly to in proportional edit for example, 
just gives a bit more choice over how hard-edged the particles 
should look.
2008-10-01 07:13:28 +00:00
f4c1fcefe8 Update MSVC project file for Bullet soft body. Strange, I though I already fixed them. 2008-10-01 07:04:10 +00:00
aa5c4f8801 + hook up a few more parameters, that can be useful for Bullet soft bodies
+ work-in-progress to hook up cluster constraints (they are better than node/vertex pinning, because they maintain a proper world coordinate system)
2008-10-01 06:36:17 +00:00
8622cbca35 * Point Density texture
Replaced the previous KD-tree (for caching points) with a 
BVH-tree (thanks to Andre 'jaguarandi' Pinto for help here!).

The bvh is quite a bit faster and doesn't suffer some of the
artifacts that were apparent with the kd-tree.

I've also added a choice of falloff types: Standard, Smooth, and 
Sharp. Standard gives a harder edge, easier to see individual 
particles, and when used with a larger radius, Smooth and Sharp 
falloffs make a much cloudier appearance possible. See the image 
below (note the settings and render times too)

http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_bvh.jpg
2008-10-01 03:35:53 +00:00
e427b82962 Bugfix #17721: Action Strips added from scripts don't work properly unless at least one strip has already been added by hand.
Synced the behaviour of the PyAPI when adding strips with the behaviour of UI.
2008-10-01 00:14:28 +00:00
c3602099c8 Bugfix #17717: IPOs / Sequencer / Markers: deleting an IPO delete also selected markers
Final attempt at solving this problem. This time I've decided to separate the 'delete markers' from the 'delete keys' hotkeys, as it proved to be too problematic for users. 

The new hotkey for deleting markers is "Shift-XKEY". (or Shift-Delkey) 
P.S. I know that 'Shift' is usually used for 'add' operations, but this will have to do for now...

----

Also, rearranged button order in Timeline header a bit to group keyframing buttons together more.
2008-10-01 00:02:06 +00:00
3c99a0f735 Fix for build error, mustn't have committed this properly last night 2008-09-30 23:58:48 +00:00
808d6197cf add support for Bullet soft body constraints against a Bullet rigid body, as well as 'fixing' it. Just use the existing rigid body joint to use it. For now, it searches the closest node/vertex to the pivot. So you can use multiple constraints/joint to attach a cloth, soft body etc. 2008-09-30 23:34:25 +00:00
09f79a8e9f add setUnscaledRadius for btSphereShape 2008-09-30 22:05:12 +00:00
66d51d461e Fix for bug #17691: edgesplit was crashing on windows on large meshes
due to stack overflow.
2008-09-30 17:06:41 +00:00
da62240ab2 Keyframing:
- More cleanups, to move the return of success from insertkey to take into account results of 'only needed' keying option
- Added a 'better' test for size of area than the previous one (for use with the keyframing buttons in the TimeLine)
- Moved the checks for Action/IPO editors to commonkey_context_get() so that the keyframing buttons in TimeLine could also consider using these editor's keyframing methods too
2008-09-30 12:30:56 +00:00
0f5dc86049 A few cleanups in keyframing.c
- Added missing update calls for buttons window keyframing. This should get rid of all those sporadic update problems (using a different keyingset would result in no curve being added)
2008-09-30 12:03:31 +00:00
80a4bbf473 Bugfix:
Keyframing from Buttons Window was broken for Materials/Lamps/Worlds due to a mixup regarding the correct adrcodes for texture-slots.
2008-09-30 11:52:59 +00:00
1eb06b9370 Action Editor:
* Grease Pencil Mode - now includes the area-ID into the name string. While the numbers currently don't mean much (though they do make it easier to distinguish between views to more than before), they could become handy if/when PyAPI access to Grease Pencil data comes into handy

* Copy + Paste bugfixes
- When there was a collapsed group, it was impossible to get the keyframes in the keyframe summary to be copied too. This fix shouldn't cause any problems with other things...
- Feature to allow pasting to any channel without doing name matching was not working
2008-09-30 10:54:12 +00:00
a667fc61d4 * Removed the volume 'layer depth' control' (was used to
limit ray intersections like as for ray transparency). It 
remains to be seen if it's even that useful, and was 
preventing refracting materials behind volumes from 
working easily.
2008-09-30 10:41:47 +00:00
361ff9e525 Fix for bug #13624: knife cut with vertex snapping was broken. 2008-09-30 07:01:37 +00:00
8c4744c4d6 Fix for bug #17302: subsurf + particle size vertex groups did not
work correct, also refactored some code here to make it more clear.
2008-09-30 06:12:47 +00:00
13c8e189f6 WITH_ELBEEM diabled wasnt working with cmake 2008-09-30 05:05:50 +00:00
5871b289cc modify BLI_convertstringcode so windows paths are converted from C:\foo.jpg to /c/foo.jpg
since there is C:\ prefix cant exist on a unix system this wont break any files.
2008-09-30 04:08:00 +00:00
16b425b9c0 * free bullet-softbody was using free softbody function.
* mistake from own changes to curves, new curves were being added with too low resolution.
* removed warnings I added recently
2008-09-29 23:46:01 +00:00
a32d4280c9 Fix for part of bug #17521: incorrect uv coordinates for particle
density controlled by a texture.
2008-09-29 23:33:27 +00:00
31acc8ba9c Fix for bug #17713: touch/no override for rendering was broken. 2008-09-29 22:31:47 +00:00
fed535f1fb Fix for bug #17712: fluid button activation crash. 2008-09-29 22:07:13 +00:00
ff096645ad fix bug with adjust retarget and control bones 2008-09-29 20:21:46 +00:00
4aff02006b Add 2 items to CTL-A menu: Scale to ObData and Rotation to ObData. These options allows to apply separately the scale and the rotation to the object data. Usefull to physics compound objects that do not support scaling. 2008-09-29 20:13:40 +00:00
70e6241c9b Do not include manifest file for x64 + Windows, was creating errors on other system 2008-09-29 18:10:42 +00:00
6deea1a5d7 Bugfix #17711
SunSky didn't include skycolor in raytrace.
Note: there seems to be  an error in sunsky when looking straight down, 
so this option requires raytracing stuff not in outer space. :)
2008-09-29 17:55:11 +00:00
a1513a8c0f BGE patch: fix force application on soft body. Force is applied on each node, it must be reduced by the same extend. 2008-09-29 17:46:25 +00:00
2a331067cc resolve some compiler warnings with intel c/c++ compiler
* subsurf code had a lot of unused variables, removed these where they are obviously not needed. commented if they could be useful later.
* some variables declorations hide existing variables (many of these left), but fixed some that could cause confusion.
* removed unused vars
* obscure python memory leak with colorband.
* make_sample_tables had a loop running wasnt used.
* if 0'd functions in arithb.c that are not used yet.
* made many functions static
2008-09-29 17:08:11 +00:00
7ebeceb399 Updated color calculus for sunsky
- removed ugly clamping function (it was dividing XYZ based on max of
  one of the values)
- added option to use Exposure, this only works for brightness (Y).
  results look very pleasant, foggy and hazy results are possible.
  with exposre==0, no exposure happens for HDR extreme range skies,
  this is how yafray rendered it.
- added menu for choosing color spaces (CIE = modern lcds)

Please review! (and yes i know it's still not in World :)
2008-09-29 17:03:24 +00:00
4fbacd6717 Move Korean file from kr to ko also updated it to newer file.
Kent
2008-09-29 15:02:20 +00:00
45035f10ec [#17703] Segfault on fluid activation. 2008-09-29 14:44:12 +00:00
3996b82b50 [#17707] Slow Cloth Baking 2008-09-29 14:20:27 +00:00
d0a8a767a7 DXF-Exporter script - initial commit
Built on "Stanis Python Library for generating dxf drawing":
History:
v1.25 - 2008.09.28 by migius
 - modif FACE class for r12
 - add mesh-polygon -> Bezier-curve converter (Yorik's code)
 - add support for curves ->POLYLINEs
 - add "3d-View to Flat" - geometry projection to XY-plane
v1.24 - 2008.09.27 by migius
 - add start UI with preferences
 - modif POLYLINE class for r12
 - changing output format from r9 to r12(AC1009)
v1.23 - 2008.09.26 by migius
 - add finish message-box
v1.22 - 2008.09.26 by migius
 - add support for curves ->LINEs
 - add support for mesh-edges ->LINEs
v1.21 - 2008.06.04 by migius
 - initial adaptation for Blender
v1.1 (20/6/2005) by www.stani.be/python/sdxf
 - Python library to generate dxf drawings
2008-09-29 14:03:15 +00:00
a8e97fe1ed Bugfix #17708: layer IPOs doesn't return the correct layer anymore
When doing IPO-cleanup, added two break statements to hopefully optimise the evaluation process a teeny-weeny bit. However, that caused more problems than it was worth!
2008-09-29 11:39:58 +00:00
2bee679a2d Bugfix #17696
- Area lamp with 1 sample still used an offset for the first sample
- Sample buttons were not visible for area without shadow.
2008-09-29 10:26:20 +00:00
404dad0e7f rewiten a if statment 2008-09-29 09:54:26 +00:00
445b83e3ce Bugfix #17687
Scaled cameras get orthogonalized on render, and did not get a signal
to refresh the matrix, resulting in wrong display of camera in 3d win.
2008-09-29 09:50:16 +00:00
e17c2c51bf Bugfix:
Recoded pidhash's recent Pad0 (Lastview) commits (r.16802 and r.16810). It was causing major issues with Ortho perspective + rotating the view with the MMB. Setting G.vd->view to -1 was not such a valid way to do so (and also, this didn't play nicely with smoothview).

This feature should now work correctly, though there are still one or two places where it doesn't always seem totally correct yet. 
The basic idea of this feature, is that after going into camera mode (Pad0), pressing Pad0 again lets you go back to the view as you had it before entering camera mode.
2008-09-29 08:11:26 +00:00
638c51ba7d don't crash when trying to make a soft body 'fh' object 2008-09-29 08:00:38 +00:00
31d6a6be68 * New Point Density texture option: 'Object Vertices'
This works very similarly to particles, it just uses the object's renderable vertices as the points instead.

http://mke3.net/blender/devel/rendering/volumetrics/pd_objectvertices.png
2008-09-29 07:56:41 +00:00
2c289a02b6 Clarify that in Bullet, the 'radius' is used for both sphere bounds, but also for Fh/Rot Fh.
So even if other bound types are used (such as box etc), the radius will be used for Fh/Rot Fh.
2008-09-29 07:17:12 +00:00
cef5c4b765 Add Fh/Rot Fh to Bullet. 2008-09-29 06:58:49 +00:00
cddd38f539 fixing a little problem with grid after last view commit 2008-09-29 04:36:18 +00:00
bab94c46e0 Point Density texture
The Point Density texture now has some additional options for how 
the point locations are cached. Previously it was all relative to 
worldspace, but there are now some other options that make things 
a lot more convenient for mapping the texture to Local (or Orco). 
Thanks to theeth for helping with the space conversions!

The new Object space options allow this sort of thing to be possible
 - a particle system, instanced on a transformed renderable object:
http://mke3.net/blender/devel/rendering/volumetrics/pd_objectspace.mov

It's also a lot easier to use multiple instances, just duplicate
the renderable objects and move them around.


The new particle cache options are:

* Emit Object space
This caches the particles relative to the emitter object's 
coordinate space (i.e. relative to the emitter's object center). 
This makes it possible to map the Texture to Local or Orco 
easily, so you can easily move, rotate or scale the rendering 
object that has the Point Density texture. It's relative to the 
emitter's location, rotation and scale, so if the object you're 
rendering the texture on is aligned differently to the emitter, 
the results will be rotated etc.

* Emit Object Location
This offsets the particles to the emitter object's location in 3D 
space. It's similar to Emit Object Space, however the emitter 
object's rotation and scale are ignored. This is probably the 
easiest to use, since you don't need to worry about the rotation 
and scale of the emitter object (just the rendered object), so 
it's the default.

* Global Space
This is the same as previously, the particles are cached in global space, so to use this effectively you'll need to map the texture to Global, and have the rendered object in the right global location.
2008-09-29 04:19:24 +00:00
425264d7cc Update the Bullet/game buttons_bullet, to better reflect usage.
1) Anisotropic friction works for static and dynamic objects
2) For soft bodies, assume triangle mesh if no bounds a chosen
3) Form factor == inertia scaling factor, it was actually hooked up in Bullet
4) Only show 'radius' if sphere is chosen, or no bounds+dynamics (== sphere bounds)
2008-09-29 04:14:47 +00:00
32b733dafb Patch #17500: fixes: multiple IK's on bone + targetless IK
Submitted by: Teppo Kansala (teppoka)

See patch report for details of fixes.
https://projects.blender.org/tracker/index.php?func=detail&aid=17500&group_id=9&atid=127

Note: the patch submitter's test files were quite nice, and would be good to have in our regression suite.
2008-09-29 04:00:42 +00:00
0b622fc07f added anisotropic friction support for Bullet. Both for static and dynamic objects 2008-09-29 03:09:03 +00:00
25fc47aaf2 tests for 2d triangle and quad intersection would only work if the points were ordered clockwise.
now return 1 for clockwise, -1 for counter-clockwise and 0 for no intersection.
2008-09-29 02:16:18 +00:00
f001e58768 Updates to hotkeys.py with some hotkeys I've added/changed over past few releases (note, this doesn't cover all of them yet) 2008-09-29 00:47:21 +00:00
12c688fd7e Adding last view feature for PAD0 2008-09-29 00:44:33 +00:00
345dc8eb94 Fix: point density texture now works with the 'auto name' button 2008-09-28 23:40:36 +00:00
cf683729f6 Second try at committing IPO code cleanups... 2008-09-28 23:17:44 +00:00
d1ce4fbaff A previous commit by me (16701) broke keyed- and none-physics particles or at least made them do funny things. 2008-09-28 19:53:37 +00:00
c3794cb983 Bugfix, irc report from slw_sl:
Instert "avail" on object without ipo crashed. Null check missing.
2008-09-28 17:05:58 +00:00
1e62b58bcc reverting revision 16784 that broke compilation. Aligorith, please fix and recommit 2008-09-28 15:37:37 +00:00
49f9049eb5 fix header text 2008-09-28 13:51:30 +00:00
21640badf7 IPO System - Code Cleanup and Commenting:
Went through and commented all the code in ipo.c, tidying up formating and coding style in places, and also rearranging to have a more logical order in some places. There shouldn't be any major issues arising from this commit.
2008-09-28 12:01:41 +00:00
8056705ae9 * Volumetrics
Removed all the old particle rendering code and options I had in there 
before, in order to make way for...

A new procedural texture: 'Point Density'

Point Density is a 3d texture that find the density of a group of 'points' 
in space and returns that in the texture as an intensity value. Right now, 
its at an early stage and it's only enabled for particles, but it would be 
cool to extend it later for things like object vertices, or point cache 
files from disk - i.e. to import point cloud data into Blender for 
rendering volumetrically.

Currently there are just options for an Object and its particle system 
number, this is the particle system that will get cached before rendering, 
and then used for the texture's density estimation.

It works totally consistent with as any other procedural texture, so 
previously where I've mapped a clouds texture to volume density to make 
some of those test renders, now I just map a point density texture to 
volume density.

Here's a version of the same particle smoke test file from before, updated 
to use the point density texture instead:
http://mke3.net/blender/devel/rendering/volumetrics/smoke_test02.blend

There are a few cool things about implementing this as a texture:

- The one texture (and cache) can be instanced across many different 
materials:
http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_instanced.png

This means you can calculate and bake one particle system, but render it 
multiple times across the scene, with different material settings, at no 
extra memory cost.

Right now, the particles are cached in world space, so you have to map it 
globally, and if you want it offset, you have to do it in the material (as 
in the file above). I plan to add an option to bake in local space, so you 
can just map the texture to local and it just works.

- It also works for solid surfaces too, it just gets the density at that 
particular point on the surface, eg:
http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_solid.mov

- You can map it to whatever you want, not only density but the various 
emissions and colours as well. I'd like to investigate using the other 
outputs in the texture too (like the RGB or normal outputs), perhaps with 
options to colour by particle age, generating normals for making particle 
'dents' in a surface, whatever!
2008-09-28 08:00:22 +00:00
28684b1c09 make gui backwards compatible with this weeks softbody blend files 2008-09-28 03:17:45 +00:00
f8fb61f9fa enable -noaudio option, so it actually works (and doesn't get overwritten by a game flag). audio initialization delays startup of game engine 2 seconds
add -nojoystick commandline option: it takes 5 seconds everytime to start the game engine, while there IS no joystick.

In other words: blender -noaudio -nojoystick improves workflow turnaround times for P - ESC from 7 seconds to 1 second!

Improved Bullet soft body advanced options, still work-in-progress. Make sure to create game Bullet soft bodies from scratch, it is not compatible with last weeks builds.
2008-09-28 03:07:13 +00:00
a765f54b1a Commiting fftw lib into extern for ocean patch 2008-09-28 02:17:05 +00:00
c723b91446 BGE patch: create new BulletSoftBody data block to store bullet soft body specific parameters.
Previously we tried to share the parameters with the
blender render soft body but there were too many differences.

MSVC project files updated.
2008-09-27 21:52:20 +00:00
5f7359a4ad Cleaned up unused variables and functions. 2008-09-27 19:57:32 +00:00
d988ff33db Global Clipboard Patch (17370)
Text, ID names and RGB colours in the interface are now copied to and pasted from the system clipboard allowing them to be copied from and pasted into the text editor. Colours are encoded as floats in the form [r.rrrrrr, g.gggggg, b.bbbbbb] making them easy to use in Python scripts.
2008-09-27 19:47:38 +00:00
d7d15c2c66 Fixed recent changes to text editor which broke building with MSVC and also cleaned up some compiler warnings. (Actually, Benoit seems to have beaten me to it, but I found moving the #includes worked without undefining INT)
The header button is great but it didn't function for 2 seconds between clicks due to the old code waiting between modification checks. Fixed that now too :)
2008-09-27 19:20:32 +00:00
8253b3e2e6 Fix compilation problem in Windows and update MSVC project files 2008-09-27 19:05:00 +00:00
ff6d4e84cb text editor changes
* out of sync text dosnt automatically popup a menu anymore since it was too easy to click on it without intending to, moved this to an alert button on the header.
* "_" character was acting as a delimiter, but in python its not.
* renamed "File" to "Text" (so as not to confuse with blenders file menu)
* added redraw_alltext function to remove many duplicate loops where every text display is redrawn.
2008-09-27 15:32:28 +00:00
fe5dd01595 linear ipo curves were still using their handles to calculate an extrapolated value.
It would only work when the bezier point had its handles set to auto before changing to a linear IpoCurve since the handles were being recalculated during transform.
2008-09-27 10:08:19 +00:00
061c5c7633 Bugfix #17693: Visual Rot Keying Broken
The problem was due to a wrong number of IPO-channels getting keyed for the quaternion channels (3 instead of 4). Was a simple copy+paste error.

Also added in check for using "Limit Distance" constraint when using VisualKeying.
2008-09-27 09:11:44 +00:00
99d56a7764 [#17692] Text Editor Line Number Background theme option
from Dalai Felinto (dfelinto)
2008-09-27 08:15:10 +00:00
98b2c0626a Lots of mingw/gcc compiler warning fixes 2008-09-27 06:49:10 +00:00
50faaccf2e Auto-Keyframing (per scene):
Now auto-keyframing can be enabled/disabled per scene (with the insertion mode also stored per scene). The flags used when insertng keyframes are still stored in the user-prefs. 

New scenes have their auto-keyframing settings initialised from the user-preferences.
2008-09-27 06:29:52 +00:00
049b88f0d2 Keyframing:
* Tidied up code a bit to remove an extra var declaration that may have been causing problems with Visual Keying

* Added buttons to Insert/Delete keyframes from current frame into Timeline header. Note that it preferentially works will insert keyframes for a 3d-view (if it exists), otherwise it "should" take the largest area available.
2008-09-27 04:51:42 +00:00
b6405b970c force collision bound type to be convex hull or concave triangle mesh for soft bodies
set collision margin between soft and mesh back to .3, smaller is not useable (yet)
2008-09-27 00:36:18 +00:00
1e0cfcfd3a fixed some outstanding issues with Bullet soft bodies:
1) re-allocate a pool allocator, if one of the soft body collision algorithms is larger than max pool element size
2) manage child shapes properly, and call RemoveReferences on the m_sparsesdf
2008-09-26 23:20:31 +00:00
17d9f2eda9 fixed soft body collision against concave triangle meshes. 2008-09-26 21:49:26 +00:00
73119b840a avoid adding degenerate faces to a Bullet soft body 2008-09-26 21:27:33 +00:00
6cc87a1047 Merge of SimpleDeform modifier from soc-2008-jaguarandi branch
http://wiki.blender.org/index.php/User:Jaguarandi/SummerOfCode2008/SimpleDeform
2008-09-26 21:21:20 +00:00
eed854b296 Update MSVC project files 2008-09-26 19:38:07 +00:00
3ad55e1541 nurbs surface resolution is now per segment rather then being distributed over the whole surface.
This is what 2D do alredy and makes resolution settings more like subsurf level.

- This makes it impossible to have a lower resolution output then the nurbs cage, however this dosnt seem a very useful feature.
- Using the do-versions from recent curve interpolation fix.

Tested with these files.

http://digilander.libero.it/pafurijaz/Files/Blender/Libellula.zip
http://digilander.libero.it/pafurijaz/Files/Blender/Martello.zip
http://digilander.libero.it/pafurijaz/Files/Blender/Punta.zip
http://digilander.libero.it/pafurijaz/Files/Blender/Phones.zip
http://digilander.libero.it/pafurijaz/Files/Blender/Tubo.zip
http://digilander.libero.it/pafurijaz/Files/Blender/Pipe.zip
http://digilander.libero.it/pafurijaz/Files/Blender/Tire.zip
http://digilander.libero.it/pafurijaz/Files/Blender/Cotton.zip
2008-09-26 19:00:49 +00:00
8e1cf42dbd BGE patch: local/global flag to distance contraint actuator.
Previously the distance constraint actuator was always working
in local axis. The local flag allows to cast the ray along a
world axis (when the flag is not selected). 
The N flag works differently in this case: only the object 
orientation is changed to be parallel to the normal at the hit
point. 

The linear velocity is now changed so that the speed along the 
ray axis is null. This eliminates the need to compensate the 
gravity when casting along the Z axis.
2008-09-26 18:03:14 +00:00
8b46e655fa Update MSVC project files 2008-09-26 17:46:55 +00:00
dff3d418d4 Bullet build system fixes: add gimpact to the makefiles, and fix
blenderplayer linking for scons.
2008-09-26 16:43:50 +00:00
b542721f32 Made simple deform limits be relative to BV of object 2008-09-26 16:14:35 +00:00
f13bd6ef3c Bugfix: the game player did not initialize tiff and quicktime, so loading
those file formats did not work. Also made sure G.order is initialized as
otherwise some reading tiff goes wrong.
2008-09-26 14:54:21 +00:00
03f26fa6e4 Fixed a UI bug on shrinkwrap constraint
Fixed vertexs weights on simpledeform modifier (they weren't working if the modifier was the first on stack, since it wasnt receiving a DerivedMesh with vertex weights)
2008-09-26 13:47:41 +00:00
c301a059bd svn merge -r 16667:16741 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-26 08:58:15 +00:00
1206061ed4 Patch #17346: Align bones in edit mode
Submitted by: Lorenzo Pierfederici (lento) 

This patch adds the CTRL-ALT-A hotkey to align bones in armature edit mode.

It works the same way as parenting: selected bones will be aligned with active bone, if only one bone is selected it
will be aligned with its parent (if any)

Thanks!
2008-09-26 08:51:05 +00:00
06a5e9b58a scons/mingw linking fixes with bullet - adjusting priorities to find libs 2008-09-26 08:40:35 +00:00
Nathan Letwory
a349a3201e * split collision lib into its subparts
-This is to remedy long command-line troubles for scons/mingw users. Hopefully this goes ok on other platforms too :)
2008-09-26 08:05:18 +00:00
5adff90b08 * Some more tweaks to particle density rendering. I'm not 100%
sure if this is 'correct' but so far in testing it's been working 
pretty well.

This also exposes a new 'Nearest' value, to determine how many
nearby particles are taken into account when determining density. 
A greater number is more accurate, but slower.
2008-09-26 07:12:36 +00:00
9d3c77ec62 support concave soft bodies, preliminary. could be used for cloth too. need vertex pinning/constraint attach to other objects. 2008-09-26 06:25:35 +00:00
a1bef84ea8 Allow Bullet soft bodies to be created using a AddObject actuator. Added a fake world coordinate system to game soft bodies, although the vertices are already in world space.
Added Bullet/Gimpact concave collision detection to Blender. If your build system isn't updated yet, please add extern/bullet2/src/BulletCollision/Gimpact/*
This allows moving/dynamic concave triangle meshes (decomposing meshes into compound convex shapes, and using 'compound' shapes is still preferred)
2008-09-26 02:27:59 +00:00
09e17ac876 SimpleDeform now initializes limit values to the BB when its added to an object 2008-09-26 02:02:02 +00:00
78c50f7af1 Wheee!
Initial commit for supporting rendering particles directly as 
volume density. It works by looking up how many particles are 
within a specified radius of the currently shaded point and using 
that to calculate density (which is used just as any other 
measure of density would be).

http://mke3.net/blender/devel/rendering/volumetrics/smoke_test01.mov
http://mke3.net/blender/devel/rendering/volumetrics/smoke_test01.blend

Right now it's an early implementation, just to see that it can 
work - it may end up changing quite a bit. Currently, it's just a 
single switch on the volume material - it looks up all particles 
in the scene for density at the current shaded point in world 
space (so the volume region must enclose the particles in order 
to render them.

This will probably change - one idea I have is to make the 
particle density estimation a procedural texture with options for:
* the object and particle system to use
* the origin of the co-ordinate system, i.e. object center, world 
space, etc.

This would allow you in a sense, to instance particle systems for 
render - you only need to bake one particle system, but you can 
render it anywhere.

Anyway, plenty of work to do here, firstly on getting a nice
density evaluation with falloff etc...
2008-09-26 01:54:31 +00:00
6732718ef1 don't apply vertex transformation for deformable game soft bodies.
set a fake world transform for game soft bodies, based on center of the AABB, so visiblity and some game logic works. note: this world transform is not smooth.
2008-09-25 21:04:41 +00:00
ec9295db3a Keep persistent results for retargeting. Easier weight adjustement.
Will have to do a second pass tomorrow to fix some leftovers.
2008-09-25 20:29:15 +00:00
9a7c53782b Fix for [#17677] Blender Crash when Baking Boids
- A check for getting the "better" dm was missing from the boids code. I plan on converting the boids code into using the collision modifier one of these days but hopefully this quick fix will do for now.
2008-09-25 18:31:01 +00:00
9c08e86b06 avoid crash and apply force for soft bodies.
copy normals for soft body vertices, to get proper lighting
2008-09-25 17:53:15 +00:00
27098d3aa0 [#17679] BGE print statement when start and when finish
from Dalai Felinto (dfelinto) 

would useually not encourage prints in these cases, except its often useful to know if an error happened since you last pressed Pkey and without this you end up needing to manually clear the terminal.
2008-09-25 17:43:06 +00:00
bc28feb997 re-use some Blender soft body settings for Bullet game soft bodies 2008-09-25 16:48:25 +00:00
c9c9b2e833 BGE patch: add Debug button next to object state. The object state mask will be printed at runtime with the debug info as a comma separated list of state numbers (1..30) for each active state bit. The reserved property name __state__ is used for that purpose (users should not create a property with that name). 2008-09-25 16:19:07 +00:00
04fa0fd869 Update MSVC project files for blenderplayer 2008-09-25 16:13:17 +00:00
1722aeb6ea This is part of the cleanup Campbell wanted :)
Just getting rid of license_key stuff.

The project files still need to be updated:
projectfiles_vc7/blender/src/BL_src_cre.vcproj
projectfiles_vc7/blender/blendercompactNG.vcproj

Just search for these files in them.
	
Kent
2008-09-25 15:39:46 +00:00
2b6f6698d2 patch [#17683] Fix OBJ import line endings
from Tom Nixon (greysquare)  for fixing [#17681] .OBj import issues
2008-09-25 13:17:56 +00:00
c2a202451f Update of the very ancient 2.3 text of blender.html.
Thanks Nathan Letwory for the poke!
2008-09-25 11:30:39 +00:00
6d7fe87767 binreloc include was wrong for make, removed last YESIAMSTUPID 2008-09-25 08:41:11 +00:00
707f2e300c * Worked a bit on cleaning up the code involving layering volumes on
solids, in front of other volumes, etc. Now there's a 'layer depth' 
value that works similarly to refraction depth - a limit for how many 
times the view ray will penetrate different volumetric surfaces.

I have it close to being able to return alpha, but it's still not 100% 
correct and needs a bit more work. Going to sit on this for a while.
2008-09-25 06:08:41 +00:00
718e2bf74f improved game soft bodies, works for objects that are using 'set smooth'
use shape matching by default for game soft bodies
store soft body index for game vertices
2008-09-25 03:02:30 +00:00
38a80ff9a5 BGE patch: add advanced parameters for SoftBody. Add Rasterizer.drawLine() Python function. 2008-09-24 22:58:49 +00:00
48bc5b2ac6 Made Object-level copy constraints work the same as for bones now too 2008-09-24 11:52:31 +00:00
0417e79586 * Moved the sample location for shading to the middle of the volumetric step. This fixes a nagging bug that would cause noise/odd moire-ish patterns, due to raytrace numerical errors:
http://mke3.net/blender/devel/rendering/volumetrics/vol_clouds_moire.jpg
2008-09-24 07:49:24 +00:00
a0a5198a03 Volumetrics:
* Now it's possible to render with the camera inside a volume. I'm not sure how this goes with overlapping volumes yet, will look at it. But it allows nice things like this :)
http://mke3.net/blender/devel/rendering/volumetrics/clouds_sky.mov

* Sped up shading significantly by not doing any shading if the density
of the current sample is less than 0.01 (there's nothing to shade there anyway!) Speeds up around 200% on that clouds scene.

* Fixed a bug in global texture coordinates for volume textures
2008-09-24 07:38:12 +00:00
3b09c0b0d5 Created a KX_SoftBodyDeformer for real-time soft bodies.
Added SetDeformer/GetDeformer() to KX_GameObject.
Store mapping between graphics/soft body vertices (work-in-progress)
Real-time soft body integration is still very premature, but
for a quick preview, see this testfile:
http://bulletphysics.com/ftp/pub/test/index.php?dir=blender/&file=soft_test.blend
2008-09-24 03:12:10 +00:00
aed107cf4a * Volumetrics scene integration
Now other objects (and sky) correctly render if they're partially 
inside or behind a volume. Previously all other objects were ignored, 
and volumes just rendered on black. The colour of surfaces inside or 
behind the volume gets correctly attenuated by the density of the 
volume in between - i.e. thicker volumes will block the light coming 
from behind. However, other solid objects don't receive volume shadows 
yet, this is to be worked on later.

http://mke3.net/blender/devel/rendering/volumetrics/vol_inside_behind.png

Currently this uses raytracing to find intersections within the volume, 
and rays are also traced from the volume, heading behind into the 
scene, to see what's behind it (similar effect to ray transp with IOR 
1). Because of this, objects inside or behind the volume will not be 
antialiased. Perhaps I can come up with a solution for this, but until 
then, for antialiasing, you can turn on Full OSA (warning, this will 
incur a slowdown). Of course you can always avoid this by rendering 
volumes on a separate renderlayer, and compositing in post, too.

Another idea I've started thinking about is to calculate an alpha 
value, then use ztransp to overlay on top of other objects. This won't 
accurately attenuate and absorb light coming from objects behind the 
volume, but for some situations it may be fine, and faster too.
2008-09-24 02:52:47 +00:00
7eae8d0c7b Patch #17675: Tooltips for fluid control panel - provided by Kai Kostack 2008-09-24 01:39:55 +00:00
7c94eed4cb Fixing compile warnings 2008-09-24 00:23:01 +00:00
005c5e6371 BGE bug #17657 fixed: dRotY doesn't work properly after 90 degrees rotation.
This problem is caused by discontinuities in the conversion
orientation matrix -> euler angles: the angle sign can
switch and thus the direction of the rotation produced
by the dRot Ipo.

To avoid this bug, the matrix->euler conversion must be 
avoided during the game. I took the following approach that 
is compatible with Blender (identical effect in the game and
in the 3D view):

- no change in Add mode: Rot and dRot are treated as additional
rotation to the orientation at the start of the Ipo. There is 
no matrix->euler conversion and thus no discontinuities. 

- Rot Ipo are treated as absolute rotation. All 3 axis should
be specified but if they are not, the startup object orientation
will be used to set the unspecified axis. By doing a matrix->
euler conversion once at the start, the discontinuities are
avoided. If there are also dRot curves, they are treated as
delta of the corresponding Rot curve or startup angle.

- dRot Ipo are treated as Add mode in Local axis.

Note about Add mode: Rot and dRot curves are treated identically
during the game. However, only dRot curves make sense because
they don't interfere with the object orientation in the 3D view.
2008-09-23 20:07:15 +00:00
3cf87f4c20 calculate curve radius for drawing curve normals 2008-09-23 15:57:05 +00:00
bd85367776 disable magnification filtering when mipmap is off. useful for texture low poly models. 2008-09-23 15:21:14 +00:00
2ad14ba223 Changed SimpleDeform to be a single modifier with (Twist|Bend|Taper|Strech) options available on the modifier painel/options. 2008-09-23 14:32:14 +00:00
d72d4a5058 fix for [#11744] NurbCurve Radius incorrect
removed calc_curve_subdiv_radius(), curve radius is now calculated the same way as tilt.

Added radius interpolation menu matching tilt interpolation, needed to add "Ease" interpolation type to keep 2.47 curves looking the same.
2008-09-23 13:35:32 +00:00
47032c251d - Particle-particle effectors we're quite unstable and not accurate at all. Now this should be fixed (especially with other integrators than euler) as the needed inter-frame effector particle positions are interpolated properly from the current and previous positions (previously only the most recent position was used).
- In practice this removes the dependency of particle simulations from the update order of objects and different particle systems inside objects.
- As a nice side effect out of this we also get fully correct birth positions for "near reactor particles" (previously for example smoke trail reactor particles were not born smoothly along the target particles path).
2008-09-23 12:53:00 +00:00
a55d591898 "Fix" for [#17671] Particles spin out of control and pass through when hitting collision object
-The fix is that particle random size factor should never ever be bigger than 1.0, else negative sizes are possible! Don't know who to blame, but probably my self :)
-The second issue of passing through the deflection and rotating wildly around strange centers is not a bug, but for particles the group and object visualization objects have to be centered on the global origin. I'll probably make an option later to use the object center, but this is how things are for now.
2008-09-23 11:51:40 +00:00
45acf427a7 * bugfix, old files (including default cube) weren't loading up with
correctly initialised volume settings
2008-09-23 08:00:55 +00:00
340c3b945e * Refactored the volume texture code. Seems to go ok so far, stress
tests and all my old files render fine, but anyone feel free to let me 
know if you find a bug in this :)

Should be a bit faster too, this file renders in about 60% of the time 
it did before 
(http://mke3.net/blender/devel/rendering/volumetrics/vol_col_emit.mov)
2008-09-23 07:44:25 +00:00
6b4ac3e7de * Volume colour absorption
Rather than a single absorption value to control how much light is absorbed as it 
travels through a volume, there's now an additional absorption colour. This is 
used to absorb different R/G/B components of light at different amounts. For 
example, if a white light shines on a volume which absorbs green and blue 
components, the volume will appear red.

To make it easier to use, the colour set in the UI is actually the inverse of the 
absorption colour, so the colour you set is the colour that the volume will 
appear as.

Here's an example of how it works:
http://mke3.net/blender/devel/rendering/volumetrics/vol_col_absorption.jpg

And this can be textured too:
http://mke3.net/blender/devel/rendering/volumetrics/vol_absorb_textured.png

Keep in mind, this doesn't use accurate spectral light wavelength mixing (just 
R/G/B channels) so in cases where the absorption colour is fully red green or 
blue, you'll get non-physical results.

Todo: refactor the volume texturing internal interface...
2008-09-23 07:05:06 +00:00
bcba8003c0 changing the number of subdivisions for nurbs curves.
this way each edge/segment gets the same number of points matching the resolution value.
before, a nurbs curve would have the same number of points no matter if it was cyclic or not.

This will make slight changes to objects on an animated path, but only noticable if the path has a low resolution.

bug [#11744] NurbCurve Radius incorrect - now dosnt show bad results with order 4 on non-cyclic curve.
2008-09-23 06:26:48 +00:00
d2d56e3058 bugfix for [#7006] Sleeping Objects losing Ghost Constraint
Bullet logic bug in (de)activation/island management: deactivated 'fantom' objects do merge islands, in particular when connected by constraints. (fantom = object with collision detection but no collision response).
2008-09-23 05:00:00 +00:00
50d0e1a988 * Volumetrics update
- Fixed a shading bug, due to issues in the raytrace engine where it would ignore 
intersections from the starting face (as it should). Disabled this for single 
scattering intersections, thanks to Brecht for a hint there. It still shows a 
little bit of noise, I think due to raytrace inaccuracy, which will have to be 
fixed up later.

before: http://mke3.net/blender/devel/rendering/volumetrics/vol_shaded_old.png
after: http://mke3.net/blender/devel/rendering/volumetrics/vol_shaded_correct.png

Now single scatttering shading works very nicely and is capable of things like this:
http://mke3.net/blender/devel/rendering/volumetrics/vol_shaded_clouds.mov

- Added colour emission. Now as well as the overall 'Emit:' slider to control 
overall emission strength, there's also a colour swatch for the volume to emit 
that colour. This can also be textured, using 'Emit Col' in the map to panel.

This animation was made using a clouds texture, with colour band, mapped to both 
emit colour and emit (strength):
http://mke3.net/blender/devel/rendering/volumetrics/vol_col_emit.mov

- Added 'Local' mapping to 'map input' - it's similar to Orco

- Fixed texture 'map input', wasn't using the offsets or scale values.
2008-09-23 04:26:52 +00:00
f187d680d8 fix for [#13825] Lack of Flags in Face Mode Set
undo was also not working.
2008-09-23 01:28:42 +00:00
872704010e [#8540] Import scripts for MilkShape3D file formats
from Markus Ilmola (glome)

note, UV's will be incorrect in some faces because of eekadoodle problem.
2008-09-23 00:49:44 +00:00
7a28ca4398 Make GameLogic work for python autocomplete (after running the BGE once at least)
only clear newly added items from the gameLogic dictionary rather then the whole dictionary.
2008-09-23 00:37:19 +00:00
2911df487e Fixed shrinkwrap constraint handling of matrixs.
Also since contraint uses BVHCache its now usable and fast.
Being possible to shrinkwrap constraint several objects to another
and only have one BVHTree being build.
2008-09-22 22:48:44 +00:00
18c954e95b BGE patch #17569 approved: Make FrameProp: work in Shape Action. PyDoc updated. 2008-09-22 21:49:48 +00:00
2875cc9cc6 Fix for second part of bug #17506: issue with swapped uv coordinates
on creating multires in editmode, wasn't doing test_index_face for
the face data.
2008-09-22 21:22:16 +00:00
d438b466b7 Fix file browser for Windows: going to the parent directory introduces ../\. Correct parent is ..\ under Windows. 2008-09-22 21:15:48 +00:00
0cf7bf7357 Fix for part of bug #17506: uv editing with multires is only
allowed at level 1, missed a case.
2008-09-22 20:26:28 +00:00
9b4956ae22 BGE patch: KX_STATEx constant to allow simple state manipulation in setState()
The constants KX_STATE1 to KX_STATE30 can be used 
with setState() to change the object state in a 
python controller. The constants are defined in the 
GameLogic module so that the full name is 
GameLogic.KX_STATE1 to GameLogic.KX_STATE30 but you
can simplify this with the import statement:

from GameLogic import *
cont = getCurrentController()
ob = cont.getOwner()
ob.setState(KX_STATE2)		#go to state 2

KX_STATEx constants are defined as (1<<(x-1))
Binary operators |, &, ^ and ~ can be used to combine states:

You can activate more than one state at a time with the | operator:

ob.setState(KX_STATE1|KX_STATE2)  #activate state 1 and 2, stop all others

You can add a state to the current state mask with:

state = ob.getState()
ob.setState(state|KX_STATE3)      #activate state 3, keep others

You can substract a state to the current state mask with the & and operator:

state = ob.getState()
ob.setState(state&~KX_STATE2)     #stop state 2, keep others

You can invert a state with the ^ operator:

state = ob.getState()
ob.setState(state^KX_STATE2)     #invert state 2, keep others
2008-09-22 19:54:30 +00:00
eef475ac7e Fix for bug #11163: strand render without tangent shading didn't
give correct results.
2008-09-22 19:37:30 +00:00
4e731c5ab5 Revert full screen, maximized and minimized code (rev 16543).
Revert this because don't work "fine" with dual-monitor.

The problem is not the code, this work fine, but full screen
for a window manager is not both monitor (until set xinerama or
whatever..).
2008-09-22 19:09:46 +00:00
48c54c275b Further fix for #8132, mac/nvidia driver issue drawing node previews,
zoom level was not correct.
2008-09-22 18:33:04 +00:00
315ef8213c BGE patch #17483 approved: object actuator DRot reverted since Blender 246. 2008-09-22 17:12:57 +00:00
b40ed96a78 Patch #17665 by Vladimir Marek
Fixes for solaris compiling
2008-09-22 15:59:50 +00:00
558d7499a6 Patch #17666 by Vladimi<C2>r Marek
Fixes for solaris compiling
2008-09-22 15:59:04 +00:00
627c6178f9 Realy time for 2.5!
Takes half an hour to find a nice empty spot for a button! Another attempt
to locate new shadow color swatch. Now back in shadow panel, bottom.
2008-09-22 15:38:17 +00:00
e4def00d5b fix for [#15020] File browser: going back from the root of all directories introduces "../" ad libitum + harcoded path?
bug was introduced when fixing BLI_cleanup_dir not to write to negative character indicies.
added a BLI_parent_dir(char *path)
2008-09-22 15:37:32 +00:00
bc151f1334 Bugfix:
- Button for 'shadow color' was drawn over 'layer shadow' button...
  The shadow+spot panel was cramped... spot shadowbuffer uses all
  space. Moved it to the Lamp panel with label, more clear now.
  Panel reorg is for later :)
- Small fix: Area Lamp 'gamma' slider didn't update preview.
  Unfortunately had to move this slider to smaller button...
2008-09-22 14:52:50 +00:00
c79f99224d Bugfix #14428: Constraints lost when object made single user
When there was a setup where an object was linked to more than one scene at once, and in one of those scenes some of the objects in that scene were related to it, the objects related to it were not correctly relinked to the new copy. 

This was due to the 2nd check for selected objects 
if( (base->flag & flag)==flag)
meaning that only selected objects would get corrected.
2008-09-22 13:01:51 +00:00
a6edcfc4ac Fluid: Remove SDL threads, also fixed the 'finished too early' problem reported once in tracker 2008-09-22 12:31:27 +00:00
2009ef810e Bugfix #12835
Zbuffer error in render: when you render faces clipped by 'clip end' the
z values could wrap around, resulting in errors. Code not nicely clamps,
plus should be faster even!
2008-09-22 12:18:07 +00:00
6e3bdacc11 Fixing missing function in elbeem 2008-09-22 10:58:50 +00:00
80f4b5b94f Removing control define 2008-09-22 10:21:57 +00:00
c08acde589 svn merge -r 16592:16667 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-22 10:04:45 +00:00
eb37006e53 [#17388] snap view to main views while rotating from Roelf De Kock (kiemdoder)
hold down ctrl when rotating the viewport
2008-09-22 10:00:31 +00:00
d1dedb2cef Added three XYZ color space options in code, will be activated later.
Thanks matt for the typing work :)
2008-09-22 09:09:03 +00:00
b7e8df1eff Bugfix: for sunsky preview I added another camera, accidentally changed clip
and lens value for other cameras.
2008-09-22 07:52:08 +00:00
486a6a214d copy object properties was crashing because of my recent changes. need to NULL listbase first.
changed visibility actuator menu to 3 toggle buttons and added tooltip note about outliner render restriction being used for visibility.
2008-09-22 07:17:39 +00:00
c57f32733a Bugfix - Long Keyframes:
In a A___B|---|B situation created by duplicating the B keyframe, the long keyframe between the 'B' keyframes was not showing up until the A keyframe was already duplicated. Reverting the 'optimisation' applied there (i.e. searching from last block, as that's where most blocks would be added)


Also removed some unused lines from gpencil.c
2008-09-22 04:30:21 +00:00
8fcac6820a KX_PythonInit.cpp - workaround for current sandbox and possible fix. no real change for now but others may want to look into it.
blendef.h - removed some unused defines.
editipo_mods.c - deselect all was selecting instead.
2008-09-22 04:18:17 +00:00
7522f86d01 * Volume rendering
This is an initial commit to get it in SVN and make it easier to work on.

Don't expect it to work perfectly, it's still in development and there's
plenty of work still needing to be done. And so no I'm not very interested 
in hearing bug reports or feature requests at this stage :)

There's some info on this, and a todo list at:
http://mke3.net/weblog/volume-rendering/

Right now I'm trying to focus on getting shading working correctly (there's 
currently a problem in which 'surfaces' of the volume facing towards or away
from light sources are getting shaded differently to how they should be),
then I'll work on integration issues, like taking materials behind the volume
into account, blending with alpha, etc. You can do simple testing though,
mapping textures to density or emission on a cube with volume material.
2008-09-22 01:51:24 +00:00
338a5c7bbf Make msvc happy (reported by broken) 2008-09-22 00:32:07 +00:00
96a0e0ab22 Bugfix where copy-protection of several modifiers like collision, softbody and particleInstance could be bypassed by using ctrl-c + 'copy all' option. 2008-09-21 22:47:50 +00:00
6e29313ac3 Update MSVC project files 2008-09-21 21:41:27 +00:00
158cca9e2f Fixing little bug allowing neegative attraction forces again 2008-09-21 21:24:46 +00:00
0039076850 Patch for rearranging fluid GUI provided by artist nudelZ 2008-09-21 21:02:41 +00:00
feccb096d8 [#17662] Blender runs the older version a python script when reloading it from disk
Missing free compiled.
2008-09-21 20:39:19 +00:00
a1b8a918cb Respect compile flags if elbeem is disabled, fix compiling for that case 2008-09-21 18:36:25 +00:00
8471184dc5 Merging fluidcontrol to trunk from rev16649 fluidcontrol branch. Code provided by Nils Thuerey. 2008-09-21 18:20:02 +00:00
afe851b6d1 Sunsky / Atmoshphere:
- Added blending mode and factor option, so it's more clear and
  controllable what happens with it. Also nice for crazy effects
  of course!
- Preview render now shows preview for it too

On the todos:

- have this in World buttons (as well) for quicker sky setups
- review math of color clamping and scaling, this is definitely 
  not good... but a fix will make old files look very different.
2008-09-21 16:04:33 +00:00
1c29d02305 BGE real-time soft bodies, step 2 / 3: create a btSoftBody. Next step is hooking up / deform graphics mesh and choose collision shape.
Note: feature is still disabled.
2008-09-21 15:17:50 +00:00
656ee61718 Merge from trunk
(The last time there was some files missing due to failed connection to svn server while merging.. thats why this stuff of reverting last merge and redoing it)

svn merge -r 16231:16608 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2008-09-19 14:15:36 +00:00
2f9f0710d1 Revert last merge from trunk
svn merge -r 16539:16538 https://svn.blender.org/svnroot/bf-blender/branches/soc-2008-jaguarandi/
2008-09-19 12:05:45 +00:00
6a8e7236cb Memoization: Remove need to keep full position lists on each node. 2008-09-18 21:45:57 +00:00
6701f07e66 svn merge -r 16490:16592 https://svn.blender.org/svnroot/bf-blender/trunk/blender + 16453:16485 2008-09-18 13:22:17 +00:00
4dab8ac3fe Group some functions as they should have been 2008-09-17 21:20:08 +00:00
63aebaf37d Benchmarking print time slice ratio 2008-09-16 23:23:33 +00:00
27de7cc2e1 Added SSLevels options to all shrinkwrap modes (before it was only available to projection mode)
Added BVHTree cache at derivedMesh level
2008-09-16 15:41:13 +00:00
871b24dd67 Benchmarkings timer cleanup
Don't number groups with only one arc (easy fix for fly model, need a two pass arc match for real fix)
2008-09-15 21:48:05 +00:00
a1d611e9bd svn merge -r 16231:16536 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-09-15 14:20:31 +00:00
980969ab63 Draw black border when drawing Reeb graphs 2008-09-12 21:07:25 +00:00
5bde46ae54 Fix bug with multires arc marking (used for flagging arcs as used) 2008-09-12 20:00:05 +00:00
ac142f329c superposed bone check when linking control bones. deal better with some constraint setups. 2008-09-08 22:36:32 +00:00
b60a24e585 Reeb:
- Prevent useless buckets reallocation
- Better multifiltering by not doing precopies

Retargetting
- if no full match found, match using loose rules
- better multiresolution flagging for used arcs (prevent ALL backtracking)
- comment out a lot of debug prints for better benchmarking
2008-09-07 21:44:23 +00:00
a87e2dac0e Use heap instead of array, shaving off approx 10% runtime. 2008-09-03 20:25:47 +00:00
17d777c486 Prebuild an indexed edge list for faster connectivity loops when applying dijkstra and harmonic function calculations.
Drops the runtime for that part of the algo by a lot (39k edges from 16s to 0.6s)
2008-09-03 19:24:26 +00:00
1924eeb182 Couple of variables renames and logic inversion simplification 2008-09-02 20:33:32 +00:00
f479aec492 Memoization based solver for inner joint placement. Pretty much reduces the problem from a monstruous exponential to a quadratic cake.
Thanks to jaguarandi for initial pointers.

Changes in arith is a simple added function to check for null vectors.
2008-09-02 02:10:14 +00:00
276c162e56 Recalculate roll to preserve orientation when retargetting for deform and control bones.
Previously, roll would be kept as it which would make the resulting orientation different than the original, messing up some controls (example: heel bone flipped 180 so feet would rotate toward ground instead of lifting).

Next possible step: preserving inter-bones orientation (if needed)
2008-08-27 19:38:51 +00:00
51d6988756 First draft for hybrid retarget/generate (turned off)
Some debugging code for filtering
Control bones link propagation (can deal with reverse foot rig now).
Bones marked as locked are ignored (useful to unlink character base)
2008-08-26 01:37:46 +00:00
039ed9cb7f svn merge -r 16215:16231 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2008-08-22 15:40:41 +00:00
86cdf3db14 Vertice outside of faces would create zero degree nodes and mess up later.
Do a single pass to remove those after reeb graph creation (but before filtering).
2008-08-21 18:12:36 +00:00
963031c99f Finish yesterday's bugfixing.
Making shape function work on cyclic graphs requires tracking the current graph level, which wasn't done correctly when this was implemented. Done properly now so going up and down on graph works as it did before.
2008-08-21 17:28:58 +00:00
e04b899e81 transfering some ongoing work for home, nothing to see here. 2008-08-20 21:34:49 +00:00
a3337a15f0 Control bone commit from yesterday broke root bones. This is now fixed in a much more elegant way.
Remove yeh ol' primary symmetry axis flipping and replace by a smarter check on both armature and mesh arcs (works better for partial retargetting).
2008-08-19 22:16:01 +00:00
18bce23a60 Make subgraph tagging use own index, to not interfere with flagging used to prevent backtracking in different other functions
Better deal with chains starting with control bones
2008-08-18 22:22:56 +00:00
aef4586408 For now, don't join subgraphs if graphs are cyclic (this causes problem when reweighting because it uses a depth first method which doesn't work with cycles properly) 2008-08-18 00:08:22 +00:00
0418220444 Use ThreadedWorker for dispatch 2008-08-16 22:48:43 +00:00
e0722e0923 ThreadedWorker
New functions to easily dispatch work to a limited number of thread, transparently.

NOTE: Could be merged in trunk, if needed.
2008-08-16 22:47:33 +00:00
cc3b41b3cd Better logic to display symmetries
Add option to hide node and arc indexes (for cleaner screenshots)
2008-08-15 20:55:38 +00:00
520e52d7d2 Control bones support for root bones (didn't work previously)
Preliminary support for multi threading. Fixed at 4 threads now, will make it use the option eventually.

Need a better mecanism to wait for at least one finished threads.
2008-08-14 23:55:40 +00:00
1363 changed files with 171802 additions and 49487 deletions

View File

@@ -61,10 +61,12 @@ 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)" ON)
OPTION(WITH_DDS "Enable DDS Support" ON)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
OPTION(WITH_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org/)" OFF)
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Mozilla-Unix only)" OFF)
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -86,14 +88,16 @@ INCLUDE(CMake/macros.cmake)
#Platform specifics
IF(UNIX)
INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
IF(OPENAL_FOUND)
SET(WITH_OPENAL ON)
SET(OPENAL_LIB ${OPENAL_LIBRARY})
SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
ELSE(OPENAL_FOUND)
SET(WITH_OPENAL OFF)
ENDIF(OPENAL_FOUND)
IF(WITH_OPENAL)
INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
IF(OPENAL_FOUND)
SET(WITH_OPENAL ON)
SET(OPENAL_LIB ${OPENAL_LIBRARY})
SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
ELSE(OPENAL_FOUND)
SET(WITH_OPENAL OFF)
ENDIF(OPENAL_FOUND)
ENDIF(WITH_OPENAL)
FIND_LIBRARY(ALUT_LIBRARY
NAMES alut
@@ -171,7 +175,7 @@ IF(UNIX)
SET(FFMPEG /usr)
SET(FFMPEG_INC ${FFMPEG}/include)
SET(FFMPEG_LIB avformat avcodec avutil)
SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
SET(JPEG_LIB jpeg)
@@ -327,7 +331,7 @@ IF(WIN32)
SET(WINTAB_INC ${LIBDIR}/wintab/include)
IF(CMAKE_CL_64)
SET(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
SET(PLATFORM_LINKFLAGS "/MANIFEST:NO /MANIFESTUAC:NO /MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
ELSE(CMAKE_CL_64)
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
ENDIF(CMAKE_CL_64)
@@ -427,6 +431,20 @@ SET(FTGL ${CMAKE_SOURCE_DIR}/extern/bFTGL)
SET(FTGL_INC ${FTGL}/include)
SET(FTGL_LIB extern_ftgl)
set(OPENJPEG ${CMAKE_SOURCE_DIR}/extern/libopenjpeg)
set(OPENJPEG_INC ${OPENJPEG})
set(OPENJPEG_LIb extern_libopenjpeg)
#-----------------------------------------------------------------------------
# Blender WebPlugin
IF(WITH_WEBPLUGIN)
SET(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
SET(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
SET(WITH_PLAYER ON)
ENDIF(WITH_WEBPLUGIN)
#-----------------------------------------------------------------------------
# Configure OpenGL.
@@ -457,12 +475,6 @@ 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

View File

@@ -42,6 +42,8 @@ import tools.Blender
import tools.btools
import tools.bcolors
EnsureSConsVersion(1,0,0)
BlenderEnvironment = tools.Blender.BlenderEnvironment
btools = tools.btools
B = tools.Blender
@@ -55,8 +57,8 @@ nsis_build = None
##### BEGIN SETUP #####
B.possible_types = ['core', 'common', 'blender', 'intern',
'international', 'game', 'game2',
'player', 'player2', 'system']
'international', 'game', 'game2',
'player', 'player2', 'system']
B.binarykind = ['blender' , 'blenderplayer']
##################################
@@ -65,15 +67,15 @@ B.binarykind = ['blender' , 'blenderplayer']
# XX cheating for BF_FANCY, we check for BF_FANCY before args are validated
use_color = ARGUMENTS.get('BF_FANCY', '1')
if platform=='win32':
use_color = None
use_color = None
if not use_color=='1':
B.bc.disable()
B.bc.disable()
#on defaut white Os X terminal, some colors are totally unlegible
if platform=='darwin':
B.bc.OKGREEN = '\033[34m'
B.bc.WARNING = '\033[36m'
B.bc.OKGREEN = '\033[34m'
B.bc.WARNING = '\033[36m'
# arguments
print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
@@ -96,231 +98,260 @@ quickie = B.arguments.get('BF_QUICK', None)
quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
if quickdebug:
B.quickdebug=string.split(quickdebug, ',')
B.quickdebug=string.split(quickdebug, ',')
else:
B.quickdebug=[]
B.quickdebug=[]
if quickie:
B.quickie=string.split(quickie,',')
B.quickie=string.split(quickie,',')
else:
B.quickie=[]
B.quickie=[]
toolset = B.arguments.get('BF_TOOLSET', None)
if toolset:
print "Using " + toolset
if toolset=='mstoolkit':
env = BlenderEnvironment(ENV = os.environ)
env.Tool('mstoolkit', ['tools'])
else:
env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
if env:
btools.SetupSpawn(env)
print "Using " + toolset
if toolset=='mstoolkit':
env = BlenderEnvironment(ENV = os.environ)
env.Tool('mstoolkit', ['tools'])
else:
env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
# xxx commented out, as was supressing warnings under mingw..
#if env:
# btools.SetupSpawn(env)
else:
env = BlenderEnvironment(ENV = os.environ)
env = BlenderEnvironment(ENV = os.environ)
if not env:
print "Could not create a build environment"
Exit()
print "Could not create a build environment"
Exit()
cc = B.arguments.get('CC', None)
cxx = B.arguments.get('CXX', None)
if cc:
env['CC'] = cc
env['CC'] = cc
if cxx:
env['CXX'] = cxx
env['CXX'] = cxx
if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
platform = 'win32-vc'
platform = 'win32-vc'
elif env['CC'] in ['gcc'] and sys.platform=='win32':
platform = 'win32-mingw'
platform = 'win32-mingw'
env.SConscriptChdir(0)
crossbuild = B.arguments.get('BF_CROSS', None)
if crossbuild and platform!='win32':
platform = 'linuxcross'
platform = 'linuxcross'
env['OURPLATFORM'] = platform
configfile = 'config'+os.sep+platform+'-config.py'
if os.path.exists(configfile):
print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
else:
print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
if crossbuild and env['PLATFORM'] != 'win32':
print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
env.Tool('crossmingw', ['tools'])
# todo: determine proper libs/includes etc.
# Needed for gui programs, console programs should do without it
env.Append(LINKFLAGS=['-mwindows'])
print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
env.Tool('crossmingw', ['tools'])
# todo: determine proper libs/includes etc.
# 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(userconfig):
print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
optfiles += [userconfig]
print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
optfiles += [userconfig]
else:
print B.bc.WARNING + userconfig + " 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)
if not env['BF_FANCY']:
B.bc.disable()
B.bc.disable()
SetOption('num_jobs', int(env['BF_NUMJOBS']))
print "Build with %d parallel jobs" % (GetOption('num_jobs'))
# disable elbeem (fluidsim) compilation?
if env['BF_NO_ELBEEM'] == 1:
env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
env['CXXFLAGS'].append('-DDISABLE_ELBEEM')
env['CCFLAGS'].append('-DDISABLE_ELBEEM')
env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
env['CXXFLAGS'].append('-DDISABLE_ELBEEM')
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'][-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'])
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
if env.has_key('BF_DEBUG_LIBS'):
B.quickdebug += env['BF_DEBUG_LIBS']
B.quickdebug += env['BF_DEBUG_LIBS']
printdebug = B.arguments.get('BF_LISTDEBUG', 0)
# see if this linux distro has libalut
if env['OURPLATFORM'] == 'linux2' :
if env['WITH_BF_OPENAL']:
mylib_test_source_file = """
#include "AL/alut.h"
int main(int argc, char **argv)
{
alutGetMajorVersion();
return 0;
}
"""
if env['WITH_BF_OPENAL']:
mylib_test_source_file = """
#include "AL/alut.h"
int main(int argc, char **argv)
{
alutGetMajorVersion();
return 0;
}
"""
def CheckFreeAlut(context,env):
context.Message( B.bc.OKGREEN + "Linux platform detected:\n checking for FreeAlut... " + B.bc.ENDC )
env['LIBS'] = 'alut'
result = context.TryLink(mylib_test_source_file, '.c')
context.Result(result)
return result
def CheckFreeAlut(context,env):
context.Message( B.bc.OKGREEN + "Linux platform detected:\n checking for FreeAlut... " + B.bc.ENDC )
env['LIBS'] = 'alut'
result = context.TryLink(mylib_test_source_file, '.c')
context.Result(result)
return result
env2 = env.Copy( LIBPATH = env['BF_OPENAL'] )
sconf_temp = mkdtemp()
conf = Configure( env2, {'CheckFreeAlut' : CheckFreeAlut}, sconf_temp, '/dev/null' )
if conf.CheckFreeAlut( env2 ):
env['BF_OPENAL_LIB'] += ' alut'
del env2
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))
if root: os.rmdir(root)
env2 = env.Clone( LIBPATH = env['BF_OPENAL'] )
sconf_temp = mkdtemp()
conf = Configure( env2, {'CheckFreeAlut' : CheckFreeAlut}, sconf_temp, '/dev/null' )
if conf.CheckFreeAlut( env2 ):
env['BF_OPENAL_LIB'] += ' alut'
del env2
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))
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
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'
if 'stdc++' in env['LLIBS']:
env['LLIBS'].remove('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
env['WITH_BF_PLAYER'] = True
if 'blendernogame' in B.targets:
env['WITH_BF_GAMEENGINE'] = False
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
target_env_defs = {}
target_env_defs['WITH_BF_GAMEENGINE'] = False
target_env_defs['WITH_BF_OPENAL'] = False
target_env_defs['WITH_BF_OPENEXR'] = False
target_env_defs['WITH_BF_ICONV'] = False
target_env_defs['WITH_BF_INTERNATIONAL'] = False
target_env_defs['WITH_BF_OPENJPEG'] = False
target_env_defs['WITH_BF_FFMPEG'] = False
target_env_defs['WITH_BF_QUICKTIME'] = False
target_env_defs['WITH_BF_YAFRAY'] = False
target_env_defs['WITH_BF_REDCODE'] = False
target_env_defs['WITH_BF_FTGL'] = False
target_env_defs['WITH_BF_DDS'] = False
target_env_defs['WITH_BF_ZLIB'] = False
target_env_defs['WITH_BF_SDL'] = False
target_env_defs['WITH_BF_JPEG'] = False
target_env_defs['WITH_BF_PNG'] = False
target_env_defs['WITH_BF_ODE'] = False
target_env_defs['WITH_BF_BULLET'] = False
target_env_defs['WITH_BF_SOLID'] = False
target_env_defs['WITH_BF_BINRELOC'] = False
target_env_defs['BF_BUILDINFO'] = False
target_env_defs['BF_NO_ELBEEM'] = True
target_env_defs['WITH_BF_PYTHON'] = False
# Merge blenderlite, let command line to override
for k,v in target_env_defs.iteritems():
if k not in B.arguments:
env[k] = v
# 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']
env['BUILDDIR'] = B.root_build_dir
B.doc_build_dir = env['BF_DOCDIR']
if not B.root_build_dir[-1]==os.sep:
B.root_build_dir += os.sep
B.root_build_dir += os.sep
if not B.doc_build_dir[-1]==os.sep:
B.doc_build_dir += os.sep
# We do a shortcut for clean when no quicklist is given: just delete
# builddir without reading in SConscripts
do_clean = None
if 'clean' in B.targets:
do_clean = True
do_clean = True
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 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
Exit()
if os.path.exists(B.doc_build_dir):
print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
dirs = os.listdir(B.doc_build_dir)
for entry in dirs:
if os.path.isdir(B.doc_build_dir + entry) == 1:
print "clean dir %s"%(B.doc_build_dir+entry)
shutil.rmtree(B.doc_build_dir+entry)
else: # remove file
print "remove file %s"%(B.doc_build_dir+entry)
os.remove(B.root_build_dir+entry)
if os.path.exists(B.root_build_dir):
print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
dirs = os.listdir(B.root_build_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', 'extern/ffmpeg/include']:
if os.path.exists(confile):
print "clean file %s"%confile
if os.path.isdir(confile):
for root, dirs, files in os.walk(confile):
for name in files:
os.remove(os.path.join(root, name))
else:
os.remove(confile)
print B.bc.OKGREEN+'...done'+B.bc.ENDC
else:
print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
Exit()
if not os.path.isdir ( B.root_build_dir):
os.makedirs ( B.root_build_dir )
os.makedirs ( B.root_build_dir + 'source' )
os.makedirs ( B.root_build_dir + 'intern' )
os.makedirs ( B.root_build_dir + 'extern' )
os.makedirs ( B.root_build_dir + 'lib' )
os.makedirs ( B.root_build_dir + 'bin' )
os.makedirs ( B.root_build_dir )
os.makedirs ( B.root_build_dir + 'source' )
os.makedirs ( B.root_build_dir + 'intern' )
os.makedirs ( B.root_build_dir + 'extern' )
os.makedirs ( B.root_build_dir + 'lib' )
os.makedirs ( B.root_build_dir + 'bin' )
if not os.path.isdir(B.doc_build_dir):
os.makedirs ( B.doc_build_dir )
Help(opts.GenerateHelpText(env))
@@ -328,10 +359,10 @@ Help(opts.GenerateHelpText(env))
# commands, do 'scons BF_QUIET=0'
bf_quietoutput = B.arguments.get('BF_QUIET', '1')
if env['BF_QUIET']:
B.set_quiet_output(env)
B.set_quiet_output(env)
else:
if toolset=='msvc':
B.msvc_hack(env)
if toolset=='msvc':
B.msvc_hack(env)
print B.bc.HEADER+'Building in '+B.bc.ENDC+B.root_build_dir
env.SConsignFile(B.root_build_dir+'scons-signatures')
@@ -353,20 +384,21 @@ SConscript(B.root_build_dir+'/source/SConscript')
# libraries to give as objects to linking phase
mainlist = []
for tp in B.possible_types:
if not tp == 'player' and not tp == 'player2':
mainlist += B.create_blender_liblist(env, tp)
if not tp == 'player' and not tp == 'player2':
mainlist += B.create_blender_liblist(env, tp)
if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
B.propose_priorities()
B.propose_priorities()
dobj = B.buildinfo(env, "dynamic") + B.resources
thestatlibs, thelibincs = B.setup_staticlibs(env)
thesyslibs = B.setup_syslibs(env)
env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
if env['WITH_BF_PLAYER']:
playerlist = B.create_blender_liblist(env, 'player')
env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
playerlist = B.create_blender_liblist(env, 'player')
env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
##### Now define some targets
@@ -376,19 +408,19 @@ if env['WITH_BF_PLAYER']:
#-- binaries
blenderinstall = []
if env['OURPLATFORM']=='darwin':
for prg in B.program_list:
bundle = '%s.app' % prg[0]
bundledir = os.path.dirname(bundle)
for dp, dn, df in os.walk(bundle):
if 'CVS' in dn:
dn.remove('CVS')
if '.svn' in dn:
dn.remove('.svn')
dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
source=[dp+os.sep+f for f in df]
blenderinstall.append(env.Install(dir=dir,source=source))
for prg in B.program_list:
bundle = '%s.app' % prg[0]
bundledir = os.path.dirname(bundle)
for dp, dn, df in os.walk(bundle):
if 'CVS' in dn:
dn.remove('CVS')
if '.svn' in dn:
dn.remove('.svn')
dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
source=[dp+os.sep+f for f in df]
blenderinstall.append(env.Install(dir=dir,source=source))
else:
blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
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
@@ -397,30 +429,41 @@ dottargetlist = []
scriptinstall = []
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)
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:
if not env['WITH_BF_INTERNATIONAL']:
if 'locale' in dp:
continue
if f == '.Blanguages':
continue
if not env['WITH_BF_FREETYPE']:
if f.endswith('.ttf'):
continue
dotblendlist.append(os.path.join(dp, 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))
dotblenderinstall = []
for targetdir,srcfile in zip(dottargetlist, dotblendlist):
td, tf = os.path.split(targetdir)
dotblenderinstall.append(env.Install(dir=td, source=srcfile))
if env['WITH_BF_PYTHON']:
#-- .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':
@@ -442,18 +485,25 @@ if env['OURPLATFORM']=='linux2':
td, tf = os.path.split(targetdir)
iconinstall.append(env.Install(dir=td, source=srcfile))
# dlls for linuxcross
# TODO - add more libs, for now this lets blenderlite run
if env['OURPLATFORM']=='linuxcross':
dir=env['BF_INSTALLDIR']
source = ['../lib/windows/pthreads/lib/pthreadGC2.dll']
scriptinstall.append(env.Install(dir=dir, source=source))
#-- plugins
pluglist = []
plugtargetlist = []
for tp, tn, tf in os.walk('release/plugins'):
if 'CVS' in tn:
tn.remove('CVS')
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)
if 'CVS' in tn:
tn.remove('CVS')
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')
@@ -473,59 +523,60 @@ plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'incl
plugininstall = []
for targetdir,srcfile in zip(plugtargetlist, pluglist):
td, tf = os.path.split(targetdir)
plugininstall.append(env.Install(dir=td, source=srcfile))
td, tf = os.path.split(targetdir)
plugininstall.append(env.Install(dir=td, source=srcfile))
textlist = []
texttargetlist = []
for tp, tn, tf in os.walk('release/text'):
if 'CVS' in tn:
tn.remove('CVS')
if '.svn' in tn:
tn.remove('.svn')
for f in tf:
textlist.append(tp+os.sep+f)
if 'CVS' in tn:
tn.remove('CVS')
if '.svn' in tn:
tn.remove('.svn')
for f in tf:
textlist.append(tp+os.sep+f)
textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
if env['OURPLATFORM']=='darwin':
allinstall = [blenderinstall, plugininstall, textinstall]
allinstall = [blenderinstall, plugininstall, textinstall]
elif env['OURPLATFORM']=='linux2':
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
else:
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
'${LCGDIR}/png/lib/libpng.dll',
'#release/windows/extra/python25.zip',
'#release/windows/extra/zlib.pyd',
'${LCGDIR}/sdl/lib/SDL.dll',
'${LCGDIR}/zlib/lib/zlib.dll',
'${LCGDIR}/tiff/lib/libtiff.dll']
if env['BF_DEBUG']:
dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}_d.dll')
else:
dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll')
if env['OURPLATFORM'] == 'win32-mingw':
dllsources += ['${LCGDIR}/pthreads/lib/pthreadGC2.dll']
else:
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-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
dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
'${BF_PNG_LIBPATH}/libpng.dll',
'${BF_ZLIB_LIBPATH}/zlib.dll',
'${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
if env['WITH_BF_SDL']:
dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
if env['WITH_BF_PYTHON']:
ver = env["BF_PYTHON_VERSION"].replace(".", "")
dllsources.append('#release/windows/extra/python' + ver + '.zip')
dllsources.append('#release/windows/extra/zlib.pyd')
if env['BF_DEBUG']:
dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}_d.dll')
else:
dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}.dll')
if env['WITH_BF_ICONV']:
dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
if env['WITH_BF_FFMPEG']:
dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-52.dll',
'${LCGDIR}/ffmpeg/lib/avformat-52.dll',
'${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
'${LCGDIR}/ffmpeg/lib/avutil-50.dll',
'${LCGDIR}/ffmpeg/lib/libfaad-2.dll',
'${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
'${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
'${LCGDIR}/ffmpeg/lib/libx264-67.dll',
'${LCGDIR}/ffmpeg/lib/xvidcore.dll',
'${LCGDIR}/ffmpeg/lib/swscale-0.dll']
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
allinstall += windlls
installtarget = env.Alias('install', allinstall)
bininstalltarget = env.Alias('install-bin', blenderinstall)
@@ -534,13 +585,17 @@ nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
nsiscmd = env.Command('nsisinstaller', None, nsisaction)
nsisalias = env.Alias('nsis', nsiscmd)
if 'blender' in B.targets:
blenderexe= env.Alias('blender', B.program_list)
Depends(blenderexe,installtarget)
if env['WITH_BF_PLAYER']:
blenderplayer = env.Alias('blenderplayer', B.program_list)
Depends(blenderplayer,installtarget)
blenderplayer = env.Alias('blenderplayer', B.program_list)
Depends(blenderplayer,installtarget)
if not env['WITH_BF_GAMEENGINE']:
blendernogame = env.Alias('blendernogame', B.program_list)
Depends(blendernogame,installtarget)
blendernogame = env.Alias('blendernogame', B.program_list)
Depends(blendernogame,installtarget)
if 'blenderlite' in B.targets:
blenderlite = env.Alias('blenderlite', B.program_list)
@@ -551,7 +606,7 @@ Depends(nsiscmd, allinstall)
Default(B.program_list)
if not env['WITHOUT_BF_INSTALL']:
Default(installtarget)
Default(installtarget)
#------------ RELEASE
# TODO: zipup the installation
@@ -560,5 +615,14 @@ if not env['WITHOUT_BF_INSTALL']:
# TODO: build stubs and link into blenderplayer
#------------ EPYDOC
# TODO: run epydoc
if env['WITH_BF_DOCS']:
try: import epydoc
except: epydoc = None
if epydoc:
SConscript('source/blender/python/api2_2x/doc/SConscript')
SConscript('source/gameengine/PyDoc/SConscript')
else:
print "No epydoc install detected, Python API and Gameengine API Docs will not be generated "

View File

@@ -20,4 +20,4 @@ Romanian:ro
Arabic:ar
Bulgarian:bg
Greek:el
Korean:kr
Korean:ko

View File

@@ -104,6 +104,8 @@ IF(UNIX)
bf_blenlib
bf_cineon
bf_openexr
extern_libopenjpeg
bf_dds
bf_ftfont
extern_ftgl
bf_readblenfile

View File

@@ -8,7 +8,7 @@
import commands
# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
USE_SDK='true'
USE_SDK=True
BF_PYTHON_VERSION = '2.3'
@@ -38,15 +38,15 @@ else:
# enable ffmpeg support
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
BF_FFMPEG = "#extern/ffmpeg"
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
if USE_SDK=='true':
BF_FFMPEG_INC = '${BF_FFMPEG}'
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'
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE = "#extern/verse/dist"
BF_VERSE_LIBPATH = "${BF_BUILDDIR}/extern/verse/dist"
BF_VERSE_INCLUDE = BF_VERSE
@@ -76,9 +76,9 @@ WITH_BF_OPENMP = '0'
# Note : should be true, but openal simply dont work on intel
if MAC_PROC == 'i386':
WITH_BF_OPENAL = 'false'
WITH_BF_OPENAL = False
else:
WITH_BF_OPENAL = 'true'
WITH_BF_OPENAL = True
#different lib must be used following version of gcc
# for gcc 3.3
#BF_OPENAL = LIBDIR + '/openal'
@@ -88,7 +88,7 @@ if MAC_PROC == 'powerpc':
else :
BF_OPENAL = LIBDIR + '/openal'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_STATICOPENAL = False
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
@@ -97,20 +97,17 @@ 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'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
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'
@@ -118,15 +115,15 @@ 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'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
@@ -135,32 +132,32 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'intl'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='true'
WITH_BF_PLAYER='true'
WITH_BF_GAMEENGINE=True
WITH_BF_PLAYER=True
WITH_BF_ODE = 'false'
WITH_BF_ODE = False
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = '${BF_ODE}/include'
BF_ODE_LIB = '${BF_ODE}/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -169,9 +166,9 @@ BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -186,7 +183,7 @@ WITH_BF_YAFRAY = 'true'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_FREETYPE = LIBDIR + '/freetype'
@@ -194,16 +191,16 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'true' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = True # -DWITH_QUICKTIME
WITH_BF_ICONV = 'true'
WITH_BF_ICONV = True
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
#BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'true'
WITH_BF_STATICOPENGL = True
BF_OPENGL_LIB = 'GL GLU'
BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
BF_OPENGL_LINKFLAGS = '-framework OpenGL'
@@ -216,16 +213,16 @@ 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'
#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'
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'
LLIBS.append('crt3.o')
if USE_SDK=='true':
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
@@ -243,7 +240,7 @@ else:
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##BF_DEPEND = True
##
##AR = ar
##ARFLAGS = ruv
@@ -251,20 +248,22 @@ else:
##
CC = 'gcc'
CXX = 'g++'
C_WARN = ' -Wall -Wno-long-double -Wdeclaration-after-statement '
C_WARN = ['-Wdeclaration-after-statement']
CC_WARN = ' -Wall -Wno-long-double'
CC_WARN = ['-Wall', '-Wno-long-double']
##FIX_STUBS_WARNINGS = -Wno-unused
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ' -pg -g '
BF_PROFILE = 'false'
BF_PROFILE_CCFLAGS = ['-pg', '-g ']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_PROFILE = False
BF_DEBUG = 'false'
BF_DEBUG_FLAGS = '-g'
BF_DEBUG = False
BF_DEBUG_CCFLAGS = ['-g']
BF_BUILDDIR='../build/darwin'
BF_INSTALLDIR='../install/darwin'
BF_DOCDIR='../install/doc'

228
config/irix6-config.py Normal file
View File

@@ -0,0 +1,228 @@
import os
LCGDIR = os.getcwd()+"/../lib/irix-6.5-mips"
LIBDIR = LCGDIR
print LCGDIR
WITH_BF_VERSE = 'false'
BF_VERSE_INCLUDE = "#extern/verse/dist"
BF_PYTHON = LCGDIR+'/python'
BF_PYTHON_VERSION = '2.5'
WITH_BF_STATICPYTHON = 'true'
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/python2.5/config/libpython${BF_PYTHON_VERSION}.a'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'true'
BF_OPENAL = LCGDIR+'/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
BF_OPENAL_LIBPATH = LIBDIR + '/lib'
# 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 = LCGDIR+'/sdl' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL audio iconv charset' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_OPENEXR = 'false'
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 = 'false'
WITH_BF_JPEG = 'false'
BF_JPEG = LCGDIR+'/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'false'
BF_PNG = LCGDIR+"/png"
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = '/usr/nekoware'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
BF_ZLIB = LCGDIR+"/zlib"
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = 'true'
BF_GETTEXT = LCGDIR+'/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextpo intl'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='false'
WITH_BF_ODE = 'false'
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = BF_ODE + '/include'
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
WITH_BF_BULLET = 'true'
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
#WITH_BF_NSPR = 'true'
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
# Uncomment the following line to use Mozilla inplace of netscape
#CPPFLAGS += -DMOZ_NOT_NET
# Location of MOZILLA/Netscape header files...
#BF_MOZILLA = $(LIBDIR)/mozilla
#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
#BF_MOZILLA_LIB =
# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
# enable freetype2 support for text objects
BF_FREETYPE = LCGDIR+'/freetype'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'true'
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv charset'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_BINRELOC = 'false'
# enable ffmpeg support
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
# Uncomment the following two lines to use system's ffmpeg
BF_FFMPEG = LCGDIR+'/ffmpeg'
BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice faad faac vorbis x264 ogg mp3lame z'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
# enable ogg, vorbis and theora in ffmpeg
WITH_BF_OGG = 'false' # -DWITH_OGG
BF_OGG = '/usr'
BF_OGG_INC = '${BF_OGG}/include'
BF_OGG_LIB = 'ogg vorbis theoraenc theoradec'
WITH_BF_OPENJPEG = 'false'
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_REDCODE = 'false'
BF_REDCODE = '#extern/libredcode'
BF_REDCODE_LIB = ''
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'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIB = 'GL GLU X11 Xi Xext'
BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
BF_OPENGL_LIB_STATIC = '${BF_OPENGL}/libGL.a ${BF_OPENGL}/libGLU.a ${BF_OPENGL}/libXxf86vm.a ${BF_OPENGL}/libX11.a ${BF_OPENGL}/libXi.a ${BF_OPENGL}/libXext.a ${BF_OPENGL}/libXxf86vm.a'
CC = 'c99'
CXX = 'CC'
CCFLAGS = ['-pipe','-fPIC', '-n32']
CPPFLAGS = ['-DXP_UNIX']
CXXFLAGS = ['-pipe','-fPIC', '-n32']
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##
##AR = ar
##ARFLAGS = ruv
##ARFLAGSQUIET = ru
##
C_WARN = '-no_prelink -ptused'
CC_WARN = '-no_prelink -ptused'
##FIX_STUBS_WARNINGS = -Wno-unused
LLIBS = 'c m dl pthread dmedia movie'
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = 'false'
BF_DEBUG = 'false'
BF_DEBUG_FLAGS = '-g'
BF_BUILDDIR = '../build/irix6'
BF_INSTALLDIR='../install/irix6'
BF_DOCDIR='../install/doc'
#Link against pthread
LDIRS = []
LDIRS.append(BF_FREETYPE_LIBPATH)
LDIRS.append(BF_PNG_LIBPATH)
LDIRS.append(BF_ZLIB_LIBPATH)
LDIRS.append(BF_SDL_LIBPATH)
LDIRS.append(BF_OPENAL_LIBPATH)
LDIRS.append(BF_ICONV_LIBPATH)
PLATFORM_LINKFLAGS = []
for x in LDIRS:
PLATFORM_LINKFLAGS.append("-L"+x)
PLATFORM_LINKFLAGS += ['-L${LCGDIR}/jpeg/lib' , '-L/usr/lib32', '-n32', '-v', '-no_prelink']
print PLATFORM_LINKFLAGS
LINKFLAGS= PLATFORM_LINKFLAGS

View File

@@ -1,20 +1,20 @@
LCGDIR = '../lib/linux2'
LIBDIR = "${LCGDIR}"
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE_INCLUDE = "#extern/verse/dist"
BF_PYTHON = '/usr'
BF_PYTHON_VERSION = '2.5'
WITH_BF_STATICPYTHON = 'false'
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'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = '/usr'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
@@ -26,19 +26,16 @@ BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a ${BF_OPENAL}/lib/libalut.a'
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = '/usr' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
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'
@@ -49,14 +46,14 @@ BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
WITH_BF_DDS = 'true'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = '/usr'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = '/usr'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
@@ -64,31 +61,31 @@ BF_PNG_LIB = 'png'
BF_TIFF = '/usr'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='false'
WITH_BF_GAMEENGINE=False
WITH_BF_ODE = 'false'
WITH_BF_ODE = False
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = BF_ODE + '/include'
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -97,9 +94,9 @@ BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -114,60 +111,61 @@ WITH_BF_YAFRAY = 'true'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_FREETYPE = '/usr'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'false'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_BINRELOC = 'true'
WITH_BF_BINRELOC = True
# enable ffmpeg support
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
BF_FFMPEG = '#extern/ffmpeg'
BF_FFMPEG_LIB = ''
# Uncomment the following two lines to use system's ffmpeg
# BF_FFMPEG = '/usr'
# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
BF_FFMPEG_INC = '${BF_FFMPEG}'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
WITH_BF_OPENJPEG = 'true'
# enable ogg, vorbis and theora in ffmpeg
WITH_BF_OGG = False # -DWITH_OGG
BF_OGG = '/usr'
BF_OGG_INC = '${BF_OGG}/include'
BF_OGG_LIB = 'ogg vorbis vorbisenc theoraenc theoradec'
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_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_REDCODE = 'false'
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_INC = '${BF_REDCODE}/include'
BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now.
BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'false'
WITH_BF_STATICOPENGL = False
BF_OPENGL = '/usr'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIB = 'GL GLU X11 Xi'
BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
BF_OPENGL_LIB_STATIC = '${BF_OPENGL}/libGL.a ${BF_OPENGL}/libGLU.a ${BF_OPENGL}/libXxf86vm.a ${BF_OPENGL}/libX11.a ${BF_OPENGL}/libXi.a ${BF_OPENGL}/libXext.a ${BF_OPENGL}/libXxf86vm.a'
BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
##
CC = 'gcc'
@@ -179,32 +177,34 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
CPPFLAGS = ['-DXP_UNIX']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
REL_CFLAGS = ['-O3']
REL_CCFLAGS = ['-O3']
##BF_DEPEND = 'true'
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = True
##
##AR = ar
##ARFLAGS = ruv
##ARFLAGSQUIET = ru
##
C_WARN = '-Wall -Wno-char-subscripts -Wdeclaration-after-statement'
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement']
CC_WARN = '-Wall'
CC_WARN = ['-Wall']
##FIX_STUBS_WARNINGS = -Wno-unused
LLIBS = 'util c m dl pthread stdc++'
LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++']
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = 'false'
BF_PROFILE = False
BF_PROFILE_CCFLAGS = ['-pg','-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_DEBUG = 'false'
BF_DEBUG_FLAGS = '-g'
BF_DEBUG = False
BF_DEBUG_CCFLAGS = ['-g']
BF_BUILDDIR = '../build/linux2'
BF_INSTALLDIR='../install/linux2'
BF_DOCDIR='../install/doc'
#Link against pthread

View File

@@ -1,10 +1,10 @@
LCGDIR = '../lib/windows'
LCGDIR = '#../lib/windows'
LIBDIR = '${LCGDIR}'
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE_INCLUDE = "#extern/verse/dist"
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '2.5'
@@ -13,8 +13,8 @@ BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal_static'
@@ -24,10 +24,10 @@ 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'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL'
@@ -38,11 +38,8 @@ BF_PTHREADS_INC = '${BF_PTHREADS}/include'
BF_PTHREADS_LIB = 'pthreadGC2'
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
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 '
@@ -50,15 +47,15 @@ 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'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
@@ -67,32 +64,32 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
#BF_ZLIB_LIB = 'z'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gnu_gettext'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = LIBDIR + '/ftgl'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE = 'false'
WITH_BF_GAMEENGINE = False
WITH_BF_ODE = 'true'
WITH_BF_ODE = True
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = BF_ODE + '/include'
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -101,24 +98,27 @@ BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
BF_WINTAB = LIBDIR + '/wintab'
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
# enable freetype2 support for text objects
BF_FREETYPE = LIBDIR + '/gcc/freetype'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'false'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'false'
WITH_BF_STATICOPENGL = False
BF_OPENGL = 'C:\\MingW'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
@@ -143,8 +143,13 @@ CC_WARN = [ '-Wall' ]
LLIBS = [ '-ldxguid', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz'] #'-lutil', '-lc', '-lm', '-ldl', '-lpthread' ]
BF_DEBUG = 'false'
BF_DEBUG_FLAGS= ''
BF_DEBUG = False
BF_DEBUG_CCFLAGS= []
BF_PROFILE = False
BF_PROFILE_CCFLAGS = ['-pg','-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_BUILDDIR = '../build/linuxcross'
BF_INSTALLDIR='../install/linuxcross'
BF_DOCDIR='../install/doc'

View File

@@ -8,40 +8,37 @@ BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
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'
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'
WITH_BF_SDL = True
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'false'
WITH_BF_STATICOPENEXR = 'false'
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'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = '/usr/local'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = '/usr/local'
BF_PNG_INC = '${BF_PNG}/include/libpng'
BF_PNG_LIB = 'png'
@@ -50,31 +47,31 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = '/usr/local'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr/local'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr/local'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'intl iconv'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='false'
WITH_BF_GAMEENGINE=False
WITH_BF_ODE = 'false'
WITH_BF_ODE = False
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = '${BF_ODE}/include'
BF_ODE_LIB = '${BF_ODE}/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -83,9 +80,9 @@ BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -100,7 +97,7 @@ WITH_BF_YAFRAY = 'true'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_FREETYPE = '/usr/X11R6'
@@ -108,16 +105,16 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
WITH_BF_ICONV = 'false'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'true'
WITH_BF_STATICOPENGL = True
BF_OPENGL = '/usr/X11R6'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIB = 'GL GLU X11 Xi'
@@ -137,7 +134,7 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##BF_DEPEND = True
##
##AR = ar
##ARFLAGS = ruv
@@ -145,21 +142,23 @@ REL_CCFLAGS = ['-O2']
##
CC = 'gcc'
CXX = 'g++'
C_WARN = '-Wall -Wdeclaration-after-statement'
C_WARN = ['-Wdeclaration-after-statement']
CC_WARN = '-Wall'
CC_WARN = ['-Wall']
##FIX_STUBS_WARNINGS = -Wno-unused
LLIBS = 'm stdc++ pthread util'
LLIBS = ['m', 'stdc++', 'pthread', 'util']
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ' -pg -g '
BF_PROFILE = 'false'
BF_PROFILE = False
BF_PROFILE_CCFLAGS = ['-pg','-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_DEBUG = 'false'
BF_DEBUG_FLAGS = '-g'
BF_DEBUG = False
BF_DEBUG_CCFLAGS = ['-g']
BF_BUILDDIR='../build/openbsd3'
BF_INSTALLDIR='../install/openbsd3'
BF_DOCDIR='../install/doc'

View File

@@ -8,8 +8,8 @@ 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']
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = '/usr/local'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
@@ -19,20 +19,17 @@ 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'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIBPATH = '${BF_SDL}/lib'
BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
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'
@@ -40,15 +37,15 @@ 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'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = '/usr/local'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
BF_JPEG_LIB = 'jpeg'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = '/usr/local'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
@@ -57,32 +54,32 @@ BF_PNG_LIB = 'png'
BF_TIFF = '/usr/local'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr/local'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='false'
WITH_BF_GAMEENGINE=False
WITH_BF_ODE = 'false'
WITH_BF_ODE = False
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = BF_ODE + '/include'
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -91,9 +88,9 @@ BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -108,7 +105,7 @@ WITH_BF_YAFRAY = 'true'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_FREETYPE = '/usr/local'
@@ -116,25 +113,25 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
BF_FREETYPE_LIB = 'freetype'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'true'
WITH_BF_ICONV = True
BF_ICONV = "/usr"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# enable ffmpeg support
WITH_BF_FFMPEG = 'false' # -DWITH_FFMPEG
WITH_BF_FFMPEG = False # -DWITH_FFMPEG
BF_FFMPEG = '/usr/local'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avformat avcodec avutil'
BF_FFMPEG_LIB = 'avformat avcodec avutil avdevice'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'false'
WITH_BF_STATICOPENGL = False
BF_OPENGL = '/usr/openwin'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIB = 'GL GLU X11 Xi'
@@ -153,30 +150,32 @@ CPPFLAGS = ['-DXP_UNIX', '-DSUN_OGL_NO_VERTEX_MACROS']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##BF_DEPEND = True
##
##AR = ar
##ARFLAGS = ruv
##ARFLAGSQUIET = ru
##
C_WARN = '-Wall -Wno-char-subscripts -Wdeclaration-after-statement'
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement']
CC_WARN = '-Wall'
CC_WARN = ['-Wall']
##FIX_STUBS_WARNINGS = -Wno-unused
LLIBS = 'c m dl pthread stdc++'
LLIBS = ['c', 'm', 'dl', 'pthread', 'stdc++']
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = 'false'
BF_PROFILE_CCFLAGS = ['-pg', '-g ']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_PROFILE = False
BF_DEBUG = 'false'
BF_DEBUG_FLAGS = ''
BF_DEBUG = False
BF_DEBUG_CCFLAGS = []
BF_BUILDDIR = '../build/sunos5'
BF_INSTALLDIR='../install/sunos5'
BF_DOCDIR='../install/doc'
PLATFORM_LINKFLAGS = ['']
PLATFORM_LINKFLAGS = []

View File

@@ -1,18 +1,20 @@
LCGDIR = '#../lib/windows'
LIBDIR = "${LCGDIR}"
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE_INCLUDE = "#extern/verse/dist"
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '2.5'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/lib25_vs2005'
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/lib25_vs2005/libpython25.a'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'dxguid openal_static'
@@ -20,12 +22,12 @@ 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'
WITH_BF_FFMPEG = False
BF_FFMPEG_LIB = 'avformat swscale avcodec avutil avdevice xvidcore x264'
BF_FFMPEG_LIBPATH = LIBDIR + '/gcc/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/gcc/ffmpeg/include'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL'
@@ -36,11 +38,8 @@ BF_PTHREADS_INC = '${BF_PTHREADS}/include'
BF_PTHREADS_LIB = 'pthreadGC2'
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
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 '
@@ -48,15 +47,15 @@ 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'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
@@ -64,32 +63,34 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'libtiff'
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gnu_gettext'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = LIBDIR + '/ftgl'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE = 'false'
WITH_BF_GAMEENGINE = False
WITH_BF_ODE = 'true'
WITH_BF_ODE = True
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = BF_ODE + '/include'
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -101,9 +102,9 @@ BF_SOLID_LIB = 'extern_solid'
BF_WINTAB = LIBDIR + '/wintab'
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -123,18 +124,18 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'false'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'false'
WITH_BF_STATICOPENGL = False
BF_OPENGL = 'C:\\MingW'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
@@ -153,17 +154,19 @@ CXXFLAGS = ['-pipe', '-mwindows', '-funsigned-char', '-fno-strict-aliasing' ]
REL_CFLAGS = [ '-O2' ]
REL_CCFLAGS = [ '-O2' ]
C_WARN = [ '-Wall' , '-Wno-char-subscripts', '-Wdeclaration-after-statement' ]
C_WARN = [ '-Wno-char-subscripts', '-Wdeclaration-after-statement' ]
CC_WARN = [ '-Wall' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++']
BF_DEBUG = 'false'
BF_DEBUG_FLAGS= '-g'
BF_DEBUG = False
BF_DEBUG_CCFLAGS= ['-g']
BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = 'false'
BF_PROFILE_CCFLAGS = ['-pg', '-g ']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_PROFILE = False
BF_BUILDDIR = '..\\build\\win32-mingw'
BF_INSTALLDIR='..\\install\\win32-mingw'
BF_DOCDIR = '..\\install\\doc'

View File

@@ -1,15 +1,15 @@
LCGDIR = '#../lib/windows'
LIBDIR = '${LCGDIR}'
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE_INCLUDE = "#extern/verse/dist"
# enable ffmpeg support
WITH_BF_FFMPEG = 'false' # -DWITH_FFMPEG
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
BF_FFMPEG = LIBDIR +'/ffmpeg'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avformat-52.lib avcodec-51.lib avdevice-52.lib avutil-49.lib swscale-0.lib'
BF_FFMPEG_LIB = 'avformat-52.lib avcodec-52.lib avdevice-52.lib avutil-50.lib swscale-0.lib'
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '2.5'
@@ -18,8 +18,8 @@ BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
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'
@@ -29,16 +29,16 @@ BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# TODO - are these useful on win32?
# BF_CXX = '/usr'
# WITH_BF_STATICCXX = 'false'
# WITH_BF_STATICCXX = False
# BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_ICONV = 'true'
WITH_BF_ICONV = True
BF_ICONV = LIBDIR + '/iconv'
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL.lib'
@@ -49,27 +49,24 @@ BF_PTHREADS_INC = '${BF_PTHREADS}/include'
BF_PTHREADS_LIB = 'pthreadVC2'
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
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'
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib_vs2008'
# 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'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'libjpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'libpng_st'
@@ -77,33 +74,36 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'libtiff'
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'libz'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gnu_gettext'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = LIBDIR + '/ftgl'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE = 'false'
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_ODE = 'true'
WITH_BF_ODE = True
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = BF_ODE + '/include'
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -115,11 +115,11 @@ BF_SOLID_LIB = 'extern_solid'
BF_WINTAB = LIBDIR + '/wintab'
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
WITH_BF_BINRELOC = 'false'
WITH_BF_BINRELOC = False
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -134,21 +134,31 @@ WITH_BF_BINRELOC = 'false'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_WITH_FREETYPE = True
BF_FREETYPE = LIBDIR + '/freetype'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype2ST'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'true' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = True # -DWITH_QUICKTIME
BF_QUICKTIME = LIBDIR + '/QTDevWin'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
BF_QUICKTIME_LIB = 'qtmlClient'
BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
WITH_BF_STATICOPENGL = 'false'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_REDCODE = False
BF_REDCODE_INC = '#extern'
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
BF_OPENGL_LIB = 'opengl32 glu32'
@@ -158,30 +168,41 @@ BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'
CC = 'cl.exe'
CXX = 'cl.exe'
CCFLAGS = ['/nologo', '/Og', '/Ot', '/Ob1', '/Op', '/G6','/EHsc', '/J', '/W3', '/Gd', '/MT']
CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/MT']
CXXFLAGS = ['/EHsc']
BF_DEBUG_FLAGS = ['/Zi', '/FR${TARGET}.sbr']
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
REL_CFLAGS = ['-O2', '-DNDEBUG']
REL_CCFLAGS = ['-O2', '-DNDEBUG']
REL_CXXFLAGS = ['-O2', '-DNDEBUG']
C_WARN = []
CC_WARN = []
CXX_WARN = []
LLIBS = 'ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid'
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
PLATFORM_LINKFLAGS = '''
/SUBSYSTEM:CONSOLE
/MACHINE:IX86
/ENTRY:mainCRTStartup
/INCREMENTAL:NO
/NODEFAULTLIB:"msvcprt.lib"
/NODEFAULTLIB:"glut32.lib"
/NODEFAULTLIB:"libc.lib"
/NODEFAULTLIB:"libcd.lib"
/NODEFAULTLIB:"libcpd.lib"
/NODEFAULTLIB:"libcp.lib"
'''
/SUBSYSTEM:CONSOLE
/MACHINE:IX86
/ENTRY:mainCRTStartup
/INCREMENTAL:NO
/NODEFAULTLIB:"msvcprt.lib"
/NODEFAULTLIB:"glut32.lib"
/NODEFAULTLIB:"libc.lib"
/NODEFAULTLIB:"libcd.lib"
/NODEFAULTLIB:"libcpd.lib"
/NODEFAULTLIB:"libcp.lib"
/LARGEADDRESSAWARE
'''
# # Todo
# BF_PROFILE_CCFLAGS = ['-pg', '-g ']
# BF_PROFILE_LINKFLAGS = ['-pg']
# BF_PROFILE = False
BF_BUILDDIR = '..\\build\\win32-vc'
BF_INSTALLDIR='..\\install\\win32-vc'
BF_DOCDIR='..\\install\\doc'

View File

@@ -1,9 +1,5 @@
$Id$
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
============================
@@ -30,8 +26,9 @@ $Id$
----------------
To build Blender with the SCons scripts you need a full Python
install, version 2.4 or later (http://www.python.org) and a SCons
installation, version v0.97 (http://www.scons.org).
install, version 2.4 or later (http://www.python.org). We already provide
a scons-local installation, which can be found in the scons/ subdirectory.
This document uses the scons-local installation for its examples.
Check from the page
http://www.blender.org/development/building-blender/getting-dependencies/
@@ -42,9 +39,14 @@ $Id$
In the base directory of the sources (from now on called $BLENDERHOME)
you'll see a file named SConstruct. This is the entry point for the
SCons build system. In a terminal, change to this directory. To just
build, issue the command 'scons':
build, start the SCons entry script on Windows (will be used for the remainder
of this document):
% scons
% python scons\scons.py
On a Unix-compatible system it would be
% python ./scons/scons.py
This will start the build process with default values. Depending
on your platform you may see colour in your output (non-Windows
@@ -53,11 +55,19 @@ $Id$
build are configured.
The build uses BF_BUILDDIR to build into and BF_INSTALLDIR to
finally copy all needed files to get a proper setup. These
variabbles have default values for every platform in
finally copy all needed files to get a proper setup. The BF_DOCDIR is
used to generate Blender Python documentation files to. These
variables have default values for every platform in
$BLENDERHOME/config/(platform)-config.py. After the build successfully
completes, you can find everything you need in BF_INSTALLDIR.
If you want to create the installer package of Blender on Windows you'll
need to install nullsoft scriptable install system from http://nsis.sf.net.
As an extra dependency, you need the MoreInfo plugin too. The creation of
the installer is tied into the build process and can be triggered with:
% python scons\scons.py nsis
Configuring the build
---------------------
@@ -73,20 +83,21 @@ $Id$
(TBD: add cygwin, solaris and freebsd support)
These files you will normally not change. If you need to override
a default value, make a copy of the proper configuration to
$BLENDERHOME/user-config.py. This file you can modify to your
likings. Any value set here will override the ones from the
(platform)-config.py.
a default value, make a file called $BLENDERHOME/user-config.py, and copy
settings from the config/(platform)-config.py that you want to change. Don't
copy the entire file (unless explicitely stated in the configuration file),
because you may not get updated options you don't change yourself, which may
result in build errors.
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
% python scons\scons.py BF_CONFIG=myownsettings
If you want to quickly test a new setting, you can give the option
also on the command-line:
% scons BF_BUILDDIR=../mybuilddir WITH_BF_OPENEXR=0
% python scons\scons.py BF_BUILDDIR=../mybuilddir WITH_BF_OPENEXR=0
This command sets the build directory to BF_BUILDDIR and disables
OpenEXR support.
@@ -94,7 +105,7 @@ $Id$
If you need to know what can be set through the command-line, run
scons with -h:
% scons -h
% python scons\scons.py -h
This command will print a long list with settable options and what
every option means. Many of the default values will be empty, and
@@ -115,11 +126,11 @@ $Id$
you need to see the full command-line for compiles, then you can
change that behaviour. Also the use of colours can be changed:
% scons BF_FANCY=0
% python scons\scons.py BF_FANCY=0
This will disable the use of colours.
% scons BF_QUIET=0
% python scons\scons.py BF_QUIET=0
This will give the old, noisy output. Every command-line per
compile is printed out in its full glory. This is very useful when
@@ -130,11 +141,11 @@ $Id$
Compiling Only Some Libraries
-----------------------------
Scons now has support for specifying a list of libraries that are
Our implementation now has support for specifying a list of libraries that are
exclusively compiled, ignoring all other libraries. This is invoked
with the BF_QUICK arguments; for example:
% scons BF_QUICK=src,bf_blenkernel
% python scons\scons.py BF_QUICK=src,bf_blenkernel
Note that this not the same as passing a list of folders as in the
makefile's "quicky" command. In Scons, all of Blender's code modules
@@ -154,7 +165,7 @@ $Id$
BF_QUICKDEBUG is similar to BF_QUICK:
% scons BF_QUICKDEBUG=src,bf_blenkernel,some-other-lib
% python scons\scons.py BF_QUICKDEBUG=src,bf_blenkernel,some-other-lib
To use BF_DEBUG_LIBS, put something like the following in you user-config.py:
@@ -166,18 +177,6 @@ $Id$
debug symbols. Also note that BF_QUICKDEBUG and BF_DEBUG_LIBS are combined;
for example, setting BF_QUICKDEBUG won't overwrite the contents of BF_DEBUG_LIBS.
Not installing
--------------
If you dont want to install the build result, you can use the following option either
on the commandline or in your user-config.py :
WITHOUT_BF_INSTALL='true'
by default, this is set to 'false', and so the build is installed
Supported toolset
-----------------
@@ -193,15 +192,8 @@ $Id$
On Windows with all of the three toolset installed you need to
specify what toolset to use
% scons BF_TOOLSET=msvc
% scons BF_TOOLSET=mstoolkit
% scons BF_TOOLSET=mingw
If you have only the toolkit installed, you will also need to give
BF_TOOLSET=mstoolkit on the command-line, to make sure everything is
setup properly. Currently there is no good mechanism to automatically
determine wether the found 'cl.exe' is from the toolkit or from a
complete install.
% python scons\scons.py BF_TOOLSET=msvc
% python scons\scons.py BF_TOOLSET=mingw
LINUX and OS X
@@ -214,30 +206,26 @@ $Id$
Build Blender with the defaults:
% scons
% python scons\scons.py
Build Blender, but disable OpenEXR support:
% scons WITH_BF_OPENEXR=0
% python scons\scons.py WITH_BF_OPENEXR=0
Build Blender, enable debug symbols:
% scons BF_DEBUG=1
% python scons\scons.py BF_DEBUG=1
Build Blender, install to different directory:
% scons BF_INSTALLDIR=/tmp/testbuild
% python scons\scons.py BF_INSTALLDIR=../myown/installdir
Build Blender in /tmp/obj and install to /usr/local:
Build Blender in ../myown/builddir and install to ../myown/installdir:
% scons BF_BUILDDIR=/tmp/obj BF_INSTALLDIR=/usr/local
% python scons\scons.py BF_BUILDDIR=../myown/builddir BF_INSTALLDIR=../myown/installdir
Clean BF_BUILDDIR:
% scons clean
Clean out the installed files:
% scons -c
% python scons\scons.py clean
/Nathan Letwory (jesterKing)

View File

@@ -29,7 +29,7 @@ IF(WITH_GAMEENGINE)
ENDIF(WITH_GAMEENGINE)
IF(WITH_BULLET)
SUBDIRS(bullet2)
SUBDIRS(bullet2)
ENDIF(WITH_BULLET)
IF(WITH_INTERNATIONAL)
@@ -46,3 +46,6 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SUBDIRS(glew)
IF(WITH_OPENJPEG)
SUBDIRS(libopenjpeg)
ENDIF(WITH_OPENJPEG)

7
extern/Makefile vendored
View File

@@ -57,11 +57,12 @@ ifeq ($(WITH_BINRELOC), true)
DIRS += binreloc
endif
TARGET =
ifneq ($(OS),irix)
TARGET=solid
ifeq ($(WITH_OPENJPEG), true)
DIRS += libopenjpeg
endif
TARGET = solid
all::
@[ -d $(OCGDIR)/extern ] || mkdir -p $(OCGDIR)/extern
@for i in $(DIRS); do \

7
extern/SConscript vendored
View File

@@ -5,8 +5,8 @@ Import('env')
SConscript(['glew/SConscript'])
if env['WITH_BF_GAMEENGINE']:
SConscript(['qhull/SConscript',
'solid/SConscript'])
if env['WITH_BF_SOLID']:
SConscript(['qhull/SConscript', 'solid/SConscript'])
if env['WITH_BF_BULLET']:
SConscript(['bullet2/src/SConscript'])
@@ -31,3 +31,6 @@ if env['WITH_BF_REDCODE'] and env['BF_REDCODE_LIB'] == '':
if env['OURPLATFORM'] == 'linux2':
SConscript(['binreloc/SConscript']);
# FFTW not needed atm - dg
# SConscript(['fftw/SConscript'])

View File

@@ -4,24 +4,6 @@ import os
Import('env')
# Import the C flags set in the SConstruct file
#Import ('cflags')
#Import ('defines')
#Import ('user_options_dict')
#if sys.platform=='linux2' or sys.platform=='linux-i386':
# ftgl_env.Append (CCFLAGS = ['-O2', '-ansi'])
#elif sys.platform=='win32':
#ftgl_env.Append (CCFLAGS = ['/O2'])
#elif sys.platform=='sunos':
# ftgl_env.Append (CCFLAGS = ['Xc', '-v', '-fast'])
#elif sys.platform=='darwin':
# ftgl_env.Append (CCFLAGS = ['-O2', '-pipe', '-fPIC', '-funsigned-char', '-ffast-math'])
#else:
# ftgl_env.Append (CCFLAGS = cflags)
#ftgl_env.Append (CPPDEFINES = defines)
incs = 'include src ' + env['BF_FREETYPE_INC'] + ' ' + env['BF_OPENGL_INC']
defs = ''

View File

@@ -0,0 +1,537 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="EXT_ftgl_static_lib"
ProjectGUID="{F9850C15-FF0A-429E-9D47-89FB433C9BD8}"
RootNamespace="ftgl_static_lib"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Blender Debug|Win32"
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\ftgl\debug"
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\ftgl\debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;..\..\..\..\..\lib\windows\freetype\include"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;FTGL_LIBRARY_STATIC"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\ftgl\debug\ftgl_static_lib.pch"
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\ftgl\debug\"
ObjectFile="..\..\..\..\..\build\msvc_9\extern\ftgl\debug\"
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\ftgl\debug\"
WarningLevel="2"
SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\debug\ftgl_static.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copying FTGL files library (debug target) to lib tree."
CommandLine="ECHO Copying header files&#x0D;&#x0A;IF NOT EXIST ..\..\..\..\..\build\msvc_9\extern\ftgl\include\ MKDIR ..\..\..\..\..\build\msvc_9\extern\ftgl\include&#x0D;&#x0A;XCOPY /Y ..\..\include\*.h ..\..\..\..\..\build\msvc_9\extern\ftgl\include&#x0D;&#x0A;ECHO Done&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Blender Release|Win32"
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\ftgl"
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\ftgl"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include;..\..\..\..\..\lib\windows\freetype\include"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;FTGL_LIBRARY_STATIC"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\ftgl\ftgl_static_lib.pch"
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\ftgl\"
ObjectFile="..\..\..\..\..\build\msvc_9\extern\ftgl\"
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\ftgl\"
WarningLevel="2"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\ftgl_static.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copying FTGL files library to lib tree."
CommandLine="ECHO Copying header files&#x0D;&#x0A;IF NOT EXIST ..\..\..\..\..\build\msvc_9\extern\ftgl\include\ MKDIR ..\..\..\..\..\build\msvc_9\extern\ftgl\include&#x0D;&#x0A;XCOPY /Y ..\..\include\*.h ..\..\..\..\..\build\msvc_9\extern\ftgl\include&#x0D;&#x0A;ECHO Done&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="3D Plugin Release|Win32"
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll"
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include;..\..\..\..\..\lib\windows\freetype\include"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;FTGL_LIBRARY_STATIC"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\ftgl_static_lib.pch"
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\"
ObjectFile="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\"
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\"
WarningLevel="2"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\mtdll\ftgl_static.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copying FTGL files library to lib tree."
CommandLine="ECHO Copying header files&#x0D;&#x0A;IF NOT EXIST ..\..\..\..\..\build\msvc_9\extern\ftgl\include\ MKDIR ..\..\..\..\..\build\msvc_9\extern\ftgl\include&#x0D;&#x0A;XCOPY /Y ..\..\include\*.h ..\..\..\..\..\build\msvc_9\extern\ftgl\include&#x0D;&#x0A;ECHO Done&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="3D Plugin Debug|Win32"
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\debug"
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;..\..\..\..\..\lib\windows\freetype\include"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;FTGL_LIBRARY_STATIC"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\debug\ftgl_static_lib.pch"
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\debug\"
ObjectFile="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\debug\"
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\ftgl\mtdll\debug\"
WarningLevel="2"
SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\mtdll\debug\ftgl_static.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copying FTGL files library (debug target) to lib tree."
CommandLine="ECHO Copying header files&#x0D;&#x0A;IF NOT EXIST ..\..\..\..\..\build\msvc_9\extern\ftgl\include\ MKDIR ..\..\..\..\..\build\msvc_9\extern\ftgl\include&#x0D;&#x0A;XCOPY /Y ..\..\include\*.h ..\..\..\..\..\build\msvc_9\extern\ftgl\include&#x0D;&#x0A;ECHO Done&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\..\src\FTBitmapGlyph.cpp"
>
</File>
<File
RelativePath="..\..\src\FTCharmap.cpp"
>
</File>
<File
RelativePath="..\..\src\FTContour.cpp"
>
</File>
<File
RelativePath="..\..\src\FTExtrdGlyph.cpp"
>
</File>
<File
RelativePath="..\..\src\FTFace.cpp"
>
</File>
<File
RelativePath="..\..\src\FTFont.cpp"
>
</File>
<File
RelativePath="..\..\src\FTGLBitmapFont.cpp"
>
</File>
<File
RelativePath="..\..\src\FTGLExtrdFont.cpp"
>
</File>
<File
RelativePath="..\..\src\FTGLOutlineFont.cpp"
>
</File>
<File
RelativePath="..\..\src\FTGLPixmapFont.cpp"
>
</File>
<File
RelativePath="..\..\src\FTGLPolygonFont.cpp"
>
</File>
<File
RelativePath="..\..\src\FTGLTextureFont.cpp"
>
</File>
<File
RelativePath="..\..\src\FTGlyph.cpp"
>
</File>
<File
RelativePath="..\..\src\FTGlyphContainer.cpp"
>
</File>
<File
RelativePath="..\..\src\FTLibrary.cpp"
>
</File>
<File
RelativePath="..\..\src\FTOutlineGlyph.cpp"
>
</File>
<File
RelativePath="..\..\src\FTPixmapGlyph.cpp"
>
</File>
<File
RelativePath="..\..\src\FTPoint.cpp"
>
</File>
<File
RelativePath="..\..\src\FTPolyGlyph.cpp"
>
</File>
<File
RelativePath="..\..\src\FTSize.cpp"
>
</File>
<File
RelativePath="..\..\src\FTTextureGlyph.cpp"
>
</File>
<File
RelativePath="..\..\src\FTVectoriser.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\..\include\FTBBox.h"
>
</File>
<File
RelativePath="..\..\include\FTBitmapGlyph.h"
>
</File>
<File
RelativePath="..\..\include\FTCharmap.h"
>
</File>
<File
RelativePath="..\..\include\FTCharToGlyphIndexMap.h"
>
</File>
<File
RelativePath="..\..\include\FTContour.h"
>
</File>
<File
RelativePath="..\..\include\FTExtrdGlyph.h"
>
</File>
<File
RelativePath="..\..\include\FTFace.h"
>
</File>
<File
RelativePath="..\..\include\FTFont.h"
>
</File>
<File
RelativePath="..\..\include\FTGL.h"
>
</File>
<File
RelativePath="..\..\include\FTGLBitmapFont.h"
>
</File>
<File
RelativePath="..\..\include\FTGLExtrdFont.h"
>
</File>
<File
RelativePath="..\..\include\FTGLOutlineFont.h"
>
</File>
<File
RelativePath="..\..\include\FTGLPixmapFont.h"
>
</File>
<File
RelativePath="..\..\include\FTGLPolygonFont.h"
>
</File>
<File
RelativePath="..\..\include\FTGLTextureFont.h"
>
</File>
<File
RelativePath="..\..\include\FTGlyph.h"
>
</File>
<File
RelativePath="..\..\include\FTGlyphContainer.h"
>
</File>
<File
RelativePath="..\..\include\FTLibrary.h"
>
</File>
<File
RelativePath="..\..\include\FTList.h"
>
</File>
<File
RelativePath="..\..\include\FTOutlineGlyph.h"
>
</File>
<File
RelativePath="..\..\include\FTPixmapGlyph.h"
>
</File>
<File
RelativePath="..\..\include\FTPoint.h"
>
</File>
<File
RelativePath="..\..\include\FTPolyGlyph.h"
>
</File>
<File
RelativePath="..\..\include\FTSize.h"
>
</File>
<File
RelativePath="..\..\include\FTTextureGlyph.h"
>
</File>
<File
RelativePath="..\..\include\FTVector.h"
>
</File>
<File
RelativePath="..\..\include\FTVectoriser.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -31,6 +31,7 @@ FILE(GLOB SRC
src/BulletCollision/BroadphaseCollision/*.cpp
src/BulletCollision/CollisionShapes/*.cpp
src/BulletCollision/NarrowPhaseCollision/*.cpp
src/BulletCollision/Gimpact/*.cpp
src/BulletCollision//CollisionDispatch/*.cpp
src/BulletDynamics/ConstraintSolver/*.cpp
src/BulletDynamics/Vehicle/*.cpp

View File

@@ -37,6 +37,7 @@ LinearMath \
BulletCollision/BroadphaseCollision \
BulletCollision/CollisionShapes \
BulletCollision/NarrowPhaseCollision \
BulletCollision/Gimpact \
BulletCollision//CollisionDispatch \
BulletDynamics/ConstraintSolver \
BulletDynamics/Vehicle \

View File

@@ -53,6 +53,7 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\Gimpact MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\Gimpact
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\ConstraintSolver MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
@@ -61,13 +62,14 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR
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\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
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
XCOPY /Y ..\..\src\BulletCollision\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
XCOPY /Y ..\..\src\BulletCollision\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
XCOPY /Y ..\..\src\BulletCollision\Gimpact\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\Gimpact
XCOPY /Y ..\..\src\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
XCOPY /Y ..\..\src\BulletDynamics\Dynamics\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
XCOPY /Y ..\..\src\BulletDynamics\Vehicle\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
@@ -135,19 +137,23 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\Gimpact MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\Gimpact
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\ConstraintSolver MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
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\BulletSoftBody\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
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
XCOPY /Y ..\..\src\BulletCollision\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
XCOPY /Y ..\..\src\BulletCollision\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
XCOPY /Y ..\..\src\BulletCollision\Gimpact\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\Gimpact
XCOPY /Y ..\..\src\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
XCOPY /Y ..\..\src\BulletDynamics\Dynamics\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
XCOPY /Y ..\..\src\BulletDynamics\Vehicle\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
@@ -213,19 +219,23 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\Gimpact MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\Gimpact
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\ConstraintSolver MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
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\BulletSoftBody\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
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
XCOPY /Y ..\..\src\BulletCollision\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
XCOPY /Y ..\..\src\BulletCollision\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
XCOPY /Y ..\..\src\BulletCollision\Gimpact\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\Gimpact
XCOPY /Y ..\..\src\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
XCOPY /Y ..\..\src\BulletDynamics\Dynamics\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
XCOPY /Y ..\..\src\BulletDynamics\Vehicle\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
@@ -293,19 +303,23 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletCollision\Gimpact MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\Gimpact
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\ConstraintSolver MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
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\BulletSoftBody\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
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
XCOPY /Y ..\..\src\BulletCollision\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionDispatch
XCOPY /Y ..\..\src\BulletCollision\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\CollisionShapes
XCOPY /Y ..\..\src\BulletCollision\Gimpact\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\Gimpact
XCOPY /Y ..\..\src\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\ConstraintSolver
XCOPY /Y ..\..\src\BulletDynamics\Dynamics\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
XCOPY /Y ..\..\src\BulletDynamics\Vehicle\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
@@ -962,6 +976,124 @@ ECHO Done
RelativePath="..\..\src\BulletCollision\CollisionShapes\btUniformScalingShape.h">
</File>
</Filter>
<Filter
Name="Gimpact"
Filter="">
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btBoxCollision.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btClipPolygon.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btContactProcessing.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btContactProcessing.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGenericPoolAllocator.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGenericPoolAllocator.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGeometryOperations.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGImpactBvh.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGImpactBvh.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGImpactCollisionAlgorithm.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGImpactCollisionAlgorithm.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGImpactMassUtil.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGImpactQuantizedBvh.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGImpactQuantizedBvh.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGImpactShape.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btGImpactShape.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btQuantization.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btTriangleShapeEx.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\btTriangleShapeEx.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_array.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_basic_geometry_operations.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_bitset.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_box_collision.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_box_set.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_box_set.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_clip_polygon.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_contact.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_contact.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_geom_types.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_geometry.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_hash_table.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_linear_math.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_math.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_memory.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_memory.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_radixsort.h">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_tri_collision.cpp">
</File>
<File
RelativePath="..\..\src\BulletCollision\Gimpact\gim_tri_collision.h">
</File>
</Filter>
</Filter>
<Filter
Name="LinearMath"

1525
extern/bullet2/make/msvc_9_0/Bullet.vcproj vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -38,37 +38,37 @@ typedef plReal plQuaternion[4];
extern "C" {
#endif
/* Particular physics SDK */
/** Particular physics SDK (C-API) */
PL_DECLARE_HANDLE(plPhysicsSdkHandle);
/* Dynamics world, belonging to some physics SDK */
/** Dynamics world, belonging to some physics SDK (C-API)*/
PL_DECLARE_HANDLE(plDynamicsWorldHandle);
/* Rigid Body that can be part of a Dynamics World */
/** Rigid Body that can be part of a Dynamics World (C-API)*/
PL_DECLARE_HANDLE(plRigidBodyHandle);
/* Collision Shape/Geometry, property of a Rigid Body */
/** Collision Shape/Geometry, property of a Rigid Body (C-API)*/
PL_DECLARE_HANDLE(plCollisionShapeHandle);
/* Constraint for Rigid Bodies */
/** Constraint for Rigid Bodies (C-API)*/
PL_DECLARE_HANDLE(plConstraintHandle);
/* Triangle Mesh interface */
/** Triangle Mesh interface (C-API)*/
PL_DECLARE_HANDLE(plMeshInterfaceHandle);
/* Broadphase Scene/Proxy Handles */
/** Broadphase Scene/Proxy Handles (C-API)*/
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 */
/** 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);

View File

@@ -19,10 +19,9 @@
// 3. This notice may not be removed or altered from any source distribution.
#include "btAxisSweep3.h"
#include <assert.h>
btAxisSweep3::btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned short int maxHandles, btOverlappingPairCache* pairCache)
:btAxisSweep3Internal<unsigned short int>(worldAabbMin,worldAabbMax,0xfffe,0xffff,maxHandles,pairCache)
btAxisSweep3::btAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned short int maxHandles, btOverlappingPairCache* pairCache, bool disableRaycastAccelerator)
:btAxisSweep3Internal<unsigned short int>(worldAabbMin,worldAabbMax,0xfffe,0xffff,maxHandles,pairCache,disableRaycastAccelerator)
{
// 1 handle is reserved as sentinel
btAssert(maxHandles > 1 && maxHandles < 32767);
@@ -30,8 +29,8 @@ btAxisSweep3::btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAab
}
bt32BitAxisSweep3::bt32BitAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned int maxHandles , btOverlappingPairCache* pairCache )
:btAxisSweep3Internal<unsigned int>(worldAabbMin,worldAabbMax,0xfffffffe,0x7fffffff,maxHandles,pairCache)
bt32BitAxisSweep3::bt32BitAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned int maxHandles , btOverlappingPairCache* pairCache , bool disableRaycastAccelerator)
:btAxisSweep3Internal<unsigned int>(worldAabbMin,worldAabbMax,0xfffffffe,0x7fffffff,maxHandles,pairCache,disableRaycastAccelerator)
{
// 1 handle is reserved as sentinel
btAssert(maxHandles > 1 && maxHandles < 2147483647);

View File

@@ -19,12 +19,12 @@
#ifndef AXIS_SWEEP_3_H
#define AXIS_SWEEP_3_H
#include "LinearMath/btPoint3.h"
#include "LinearMath/btVector3.h"
#include "btOverlappingPairCache.h"
#include "btBroadphaseInterface.h"
#include "btBroadphaseProxy.h"
#include "btOverlappingPairCallback.h"
#include "btDbvtBroadphase.h"
//#define DEBUG_BROADPHASE 1
#define USE_OVERLAP_TEST_ON_REMOVES 1
@@ -42,6 +42,7 @@ protected:
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
class Edge
{
@@ -61,8 +62,7 @@ public:
// indexes into the edge arrays
BP_FP_INT_TYPE m_minEdges[3], m_maxEdges[3]; // 6 * 2 = 12
// BP_FP_INT_TYPE m_uniqueId;
BP_FP_INT_TYPE m_pad;
btBroadphaseProxy* m_dbvtProxy;//for faster raycast
//void* m_pOwner; this is now in btBroadphaseProxy.m_clientObject
SIMD_FORCE_INLINE void SetNextFree(BP_FP_INT_TYPE next) {m_minEdges[0] = next;}
@@ -71,8 +71,8 @@ public:
protected:
btPoint3 m_worldAabbMin; // overall system bounds
btPoint3 m_worldAabbMax; // overall system bounds
btVector3 m_worldAabbMin; // overall system bounds
btVector3 m_worldAabbMax; // overall system bounds
btVector3 m_quantize; // scaling factor for quantization
@@ -94,6 +94,12 @@ protected:
int m_invalidPair;
///additional dynamic aabb structure, used to accelerate ray cast queries.
///can be disabled using a optional argument in the constructor
btDbvtBroadphase* m_raycastAccelerator;
btOverlappingPairCache* m_nullPairCache;
// allocation/deallocation
BP_FP_INT_TYPE allocHandle();
void freeHandle(BP_FP_INT_TYPE handle);
@@ -108,7 +114,7 @@ protected:
//Overlap* AddOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB);
//void RemoveOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB);
void quantize(BP_FP_INT_TYPE* out, const btPoint3& point, int isMax) const;
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 );
@@ -117,7 +123,7 @@ protected:
public:
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);
btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE maxHandles = 16384, btOverlappingPairCache* pairCache=0,bool disableRaycastAccelerator = false);
virtual ~btAxisSweep3Internal();
@@ -128,17 +134,26 @@ public:
virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
BP_FP_INT_TYPE addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy);
BP_FP_INT_TYPE addHandle(const btVector3& aabbMin,const btVector3& 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);
void updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher);
SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const {return m_pHandles + index;}
virtual void resetPool(btDispatcher* dispatcher);
void processAllOverlappingPairs(btOverlapCallback* callback);
//Broadphase Interface
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);
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0));
void quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const;
///unQuantize should be conservative: aabbMin/aabbMax should be larger then 'getAabb' result
void unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
@@ -206,7 +221,7 @@ void btAxisSweep3<BP_FP_INT_TYPE>::debugPrintAxis(int axis, bool checkCardinalit
}
if (checkCardinality)
assert(numEdges == m_numHandles*2+1);
btAssert(numEdges == m_numHandles*2+1);
}
#endif //DEBUG_BROADPHASE
@@ -217,7 +232,12 @@ btBroadphaseProxy* btAxisSweep3Internal<BP_FP_INT_TYPE>::createProxy( const btV
BP_FP_INT_TYPE handleId = addHandle(aabbMin,aabbMax, userPtr,collisionFilterGroup,collisionFilterMask,dispatcher,multiSapProxy);
Handle* handle = getHandle(handleId);
if (m_raycastAccelerator)
{
btBroadphaseProxy* rayProxy = m_raycastAccelerator->createProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,dispatcher,0);
handle->m_dbvtProxy = rayProxy;
}
return handle;
}
@@ -227,6 +247,8 @@ template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
{
Handle* handle = static_cast<Handle*>(proxy);
if (m_raycastAccelerator)
m_raycastAccelerator->destroyProxy(handle->m_dbvtProxy,dispatcher);
removeHandle(static_cast<BP_FP_INT_TYPE>(handle->m_uniqueId), dispatcher);
}
@@ -234,22 +256,80 @@ 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);
handle->m_aabbMin = aabbMin;
handle->m_aabbMax = aabbMax;
updateHandle(static_cast<BP_FP_INT_TYPE>(handle->m_uniqueId), aabbMin, aabbMax,dispatcher);
if (m_raycastAccelerator)
m_raycastAccelerator->setAabb(handle->m_dbvtProxy,aabbMin,aabbMax,dispatcher);
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax)
{
if (m_raycastAccelerator)
{
m_raycastAccelerator->rayTest(rayFrom,rayTo,rayCallback,aabbMin,aabbMax);
} else
{
//choose axis?
BP_FP_INT_TYPE axis = 0;
//for each proxy
for (BP_FP_INT_TYPE i=1;i<m_numHandles*2+1;i++)
{
if (m_pEdges[axis][i].IsMax())
{
rayCallback.process(getHandle(m_pEdges[axis][i].m_handle));
}
}
}
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const
{
Handle* pHandle = static_cast<Handle*>(proxy);
aabbMin = pHandle->m_aabbMin;
aabbMax = pHandle->m_aabbMax;
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const
{
Handle* pHandle = static_cast<Handle*>(proxy);
unsigned short vecInMin[3];
unsigned short vecInMax[3];
vecInMin[0] = m_pEdges[0][pHandle->m_minEdges[0]].m_pos ;
vecInMax[0] = m_pEdges[0][pHandle->m_maxEdges[0]].m_pos +1 ;
vecInMin[1] = m_pEdges[1][pHandle->m_minEdges[1]].m_pos ;
vecInMax[1] = m_pEdges[1][pHandle->m_maxEdges[1]].m_pos +1 ;
vecInMin[2] = m_pEdges[2][pHandle->m_minEdges[2]].m_pos ;
vecInMax[2] = m_pEdges[2][pHandle->m_maxEdges[2]].m_pos +1 ;
aabbMin.setValue((btScalar)(vecInMin[0]) / (m_quantize.getX()),(btScalar)(vecInMin[1]) / (m_quantize.getY()),(btScalar)(vecInMin[2]) / (m_quantize.getZ()));
aabbMin += m_worldAabbMin;
aabbMax.setValue((btScalar)(vecInMax[0]) / (m_quantize.getX()),(btScalar)(vecInMax[1]) / (m_quantize.getY()),(btScalar)(vecInMax[2]) / (m_quantize.getZ()));
aabbMax += m_worldAabbMin;
}
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 )
btAxisSweep3Internal<BP_FP_INT_TYPE>::btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE userMaxHandles, btOverlappingPairCache* pairCache , bool disableRaycastAccelerator)
:m_bpHandleMask(handleMask),
m_handleSentinel(handleSentinel),
m_pairCache(pairCache),
m_userPairCallback(0),
m_ownsPairCache(false),
m_invalidPair(0)
m_invalidPair(0),
m_raycastAccelerator(0)
{
BP_FP_INT_TYPE maxHandles = static_cast<BP_FP_INT_TYPE>(userMaxHandles+1);//need to add one sentinel handle
@@ -260,7 +340,14 @@ m_invalidPair(0)
m_ownsPairCache = true;
}
//assert(bounds.HasVolume());
if (!disableRaycastAccelerator)
{
m_nullPairCache = new (btAlignedAlloc(sizeof(btNullPairCache),16)) btNullPairCache();
m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroadphase),16)) btDbvtBroadphase(m_nullPairCache);//m_pairCache);
m_raycastAccelerator->m_deferedcollide = true;//don't add/remove pairs
}
//btAssert(bounds.HasVolume());
// init bounds
m_worldAabbMin = worldAabbMin;
@@ -320,7 +407,14 @@ m_invalidPair(0)
template <typename BP_FP_INT_TYPE>
btAxisSweep3Internal<BP_FP_INT_TYPE>::~btAxisSweep3Internal()
{
if (m_raycastAccelerator)
{
m_nullPairCache->~btOverlappingPairCache();
btAlignedFree(m_nullPairCache);
m_raycastAccelerator->~btDbvtBroadphase();
btAlignedFree (m_raycastAccelerator);
}
for (int i = 2; i >= 0; i--)
{
btAlignedFree(m_pEdgesRawPtr[i]);
@@ -335,27 +429,31 @@ btAxisSweep3Internal<BP_FP_INT_TYPE>::~btAxisSweep3Internal()
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::quantize(BP_FP_INT_TYPE* out, const btPoint3& point, int isMax) const
void btAxisSweep3Internal<BP_FP_INT_TYPE>::quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const
{
btPoint3 clampedPoint(point);
#ifdef OLD_CLAMPING_METHOD
///problem with this clamping method is that the floating point during quantization might still go outside the range [(0|isMax) .. (m_handleSentinel&m_bpHandleMask]|isMax]
///see http://code.google.com/p/bullet/issues/detail?id=87
btVector3 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);
#else
btVector3 v = (point - m_worldAabbMin) * m_quantize;
out[0]=(v[0]<=0)?(BP_FP_INT_TYPE)isMax:(v[0]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[0]&m_bpHandleMask)|isMax);
out[1]=(v[1]<=0)?(BP_FP_INT_TYPE)isMax:(v[1]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[1]&m_bpHandleMask)|isMax);
out[2]=(v[2]<=0)?(BP_FP_INT_TYPE)isMax:(v[2]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[2]&m_bpHandleMask)|isMax);
#endif //OLD_CLAMPING_METHOD
}
template <typename BP_FP_INT_TYPE>
BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::allocHandle()
{
assert(m_firstFreeHandle);
btAssert(m_firstFreeHandle);
BP_FP_INT_TYPE handle = m_firstFreeHandle;
m_firstFreeHandle = getHandle(handle)->GetNextFree();
@@ -367,7 +465,7 @@ BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::allocHandle()
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::freeHandle(BP_FP_INT_TYPE handle)
{
assert(handle > 0 && handle < m_maxHandles);
btAssert(handle > 0 && handle < m_maxHandles);
getHandle(handle)->SetNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle;
@@ -377,7 +475,7 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::freeHandle(BP_FP_INT_TYPE handle)
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)
BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::addHandle(const btVector3& aabbMin,const btVector3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy)
{
// quantize the bounds
BP_FP_INT_TYPE min[3], max[3];
@@ -440,7 +538,7 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::removeHandle(BP_FP_INT_TYPE handle,bt
//explicitly remove the pairs containing the proxy
//we could do it also in the sortMinUp (passing true)
//todo: compare performance
///@todo: compare performance
if (!m_pairCache->hasDeferredRemoval())
{
m_pairCache->removeOverlappingPairsContainingProxy(pHandle,dispatcher);
@@ -489,6 +587,21 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::removeHandle(BP_FP_INT_TYPE handle,bt
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::resetPool(btDispatcher* dispatcher)
{
if (m_numHandles == 0)
{
m_firstFreeHandle = 1;
{
for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < m_maxHandles; i++)
m_pHandles[i].SetNextFree(static_cast<BP_FP_INT_TYPE>(i + 1));
m_pHandles[m_maxHandles - 1].SetNextFree(0);
}
}
}
extern int gOverlappingPairs;
//#include <stdio.h>
@@ -529,6 +642,7 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::calculateOverlappingPairs(btDispatche
if (!isDuplicate)
{
///important to use an AABB test that is consistent with the broadphase
bool hasOverlap = testAabbOverlap(pair.m_pProxy0,pair.m_pProxy1);
if (hasOverlap)
@@ -574,10 +688,6 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::calculateOverlappingPairs(btDispatche
//printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size());
}
}
@@ -616,10 +726,10 @@ bool btAxisSweep3Internal<BP_FP_INT_TYPE>::testOverlap2D(const Handle* pHandleA,
}
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)
void btAxisSweep3Internal<BP_FP_INT_TYPE>::updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher)
{
// assert(bounds.IsFinite());
//assert(bounds.HasVolume());
// btAssert(bounds.IsFinite());
//btAssert(bounds.HasVolume());
Handle* pHandle = getHandle(handle);
@@ -895,7 +1005,7 @@ class btAxisSweep3 : public btAxisSweep3Internal<unsigned short int>
{
public:
btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned short int maxHandles = 16384, btOverlappingPairCache* pairCache = 0);
btAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned short int maxHandles = 16384, btOverlappingPairCache* pairCache = 0, bool disableRaycastAccelerator = false);
};
@@ -906,7 +1016,7 @@ class bt32BitAxisSweep3 : public btAxisSweep3Internal<unsigned int>
{
public:
bt32BitAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned int maxHandles = 1500000, btOverlappingPairCache* pairCache = 0);
bt32BitAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned int maxHandles = 1500000, btOverlappingPairCache* pairCache = 0, bool disableRaycastAccelerator = false);
};

View File

@@ -21,8 +21,22 @@ subject to the following restrictions:
struct btDispatcherInfo;
class btDispatcher;
#include "btBroadphaseProxy.h"
class btOverlappingPairCache;
struct btBroadphaseRayCallback
{
///added some cached data to accelerate ray-AABB tests
btVector3 m_rayDirectionInverse;
unsigned int m_signs[3];
btScalar m_lambda_max;
virtual ~btBroadphaseRayCallback() {}
virtual bool process(const btBroadphaseProxy* proxy) = 0;
};
#include "LinearMath/btVector3.h"
///The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs.
@@ -36,7 +50,10 @@ public:
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;
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const =0;
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)) = 0;
///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb
virtual void calculateOverlappingPairs(btDispatcher* dispatcher)=0;
@@ -47,6 +64,9 @@ public:
///will add some transform later
virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const =0;
///reset broadphase internal structures, to ensure determinism/reproducability
virtual void resetPool(btDispatcher* dispatcher) {};
virtual void printStats() = 0;
};

View File

@@ -17,20 +17,24 @@ subject to the following restrictions:
#define BROADPHASE_PROXY_H
#include "LinearMath/btScalar.h" //for SIMD_FORCE_INLINE
#include "LinearMath/btVector3.h"
#include "LinearMath/btAlignedAllocator.h"
/// btDispatcher uses these types
/// IMPORTANT NOTE:The types are ordered polyhedral, implicit convex and concave
/// to facilitate type checking
/// CUSTOM_POLYHEDRAL_SHAPE_TYPE,CUSTOM_CONVEX_SHAPE_TYPE and CUSTOM_CONCAVE_SHAPE_TYPE can be used to extend Bullet without modifying source code
enum BroadphaseNativeTypes
{
// polyhedral convex shapes
// polyhedral convex shapes
BOX_SHAPE_PROXYTYPE,
TRIANGLE_SHAPE_PROXYTYPE,
TETRAHEDRAL_SHAPE_PROXYTYPE,
CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE,
CONVEX_HULL_SHAPE_PROXYTYPE,
CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE,
CUSTOM_POLYHEDRAL_SHAPE_TYPE,
//implicit convex shapes
IMPLICIT_CONVEX_SHAPES_START_HERE,
SPHERE_SHAPE_PROXYTYPE,
@@ -42,10 +46,12 @@ IMPLICIT_CONVEX_SHAPES_START_HERE,
UNIFORM_SCALING_SHAPE_PROXYTYPE,
MINKOWSKI_SUM_SHAPE_PROXYTYPE,
MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE,
CUSTOM_CONVEX_SHAPE_TYPE,
//concave shapes
CONCAVE_SHAPES_START_HERE,
//keep all the convex shapetype below here, for the check IsConvexShape in broadphase proxy!
TRIANGLE_MESH_SHAPE_PROXYTYPE,
SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE,
///used for demo integration FAST/Swift collision library and Bullet
FAST_CONCAVE_MESH_PROXYTYPE,
//terrain
@@ -57,13 +63,18 @@ CONCAVE_SHAPES_START_HERE,
EMPTY_SHAPE_PROXYTYPE,
STATIC_PLANE_PROXYTYPE,
CUSTOM_CONCAVE_SHAPE_TYPE,
CONCAVE_SHAPES_END_HERE,
COMPOUND_SHAPE_PROXYTYPE,
SOFTBODY_SHAPE_PROXYTYPE,
HFFLUID_SHAPE_PROXYTYPE,
HFFLUID_BUOYANT_CONVEX_SHAPE_PROXYTYPE,
INVALID_SHAPE_PROXYTYPE,
MAX_BROADPHASE_COLLISION_TYPES
};
@@ -82,20 +93,20 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
KinematicFilter = 4,
DebrisFilter = 8,
SensorTrigger = 16,
CharacterFilter = 32,
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;
void* m_multiSapParentProxy;
int m_uniqueId;//m_uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc.
btVector3 m_aabbMin;
btVector3 m_aabbMax;
SIMD_FORCE_INLINE int getUid() const
{
return m_uniqueId;
@@ -106,10 +117,12 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
{
}
btBroadphaseProxy(void* userPtr,short int collisionFilterGroup, short int collisionFilterMask,void* multiSapParentProxy=0)
btBroadphaseProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask,void* multiSapParentProxy=0)
:m_clientObject(userPtr),
m_collisionFilterGroup(collisionFilterGroup),
m_collisionFilterMask(collisionFilterMask)
m_collisionFilterMask(collisionFilterMask),
m_aabbMin(aabbMin),
m_aabbMax(aabbMax)
{
m_multiSapParentProxy = multiSapParentProxy;
}
@@ -158,7 +171,7 @@ ATTRIBUTE_ALIGNED16(struct) btBroadphasePair
m_pProxy0(0),
m_pProxy1(0),
m_algorithm(0),
m_userInfo(0)
m_internalInfo1(0)
{
}
@@ -168,14 +181,14 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
: m_pProxy0(other.m_pProxy0),
m_pProxy1(other.m_pProxy1),
m_algorithm(other.m_algorithm),
m_userInfo(other.m_userInfo)
m_internalInfo1(other.m_internalInfo1)
{
}
btBroadphasePair(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
{
//keep them sorted, so the std::set operations work
if (&proxy0 < &proxy1)
if (proxy0.m_uniqueId < proxy1.m_uniqueId)
{
m_pProxy0 = &proxy0;
m_pProxy1 = &proxy1;
@@ -187,7 +200,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
}
m_algorithm = 0;
m_userInfo = 0;
m_internalInfo1 = 0;
}
@@ -195,7 +208,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
btBroadphaseProxy* m_pProxy1;
mutable btCollisionAlgorithm* m_algorithm;
mutable void* m_userInfo;
union { void* m_internalInfo1; int m_internalTmpValue;};//don't use this data, it will be removed in future version.
};
@@ -216,8 +229,13 @@ class btBroadphasePairSortPredicate
bool operator() ( const btBroadphasePair& a, const btBroadphasePair& b )
{
return a.m_pProxy0 > b.m_pProxy0 ||
(a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 > b.m_pProxy1) ||
const int uidA0 = a.m_pProxy0 ? a.m_pProxy0->m_uniqueId : -1;
const int uidB0 = b.m_pProxy0 ? b.m_pProxy0->m_uniqueId : -1;
const int uidA1 = a.m_pProxy1 ? a.m_pProxy1->m_uniqueId : -1;
const int uidB1 = b.m_pProxy1 ? b.m_pProxy1->m_uniqueId : -1;
return uidA0 > uidB0 ||
(a.m_pProxy0 == b.m_pProxy0 && uidA1 > uidB1) ||
(a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 == b.m_pProxy1 && a.m_algorithm > b.m_algorithm);
}
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -26,19 +26,19 @@ subject to the following restrictions:
#if DBVT_BP_PROFILE
struct ProfileScope
{
{
__forceinline ProfileScope(btClock& clock,unsigned long& value) :
m_clock(&clock),m_value(&value),m_base(clock.getTimeMicroseconds())
{
}
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_)
@@ -52,35 +52,35 @@ struct ProfileScope
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;
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];
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);
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;
static const struct ZeroDummy : T {} zerodummy;
value=zerodummy;
}
//
@@ -90,25 +90,26 @@ value=zerodummy;
/* Tree collider */
struct btDbvtTreeCollider : btDbvt::ICollide
{
btDbvtBroadphase* pbp;
btDbvtProxy* proxy;
btDbvtTreeCollider(btDbvtBroadphase* p) : pbp(p) {}
void Process(const btDbvtNode* na,const btDbvtNode* nb)
btDbvtBroadphase* pbp;
btDbvtProxy* proxy;
btDbvtTreeCollider(btDbvtBroadphase* p) : pbp(p) {}
void Process(const btDbvtNode* na,const btDbvtNode* nb)
{
if(na!=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;
btDbvtProxy* pa=(btDbvtProxy*)na->data;
btDbvtProxy* pb=(btDbvtProxy*)nb->data;
#if DBVT_BP_SORTPAIRS
if(pa->m_uniqueId>pb->m_uniqueId)
btSwap(pa,pb);
#endif
pbp->m_paircache->addOverlappingPair(pa,pb);
++pbp->m_newpairs;
}
}
void Process(const btDbvtNode* n)
void Process(const btDbvtNode* n)
{
Process(n,proxy->leaf);
Process(n,proxy->leaf);
}
};
@@ -119,146 +120,197 @@ void Process(const btDbvtNode* n)
//
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_deferedcollide = 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;
m_stageRoots[i]=0;
}
#if DBVT_BP_PROFILE
clear(m_profiling);
clear(m_profiling);
#endif
}
//
btDbvtBroadphase::~btDbvtBroadphase()
{
if(m_releasepaircache)
{
m_paircache->~btOverlappingPairCache();
btAlignedFree(m_paircache);
}
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*/)
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)
btDbvtProxy* proxy=new(btAlignedAlloc(sizeof(btDbvtProxy),16)) btDbvtProxy( aabbMin,aabbMax,userPtr,
collisionFilterGroup,
collisionFilterMask);
btDbvtAabbMm aabb = btDbvtVolume::FromMM(aabbMin,aabbMax);
//bproxy->aabb = btDbvtVolume::FromMM(aabbMin,aabbMax);
proxy->stage = m_stageCurrent;
proxy->m_uniqueId = ++m_gid;
proxy->leaf = m_sets[0].insert(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);
btDbvtTreeCollider collider(this);
collider.proxy=proxy;
m_sets[0].collideTV(m_sets[0].m_root,aabb,collider);
m_sets[1].collideTV(m_sets[1].m_root,aabb,collider);
}
return(proxy);
return(proxy);
}
//
void btDbvtBroadphase::destroyProxy( btBroadphaseProxy* absproxy,
btDispatcher* dispatcher)
btDispatcher* dispatcher)
{
btDbvtProxy* proxy=(btDbvtProxy*)absproxy;
if(proxy->stage==STAGECOUNT)
m_sets[1].remove(proxy->leaf);
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;
m_sets[0].remove(proxy->leaf);
listremove(proxy,m_stageRoots[proxy->stage]);
m_paircache->removeOverlappingPairsContainingProxy(proxy,dispatcher);
btAlignedFree(proxy);
m_needcleanup=true;
}
void btDbvtBroadphase::getAabb(btBroadphaseProxy* absproxy,btVector3& aabbMin, btVector3& aabbMax ) const
{
btDbvtProxy* proxy=(btDbvtProxy*)absproxy;
aabbMin = proxy->m_aabbMin;
aabbMax = proxy->m_aabbMax;
}
struct BroadphaseRayTester : btDbvt::ICollide
{
btBroadphaseRayCallback& m_rayCallback;
BroadphaseRayTester(btBroadphaseRayCallback& orgCallback)
:m_rayCallback(orgCallback)
{
}
void Process(const btDbvtNode* leaf)
{
btDbvtProxy* proxy=(btDbvtProxy*)leaf->data;
m_rayCallback.process(proxy);
}
};
void btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax)
{
BroadphaseRayTester callback(rayCallback);
m_sets[0].rayTestInternal( m_sets[0].m_root,
rayFrom,
rayTo,
rayCallback.m_rayDirectionInverse,
rayCallback.m_signs,
rayCallback.m_lambda_max,
aabbMin,
aabbMax,
callback);
m_sets[1].rayTestInternal( m_sets[1].m_root,
rayFrom,
rayTo,
rayCallback.m_rayDirectionInverse,
rayCallback.m_signs,
rayCallback.m_lambda_max,
aabbMin,
aabbMax,
callback);
}
//
void btDbvtBroadphase::setAabb( btBroadphaseProxy* absproxy,
const btVector3& aabbMin,
const btVector3& aabbMax,
btDispatcher* /*dispatcher*/)
const btVector3& aabbMin,
const btVector3& aabbMax,
btDispatcher* /*dispatcher*/)
{
btDbvtProxy* proxy=(btDbvtProxy*)absproxy;
ATTRIBUTE_ALIGNED16(btDbvtVolume) aabb=btDbvtVolume::FromMM(aabbMin,aabbMax);
btDbvtProxy* proxy=(btDbvtProxy*)absproxy;
ATTRIBUTE_ALIGNED16(btDbvtVolume) aabb=btDbvtVolume::FromMM(aabbMin,aabbMax);
#if DBVT_BP_PREVENTFALSEUPDATE
if(NotEqual(aabb,proxy->leaf->volume))
if(NotEqual(aabb,proxy->leaf->volume))
#endif
{
bool docollide=false;
if(proxy->stage==STAGECOUNT)
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;
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))
++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
)
const btVector3 delta=aabbMin-proxy->m_aabbMin;
btVector3 velocity(((proxy->m_aabbMax-proxy->m_aabbMin)/2)*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;
++m_updates_done;
docollide=true;
}
}
else
{/* Teleporting */
m_sets[0].update(proxy->leaf,aabb);
++m_updates_done;
docollide=true;
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)
listremove(proxy,m_stageRoots[proxy->stage]);
proxy->m_aabbMin = aabbMin;
proxy->m_aabbMax = aabbMax;
proxy->stage = m_stageCurrent;
listappend(proxy,m_stageRoots[m_stageCurrent]);
if(docollide)
{
m_needcleanup=true;
if(!m_deferedcollide)
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);
btDbvtTreeCollider collider(this);
m_sets[1].collideTTpersistentStack(m_sets[1].m_root,proxy->leaf,collider);
m_sets[0].collideTTpersistentStack(m_sets[0].m_root,proxy->leaf,collider);
}
}
}
@@ -267,132 +319,226 @@ if(NotEqual(aabb,proxy->leaf->volume))
//
void btDbvtBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
{
collide(dispatcher);
collide(dispatcher);
#if DBVT_BP_PROFILE
if(0==(m_pid%DBVT_BP_PROFILING_RATE))
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();
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
performDeferredRemoval(dispatcher);
}
void btDbvtBroadphase::performDeferredRemoval(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());
int 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)
{
//important to perform AABB check that is consistent with the broadphase
btDbvtProxy* pa=(btDbvtProxy*)pair.m_pProxy0;
btDbvtProxy* pb=(btDbvtProxy*)pair.m_pProxy1;
bool hasOverlap = Intersect(pa->leaf->volume,pb->leaf->volume);
if (hasOverlap)
{
needsRemoval = false;
} else
{
needsRemoval = true;
}
} else
{
//remove duplicate
needsRemoval = true;
//should have no algorithm
btAssert(!pair.m_algorithm);
}
if (needsRemoval)
{
m_paircache->cleanOverlappingPair(pair,dispatcher);
pair.m_pProxy0 = 0;
pair.m_pProxy1 = 0;
invalidPair++;
}
}
//perform a sort, to sort 'invalid' pairs to the end
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
overlappingPairArray.resize(overlappingPairArray.size() - invalidPair);
}
}
//
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)
/*printf("---------------------------------------------------------\n");
printf("m_sets[0].m_leaves=%d\n",m_sets[0].m_leaves);
printf("m_sets[1].m_leaves=%d\n",m_sets[1].m_leaves);
printf("numPairs = %d\n",getOverlappingPairCache()->getNumOverlappingPairs());
{
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);
int i;
for (i=0;i<getOverlappingPairCache()->getNumOverlappingPairs();i++)
{
printf("pair[%d]=(%d,%d),",i,getOverlappingPairCache()->getOverlappingPairArray()[i].m_pProxy0->getUid(),
getOverlappingPairCache()->getOverlappingPairArray()[i].m_pProxy1->getUid());
}
printf("\n");
}
/* dynamic -> fixed set */
m_stageCurrent=(m_stageCurrent+1)%STAGECOUNT;
btDbvtProxy* current=m_stageRoots[m_stageCurrent];
if(current)
*/
SPC(m_profiling.m_total);
/* optimize */
m_sets[0].optimizeIncremental(1+(m_sets[0].m_leaves*m_dupdates)/100);
if(m_fixedleft)
{
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;
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);
ATTRIBUTE_ALIGNED16(btDbvtVolume) curAabb=btDbvtVolume::FromMM(current->m_aabbMin,current->m_aabbMax);
current->leaf = m_sets[1].insert(curAabb,current);
current->stage = STAGECOUNT;
current = next;
} while(current);
m_fixedleft=m_sets[1].m_leaves;
m_needcleanup=true;
m_fixedleft=m_sets[1].m_leaves;
m_needcleanup=true;
}
/* collide dynamics */
/* collide dynamics */
{
btDbvtTreeCollider collider(this);
if(m_deferedcollide)
btDbvtTreeCollider collider(this);
if(m_deferedcollide)
{
SPC(m_profiling.m_fdcollide);
btDbvt::collideTT(m_sets[0].m_root,m_sets[1].m_root,collider);
SPC(m_profiling.m_fdcollide);
m_sets[0].collideTTpersistentStack(m_sets[0].m_root,m_sets[1].m_root,collider);
}
if(m_deferedcollide)
if(m_deferedcollide)
{
SPC(m_profiling.m_ddcollide);
btDbvt::collideTT(m_sets[0].m_root,m_sets[0].m_root,collider);
SPC(m_profiling.m_ddcollide);
m_sets[0].collideTTpersistentStack(m_sets[0].m_root,m_sets[0].m_root,collider);
}
}
/* clean up */
if(m_needcleanup)
/* clean up */
if(m_needcleanup)
{
SPC(m_profiling.m_cleanup);
btBroadphasePairArray& pairs=m_paircache->getOverlappingPairArray();
if(pairs.size()>0)
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)
int ni=btMin(pairs.size(),btMax<int>(m_newpairs,(pairs.size()*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))
btBroadphasePair& p=pairs[(m_cid+i)%pairs.size()];
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 DBVT_BP_SORTPAIRS
if(pa->m_uniqueId>pb->m_uniqueId)
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;
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_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;
m_updates_done/=2;
m_updates_call/=2;
}
//
void btDbvtBroadphase::optimize()
{
m_sets[0].optimizeTopDown();
m_sets[1].optimizeTopDown();
m_sets[0].optimizeTopDown();
m_sets[1].optimizeTopDown();
}
//
btOverlappingPairCache* btDbvtBroadphase::getOverlappingPairCache()
{
return(m_paircache);
return(m_paircache);
}
//
const btOverlappingPairCache* btDbvtBroadphase::getOverlappingPairCache() const
{
return(m_paircache);
return(m_paircache);
}
//
@@ -401,16 +547,49 @@ void btDbvtBroadphase::getBroadphaseAabb(btVector3& aabbMin,btVector3& aab
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();
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::resetPool(btDispatcher* dispatcher)
{
int totalObjects = m_sets[0].m_leaves + m_sets[1].m_leaves;
if (!totalObjects)
{
//reset internal dynamic tree data structures
m_sets[0].clear();
m_sets[1].clear();
m_deferedcollide = false;
m_needcleanup = 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_gid = 0;
m_pid = 0;
m_cid = 0;
for(int i=0;i<=STAGECOUNT;++i)
{
m_stageRoots[i]=0;
}
}
}
//
@@ -421,9 +600,9 @@ void btDbvtBroadphase::printStats()
#if DBVT_BP_ENABLE_BENCHMARK
struct btBroadphaseBenchmark
{
{
struct Experiment
{
{
const char* name;
int object_count;
int update_count;
@@ -431,109 +610,109 @@ struct btBroadphaseBenchmark
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;
btSin(time)*amplitude/2;
center[1] = btCos(time*(btScalar)1.38)*amplitude+
btSin(time)*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
else
printf("%s : %u us (%u ms)\r\n",name,us,ms);
}
};
}
};
void btDbvtBroadphase::benchmark(btBroadphaseInterface* pbi)
{
static const btBroadphaseBenchmark::Experiment experiments[]=
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},*/
{"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)
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)
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::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)
btBroadphaseBenchmark::OutputTime("\tInitialization",wallclock);
/* First update */
wallclock.reset();
for(int i=0;i<objects.size();++i)
{
objects[i]->update(speed,amplitude,pbi);
objects[i]->update(speed,amplitude,pbi);
}
btBroadphaseBenchmark::OutputTime("\tFirst update",wallclock);
/* Updates */
wallclock.reset();
for(int i=0;i<experiment.iterations;++i)
btBroadphaseBenchmark::OutputTime("\tFirst update",wallclock);
/* Updates */
wallclock.reset();
for(int i=0;i<experiment.iterations;++i)
{
for(int j=0;j<update_count;++j)
for(int j=0;j<update_count;++j)
{
objects[j]->update(speed,amplitude,pbi);
objects[j]->update(speed,amplitude,pbi);
}
pbi->calculateOverlappingPairs(0);
pbi->calculateOverlappingPairs(0);
}
btBroadphaseBenchmark::OutputTime("\tUpdate",wallclock,experiment.iterations);
/* Clean up */
wallclock.reset();
for(int i=0;i<objects.size();++i)
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];
pbi->destroyProxy(objects[i]->proxy,0);
delete objects[i];
}
objects.resize(0);
btBroadphaseBenchmark::OutputTime("\tRelease",wallclock);
objects.resize(0);
btBroadphaseBenchmark::OutputTime("\tRelease",wallclock);
}
}
@@ -545,3 +724,4 @@ void btDbvtBroadphase::benchmark(btBroadphaseInterface*)
#if DBVT_BP_PROFILE
#undef SPC
#endif

View File

@@ -24,15 +24,15 @@ subject to the following restrictions:
//
#define DBVT_BP_PROFILE 0
#define DBVT_BP_SORTPAIRS 1
//#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"
#define DBVT_BP_PROFILING_RATE 256
#include "LinearMath/btQuickprof.h"
#endif
//
@@ -40,16 +40,16 @@ subject to the following restrictions:
//
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)
/* Fields */
//btDbvtAabbMm aabb;
btDbvtNode* leaf;
btDbvtProxy* links[2];
int stage;
/* ctor */
btDbvtProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask) :
btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask)
{
links[0]=links[1]=0;
links[0]=links[1]=0;
}
};
@@ -60,58 +60,67 @@ typedef btAlignedObjectArray<btDbvtProxy*> btDbvtProxyArray;
///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 {
/* 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
};
/* 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?
#if DBVT_BP_PROFILE
btClock m_clock;
struct {
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;
} 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*);
/* 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);
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0));
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
void calculateOverlappingPairs(btDispatcher* dispatcher);
btOverlappingPairCache* getOverlappingPairCache();
const btOverlappingPairCache* getOverlappingPairCache() const;
void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const;
void printStats();
static void benchmark(btBroadphaseInterface*);
void performDeferredRemoval(btDispatcher* dispatcher);
///reset broadphase internal structures, to ensure determinism/reproducability
virtual void resetPool(btDispatcher* dispatcher);
};
#endif

View File

@@ -46,22 +46,25 @@ struct btDispatcherInfo
m_enableSPU(true),
m_useEpa(true),
m_allowedCcdPenetration(btScalar(0.04)),
m_useConvexConservativeDistanceUtil(true),
m_convexConservativeDistanceThreshold(0.0f),
m_stackAllocator(0)
{
}
btScalar m_timeStep;
int m_stepCount;
int m_dispatchFunc;
int m_stepCount;
int m_dispatchFunc;
mutable btScalar m_timeOfImpact;
bool m_useContinuous;
bool m_useContinuous;
class btIDebugDraw* m_debugDraw;
bool m_enableSatConvex;
bool m_enableSPU;
bool m_useEpa;
bool m_enableSatConvex;
bool m_enableSPU;
bool m_useEpa;
btScalar m_allowedCcdPenetration;
bool m_useConvexConservativeDistanceUtil;
btScalar m_convexConservativeDistanceThreshold;
btStackAlloc* m_stackAllocator;
};
///The btDispatcher interface class can be used in combination with broadphase to dispatch calculations for overlapping pairs.

View File

@@ -149,6 +149,22 @@ amin.getZ() >= bmin.getZ() && amax.getZ() <= bmax.getZ();
void btMultiSapBroadphase::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const
{
btMultiSapProxy* multiProxy = static_cast<btMultiSapProxy*>(proxy);
aabbMin = multiProxy->m_aabbMin;
aabbMax = multiProxy->m_aabbMax;
}
void btMultiSapBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin,const btVector3& aabbMax)
{
for (int i=0;i<m_multiSapProxies.size();i++)
{
rayCallback.process(m_multiSapProxies[i]);
}
}
//#include <stdio.h>
void btMultiSapBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher)
@@ -208,7 +224,9 @@ void btMultiSapBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aab
m_optimizedAabbTree->reportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax);
if (m_optimizedAabbTree)
m_optimizedAabbTree->reportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax);
int i;
for ( i=0;i<multiProxy->m_bridgeProxies.size();i++)
@@ -464,3 +482,8 @@ void btMultiSapBroadphase::printStats()
*/
}
void btMultiSapBroadphase::resetPool(btDispatcher* dispatcher)
{
// not yet
}

View File

@@ -26,6 +26,7 @@ class btSimpleBroadphase;
typedef btAlignedObjectArray<btBroadphaseInterface*> btSapBroadphaseArray;
///The btMultiSapBroadphase is a research project, not recommended to use in production. Use btAxisSweep3 or btDbvtBroadphase instead.
///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.
@@ -72,7 +73,7 @@ public:
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),
:btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask),
m_aabbMin(aabbMin),
m_aabbMax(aabbMax),
m_shapeType(shapeType)
@@ -108,6 +109,9 @@ public:
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);
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin=btVector3(0,0,0),const btVector3& aabbMax=btVector3(0,0,0));
void addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase);
@@ -139,6 +143,9 @@ public:
void quicksort (btBroadphasePairArray& a, int lo, int hi);
///reset broadphase internal structures, to ensure determinism/reproducability
virtual void resetPool(btDispatcher* dispatcher);
};
#endif //BT_MULTI_SAP_BROADPHASE

View File

@@ -19,6 +19,7 @@ subject to the following restrictions:
#include "btDispatcher.h"
#include "btCollisionAlgorithm.h"
#include "LinearMath/btAabbUtil2.h"
#include <stdio.h>
@@ -33,7 +34,8 @@ int gFindPairs =0;
btHashedOverlappingPairCache::btHashedOverlappingPairCache():
m_overlapFilterCallback(0),
m_blockedForChanges(false)
m_blockedForChanges(false),
m_ghostPairCallback(0)
{
int initialAllocatedSize= 2;
m_overlappingPairArray.reserve(initialAllocatedSize);
@@ -45,7 +47,6 @@ btHashedOverlappingPairCache::btHashedOverlappingPairCache():
btHashedOverlappingPairCache::~btHashedOverlappingPairCache()
{
//todo/test: show we erase/delete data, or is it automatic
}
@@ -135,7 +136,8 @@ void btHashedOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroad
btBroadphasePair* btHashedOverlappingPairCache::findPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
{
gFindPairs++;
if(proxy0>proxy1) btSwap(proxy0,proxy1);
if(proxy0->m_uniqueId>proxy1->m_uniqueId)
btSwap(proxy0,proxy1);
int proxyId1 = proxy0->getUid();
int proxyId2 = proxy1->getUid();
@@ -211,7 +213,8 @@ void btHashedOverlappingPairCache::growTables()
btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
{
if(proxy0>proxy1) btSwap(proxy0,proxy1);
if(proxy0->m_uniqueId>proxy1->m_uniqueId)
btSwap(proxy0,proxy1);
int proxyId1 = proxy0->getUid();
int proxyId2 = proxy1->getUid();
@@ -238,6 +241,11 @@ btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProx
int count = m_overlappingPairArray.size();
int oldCapacity = m_overlappingPairArray.capacity();
void* mem = &m_overlappingPairArray.expand();
//this is where we add an actual pair, so also call the 'ghost'
if (m_ghostPairCallback)
m_ghostPairCallback->addOverlappingPair(proxy0,proxy1);
int newCapacity = m_overlappingPairArray.capacity();
if (oldCapacity < newCapacity)
@@ -251,7 +259,7 @@ btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProx
// pair->m_pProxy0 = proxy0;
// pair->m_pProxy1 = proxy1;
pair->m_algorithm = 0;
pair->m_userInfo = 0;
pair->m_internalTmpValue = 0;
m_next[count] = m_hashTable[hash];
@@ -265,7 +273,8 @@ btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProx
void* btHashedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1,btDispatcher* dispatcher)
{
gRemovePairs++;
if(proxy0>proxy1) btSwap(proxy0,proxy1);
if(proxy0->m_uniqueId>proxy1->m_uniqueId)
btSwap(proxy0,proxy1);
int proxyId1 = proxy0->getUid();
int proxyId2 = proxy1->getUid();
@@ -282,7 +291,7 @@ void* btHashedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* pro
cleanOverlappingPair(*pair,dispatcher);
void* userData = pair->m_userInfo;
void* userData = pair->m_internalInfo1;
btAssert(pair->m_pProxy0->getUid() == proxyId1);
btAssert(pair->m_pProxy1->getUid() == proxyId2);
@@ -317,6 +326,9 @@ void* btHashedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* pro
int lastPairIndex = m_overlappingPairArray.size() - 1;
if (m_ghostPairCallback)
m_ghostPairCallback->removeOverlappingPair(proxy0, proxy1,dispatcher);
// If the removed pair is the last pair, we are done.
if (lastPairIndex == pairIndex)
{
@@ -384,6 +396,35 @@ void btHashedOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback*
}
}
void btHashedOverlappingPairCache::sortOverlappingPairs(btDispatcher* dispatcher)
{
///need to keep hashmap in sync with pair address, so rebuild all
btBroadphasePairArray tmpPairs;
int i;
for (i=0;i<m_overlappingPairArray.size();i++)
{
tmpPairs.push_back(m_overlappingPairArray[i]);
}
for (i=0;i<tmpPairs.size();i++)
{
removeOverlappingPair(tmpPairs[i].m_pProxy0,tmpPairs[i].m_pProxy1,dispatcher);
}
for (i = 0; i < m_next.size(); i++)
{
m_next[i] = BT_NULL_PAIR;
}
tmpPairs.quickSort(btBroadphasePairSortPredicate());
for (i=0;i<tmpPairs.size();i++)
{
addOverlappingPair(tmpPairs[i].m_pProxy0,tmpPairs[i].m_pProxy1);
}
}
void* btSortedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1, btDispatcher* dispatcher )
@@ -397,8 +438,10 @@ void* btSortedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* pro
{
gOverlappingPairs--;
btBroadphasePair& pair = m_overlappingPairArray[findIndex];
void* userData = pair.m_userInfo;
void* userData = pair.m_internalInfo1;
cleanOverlappingPair(pair,dispatcher);
if (m_ghostPairCallback)
m_ghostPairCallback->removeOverlappingPair(proxy0, proxy1,dispatcher);
m_overlappingPairArray.swap(findIndex,m_overlappingPairArray.capacity()-1);
m_overlappingPairArray.pop_back();
@@ -419,15 +462,19 @@ void* btSortedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* pro
btBroadphasePair* btSortedOverlappingPairCache::addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
//don't add overlap with own
assert(proxy0 != proxy1);
btAssert(proxy0 != proxy1);
if (!needsBroadphaseCollision(proxy0,proxy1))
return 0;
void* mem = &m_overlappingPairArray.expand();
btBroadphasePair* pair = new (mem) btBroadphasePair(*proxy0,*proxy1);
gOverlappingPairs++;
gAddedPairs++;
if (m_ghostPairCallback)
m_ghostPairCallback->addOverlappingPair(proxy0, proxy1);
return pair;
}
@@ -446,7 +493,7 @@ btBroadphasePair* btSortedOverlappingPairCache::addOverlappingPair(btBroadphaseP
if (findIndex < m_overlappingPairArray.size())
{
//assert(it != m_overlappingPairSet.end());
//btAssert(it != m_overlappingPairSet.end());
btBroadphasePair* pair = &m_overlappingPairArray[findIndex];
return pair;
}
@@ -476,8 +523,9 @@ void btSortedOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback*
if (callback->processOverlap(*pair))
{
cleanOverlappingPair(*pair,dispatcher);
m_overlappingPairArray.swap(i,m_overlappingPairArray.capacity()-1);
pair->m_pProxy0 = 0;
pair->m_pProxy1 = 0;
m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
m_overlappingPairArray.pop_back();
gOverlappingPairs--;
} else
@@ -493,7 +541,8 @@ void btSortedOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback*
btSortedOverlappingPairCache::btSortedOverlappingPairCache():
m_blockedForChanges(false),
m_hasDeferredRemoval(true),
m_overlapFilterCallback(0)
m_overlapFilterCallback(0),
m_ghostPairCallback(0)
{
int initialAllocatedSize= 2;
m_overlappingPairArray.reserve(initialAllocatedSize);
@@ -501,7 +550,6 @@ btSortedOverlappingPairCache::btSortedOverlappingPairCache():
btSortedOverlappingPairCache::~btSortedOverlappingPairCache()
{
//todo/test: show we erase/delete data, or is it automatic
}
void btSortedOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher)
@@ -577,3 +625,9 @@ void btSortedOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroad
processAllOverlappingPairs(&removeCallback,dispatcher);
}
void btSortedOverlappingPairCache::sortOverlappingPairs(btDispatcher* dispatcher)
{
//should already be sorted
}

View File

@@ -21,7 +21,6 @@ subject to the following restrictions:
#include "btBroadphaseProxy.h"
#include "btOverlappingPairCallback.h"
#include "LinearMath/btPoint3.h"
#include "LinearMath/btAlignedObjectArray.h"
class btDispatcher;
@@ -83,6 +82,11 @@ public:
virtual bool hasDeferredRemoval() = 0;
virtual void setInternalGhostPairCallback(btOverlappingPairCallback* ghostPairCallback)=0;
virtual void sortOverlappingPairs(btDispatcher* dispatcher) = 0;
};
/// Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.box2d.org, and Pierre Terdiman, Codercorner, http://codercorner.com
@@ -253,10 +257,19 @@ private:
return false;
}
public:
virtual void setInternalGhostPairCallback(btOverlappingPairCallback* ghostPairCallback)
{
m_ghostPairCallback = ghostPairCallback;
}
virtual void sortOverlappingPairs(btDispatcher* dispatcher);
protected:
btAlignedObjectArray<int> m_hashTable;
btAlignedObjectArray<int> m_next;
btOverlappingPairCallback* m_ghostPairCallback;
};
@@ -280,6 +293,8 @@ class btSortedOverlappingPairCache : public btOverlappingPairCache
//if set, use the callback instead of the built in filter in needBroadphaseCollision
btOverlapFilterCallback* m_overlapFilterCallback;
btOverlappingPairCallback* m_ghostPairCallback;
public:
btSortedOverlappingPairCache();
@@ -355,12 +370,19 @@ class btSortedOverlappingPairCache : public btOverlappingPairCache
return m_hasDeferredRemoval;
}
virtual void setInternalGhostPairCallback(btOverlappingPairCallback* ghostPairCallback)
{
m_ghostPairCallback = ghostPairCallback;
}
virtual void sortOverlappingPairs(btDispatcher* dispatcher);
};
///btNullPairCache skips add/removal of overlapping pairs. Userful for benchmarking and testing.
///btNullPairCache skips add/removal of overlapping pairs. Userful for benchmarking and unit testing.
class btNullPairCache : public btOverlappingPairCache
{
@@ -414,6 +436,11 @@ public:
return true;
}
virtual void setInternalGhostPairCallback(btOverlappingPairCallback* /* ghostPairCallback */)
{
}
virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* /*proxy0*/,btBroadphaseProxy* /*proxy1*/)
{
return 0;
@@ -427,6 +454,10 @@ public:
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy* /*proxy0*/,btDispatcher* /*dispatcher*/)
{
}
virtual void sortOverlappingPairs(btDispatcher* dispatcher)
{
}
};

View File

@@ -18,14 +18,18 @@ subject to the following restrictions:
#include "LinearMath/btAabbUtil2.h"
#include "LinearMath/btIDebugDraw.h"
#define RAYAABB2
btQuantizedBvh::btQuantizedBvh() : m_useQuantization(false),
btQuantizedBvh::btQuantizedBvh() :
m_bulletVersion(BT_BULLET_VERSION),
m_useQuantization(false),
//m_traversalMode(TRAVERSAL_STACKLESS_CACHE_FRIENDLY)
m_traversalMode(TRAVERSAL_STACKLESS)
//m_traversalMode(TRAVERSAL_RECURSIVE)
,m_subtreeHeaderCount(0) //PCK: add this line
{
{
m_bvhAabbMin.setValue(-SIMD_INFINITY,-SIMD_INFINITY,-SIMD_INFINITY);
m_bvhAabbMax.setValue(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY);
}
@@ -119,7 +123,7 @@ void btQuantizedBvh::buildTree (int startIndex,int endIndex)
int numIndices =endIndex-startIndex;
int curIndex = m_curNodeIndex;
assert(numIndices>0);
btAssert(numIndices>0);
if (numIndices==1)
{
@@ -140,8 +144,11 @@ void btQuantizedBvh::buildTree (int startIndex,int endIndex)
int internalNodeIndex = m_curNodeIndex;
setInternalNodeAabbMax(m_curNodeIndex,m_bvhAabbMin);
setInternalNodeAabbMin(m_curNodeIndex,m_bvhAabbMax);
//set the min aabb to 'inf' or a max value, and set the max aabb to a -inf/minimum value.
//the aabb will be expanded during buildTree/mergeInternalNodeAabb with actual node values
setInternalNodeAabbMin(m_curNodeIndex,m_bvhAabbMax);//can't use btVector3(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY)) because of quantization
setInternalNodeAabbMax(m_curNodeIndex,m_bvhAabbMin);//can't use btVector3(-SIMD_INFINITY,-SIMD_INFINITY,-SIMD_INFINITY)) because of quantization
for (i=startIndex;i<endIndex;i++)
{
@@ -177,6 +184,9 @@ void btQuantizedBvh::buildTree (int startIndex,int endIndex)
{
updateSubtreeHeaders(leftChildNodexIndex,rightChildNodexIndex);
}
} else
{
}
setInternalNodeEscapeIndex(internalNodeIndex,escapeIndex);
@@ -338,6 +348,7 @@ void btQuantizedBvh::reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallb
int maxIterations = 0;
void btQuantizedBvh::walkStacklessTree(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
{
btAssert(!m_useQuantization);
@@ -352,7 +363,7 @@ void btQuantizedBvh::walkStacklessTree(btNodeOverlapCallback* nodeCallback,const
while (curIndex < m_curNodeIndex)
{
//catch bugs in tree data
assert (walkIterations < m_curNodeIndex);
btAssert (walkIterations < m_curNodeIndex);
walkIterations++;
aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMinOrg,rootNode->m_aabbMaxOrg);
@@ -434,6 +445,96 @@ void btQuantizedBvh::walkRecursiveQuantizedTreeAgainstQueryAabb(const btQuantize
void btQuantizedBvh::walkStacklessTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, int startNodeIndex,int endNodeIndex) const
{
btAssert(!m_useQuantization);
const btOptimizedBvhNode* rootNode = &m_contiguousNodes[0];
int escapeIndex, curIndex = 0;
int walkIterations = 0;
bool isLeafNode;
//PCK: unsigned instead of bool
unsigned aabbOverlap=0;
unsigned rayBoxOverlap=0;
btScalar lambda_max = 1.0;
/* Quick pruning by quantized box */
btVector3 rayAabbMin = raySource;
btVector3 rayAabbMax = raySource;
rayAabbMin.setMin(rayTarget);
rayAabbMax.setMax(rayTarget);
/* Add box cast extents to bounding box */
rayAabbMin += aabbMin;
rayAabbMax += aabbMax;
#ifdef RAYAABB2
btVector3 rayDir = (rayTarget-raySource);
rayDir.normalize ();
lambda_max = rayDir.dot(rayTarget-raySource);
///what about division by zero? --> just set rayDirection[i] to 1.0
btVector3 rayDirectionInverse;
rayDirectionInverse[0] = rayDir[0] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[0];
rayDirectionInverse[1] = rayDir[1] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[1];
rayDirectionInverse[2] = rayDir[2] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[2];
unsigned int sign[3] = { rayDirectionInverse[0] < 0.0, rayDirectionInverse[1] < 0.0, rayDirectionInverse[2] < 0.0};
#endif
btVector3 bounds[2];
while (curIndex < m_curNodeIndex)
{
btScalar param = 1.0;
//catch bugs in tree data
btAssert (walkIterations < m_curNodeIndex);
walkIterations++;
bounds[0] = rootNode->m_aabbMinOrg;
bounds[1] = rootNode->m_aabbMaxOrg;
/* Add box cast extents */
bounds[0] += aabbMin;
bounds[1] += aabbMax;
aabbOverlap = TestAabbAgainstAabb2(rayAabbMin,rayAabbMax,rootNode->m_aabbMinOrg,rootNode->m_aabbMaxOrg);
//perhaps profile if it is worth doing the aabbOverlap test first
#ifdef RAYAABB2
///careful with this check: need to check division by zero (above) and fix the unQuantize method
///thanks Joerg/hiker for the reproduction case!
///http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1858
rayBoxOverlap = aabbOverlap ? btRayAabb2 (raySource, rayDirectionInverse, sign, bounds, param, 0.0f, lambda_max) : false;
#else
btVector3 normal;
rayBoxOverlap = btRayAabb(raySource, rayTarget,bounds[0],bounds[1],param, normal);
#endif
isLeafNode = rootNode->m_escapeIndex == -1;
//PCK: unsigned instead of bool
if (isLeafNode && (rayBoxOverlap != 0))
{
nodeCallback->processNode(rootNode->m_subPart,rootNode->m_triangleIndex);
}
//PCK: unsigned instead of bool
if ((rayBoxOverlap != 0) || isLeafNode)
{
rootNode++;
curIndex++;
} else
{
escapeIndex = rootNode->m_escapeIndex;
rootNode += escapeIndex;
curIndex += escapeIndex;
}
}
if (maxIterations < walkIterations)
maxIterations = walkIterations;
}
void btQuantizedBvh::walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, int startNodeIndex,int endNodeIndex) const
@@ -454,9 +555,8 @@ void btQuantizedBvh::walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback*
unsigned rayBoxOverlap = 0;
btScalar lambda_max = 1.0;
#define RAYAABB2
#ifdef RAYAABB2
btVector3 rayFrom = raySource;
btVector3 rayDirection = (rayTarget-raySource);
rayDirection.normalize ();
lambda_max = rayDirection.dot(rayTarget-raySource);
@@ -502,7 +602,7 @@ void btQuantizedBvh::walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback*
#endif//VISUALLY_ANALYZE_BVH
//catch bugs in tree data
assert (walkIterations < subTreeSize);
btAssert (walkIterations < subTreeSize);
walkIterations++;
//PCK: unsigned instead of bool
@@ -533,7 +633,9 @@ void btQuantizedBvh::walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback*
///thanks Joerg/hiker for the reproduction case!
///http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1858
//BT_PROFILE("btRayAabb2");
rayBoxOverlap = btRayAabb2 (raySource, rayDirection, sign, bounds, param, 0.0f, lambda_max);
#else
rayBoxOverlap = true;//btRayAabb(raySource, rayTarget, bounds[0], bounds[1], param, normal);
#endif
@@ -597,7 +699,7 @@ void btQuantizedBvh::walkStacklessQuantizedTree(btNodeOverlapCallback* nodeCallb
#endif//VISUALLY_ANALYZE_BVH
//catch bugs in tree data
assert (walkIterations < subTreeSize);
btAssert (walkIterations < subTreeSize);
walkIterations++;
//PCK: unsigned instead of bool
@@ -652,30 +754,25 @@ void btQuantizedBvh::walkStacklessQuantizedTreeCacheFriendly(btNodeOverlapCallba
void btQuantizedBvh::reportRayOverlappingNodex (btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget) const
{
bool fast_path = m_useQuantization && m_traversalMode == TRAVERSAL_STACKLESS;
if (fast_path)
{
walkStacklessQuantizedTreeAgainstRay(nodeCallback, raySource, rayTarget, btVector3(0, 0, 0), btVector3(0, 0, 0), 0, m_curNodeIndex);
} else {
/* Otherwise fallback to AABB overlap test */
btVector3 aabbMin = raySource;
btVector3 aabbMax = raySource;
aabbMin.setMin(rayTarget);
aabbMax.setMax(rayTarget);
reportAabbOverlappingNodex(nodeCallback,aabbMin,aabbMax);
}
reportBoxCastOverlappingNodex(nodeCallback,raySource,rayTarget,btVector3(0,0,0),btVector3(0,0,0));
}
void btQuantizedBvh::reportBoxCastOverlappingNodex(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin,const btVector3& aabbMax) const
{
bool fast_path = m_useQuantization && m_traversalMode == TRAVERSAL_STACKLESS;
if (fast_path)
//always use stackless
if (m_useQuantization)
{
walkStacklessQuantizedTreeAgainstRay(nodeCallback, raySource, rayTarget, aabbMin, aabbMax, 0, m_curNodeIndex);
} else {
/* Slow path:
Construct the bounding box for the entire box cast and send that down the tree */
}
else
{
walkStacklessTreeAgainstRay(nodeCallback, raySource, rayTarget, aabbMin, aabbMax, 0, m_curNodeIndex);
}
/*
{
//recursive traversal
btVector3 qaabbMin = raySource;
btVector3 qaabbMax = raySource;
qaabbMin.setMin(rayTarget);
@@ -684,6 +781,8 @@ void btQuantizedBvh::reportBoxCastOverlappingNodex(btNodeOverlapCallback* nodeCa
qaabbMax += aabbMax;
reportAabbOverlappingNodex(nodeCallback,qaabbMin,qaabbMax);
}
*/
}
@@ -716,17 +815,19 @@ void btQuantizedBvh::assignInternalNodeFromLeafNode(int internalNode,int leafNod
//PCK: include
#include <new>
#if 0
//PCK: consts
static const unsigned BVH_ALIGNMENT = 16;
static const unsigned BVH_ALIGNMENT_MASK = BVH_ALIGNMENT-1;
static const unsigned BVH_ALIGNMENT_BLOCKS = 2;
#endif
unsigned int btQuantizedBvh::getAlignmentSerializationPadding()
{
return BVH_ALIGNMENT_BLOCKS * BVH_ALIGNMENT;
// I changed this to 0 since the extra padding is not needed or used.
return 0;//BVH_ALIGNMENT_BLOCKS * BVH_ALIGNMENT;
}
unsigned btQuantizedBvh::calculateSerializeBufferSize()
@@ -742,7 +843,7 @@ unsigned btQuantizedBvh::calculateSerializeBufferSize()
bool btQuantizedBvh::serialize(void *o_alignedDataBuffer, unsigned /*i_dataBufferSize */, bool i_swapEndian)
{
assert(m_subtreeHeaderCount == m_SubtreeHeaders.size());
btAssert(m_subtreeHeaderCount == m_SubtreeHeaders.size());
m_subtreeHeaderCount = m_SubtreeHeaders.size();
/* if (i_dataBufferSize < calculateSerializeBufferSize() || o_alignedDataBuffer == NULL || (((unsigned)o_alignedDataBuffer & BVH_ALIGNMENT_MASK) != 0))
@@ -829,6 +930,11 @@ bool btQuantizedBvh::serialize(void *o_alignedDataBuffer, unsigned /*i_dataBuffe
}
}
nodeData += sizeof(btQuantizedBvhNode) * nodeCount;
// this clears the pointer in the member variable it doesn't really do anything to the data
// it does call the destructor on the contained objects, but they are all classes with no destructor defined
// so the memory (which is not freed) is left alone
targetBvh->m_quantizedContiguousNodes.initializeFromBuffer(NULL, 0, 0);
}
else
{
@@ -859,6 +965,11 @@ bool btQuantizedBvh::serialize(void *o_alignedDataBuffer, unsigned /*i_dataBuffe
}
}
nodeData += sizeof(btOptimizedBvhNode) * nodeCount;
// this clears the pointer in the member variable it doesn't really do anything to the data
// it does call the destructor on the contained objects, but they are all classes with no destructor defined
// so the memory (which is not freed) is left alone
targetBvh->m_contiguousNodes.initializeFromBuffer(NULL, 0, 0);
}
sizeToAdd = 0;//(BVH_ALIGNMENT-((unsigned)nodeData & BVH_ALIGNMENT_MASK))&BVH_ALIGNMENT_MASK;
@@ -896,12 +1007,23 @@ bool btQuantizedBvh::serialize(void *o_alignedDataBuffer, unsigned /*i_dataBuffe
targetBvh->m_SubtreeHeaders[i].m_rootNodeIndex = (m_SubtreeHeaders[i].m_rootNodeIndex);
targetBvh->m_SubtreeHeaders[i].m_subtreeSize = (m_SubtreeHeaders[i].m_subtreeSize);
targetBvh->m_SubtreeHeaders[i] = m_SubtreeHeaders[i];
// need to clear padding in destination buffer
targetBvh->m_SubtreeHeaders[i].m_padding[0] = 0;
targetBvh->m_SubtreeHeaders[i].m_padding[1] = 0;
targetBvh->m_SubtreeHeaders[i].m_padding[2] = 0;
}
}
nodeData += sizeof(btBvhSubtreeInfo) * m_subtreeHeaderCount;
// this clears the pointer in the member variable it doesn't really do anything to the data
// it does call the destructor on the contained objects, but they are all classes with no destructor defined
// so the memory (which is not freed) is left alone
targetBvh->m_SubtreeHeaders.initializeFromBuffer(NULL, 0, 0);
// this wipes the virtual function table pointer at the start of the buffer for the class
*((void**)o_alignedDataBuffer) = NULL;
return true;
}
@@ -1015,11 +1137,12 @@ btQuantizedBvh *btQuantizedBvh::deSerializeInPlace(void *i_alignedDataBuffer, un
btQuantizedBvh::btQuantizedBvh(btQuantizedBvh &self, bool /* ownsMemory */) :
m_bvhAabbMin(self.m_bvhAabbMin),
m_bvhAabbMax(self.m_bvhAabbMax),
m_bvhQuantization(self.m_bvhQuantization)
m_bvhQuantization(self.m_bvhQuantization),
m_bulletVersion(BT_BULLET_VERSION)
{
}

View File

@@ -158,41 +158,43 @@ typedef btAlignedObjectArray<btBvhSubtreeInfo> BvhSubtreeInfoArray;
///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;
btVector3 m_bvhAabbMin;
btVector3 m_bvhAabbMax;
btVector3 m_bvhQuantization;
int m_bulletVersion; //for serialization versioning. It could also be used to detect endianess.
int m_curNodeIndex;
//quantization data
bool m_useQuantization;
NodeArray m_leafNodes;
NodeArray m_contiguousNodes;
QuantizedNodeArray m_quantizedLeafNodes;
QuantizedNodeArray m_quantizedContiguousNodes;
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
@@ -296,6 +298,7 @@ protected:
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;
void walkStacklessTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, 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;
@@ -307,30 +310,14 @@ protected:
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:
BT_DECLARE_ALIGNED_ALLOCATOR();
btQuantizedBvh();
virtual ~btQuantizedBvh();
@@ -363,7 +350,7 @@ public:
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
///@todo: double-check this
if (isMax)
{
out[0] = (unsigned short) (((unsigned short)(v.getX()+btScalar(1.)) | 1));

View File

@@ -55,6 +55,7 @@ btSimpleBroadphase::btSimpleBroadphase(int maxProxies, btOverlappingPairCache* o
m_maxHandles = maxProxies;
m_numHandles = 0;
m_firstFreeHandle = 0;
m_LastHandleIndex = -1;
{
@@ -88,7 +89,7 @@ btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& aabbMin,
btAssert(0);
return 0; //should never happen, but don't let the game crash ;-)
}
assert(aabbMin[0]<= aabbMax[0] && aabbMin[1]<= aabbMax[1] && aabbMin[2]<= aabbMax[2]);
btAssert(aabbMin[0]<= aabbMax[0] && aabbMin[1]<= aabbMax[1] && aabbMin[2]<= aabbMax[2]);
int newHandleIndex = allocHandle();
btSimpleBroadphaseProxy* proxy = new (&m_pHandles[newHandleIndex])btSimpleBroadphaseProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,multiSapProxy);
@@ -137,14 +138,32 @@ void btSimpleBroadphase::destroyProxy(btBroadphaseProxy* proxyOrg,btDispatcher*
}
void btSimpleBroadphase::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const
{
const btSimpleBroadphaseProxy* sbp = getSimpleProxyFromProxy(proxy);
aabbMin = sbp->m_aabbMin;
aabbMax = sbp->m_aabbMax;
}
void btSimpleBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* /*dispatcher*/)
{
btSimpleBroadphaseProxy* sbp = getSimpleProxyFromProxy(proxy);
sbp->m_min = aabbMin;
sbp->m_max = aabbMax;
sbp->m_aabbMin = aabbMin;
sbp->m_aabbMax = aabbMax;
}
void btSimpleBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin,const btVector3& aabbMax)
{
for (int i=0; i <= m_LastHandleIndex; i++)
{
btSimpleBroadphaseProxy* proxy = &m_pHandles[i];
if(!proxy->m_clientObject)
{
continue;
}
rayCallback.process(proxy);
}
}
@@ -154,9 +173,9 @@ void btSimpleBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbM
bool btSimpleBroadphase::aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1)
{
return proxy0->m_min[0] <= proxy1->m_max[0] && proxy1->m_min[0] <= proxy0->m_max[0] &&
proxy0->m_min[1] <= proxy1->m_max[1] && proxy1->m_min[1] <= proxy0->m_max[1] &&
proxy0->m_min[2] <= proxy1->m_max[2] && proxy1->m_min[2] <= proxy0->m_max[2];
return proxy0->m_aabbMin[0] <= proxy1->m_aabbMax[0] && proxy1->m_aabbMin[0] <= proxy0->m_aabbMax[0] &&
proxy0->m_aabbMin[1] <= proxy1->m_aabbMax[1] && proxy1->m_aabbMin[1] <= proxy0->m_aabbMax[1] &&
proxy0->m_aabbMin[2] <= proxy1->m_aabbMax[2] && proxy1->m_aabbMin[2] <= proxy0->m_aabbMax[2];
}
@@ -176,18 +195,25 @@ void btSimpleBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
{
//first check for new overlapping pairs
int i,j;
if (m_numHandles >= 0)
{
for (i=0;i<m_numHandles;i++)
int new_largest_index = -1;
for (i=0; i <= m_LastHandleIndex; i++)
{
btSimpleBroadphaseProxy* proxy0 = &m_pHandles[i];
for (j=i+1;j<m_numHandles;j++)
if(!proxy0->m_clientObject)
{
continue;
}
new_largest_index = i;
for (j=i+1; j <= m_LastHandleIndex; j++)
{
btSimpleBroadphaseProxy* proxy1 = &m_pHandles[j];
btAssert(proxy0 != proxy1);
if(!proxy1->m_clientObject)
{
continue;
}
btSimpleBroadphaseProxy* p0 = getSimpleProxyFromProxy(proxy0);
btSimpleBroadphaseProxy* p1 = getSimpleProxyFromProxy(proxy1);
@@ -211,6 +237,8 @@ void btSimpleBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
}
}
m_LastHandleIndex = new_largest_index;
if (m_ownsPairCache && m_pairCache->hasDeferredRemoval())
{
@@ -296,5 +324,7 @@ bool btSimpleBroadphase::testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseP
return aabbOverlap(p0,p1);
}
void btSimpleBroadphase::resetPool(btDispatcher* dispatcher)
{
//not yet
}

View File

@@ -22,8 +22,6 @@ subject to the following restrictions:
struct btSimpleBroadphaseProxy : public btBroadphaseProxy
{
btVector3 m_min;
btVector3 m_max;
int m_nextFree;
// int m_handleId;
@@ -31,9 +29,8 @@ struct btSimpleBroadphaseProxy : public btBroadphaseProxy
btSimpleBroadphaseProxy() {};
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)
btSimpleBroadphaseProxy(const btVector3& minpt,const btVector3& maxpt,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,void* multiSapProxy)
:btBroadphaseProxy(minpt,maxpt,userPtr,collisionFilterGroup,collisionFilterMask,multiSapProxy)
{
(void)shapeType;
}
@@ -56,6 +53,7 @@ protected:
int m_numHandles; // number of active handles
int m_maxHandles; // max number of handles
int m_LastHandleIndex;
btSimpleBroadphaseProxy* m_pHandles; // handles pool
@@ -68,6 +66,10 @@ protected:
int freeHandle = m_firstFreeHandle;
m_firstFreeHandle = m_pHandles[freeHandle].GetNextFree();
m_numHandles++;
if(freeHandle > m_LastHandleIndex)
{
m_LastHandleIndex = freeHandle;
}
return freeHandle;
}
@@ -75,10 +77,15 @@ protected:
{
int handle = int(proxy-m_pHandles);
btAssert(handle >= 0 && handle < m_maxHandles);
if(handle == m_LastHandleIndex)
{
m_LastHandleIndex--;
}
proxy->SetNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle;
proxy->m_clientObject = 0;
m_numHandles--;
}
@@ -95,6 +102,15 @@ protected:
return proxy0;
}
inline const btSimpleBroadphaseProxy* getSimpleProxyFromProxy(btBroadphaseProxy* proxy) const
{
const btSimpleBroadphaseProxy* proxy0 = static_cast<const btSimpleBroadphaseProxy*>(proxy);
return proxy0;
}
///reset broadphase internal structures, to ensure determinism/reproducability
virtual void resetPool(btDispatcher* dispatcher);
void validate();
@@ -117,6 +133,9 @@ public:
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher);
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0),const btVector3& aabbMax=btVector3(0,0,0));
btOverlappingPairCache* getOverlappingPairCache()
{

View File

@@ -1,153 +1,234 @@
INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src }
INCLUDE_DIRECTORIES( ${BULLET_PHYSICS_SOURCE_DIR}/src } )
SET(BulletCollision_SRCS
BroadphaseCollision/btAxisSweep3.cpp
BroadphaseCollision/btBroadphaseProxy.cpp
BroadphaseCollision/btCollisionAlgorithm.cpp
BroadphaseCollision/btDispatcher.cpp
BroadphaseCollision/btDbvtBroadphase.cpp
BroadphaseCollision/btDbvt.cpp
BroadphaseCollision/btMultiSapBroadphase.cpp
BroadphaseCollision/btOverlappingPairCache.cpp
BroadphaseCollision/btQuantizedBvh.cpp
BroadphaseCollision/btSimpleBroadphase.cpp
CollisionDispatch/btActivatingCollisionAlgorithm.cpp
CollisionDispatch/btCollisionDispatcher.cpp
CollisionDispatch/btCollisionObject.cpp
CollisionDispatch/btCollisionWorld.cpp
CollisionDispatch/btCompoundCollisionAlgorithm.cpp
CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
CollisionDispatch/btDefaultCollisionConfiguration.cpp
CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp
CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp
CollisionDispatch/btBoxBoxDetector.cpp
CollisionDispatch/btGhostObject.cpp
CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp
CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp
CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp
CollisionDispatch/btConvexConvexAlgorithm.cpp
CollisionDispatch/btEmptyCollisionAlgorithm.cpp
CollisionDispatch/btManifoldResult.cpp
CollisionDispatch/btSimulationIslandManager.cpp
CollisionDispatch/btUnionFind.cpp
CollisionDispatch/SphereTriangleDetector.cpp
CollisionShapes/btBoxShape.cpp
CollisionShapes/btBvhTriangleMeshShape.cpp
CollisionShapes/btCapsuleShape.cpp
CollisionShapes/btCollisionShape.cpp
CollisionShapes/btCompoundShape.cpp
CollisionShapes/btConcaveShape.cpp
CollisionShapes/btConeShape.cpp
CollisionShapes/btConvexHullShape.cpp
CollisionShapes/btConvexPointCloudShape.cpp
CollisionShapes/btConvexShape.cpp
CollisionShapes/btConvexInternalShape.cpp
CollisionShapes/btConvexTriangleMeshShape.cpp
CollisionShapes/btCylinderShape.cpp
CollisionShapes/btEmptyShape.cpp
CollisionShapes/btHeightfieldTerrainShape.cpp
CollisionShapes/btMinkowskiSumShape.cpp
CollisionShapes/btMultimaterialTriangleMeshShape.cpp
CollisionShapes/btMultiSphereShape.cpp
CollisionShapes/btOptimizedBvh.cpp
CollisionShapes/btPolyhedralConvexShape.cpp
CollisionShapes/btScaledBvhTriangleMeshShape.cpp
CollisionShapes/btTetrahedronShape.cpp
CollisionShapes/btSphereShape.cpp
CollisionShapes/btShapeHull.cpp
CollisionShapes/btStaticPlaneShape.cpp
CollisionShapes/btStridingMeshInterface.cpp
CollisionShapes/btTriangleCallback.cpp
CollisionShapes/btTriangleBuffer.cpp
CollisionShapes/btTriangleIndexVertexArray.cpp
CollisionShapes/btTriangleIndexVertexMaterialArray.cpp
CollisionShapes/btTriangleMesh.cpp
CollisionShapes/btTriangleMeshShape.cpp
CollisionShapes/btUniformScalingShape.cpp
Gimpact/btContactProcessing.cpp
Gimpact/btGImpactShape.cpp
Gimpact/gim_contact.cpp
Gimpact/btGImpactBvh.cpp
Gimpact/btGenericPoolAllocator.cpp
Gimpact/gim_memory.cpp
Gimpact/btGImpactCollisionAlgorithm.cpp
Gimpact/btTriangleShapeEx.cpp
Gimpact/gim_tri_collision.cpp
Gimpact/btGImpactQuantizedBvh.cpp
Gimpact/gim_box_set.cpp
NarrowPhaseCollision/btContinuousConvexCollision.cpp
NarrowPhaseCollision/btGjkEpa2.cpp
NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp
NarrowPhaseCollision/btConvexCast.cpp
NarrowPhaseCollision/btGjkConvexCast.cpp
NarrowPhaseCollision/btGjkPairDetector.cpp
NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp
NarrowPhaseCollision/btPersistentManifold.cpp
NarrowPhaseCollision/btRaycastCallback.cpp
NarrowPhaseCollision/btSubSimplexConvexCast.cpp
NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
)
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
SET(Root_HDRS
../btBulletCollisionCommon.h
)
SET(BroadphaseCollision_HDRS
BroadphaseCollision/btAxisSweep3.h
BroadphaseCollision/btBroadphaseInterface.h
BroadphaseCollision/btBroadphaseProxy.h
BroadphaseCollision/btCollisionAlgorithm.h
BroadphaseCollision/btDispatcher.h
BroadphaseCollision/btDbvtBroadphase.h
BroadphaseCollision/btDbvt.h
BroadphaseCollision/btMultiSapBroadphase.h
BroadphaseCollision/btOverlappingPairCache.h
BroadphaseCollision/btOverlappingPairCallback.h
BroadphaseCollision/btQuantizedBvh.h
BroadphaseCollision/btSimpleBroadphase.h
)
SET(CollisionDispatch_HDRS
CollisionDispatch/btActivatingCollisionAlgorithm.h
CollisionDispatch/btCollisionConfiguration.h
CollisionDispatch/btCollisionCreateFunc.h
CollisionDispatch/btCollisionDispatcher.h
CollisionDispatch/btCollisionObject.h
CollisionDispatch/btCollisionWorld.h
CollisionDispatch/btCompoundCollisionAlgorithm.h
CollisionDispatch/btConvexConcaveCollisionAlgorithm.h
CollisionDispatch/btDefaultCollisionConfiguration.h
CollisionDispatch/btSphereSphereCollisionAlgorithm.h
CollisionDispatch/btBoxBoxCollisionAlgorithm.h
CollisionDispatch/btBoxBoxDetector.h
CollisionDispatch/btGhostObject.h
CollisionDispatch/btSphereBoxCollisionAlgorithm.h
CollisionDispatch/btConvexPlaneCollisionAlgorithm.h
CollisionDispatch/btSphereTriangleCollisionAlgorithm.h
CollisionDispatch/btConvexConvexAlgorithm.h
CollisionDispatch/btEmptyCollisionAlgorithm.h
CollisionDispatch/btManifoldResult.h
CollisionDispatch/btSimulationIslandManager.h
CollisionDispatch/btUnionFind.h
CollisionDispatch/SphereTriangleDetector.h
)
SET(CollisionShapes_HDRS
CollisionShapes/btBoxShape.h
CollisionShapes/btBvhTriangleMeshShape.h
CollisionShapes/btCapsuleShape.h
CollisionShapes/btCollisionMargin
CollisionShapes/btCollisionShape.h
CollisionShapes/btCompoundShape.h
CollisionShapes/btConcaveShape.h
CollisionShapes/btConeShape.h
CollisionShapes/btConvexHullShape.h
CollisionShapes/btConvexPointCloudShape.h
CollisionShapes/btConvexShape.h
CollisionShapes/btConvexInternalShape.h
CollisionShapes/btConvexTriangleMeshShape.h
CollisionShapes/btCylinderShape.h
CollisionShapes/btEmptyShape.h
CollisionShapes/btHeightfieldTerrainShape.h
CollisionShapes/btMinkowskiSumShape.h
CollisionShapes/btMaterial.h
CollisionShapes/btMultimaterialTriangleMeshShape.h
CollisionShapes/btMultiSphereShape.h
CollisionShapes/btOptimizedBvh.h
CollisionShapes/btPolyhedralConvexShape.h
CollisionShapes/btScaledBvhTriangleMeshShape.h
CollisionShapes/btTetrahedronShape.h
CollisionShapes/btSphereShape.h
CollisionShapes/btShapeHull.h
CollisionShapes/btStaticPlaneShape.h
CollisionShapes/btStridingMeshInterface.h
CollisionShapes/btTriangleCallback.h
CollisionShapes/btTriangleBuffer.h
CollisionShapes/btTriangleIndexVertexArray.h
CollisionShapes/btTriangleIndexVertexMaterialArray.h
CollisionShapes/btTriangleMesh.h
CollisionShapes/btTriangleMeshShape.h
CollisionShapes/btUniformScalingShape.h
)
SET(Gimpact_HDRS
Gimpact/btGImpactShape.h
Gimpact/gim_contact.h
Gimpact/btGImpactBvh.h
Gimpact/btGenericPoolAllocator.h
Gimpact/gim_memory.h
Gimpact/btGImpactCollisionAlgorithm.h
Gimpact/btTriangleShapeEx.h
Gimpact/gim_tri_collision.h
Gimpact/btGImpactQuantizedBvh.h
Gimpact/gim_box_set.h
)
SET(NarrowPhaseCollision_HDRS
NarrowPhaseCollision/btContinuousConvexCollision.h
NarrowPhaseCollision/btConvexCast.h
NarrowPhaseCollision/btConvexPenetrationDepthSolver.h
NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h
NarrowPhaseCollision/btGjkConvexCast.h
NarrowPhaseCollision/btGjkEpa2.h
NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h
NarrowPhaseCollision/btGjkPairDetector.h
NarrowPhaseCollision/btManifoldPoint.h
NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h
NarrowPhaseCollision/btPersistentManifold.h
NarrowPhaseCollision/btPointCollector.h
NarrowPhaseCollision/btRaycastCallback.h
NarrowPhaseCollision/btSimplexSolverInterface.h
NarrowPhaseCollision/btSubSimplexConvexCast.h
NarrowPhaseCollision/btVoronoiSimplexSolver.h
)
SET(BulletCollision_HDRS
${Root_HDRS}
${BroadphaseCollision_HDRS}
${CollisionDispatch_HDRS}
${CollisionShapes_HDRS}
${Gimpact_HDRS}
${NarrowPhaseCollision_HDRS}
)
ADD_LIBRARY(BulletCollision ${BulletCollision_SRCS} ${BulletCollision_HDRS})
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES VERSION ${BULLET_VERSION})
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES SOVERSION ${BULLET_VERSION})
IF (BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(BulletCollision LinearMath)
ENDIF (BUILD_SHARED_LIBS)
#INSTALL of other files requires CMake 2.6
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
INSTALL(TARGETS BulletCollision DESTINATION lib)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES FRAMEWORK true)
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES PUBLIC_HEADER "${Root_HDRS}")
# Have to list out sub-directories manually:
SET_PROPERTY(SOURCE ${BroadphaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/BroadphaseCollision)
SET_PROPERTY(SOURCE ${CollisionDispatch_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionDispatch)
SET_PROPERTY(SOURCE ${CollisionShapes_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionShapes)
SET_PROPERTY(SOURCE ${Gimpact_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Gimpact)
SET_PROPERTY(SOURCE ${NarrowPhaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/NarrowPhaseCollision)
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)

View File

@@ -19,9 +19,10 @@ subject to the following restrictions:
#include "BulletCollision/CollisionShapes/btSphereShape.h"
SphereTriangleDetector::SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triangle)
SphereTriangleDetector::SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triangle,btScalar contactBreakingThreshold)
:m_sphere(sphere),
m_triangle(triangle)
m_triangle(triangle),
m_contactBreakingThreshold(contactBreakingThreshold)
{
}
@@ -40,7 +41,7 @@ void SphereTriangleDetector::getClosestPoints(const ClosestPointInput& input,Res
//move sphere into triangle space
btTransform sphereInTr = transformB.inverseTimes(transformA);
if (collide(sphereInTr.getOrigin(),point,normal,depth,timeOfImpact))
if (collide(sphereInTr.getOrigin(),point,normal,depth,timeOfImpact,m_contactBreakingThreshold))
{
if (swapResults)
{
@@ -93,7 +94,7 @@ bool SphereTriangleDetector::facecontains(const btVector3 &p,const btVector3* ve
}
///combined discrete/continuous sphere-triangle
bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &point, btVector3& resultNormal, btScalar& depth, btScalar &timeOfImpact)
bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &point, btVector3& resultNormal, btScalar& depth, btScalar &timeOfImpact, btScalar contactBreakingThreshold)
{
const btVector3* vertices = &m_triangle->getVertexPtr(0);
@@ -115,10 +116,7 @@ bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &po
normal *= btScalar(-1.);
}
///todo: move this gContactBreakingThreshold into a proper structure
extern btScalar gContactBreakingThreshold;
btScalar contactMargin = gContactBreakingThreshold;
btScalar contactMargin = contactBreakingThreshold;
bool isInsideContactPlane = distanceFromPlane < r + contactMargin;
bool isInsideShellPlane = distanceFromPlane < r;
@@ -140,8 +138,8 @@ bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &po
btVector3 nearestOnEdge;
for (int i = 0; i < m_triangle->getNumEdges(); i++) {
btPoint3 pa;
btPoint3 pb;
btVector3 pa;
btVector3 pb;
m_triangle->getEdge(i,pa,pb);

View File

@@ -17,7 +17,7 @@ subject to the following restrictions:
#define SPHERE_TRIANGLE_DETECTOR_H
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
#include "LinearMath/btPoint3.h"
class btSphereShape;
@@ -30,19 +30,19 @@ struct SphereTriangleDetector : public btDiscreteCollisionDetectorInterface
{
virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false);
SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triangle);
SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triangle, btScalar contactBreakingThreshold);
virtual ~SphereTriangleDetector() {};
private:
bool collide(const btVector3& sphereCenter,btVector3 &point, btVector3& resultNormal, btScalar& depth, btScalar &timeOfImpact);
bool collide(const btVector3& sphereCenter,btVector3 &point, btVector3& resultNormal, btScalar& depth, btScalar &timeOfImpact, btScalar contactBreakingThreshold);
bool pointInTriangle(const btVector3 vertices[], const btVector3 &normal, btVector3 *p );
bool facecontains(const btVector3 &p,const btVector3* vertices,btVector3& normal);
btSphereShape* m_sphere;
btTriangleShape* m_triangle;
btScalar m_contactBreakingThreshold;
};
#endif //SPHERE_TRIANGLE_DETECTOR_H

View File

@@ -0,0 +1,47 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2008 Erwin Coumans http://bulletphysics.com
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 "btActivatingCollisionAlgorithm.h"
#include "btCollisionDispatcher.h"
#include "btCollisionObject.h"
btActivatingCollisionAlgorithm::btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci)
:btCollisionAlgorithm(ci)
//,
//m_colObj0(0),
//m_colObj1(0)
{
}
btActivatingCollisionAlgorithm::btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* colObj0,btCollisionObject* colObj1)
:btCollisionAlgorithm(ci)
//,
//m_colObj0(0),
//m_colObj1(0)
{
// if (ci.m_dispatcher1->needsCollision(colObj0,colObj1))
// {
// m_colObj0 = colObj0;
// m_colObj1 = colObj1;
//
// m_colObj0->activate();
// m_colObj1->activate();
// }
}
btActivatingCollisionAlgorithm::~btActivatingCollisionAlgorithm()
{
// m_colObj0->activate();
// m_colObj1->activate();
}

View File

@@ -0,0 +1,36 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2008 Erwin Coumans http://bulletphysics.com
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_ACTIVATING_COLLISION_ALGORITHM_H
#define __BT_ACTIVATING_COLLISION_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
///This class is not enabled yet (work-in-progress) to more aggressively activate objects.
class btActivatingCollisionAlgorithm : public btCollisionAlgorithm
{
// btCollisionObject* m_colObj0;
// btCollisionObject* m_colObj1;
public:
btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci);
btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* colObj0,btCollisionObject* colObj1);
virtual ~btActivatingCollisionAlgorithm();
};
#endif //__BT_ACTIVATING_COLLISION_ALGORITHM_H

View File

@@ -22,7 +22,7 @@ subject to the following restrictions:
#define USE_PERSISTENT_CONTACTS 1
btBoxBoxCollisionAlgorithm::btBoxBoxCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* obj0,btCollisionObject* obj1)
: btCollisionAlgorithm(ci),
: btActivatingCollisionAlgorithm(ci,obj0,obj1),
m_ownManifold(false),
m_manifoldPtr(mf)
{

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef BOX_BOX__COLLISION_ALGORITHM_H
#define BOX_BOX__COLLISION_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
@@ -24,14 +24,14 @@ subject to the following restrictions:
class btPersistentManifold;
///box-box collision detection
class btBoxBoxCollisionAlgorithm : public btCollisionAlgorithm
class btBoxBoxCollisionAlgorithm : public btActivatingCollisionAlgorithm
{
bool m_ownManifold;
btPersistentManifold* m_manifoldPtr;
public:
btBoxBoxCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
: btCollisionAlgorithm(ci) {}
: btActivatingCollisionAlgorithm(ci) {}
virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);

View File

@@ -207,7 +207,13 @@ void cullPoints2 (int n, btScalar p[], int m, int i0, int iret[])
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));
if (btFabs(a+q) > SIMD_EPSILON)
{
a = 1.f/(btScalar(3.0)*(a+q));
} else
{
a=1e30f;
}
cx = a*(cx + q*(p[n*2-2]+p[0]));
cy = a*(cy + q*(p[n*2-1]+p[1]));
}
@@ -226,9 +232,9 @@ void cullPoints2 (int n, btScalar p[], int m, int i0, int iret[])
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
*iret = i0; // iret is not allowed to keep this value, but it sometimes does, when diff=#QNAN0
for (i=0; i<n; i++) {
if (avail[i]) {
diff = btFabs (A[i]-a);

View File

@@ -22,7 +22,7 @@ class btPoolAllocator;
///btCollisionConfiguration allows to configure Bullet collision detection
///stack allocator size, default collision algorithms and persistent manifold pool size
///todo: describe the meaning
///@todo: describe the meaning
class btCollisionConfiguration
{

View File

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

View File

@@ -52,12 +52,12 @@ btCollisionDispatcher::btCollisionDispatcher (btCollisionConfiguration* collisio
for (int j=0;j<MAX_BROADPHASE_COLLISION_TYPES;j++)
{
m_doubleDispatch[i][j] = m_collisionConfiguration->getCollisionAlgorithmCreateFunc(i,j);
assert(m_doubleDispatch[i][j]);
btAssert(m_doubleDispatch[i][j]);
}
}
};
}
void btCollisionDispatcher::registerCollisionCreateFunc(int proxyType0, int proxyType1, btCollisionAlgorithmCreateFunc *createFunc)
@@ -78,7 +78,13 @@ btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1)
btCollisionObject* body0 = (btCollisionObject*)b0;
btCollisionObject* body1 = (btCollisionObject*)b1;
//test for Bullet 2.74: use a relative contact breaking threshold without clamping against 'gContactBreakingThreshold'
//btScalar contactBreakingThreshold = btMin(gContactBreakingThreshold,btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold()));
btScalar contactBreakingThreshold = btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold());
btScalar contactProcessingThreshold = btMin(body0->getContactProcessingThreshold(),body1->getContactProcessingThreshold());
void* mem = 0;
if (m_persistentManifoldPoolAllocator->getFreeCount())
@@ -89,7 +95,7 @@ btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1)
mem = btAlignedAlloc(sizeof(btPersistentManifold),16);
}
btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0);
btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0,contactBreakingThreshold,contactProcessingThreshold);
manifold->m_index1a = m_manifoldsPtr.size();
m_manifoldsPtr.push_back(manifold);
@@ -144,7 +150,6 @@ btCollisionAlgorithm* btCollisionDispatcher::findAlgorithm(btCollisionObject* bo
bool btCollisionDispatcher::needsResponse(btCollisionObject* body0,btCollisionObject* body1)
{
//here you can do filtering
@@ -158,8 +163,8 @@ bool btCollisionDispatcher::needsResponse(btCollisionObject* body0,btCollisionOb
bool btCollisionDispatcher::needsCollision(btCollisionObject* body0,btCollisionObject* body1)
{
assert(body0);
assert(body1);
btAssert(body0);
btAssert(body1);
bool needsCollision = true;

View File

@@ -17,7 +17,10 @@ subject to the following restrictions:
#include "btCollisionObject.h"
btCollisionObject::btCollisionObject()
: m_broadphaseHandle(0),
: m_anisotropicFriction(1.f,1.f,1.f),
m_hasAnisotropicFriction(false),
m_contactProcessingThreshold(0.f),
m_broadphaseHandle(0),
m_collisionShape(0),
m_rootCollisionShape(0),
m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT),

View File

@@ -29,8 +29,11 @@ struct btBroadphaseProxy;
class btCollisionShape;
#include "LinearMath/btMotionState.h"
#include "LinearMath/btAlignedAllocator.h"
#include "LinearMath/btAlignedObjectArray.h"
typedef btAlignedObjectArray<class btCollisionObject*> btCollisionObjectArray;
/// btCollisionObject can be used to manage collision detection objects.
/// btCollisionObject maintains all information that is needed for a collision detection: Shape, Transform and AABB proxy.
@@ -49,6 +52,11 @@ protected:
//without destroying the continuous interpolated motion (which uses this interpolation velocities)
btVector3 m_interpolationLinearVelocity;
btVector3 m_interpolationAngularVelocity;
btVector3 m_anisotropicFriction;
bool m_hasAnisotropicFriction;
btScalar m_contactProcessingThreshold;
btBroadphaseProxy* m_broadphaseHandle;
btCollisionShape* m_collisionShape;
@@ -71,7 +79,7 @@ protected:
///users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPointer
void* m_userObjectPointer;
///m_internalType is reserved to distinguish Bullet's btCollisionObject, btRigidBody, btSoftBody etc.
///m_internalType is reserved to distinguish Bullet's btCollisionObject, btRigidBody, btSoftBody, btGhostObject etc.
///do not assign your own m_internalType unless you write a new dynamics object class.
int m_internalType;
@@ -103,14 +111,19 @@ public:
CF_STATIC_OBJECT= 1,
CF_KINEMATIC_OBJECT= 2,
CF_NO_CONTACT_RESPONSE = 4,
CF_CUSTOM_MATERIAL_CALLBACK = 8//this allows per-triangle material (friction/restitution)
CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle material (friction/restitution)
CF_CHARACTER_OBJECT = 16
};
enum CollisionObjectTypes
{
CO_COLLISION_OBJECT =1,
CO_RIGID_BODY,
CO_SOFT_BODY
///CO_GHOST_OBJECT keeps track of all objects overlapping its AABB and that pass its collision filter
///It is useful for collision sensors, explosion objects, character controller etc.
CO_GHOST_OBJECT,
CO_SOFT_BODY,
CO_HF_FLUID
};
SIMD_FORCE_INLINE bool mergesSimulationIslands() const
@@ -119,6 +132,30 @@ public:
return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE) )==0);
}
const btVector3& getAnisotropicFriction() const
{
return m_anisotropicFriction;
}
void setAnisotropicFriction(const btVector3& anisotropicFriction)
{
m_anisotropicFriction = anisotropicFriction;
m_hasAnisotropicFriction = (anisotropicFriction[0]!=1.f) || (anisotropicFriction[1]!=1.f) || (anisotropicFriction[2]!=1.f);
}
bool hasAnisotropicFriction() const
{
return m_hasAnisotropicFriction;
}
///the constraint solver can discard solving contacts, if the distance is above this threshold. 0 by default.
///Note that using contacts with positive distance can improve stability. It increases, however, the chance of colliding with degerate contacts, such as 'interior' triangle edges
void setContactProcessingThreshold( btScalar contactProcessingThreshold)
{
m_contactProcessingThreshold = contactProcessingThreshold;
}
btScalar getContactProcessingThreshold() const
{
return m_contactProcessingThreshold;
}
SIMD_FORCE_INLINE bool isStaticObject() const {
return (m_collisionFlags & CF_STATIC_OBJECT) != 0;
@@ -143,7 +180,7 @@ public:
virtual ~btCollisionObject();
void setCollisionShape(btCollisionShape* collisionShape)
virtual void setCollisionShape(btCollisionShape* collisionShape)
{
m_collisionShape = collisionShape;
m_rootCollisionShape = collisionShape;
@@ -176,7 +213,7 @@ public:
m_collisionShape = collisionShape;
}
int getActivationState() const { return m_activationState1;}
SIMD_FORCE_INLINE int getActivationState() const { return m_activationState1;}
void setActivationState(int newState);
@@ -193,7 +230,7 @@ public:
void activate(bool forceActivation = false);
inline bool isActive() const
SIMD_FORCE_INLINE bool isActive() const
{
return ((getActivationState() != ISLAND_SLEEPING) && (getActivationState() != DISABLE_SIMULATION));
}
@@ -237,12 +274,12 @@ public:
}
btBroadphaseProxy* getBroadphaseHandle()
SIMD_FORCE_INLINE btBroadphaseProxy* getBroadphaseHandle()
{
return m_broadphaseHandle;
}
const btBroadphaseProxy* getBroadphaseHandle() const
SIMD_FORCE_INLINE const btBroadphaseProxy* getBroadphaseHandle() const
{
return m_broadphaseHandle;
}
@@ -288,7 +325,7 @@ public:
return m_interpolationAngularVelocity;
}
const int getIslandTag() const
SIMD_FORCE_INLINE int getIslandTag() const
{
return m_islandTag1;
}
@@ -298,7 +335,7 @@ public:
m_islandTag1 = tag;
}
const int getCompanionId() const
SIMD_FORCE_INLINE int getCompanionId() const
{
return m_companionId;
}
@@ -308,7 +345,7 @@ public:
m_companionId = id;
}
const btScalar getHitFraction() const
SIMD_FORCE_INLINE btScalar getHitFraction() const
{
return m_hitFraction;
}
@@ -319,7 +356,7 @@ public:
}
const int getCollisionFlags() const
SIMD_FORCE_INLINE int getCollisionFlags() const
{
return m_collisionFlags;
}

View File

@@ -32,6 +32,9 @@ subject to the following restrictions:
#include "LinearMath/btQuickprof.h"
#include "LinearMath/btStackAlloc.h"
//#define USE_BRUTEFORCE_RAYBROADPHASE 1
//RECALCULATE_AABB is slower, but benefit is that you don't need to call 'stepSimulation' or 'updateAabbs' before using a rayTest
//#define RECALCULATE_AABB_RAYCAST 1
//When the user doesn't provide dispatcher or broadphase, create basic versions (and delete them in destructor)
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
@@ -66,6 +69,7 @@ btCollisionWorld::~btCollisionWorld()
//
getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(bp,m_dispatcher1);
getBroadphase()->destroyProxy(bp,m_dispatcher1);
collisionObject->setBroadphaseHandle(0);
}
}
@@ -111,6 +115,41 @@ void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,sho
}
void btCollisionWorld::updateSingleAabb(btCollisionObject* colObj)
{
btVector3 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::updateAabbs()
@@ -125,38 +164,9 @@ void btCollisionWorld::updateAabbs()
//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");
}
}
updateSingleAabb(colObj);
}
}
}
@@ -226,6 +236,7 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
if (collisionShape->isConvex())
{
// BT_PROFILE("rayTestConvex");
btConvexCast::CastResult castResult;
castResult.m_fraction = resultCallback.m_closestHitFraction;
@@ -269,6 +280,7 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
} else {
if (collisionShape->isConcave())
{
// BT_PROFILE("rayTestConcave");
if (collisionShape->getShapeType()==TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
///optimized version for btBvhTriangleMeshShape
@@ -286,7 +298,8 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,
btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh):
btTriangleRaycastCallback(from,to),
//@BP Mod
btTriangleRaycastCallback(from,to, resultCallback->m_flags),
m_resultCallback(resultCallback),
m_collisionObject(collisionObject),
m_triangleMesh(triangleMesh)
@@ -317,7 +330,8 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
triangleMesh->performRaycast(&rcb,rayFromLocal,rayToLocal);
} else
{
btTriangleMeshShape* triangleMesh = (btTriangleMeshShape*)collisionShape;
//generic (slower) case
btConcaveShape* concaveShape = (btConcaveShape*)collisionShape;
btTransform worldTocollisionObject = colObjWorldTransform.inverse();
@@ -330,11 +344,12 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
{
btCollisionWorld::RayResultCallback* m_resultCallback;
btCollisionObject* m_collisionObject;
btTriangleMeshShape* m_triangleMesh;
btConcaveShape* m_triangleMesh;
BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,
btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh):
btTriangleRaycastCallback(from,to),
btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btConcaveShape* triangleMesh):
//@BP Mod
btTriangleRaycastCallback(from,to, resultCallback->m_flags),
m_resultCallback(resultCallback),
m_collisionObject(collisionObject),
m_triangleMesh(triangleMesh)
@@ -363,7 +378,7 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
};
BridgeTriangleRaycastCallback rcb(rayFromLocal,rayToLocal,&resultCallback,collisionObject,triangleMesh);
BridgeTriangleRaycastCallback rcb(rayFromLocal,rayToLocal,&resultCallback,collisionObject,concaveShape);
rcb.m_hitFraction = resultCallback.m_closestHitFraction;
btVector3 rayAabbMinLocal = rayFromLocal;
@@ -371,10 +386,11 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
btVector3 rayAabbMaxLocal = rayFromLocal;
rayAabbMaxLocal.setMax(rayToLocal);
triangleMesh->processAllTriangles(&rcb,rayAabbMinLocal,rayAabbMaxLocal);
concaveShape->processAllTriangles(&rcb,rayAabbMinLocal,rayAabbMaxLocal);
}
} else {
//todo: use AABB tree or other BVH acceleration structure!
// BT_PROFILE("rayTestCompound");
///@todo: use AABB tree or other BVH acceleration structure, see btDbvt
if (collisionShape->isCompound())
{
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(collisionShape);
@@ -408,9 +424,10 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
{
if (collisionShape->isConvex())
{
//BT_PROFILE("convexSweepConvex");
btConvexCast::CastResult castResult;
castResult.m_allowedPenetration = allowedPenetration;
castResult.m_fraction = btScalar(1.);//??
castResult.m_fraction = resultCallback.m_closestHitFraction;//btScalar(1.);//??
btConvexShape* convexShape = (btConvexShape*) collisionShape;
btVoronoiSimplexSolver simplexSolver;
@@ -452,6 +469,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
{
if (collisionShape->getShapeType()==TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
//BT_PROFILE("convexSweepbtBvhTriangleMesh");
btBvhTriangleMeshShape* triangleMesh = (btBvhTriangleMeshShape*)collisionShape;
btTransform worldTocollisionObject = colObjWorldTransform.inverse();
btVector3 convexFromLocal = worldTocollisionObject * convexFromTrans.getOrigin();
@@ -508,7 +526,8 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
triangleMesh->performConvexcast(&tccb,convexFromLocal,convexToLocal,boxMinLocal, boxMaxLocal);
} else
{
btBvhTriangleMeshShape* triangleMesh = (btBvhTriangleMeshShape*)collisionShape;
//BT_PROFILE("convexSweepConcave");
btConcaveShape* concaveShape = (btConcaveShape*)collisionShape;
btTransform worldTocollisionObject = colObjWorldTransform.inverse();
btVector3 convexFromLocal = worldTocollisionObject * convexFromTrans.getOrigin();
btVector3 convexToLocal = worldTocollisionObject * convexToTrans.getOrigin();
@@ -520,10 +539,10 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
{
btCollisionWorld::ConvexResultCallback* m_resultCallback;
btCollisionObject* m_collisionObject;
btTriangleMeshShape* m_triangleMesh;
btConcaveShape* m_triangleMesh;
BridgeTriangleConvexcastCallback(const btConvexShape* castShape, const btTransform& from,const btTransform& to,
btCollisionWorld::ConvexResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh, const btTransform& triangleToWorld):
btCollisionWorld::ConvexResultCallback* resultCallback, btCollisionObject* collisionObject,btConcaveShape* triangleMesh, const btTransform& triangleToWorld):
btTriangleConvexcastCallback(castShape, from,to, triangleToWorld, triangleMesh->getMargin()),
m_resultCallback(resultCallback),
m_collisionObject(collisionObject),
@@ -556,7 +575,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
};
BridgeTriangleConvexcastCallback tccb(castShape, convexFromTrans,convexToTrans,&resultCallback,collisionObject,triangleMesh, colObjWorldTransform);
BridgeTriangleConvexcastCallback tccb(castShape, convexFromTrans,convexToTrans,&resultCallback,collisionObject,concaveShape, colObjWorldTransform);
tccb.m_hitFraction = resultCallback.m_closestHitFraction;
btVector3 boxMinLocal, boxMaxLocal;
castShape->getAabb(rotationXform, boxMinLocal, boxMaxLocal);
@@ -567,12 +586,13 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
rayAabbMaxLocal.setMax(convexToLocal);
rayAabbMinLocal += boxMinLocal;
rayAabbMaxLocal += boxMaxLocal;
triangleMesh->processAllTriangles(&tccb,rayAabbMinLocal,rayAabbMaxLocal);
concaveShape->processAllTriangles(&tccb,rayAabbMinLocal,rayAabbMaxLocal);
}
} else {
//todo: use AABB tree or other BVH acceleration structure!
///@todo : use AABB tree or other BVH acceleration structure!
if (collisionShape->isCompound())
{
BT_PROFILE("convexSweepCompound");
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(collisionShape);
int i=0;
for (i=0;i<compoundShape->getNumChildShapes();i++)
@@ -596,51 +616,173 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
}
}
void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const
struct btSingleRayCallback : public btBroadphaseRayCallback
{
btVector3 m_rayFromWorld;
btVector3 m_rayToWorld;
btTransform m_rayFromTrans;
btTransform m_rayToTrans;
btVector3 m_hitNormal;
btTransform rayFromTrans,rayToTrans;
rayFromTrans.setIdentity();
rayFromTrans.setOrigin(rayFromWorld);
rayToTrans.setIdentity();
const btCollisionWorld* m_world;
btCollisionWorld::RayResultCallback& m_resultCallback;
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++)
btSingleRayCallback(const btVector3& rayFromWorld,const btVector3& rayToWorld,const btCollisionWorld* world,btCollisionWorld::RayResultCallback& resultCallback)
:m_rayFromWorld(rayFromWorld),
m_rayToWorld(rayToWorld),
m_world(world),
m_resultCallback(resultCallback)
{
///terminate further ray tests, once the closestHitFraction reached zero
if (resultCallback.m_closestHitFraction == btScalar(0.f))
break;
m_rayFromTrans.setIdentity();
m_rayFromTrans.setOrigin(m_rayFromWorld);
m_rayToTrans.setIdentity();
m_rayToTrans.setOrigin(m_rayToWorld);
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);
btVector3 rayDir = (rayToWorld-rayFromWorld);
btScalar hitLambda = resultCallback.m_closestHitFraction;
btVector3 hitNormal;
if (btRayAabb(rayFromWorld,rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,hitNormal))
{
rayTestSingle(rayFromTrans,rayToTrans,
collisionObject,
collisionObject->getCollisionShape(),
collisionObject->getWorldTransform(),
resultCallback);
}
}
rayDir.normalize ();
///what about division by zero? --> just set rayDirection[i] to INF/1e30
m_rayDirectionInverse[0] = rayDir[0] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[0];
m_rayDirectionInverse[1] = rayDir[1] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[1];
m_rayDirectionInverse[2] = rayDir[2] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[2];
m_signs[0] = m_rayDirectionInverse[0] < 0.0;
m_signs[1] = m_rayDirectionInverse[1] < 0.0;
m_signs[2] = m_rayDirectionInverse[2] < 0.0;
m_lambda_max = rayDir.dot(m_rayToWorld-m_rayFromWorld);
}
virtual bool process(const btBroadphaseProxy* proxy)
{
///terminate further ray tests, once the closestHitFraction reached zero
if (m_resultCallback.m_closestHitFraction == btScalar(0.f))
return false;
btCollisionObject* collisionObject = (btCollisionObject*)proxy->m_clientObject;
//only perform raycast if filterMask matches
if(m_resultCallback.needsCollision(collisionObject->getBroadphaseHandle()))
{
//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
//btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
#if 0
#ifdef RECALCULATE_AABB
btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax);
#else
//getBroadphase()->getAabb(collisionObject->getBroadphaseHandle(),collisionObjectAabbMin,collisionObjectAabbMax);
const btVector3& collisionObjectAabbMin = collisionObject->getBroadphaseHandle()->m_aabbMin;
const btVector3& collisionObjectAabbMax = collisionObject->getBroadphaseHandle()->m_aabbMax;
#endif
#endif
//btScalar hitLambda = m_resultCallback.m_closestHitFraction;
//culling already done by broadphase
//if (btRayAabb(m_rayFromWorld,m_rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,m_hitNormal))
{
m_world->rayTestSingle(m_rayFromTrans,m_rayToTrans,
collisionObject,
collisionObject->getCollisionShape(),
collisionObject->getWorldTransform(),
m_resultCallback);
}
}
return true;
}
};
void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const
{
BT_PROFILE("rayTest");
/// use the broadphase to accelerate the search for objects, based on their aabb
/// and for each object with ray-aabb overlap, perform an exact ray test
btSingleRayCallback rayCB(rayFromWorld,rayToWorld,this,resultCallback);
#ifndef USE_BRUTEFORCE_RAYBROADPHASE
m_broadphasePairCache->rayTest(rayFromWorld,rayToWorld,rayCB);
#else
for (int i=0;i<this->getNumCollisionObjects();i++)
{
rayCB.process(m_collisionObjects[i]->getBroadphaseHandle());
}
#endif //USE_BRUTEFORCE_RAYBROADPHASE
}
void btCollisionWorld::convexSweepTest(const btConvexShape* castShape, const btTransform& convexFromWorld, const btTransform& convexToWorld, ConvexResultCallback& resultCallback) const
struct btSingleSweepCallback : public btBroadphaseRayCallback
{
btTransform m_convexFromTrans;
btTransform m_convexToTrans;
btVector3 m_hitNormal;
const btCollisionWorld* m_world;
btCollisionWorld::ConvexResultCallback& m_resultCallback;
btScalar m_allowedCcdPenetration;
const btConvexShape* m_castShape;
btSingleSweepCallback(const btConvexShape* castShape, const btTransform& convexFromTrans,const btTransform& convexToTrans,const btCollisionWorld* world,btCollisionWorld::ConvexResultCallback& resultCallback,btScalar allowedPenetration)
:m_convexFromTrans(convexFromTrans),
m_convexToTrans(convexToTrans),
m_world(world),
m_resultCallback(resultCallback),
m_allowedCcdPenetration(allowedPenetration),
m_castShape(castShape)
{
btVector3 unnormalizedRayDir = (m_convexToTrans.getOrigin()-m_convexFromTrans.getOrigin());
btVector3 rayDir = unnormalizedRayDir.normalized();
///what about division by zero? --> just set rayDirection[i] to INF/1e30
m_rayDirectionInverse[0] = rayDir[0] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[0];
m_rayDirectionInverse[1] = rayDir[1] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[1];
m_rayDirectionInverse[2] = rayDir[2] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[2];
m_signs[0] = m_rayDirectionInverse[0] < 0.0;
m_signs[1] = m_rayDirectionInverse[1] < 0.0;
m_signs[2] = m_rayDirectionInverse[2] < 0.0;
m_lambda_max = rayDir.dot(unnormalizedRayDir);
}
virtual bool process(const btBroadphaseProxy* proxy)
{
///terminate further convex sweep tests, once the closestHitFraction reached zero
if (m_resultCallback.m_closestHitFraction == btScalar(0.f))
return false;
btCollisionObject* collisionObject = (btCollisionObject*)proxy->m_clientObject;
//only perform raycast if filterMask matches
if(m_resultCallback.needsCollision(collisionObject->getBroadphaseHandle())) {
//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
m_world->objectQuerySingle(m_castShape, m_convexFromTrans,m_convexToTrans,
collisionObject,
collisionObject->getCollisionShape(),
collisionObject->getWorldTransform(),
m_resultCallback,
m_allowedCcdPenetration);
}
return true;
}
};
void btCollisionWorld::convexSweepTest(const btConvexShape* castShape, const btTransform& convexFromWorld, const btTransform& convexToWorld, ConvexResultCallback& resultCallback, btScalar allowedCcdPenetration) const
{
BT_PROFILE("convexSweepTest");
/// use the broadphase to accelerate the search for objects, based on their aabb
/// and for each object with ray-aabb overlap, perform an exact ray test
/// unfortunately the implementation for rayTest and convexSweepTest duplicated, albeit practically identical
btTransform convexFromTrans,convexToTrans;
convexFromTrans = convexFromWorld;
convexToTrans = convexToWorld;
@@ -649,12 +791,21 @@ void btCollisionWorld::convexSweepTest(const btConvexShape* castShape, const btT
{
btVector3 linVel, angVel;
btTransformUtil::calculateVelocity (convexFromTrans, convexToTrans, 1.0, linVel, angVel);
btVector3 zeroLinVel;
zeroLinVel.setValue(0,0,0);
btTransform R;
R.setIdentity ();
R.setRotation (convexFromTrans.getRotation());
castShape->calculateTemporalAabb (R, linVel, angVel, 1.0, castShapeAabbMin, castShapeAabbMax);
castShape->calculateTemporalAabb (R, zeroLinVel, angVel, 1.0, castShapeAabbMin, castShapeAabbMax);
}
#ifndef USE_BRUTEFORCE_RAYBROADPHASE
btSingleSweepCallback convexCB(castShape,convexFromWorld,convexToWorld,this,resultCallback,allowedCcdPenetration);
m_broadphasePairCache->rayTest(convexFromTrans.getOrigin(),convexToTrans.getOrigin(),convexCB,castShapeAabbMin,castShapeAabbMax);
#else
/// go over all objects, and if the ray intersects their aabb + cast shape aabb,
// do a ray-shape query using convexCaster (CCD)
int i;
@@ -676,9 +827,9 @@ void btCollisionWorld::convexSweepTest(const btConvexShape* castShape, const btT
collisionObject->getCollisionShape(),
collisionObject->getWorldTransform(),
resultCallback,
getDispatchInfo().m_allowedCcdPenetration);
allowedCcdPenetration);
}
}
}
#endif //USE_BRUTEFORCE_RAYBROADPHASE
}

View File

@@ -1,6 +1,6 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
Copyright (c) 2003-2006 Erwin Coumans http://bulletphysics.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.
@@ -22,39 +22,39 @@ subject to the following restrictions:
*
* Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license ( http://opensource.org/licenses/zlib-license.php ).
*
* There is the Physics Forum for Feedback and bteral Collision Detection and Physics discussions.
* Please visit http://www.continuousphysics.com/Bullet/phpBB2/index.php
* There is the Physics Forum for feedback and general Collision Detection and Physics discussions.
* Please visit http://www.bulletphysics.com
*
* @section install_sec Installation
*
* @subsection step1 Step 1: Download
* You can download the Bullet Physics Library from our website: http://www.continuousphysics.com/Bullet/
* You can download the Bullet Physics Library from the Google Code repository: http://code.google.com/p/bullet/downloads/list
* @subsection step2 Step 2: Building
* Bullet comes with autogenerated Project Files for Microsoft Visual Studio 6, 7, 7.1 and 8.
* The main Workspace/Solution is located in Bullet/msvc/8/wksbullet.sln (replace 8 with your version).
*
* Under other platforms, like Linux or Mac OS-X, Bullet can be build using either using cmake, http://www.cmake.org, or jam, http://www.perforce.com/jam/jam.html . cmake can autogenerate Xcode, KDevelop, MSVC and other build systems. just run cmake . in the root of Bullet.
* Under other platforms, like Linux or Mac OS-X, Bullet can be build using either using make, cmake, http://www.cmake.org , or jam, http://www.perforce.com/jam/jam.html . cmake can autogenerate Xcode, KDevelop, MSVC and other build systems. just run cmake . in the root of Bullet.
* So if you are not using MSVC or cmake, you can run ./autogen.sh ./configure to create both Makefile and Jamfile and then run make or jam.
* Jam is a build system that can build the library, demos and also autogenerate the MSVC Project Files.
* So if you are not using MSVC, you can run configure and jam .
* If you don't have jam installed, you can make jam from the included jam-2.5 sources, or download jam from ftp://ftp.perforce.com/pub/jam/
* If you don't have jam installed, you can make jam from the included jam-2.5 sources, or download jam from ftp://ftp.perforce.com/jam
*
* @subsection step3 Step 3: Testing demos
* Try to run and experiment with CcdPhysicsDemo executable as a starting point.
* Try to run and experiment with BasicDemo executable as a starting point.
* Bullet can be used in several ways, as Full Rigid Body simulation, as Collision Detector Library or Low Level / Snippets like the GJK Closest Point calculation.
* The Dependencies can be seen in this documentation under Directories
*
* @subsection step4 Step 4: Integrating in your application, Full Rigid Body Simulation
* Check out CcdPhysicsDemo how to create a btDynamicsWorld, btRigidBody and btCollisionShape, Stepping the simulation and synchronizing your graphics object transform.
* PLEASE NOTE THE CcdPhysicsEnvironment and CcdPhysicsController is obsolete and will be removed. It has been replaced by classes derived frmo btDynamicsWorld and btRididBody
* @subsection step4 Step 4: Integrating in your application, full Rigid Body and Soft Body simulation
* Check out BasicDemo how to create a btDynamicsWorld, btRigidBody and btCollisionShape, Stepping the simulation and synchronizing your graphics object transform.
* Check out SoftDemo how to use soft body dynamics, using btSoftRigidDynamicsWorld.
* @subsection step5 Step 5 : Integrate the Collision Detection Library (without Dynamics and other Extras)
* Bullet Collision Detection can also be used without the Dynamics/Extras.
* Check out btCollisionWorld and btCollisionObject, and the CollisionInterfaceDemo. Also in Extras/test_BulletOde.cpp there is a sample Collision Detection integration with Open Dynamics Engine, ODE, http://www.ode.org
* Check out btCollisionWorld and btCollisionObject, and the CollisionInterfaceDemo.
* @subsection step6 Step 6 : Use Snippets like the GJK Closest Point calculation.
* Bullet has been designed in a modular way keeping dependencies to a minimum. The ConvexHullDistance demo demonstrates direct use of btGjkPairDetector.
*
* @section copyright Copyright
* Copyright (C) 2005-2007 Erwin Coumans, some contributions Copyright Gino van den Bergen, Christer Ericson, Simon Hobbs, Ricardo Padrela, F Richter(res), Stephane Redon
* Special thanks to all visitors of the Bullet Physics forum, and in particular above contributors, Dave Eberle, Dirk Gregorius, Erin Catto, Dave Eberle, Adam Moravanszky,
* Copyright (C) 2005-2008 Erwin Coumans, some contributions Copyright Gino van den Bergen, Christer Ericson, Simon Hobbs, Ricardo Padrela, F Richter(res), Stephane Redon
* Special thanks to all visitors of the Bullet Physics forum, and in particular above contributors, John McCutchan, Nathanael Presson, Dave Eberle, Dirk Gregorius, Erin Catto, Dave Eberle, Adam Moravanszky,
* Pierre Terdiman, Kenny Erleben, Russell Smith, Oliver Strunk, Jan Paul van Waveren, Marten Svanfeldt.
*
*/
@@ -71,7 +71,7 @@ class btBroadphaseInterface;
#include "LinearMath/btVector3.h"
#include "LinearMath/btTransform.h"
#include "btCollisionObject.h"
#include "btCollisionDispatcher.h" //for definition of btCollisionObjectArray
#include "btCollisionDispatcher.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
#include "LinearMath/btAlignedObjectArray.h"
@@ -107,6 +107,11 @@ public:
m_broadphasePairCache = pairCache;
}
const btBroadphaseInterface* getBroadphase() const
{
return m_broadphasePairCache;
}
btBroadphaseInterface* getBroadphase()
{
return m_broadphasePairCache;
@@ -128,8 +133,10 @@ public:
return m_dispatcher1;
}
virtual void updateAabbs();
void updateSingleAabb(btCollisionObject* colObj);
virtual void updateAabbs();
virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
{
m_debugDrawer = debugDrawer;
@@ -179,6 +186,8 @@ public:
btCollisionObject* m_collisionObject;
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
//@BP Mod - Custom flags, currently used to enable backface culling on tri-meshes, see btRaycastCallback
unsigned int m_flags;
virtual ~RayResultCallback()
{
@@ -192,7 +201,9 @@ public:
:m_closestHitFraction(btScalar(1.)),
m_collisionObject(0),
m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter)
m_collisionFilterMask(btBroadphaseProxy::AllFilter),
//@BP Mod
m_flags(0)
{
}
@@ -347,7 +358,7 @@ public:
// 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;
void convexSweepTest (const btConvexShape* castShape, const btTransform& from, const btTransform& to, ConvexResultCallback& resultCallback, btScalar allowedCcdPenetration = btScalar(0.)) const;
/// rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest.

View File

@@ -19,19 +19,32 @@ subject to the following restrictions:
#include "BulletCollision/BroadphaseCollision/btDbvt.h"
#include "LinearMath/btIDebugDraw.h"
#include "LinearMath/btAabbUtil2.h"
#include "btManifoldResult.h"
btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped)
:btCollisionAlgorithm(ci),
:btActivatingCollisionAlgorithm(ci,body0,body1),
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());
btAssert (colObj->getCollisionShape()->isCompound());
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
m_compoundShapeRevision = compoundShape->getUpdateRevision();
preallocateChildAlgorithms(body0,body1);
}
void btCompoundCollisionAlgorithm::preallocateChildAlgorithms(btCollisionObject* body0,btCollisionObject* body1)
{
btCollisionObject* colObj = m_isSwapped? body1 : body0;
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
btAssert (colObj->getCollisionShape()->isCompound());
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
int numChildren = compoundShape->getNumChildShapes();
int i;
@@ -46,14 +59,13 @@ m_sharedManifold(ci.m_manifold)
btCollisionShape* tmpShape = colObj->getCollisionShape();
btCollisionShape* childShape = compoundShape->getChildShape(i);
colObj->internalSetTemporaryCollisionShape( childShape );
m_childCollisionAlgorithms[i] = ci.m_dispatcher1->findAlgorithm(colObj,otherObj,m_sharedManifold);
m_childCollisionAlgorithms[i] = m_dispatcher->findAlgorithm(colObj,otherObj,m_sharedManifold);
colObj->internalSetTemporaryCollisionShape( tmpShape );
}
}
}
btCompoundCollisionAlgorithm::~btCompoundCollisionAlgorithm()
void btCompoundCollisionAlgorithm::removeChildAlgorithms()
{
int numChildren = m_childCollisionAlgorithms.size();
int i;
@@ -67,6 +79,11 @@ btCompoundCollisionAlgorithm::~btCompoundCollisionAlgorithm()
}
}
btCompoundCollisionAlgorithm::~btCompoundCollisionAlgorithm()
{
removeChildAlgorithms();
}
@@ -167,13 +184,50 @@ void btCompoundCollisionAlgorithm::processCollision (btCollisionObject* body0,bt
btCollisionObject* colObj = m_isSwapped? body1 : body0;
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
assert (colObj->getCollisionShape()->isCompound());
btAssert (colObj->getCollisionShape()->isCompound());
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
///btCompoundShape might have changed:
////make sure the internal child collision algorithm caches are still valid
if (compoundShape->getUpdateRevision() != m_compoundShapeRevision)
{
///clear and update all
removeChildAlgorithms();
preallocateChildAlgorithms(body0,body1);
}
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);
///we need to refresh all contact manifolds
///note that we should actually recursively traverse all children, btCompoundShape can nested more then 1 level deep
///so we should add a 'refreshManifolds' in the btCollisionAlgorithm
{
int i;
btManifoldArray manifoldArray;
for (i=0;i<m_childCollisionAlgorithms.size();i++)
{
if (m_childCollisionAlgorithms[i])
{
m_childCollisionAlgorithms[i]->getAllContactManifolds(manifoldArray);
for (int m=0;m<manifoldArray.size();m++)
{
if (manifoldArray[m]->getNumContacts())
{
resultOut->setPersistentManifold(manifoldArray[m]);
resultOut->refreshContactPoints();
resultOut->setPersistentManifold(0);//??necessary?
}
}
manifoldArray.clear();
}
}
}
if (tree)
{
@@ -242,7 +296,7 @@ btScalar btCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject*
btCollisionObject* colObj = m_isSwapped? body1 : body0;
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
assert (colObj->getCollisionShape()->isCompound());
btAssert (colObj->getCollisionShape()->isCompound());
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
@@ -285,3 +339,4 @@ btScalar btCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject*
}

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef COMPOUND_COLLISION_ALGORITHM_H
#define COMPOUND_COLLISION_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
@@ -26,16 +26,23 @@ class btDispatcher;
#include "btCollisionCreateFunc.h"
#include "LinearMath/btAlignedObjectArray.h"
class btDispatcher;
class btCollisionObject;
/// btCompoundCollisionAlgorithm supports collision between CompoundCollisionShapes and other collision shapes
class btCompoundCollisionAlgorithm : public btCollisionAlgorithm
class btCompoundCollisionAlgorithm : public btActivatingCollisionAlgorithm
{
btAlignedObjectArray<btCollisionAlgorithm*> m_childCollisionAlgorithms;
bool m_isSwapped;
class btPersistentManifold* m_sharedManifold;
bool m_ownsManifold;
int m_compoundShapeRevision;//to keep track of changes, so that childAlgorithm array can be updated
void removeChildAlgorithms();
void preallocateChildAlgorithms(btCollisionObject* body0,btCollisionObject* body1);
public:
btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);

View File

@@ -27,7 +27,7 @@ subject to the following restrictions:
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
btConvexConcaveCollisionAlgorithm::btConvexConcaveCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1,bool isSwapped)
: btCollisionAlgorithm(ci),
: btActivatingCollisionAlgorithm(ci,body0,body1),
m_isSwapped(isSwapped),
m_btConvexTriangleCallback(ci.m_dispatcher1,body0,body1,isSwapped)
{
@@ -72,7 +72,7 @@ btConvexTriangleCallback::~btConvexTriangleCallback()
void btConvexTriangleCallback::clearCache()
{
m_dispatcher->clearManifold(m_manifoldPtr);
};
}
@@ -93,7 +93,7 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i
///debug drawing of the overlapping triangles
if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && m_dispatchInfoPtr->m_debugDraw->getDebugMode() > 0)
if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && (m_dispatchInfoPtr->m_debugDraw->getDebugMode() &btIDebugDraw::DBG_DrawWireframe ))
{
btVector3 color(255,255,0);
btTransform& tr = ob->getWorldTransform();

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef CONVEX_CONCAVE_COLLISION_ALGORITHM_H
#define CONVEX_CONCAVE_COLLISION_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
#include "BulletCollision/CollisionShapes/btTriangleCallback.h"
@@ -34,8 +34,8 @@ class btConvexTriangleCallback : public btTriangleCallback
btVector3 m_aabbMin;
btVector3 m_aabbMax ;
btManifoldResult* m_resultOut;
btManifoldResult* m_resultOut;
btDispatcher* m_dispatcher;
const btDispatcherInfo* m_dispatchInfoPtr;
btScalar m_collisionMarginTriangle;
@@ -70,7 +70,7 @@ int m_triangleCount;
/// btConvexConcaveCollisionAlgorithm supports collision between convex shapes and (concave) trianges meshes.
class btConvexConcaveCollisionAlgorithm : public btCollisionAlgorithm
class btConvexConcaveCollisionAlgorithm : public btActivatingCollisionAlgorithm
{
bool m_isSwapped;
@@ -78,6 +78,7 @@ class btConvexConcaveCollisionAlgorithm : public btCollisionAlgorithm
btConvexTriangleCallback m_btConvexTriangleCallback;
public:
btConvexConcaveCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);

View File

@@ -38,7 +38,7 @@ subject to the following restrictions:
#include "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkEpa.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkEpa2.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h"
@@ -51,6 +51,8 @@ subject to the following restrictions:
btConvexConvexAlgorithm::CreateFunc::CreateFunc(btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver)
{
m_numPerturbationIterations = 0;
m_minimumPointsPerturbationThreshold = 3;
m_simplexSolver = simplexSolver;
m_pdSolver = pdSolver;
}
@@ -59,17 +61,22 @@ btConvexConvexAlgorithm::CreateFunc::~CreateFunc()
{
}
btConvexConvexAlgorithm::btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver)
: btCollisionAlgorithm(ci),
m_gjkPairDetector(0,0,simplexSolver,pdSolver),
btConvexConvexAlgorithm::btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver,int numPerturbationIterations, int minimumPointsPerturbationThreshold)
: btActivatingCollisionAlgorithm(ci,body0,body1),
m_simplexSolver(simplexSolver),
m_pdSolver(pdSolver),
m_ownManifold (false),
m_manifoldPtr(mf),
m_lowLevelOfDetail(false)
m_lowLevelOfDetail(false),
#ifdef USE_SEPDISTANCE_UTIL2
,m_sepDistance((static_cast<btConvexShape*>(body0->getCollisionShape()))->getAngularMotionDisc(),
(static_cast<btConvexShape*>(body1->getCollisionShape()))->getAngularMotionDisc()),
#endif
m_numPerturbationIterations(numPerturbationIterations),
m_minimumPointsPerturbationThreshold(minimumPointsPerturbationThreshold)
{
(void)body0;
(void)body1;
}
@@ -90,8 +97,63 @@ void btConvexConvexAlgorithm ::setLowLevelOfDetail(bool useLowLevel)
}
struct btPerturbedContactResult : public btManifoldResult
{
btManifoldResult* m_originalManifoldResult;
btTransform m_transformA;
btTransform m_transformB;
btTransform m_unPerturbedTransform;
bool m_perturbA;
btIDebugDraw* m_debugDrawer;
btPerturbedContactResult(btManifoldResult* originalResult,const btTransform& transformA,const btTransform& transformB,const btTransform& unPerturbedTransform,bool perturbA,btIDebugDraw* debugDrawer)
:m_originalManifoldResult(originalResult),
m_transformA(transformA),
m_transformB(transformB),
m_perturbA(perturbA),
m_unPerturbedTransform(unPerturbedTransform),
m_debugDrawer(debugDrawer)
{
}
virtual ~ btPerturbedContactResult()
{
}
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar orgDepth)
{
btVector3 endPt,startPt;
btScalar newDepth;
btVector3 newNormal;
if (m_perturbA)
{
btVector3 endPtOrg = pointInWorld + normalOnBInWorld*orgDepth;
endPt = (m_unPerturbedTransform*m_transformA.inverse())(endPtOrg);
newDepth = (endPt - pointInWorld).dot(normalOnBInWorld);
startPt = endPt+normalOnBInWorld*newDepth;
} else
{
endPt = pointInWorld + normalOnBInWorld*orgDepth;
startPt = (m_unPerturbedTransform*m_transformB.inverse())(pointInWorld);
newDepth = (endPt - startPt).dot(normalOnBInWorld);
}
//#define DEBUG_CONTACTS 1
#ifdef DEBUG_CONTACTS
m_debugDrawer->drawLine(startPt,endPt,btVector3(1,0,0));
m_debugDrawer->drawSphere(startPt,0.05,btVector3(0,1,0));
m_debugDrawer->drawSphere(endPt,0.05,btVector3(0,0,1));
#endif //DEBUG_CONTACTS
m_originalManifoldResult->addContactPoint(normalOnBInWorld,startPt,newDepth);
}
};
extern btScalar gContactBreakingThreshold;
//
// Convex-Convex collision algorithm
@@ -107,39 +169,125 @@ void btConvexConvexAlgorithm ::processCollision (btCollisionObject* body0,btColl
}
resultOut->setPersistentManifold(m_manifoldPtr);
#ifdef USE_BT_GJKEPA
btConvexShape* shape0(static_cast<btConvexShape*>(body0->getCollisionShape()));
btConvexShape* shape1(static_cast<btConvexShape*>(body1->getCollisionShape()));
const btScalar radialmargin(0/*shape0->getMargin()+shape1->getMargin()*/);
btGjkEpaSolver::sResults results;
if(btGjkEpaSolver::Collide( shape0,body0->getWorldTransform(),
shape1,body1->getWorldTransform(),
radialmargin,results))
{
dispatchInfo.m_debugDraw->drawLine(results.witnesses[1],results.witnesses[1]+results.normal,btVector3(255,0,0));
resultOut->addContactPoint(results.normal,results.witnesses[1],-results.depth);
}
#else
//comment-out next line to test multi-contact generation
//resultOut->getPersistentManifold()->clearManifold();
btConvexShape* min0 = static_cast<btConvexShape*>(body0->getCollisionShape());
btConvexShape* min1 = static_cast<btConvexShape*>(body1->getCollisionShape());
#ifdef USE_SEPDISTANCE_UTIL2
m_sepDistance.updateSeparatingDistance(body0->getWorldTransform(),body1->getWorldTransform());
if (!dispatchInfo.m_useConvexConservativeDistanceUtil || m_sepDistance.getConservativeSeparatingDistance()<=0.f)
#endif //USE_SEPDISTANCE_UTIL2
{
btGjkPairDetector::ClosestPointInput input;
btGjkPairDetector gjkPairDetector(min0,min1,m_simplexSolver,m_pdSolver);
//TODO: if (dispatchInfo.m_useContinuous)
m_gjkPairDetector.setMinkowskiA(min0);
m_gjkPairDetector.setMinkowskiB(min1);
input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactBreakingThreshold();
input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared;
input.m_stackAlloc = dispatchInfo.m_stackAllocator;
gjkPairDetector.setMinkowskiA(min0);
gjkPairDetector.setMinkowskiB(min1);
// input.m_maximumDistanceSquared = btScalar(1e30);
#ifdef USE_SEPDISTANCE_UTIL2
if (dispatchInfo.m_useConvexConservativeDistanceUtil)
{
input.m_maximumDistanceSquared = 1e30f;
} else
#endif //USE_SEPDISTANCE_UTIL2
{
input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactBreakingThreshold();
input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared;
}
input.m_stackAlloc = dispatchInfo.m_stackAllocator;
input.m_transformA = body0->getWorldTransform();
input.m_transformB = body1->getWorldTransform();
gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
btScalar sepDist = gjkPairDetector.getCachedSeparatingDistance()+dispatchInfo.m_convexConservativeDistanceThreshold;
//now perturbe directions to get multiple contact points
btVector3 v0,v1;
btVector3 sepNormalWorldSpace = gjkPairDetector.getCachedSeparatingAxis().normalized();
btPlaneSpace1(sepNormalWorldSpace,v0,v1);
//now perform 'm_numPerturbationIterations' collision queries with the perturbated collision objects
m_gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
//perform perturbation when more then 'm_minimumPointsPerturbationThreshold' points
if (resultOut->getPersistentManifold()->getNumContacts() < m_minimumPointsPerturbationThreshold)
{
int i;
bool perturbeA = true;
const btScalar angleLimit = 0.125f * SIMD_PI;
btScalar perturbeAngle;
btScalar radiusA = min0->getAngularMotionDisc();
btScalar radiusB = min1->getAngularMotionDisc();
if (radiusA < radiusB)
{
perturbeAngle = gContactBreakingThreshold /radiusA;
perturbeA = true;
} else
{
perturbeAngle = gContactBreakingThreshold / radiusB;
perturbeA = false;
}
if ( perturbeAngle > angleLimit )
perturbeAngle = angleLimit;
btTransform unPerturbedTransform;
if (perturbeA)
{
unPerturbedTransform = input.m_transformA;
} else
{
unPerturbedTransform = input.m_transformB;
}
for ( i=0;i<m_numPerturbationIterations;i++)
{
btQuaternion perturbeRot(v0,perturbeAngle);
btScalar iterationAngle = i*(SIMD_2_PI/btScalar(m_numPerturbationIterations));
btQuaternion rotq(sepNormalWorldSpace,iterationAngle);
if (perturbeA)
{
input.m_transformA.setBasis( btMatrix3x3(rotq.inverse()*perturbeRot*rotq)*body0->getWorldTransform().getBasis());
input.m_transformB = body1->getWorldTransform();
#ifdef DEBUG_CONTACTS
dispatchInfo.m_debugDraw->drawTransform(input.m_transformA,10.0);
#endif //DEBUG_CONTACTS
} else
{
input.m_transformA = body0->getWorldTransform();
input.m_transformB.setBasis( btMatrix3x3(rotq.inverse()*perturbeRot*rotq)*body1->getWorldTransform().getBasis());
#ifdef DEBUG_CONTACTS
dispatchInfo.m_debugDraw->drawTransform(input.m_transformB,10.0);
#endif
}
btPerturbedContactResult perturbedResultOut(resultOut,input.m_transformA,input.m_transformB,unPerturbedTransform,perturbeA,dispatchInfo.m_debugDraw);
gjkPairDetector.getClosestPoints(input,perturbedResultOut,dispatchInfo.m_debugDraw);
}
}
#ifdef USE_SEPDISTANCE_UTIL2
if (dispatchInfo.m_useConvexConservativeDistanceUtil)
{
m_sepDistance.initSeparatingDistance(gjkPairDetector.getCachedSeparatingAxis(),sepDist,body0->getWorldTransform(),body1->getWorldTransform());
}
#endif //USE_SEPDISTANCE_UTIL2
}
if (m_ownManifold)
{

View File

@@ -16,30 +16,50 @@ subject to the following restrictions:
#ifndef CONVEX_CONVEX_ALGORITHM_H
#define CONVEX_CONVEX_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "btCollisionCreateFunc.h"
#include "btCollisionDispatcher.h"
#include "LinearMath/btTransformUtil.h" //for btConvexSeparatingDistanceUtil
class btConvexPenetrationDepthSolver;
///ConvexConvexAlgorithm collision algorithm implements time of impact, convex closest points and penetration depth calculations.
class btConvexConvexAlgorithm : public btCollisionAlgorithm
{
btGjkPairDetector m_gjkPairDetector;
public:
///Enabling USE_SEPDISTANCE_UTIL2 requires 100% reliable distance computation. However, when using large size ratios GJK can be imprecise
///so the distance is not conservative. In that case, enabling this USE_SEPDISTANCE_UTIL2 would result in failing/missing collisions.
///Either improve GJK for large size ratios (testing a 100 units versus a 0.1 unit object) or only enable the util
///for certain pairs that have a small size ratio
///#define USE_SEPDISTANCE_UTIL2 1
///The convexConvexAlgorithm collision algorithm implements time of impact, convex closest points and penetration depth calculations between two convex objects.
///Multiple contact points are calculated by perturbing the orientation of the smallest object orthogonal to the separating normal.
///This idea was described by Gino van den Bergen in this forum topic http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=4&t=288&p=888#p888
class btConvexConvexAlgorithm : public btActivatingCollisionAlgorithm
{
#ifdef USE_SEPDISTANCE_UTIL2
btConvexSeparatingDistanceUtil m_sepDistance;
#endif
btSimplexSolverInterface* m_simplexSolver;
btConvexPenetrationDepthSolver* m_pdSolver;
bool m_ownManifold;
btPersistentManifold* m_manifoldPtr;
bool m_lowLevelOfDetail;
int m_numPerturbationIterations;
int m_minimumPointsPerturbationThreshold;
///cache separating vector to speedup collision detection
public:
btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold);
virtual ~btConvexConvexAlgorithm();
@@ -65,9 +85,12 @@ public:
struct CreateFunc :public btCollisionAlgorithmCreateFunc
{
btConvexPenetrationDepthSolver* m_pdSolver;
btSimplexSolverInterface* m_simplexSolver;
int m_numPerturbationIterations;
int m_minimumPointsPerturbationThreshold;
CreateFunc(btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
virtual ~CreateFunc();
@@ -75,7 +98,7 @@ public:
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
{
void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConvexAlgorithm));
return new(mem) btConvexConvexAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver);
return new(mem) btConvexConvexAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold);
}
};

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.
@@ -22,15 +22,17 @@ subject to the following restrictions:
//#include <stdio.h>
btConvexPlaneCollisionAlgorithm::btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped)
btConvexPlaneCollisionAlgorithm::btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped, int numPerturbationIterations,int minimumPointsPerturbationThreshold)
: btCollisionAlgorithm(ci),
m_ownManifold(false),
m_manifoldPtr(mf),
m_isSwapped(isSwapped)
m_isSwapped(isSwapped),
m_numPerturbationIterations(numPerturbationIterations),
m_minimumPointsPerturbationThreshold(minimumPointsPerturbationThreshold)
{
btCollisionObject* convexObj = m_isSwapped? col1 : col0;
btCollisionObject* planeObj = m_isSwapped? col0 : col1;
if (!m_manifoldPtr && m_dispatcher->needsCollision(convexObj,planeObj))
{
m_manifoldPtr = m_dispatcher->getNewManifold(convexObj,planeObj);
@@ -48,30 +50,28 @@ btConvexPlaneCollisionAlgorithm::~btConvexPlaneCollisionAlgorithm()
}
}
void btConvexPlaneCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
void btConvexPlaneCollisionAlgorithm::collideSingleContact (const btQuaternion& perturbeRot, btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
{
(void)dispatchInfo;
(void)resultOut;
if (!m_manifoldPtr)
return;
btCollisionObject* convexObj = m_isSwapped? body1 : body0;
btCollisionObject* convexObj = m_isSwapped? body1 : body0;
btCollisionObject* planeObj = m_isSwapped? body0: body1;
btConvexShape* convexShape = (btConvexShape*) convexObj->getCollisionShape();
btStaticPlaneShape* planeShape = (btStaticPlaneShape*) planeObj->getCollisionShape();
bool hasCollision = false;
bool hasCollision = false;
const btVector3& planeNormal = planeShape->getPlaneNormal();
const btScalar& planeConstant = planeShape->getPlaneConstant();
btTransform planeInConvex;
planeInConvex= convexObj->getWorldTransform().inverse() * planeObj->getWorldTransform();
btTransform convexWorldTransform = convexObj->getWorldTransform();
btTransform convexInPlaneTrans;
convexInPlaneTrans= planeObj->getWorldTransform().inverse() * convexObj->getWorldTransform();
convexInPlaneTrans= planeObj->getWorldTransform().inverse() * convexWorldTransform;
//now perturbe the convex-world transform
convexWorldTransform.getBasis()*=btMatrix3x3(perturbeRot);
btTransform planeInConvex;
planeInConvex= convexWorldTransform.inverse() * planeObj->getWorldTransform();
btVector3 vtx = convexShape->localGetSupportingVertex(planeInConvex.getBasis()*-planeNormal);
btVector3 vtxInPlane = convexInPlaneTrans(vtx);
btScalar distance = (planeNormal.dot(vtxInPlane) - planeConstant);
@@ -87,6 +87,53 @@ void btConvexPlaneCollisionAlgorithm::processCollision (btCollisionObject* body0
btVector3 pOnB = vtxInPlaneWorld;
resultOut->addContactPoint(normalOnSurfaceB,pOnB,distance);
}
}
void btConvexPlaneCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
{
(void)dispatchInfo;
if (!m_manifoldPtr)
return;
btCollisionObject* convexObj = m_isSwapped? body1 : body0;
btCollisionObject* planeObj = m_isSwapped? body0: body1;
btConvexShape* convexShape = (btConvexShape*) convexObj->getCollisionShape();
btStaticPlaneShape* planeShape = (btStaticPlaneShape*) planeObj->getCollisionShape();
bool hasCollision = false;
const btVector3& planeNormal = planeShape->getPlaneNormal();
const btScalar& planeConstant = planeShape->getPlaneConstant();
//first perform a collision query with the non-perturbated collision objects
{
btQuaternion rotq(0,0,0,1);
collideSingleContact(rotq,body0,body1,dispatchInfo,resultOut);
}
if (resultOut->getPersistentManifold()->getNumContacts()<m_minimumPointsPerturbationThreshold)
{
btVector3 v0,v1;
btPlaneSpace1(planeNormal,v0,v1);
//now perform 'm_numPerturbationIterations' collision queries with the perturbated collision objects
const btScalar angleLimit = 0.125f * SIMD_PI;
btScalar perturbeAngle;
btScalar radius = convexShape->getAngularMotionDisc();
perturbeAngle = gContactBreakingThreshold / radius;
if ( perturbeAngle > angleLimit )
perturbeAngle = angleLimit;
btQuaternion perturbeRot(v0,perturbeAngle);
for (int i=0;i<m_numPerturbationIterations;i++)
{
btScalar iterationAngle = i*(SIMD_2_PI/btScalar(m_numPerturbationIterations));
btQuaternion rotq(planeNormal,iterationAngle);
collideSingleContact(rotq.inverse()*perturbeRot*rotq,body0,body1,dispatchInfo,resultOut);
}
}
if (m_ownManifold)
{
if (m_manifoldPtr->getNumContacts())

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.
@@ -28,18 +28,22 @@ class btPersistentManifold;
/// Other features are frame-coherency (persistent data) and collision response.
class btConvexPlaneCollisionAlgorithm : public btCollisionAlgorithm
{
bool m_ownManifold;
bool m_ownManifold;
btPersistentManifold* m_manifoldPtr;
bool m_isSwapped;
bool m_isSwapped;
int m_numPerturbationIterations;
int m_minimumPointsPerturbationThreshold;
public:
btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped);
btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped, int numPerturbationIterations,int minimumPointsPerturbationThreshold);
virtual ~btConvexPlaneCollisionAlgorithm();
virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
void collideSingleContact (const btQuaternion& perturbeRot, btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
@@ -52,15 +56,24 @@ public:
struct CreateFunc :public btCollisionAlgorithmCreateFunc
{
int m_numPerturbationIterations;
int m_minimumPointsPerturbationThreshold;
CreateFunc()
: m_numPerturbationIterations(3),
m_minimumPointsPerturbationThreshold(3)
{
}
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
{
void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexPlaneCollisionAlgorithm));
if (!m_swapped)
{
return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,false);
return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,false,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold);
} else
{
return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,true);
return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,true,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold);
}
}
};

View File

@@ -100,11 +100,10 @@ btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefault
int maxSize = sizeof(btConvexConvexAlgorithm);
int maxSize2 = sizeof(btConvexConcaveCollisionAlgorithm);
int maxSize3 = sizeof(btCompoundCollisionAlgorithm);
int maxSize4 = sizeof(btEmptyAlgorithm);
int sl = sizeof(btConvexSeparatingDistanceUtil);
sl = sizeof(btGjkPairDetector);
int collisionAlgorithmMaxElementSize = btMax(maxSize,maxSize2);
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize3);
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize4);
if (constructionInfo.m_stackAlloc)
{
@@ -289,3 +288,10 @@ btCollisionAlgorithmCreateFunc* btDefaultCollisionConfiguration::getCollisionAlg
//failed to find an algorithm
return m_emptyCreateFunc;
}
void btDefaultCollisionConfiguration::setConvexConvexMultipointIterations(int numPerturbationIterations, int minimumPointsPerturbationThreshold)
{
btConvexConvexAlgorithm::CreateFunc* convexConvex = (btConvexConvexAlgorithm::CreateFunc*) m_convexConvexCreateFunc;
convexConvex->m_numPerturbationIterations = numPerturbationIterations;
convexConvex->m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
}

View File

@@ -33,9 +33,9 @@ struct btDefaultCollisionConstructionInfo
:m_stackAlloc(0),
m_persistentManifoldPool(0),
m_collisionAlgorithmPool(0),
m_defaultMaxPersistentManifoldPoolSize(65535),
m_defaultMaxCollisionAlgorithmPoolSize(65535),
m_defaultStackAllocatorSize(5*1024*1024)
m_defaultMaxPersistentManifoldPoolSize(4096),
m_defaultMaxCollisionAlgorithmPoolSize(4096),
m_defaultStackAllocatorSize(0)
{
}
};
@@ -44,10 +44,12 @@ struct btDefaultCollisionConstructionInfo
///btCollisionConfiguration allows to configure Bullet collision detection
///stack allocator, pool memory allocators
///todo: describe the meaning
///@todo: describe the meaning
class btDefaultCollisionConfiguration : public btCollisionConfiguration
{
protected:
int m_persistentManifoldPoolSize;
btStackAlloc* m_stackAlloc;
@@ -56,6 +58,7 @@ class btDefaultCollisionConfiguration : public btCollisionConfiguration
btPoolAllocator* m_persistentManifoldPool;
bool m_ownsPersistentManifoldPool;
btPoolAllocator* m_collisionAlgorithmPool;
bool m_ownsCollisionAlgorithmPool;
@@ -108,6 +111,14 @@ public:
virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1);
///Use this method to allow to generate multiple contact points between at once, between two objects using the generic convex-convex algorithm.
///By default, this feature is disabled for best performance.
///@param numPerturbationIterations controls the number of collision queries. Set it to zero to disable the feature.
///@param minimumPointsPerturbationThreshold is the minimum number of points in the contact cache, above which the feature is disabled
///3 is a good value for both params, if you want to enable the feature. This is because the default contact cache contains a maximum of 4 points, and one collision query at the unperturbed orientation is performed first.
///See Bullet/Demos/CollisionDemo for an example how this feature gathers multiple points.
///@todo we could add a per-object setting of those parameters, for level-of-detail collision detection.
void setConvexConvexMultipointIterations(int numPerturbationIterations=3, int minimumPointsPerturbationThreshold = 3);
};

View File

@@ -0,0 +1,171 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2008 Erwin Coumans http://bulletphysics.com
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 "btGhostObject.h"
#include "btCollisionWorld.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "LinearMath/btAabbUtil2.h"
btGhostObject::btGhostObject()
{
m_internalType = CO_GHOST_OBJECT;
}
btGhostObject::~btGhostObject()
{
///btGhostObject should have been removed from the world, so no overlapping objects
btAssert(!m_overlappingObjects.size());
}
void btGhostObject::addOverlappingObjectInternal(btBroadphaseProxy* otherProxy,btBroadphaseProxy* thisProxy)
{
btCollisionObject* otherObject = (btCollisionObject*)otherProxy->m_clientObject;
btAssert(otherObject);
///if this linearSearch becomes too slow (too many overlapping objects) we should add a more appropriate data structure
int index = m_overlappingObjects.findLinearSearch(otherObject);
if (index==m_overlappingObjects.size())
{
//not found
m_overlappingObjects.push_back(otherObject);
}
}
void btGhostObject::removeOverlappingObjectInternal(btBroadphaseProxy* otherProxy,btDispatcher* dispatcher,btBroadphaseProxy* thisProxy)
{
btCollisionObject* otherObject = (btCollisionObject*)otherProxy->m_clientObject;
btAssert(otherObject);
int index = m_overlappingObjects.findLinearSearch(otherObject);
if (index<m_overlappingObjects.size())
{
m_overlappingObjects[index] = m_overlappingObjects[m_overlappingObjects.size()-1];
m_overlappingObjects.pop_back();
}
}
btPairCachingGhostObject::btPairCachingGhostObject()
{
m_hashPairCache = new (btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16)) btHashedOverlappingPairCache();
}
btPairCachingGhostObject::~btPairCachingGhostObject()
{
m_hashPairCache->~btHashedOverlappingPairCache();
btAlignedFree( m_hashPairCache );
}
void btPairCachingGhostObject::addOverlappingObjectInternal(btBroadphaseProxy* otherProxy,btBroadphaseProxy* thisProxy)
{
btBroadphaseProxy*actualThisProxy = thisProxy ? thisProxy : getBroadphaseHandle();
btAssert(actualThisProxy);
btCollisionObject* otherObject = (btCollisionObject*)otherProxy->m_clientObject;
btAssert(otherObject);
int index = m_overlappingObjects.findLinearSearch(otherObject);
if (index==m_overlappingObjects.size())
{
m_overlappingObjects.push_back(otherObject);
m_hashPairCache->addOverlappingPair(actualThisProxy,otherProxy);
}
}
void btPairCachingGhostObject::removeOverlappingObjectInternal(btBroadphaseProxy* otherProxy,btDispatcher* dispatcher,btBroadphaseProxy* thisProxy1)
{
btCollisionObject* otherObject = (btCollisionObject*)otherProxy->m_clientObject;
btBroadphaseProxy* actualThisProxy = thisProxy1 ? thisProxy1 : getBroadphaseHandle();
btAssert(actualThisProxy);
btAssert(otherObject);
int index = m_overlappingObjects.findLinearSearch(otherObject);
if (index<m_overlappingObjects.size())
{
m_overlappingObjects[index] = m_overlappingObjects[m_overlappingObjects.size()-1];
m_overlappingObjects.pop_back();
m_hashPairCache->removeOverlappingPair(actualThisProxy,otherProxy,dispatcher);
}
}
void btGhostObject::convexSweepTest(const btConvexShape* castShape, const btTransform& convexFromWorld, const btTransform& convexToWorld, btCollisionWorld::ConvexResultCallback& resultCallback, btScalar allowedCcdPenetration) 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_overlappingObjects.size();i++)
{
btCollisionObject* collisionObject= m_overlappingObjects[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))
{
btCollisionWorld::objectQuerySingle(castShape, convexFromTrans,convexToTrans,
collisionObject,
collisionObject->getCollisionShape(),
collisionObject->getWorldTransform(),
resultCallback,
allowedCcdPenetration);
}
}
}
}
void btGhostObject::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, btCollisionWorld::RayResultCallback& resultCallback) const
{
btTransform rayFromTrans;
rayFromTrans.setIdentity();
rayFromTrans.setOrigin(rayFromWorld);
btTransform rayToTrans;
rayToTrans.setIdentity();
rayToTrans.setOrigin(rayToWorld);
int i;
for (i=0;i<m_overlappingObjects.size();i++)
{
btCollisionObject* collisionObject= m_overlappingObjects[i];
//only perform raycast if filterMask matches
if(resultCallback.needsCollision(collisionObject->getBroadphaseHandle()))
{
btCollisionWorld::rayTestSingle(rayFromTrans,rayToTrans,
collisionObject,
collisionObject->getCollisionShape(),
collisionObject->getWorldTransform(),
resultCallback);
}
}
}

View File

@@ -0,0 +1,174 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2008 Erwin Coumans http://bulletphysics.com
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_GHOST_OBJECT_H
#define BT_GHOST_OBJECT_H
#include "btCollisionObject.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h"
#include "LinearMath/btAlignedAllocator.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
#include "btCollisionWorld.h"
class btConvexShape;
class btDispatcher;
///The btGhostObject can keep track of all objects that are overlapping
///By default, this overlap is based on the AABB
///This is useful for creating a character controller, collision sensors/triggers, explosions etc.
///We plan on adding rayTest and other queries for the btGhostObject
ATTRIBUTE_ALIGNED16(class) btGhostObject : public btCollisionObject
{
protected:
btAlignedObjectArray<btCollisionObject*> m_overlappingObjects;
public:
btGhostObject();
virtual ~btGhostObject();
void convexSweepTest(const class btConvexShape* castShape, const btTransform& convexFromWorld, const btTransform& convexToWorld, btCollisionWorld::ConvexResultCallback& resultCallback, btScalar allowedCcdPenetration = 0.f) const;
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, btCollisionWorld::RayResultCallback& resultCallback) const;
///this method is mainly for expert/internal use only.
virtual void addOverlappingObjectInternal(btBroadphaseProxy* otherProxy, btBroadphaseProxy* thisProxy=0);
///this method is mainly for expert/internal use only.
virtual void removeOverlappingObjectInternal(btBroadphaseProxy* otherProxy,btDispatcher* dispatcher,btBroadphaseProxy* thisProxy=0);
int getNumOverlappingObjects() const
{
return m_overlappingObjects.size();
}
btCollisionObject* getOverlappingObject(int index)
{
return m_overlappingObjects[index];
}
const btCollisionObject* getOverlappingObject(int index) const
{
return m_overlappingObjects[index];
}
btAlignedObjectArray<btCollisionObject*>& getOverlappingPairs()
{
return m_overlappingObjects;
}
const btAlignedObjectArray<btCollisionObject*> getOverlappingPairs() const
{
return m_overlappingObjects;
}
//
// internal cast
//
static const btGhostObject* upcast(const btCollisionObject* colObj)
{
if (colObj->getInternalType()==CO_GHOST_OBJECT)
return (const btGhostObject*)colObj;
return 0;
}
static btGhostObject* upcast(btCollisionObject* colObj)
{
if (colObj->getInternalType()==CO_GHOST_OBJECT)
return (btGhostObject*)colObj;
return 0;
}
};
class btPairCachingGhostObject : public btGhostObject
{
btHashedOverlappingPairCache* m_hashPairCache;
public:
btPairCachingGhostObject();
virtual ~btPairCachingGhostObject();
///this method is mainly for expert/internal use only.
virtual void addOverlappingObjectInternal(btBroadphaseProxy* otherProxy, btBroadphaseProxy* thisProxy=0);
virtual void removeOverlappingObjectInternal(btBroadphaseProxy* otherProxy,btDispatcher* dispatcher,btBroadphaseProxy* thisProxy=0);
btHashedOverlappingPairCache* getOverlappingPairCache()
{
return m_hashPairCache;
}
};
///The btGhostPairCallback interfaces and forwards adding and removal of overlapping pairs from the btBroadphaseInterface to btGhostObject.
class btGhostPairCallback : public btOverlappingPairCallback
{
public:
btGhostPairCallback()
{
}
virtual ~btGhostPairCallback()
{
}
virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
{
btCollisionObject* colObj0 = (btCollisionObject*) proxy0->m_clientObject;
btCollisionObject* colObj1 = (btCollisionObject*) proxy1->m_clientObject;
btGhostObject* ghost0 = btGhostObject::upcast(colObj0);
btGhostObject* ghost1 = btGhostObject::upcast(colObj1);
if (ghost0)
ghost0->addOverlappingObjectInternal(proxy1, proxy0);
if (ghost1)
ghost1->addOverlappingObjectInternal(proxy0, proxy1);
return 0;
}
virtual void* removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,btDispatcher* dispatcher)
{
btCollisionObject* colObj0 = (btCollisionObject*) proxy0->m_clientObject;
btCollisionObject* colObj1 = (btCollisionObject*) proxy1->m_clientObject;
btGhostObject* ghost0 = btGhostObject::upcast(colObj0);
btGhostObject* ghost1 = btGhostObject::upcast(colObj1);
if (ghost0)
ghost0->removeOverlappingObjectInternal(proxy1,dispatcher,proxy0);
if (ghost1)
ghost1->removeOverlappingObjectInternal(proxy0,dispatcher,proxy1);
return 0;
}
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy0,btDispatcher* dispatcher)
{
btAssert(0);
//need to keep track of all ghost objects and call them here
//m_hashPairCache->removeOverlappingPairsContainingProxy(proxy0,dispatcher);
}
};
#endif

View File

@@ -55,7 +55,7 @@ btManifoldResult::btManifoldResult(btCollisionObject* body0,btCollisionObject* b
void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)
{
assert(m_manifoldPtr);
btAssert(m_manifoldPtr);
//order in manifold needs to match
if (depth > m_manifoldPtr->getContactBreakingThreshold())
@@ -92,8 +92,8 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b
newPt.m_partId1 = m_partId1;
newPt.m_index0 = m_index0;
newPt.m_index1 = m_index1;
///todo, check this for any side effects
//printf("depth=%f\n",depth);
///@todo, check this for any side effects
if (insertIndex >= 0)
{
//const btManifoldPoint& oldPoint = m_manifoldPtr->getContactPoint(insertIndex);

View File

@@ -45,6 +45,8 @@ class btManifoldResult : public btDiscreteCollisionDetectorInterface::Result
int m_partId1;
int m_index0;
int m_index1;
public:
btManifoldResult()
@@ -77,6 +79,7 @@ public:
m_index1=index1;
}
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth);
SIMD_FORCE_INLINE void refreshContactPoints()

View File

@@ -24,7 +24,8 @@ subject to the following restrictions:
//#include <stdio.h>
#include "LinearMath/btQuickprof.h"
btSimulationIslandManager::btSimulationIslandManager()
btSimulationIslandManager::btSimulationIslandManager():
m_splitIslands(true)
{
}
@@ -43,10 +44,10 @@ void btSimulationIslandManager::findUnions(btDispatcher* /* dispatcher */,btColl
{
{
btBroadphasePair* pairPtr = colWorld->getPairCache()->getOverlappingPairArrayPtr();
for (int i=0;i<colWorld->getPairCache()->getNumOverlappingPairs();i++)
{
btBroadphasePair* pairPtr = colWorld->getPairCache()->getOverlappingPairArrayPtr();
const btBroadphasePair& collisionPair = pairPtr[i];
btCollisionObject* colObj0 = (btCollisionObject*)collisionPair.m_pProxy0->m_clientObject;
btCollisionObject* colObj1 = (btCollisionObject*)collisionPair.m_pProxy1->m_clientObject;
@@ -105,7 +106,7 @@ void btSimulationIslandManager::storeIslandActivationState(btCollisionWorld* col
for (i=0;i<colWorld->getCollisionObjectArray().size();i++)
{
btCollisionObject* collisionObject= colWorld->getCollisionObjectArray()[i];
if (collisionObject->mergesSimulationIslands())
if (!collisionObject->isStaticOrKinematicObject())
{
collisionObject->setIslandTag( m_unionFind.find(index) );
collisionObject->setCompanionId(-1);
@@ -143,11 +144,13 @@ class btPersistentManifoldSortPredicate
};
void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisionObjectArray& collisionObjects)
void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisionWorld* collisionWorld)
{
BT_PROFILE("islandUnionFindAndQuickSort");
btCollisionObjectArray& collisionObjects = collisionWorld->getCollisionObjectArray();
m_islandmanifold.resize(0);
//we are going to sort the unionfind array, and store the element id in the size
@@ -183,7 +186,7 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio
// printf("error in island management\n");
}
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
if (colObj0->getIslandTag() == islandId)
{
if (colObj0->getActivationState()== ACTIVE_TAG)
@@ -210,7 +213,7 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio
// printf("error in island management\n");
}
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
if (colObj0->getIslandTag() == islandId)
{
@@ -231,13 +234,14 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio
// printf("error in island management\n");
}
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
if (colObj0->getIslandTag() == islandId)
{
if ( colObj0->getActivationState() == ISLAND_SLEEPING)
{
colObj0->setActivationState( WANTS_DEACTIVATION);
colObj0->setDeactivationTime(0.f);
}
}
}
@@ -248,11 +252,11 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio
int i;
int maxNumManifolds = dispatcher->getNumManifolds();
#define SPLIT_ISLANDS 1
#ifdef SPLIT_ISLANDS
//#define SPLIT_ISLANDS 1
//#ifdef SPLIT_ISLANDS
#endif //SPLIT_ISLANDS
//#endif //SPLIT_ISLANDS
for (i=0;i<maxNumManifolds ;i++)
@@ -262,7 +266,7 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio
btCollisionObject* colObj0 = static_cast<btCollisionObject*>(manifold->getBody0());
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->getBody1());
//todo: check sleeping conditions!
///@todo: check sleeping conditions!
if (((colObj0) && colObj0->getActivationState() != ISLAND_SLEEPING) ||
((colObj1) && colObj1->getActivationState() != ISLAND_SLEEPING))
{
@@ -276,24 +280,24 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio
{
colObj0->activate();
}
#ifdef SPLIT_ISLANDS
// //filtering for response
if (dispatcher->needsResponse(colObj0,colObj1))
m_islandmanifold.push_back(manifold);
#endif //SPLIT_ISLANDS
if(m_splitIslands)
{
//filtering for response
if (dispatcher->needsResponse(colObj0,colObj1))
m_islandmanifold.push_back(manifold);
}
}
}
}
//
// todo: this is random access, it can be walked 'cache friendly'!
//
void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,btCollisionObjectArray& collisionObjects, IslandCallback* callback)
///@todo: this is random access, it can be walked 'cache friendly'!
void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,btCollisionWorld* collisionWorld, IslandCallback* callback)
{
btCollisionObjectArray& collisionObjects = collisionWorld->getCollisionObjectArray();
buildIslands(dispatcher,collisionObjects);
buildIslands(dispatcher,collisionWorld);
int endIslandIndex=1;
int startIslandIndex;
@@ -301,84 +305,86 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
BT_PROFILE("processIslands");
#ifndef SPLIT_ISLANDS
btPersistentManifold** manifold = dispatcher->getInternalManifoldPointer();
callback->ProcessIsland(&collisionObjects[0],collisionObjects.size(),manifold,maxNumManifolds, -1);
#else
// Sort manifolds, based on islands
// Sort the vector using predicate and std::sort
//std::sort(islandmanifold.begin(), islandmanifold.end(), btPersistentManifoldSortPredicate);
int numManifolds = int (m_islandmanifold.size());
//we should do radix sort, it it much faster (O(n) instead of O (n log2(n))
m_islandmanifold.quickSort(btPersistentManifoldSortPredicate());
//now process all active islands (sets of manifolds for now)
int startManifoldIndex = 0;
int endManifoldIndex = 1;
//int islandId;
// printf("Start Islands\n");
//traverse the simulation islands, and call the solver, unless all objects are sleeping/deactivated
for ( startIslandIndex=0;startIslandIndex<numElem;startIslandIndex = endIslandIndex)
if(!m_splitIslands)
{
int islandId = getUnionFind().getElement(startIslandIndex).m_id;
btPersistentManifold** manifold = dispatcher->getInternalManifoldPointer();
int maxNumManifolds = dispatcher->getNumManifolds();
callback->ProcessIsland(&collisionObjects[0],collisionObjects.size(),manifold,maxNumManifolds, -1);
}
else
{
// Sort manifolds, based on islands
// Sort the vector using predicate and std::sort
//std::sort(islandmanifold.begin(), islandmanifold.end(), btPersistentManifoldSortPredicate);
int numManifolds = int (m_islandmanifold.size());
bool islandSleeping = false;
for (endIslandIndex = startIslandIndex;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
{
int i = getUnionFind().getElement(endIslandIndex).m_sz;
btCollisionObject* colObj0 = collisionObjects[i];
m_islandBodies.push_back(colObj0);
if (!colObj0->isActive())
islandSleeping = true;
}
//we should do radix sort, it it much faster (O(n) instead of O (n log2(n))
m_islandmanifold.quickSort(btPersistentManifoldSortPredicate());
//find the accompanying contact manifold for this islandId
int numIslandManifolds = 0;
btPersistentManifold** startManifold = 0;
//now process all active islands (sets of manifolds for now)
if (startManifoldIndex<numManifolds)
int startManifoldIndex = 0;
int endManifoldIndex = 1;
//int islandId;
// printf("Start Islands\n");
//traverse the simulation islands, and call the solver, unless all objects are sleeping/deactivated
for ( startIslandIndex=0;startIslandIndex<numElem;startIslandIndex = endIslandIndex)
{
int curIslandId = getIslandId(m_islandmanifold[startManifoldIndex]);
if (curIslandId == islandId)
{
startManifold = &m_islandmanifold[startManifoldIndex];
for (endManifoldIndex = startManifoldIndex+1;(endManifoldIndex<numManifolds) && (islandId == getIslandId(m_islandmanifold[endManifoldIndex]));endManifoldIndex++)
{
int islandId = getUnionFind().getElement(startIslandIndex).m_id;
bool islandSleeping = false;
for (endIslandIndex = startIslandIndex;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
{
int i = getUnionFind().getElement(endIslandIndex).m_sz;
btCollisionObject* colObj0 = collisionObjects[i];
m_islandBodies.push_back(colObj0);
if (!colObj0->isActive())
islandSleeping = true;
}
//find the accompanying contact manifold for this islandId
int numIslandManifolds = 0;
btPersistentManifold** startManifold = 0;
if (startManifoldIndex<numManifolds)
{
int curIslandId = getIslandId(m_islandmanifold[startManifoldIndex]);
if (curIslandId == islandId)
{
startManifold = &m_islandmanifold[startManifoldIndex];
for (endManifoldIndex = startManifoldIndex+1;(endManifoldIndex<numManifolds) && (islandId == getIslandId(m_islandmanifold[endManifoldIndex]));endManifoldIndex++)
{
}
/// Process the actual simulation, only if not sleeping/deactivated
numIslandManifolds = endManifoldIndex-startManifoldIndex;
}
/// Process the actual simulation, only if not sleeping/deactivated
numIslandManifolds = endManifoldIndex-startManifoldIndex;
}
}
if (!islandSleeping)
{
callback->ProcessIsland(&m_islandBodies[0],m_islandBodies.size(),startManifold,numIslandManifolds, islandId);
// printf("Island callback of size:%d bodies, %d manifolds\n",islandBodies.size(),numIslandManifolds);
}
if (numIslandManifolds)
{
startManifoldIndex = endManifoldIndex;
}
if (!islandSleeping)
{
callback->ProcessIsland(&m_islandBodies[0],m_islandBodies.size(),startManifold,numIslandManifolds, islandId);
// printf("Island callback of size:%d bodies, %d manifolds\n",islandBodies.size(),numIslandManifolds);
m_islandBodies.resize(0);
}
if (numIslandManifolds)
{
startManifoldIndex = endManifoldIndex;
}
m_islandBodies.resize(0);
}
#endif //SPLIT_ISLANDS
} // else if(!splitIslands)
}

View File

@@ -19,7 +19,7 @@ subject to the following restrictions:
#include "BulletCollision/CollisionDispatch/btUnionFind.h"
#include "btCollisionCreateFunc.h"
#include "LinearMath/btAlignedObjectArray.h"
#include "btCollisionObject.h"
class btCollisionObject;
class btCollisionWorld;
@@ -35,6 +35,7 @@ class btSimulationIslandManager
btAlignedObjectArray<btPersistentManifold*> m_islandmanifold;
btAlignedObjectArray<btCollisionObject* > m_islandBodies;
bool m_splitIslands;
public:
btSimulationIslandManager();
@@ -61,9 +62,18 @@ public:
virtual void ProcessIsland(btCollisionObject** bodies,int numBodies,class btPersistentManifold** manifolds,int numManifolds, int islandId) = 0;
};
void buildAndProcessIslands(btDispatcher* dispatcher,btCollisionObjectArray& collisionObjects, IslandCallback* callback);
void buildAndProcessIslands(btDispatcher* dispatcher,btCollisionWorld* collisionWorld, IslandCallback* callback);
void buildIslands(btDispatcher* dispatcher,btCollisionObjectArray& collisionObjects);
void buildIslands(btDispatcher* dispatcher,btCollisionWorld* colWorld);
bool getSplitIslands()
{
return m_splitIslands;
}
void setSplitIslands(bool doSplitIslands)
{
m_splitIslands = doSplitIslands;
}
};

View File

@@ -21,7 +21,7 @@ subject to the following restrictions:
//#include <stdio.h>
btSphereBoxCollisionAlgorithm::btSphereBoxCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped)
: btCollisionAlgorithm(ci),
: btActivatingCollisionAlgorithm(ci,col0,col1),
m_ownManifold(false),
m_manifoldPtr(mf),
m_isSwapped(isSwapped)

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef SPHERE_BOX_COLLISION_ALGORITHM_H
#define SPHERE_BOX_COLLISION_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
class btPersistentManifold;
@@ -26,7 +26,7 @@ class btPersistentManifold;
/// btSphereBoxCollisionAlgorithm provides sphere-box collision detection.
/// Other features are frame-coherency (persistent data) and collision response.
class btSphereBoxCollisionAlgorithm : public btCollisionAlgorithm
class btSphereBoxCollisionAlgorithm : public btActivatingCollisionAlgorithm
{
bool m_ownManifold;
btPersistentManifold* m_manifoldPtr;

View File

@@ -19,7 +19,7 @@ subject to the following restrictions:
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
btSphereSphereCollisionAlgorithm::btSphereSphereCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1)
: btCollisionAlgorithm(ci),
: btActivatingCollisionAlgorithm(ci,col0,col1),
m_ownManifold(false),
m_manifoldPtr(mf)
{
@@ -78,7 +78,7 @@ void btSphereSphereCollisionAlgorithm::processCollision (btCollisionObject* col0
}
///point on A (worldspace)
btVector3 pos0 = col0->getWorldTransform().getOrigin() - radius0 * normalOnSurfaceB;
///btVector3 pos0 = col0->getWorldTransform().getOrigin() - radius0 * normalOnSurfaceB;
///point on B (worldspace)
btVector3 pos1 = col1->getWorldTransform().getOrigin() + radius1* normalOnSurfaceB;

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef SPHERE_SPHERE_COLLISION_ALGORITHM_H
#define SPHERE_SPHERE_COLLISION_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
#include "btCollisionDispatcher.h"
@@ -26,7 +26,7 @@ class btPersistentManifold;
/// btSphereSphereCollisionAlgorithm provides sphere-sphere collision detection.
/// Other features are frame-coherency (persistent data) and collision response.
/// Also provides the most basic sample for custom/user btCollisionAlgorithm
class btSphereSphereCollisionAlgorithm : public btCollisionAlgorithm
class btSphereSphereCollisionAlgorithm : public btActivatingCollisionAlgorithm
{
bool m_ownManifold;
btPersistentManifold* m_manifoldPtr;
@@ -35,7 +35,7 @@ public:
btSphereSphereCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1);
btSphereSphereCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
: btCollisionAlgorithm(ci) {}
: btActivatingCollisionAlgorithm(ci) {}
virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);

View File

@@ -22,7 +22,7 @@ subject to the following restrictions:
btSphereTriangleCollisionAlgorithm::btSphereTriangleCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1,bool swapped)
: btCollisionAlgorithm(ci),
: btActivatingCollisionAlgorithm(ci,col0,col1),
m_ownManifold(false),
m_manifoldPtr(mf),
m_swapped(swapped)
@@ -56,10 +56,10 @@ void btSphereTriangleCollisionAlgorithm::processCollision (btCollisionObject* co
/// report a contact. internally this will be kept persistent, and contact reduction is done
resultOut->setPersistentManifold(m_manifoldPtr);
SphereTriangleDetector detector(sphere,triangle);
SphereTriangleDetector detector(sphere,triangle, m_manifoldPtr->getContactBreakingThreshold());
btDiscreteCollisionDetectorInterface::ClosestPointInput input;
input.m_maximumDistanceSquared = btScalar(1e30);//todo: tighter bounds
input.m_maximumDistanceSquared = btScalar(1e30);///@todo: tighter bounds
input.m_transformA = sphereObj->getWorldTransform();
input.m_transformB = triObj->getWorldTransform();

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef SPHERE_TRIANGLE_COLLISION_ALGORITHM_H
#define SPHERE_TRIANGLE_COLLISION_ALGORITHM_H
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
class btPersistentManifold;
@@ -25,7 +25,7 @@ class btPersistentManifold;
/// btSphereSphereCollisionAlgorithm provides sphere-sphere collision detection.
/// Other features are frame-coherency (persistent data) and collision response.
/// Also provides the most basic sample for custom/user btCollisionAlgorithm
class btSphereTriangleCollisionAlgorithm : public btCollisionAlgorithm
class btSphereTriangleCollisionAlgorithm : public btActivatingCollisionAlgorithm
{
bool m_ownManifold;
btPersistentManifold* m_manifoldPtr;
@@ -35,7 +35,7 @@ public:
btSphereTriangleCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool swapped);
btSphereTriangleCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
: btCollisionAlgorithm(ci) {}
: btActivatingCollisionAlgorithm(ci) {}
virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);

View File

@@ -14,8 +14,6 @@ subject to the following restrictions:
*/
#include "btUnionFind.h"
#include <assert.h>

View File

@@ -98,8 +98,8 @@ class btUnionFind
int find(int x)
{
//assert(x < m_N);
//assert(x >= 0);
//btAssert(x < m_N);
//btAssert(x >= 0);
while (x != m_elements[x].m_id)
{
@@ -110,8 +110,8 @@ class btUnionFind
m_elements[x].m_id = m_elements[m_elements[x].m_id].m_id;
#endif //
x = m_elements[x].m_id;
//assert(x < m_N);
//assert(x >= 0);
//btAssert(x < m_N);
//btAssert(x >= 0);
}
return x;

View File

@@ -19,7 +19,7 @@ subject to the following restrictions:
#include "btPolyhedralConvexShape.h"
#include "btCollisionMargin.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "LinearMath/btPoint3.h"
#include "LinearMath/btVector3.h"
#include "LinearMath/btMinMax.h"
///The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by half extents, in local shape coordinates. When used as part of a btCollisionObject or btRigidBody it will be an oriented box in world space.
@@ -45,8 +45,6 @@ public:
}
virtual int getShapeType() const { return BOX_SHAPE_PROXYTYPE;}
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
{
btVector3 halfExtents = getHalfExtentsWithoutMargin();
@@ -82,8 +80,10 @@ public:
}
btBoxShape( const btVector3& boxHalfExtents)
btBoxShape( const btVector3& boxHalfExtents)
: btPolyhedralConvexShape()
{
m_shapeType = BOX_SHAPE_PROXYTYPE;
btVector3 margin(getMargin(),getMargin(),getMargin());
m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin;
};
@@ -117,7 +117,7 @@ public:
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const
{
//this plane might not be aligned...
btVector4 plane ;
@@ -161,36 +161,30 @@ public:
switch (i)
{
case 0:
plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.));
plane[3] = -halfExtents.x();
plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.),-halfExtents.x());
break;
case 1:
plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0.));
plane[3] = -halfExtents.x();
plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0.),-halfExtents.x());
break;
case 2:
plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.));
plane[3] = -halfExtents.y();
plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.),-halfExtents.y());
break;
case 3:
plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0.));
plane[3] = -halfExtents.y();
plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0.),-halfExtents.y());
break;
case 4:
plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.));
plane[3] = -halfExtents.z();
plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.),-halfExtents.z());
break;
case 5:
plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
plane[3] = -halfExtents.z();
plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.),-halfExtents.z());
break;
default:
assert(0);
btAssert(0);
}
}
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const
//virtual void getEdge(int i,Edge& edge) const
{
int edgeVert0 = 0;
@@ -261,7 +255,7 @@ public:
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const
virtual bool isInside(const btVector3& pt,btScalar tolerance) const
{
btVector3 halfExtents = getHalfExtentsWithoutMargin();
@@ -312,7 +306,7 @@ public:
penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
break;
default:
assert(0);
btAssert(0);
}
}

View File

@@ -26,6 +26,7 @@ m_bvh(0),
m_useQuantizedAabbCompression(useQuantizedAabbCompression),
m_ownsBvh(false)
{
m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;
//construct bvh from meshInterface
#ifndef DISABLE_BVH
@@ -57,6 +58,7 @@ m_bvh(0),
m_useQuantizedAabbCompression(useQuantizedAabbCompression),
m_ownsBvh(false)
{
m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;
//construct bvh from meshInterface
#ifndef DISABLE_BVH
@@ -141,10 +143,19 @@ void btBvhTriangleMeshShape::performRaycast (btTriangleCallback* callback, const
for (int j=2;j>=0;j--)
{
int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride);
m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
if (type == PHY_FLOAT)
{
float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
}
else
{
double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
m_triangle[j] = btVector3(btScalar(graphicsbase[0])*meshScaling.getX(),btScalar(graphicsbase[1])*meshScaling.getY(),btScalar(graphicsbase[2])*meshScaling.getZ());
}
}
/* Perform ray vs. triangle collision here */
@@ -202,9 +213,18 @@ void btBvhTriangleMeshShape::performConvexcast (btTriangleCallback* callback, co
{
int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride);
if (type == PHY_FLOAT)
{
float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
}
else
{
double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
m_triangle[j] = btVector3(btScalar(graphicsbase[0])*meshScaling.getX(),btScalar(graphicsbase[1])*meshScaling.getY(),btScalar(graphicsbase[2])*meshScaling.getZ());
}
}
/* Perform ray vs. triangle collision here */
@@ -279,12 +299,24 @@ void btBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,co
#ifdef DEBUG_TRIANGLE_MESH
printf("%d ,",graphicsindex);
#endif //DEBUG_TRIANGLE_MESH
btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride);
if (type == PHY_FLOAT)
{
float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
m_triangle[j] = btVector3(
graphicsbase[0]*meshScaling.getX(),
graphicsbase[1]*meshScaling.getY(),
graphicsbase[2]*meshScaling.getZ());
}
else
{
double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
m_triangle[j] = btVector3(
graphicsbase[0]*meshScaling.getX(),
graphicsbase[1]*meshScaling.getY(),
graphicsbase[2]*meshScaling.getZ());
m_triangle[j] = btVector3(
btScalar(graphicsbase[0])*meshScaling.getX(),
btScalar(graphicsbase[1])*meshScaling.getY(),
btScalar(graphicsbase[2])*meshScaling.getZ());
}
#ifdef DEBUG_TRIANGLE_MESH
printf("triangle vertices:%f,%f,%f\n",triangle[j].x(),triangle[j].y(),triangle[j].z());
#endif //DEBUG_TRIANGLE_MESH

View File

@@ -37,7 +37,7 @@ public:
BT_DECLARE_ALIGNED_ALLOCATOR();
btBvhTriangleMeshShape() :btTriangleMeshShape(0),m_bvh(0),m_ownsBvh(false) {};
btBvhTriangleMeshShape() : btTriangleMeshShape(0),m_bvh(0),m_ownsBvh(false) {m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;};
btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true);
///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
@@ -50,10 +50,7 @@ public:
return m_ownsBvh;
}
virtual int getShapeType() const
{
return TRIANGLE_MESH_SHAPE_PROXYTYPE;
}
void performRaycast (btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget);
void performConvexcast (btTriangleCallback* callback, const btVector3& boxSource, const btVector3& boxTarget, const btVector3& boxMin, const btVector3& boxMax);

View File

@@ -19,8 +19,9 @@ subject to the following restrictions:
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height)
btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInternalShape ()
{
m_shapeType = CAPSULE_SHAPE_PROXYTYPE;
m_upAxis = 1;
m_implicitShapeDimensions.setValue(radius,0.5f*height,radius);
}

View File

@@ -30,7 +30,7 @@ protected:
protected:
///only used for btCapsuleShapeZ and btCapsuleShapeX subclasses.
btCapsuleShape() {};
btCapsuleShape() : btConvexInternalShape() {m_shapeType = CAPSULE_SHAPE_PROXYTYPE;};
public:
btCapsuleShape(btScalar radius,btScalar height);
@@ -43,15 +43,13 @@ public:
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
virtual int getShapeType() const { return CAPSULE_SHAPE_PROXYTYPE; }
virtual void getAabb (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
{
btVector3 halfExtents(getRadius(),getRadius(),getRadius());
halfExtents[m_upAxis] = getRadius() + getHalfHeight();
halfExtents += btVector3(getMargin(),getMargin(),getMargin());
btMatrix3x3 abs_b = t.getBasis().absolute();
btPoint3 center = t.getOrigin();
btVector3 center = t.getOrigin();
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),abs_b[1].dot(halfExtents),abs_b[2].dot(halfExtents));
aabbMin = center - extent;

View File

@@ -16,6 +16,9 @@ subject to the following restrictions:
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
btScalar gContactThresholdFactor=btScalar(0.02);
/*
Make sure this dummy function never changes so that it
can be used by probes that are checking whether the
@@ -42,8 +45,13 @@ void btCollisionShape::getBoundingSphere(btVector3& center,btScalar& radius) con
center = (aabbMin+aabbMax)*btScalar(0.5);
}
btScalar btCollisionShape::getContactBreakingThreshold() const
{
return getAngularMotionDisc() * gContactThresholdFactor;
}
btScalar btCollisionShape::getAngularMotionDisc() const
{
///@todo cache this value, to improve performance
btVector3 center;
btScalar disc;
getBoundingSphere(center,disc);
@@ -65,7 +73,7 @@ void btCollisionShape::calculateTemporalAabb(const btTransform& curTrans,const b
// add linear motion
btVector3 linMotion = linvel*timeStep;
//todo: simd would have a vector max/min operation, instead of per-element access
///@todo: simd would have a vector max/min operation, instead of per-element access
if (linMotion.x() > btScalar(0.))
temporalAabbMaxx += linMotion.x();
else

View File

@@ -19,20 +19,21 @@ subject to the following restrictions:
#include "LinearMath/btTransform.h"
#include "LinearMath/btVector3.h"
#include "LinearMath/btMatrix3x3.h"
#include "LinearMath/btPoint3.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" //for the shape types
///The btCollisionShape class provides an interface for collision shapes that can be shared among btCollisionObjects.
class btCollisionShape
{
protected:
int m_shapeType;
void* m_userPointer;
public:
btCollisionShape() : m_userPointer(0)
btCollisionShape() : m_shapeType (INVALID_SHAPE_PROXYTYPE), m_userPointer(0)
{
}
virtual ~btCollisionShape()
{
}
@@ -45,6 +46,8 @@ public:
///getAngularMotionDisc returns the maximus radius needed for Conservative Advancement to handle time-of-impact with rotations.
virtual btScalar getAngularMotionDisc() const;
virtual btScalar getContactBreakingThreshold() const;
///calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep)
///result is conservative
@@ -76,7 +79,7 @@ public:
return btBroadphaseProxy::isInfinite(getShapeType());
}
virtual int getShapeType() const=0;
virtual void setLocalScaling(const btVector3& scaling) =0;
virtual const btVector3& getLocalScaling() const =0;
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const = 0;
@@ -87,13 +90,13 @@ public:
#endif //__SPU__
int getShapeType() const { return m_shapeType; }
virtual void setMargin(btScalar margin) = 0;
virtual btScalar getMargin() const = 0;
///optional user data pointer
void setUserPointer(void* userPtr)
void setUserPointer(void* userPtr)
{
m_userPointer = userPtr;
}

View File

@@ -17,16 +17,22 @@ subject to the following restrictions:
#include "btCollisionShape.h"
#include "BulletCollision/BroadphaseCollision/btDbvt.h"
btCompoundShape::btCompoundShape()
:m_localAabbMin(btScalar(1e30),btScalar(1e30),btScalar(1e30)),
btCompoundShape::btCompoundShape(bool enableDynamicAabbTree)
: m_localAabbMin(btScalar(1e30),btScalar(1e30),btScalar(1e30)),
m_localAabbMax(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30)),
m_collisionMargin(btScalar(0.)),
m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)),
m_dynamicAabbTree(0)
m_dynamicAabbTree(0),
m_updateRevision(1)
{
void* mem = btAlignedAlloc(sizeof(btDbvt),16);
m_dynamicAabbTree = new(mem) btDbvt();
btAssert(mem==m_dynamicAabbTree);
m_shapeType = COMPOUND_SHAPE_PROXYTYPE;
if (enableDynamicAabbTree)
{
void* mem = btAlignedAlloc(sizeof(btDbvt),16);
m_dynamicAabbTree = new(mem) btDbvt();
btAssert(mem==m_dynamicAabbTree);
}
}
@@ -41,6 +47,7 @@ btCompoundShape::~btCompoundShape()
void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisionShape* shape)
{
m_updateRevision++;
//m_childTransforms.push_back(localTransform);
//m_childShapes.push_back(shape);
btCompoundShapeChild child;
@@ -49,8 +56,7 @@ void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
child.m_childShapeType = shape->getShapeType();
child.m_childMargin = shape->getMargin();
m_children.push_back(child);
//extend the local aabbMin/aabbMax
btVector3 localAabbMin,localAabbMax;
shape->getAabb(localTransform,localAabbMin,localAabbMax);
@@ -69,14 +75,34 @@ void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
if (m_dynamicAabbTree)
{
const btDbvtVolume bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
int index = m_children.size()-1;
int index = m_children.size();
child.m_node = m_dynamicAabbTree->insert(bounds,(void*)index);
}
m_children.push_back(child);
}
void btCompoundShape::updateChildTransform(int childIndex, const btTransform& newChildTransform)
{
m_children[childIndex].m_transform = newChildTransform;
if (m_dynamicAabbTree)
{
///update the dynamic aabb tree
btVector3 localAabbMin,localAabbMax;
m_children[childIndex].m_childShape->getAabb(newChildTransform,localAabbMin,localAabbMax);
ATTRIBUTE_ALIGNED16(btDbvtVolume) bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
int index = m_children.size()-1;
m_dynamicAabbTree->update(m_children[childIndex].m_node,bounds);
}
recalculateLocalAabb();
}
void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
{
m_updateRevision++;
btAssert(childShapeIndex >=0 && childShapeIndex < m_children.size());
if (m_dynamicAabbTree)
{
@@ -87,8 +113,11 @@ void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
}
void btCompoundShape::removeChildShape(btCollisionShape* shape)
{
m_updateRevision++;
// Find the children containing the shape specified, and remove those children.
//note: there might be multiple children using the same shape!
for(int i = m_children.size()-1; i >= 0 ; i--)
@@ -98,6 +127,8 @@ void btCompoundShape::removeChildShape(btCollisionShape* shape)
m_children.swap(i,m_children.size()-1);
m_children.pop_back();
//remove it from the m_dynamicAabbTree too
//@todo: this leads to problems due to caching in the btCompoundCollisionAlgorithm
//so effectively, removeChildShape is broken at the moment
//m_dynamicAabbTree->remove(m_aabbProxies[i]);
//m_aabbProxies.swap(i,m_children.size()-1);
//m_aabbProxies.pop_back();
@@ -113,6 +144,7 @@ void btCompoundShape::recalculateLocalAabb()
{
// Recalculate the local aabb
// Brute force, it iterates over all the shapes left.
m_localAabbMin = btVector3(btScalar(1e30),btScalar(1e30),btScalar(1e30));
m_localAabbMax = btVector3(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30));
@@ -135,19 +167,27 @@ void btCompoundShape::recalculateLocalAabb()
void btCompoundShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
{
btVector3 localHalfExtents = btScalar(0.5)*(m_localAabbMax-m_localAabbMin);
localHalfExtents += btVector3(getMargin(),getMargin(),getMargin());
btVector3 localCenter = btScalar(0.5)*(m_localAabbMax+m_localAabbMin);
//avoid an illegal AABB when there are no children
if (!m_children.size())
{
localHalfExtents.setValue(0,0,0);
localCenter.setValue(0,0,0);
}
localHalfExtents += btVector3(getMargin(),getMargin(),getMargin());
btMatrix3x3 abs_b = trans.getBasis().absolute();
btPoint3 center = trans(localCenter);
btVector3 center = trans(localCenter);
btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
abs_b[1].dot(localHalfExtents),
abs_b[2].dot(localHalfExtents));
aabbMin = center-extent;
aabbMax = center+extent;
}
void btCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
@@ -179,7 +219,9 @@ void btCompoundShape::calculatePrincipalAxisTransform(btScalar* masses, btTransf
btScalar totalMass = 0;
btVector3 center(0, 0, 0);
for (int k = 0; k < n; k++)
int k;
for (k = 0; k < n; k++)
{
center += m_children[k].m_transform.getOrigin() * masses[k];
totalMass += masses[k];
@@ -188,7 +230,7 @@ void btCompoundShape::calculatePrincipalAxisTransform(btScalar* masses, btTransf
principal.setOrigin(center);
btMatrix3x3 tensor(0, 0, 0, 0, 0, 0, 0, 0, 0);
for (int k = 0; k < n; k++)
for ( k = 0; k < n; k++)
{
btVector3 i;
m_children[k].m_childShape->calculateLocalInertia(masses[k], i);

View File

@@ -46,23 +46,26 @@ SIMD_FORCE_INLINE bool operator==(const btCompoundShapeChild& c1, const btCompou
c1.m_childMargin == c2.m_childMargin );
}
/// btCompoundShape allows to store multiple other btCollisionShapes
/// The btCompoundShape allows to store multiple other btCollisionShapes
/// This allows for moving concave collision objects. This is more general then the static concave btBvhTriangleMeshShape.
/// It has an (optional) dynamic aabb tree to accelerate early rejection tests.
/// @todo: This aabb tree can also be use to speed up ray tests on btCompoundShape, see http://code.google.com/p/bullet/issues/detail?id=25
/// Currently, removal of child shapes is only supported when disabling the aabb tree (pass 'false' in the constructor of btCompoundShape)
ATTRIBUTE_ALIGNED16(class) btCompoundShape : public btCollisionShape
{
//btAlignedObjectArray<btTransform> m_childTransforms;
//btAlignedObjectArray<btCollisionShape*> m_childShapes;
btAlignedObjectArray<btCompoundShapeChild> m_children;
btVector3 m_localAabbMin;
btVector3 m_localAabbMax;
//btOptimizedBvh* m_aabbTree;
btDbvt* m_dynamicAabbTree;
///increment m_updateRevision when adding/removing/replacing child shapes, so that some caches can be updated
int m_updateRevision;
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
btCompoundShape();
btCompoundShape(bool enableDynamicAabbTree = true);
virtual ~btCompoundShape();
@@ -88,15 +91,18 @@ public:
return m_children[index].m_childShape;
}
btTransform getChildTransform(int index)
btTransform& getChildTransform(int index)
{
return m_children[index].m_transform;
}
const btTransform getChildTransform(int index) const
const btTransform& getChildTransform(int index) const
{
return m_children[index].m_transform;
}
///set a new transform for a child, and update internal data structures (local aabb and dynamic tree)
void updateChildTransform(int childIndex, const btTransform& newChildTransform);
btCompoundShapeChild* getChildList()
{
@@ -121,8 +127,6 @@ public:
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
virtual int getShapeType() const { return COMPOUND_SHAPE_PROXYTYPE;}
virtual void setMargin(btScalar margin)
{
m_collisionMargin = margin;
@@ -151,6 +155,10 @@ public:
///of the collision object by the principal transform.
void calculatePrincipalAxisTransform(btScalar* masses, btTransform& principal, btVector3& inertia) const;
int getUpdateRevision() const
{
return m_updateRevision;
}
private:
btScalar m_collisionMargin;

View File

@@ -20,6 +20,16 @@ subject to the following restrictions:
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
#include "btTriangleCallback.h"
/// PHY_ScalarType enumerates possible scalar types.
/// See the btStridingMeshInterface or btHeightfieldTerrainShape for its use
typedef enum PHY_ScalarType {
PHY_FLOAT,
PHY_DOUBLE,
PHY_INTEGER,
PHY_SHORT,
PHY_FIXEDPOINT88,
PHY_UCHAR
} PHY_ScalarType;
///The btConcaveShape class provides an interface for non-moving (static) concave shapes.
///It has been implemented by the btStaticPlaneShape, btBvhTriangleMeshShape and btHeightfieldTerrainShape.

View File

@@ -14,14 +14,14 @@ subject to the following restrictions:
*/
#include "btConeShape.h"
#include "LinearMath/btPoint3.h"
btConeShape::btConeShape (btScalar radius,btScalar height):
btConeShape::btConeShape (btScalar radius,btScalar height): btConvexInternalShape (),
m_radius (radius),
m_height(height)
{
m_shapeType = CONE_SHAPE_PROXYTYPE;
setConeUpIndex(1);
btVector3 halfExtents;
m_sinAngle = (m_radius / btSqrt(m_radius * m_radius + m_height * m_height));
@@ -60,7 +60,7 @@ void btConeShape::setConeUpIndex(int upIndex)
m_coneIndices[2] = 1;
break;
default:
assert(0);
btAssert(0);
};
}

View File

@@ -69,9 +69,6 @@ public:
}
virtual int getShapeType() const { return CONE_SHAPE_PROXYTYPE; }
virtual const char* getName()const
{
return "Cone";

View File

@@ -19,16 +19,17 @@ subject to the following restrictions:
btConvexHullShape ::btConvexHullShape (const btScalar* points,int numPoints,int stride)
btConvexHullShape ::btConvexHullShape (const btScalar* points,int numPoints,int stride) : btPolyhedralConvexShape ()
{
m_points.resize(numPoints);
m_shapeType = CONVEX_HULL_SHAPE_PROXYTYPE;
m_unscaledPoints.resize(numPoints);
unsigned char* pointsBaseAddress = (unsigned char*)points;
for (int i=0;i<numPoints;i++)
{
btPoint3* point = (btPoint3*)(pointsBaseAddress + i*stride);
m_points[i] = point[0];
btVector3* point = (btVector3*)(pointsBaseAddress + i*stride);
m_unscaledPoints[i] = point[0];
}
recalcLocalAabb();
@@ -43,9 +44,9 @@ void btConvexHullShape::setLocalScaling(const btVector3& scaling)
recalcLocalAabb();
}
void btConvexHullShape::addPoint(const btPoint3& point)
void btConvexHullShape::addPoint(const btVector3& point)
{
m_points.push_back(point);
m_unscaledPoints.push_back(point);
recalcLocalAabb();
}
@@ -67,9 +68,9 @@ btVector3 btConvexHullShape::localGetSupportingVertexWithoutMargin(const btVecto
}
for (int i=0;i<m_points.size();i++)
for (int i=0;i<m_unscaledPoints.size();i++)
{
btPoint3 vtx = m_points[i] * m_localScaling;
btVector3 vtx = m_unscaledPoints[i] * m_localScaling;
newDot = vec.dot(vtx);
if (newDot > maxDot)
@@ -91,9 +92,9 @@ void btConvexHullShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const
supportVerticesOut[i][3] = btScalar(-1e30);
}
}
for (int i=0;i<m_points.size();i++)
for (int i=0;i<m_unscaledPoints.size();i++)
{
btPoint3 vtx = m_points[i] * m_localScaling;
btVector3 vtx = getScaledPoint(i);
for (int j=0;j<numVectors;j++)
{
@@ -144,26 +145,26 @@ btVector3 btConvexHullShape::localGetSupportingVertex(const btVector3& vec)const
//Please note that you can debug-draw btConvexHullShape with the Raytracer Demo
int btConvexHullShape::getNumVertices() const
{
return m_points.size();
return m_unscaledPoints.size();
}
int btConvexHullShape::getNumEdges() const
{
return m_points.size();
return m_unscaledPoints.size();
}
void btConvexHullShape::getEdge(int i,btPoint3& pa,btPoint3& pb) const
void btConvexHullShape::getEdge(int i,btVector3& pa,btVector3& pb) const
{
int index0 = i%m_points.size();
int index1 = (i+1)%m_points.size();
pa = m_points[index0]*m_localScaling;
pb = m_points[index1]*m_localScaling;
int index0 = i%m_unscaledPoints.size();
int index1 = (i+1)%m_unscaledPoints.size();
pa = getScaledPoint(index0);
pb = getScaledPoint(index1);
}
void btConvexHullShape::getVertex(int i,btPoint3& vtx) const
void btConvexHullShape::getVertex(int i,btVector3& vtx) const
{
vtx = m_points[i]*m_localScaling;
vtx = getScaledPoint(i);
}
int btConvexHullShape::getNumPlanes() const
@@ -171,16 +172,16 @@ int btConvexHullShape::getNumPlanes() const
return 0;
}
void btConvexHullShape::getPlane(btVector3& ,btPoint3& ,int ) const
void btConvexHullShape::getPlane(btVector3& ,btVector3& ,int ) const
{
btAssert(0);
}
//not yet
bool btConvexHullShape::isInside(const btPoint3& ,btScalar ) const
bool btConvexHullShape::isInside(const btVector3& ,btScalar ) const
{
assert(0);
btAssert(0);
return false;
}

View File

@@ -24,7 +24,7 @@ subject to the following restrictions:
///Bullet provides a general and fast collision detector for convex shapes based on GJK and EPA using localGetSupportingVertex.
ATTRIBUTE_ALIGNED16(class) btConvexHullShape : public btPolyhedralConvexShape
{
btAlignedObjectArray<btPoint3> m_points;
btAlignedObjectArray<btVector3> m_unscaledPoints;
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
@@ -33,23 +33,38 @@ public:
///this constructor optionally takes in a pointer to points. Each point is assumed to be 3 consecutive btScalar (x,y,z), the striding defines the number of bytes between each point, in memory.
///It is easier to not pass any points in the constructor, and just add one point at a time, using addPoint.
///btConvexHullShape make an internal copy of the points.
btConvexHullShape(const btScalar* points=0,int numPoints=0, int stride=sizeof(btPoint3));
btConvexHullShape(const btScalar* points=0,int numPoints=0, int stride=sizeof(btVector3));
void addPoint(const btPoint3& point);
void addPoint(const btVector3& point);
btPoint3* getPoints()
btVector3* getUnscaledPoints()
{
return &m_points[0];
return &m_unscaledPoints[0];
}
const btPoint3* getPoints() const
const btVector3* getUnscaledPoints() const
{
return &m_points[0];
return &m_unscaledPoints[0];
}
int getNumPoints() const
///getPoints is obsolete, please use getUnscaledPoints
const btVector3* getPoints() const
{
return m_points.size();
return getUnscaledPoints();
}
SIMD_FORCE_INLINE btVector3 getScaledPoint(int i) const
{
return m_unscaledPoints[i] * m_localScaling;
}
SIMD_FORCE_INLINE int getNumPoints() const
{
return m_unscaledPoints.size();
}
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
@@ -57,7 +72,6 @@ public:
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
virtual int getShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; }
//debugging
virtual const char* getName()const {return "Convex";}
@@ -65,11 +79,11 @@ public:
virtual int getNumVertices() const;
virtual int getNumEdges() const;
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
virtual void getVertex(int i,btPoint3& vtx) const;
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
virtual void getVertex(int i,btVector3& vtx) const;
virtual int getNumPlanes() const;
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const;
virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
///in case we receive negative scaling
virtual void setLocalScaling(const btVector3& scaling);

View File

@@ -17,6 +17,7 @@ subject to the following restrictions:
#include "btConvexInternalShape.h"
btConvexInternalShape::btConvexInternalShape()
: m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)),
m_collisionMargin(CONVEX_DISTANCE_MARGIN)
@@ -48,7 +49,8 @@ void btConvexInternalShape::getAabbSlow(const btTransform& trans,btVector3&minAa
tmp = trans(localGetSupportingVertex(vec*trans.getBasis()));
minAabb[i] = tmp[i]-margin;
}
};
}
btVector3 btConvexInternalShape::localGetSupportingVertex(const btVector3& vec)const
@@ -70,6 +72,7 @@ btVector3 btConvexInternalShape::localGetSupportingVertex(const btVector3& vec)c
return supVertex;
#else
btAssert(0);
return btVector3(0,0,0);
#endif //__SPU__

View File

@@ -19,23 +19,18 @@ class btConvexInternalShape : public btConvexShape
btScalar m_padding;
btConvexInternalShape();
public:
btConvexInternalShape();
virtual ~btConvexInternalShape()
{
}
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
#ifndef __SPU__
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const= 0;
//notice that the vectors should be unit length
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const= 0;
#endif //#ifndef __SPU__
const btVector3& getImplicitShapeDimensions() const
{

View File

@@ -0,0 +1,156 @@
/*
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 "btConvexPointCloudShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
void btConvexPointCloudShape::setLocalScaling(const btVector3& scaling)
{
m_localScaling = scaling;
recalcLocalAabb();
}
#ifndef __SPU__
btVector3 btConvexPointCloudShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
{
btVector3 supVec(btScalar(0.),btScalar(0.),btScalar(0.));
btScalar newDot,maxDot = btScalar(-1e30);
btVector3 vec = vec0;
btScalar lenSqr = vec.length2();
if (lenSqr < btScalar(0.0001))
{
vec.setValue(1,0,0);
} else
{
btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
vec *= rlen;
}
for (int i=0;i<m_numPoints;i++)
{
btVector3 vtx = getScaledPoint(i);
newDot = vec.dot(vtx);
if (newDot > maxDot)
{
maxDot = newDot;
supVec = vtx;
}
}
return supVec;
}
void btConvexPointCloudShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
{
btScalar newDot;
//use 'w' component of supportVerticesOut?
{
for (int i=0;i<numVectors;i++)
{
supportVerticesOut[i][3] = btScalar(-1e30);
}
}
for (int i=0;i<m_numPoints;i++)
{
btVector3 vtx = getScaledPoint(i);
for (int j=0;j<numVectors;j++)
{
const btVector3& vec = vectors[j];
newDot = vec.dot(vtx);
if (newDot > supportVerticesOut[j][3])
{
//WARNING: don't swap next lines, the w component would get overwritten!
supportVerticesOut[j] = vtx;
supportVerticesOut[j][3] = newDot;
}
}
}
}
btVector3 btConvexPointCloudShape::localGetSupportingVertex(const btVector3& vec)const
{
btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
if ( getMargin()!=btScalar(0.) )
{
btVector3 vecnorm = vec;
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
{
vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
}
vecnorm.normalize();
supVertex+= getMargin() * vecnorm;
}
return supVertex;
}
#endif
//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
//Please note that you can debug-draw btConvexHullShape with the Raytracer Demo
int btConvexPointCloudShape::getNumVertices() const
{
return m_numPoints;
}
int btConvexPointCloudShape::getNumEdges() const
{
return 0;
}
void btConvexPointCloudShape::getEdge(int i,btVector3& pa,btVector3& pb) const
{
btAssert (0);
}
void btConvexPointCloudShape::getVertex(int i,btVector3& vtx) const
{
vtx = m_unscaledPoints[i]*m_localScaling;
}
int btConvexPointCloudShape::getNumPlanes() const
{
return 0;
}
void btConvexPointCloudShape::getPlane(btVector3& ,btVector3& ,int ) const
{
btAssert(0);
}
//not yet
bool btConvexPointCloudShape::isInside(const btVector3& ,btScalar ) const
{
btAssert(0);
return false;
}

View File

@@ -0,0 +1,96 @@
/*
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_CONVEX_POINT_CLOUD_SHAPE_H
#define BT_CONVEX_POINT_CLOUD_SHAPE_H
#include "btPolyhedralConvexShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
#include "LinearMath/btAlignedObjectArray.h"
///The btConvexPointCloudShape implements an implicit convex hull of an array of vertices.
ATTRIBUTE_ALIGNED16(class) btConvexPointCloudShape : public btPolyhedralConvexShape
{
btVector3* m_unscaledPoints;
int m_numPoints;
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
btConvexPointCloudShape(btVector3* points,int numPoints, const btVector3& localScaling,bool computeAabb = true)
{
m_localScaling = localScaling;
m_shapeType = CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE;
m_unscaledPoints = points;
m_numPoints = numPoints;
if (computeAabb)
recalcLocalAabb();
}
void setPoints (btVector3* points, int numPoints, bool computeAabb = true)
{
m_unscaledPoints = points;
m_numPoints = numPoints;
if (computeAabb)
recalcLocalAabb();
}
SIMD_FORCE_INLINE btVector3* getUnscaledPoints()
{
return m_unscaledPoints;
}
SIMD_FORCE_INLINE const btVector3* getUnscaledPoints() const
{
return m_unscaledPoints;
}
SIMD_FORCE_INLINE int getNumPoints() const
{
return m_numPoints;
}
SIMD_FORCE_INLINE btVector3 getScaledPoint( int index) const
{
return m_unscaledPoints[index] * m_localScaling;
}
#ifndef __SPU__
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
#endif
//debugging
virtual const char* getName()const {return "ConvexPointCloud";}
virtual int getNumVertices() const;
virtual int getNumEdges() const;
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
virtual void getVertex(int i,btVector3& vtx) const;
virtual int getNumPlanes() const;
virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const;
virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
///in case we receive negative scaling
virtual void setLocalScaling(const btVector3& scaling);
};
#endif //BT_CONVEX_POINT_CLOUD_SHAPE_H

View File

@@ -14,5 +14,366 @@ subject to the following restrictions:
*/
#include "btConvexShape.h"
#include "btTriangleShape.h"
#include "btSphereShape.h"
#include "btCylinderShape.h"
#include "btCapsuleShape.h"
#include "btConvexHullShape.h"
#include "btConvexPointCloudShape.h"
btConvexShape::btConvexShape ()
{
}
btConvexShape::~btConvexShape()
{
}
static btVector3 convexHullSupport (const btVector3& localDir, const btVector3* points, int numPoints, const btVector3& localScaling)
{
btVector3 supVec(btScalar(0.),btScalar(0.),btScalar(0.));
btScalar newDot,maxDot = btScalar(-1e30);
btVector3 vec0(localDir.getX(),localDir.getY(),localDir.getZ());
btVector3 vec = vec0;
btScalar lenSqr = vec.length2();
if (lenSqr < btScalar(0.0001))
{
vec.setValue(1,0,0);
} else {
btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
vec *= rlen;
}
for (int i=0;i<numPoints;i++)
{
btVector3 vtx = points[i] * localScaling;
newDot = vec.dot(vtx);
if (newDot > maxDot)
{
maxDot = newDot;
supVec = vtx;
}
}
return btVector3(supVec.getX(),supVec.getY(),supVec.getZ());
}
btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btVector3& localDir) const
{
switch (m_shapeType)
{
case SPHERE_SHAPE_PROXYTYPE:
{
return btVector3(0,0,0);
}
case BOX_SHAPE_PROXYTYPE:
{
btBoxShape* convexShape = (btBoxShape*)this;
const btVector3& halfExtents = convexShape->getImplicitShapeDimensions();
return btVector3(btFsels(localDir.x(), halfExtents.x(), -halfExtents.x()),
btFsels(localDir.y(), halfExtents.y(), -halfExtents.y()),
btFsels(localDir.z(), halfExtents.z(), -halfExtents.z()));
}
case TRIANGLE_SHAPE_PROXYTYPE:
{
btTriangleShape* triangleShape = (btTriangleShape*)this;
btVector3 dir(localDir.getX(),localDir.getY(),localDir.getZ());
btVector3* vertices = &triangleShape->m_vertices1[0];
btVector3 dots(dir.dot(vertices[0]), dir.dot(vertices[1]), dir.dot(vertices[2]));
btVector3 sup = vertices[dots.maxAxis()];
return btVector3(sup.getX(),sup.getY(),sup.getZ());
}
case CYLINDER_SHAPE_PROXYTYPE:
{
btCylinderShape* cylShape = (btCylinderShape*)this;
//mapping of halfextents/dimension onto radius/height depends on how cylinder local orientation is (upAxis)
btVector3 halfExtents = cylShape->getImplicitShapeDimensions();
btVector3 v(localDir.getX(),localDir.getY(),localDir.getZ());
int cylinderUpAxis = cylShape->getUpAxis();
int XX(1),YY(0),ZZ(2);
switch (cylinderUpAxis)
{
case 0:
{
XX = 1;
YY = 0;
ZZ = 2;
}
break;
case 1:
{
XX = 0;
YY = 1;
ZZ = 2;
}
break;
case 2:
{
XX = 0;
YY = 2;
ZZ = 1;
}
break;
default:
btAssert(0);
break;
};
btScalar radius = halfExtents[XX];
btScalar halfHeight = halfExtents[cylinderUpAxis];
btVector3 tmp;
btScalar d ;
btScalar s = btSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
if (s != btScalar(0.0))
{
d = radius / s;
tmp[XX] = v[XX] * d;
tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
tmp[ZZ] = v[ZZ] * d;
return btVector3(tmp.getX(),tmp.getY(),tmp.getZ());
} else {
tmp[XX] = radius;
tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
tmp[ZZ] = btScalar(0.0);
return btVector3(tmp.getX(),tmp.getY(),tmp.getZ());
}
}
case CAPSULE_SHAPE_PROXYTYPE:
{
btVector3 vec0(localDir.getX(),localDir.getY(),localDir.getZ());
btCapsuleShape* capsuleShape = (btCapsuleShape*)this;
btScalar halfHeight = capsuleShape->getHalfHeight();
int capsuleUpAxis = capsuleShape->getUpAxis();
btScalar radius = capsuleShape->getRadius();
btVector3 supVec(0,0,0);
btScalar maxDot(btScalar(-1e30));
btVector3 vec = vec0;
btScalar lenSqr = vec.length2();
if (lenSqr < btScalar(0.0001))
{
vec.setValue(1,0,0);
} else
{
btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
vec *= rlen;
}
btVector3 vtx;
btScalar newDot;
{
btVector3 pos(0,0,0);
pos[capsuleUpAxis] = halfHeight;
//vtx = pos +vec*(radius);
vtx = pos +vec*capsuleShape->getLocalScalingNV()*(radius) - vec * capsuleShape->getMarginNV();
newDot = vec.dot(vtx);
if (newDot > maxDot)
{
maxDot = newDot;
supVec = vtx;
}
}
{
btVector3 pos(0,0,0);
pos[capsuleUpAxis] = -halfHeight;
//vtx = pos +vec*(radius);
vtx = pos +vec*capsuleShape->getLocalScalingNV()*(radius) - vec * capsuleShape->getMarginNV();
newDot = vec.dot(vtx);
if (newDot > maxDot)
{
maxDot = newDot;
supVec = vtx;
}
}
return btVector3(supVec.getX(),supVec.getY(),supVec.getZ());
}
case CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE:
{
btConvexPointCloudShape* convexPointCloudShape = (btConvexPointCloudShape*)this;
btVector3* points = convexPointCloudShape->getUnscaledPoints ();
int numPoints = convexPointCloudShape->getNumPoints ();
return convexHullSupport (localDir, points, numPoints,convexPointCloudShape->getLocalScalingNV());
}
case CONVEX_HULL_SHAPE_PROXYTYPE:
{
btConvexHullShape* convexHullShape = (btConvexHullShape*)this;
btVector3* points = convexHullShape->getUnscaledPoints();
int numPoints = convexHullShape->getNumPoints ();
return convexHullSupport (localDir, points, numPoints,convexHullShape->getLocalScalingNV());
}
default:
#ifndef __SPU__
return this->localGetSupportingVertexWithoutMargin (localDir);
#else
btAssert (0);
#endif
}
// should never reach here
btAssert (0);
return btVector3 (btScalar(0.0f), btScalar(0.0f), btScalar(0.0f));
}
btVector3 btConvexShape::localGetSupportVertexNonVirtual (const btVector3& localDir) const
{
btVector3 localDirNorm = localDir;
if (localDirNorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
{
localDirNorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
}
localDirNorm.normalize ();
return localGetSupportVertexWithoutMarginNonVirtual(localDirNorm)+ getMarginNonVirtual() * localDirNorm;
}
/* TODO: This should be bumped up to btCollisionShape () */
btScalar btConvexShape::getMarginNonVirtual () const
{
switch (m_shapeType)
{
case SPHERE_SHAPE_PROXYTYPE:
{
btSphereShape* sphereShape = (btSphereShape*)this;
return sphereShape->getRadius ();
}
case BOX_SHAPE_PROXYTYPE:
{
btBoxShape* convexShape = (btBoxShape*)this;
return convexShape->getMarginNV ();
}
case TRIANGLE_SHAPE_PROXYTYPE:
{
btTriangleShape* triangleShape = (btTriangleShape*)this;
return triangleShape->getMarginNV ();
}
case CYLINDER_SHAPE_PROXYTYPE:
{
btCylinderShape* cylShape = (btCylinderShape*)this;
return cylShape->getMarginNV();
}
case CAPSULE_SHAPE_PROXYTYPE:
{
btCapsuleShape* capsuleShape = (btCapsuleShape*)this;
return capsuleShape->getMarginNV();
}
case CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE:
/* fall through */
case CONVEX_HULL_SHAPE_PROXYTYPE:
{
btPolyhedralConvexShape* convexHullShape = (btPolyhedralConvexShape*)this;
return convexHullShape->getMarginNV();
}
default:
#ifndef __SPU__
return this->getMargin ();
#else
btAssert (0);
#endif
}
// should never reach here
btAssert (0);
return btScalar(0.0f);
}
void btConvexShape::getAabbNonVirtual (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
{
switch (m_shapeType)
{
case SPHERE_SHAPE_PROXYTYPE:
{
btSphereShape* sphereShape = (btSphereShape*)this;
btScalar radius = sphereShape->getImplicitShapeDimensions().getX();// * convexShape->getLocalScaling().getX();
btScalar margin = radius + sphereShape->getMarginNonVirtual();
const btVector3& center = t.getOrigin();
btVector3 extent(margin,margin,margin);
aabbMin = center - extent;
aabbMax = center + extent;
}
break;
case CYLINDER_SHAPE_PROXYTYPE:
/* fall through */
case BOX_SHAPE_PROXYTYPE:
{
btBoxShape* convexShape = (btBoxShape*)this;
btScalar margin=convexShape->getMarginNonVirtual();
btVector3 halfExtents = convexShape->getImplicitShapeDimensions();
halfExtents += btVector3(margin,margin,margin);
btMatrix3x3 abs_b = t.getBasis().absolute();
btVector3 center = t.getOrigin();
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),abs_b[1].dot(halfExtents),abs_b[2].dot(halfExtents));
aabbMin = center - extent;
aabbMax = center + extent;
break;
}
case TRIANGLE_SHAPE_PROXYTYPE:
{
btTriangleShape* triangleShape = (btTriangleShape*)this;
btScalar margin = triangleShape->getMarginNonVirtual();
for (int i=0;i<3;i++)
{
btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.));
vec[i] = btScalar(1.);
btVector3 sv = localGetSupportVertexWithoutMarginNonVirtual(vec*t.getBasis());
btVector3 tmp = t(sv);
aabbMax[i] = tmp[i]+margin;
vec[i] = btScalar(-1.);
tmp = t(localGetSupportVertexWithoutMarginNonVirtual(vec*t.getBasis()));
aabbMin[i] = tmp[i]-margin;
}
}
break;
case CAPSULE_SHAPE_PROXYTYPE:
{
btCapsuleShape* capsuleShape = (btCapsuleShape*)this;
btVector3 halfExtents(capsuleShape->getRadius(),capsuleShape->getRadius(),capsuleShape->getRadius());
int m_upAxis = capsuleShape->getUpAxis();
halfExtents[m_upAxis] = capsuleShape->getRadius() + capsuleShape->getHalfHeight();
halfExtents += btVector3(capsuleShape->getMarginNonVirtual(),capsuleShape->getMarginNonVirtual(),capsuleShape->getMarginNonVirtual());
btMatrix3x3 abs_b = t.getBasis().absolute();
btVector3 center = t.getOrigin();
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),abs_b[1].dot(halfExtents),abs_b[2].dot(halfExtents));
aabbMin = center - extent;
aabbMax = center + extent;
}
break;
case CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE:
case CONVEX_HULL_SHAPE_PROXYTYPE:
{
btPolyhedralConvexShape* convexHullShape = (btPolyhedralConvexShape*)this;
btScalar margin = convexHullShape->getMarginNonVirtual();
convexHullShape->getNonvirtualAabb (t, aabbMin, aabbMax, margin);
}
break;
default:
#ifndef __SPU__
this->getAabb (t, aabbMin, aabbMax);
#else
btAssert (0);
#endif
break;
}
// should never reach here
btAssert (0);
}

View File

@@ -24,8 +24,6 @@ subject to the following restrictions:
#include "btCollisionMargin.h"
#include "LinearMath/btAlignedAllocator.h"
//todo: get rid of this btConvexCastResult thing!
struct btConvexCastResult;
#define MAX_PREFERRED_PENETRATION_DIRECTIONS 10
/// The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape, btConvexHullShape etc.
@@ -38,20 +36,25 @@ public:
BT_DECLARE_ALIGNED_ALLOCATOR();
virtual ~btConvexShape()
{
btConvexShape ();
}
virtual ~btConvexShape();
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const = 0;
////////
#ifndef __SPU__
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const=0;
#endif //#ifndef __SPU__
btVector3 localGetSupportVertexWithoutMarginNonVirtual (const btVector3& vec) const;
btVector3 localGetSupportVertexNonVirtual (const btVector3& vec) const;
btScalar getMarginNonVirtual () const;
void getAabbNonVirtual (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const;
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const =0;
#ifndef __SPU__
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const= 0;
//notice that the vectors should be unit length
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const= 0;
#endif //#ifndef __SPU__
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
@@ -69,6 +72,9 @@ public:
virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const=0;
};

View File

@@ -20,8 +20,9 @@ subject to the following restrictions:
btConvexTriangleMeshShape ::btConvexTriangleMeshShape (btStridingMeshInterface* meshInterface, bool calcAabb)
:m_stridingMesh(meshInterface)
: btPolyhedralConvexShape(), m_stridingMesh(meshInterface)
{
m_shapeType = CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE;
if ( calcAabb )
recalcLocalAabb();
}
@@ -107,7 +108,7 @@ void btConvexTriangleMeshShape::batchedUnitVectorGetSupportingVertexWithoutMargi
}
}
//todo: could do the batch inside the callback!
///@todo: could do the batch inside the callback!
for (int j=0;j<numVectors;j++)
@@ -162,12 +163,12 @@ int btConvexTriangleMeshShape::getNumEdges() const
return 0;
}
void btConvexTriangleMeshShape::getEdge(int ,btPoint3& ,btPoint3& ) const
void btConvexTriangleMeshShape::getEdge(int ,btVector3& ,btVector3& ) const
{
btAssert(0);
}
void btConvexTriangleMeshShape::getVertex(int ,btPoint3& ) const
void btConvexTriangleMeshShape::getVertex(int ,btVector3& ) const
{
btAssert(0);
}
@@ -177,13 +178,13 @@ int btConvexTriangleMeshShape::getNumPlanes() const
return 0;
}
void btConvexTriangleMeshShape::getPlane(btVector3& ,btPoint3& ,int ) const
void btConvexTriangleMeshShape::getPlane(btVector3& ,btVector3& ,int ) const
{
btAssert(0);
}
//not yet
bool btConvexTriangleMeshShape::isInside(const btPoint3& ,btScalar ) const
bool btConvexTriangleMeshShape::isInside(const btVector3& ,btScalar ) const
{
btAssert(0);
return false;
@@ -268,15 +269,12 @@ void btConvexTriangleMeshShape::calculatePrincipalAxisTransform(btTransform& pri
btVector3 a = triangle[0] - center;
btVector3 b = triangle[1] - center;
btVector3 c = triangle[2] - center;
btVector3 abc = a + b + c;
btScalar volNeg = -btFabs(a.triple(b, c)) * btScalar(1. / 6);
for (int j = 0; j < 3; j++)
{
for (int k = 0; k <= j; k++)
{
i[j][k] = i[k][j] = volNeg * (center[j] * center[k]
+ btScalar(0.25) * (center[j] * abc[k] + center[k] * abc[j])
+ btScalar(0.1) * (a[j] * a[k] + b[j] * b[k] + c[j] * c[k])
i[j][k] = i[k][j] = volNeg * (btScalar(0.1) * (a[j] * a[k] + b[j] * b[k] + c[j] * c[k])
+ btScalar(0.05) * (a[j] * b[k] + a[k] * b[j] + a[j] * c[k] + a[k] * c[j] + b[j] * c[k] + b[k] * c[j]));
}
}

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