2008-01-07 19:13:47 +00:00
|
|
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
2006-11-17 02:27:12 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
2008-01-07 19:13:47 +00:00
|
|
|
# of the License, or (at your option) any later version.
|
2006-11-17 02:27:12 +00:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-11-17 02:27:12 +00:00
|
|
|
#
|
|
|
|
# The Original Code is Copyright (C) 2006, Blender Foundation
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# The Original Code is: all of this file.
|
|
|
|
#
|
|
|
|
# Contributor(s): Jacques Beaurain.
|
|
|
|
#
|
2008-01-07 19:13:47 +00:00
|
|
|
# ***** END GPL LICENSE BLOCK *****
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
set(INC
|
2009-09-06 01:51:23 +00:00
|
|
|
.
|
2011-07-17 09:11:13 +00:00
|
|
|
KXNetwork
|
|
|
|
../BlenderRoutines
|
|
|
|
../Converter
|
|
|
|
../Expressions
|
|
|
|
../GameLogic
|
|
|
|
../Network
|
|
|
|
../Network/LoopBackNetwork
|
|
|
|
../Physics/common
|
|
|
|
../Rasterizer
|
|
|
|
../Rasterizer/RAS_OpenGLRasterizer
|
|
|
|
../SceneGraph
|
|
|
|
../../blender
|
|
|
|
../../blender/blenfont
|
|
|
|
../../blender/blenkernel
|
|
|
|
../../blender/blenlib
|
|
|
|
../../blender/blenloader
|
|
|
|
../../blender/gpu
|
|
|
|
../../blender/imbuf
|
|
|
|
../../blender/makesdna
|
2011-08-28 14:21:44 +00:00
|
|
|
../../blender/makesrna
|
2011-07-17 09:11:13 +00:00
|
|
|
../../blender/python
|
|
|
|
../../blender/python/generic
|
|
|
|
../../blender/python/mathutils
|
2011-05-06 20:18:42 +00:00
|
|
|
../../../intern/container
|
2009-09-06 01:51:23 +00:00
|
|
|
../../../intern/guardedalloc
|
|
|
|
../../../intern/moto/include
|
2011-07-17 09:11:13 +00:00
|
|
|
../../../intern/string
|
2011-05-31 01:15:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(INC_SYS
|
2012-04-28 22:59:55 +00:00
|
|
|
${PTHREADS_INCLUDE_DIRS}
|
2011-04-05 23:31:01 +00:00
|
|
|
${GLEW_INCLUDE_PATH}
|
2010-08-31 22:08:01 +00:00
|
|
|
../../../extern/recastnavigation/Recast/Include
|
|
|
|
../../../extern/recastnavigation/Detour/Include
|
2006-11-17 02:27:12 +00:00
|
|
|
)
|
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
set(SRC
|
2011-05-27 08:45:48 +00:00
|
|
|
BL_Action.cpp
|
|
|
|
BL_ActionManager.cpp
|
2010-10-23 04:05:55 +00:00
|
|
|
BL_BlenderShader.cpp
|
|
|
|
BL_Material.cpp
|
|
|
|
BL_Shader.cpp
|
|
|
|
BL_Texture.cpp
|
|
|
|
KX_ArmatureSensor.cpp
|
|
|
|
KX_BlenderMaterial.cpp
|
|
|
|
KX_BulletPhysicsController.cpp
|
|
|
|
KX_Camera.cpp
|
|
|
|
KX_CameraActuator.cpp
|
|
|
|
KX_CameraIpoSGController.cpp
|
|
|
|
KX_ConstraintActuator.cpp
|
|
|
|
KX_ConstraintWrapper.cpp
|
|
|
|
KX_ConvertPhysicsObjects.cpp
|
|
|
|
KX_Dome.cpp
|
|
|
|
KX_EmptyObject.cpp
|
Patch:[#25163] BGE support for Blender Font objects - unicode support
Problem/Bug:
------------
There were no way to have proper unicode characters (e.g. Japanese) in Blender Game Engine. Now we can :)
You can see a sample here: http://blog.mikepan.com/multi-language-support-in-blender/
Functionality Explanation:
--------------------------
This patch converts the Blender Font Objects to a new BGE type: KX_FontObject
This object inherits KX_GameObject.cpp and has the following properties:
- text (the text of the object)
- size (taken from the Blender object, usually is 1.0)
- resolution (1.0 by default, maybe not really needed, but at least for debugging/the time being it's nice to have)
The way we deal with linked objects is different than Blender. In Blender the text and size are a property of the Text databock. Therefore linked objects necessarily share the same text (and size, although the size of the object datablock affects that too). In BGE they are stored and accessed per object. Without that it would be problematic to have addObject adding texts that don't share the same data.
Known problems/limitations/ToDo:
--------------------------------
1) support for packed font and the <builtin>
2) figure why some fonts are displayed in a different size in 3DView/BGE (BLF)
3) investigate some glitches I see some times
4) support for multiline
5) support for more Blender Font Object options (text aligment, text boxes, ...)
[1] Diego (bdiego) evantually will help on that. For the time being we are using the "default" (ui) font to replace the <builtin>.
[2] but not all of them. I need to cross check who is calculating the size/dpi in/correctly - Blender or BLF. (e.g. fonts that work well - MS Gothic)
[3] I think this may be related to the resolution we are drawing the font
[4] It can't/will not be handled inside BFL. So the way I see it is to implement a mini text library/api that works as a middlelayer between the drawing step and BLF.
So instead of:
BLF_draw(fontid, (char *)text, strlen(text));
We would do:
MAGIC_ROUTINE_IM_NOT_BLF_draw(fontir, (char *)text, styleflag, width, height);
[5] don't hold your breath ... but if someone wants to have fun in the holidays the (4) and (5) are part of the same problem.
Code Explanation:
-----------------
The patch should be simple to read. They are three may parts:
1) BL_BlenderDataConversion.cpp:: converts the OB_FONT object into a KX_FontObject.cpp and store it in the KX_Scene->m_fonts
2) KetsjiEngine.cpp::RenderFonts:: loop through the texts and call their internal drawing routine.
3) KX_FontObject.cpp::
a) constructor: load the font of the object, and store other values.
b) DrawText: calculate the aspect for the given size (sounds hacky but this is how blf works) and call the render routine in RenderTools
4) KX_BlenderGL.cpp (called from rendertools) ::BL_print_game_line:: Draws the text. Using the BLF API
*) In order to handle visibility of the object added with AddObject I'm adding to the m_scene.m_fonts list only the Fonts in a visible layer - unlike Cameras and Lamps where all the objects are added.
Acknowledgements:
----------------
Thanks Benoit for the review and adjustment suggestions.
Thanks Diego for the BFL expertise, patches and support (Latin community ftw)
Thanks my boss for letting me do part of this patch during work time. Good thing we are starting a project in a partnership with a Japanese Foundation and eventual will need unicode in BGE :) for more details on that - www.nereusprogram.org - let's call it the main sponsor of this "bug feature" ;)
2010-12-16 10:25:41 +00:00
|
|
|
KX_FontObject.cpp
|
2010-10-23 04:05:55 +00:00
|
|
|
KX_GameActuator.cpp
|
|
|
|
KX_GameObject.cpp
|
|
|
|
KX_IPO_SGController.cpp
|
|
|
|
KX_IPhysicsController.cpp
|
|
|
|
KX_IpoActuator.cpp
|
|
|
|
KX_KetsjiEngine.cpp
|
|
|
|
KX_Light.cpp
|
|
|
|
KX_LightIpoSGController.cpp
|
|
|
|
KX_MaterialIpoController.cpp
|
|
|
|
KX_MeshProxy.cpp
|
|
|
|
KX_MotionState.cpp
|
|
|
|
KX_MouseFocusSensor.cpp
|
2011-02-16 17:07:18 +00:00
|
|
|
KX_NavMeshObject.cpp
|
2010-10-23 04:05:55 +00:00
|
|
|
KX_NearSensor.cpp
|
|
|
|
KX_ObColorIpoSGController.cpp
|
|
|
|
KX_ObjectActuator.cpp
|
2011-02-16 17:07:18 +00:00
|
|
|
KX_ObstacleSimulation.cpp
|
2010-10-23 04:05:55 +00:00
|
|
|
KX_OrientationInterpolator.cpp
|
|
|
|
KX_ParentActuator.cpp
|
|
|
|
KX_PhysicsObjectWrapper.cpp
|
|
|
|
KX_PolyProxy.cpp
|
|
|
|
KX_PolygonMaterial.cpp
|
|
|
|
KX_PositionInterpolator.cpp
|
|
|
|
KX_PyConstraintBinding.cpp
|
|
|
|
KX_PyMath.cpp
|
|
|
|
KX_PythonInit.cpp
|
|
|
|
KX_PythonInitTypes.cpp
|
|
|
|
KX_PythonSeq.cpp
|
|
|
|
KX_RadarSensor.cpp
|
|
|
|
KX_RayCast.cpp
|
|
|
|
KX_RayEventManager.cpp
|
|
|
|
KX_RaySensor.cpp
|
|
|
|
KX_SCA_AddObjectActuator.cpp
|
|
|
|
KX_SCA_DynamicActuator.cpp
|
|
|
|
KX_SCA_EndObjectActuator.cpp
|
|
|
|
KX_SCA_ReplaceMeshActuator.cpp
|
|
|
|
KX_SG_BoneParentNodeRelationship.cpp
|
|
|
|
KX_SG_NodeRelationships.cpp
|
|
|
|
KX_ScalarInterpolator.cpp
|
|
|
|
KX_ScalingInterpolator.cpp
|
|
|
|
KX_Scene.cpp
|
|
|
|
KX_SceneActuator.cpp
|
|
|
|
KX_SoundActuator.cpp
|
|
|
|
KX_StateActuator.cpp
|
2011-02-16 17:07:18 +00:00
|
|
|
KX_SteeringActuator.cpp
|
2010-10-23 04:05:55 +00:00
|
|
|
KX_TimeCategoryLogger.cpp
|
|
|
|
KX_TimeLogger.cpp
|
|
|
|
KX_TouchEventManager.cpp
|
|
|
|
KX_TouchSensor.cpp
|
|
|
|
KX_TrackToActuator.cpp
|
|
|
|
KX_VehicleWrapper.cpp
|
|
|
|
KX_VertexProxy.cpp
|
|
|
|
KX_VisibilityActuator.cpp
|
|
|
|
KX_WorldInfo.cpp
|
|
|
|
KX_WorldIpoController.cpp
|
2010-11-29 04:35:56 +00:00
|
|
|
|
2011-05-27 08:45:48 +00:00
|
|
|
BL_Action.h
|
|
|
|
BL_ActionManager.h
|
2011-07-17 09:11:13 +00:00
|
|
|
BL_BlenderShader.h
|
|
|
|
BL_Material.h
|
|
|
|
BL_Shader.h
|
|
|
|
BL_Texture.h
|
2010-11-29 04:35:56 +00:00
|
|
|
KX_ArmatureSensor.h
|
|
|
|
KX_BlenderMaterial.h
|
|
|
|
KX_BulletPhysicsController.h
|
|
|
|
KX_Camera.h
|
|
|
|
KX_CameraActuator.h
|
|
|
|
KX_CameraIpoSGController.h
|
|
|
|
KX_ClientObjectInfo.h
|
|
|
|
KX_ConstraintActuator.h
|
|
|
|
KX_ConstraintWrapper.h
|
|
|
|
KX_ConvertPhysicsObject.h
|
|
|
|
KX_Dome.h
|
|
|
|
KX_EmptyObject.h
|
Patch:[#25163] BGE support for Blender Font objects - unicode support
Problem/Bug:
------------
There were no way to have proper unicode characters (e.g. Japanese) in Blender Game Engine. Now we can :)
You can see a sample here: http://blog.mikepan.com/multi-language-support-in-blender/
Functionality Explanation:
--------------------------
This patch converts the Blender Font Objects to a new BGE type: KX_FontObject
This object inherits KX_GameObject.cpp and has the following properties:
- text (the text of the object)
- size (taken from the Blender object, usually is 1.0)
- resolution (1.0 by default, maybe not really needed, but at least for debugging/the time being it's nice to have)
The way we deal with linked objects is different than Blender. In Blender the text and size are a property of the Text databock. Therefore linked objects necessarily share the same text (and size, although the size of the object datablock affects that too). In BGE they are stored and accessed per object. Without that it would be problematic to have addObject adding texts that don't share the same data.
Known problems/limitations/ToDo:
--------------------------------
1) support for packed font and the <builtin>
2) figure why some fonts are displayed in a different size in 3DView/BGE (BLF)
3) investigate some glitches I see some times
4) support for multiline
5) support for more Blender Font Object options (text aligment, text boxes, ...)
[1] Diego (bdiego) evantually will help on that. For the time being we are using the "default" (ui) font to replace the <builtin>.
[2] but not all of them. I need to cross check who is calculating the size/dpi in/correctly - Blender or BLF. (e.g. fonts that work well - MS Gothic)
[3] I think this may be related to the resolution we are drawing the font
[4] It can't/will not be handled inside BFL. So the way I see it is to implement a mini text library/api that works as a middlelayer between the drawing step and BLF.
So instead of:
BLF_draw(fontid, (char *)text, strlen(text));
We would do:
MAGIC_ROUTINE_IM_NOT_BLF_draw(fontir, (char *)text, styleflag, width, height);
[5] don't hold your breath ... but if someone wants to have fun in the holidays the (4) and (5) are part of the same problem.
Code Explanation:
-----------------
The patch should be simple to read. They are three may parts:
1) BL_BlenderDataConversion.cpp:: converts the OB_FONT object into a KX_FontObject.cpp and store it in the KX_Scene->m_fonts
2) KetsjiEngine.cpp::RenderFonts:: loop through the texts and call their internal drawing routine.
3) KX_FontObject.cpp::
a) constructor: load the font of the object, and store other values.
b) DrawText: calculate the aspect for the given size (sounds hacky but this is how blf works) and call the render routine in RenderTools
4) KX_BlenderGL.cpp (called from rendertools) ::BL_print_game_line:: Draws the text. Using the BLF API
*) In order to handle visibility of the object added with AddObject I'm adding to the m_scene.m_fonts list only the Fonts in a visible layer - unlike Cameras and Lamps where all the objects are added.
Acknowledgements:
----------------
Thanks Benoit for the review and adjustment suggestions.
Thanks Diego for the BFL expertise, patches and support (Latin community ftw)
Thanks my boss for letting me do part of this patch during work time. Good thing we are starting a project in a partnership with a Japanese Foundation and eventual will need unicode in BGE :) for more details on that - www.nereusprogram.org - let's call it the main sponsor of this "bug feature" ;)
2010-12-16 10:25:41 +00:00
|
|
|
KX_FontObject.h
|
2010-11-29 04:35:56 +00:00
|
|
|
KX_GameActuator.h
|
|
|
|
KX_GameObject.h
|
|
|
|
KX_IInterpolator.h
|
|
|
|
KX_IPOTransform.h
|
|
|
|
KX_IPO_SGController.h
|
|
|
|
KX_IPhysicsController.h
|
|
|
|
KX_IScalarInterpolator.h
|
|
|
|
KX_ISceneConverter.h
|
|
|
|
KX_ISystem.h
|
|
|
|
KX_IpoActuator.h
|
|
|
|
KX_KetsjiEngine.h
|
|
|
|
KX_Light.h
|
|
|
|
KX_LightIpoSGController.h
|
|
|
|
KX_MaterialIpoController.h
|
|
|
|
KX_MeshProxy.h
|
|
|
|
KX_MotionState.h
|
|
|
|
KX_MouseFocusSensor.h
|
2011-02-16 17:07:18 +00:00
|
|
|
KX_NavMeshObject.h
|
2010-11-29 04:35:56 +00:00
|
|
|
KX_NearSensor.h
|
|
|
|
KX_ObColorIpoSGController.h
|
|
|
|
KX_ObjectActuator.h
|
2011-02-16 17:07:18 +00:00
|
|
|
KX_ObstacleSimulation.h
|
2010-11-29 04:35:56 +00:00
|
|
|
KX_OrientationInterpolator.h
|
|
|
|
KX_ParentActuator.h
|
|
|
|
KX_PhysicsEngineEnums.h
|
|
|
|
KX_PhysicsObjectWrapper.h
|
|
|
|
KX_PhysicsPropertiesobsolete.h
|
|
|
|
KX_PolyProxy.h
|
|
|
|
KX_PolygonMaterial.h
|
|
|
|
KX_PositionInterpolator.h
|
|
|
|
KX_PyConstraintBinding.h
|
|
|
|
KX_PyMath.h
|
|
|
|
KX_PythonInit.h
|
|
|
|
KX_PythonInitTypes.h
|
|
|
|
KX_PythonSeq.h
|
|
|
|
KX_RadarSensor.h
|
|
|
|
KX_RayCast.h
|
|
|
|
KX_RayEventManager.h
|
|
|
|
KX_RaySensor.h
|
|
|
|
KX_SCA_AddObjectActuator.h
|
|
|
|
KX_SCA_DynamicActuator.h
|
|
|
|
KX_SCA_EndObjectActuator.h
|
|
|
|
KX_SCA_ReplaceMeshActuator.h
|
|
|
|
KX_SG_BoneParentNodeRelationship.h
|
|
|
|
KX_SG_NodeRelationships.h
|
|
|
|
KX_ScalarInterpolator.h
|
|
|
|
KX_ScalingInterpolator.h
|
|
|
|
KX_Scene.h
|
|
|
|
KX_SceneActuator.h
|
|
|
|
KX_SoundActuator.h
|
|
|
|
KX_StateActuator.h
|
2011-02-16 17:07:18 +00:00
|
|
|
KX_SteeringActuator.h
|
2010-11-29 04:35:56 +00:00
|
|
|
KX_TimeCategoryLogger.h
|
|
|
|
KX_TimeLogger.h
|
|
|
|
KX_TouchEventManager.h
|
|
|
|
KX_TouchSensor.h
|
|
|
|
KX_TrackToActuator.h
|
|
|
|
KX_VehicleWrapper.h
|
|
|
|
KX_VertexProxy.h
|
|
|
|
KX_VisibilityActuator.h
|
|
|
|
KX_WorldInfo.h
|
|
|
|
KX_WorldIpoController.h
|
2010-10-23 04:05:55 +00:00
|
|
|
)
|
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
add_definitions(-DGLEW_STATIC)
|
2009-11-21 20:36:03 +00:00
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
if(WITH_SDL)
|
2011-07-16 23:01:14 +00:00
|
|
|
list(APPEND INC_SYS
|
|
|
|
${SDL_INCLUDE_DIR}
|
|
|
|
)
|
2011-10-20 00:19:21 +00:00
|
|
|
add_definitions(-DWITH_SDL)
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
2009-07-20 10:24:53 +00:00
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
if(WITH_CODEC_FFMPEG)
|
|
|
|
add_definitions(-DWITH_FFMPEG)
|
|
|
|
endif()
|
2009-09-29 21:42:40 +00:00
|
|
|
|
2011-06-23 09:27:56 +00:00
|
|
|
if(WITH_AUDASPACE)
|
|
|
|
list(APPEND INC
|
|
|
|
../../../intern/audaspace/intern
|
2011-08-07 11:54:58 +00:00
|
|
|
../../../intern/audaspace/FX
|
2011-06-23 09:27:56 +00:00
|
|
|
)
|
|
|
|
add_definitions(-DWITH_AUDASPACE)
|
|
|
|
endif()
|
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
if(WITH_BULLET)
|
2011-05-31 01:15:44 +00:00
|
|
|
list(APPEND INC
|
|
|
|
../../../extern/bullet2/src
|
2011-07-17 09:11:13 +00:00
|
|
|
../Physics/Bullet
|
2011-05-31 01:15:44 +00:00
|
|
|
)
|
2010-12-08 08:43:06 +00:00
|
|
|
add_definitions(-DUSE_BULLET)
|
|
|
|
endif()
|
2010-02-07 14:12:39 +00:00
|
|
|
|
2011-05-31 01:15:44 +00:00
|
|
|
blender_add_lib(ge_logic_ketsji "${SRC}" "${INC}" "${INC_SYS}")
|