Commit Graph

143 Commits

Author SHA1 Message Date
Campbell Barton
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
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
Brecht Van Lommel
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
Benoit Bolsee
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
Campbell Barton
630c16feb7 patch [#18110] [patch] Update blenderplayer.exe -h text
from Mitchell Stokes (moguri)
2008-12-20 07:12:38 +00:00
Campbell Barton
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
Stefan Gartner
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
Benoit Bolsee
773824bbea VideoTexture: support VideoTexture in blenderplayer 2008-11-10 22:17:40 +00:00
Brecht Van Lommel
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
Brecht Van Lommel
d7589d8bc8 Game player: preserve material, debug settings, between .blend files. 2008-10-04 16:42:36 +00:00
Brecht Van Lommel
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
Campbell Barton
f510057fef [#17600] char* -> const char*
Thanks to Sean Bartell (wtachi), was causing many many warnings which distracted from the real problems.
2008-09-20 11:08:35 +00:00
Brecht Van Lommel
9064ed8d6a Fix for bug #4192: game engine armatures that are dynamically added
but don't have an action got the pose of already added armatures, even
though they're not related. This also fixes an issue where the armature
in Blender would end up in the pose from the game after ESC, removes
unneeded copies made during armature evaluation, and also solves the
constraint copying hack.
2008-09-17 01:29:54 +00:00
Brecht Van Lommel
c6d0be2a99 Fix (harmless) error print about GameLogic.globalDict being lost. Also
fixed some memory leaks in this code and simplified it.
2008-09-16 19:25:35 +00:00
Kent Mein
cffba77f50 Small tweak to get things compiling again.
Kent
2008-09-15 15:58:50 +00:00
Brecht Van Lommel
dc2594c81b Added -d debug option for blenderplayer, and remove some
invalid/unnecessary opengl calls on shader errors.
2008-09-15 12:40:17 +00:00
Campbell Barton
89721ec4de replaced static make_absolute_filename with BLI_convertstringcwd 2008-09-15 02:18:37 +00:00
Brecht Van Lommel
d111983064 Fix for bug #5758 and #17585: armatures with IK constraint did not
work in the game player, now the IK lib is linked into the player.

Makefiles/Scons/CMake buildsystems have been updated.

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

Also commented out code that disabled mipmapping in the player on
Mac OS X. If that is a workaround for a bug it is a really poor one,
and hopefully fixed now since this code is from 2002 or earlier.
2008-09-14 01:10:45 +00:00
Brecht Van Lommel
704fef314a Various game engine fixes:
* Fix issue with add transparency mode with blender materials.
* Possible fix at frontface flip in the game engine.
* Fix color buffering clearing for multiple viewports, it used
  to clear as if there was one.
* Fix for zoom level in user defined viewports, it was based on
  the full window before, now it is based on the viewport itself.
* For user defined viewports, always use Expose instead of
  Letterbox with bars, the latter doesn't make sense then.
2008-09-14 00:32:18 +00:00
Brecht Van Lommel
fa825e70e3 Game engine: added Rasterizer.get/setMaterialMode to set texface,
multitexture or glsl materials. This does not affect existing
scenes, only newly created ones.
2008-09-13 19:19:51 +00:00
Brecht Van Lommel
21d74deda6 Fixes for game engine runtime on Mac OS X, there were issues
working with relative paths. Still doesn't work optimal, since
paths are relative to game.blend which is in the app bundle
under Contents/Resources, so other files need to be moved there
manually at the moment.
2008-09-12 16:06:17 +00:00
Campbell Barton
0dea748e01 save and load configuration actuator, (option in game actuator menu)
saves a marshal'd GameLogic.globalDict to the blendfile path with the blend extension replaced with bgeconf

Use this in YoFrankie to save keyboard layout and graphics quality settings.
2008-09-12 02:15:16 +00:00
Brecht Van Lommel
729af67742 Bugfix: saved game engine runtimes failed to load library .blend
files with relative paths.
2008-09-11 13:00:54 +00:00
Campbell Barton
dca6bd87ef removed debug print 2008-09-10 22:49:11 +00:00
Benoit Bolsee
f305bb22b7 Patch 17508: Blender Web Plugin - XEmbed. Enable XEmbed integration of blenderplayer, using -i as input parameter to pass embedder window id. create a minimal web plugin to embed blenderplayer on web pages (using gecko/mozilla as browser). Only for *nix. 2008-09-09 21:15:30 +00:00
Kent Mein
115cf18bed converted my gen_utils.h fix to PyObjectPlus.h
Also added a fix for PyMarshal_WriteObjectToString

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

Kent
2008-09-06 14:13:31 +00:00
Brecht Van Lommel
cb89decfdc Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:

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

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

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

* An offset for dupligroups, so not all objects in a group have to
  be at the origin.
2008-09-04 20:51:28 +00:00
Campbell Barton
f60992daae BGE Py API - GameKeys.EventToString() utility function, makes key configuration menu's easier to write.
own error with blenderplayer, wasnt decreffing the GameLogic module, probably didnt matter since python was restarted anyway, but is incorrect.
2008-08-29 03:15:17 +00:00
Benoit Bolsee
84d1dfb89b patch for compilation problem around KX_RayCast::Callback template with gcc 2008-08-28 10:28:06 +00:00
Benoit Bolsee
becd467be8 BGE patch: KX_GameObject::rayCast() improvements to have X-Ray option, return true face normal and hit polygon information.
rayCast(to,from,dist,prop,face,xray,poly):

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

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

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

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

More details in PyDoc.
2008-08-27 19:34:19 +00:00
Campbell Barton
7608dcfc51 GameLogic.globalDict blenderplayer now keeps settings when loading new blend files.
workaround for python stopping and starting by storing the dictionary as marshal'd data. this means only python types are supported.
This feature is needed so when switching from a menu to a level blendfile, the configuration isnt lost.
2008-08-20 06:11:11 +00:00
Campbell Barton
553e35e36f * blenderplayer wasnt useing the scenes frame rate.
* GBE Python API's alignToVect wasnt clamping the align ammount from 0.0-1.0
* Generated images arnt animated - use for a test to see if the textures animated.
2008-08-06 04:09:10 +00:00
Campbell Barton
028d44c075 Made Mathutils its own module rather then GanmeLogic.Mathutils 2008-08-05 22:26:00 +00:00
Benoit Bolsee
bf168dc3c5 Small update to get the BlenderPlayer compiling (also needed for 2.47) 2008-08-02 22:11:22 +00:00
Hamed Zaghaghi
5350d5eb2c BGE Bug Fix:#17349, fixes some problems about 2d-filters 2008-07-20 23:03:01 +00:00
Campbell Barton
38cfe9c1a2 importing the GameLogic module was being done by adding the text "import GameLogic" to the start of all scripts used in the game engine, this meant every error line number was off by 1 (quite annoying). better to do this to the dictionary that the scripts run with. 2008-07-14 00:47:07 +00:00
Hamed Zaghaghi
a49c9c458a improvement of 2d-filter custom shader,
some bugfixes,
now you can use depth buffer and luminance buffer without any settings,
also you can use object's properties in a shader
2008-07-12 10:21:37 +00:00
Brecht Van Lommel
ab7794392e Fix for bug #7753: after game engine drawing with vertex arrays,
nurbs/curves/text dissappears.

This also removes the "vertex arrays" option and enables it always
for OpenGL version >= 1.1 - there's no need to have an option to
make things render faster disabled by default, also it should work
stable now.
2008-06-29 21:51:27 +00:00
Hamed Zaghaghi
b98e53b8ac BGE , fix an compile error 2008-06-28 14:19:25 +00:00
Brecht Van Lommel
272a91f754 Merge of apricot branch game engine changes into trunk, excluding GLSL.
GLEW
====

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

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

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

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

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

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

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

* Refactored the code to allow drawing skinned meshes with vertex
  arrays too, removing some specific immediate mode drawing functions
  for this that only did extra normal calculation. Now it always splits
  vertices of flat faces instead.
* Refactored normal recalculation with some minor optimizations,
  required for the above change.
* Removed some outdated code behind the __NLA_OLDDEFORM #ifdef.
* Fixed various bugs in setting of multitexture coordinates and vertex
  attributes for vertex arrays. These were not being enabled/disabled
  correct according to the opengl spec, leading to crashes. Also tangent
  attributes used an immediate mode call for vertex arrays, which can't
  work.
* Fixed use of uninitialized variable in RAS_TexVert.
* Exporting skinned meshes was doing O(n^2) lookups for vertices and
  deform weights, now uses same trick as regular meshes.
2008-06-17 10:27:34 +00:00
Campbell Barton
192037960d error in variable name, not sure how this even compiled 2008-06-09 22:54:56 +00:00
Campbell Barton
f39758cddc adding clip alpha (binary alpha) to the 3D view and game engine. 2008-06-09 15:45:46 +00:00
Benoit Bolsee
da1f38f99d Apply BGE patch 11137: Render objects with negative scaling correctly (as in Blender) 2008-05-25 14:37:39 +00:00
Benoit Bolsee
96486b356f fix BGE bug #8668: Behavior of os.getcwd() is not consistent between operating systems
Add a function GameLogic.expandPath() that works like Blender.sys.expandpath() and is also available in the BlenderPlayer.
Fix the game actuator in the BlenderPlayer to work like in Blender: 
- try first to load the .blend from the current working directory
- if not found, try to load from the startup .blend or runtime base directory
2008-05-11 18:45:30 +00:00
Kent Mein
106974a9d2 Fixing up the webplugin defines for the Makefiles.
Now you can do one of the following to disable it:
export NAN_NO_PLUGIN=true
export WITH_BF_WEBPLUGIN=false

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

Kent
2008-05-08 18:38:21 +00:00
Kent Mein
3ba9069c04 Fixes Makefiles for mac_compat_glext.h by updating some include paths.
Kent
2008-05-06 09:43:28 +00:00
Campbell Barton
6c05a92fe1 missed out on some BLI_convertstringcode's, also found that playing relative quicktime paths from the python api never worked, was using the 'Scene' type cast to a char. 2008-05-04 15:02:48 +00:00
Benoit Bolsee
3a430c33d2 fix BGE bug #8869: Added objects are not lit correctly
The current layer information is now stored in KX_GameObject and inherited from the parent object when dynamically added. This information is used during the rendering the select the lamps. As the selected lamps are always coming from active layers, their position and orientation are correct.
2008-04-30 19:58:44 +00:00