Commit Graph

1502 Commits

Author SHA1 Message Date
Benoit Bolsee
50b13f0a56 BGE 2D Filters: slightly change dfelinto patch to use SCA_IScene instead of KX_Scene. It is rather anecdotic since KX_Scene is the only implementation of SCA_IScene but it's better to keep GameLogic and Ketsji separated. 2010-03-06 21:22:09 +00:00
Dalai Felinto
790d6ca256 small png include adjustments (ifndef NOPNG ...).
* gameplayer is now probably not going to build without PNG turned ON.

To fix that it would be necessary to use #ifndef NOPNG  around the GPC_Canvas::MakeScreenShot.
Since I don't this function it's working in 2.5 yet it's better to wait for that before doing it.
2010-03-03 19:34:17 +00:00
Dalai Felinto
c5231858d4 fix for CMake compile in windows. ($PNG_INC was needed) - partial revert of commit 27251 2010-03-03 19:18:50 +00:00
Campbell Barton
f09efddcda fix for minor errors/warnings 2010-03-03 13:59:57 +00:00
Dalai Felinto
0cad3ae24c BGE 2D Filters: filters run per scene now (fix for [#18152]) - it (slightly) breaks backward compatibility !!!
Originally we had 2DFilters (m_filtermanager) stored in RenderTools. That way filters were stored globally and were being called once per each scene. This was producing two big problems: (1) performance and (2) flexibility of use.

(1) Performance - To run the filters 2X == 2X slower
(2) flexibility of use - Very often we want the filter in the scene but not in the UI for example.

For those reasons I believe that 2DFilters with multiple scenes was very useless or unpredictable. I hope they work fine now.
To make it work as before (2.4) you can simply recreate the 2dfilter actuators across the scenes.

* * * * *

Imagine that we have:
(a) Main Scene
(b) Overlay Scene

in Main Scene the Z Buffer and RGB will be from the main scene.
in Overlay Scene the Z Buffer will be from the Overlay Scene and the RBG buffer is from both [(a + 2D Filter) + b].

So in pseudo code if we have a,b,c,d,e scenes we have: (2DFilterE(2DFilterD(2DFilterC(2DFilterB(2DFilterA(a) + b) + c) + d) + e)
2010-03-03 06:38:47 +00:00
Campbell Barton
ed7f4f2e3c make BGL and BLF modile names lowercase 2010-02-28 14:57:26 +00:00
Benoit Bolsee
71f7e50451 VideoTexture: optional arguments to ImageBuff constructor.
ImageBuff([width,height[,color[,scale]]])

width, height: size of buffer in pixel.
               default: buffer not allocated.
color: initial value of RGB channels. Alpha channel is 255.
       Possible values: 0(black=default) -> 255 (white)
scale: True or False to enable or disable fast scaling
       default: False

This constructors eliminates the need to use the load function
when you just want to initialize the image buffer to black or white.
2010-02-26 22:14:31 +00:00
Campbell Barton
9352c9f0c1 use negate_v3 rather then multiplying a vector by -1.0 (no functional changes) 2010-02-26 09:02:52 +00:00
Benoit Bolsee
af987c12b5 VideoTexture: fix a bug with AV sync that was causing a loss of sync in case of rewind to the begining of the file. 2010-02-25 22:12:16 +00:00
Dalai Felinto
4d3accd0cb BGE Dome: BlenderPlayer Console arguments: warpdata working now (only with absolute path)
I forgot to say in the last commit that those arguments are only for the BlenderPlayer.
we can now set external warpdata files.

2Do:
(1) convert relative to absolute paths for warpdata files
(2) investigate weird bug on lack of light in blenderplayer with warpmesh

... [old 2Do]

(3) documentation
(4) preserve scene settings (at least scene->gm.dome) even if you load a new file inside the game (e.g. Yo Frankie loading new levels)
2010-02-25 06:05:56 +00:00
Dalai Felinto
47d79b04d1 BGE Dome: Console arguments: angle, tilt, mode and warpdata (not working yet)
2Do:
(1) open external warpdata file
(2) documentation
(3) preserve scene settings (at least scene->gm.dome) even if you load a new file inside the game (e.g. Yo Frankie loading new levels)
otherwise it's a nightmare to update all your files every time you change your projection system. See note.
Maybe SYS_WriteCommandLineInt/Float/String can be used for that. Gotta investigate further.

* Note: an external warpdata file is a must ! Currently every time you need to calibrate your system you have to update the warp file in all your demo files. This is terrible. I'm glad I *now* have a dome near by to test it ;)
* FYI: A recent 'Yo Frankie in a dome' video if you want to see how it works: http://www.vimeo.com/9629626 I'm going to record a better one tomorrow.
2010-02-24 23:01:49 +00:00
Campbell Barton
0c89dcc25c matrix functions, to_3x3, to_4x4
force fixed time when recording in the BGE.
2010-02-23 09:39:47 +00:00
Campbell Barton
4ef1fd1078 game engine support for recording animation back & some other minor changes. 2010-02-22 12:25:58 +00:00
Campbell Barton
b65a983d39 use BLI_findstring in more places & remove some warnings, no functional changes. 2010-02-22 09:22:36 +00:00
Campbell Barton
756dace6f5 fix for typo 2010-02-22 09:02:05 +00:00
Joerg Mueller
81847df968 Fix for the player by nazg-gul. 2010-02-22 08:27:45 +00:00
Benoit Bolsee
37b9c9fe4d VideoTexture: improvements to image data access API.
- Use BGL buffer instead of string for image data.
- Add buffer interface to image source.
- Allow customization of pixel format.
- Add valid property to check if the image data is available.

The image property of all Image source objects will now
return a BGL 'buffer' object. Previously it was returning
a string, which was not working at all with Python 3.1.
The BGL buffer type allows sequence access to bytes and
is directly usable in BGL OpenGL wrapper functions.
The buffer is formated as a 1 dimensional array of bytes
with 4 bytes per pixel in RGBA order.

BGL buffers will also be accepted in the ImageBuff load()
and plot() functions.

It is possible to customize the pixel format by using
the VideoTexture.imageToArray(image, mode) function:
the first argument is a Image source object, the second
optional argument is a format string using the R, G, B,
A, 0 and 1 characters. For example "BGR" means that each
pixel will be 3 bytes, corresponding to the Blue, Green
and Red channel in that order. Use 0 for a fixed hex 00
value, 1 for hex FF. The default mode is "RGBA".

All Image source objects now support the buffer interface
which allows to create memoryview objects for direct access
to the image internal buffer without memory copy. The buffer
format is one dimensional array of bytes with 4 bytes per
pixel in RGBA order. The buffer is writable, which allows
custom modifications of the image data.

v = memoryview(source)

A bug in the Python 3.1 buffer API will cause a crash if
the memoryview object cannot be created. Therefore, you
must always check first that an image data is available
before creating a memoryview object. Use the new valid
attribute for that:

if source.valid:
    v = memoryview(source)
    ...	

Note: the BGL buffer object itself does not yet support
the buffer interface.

Note: the valid attribute makes sense only if you use
image source in conjunction with texture object like this:

# refresh texture but keep image data in memory
texture.refresh(False)
if texture.source.valid:
    v = memoryview(texture.source)
    # process image
    ...
    # invalidate image for next texture refresh
    texture.source.refresh()

Limitation: While memoryview objects exist, the image cannot be
resized. Resizing occurs with ImageViewport objects when the
viewport size is changed or with ImageFFmpeg when a new image
is reloaded for example. Any attempt to resize will cause a
runtime error. Delete the memoryview objects is you want to
resize an image source object.
2010-02-21 22:20:00 +00:00
Martin Poirier
71125002a9 No need for this change anymore (force include to get BLO_sys_types.h in GE) 2010-02-20 22:51:22 +00:00
Elia Sarti
f7d82af101 Compile fix for CMake 2010-02-20 22:38:21 +00:00
Campbell Barton
aefe9be5db [#18961] Use const char * where appropriate (2.5)
from Sean Bartell (wtachi) 

added own changes bpy_props.c
2010-02-16 16:47:41 +00:00
Campbell Barton
ea8b072b75 [#21023] 2 Dynamic loading patches (one bugfix, one feature)
patch from Mitchell Stokes (moguri), only the bugfix part for now.
2010-02-15 09:01:52 +00:00
Campbell Barton
081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Dalai Felinto
2541429ded BGE: linear velocity and angular velocity are attributes now
... what lead me to wonder if we should remove obj.setAngularVelocity, obj.setLinearVelocity, obj.getLinearVelocity and obj.getAngularVelocity.

* this was so Copy and Paste ... anyways tests are welcome (I never used those methods in python myself).
2010-02-12 03:40:28 +00:00
Dalai Felinto
0119072fc3 BGE API DOC update - scene add/restart/end. patch by Gomer 2010-02-11 04:24:58 +00:00
Joerg Mueller
9827a3e9ea 2.5 Audio:
- recode of the whole sequencer audio handling
- encode audio flag removed, instead you choose None as audio codec, added None for video codec too
- ffmpeg formats/codecs: enabled: theora, ogg, vorbis; added: matroska, flac (not working, who can fix?), mp3, wav
- sequencer wave drawing
- volume animation (now also working when mixing down to a file!)
- made sequencer strip position and length values unanimatable
2010-02-07 23:41:17 +00:00
Benoit Bolsee
a8a99a628f BGE: add audio/video synchronization capability to VideoTexture
Add optional parameter to VideoTexture.Texture refresh() method
to specify timestamp (in seconds from start of movie) of the frame
to be loaded. This value is passed down to image source and for
VideoFFmpeg source, it is used instead of current time to load
the frame from the video file.

When combined with an audio actuator, it can be used to synchronize
the sound and the image: specify the same video file in the sound
actuator and use the KX_SoundActuator time attribute as timestamp
to refresh: the frame corresponding to the sound will be loaded:

GameLogic.video.refresh(True, soundAct.time)
2010-02-07 19:18:00 +00:00
Martin Poirier
3944cda193 Adjust priorities so game engine will link (VideoTex after Ketsji) 2010-02-07 17:56:55 +00:00
Benoit Bolsee
3e598e7468 BGE: Fix typo in SConscript preventing to import VideoTexture module. 2010-02-07 16:52:19 +00:00
Martin Poirier
3bd78cf8f6 Wrong argument name for scons 2010-02-07 14:59:00 +00:00
Benoit Bolsee
81fd89c8e0 BGE: VideoTexture was not included, missing WITH_FFMEG defined. Fixed in all building system. 2010-02-07 14:12:39 +00:00
Dalai Felinto
f7a24a25ba BGE: Sound Actuator API
act.time can set the sound position (float in seconds)
act.is3D RO gives you the dimension of the audio
act.minGain3D, maxGain3D ... set the 3D parameters of the sound

** PyDoc to be done. Jörg Müller (NeXyon) do you want to document them? The file is here:
//source/gameengine/PyDoc/GameTypes.py


+ adding a missing \n to KX_Scene.cpp. (kind of typo)
2010-02-05 00:51:32 +00:00
Dalai Felinto
f32df64d2b BGE fix: KX_Lamp using strcmp wrongly + typo in rna_define 2010-02-04 23:51:41 +00:00
Benoit Bolsee
0020de72e4 BGE: Optimize Soft body conversion: don't create BVH structure.
A btBvhTriangleMeshShape object is created when converting
a mesh to physics, also in case of Soft body although the
soft body will not use it (it only uses the mesh interface).

This patch keeps this system for compatibility with the
KX converter but avoids the creation of the BVH structure,
which consumes a lots of CPU. This should speed up
significantly the conversion of large mesh to softbody.

A secondary optimization is that the sharing of shapeInfo
is extended to rigid body using gImpact. Before it was
only active between static body and soft body.
2010-02-03 21:41:03 +00:00
Dalai Felinto
90e2b22fee BGE: fix for [#20684] Game Render blanks screen on Anaglyph Stereo view
The problem was: the Blender default camera has DOF distance as 0.0. Since we are using this as Focal Length for the stereo calculation we had terrible stereo by default.

Fix: whenever DOF == 0.0 we use focal length as eye separation * 30.0 (known to be a reasonable value)
2010-02-01 15:13:05 +00:00
Campbell Barton
1943a73439 rename game object obcolor to color 2010-01-30 21:59:20 +00:00
Benoit Bolsee
f7b7d7952d BGE: patch [#20293] Added python sensor attribute: Status. 2010-01-30 18:53:33 +00:00
Benoit Bolsee
cfdd53a4f8 BGE: patch #20399 Python control over adding/removing scenes. 2010-01-30 18:23:13 +00:00
Campbell Barton
014a24ff62 same fix from 2.4x r26392. 2010-01-29 09:56:32 +00:00
Matt Ebb
0c5998e799 Radians -> Degrees (in UI)
Rotations are now stored internally as radians, while exposing degrees in the UI - 
in the graph editor and UI controls. This is done in two areas:
1) Using the unit system to convert RNA data to display as degrees in the UI controls
2) FCurves now use degrees for rotation, so you can edit in the graph editor what 
you see in the UI.

All rotation data is consistently accessible in DNA and RNA as radians, degrees are only 
used for the UI controls and graph editor.

This commit includes conversions will convert old files (stored data and also fcurve data) 
to the new units, hopefully everything should go smoothly!

Part of this also changes a few properties that were hard-coded as degrees before (such 
as IK pole angle and brush texture rotation) to also use the same consistent system of 
radians (dna/rna) and degrees (ui).

Thanks to Joshua for hints and review here too.
2010-01-25 06:24:05 +00:00
Dalai Felinto
9356b1b7ee BGE: Mouse Sensor type defaults to 1 (MOUSELEFT ) + remove camera attribute from Camera objects.
(if you want to mark your camera objects create a property manually ;)

That way object.getPropertyNames() works consistently across all object types.
2010-01-17 21:46:34 +00:00
Campbell Barton
68c8054191 patch [#20560] [patch] KX_GameObject.obcolor
by Mitchell Stokes (moguri)
* renamed attribute obcolor to color
2010-01-16 23:53:51 +00:00
Campbell Barton
b0f87935a8 spelling errors, no real changes to code. 2010-01-14 10:59:42 +00:00
Campbell Barton
1cb013f877 evil 1 liner to get bge.logic, bge.render, bge.keys etc.. may eventually replace GameLogic, GameKeys module names. 2010-01-10 22:15:29 +00:00
Campbell Barton
affe84a453 get rid of annoying duplicate python initialization code, added setupGamePython() which initializes modules 2010-01-10 22:03:26 +00:00
Dalai Felinto
580345394e BGE API_DOC: VideoTexture and PhysicsConstraints templates (need the functions to be filled with their description).
PhysicsConstraints is documented in the Game Kit Book:
http://download.blender.org/documentation/gamekit1/

VideoTexture is documented in the wiki:
http://wiki.blender.org/index.php/Dev:Source/GameEngine/2.49/VideoTexture

I don't think I will have time to fill the documentation. But I hope this commit helps someone interested in helping it.

Therefore volunteers to document those modules are highly welcome !!! (let's give to BGE the documentation it deserves)!

* + added GameLogic.Lave/LoadGlobalDict + some typo fixes
2010-01-10 19:35:42 +00:00
Dalai Felinto
4463597dcd PyDoc updated for Rasterizer setEyeSeparation and setFocalLength + blenderplayer building again.
stubs.c update patch by Mitchel Stokes - Moguri
2010-01-07 05:23:54 +00:00
Benoit Bolsee
042c2b2aa5 BGE: KX_GameObject.rayCast() to return 5-tuple in case of no hit when poly=2 option is used. 2010-01-06 08:44:10 +00:00
Dalai Felinto
09994fb444 BGE: negative lamp last fix - Texture Face. I'm going to commit it to 2.49 too.
The files I used for test are here: http://blenderecia.orgfree.com/blender/tmp/neg_light.zip
2009-12-31 18:51:02 +00:00
Dalai Felinto
bccda9857b BGE bugfix: [#19476] Negative Lamps in BGE Do Not Function (in GLSL)
this bug was introduced in Blender 2.49 (probably my own fault, in other part of the code though while fixing support for IPOs in GLSL Lamps).

The good news is: GLSL Lamps looks in BGE like working perfectly now.

Multitexture on the other hand is not supporting "negative" lamps (with the checkbox option on).

From my search (svn blame+log) it looks like multitexture never had negative lamp working. Actually in Blender 2.34 when this was introduced in BGE (maybe in Blender as well?) I couldn't see negative lamps working either. It's hard to test this with Blender 2.34 though (it even crash with my test file).
2009-12-31 07:17:14 +00:00
Dalai Felinto
3e5b6ed469 BGE: (1) stereo tooltip update (2) blenderplayer working with new stereo setting (3) blenderplayer building again (patch by Mitchell Stokes - Moguri)
(1) the new text suggest what was the default eye separation before. Now I'm confident that changing the eye separation for the UI is a good move
(2) no big deal here. It's not reading the parameter from the command line. But does it ever read it?
(3) stubs.c update and glew linking statically. patch by Mitchell Stokes, thanks for that. 

And now we finish 2009 with a building blenderplayer =D
2009-12-31 04:56:23 +00:00