UPBGEĀ Documentation


2D filter python proxy

Since filters had now a common base with custom material shader (BL_Shader), the user can now access to the filters from the scene in python from a filter manager. The KX_2DFilterManager class contains function to get a filter for a given pass, remove a filter for a given pass and add a filter for a given pass, mode and fragment shader if needed.
The three functions are:

scene.filterManager.addFilter(index, mode[, fragmentProgram])

The filter is represented in the KX_2DFilter python class based on BL_Shader which allow the user to use all functions for vectors or matrixs uniforms. But a function is introduced in KX_2DFilter: setTexture. This function allow the user to bind a texture bind code in a given slot index reused in setSampler.
For example:
bindCode = material.textures[0].bindCode
shader = material.getShader()
shader.setTexture(0, bindCode)
shader.setSampler("texture", 0)

See also: KX_2DFilter and KX_2DFilterManager.

Vehicle constraint ray cast mask

The user can now specify which object can hit the vehicle ray cast constraint by specifying a mask similar to object collision mask. The mask is set in the vehicle constraint python class and initialized as default to 0xFFFF(means all layer allowed).
The attributs is:
vehicleConstraint.rayMask = (1 << 0) | (1 << 8) # allow collision layer 1 and 9

See also: KX_VehicleWrapper.rayMask.

Transparent debug draw line

It's now possible to specify a transparency color to bge.render.drawLine, e.g:
bge.render.drawLine(Vector((1, 0, 0)), Vector((0, 1, 0)), Vector((1, 0, 0, 0.5)))

See also: drawLine.

Float object life

The function scene.addObject now support float as life, even if the value is still cooresponding to time = 1/50 * file, the user can be more precise if the framerate is highter than 50 fps.

Writable material texture bind code

The material texture (BL_Texture) bind code can now be changed, for example to bind a shadow texture in a material texture for a custom shader:
bindCode = lamp.shadowBindId
texture = material.textures[0]
texture.bindCode = bindCode
shader = material.getShader()
shader.setSampler("shadowtex", 0)

See also: BL_Texture.bindCode

Lod bias for lamp texture

The user can now set a lod bias for lamp texture as for material textures.

Refactors and cleanups
- Cleanup KX_BlenderSceneConverter. (see e1b72a9)
- Small optimization in cubemap mapping shader. (see 48571d6)
- Refactor BL_Texture in base class RAS_Texture. (see a28563d)
- Refactor BL_Shader in RAS_Shader. (see e331883)
- Cleanup KX_Light.[h/cpp] (see f98be70)
- Remove BL_Material. (see 43ea154)

Bugs fixed
- Fix front face with text objects. (see ef69402)
- Fix SSS with geometry instancing. (see 43228c6)
- Fix unsupported texture scale for lamp texture. (see 9d4fbf4)
- Fix current scene and physics environment not restored after a LibLoad. (see 248074f)
- Fix url for Python API reference. (see f2dece9)
- Fix variance shadow textures left bound. (see a56071d)
- Fix alpha sort with modifier. (see 045ef96)
- Fix python module memory leak (see 2c2d210, 5a1e3c5, T44557)
- Fix python component initialization when object added. (see 995cfe6)
- Fix PyComponent crash on reload when script error. (see 411b9d9)