svn merge ^/trunk/blender -r43995:44024
This commit is contained in:
		@@ -1490,10 +1490,9 @@ if(MSVC10)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 | 
			
		||||
	if(WITH_IK_ITASC OR WITH_MOD_FLUID)
 | 
			
		||||
	if(WITH_IK_ITASC)
 | 
			
		||||
		message(WARNING "Using Clang as CXX compiler: disabling WITH_IK_ITASC and WITH_MOD_FLUID, these features will be missing.")
 | 
			
		||||
		set(WITH_IK_ITASC OFF)
 | 
			
		||||
		set(WITH_MOD_FLUID OFF)
 | 
			
		||||
	endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,14 @@
 | 
			
		||||
*******************
 | 
			
		||||
GPU functions (gpu)
 | 
			
		||||
===================
 | 
			
		||||
*******************
 | 
			
		||||
 | 
			
		||||
.. module:: gpu
 | 
			
		||||
 | 
			
		||||
This module provides access to materials GLSL shaders.
 | 
			
		||||
 | 
			
		||||
*****
 | 
			
		||||
 | 
			
		||||
Intro
 | 
			
		||||
*****
 | 
			
		||||
=====
 | 
			
		||||
 | 
			
		||||
Module to provide functions concerning the GPU implementation in Blender, in particular
 | 
			
		||||
the GLSL shaders that blender generates automatically to render materials in the 3D view
 | 
			
		||||
@@ -15,16 +16,15 @@ and in the game engine.
 | 
			
		||||
 | 
			
		||||
.. warning::
 | 
			
		||||
 | 
			
		||||
    The API provided by this module should be consider unstable. The data exposed by the API 
 | 
			
		||||
    are are closely related to Blender's internal GLSL code and may change if the GLSL code 
 | 
			
		||||
    is modified (e.g. new uniform type). 
 | 
			
		||||
   The API provided by this module should be consider unstable. The data exposed by the API
 | 
			
		||||
   are are closely related to Blender's internal GLSL code and may change if the GLSL code
 | 
			
		||||
   is modified (e.g. new uniform type).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
*********
 | 
			
		||||
Constants
 | 
			
		||||
*********
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
--------------
 | 
			
		||||
GLSL data type
 | 
			
		||||
--------------
 | 
			
		||||
 | 
			
		||||
@@ -86,7 +86,7 @@ See export_shader_
 | 
			
		||||
 | 
			
		||||
   :value: 8
 | 
			
		||||
 | 
			
		||||
-----------------
 | 
			
		||||
 | 
			
		||||
GLSL uniform type
 | 
			
		||||
-----------------
 | 
			
		||||
 | 
			
		||||
@@ -98,176 +98,176 @@ of calculation used by Blender to compute the uniform value.
 | 
			
		||||
 | 
			
		||||
The calculation of some of the uniforms is based on matrices available in the scene:
 | 
			
		||||
 | 
			
		||||
    .. _mat4_cam_to_world:
 | 
			
		||||
    .. _mat4_world_to_cam:
 | 
			
		||||
   .. _mat4_cam_to_world:
 | 
			
		||||
   .. _mat4_world_to_cam:
 | 
			
		||||
 | 
			
		||||
    *mat4_cam_to_world*
 | 
			
		||||
      Model matrix of the camera. OpenGL 4x4 matrix that converts 
 | 
			
		||||
      camera local coordinates to world coordinates. In blender this is obtained from the
 | 
			
		||||
      'matrix_world' attribute of the camera object.
 | 
			
		||||
   *mat4_cam_to_world*
 | 
			
		||||
     Model matrix of the camera. OpenGL 4x4 matrix that converts
 | 
			
		||||
     camera local coordinates to world coordinates. In blender this is obtained from the
 | 
			
		||||
     'matrix_world' attribute of the camera object.
 | 
			
		||||
 | 
			
		||||
      Some uniform will need the *mat4_world_to_cam*
 | 
			
		||||
      matrix computed as the inverse of this matrix.
 | 
			
		||||
     Some uniform will need the *mat4_world_to_cam*
 | 
			
		||||
     matrix computed as the inverse of this matrix.
 | 
			
		||||
 | 
			
		||||
    .. _mat4_object_to_world:
 | 
			
		||||
    .. _mat4_world_to_object:
 | 
			
		||||
   .. _mat4_object_to_world:
 | 
			
		||||
   .. _mat4_world_to_object:
 | 
			
		||||
 | 
			
		||||
    *mat4_object_to_world*
 | 
			
		||||
      Model matrix of the object that is being rendered. OpenGL 4x4 matric that converts
 | 
			
		||||
      object local coordinates to world coordinates. In blender this is obtained from the
 | 
			
		||||
      'matrix_world' attribute of the object.
 | 
			
		||||
   *mat4_object_to_world*
 | 
			
		||||
     Model matrix of the object that is being rendered. OpenGL 4x4 matric that converts
 | 
			
		||||
     object local coordinates to world coordinates. In blender this is obtained from the
 | 
			
		||||
     'matrix_world' attribute of the object.
 | 
			
		||||
 | 
			
		||||
      Some uniform will need the *mat4_world_to_object* matrix, computed as the inverse of this matrix.
 | 
			
		||||
     Some uniform will need the *mat4_world_to_object* matrix, computed as the inverse of this matrix.
 | 
			
		||||
 | 
			
		||||
    .. _mat4_lamp_to_world:
 | 
			
		||||
    .. _mat4_world_to_lamp:
 | 
			
		||||
   .. _mat4_lamp_to_world:
 | 
			
		||||
   .. _mat4_world_to_lamp:
 | 
			
		||||
 | 
			
		||||
    *mat4_lamp_to_world*
 | 
			
		||||
      Model matrix of the lamp lighting the object. OpenGL 4x4 matrix that converts lamp
 | 
			
		||||
      local coordinates to world coordinates. In blender this is obtained from the
 | 
			
		||||
      'matrix_world' attribute of the lamp object.
 | 
			
		||||
   *mat4_lamp_to_world*
 | 
			
		||||
     Model matrix of the lamp lighting the object. OpenGL 4x4 matrix that converts lamp
 | 
			
		||||
     local coordinates to world coordinates. In blender this is obtained from the
 | 
			
		||||
     'matrix_world' attribute of the lamp object.
 | 
			
		||||
 | 
			
		||||
      Some uniform will need the *mat4_world_to_lamp* matrix
 | 
			
		||||
      computed as the inverse of this matrix.
 | 
			
		||||
     Some uniform will need the *mat4_world_to_lamp* matrix
 | 
			
		||||
     computed as the inverse of this matrix.
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_OBJECT_VIEWMAT
 | 
			
		||||
 | 
			
		||||
    The uniform is a 4x4 GL matrix that converts world coordinates to 
 | 
			
		||||
    camera coordinates (see mat4_world_to_cam_). Can be set once per frame.
 | 
			
		||||
    There is at most one uniform of that type per shader.
 | 
			
		||||
   The uniform is a 4x4 GL matrix that converts world coordinates to
 | 
			
		||||
   camera coordinates (see mat4_world_to_cam_). Can be set once per frame.
 | 
			
		||||
   There is at most one uniform of that type per shader.
 | 
			
		||||
 | 
			
		||||
    :value: 1
 | 
			
		||||
   :value: 1
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_OBJECT_MAT
 | 
			
		||||
 | 
			
		||||
    The uniform is a 4x4 GL matrix that converts object coordinates 
 | 
			
		||||
    to world coordinates (see mat4_object_to_world_). Must be set before drawing the object.
 | 
			
		||||
    There is at most one uniform of that type per shader.
 | 
			
		||||
   The uniform is a 4x4 GL matrix that converts object coordinates
 | 
			
		||||
   to world coordinates (see mat4_object_to_world_). Must be set before drawing the object.
 | 
			
		||||
   There is at most one uniform of that type per shader.
 | 
			
		||||
 | 
			
		||||
    :value: 2
 | 
			
		||||
   :value: 2
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_OBJECT_VIEWIMAT
 | 
			
		||||
 | 
			
		||||
    The uniform is a 4x4 GL matrix that converts coordinates
 | 
			
		||||
    in camera space to world coordinates (see mat4_cam_to_world_).
 | 
			
		||||
    Can be set once per frame. 
 | 
			
		||||
    There is at most one uniform of that type per shader.
 | 
			
		||||
   The uniform is a 4x4 GL matrix that converts coordinates
 | 
			
		||||
   in camera space to world coordinates (see mat4_cam_to_world_).
 | 
			
		||||
   Can be set once per frame.
 | 
			
		||||
   There is at most one uniform of that type per shader.
 | 
			
		||||
 | 
			
		||||
    :value: 3
 | 
			
		||||
   :value: 3
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_OBJECT_IMAT
 | 
			
		||||
 | 
			
		||||
    The uniform is a 4x4 GL matrix that converts world coodinates
 | 
			
		||||
    to object coordinates (see mat4_world_to_object_).
 | 
			
		||||
    Must be set before drawing the object.
 | 
			
		||||
    There is at most one uniform of that type per shader.
 | 
			
		||||
   The uniform is a 4x4 GL matrix that converts world coodinates
 | 
			
		||||
   to object coordinates (see mat4_world_to_object_).
 | 
			
		||||
   Must be set before drawing the object.
 | 
			
		||||
   There is at most one uniform of that type per shader.
 | 
			
		||||
 | 
			
		||||
    :value: 4
 | 
			
		||||
   :value: 4
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_OBJECT_COLOR
 | 
			
		||||
 | 
			
		||||
    The uniform is a vector of 4 float representing a RGB color + alpha defined at object level.
 | 
			
		||||
    Each values between 0.0 and 1.0. In blender it corresponds to the 'color' attribute of the object.
 | 
			
		||||
    Must be set before drawing the object.
 | 
			
		||||
    There is at most one uniform of that type per shader.
 | 
			
		||||
   The uniform is a vector of 4 float representing a RGB color + alpha defined at object level.
 | 
			
		||||
   Each values between 0.0 and 1.0. In blender it corresponds to the 'color' attribute of the object.
 | 
			
		||||
   Must be set before drawing the object.
 | 
			
		||||
   There is at most one uniform of that type per shader.
 | 
			
		||||
 | 
			
		||||
    :value: 5
 | 
			
		||||
   :value: 5
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_LAMP_DYNVEC
 | 
			
		||||
 | 
			
		||||
    The uniform is a vector of 3 float representing the direction of light in camera space.
 | 
			
		||||
    In Blender, this is computed by 
 | 
			
		||||
   The uniform is a vector of 3 float representing the direction of light in camera space.
 | 
			
		||||
   In Blender, this is computed by
 | 
			
		||||
 | 
			
		||||
    mat4_world_to_cam_ * (-vec3_lamp_Z_axis) 
 | 
			
		||||
   mat4_world_to_cam_ * (-vec3_lamp_Z_axis)
 | 
			
		||||
 | 
			
		||||
    as the lamp Z axis points to the opposite direction of light.
 | 
			
		||||
    The norm of the vector should be unity. Can be set once per frame.
 | 
			
		||||
    There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
   as the lamp Z axis points to the opposite direction of light.
 | 
			
		||||
   The norm of the vector should be unity. Can be set once per frame.
 | 
			
		||||
   There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
 | 
			
		||||
    :value: 6
 | 
			
		||||
   :value: 6
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_LAMP_DYNCO
 | 
			
		||||
 | 
			
		||||
    The uniform is a vector of 3 float representing the position of the light in camera space.
 | 
			
		||||
    Computed as 
 | 
			
		||||
   The uniform is a vector of 3 float representing the position of the light in camera space.
 | 
			
		||||
   Computed as
 | 
			
		||||
 | 
			
		||||
    mat4_world_to_cam_ * vec3_lamp_pos
 | 
			
		||||
   mat4_world_to_cam_ * vec3_lamp_pos
 | 
			
		||||
 | 
			
		||||
    Can be set once per frame.
 | 
			
		||||
    There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
   Can be set once per frame.
 | 
			
		||||
   There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
 | 
			
		||||
    :value: 7
 | 
			
		||||
   :value: 7
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_LAMP_DYNIMAT
 | 
			
		||||
 | 
			
		||||
    The uniform is a 4x4 GL matrix that converts vector in camera space to lamp space.
 | 
			
		||||
    Computed as 
 | 
			
		||||
   The uniform is a 4x4 GL matrix that converts vector in camera space to lamp space.
 | 
			
		||||
   Computed as
 | 
			
		||||
 | 
			
		||||
    mat4_world_to_lamp_ * mat4_cam_to_world_
 | 
			
		||||
   mat4_world_to_lamp_ * mat4_cam_to_world_
 | 
			
		||||
 | 
			
		||||
    Can be set once per frame.
 | 
			
		||||
    There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
   Can be set once per frame.
 | 
			
		||||
   There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
 | 
			
		||||
    :value: 8
 | 
			
		||||
   :value: 8
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_LAMP_DYNPERSMAT
 | 
			
		||||
 | 
			
		||||
    The uniform is a 4x4 GL matrix that converts a vector in camera space to shadow buffer depth space.
 | 
			
		||||
    Computed as 
 | 
			
		||||
   The uniform is a 4x4 GL matrix that converts a vector in camera space to shadow buffer depth space.
 | 
			
		||||
   Computed as
 | 
			
		||||
 | 
			
		||||
    mat4_perspective_to_depth_ * mat4_lamp_to_perspective_ * mat4_world_to_lamp_ * mat4_cam_to_world_.
 | 
			
		||||
   mat4_perspective_to_depth_ * mat4_lamp_to_perspective_ * mat4_world_to_lamp_ * mat4_cam_to_world_.
 | 
			
		||||
 | 
			
		||||
    .. _mat4_perspective_to_depth:
 | 
			
		||||
   .. _mat4_perspective_to_depth:
 | 
			
		||||
 | 
			
		||||
    *mat4_perspective_to_depth* is a fixed matrix defined as follow::
 | 
			
		||||
   *mat4_perspective_to_depth* is a fixed matrix defined as follow::
 | 
			
		||||
 | 
			
		||||
        0.5 0.0 0.0 0.5
 | 
			
		||||
        0.0 0.5 0.0 0.5
 | 
			
		||||
        0.0 0.0 0.5 0.5
 | 
			
		||||
        0.0 0.0 0.0 1.0
 | 
			
		||||
      0.5 0.0 0.0 0.5
 | 
			
		||||
      0.0 0.5 0.0 0.5
 | 
			
		||||
      0.0 0.0 0.5 0.5
 | 
			
		||||
      0.0 0.0 0.0 1.0
 | 
			
		||||
 | 
			
		||||
    This uniform can be set once per frame. There is one uniform of that type per lamp casting shadow in the scene.
 | 
			
		||||
   This uniform can be set once per frame. There is one uniform of that type per lamp casting shadow in the scene.
 | 
			
		||||
 | 
			
		||||
    :value: 9
 | 
			
		||||
   :value: 9
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_LAMP_DYNENERGY
 | 
			
		||||
 | 
			
		||||
    The uniform is a single float representing the lamp energy. In blender it corresponds
 | 
			
		||||
    to the 'energy' attribute of the lamp data block.
 | 
			
		||||
    There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
   The uniform is a single float representing the lamp energy. In blender it corresponds
 | 
			
		||||
   to the 'energy' attribute of the lamp data block.
 | 
			
		||||
   There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
 | 
			
		||||
    :value: 10
 | 
			
		||||
   :value: 10
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_LAMP_DYNCOL
 | 
			
		||||
 | 
			
		||||
    The uniform is a vector of 3 float representing the lamp color. 
 | 
			
		||||
    Color elements are between 0.0 and 1.0. In blender it corresponds
 | 
			
		||||
    to the 'color' attribute of the lamp data block.
 | 
			
		||||
    There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
   The uniform is a vector of 3 float representing the lamp color.
 | 
			
		||||
   Color elements are between 0.0 and 1.0. In blender it corresponds
 | 
			
		||||
   to the 'color' attribute of the lamp data block.
 | 
			
		||||
   There is one uniform of that type per lamp lighting the material.
 | 
			
		||||
 | 
			
		||||
    :value: 11
 | 
			
		||||
   :value: 11
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_SAMPLER_2DBUFFER
 | 
			
		||||
 | 
			
		||||
    The uniform is an integer representing an internal texture used for certain effect
 | 
			
		||||
    (color band, etc). 
 | 
			
		||||
   The uniform is an integer representing an internal texture used for certain effect
 | 
			
		||||
   (color band, etc).
 | 
			
		||||
 | 
			
		||||
    :value: 12
 | 
			
		||||
   :value: 12
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_SAMPLER_2DIMAGE
 | 
			
		||||
 | 
			
		||||
    The uniform is an integer representing a texture loaded from an image file. 
 | 
			
		||||
   The uniform is an integer representing a texture loaded from an image file.
 | 
			
		||||
 | 
			
		||||
    :value: 13
 | 
			
		||||
   :value: 13
 | 
			
		||||
 | 
			
		||||
.. data:: GPU_DYNAMIC_SAMPLER_2DSHADOW
 | 
			
		||||
 | 
			
		||||
    The uniform is an integer representing a shadow buffer corresponding to a lamp
 | 
			
		||||
    casting shadow.
 | 
			
		||||
   The uniform is an integer representing a shadow buffer corresponding to a lamp
 | 
			
		||||
   casting shadow.
 | 
			
		||||
 | 
			
		||||
   :value: 14
 | 
			
		||||
 | 
			
		||||
    :value: 14
 | 
			
		||||
 | 
			
		||||
-------------------
 | 
			
		||||
GLSL attribute type
 | 
			
		||||
-------------------
 | 
			
		||||
 | 
			
		||||
@@ -278,231 +278,231 @@ layer that contains the vertex attribute.
 | 
			
		||||
 | 
			
		||||
.. data:: CD_MTFACE
 | 
			
		||||
 | 
			
		||||
    Vertex attribute is a UV Map. Data type is vector of 2 float.
 | 
			
		||||
   Vertex attribute is a UV Map. Data type is vector of 2 float.
 | 
			
		||||
 | 
			
		||||
    There can be more than one attribute of that type, they are differenciated by name.
 | 
			
		||||
    In blender, you can retrieve the attribute data with:
 | 
			
		||||
   There can be more than one attribute of that type, they are differenciated by name.
 | 
			
		||||
   In blender, you can retrieve the attribute data with:
 | 
			
		||||
 | 
			
		||||
    .. code-block:: python
 | 
			
		||||
   .. code-block:: python
 | 
			
		||||
 | 
			
		||||
        mesh.uv_textures[attribute['name']]
 | 
			
		||||
      mesh.uv_textures[attribute["name"]]
 | 
			
		||||
 | 
			
		||||
    :value: 5
 | 
			
		||||
   :value: 5
 | 
			
		||||
 | 
			
		||||
.. data:: CD_MCOL
 | 
			
		||||
 | 
			
		||||
    Vertex attribute is color layer. Data type is vector 4 unsigned byte (RGBA).
 | 
			
		||||
   Vertex attribute is color layer. Data type is vector 4 unsigned byte (RGBA).
 | 
			
		||||
 | 
			
		||||
    There can be more than one attribute of that type, they are differenciated by name.
 | 
			
		||||
    In blender you can retrieve the attribute data with:
 | 
			
		||||
   There can be more than one attribute of that type, they are differenciated by name.
 | 
			
		||||
   In blender you can retrieve the attribute data with:
 | 
			
		||||
 | 
			
		||||
    .. code-block:: python
 | 
			
		||||
   .. code-block:: python
 | 
			
		||||
 | 
			
		||||
        mesh.vertex_colors[attribute['name']]
 | 
			
		||||
      mesh.vertex_colors[attribute["name"]]
 | 
			
		||||
 | 
			
		||||
    :value: 6
 | 
			
		||||
   :value: 6
 | 
			
		||||
 | 
			
		||||
.. data:: CD_ORCO
 | 
			
		||||
 | 
			
		||||
    Vertex attribute is original coordinates. Data type is vector 3 float.
 | 
			
		||||
   Vertex attribute is original coordinates. Data type is vector 3 float.
 | 
			
		||||
 | 
			
		||||
    There can be only 1 attribute of that type per shader.	
 | 
			
		||||
    In blender you can retrieve the attribute data with:
 | 
			
		||||
   There can be only 1 attribute of that type per shader.
 | 
			
		||||
   In blender you can retrieve the attribute data with:
 | 
			
		||||
 | 
			
		||||
    .. code-block:: python
 | 
			
		||||
   .. code-block:: python
 | 
			
		||||
 | 
			
		||||
        mesh.vertices
 | 
			
		||||
      mesh.vertices
 | 
			
		||||
 | 
			
		||||
    :value: 14
 | 
			
		||||
   :value: 14
 | 
			
		||||
 | 
			
		||||
.. data:: CD_TANGENT
 | 
			
		||||
 | 
			
		||||
    Vertex attribute is the tangent vector. Data type is vector 4 float.
 | 
			
		||||
   Vertex attribute is the tangent vector. Data type is vector 4 float.
 | 
			
		||||
 | 
			
		||||
    There can be only 1 attribute of that type per shader.
 | 
			
		||||
    There is currently no way to retrieve this attribute data via the RNA API but a standalone 
 | 
			
		||||
    C function to compute the tangent layer from the other layers can be obtained from
 | 
			
		||||
    blender.org.
 | 
			
		||||
   There can be only 1 attribute of that type per shader.
 | 
			
		||||
   There is currently no way to retrieve this attribute data via the RNA API but a standalone
 | 
			
		||||
   C function to compute the tangent layer from the other layers can be obtained from
 | 
			
		||||
   blender.org.
 | 
			
		||||
 | 
			
		||||
   :value: 18
 | 
			
		||||
 | 
			
		||||
    :value: 18
 | 
			
		||||
 | 
			
		||||
*********
 | 
			
		||||
Functions
 | 
			
		||||
*********
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
.. _export_shader:
 | 
			
		||||
 | 
			
		||||
.. function:: export_shader(scene,material)
 | 
			
		||||
 | 
			
		||||
    Extracts the GLSL shader producing the visual effect of material in scene for the purpose of 
 | 
			
		||||
    reusing the shader in an external engine. This function is meant to be used in material exporter 
 | 
			
		||||
    so that the GLSL shader can be exported entirely. The return value is a dictionary containing the
 | 
			
		||||
    shader source code and all associated data. 
 | 
			
		||||
   Extracts the GLSL shader producing the visual effect of material in scene for the purpose of
 | 
			
		||||
   reusing the shader in an external engine. This function is meant to be used in material exporter
 | 
			
		||||
   so that the GLSL shader can be exported entirely. The return value is a dictionary containing the
 | 
			
		||||
   shader source code and all associated data.
 | 
			
		||||
 | 
			
		||||
    :arg scene: the scene in which the material in rendered.
 | 
			
		||||
    :type scene: :class:`bpy.types.Scene`
 | 
			
		||||
    :arg material: the material that you want to export the GLSL shader
 | 
			
		||||
    :type material: :class:`bpy.types.Material`
 | 
			
		||||
    :return: the shader source code and all associated data in a dictionary
 | 
			
		||||
    :rtype: dictionary
 | 
			
		||||
   :arg scene: the scene in which the material in rendered.
 | 
			
		||||
   :type scene: :class:`bpy.types.Scene`
 | 
			
		||||
   :arg material: the material that you want to export the GLSL shader
 | 
			
		||||
   :type material: :class:`bpy.types.Material`
 | 
			
		||||
   :return: the shader source code and all associated data in a dictionary
 | 
			
		||||
   :rtype: dictionary
 | 
			
		||||
 | 
			
		||||
    The dictionary contains the following elements:
 | 
			
		||||
   The dictionary contains the following elements:
 | 
			
		||||
 | 
			
		||||
    * ['fragment'] : string
 | 
			
		||||
        fragment shader source code.
 | 
			
		||||
   * ["fragment"] : string
 | 
			
		||||
      fragment shader source code.
 | 
			
		||||
 | 
			
		||||
    * ['vertex'] : string
 | 
			
		||||
        vertex shader source code.
 | 
			
		||||
   * ["vertex"] : string
 | 
			
		||||
      vertex shader source code.
 | 
			
		||||
 | 
			
		||||
    * ['uniforms'] : sequence
 | 
			
		||||
        list of uniforms used in fragment shader, can be empty list. Each element of the
 | 
			
		||||
        sequence is a dictionary with the following elements:
 | 
			
		||||
   * ["uniforms"] : sequence
 | 
			
		||||
      list of uniforms used in fragment shader, can be empty list. Each element of the
 | 
			
		||||
      sequence is a dictionary with the following elements:
 | 
			
		||||
 | 
			
		||||
        * ['varname'] : string
 | 
			
		||||
            name of the uniform in the fragment shader. Always of the form 'unf<number>'.
 | 
			
		||||
      * ["varname"] : string
 | 
			
		||||
         name of the uniform in the fragment shader. Always of the form 'unf<number>'.
 | 
			
		||||
 | 
			
		||||
        * ['datatype'] : integer
 | 
			
		||||
            data type of the uniform variable. Can be one of the following:
 | 
			
		||||
      * ["datatype"] : integer
 | 
			
		||||
         data type of the uniform variable. Can be one of the following:
 | 
			
		||||
 | 
			
		||||
            * :data:`gpu.GPU_DATA_1I` : use glUniform1i
 | 
			
		||||
            * :data:`gpu.GPU_DATA_1F` : use glUniform1fv
 | 
			
		||||
            * :data:`gpu.GPU_DATA_2F` : use glUniform2fv
 | 
			
		||||
            * :data:`gpu.GPU_DATA_3F` : use glUniform3fv
 | 
			
		||||
            * :data:`gpu.GPU_DATA_4F` : use glUniform4fv
 | 
			
		||||
            * :data:`gpu.GPU_DATA_9F` : use glUniformMatrix3fv
 | 
			
		||||
            * :data:`gpu.GPU_DATA_16F` : use glUniformMatrix4fv
 | 
			
		||||
         * :data:`gpu.GPU_DATA_1I` : use glUniform1i
 | 
			
		||||
         * :data:`gpu.GPU_DATA_1F` : use glUniform1fv
 | 
			
		||||
         * :data:`gpu.GPU_DATA_2F` : use glUniform2fv
 | 
			
		||||
         * :data:`gpu.GPU_DATA_3F` : use glUniform3fv
 | 
			
		||||
         * :data:`gpu.GPU_DATA_4F` : use glUniform4fv
 | 
			
		||||
         * :data:`gpu.GPU_DATA_9F` : use glUniformMatrix3fv
 | 
			
		||||
         * :data:`gpu.GPU_DATA_16F` : use glUniformMatrix4fv
 | 
			
		||||
 | 
			
		||||
        * ['type'] : integer
 | 
			
		||||
            type of uniform, determines the origin and method of calculation. See uniform-type_.
 | 
			
		||||
            Depending on the type, more elements will be be present.
 | 
			
		||||
      * ["type"] : integer
 | 
			
		||||
         type of uniform, determines the origin and method of calculation. See uniform-type_.
 | 
			
		||||
         Depending on the type, more elements will be be present.
 | 
			
		||||
 | 
			
		||||
        * ['lamp'] : :class:`bpy.types.Object`
 | 
			
		||||
            Reference to the lamp object from which the uniforms value are extracted. Set for the following uniforms types:
 | 
			
		||||
      * ["lamp"] : :class:`bpy.types.Object`
 | 
			
		||||
         Reference to the lamp object from which the uniforms value are extracted. Set for the following uniforms types:
 | 
			
		||||
 | 
			
		||||
            .. hlist::
 | 
			
		||||
               :columns: 3
 | 
			
		||||
         .. hlist::
 | 
			
		||||
            :columns: 3
 | 
			
		||||
 | 
			
		||||
               * :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`
 | 
			
		||||
               * :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`
 | 
			
		||||
               * :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT`
 | 
			
		||||
               * :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
 | 
			
		||||
               * :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY`
 | 
			
		||||
               * :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
 | 
			
		||||
               * :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`
 | 
			
		||||
            * :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`
 | 
			
		||||
            * :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`
 | 
			
		||||
            * :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT`
 | 
			
		||||
            * :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
 | 
			
		||||
            * :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY`
 | 
			
		||||
            * :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
 | 
			
		||||
            * :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`
 | 
			
		||||
 | 
			
		||||
            Notes:
 | 
			
		||||
         Notes:
 | 
			
		||||
 | 
			
		||||
            * The uniforms :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
 | 
			
		||||
              refer to the lamp object position and orientation, both of can be derived from the object world matrix:
 | 
			
		||||
 | 
			
		||||
              .. code-block:: python
 | 
			
		||||
 | 
			
		||||
                obmat = uniform['lamp'].matrix_world
 | 
			
		||||
 | 
			
		||||
              where obmat is the mat4_lamp_to_world_ matrix of the lamp as a 2 dimensional array,
 | 
			
		||||
              the lamp world location location is in obmat[3].
 | 
			
		||||
 | 
			
		||||
            * The uniform types :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL` refer to the lamp data bloc that you get from:
 | 
			
		||||
 | 
			
		||||
              .. code-block:: python
 | 
			
		||||
 | 
			
		||||
                la = uniform['lamp'].data
 | 
			
		||||
          
 | 
			
		||||
              from which you get la.energy and la.color
 | 
			
		||||
 | 
			
		||||
            * Lamp duplication is not supported: if you have duplicated lamps in your scene
 | 
			
		||||
              (i.e. lamp that are instantiated by dupligroup, etc), this element will only 
 | 
			
		||||
              give you a reference to the orignal lamp and you will not know which instance
 | 
			
		||||
              of the lamp it is refering too. You can still handle that case in the exporter
 | 
			
		||||
              by distributing the uniforms amongst the duplicated lamps.
 | 
			
		||||
              
 | 
			
		||||
        * ['image'] : :class:`bpy.types.Image`
 | 
			
		||||
            Reference to the image databloc. Set for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE`. You can get the image data from:
 | 
			
		||||
         * The uniforms :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
 | 
			
		||||
            refer to the lamp object position and orientation, both of can be derived from the object world matrix:
 | 
			
		||||
 | 
			
		||||
            .. code-block:: python
 | 
			
		||||
 | 
			
		||||
               # full path to image file
 | 
			
		||||
               uniform['image'].filepath
 | 
			
		||||
               # image size as a 2-dimensional array of int
 | 
			
		||||
               uniform['image'].size
 | 
			
		||||
               obmat = uniform["lamp"].matrix_world
 | 
			
		||||
 | 
			
		||||
        * ['texnumber'] : integer
 | 
			
		||||
            Channel number to which the texture is bound when drawing the object.
 | 
			
		||||
            Set for uniform types :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`, :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE` and :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`.
 | 
			
		||||
            where obmat is the mat4_lamp_to_world_ matrix of the lamp as a 2 dimensional array,
 | 
			
		||||
            the lamp world location location is in obmat[3].
 | 
			
		||||
 | 
			
		||||
            This is provided for information only: when reusing the shader outside blencer, 
 | 
			
		||||
            you are free to assign the textures to the channel of your choice and to pass
 | 
			
		||||
            that number channel to the GPU in the uniform.
 | 
			
		||||
         * The uniform types :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL` refer to the lamp data bloc that you get from:
 | 
			
		||||
 | 
			
		||||
        * ['texpixels'] : byte array
 | 
			
		||||
            texture data for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`. Although
 | 
			
		||||
            the corresponding uniform is a 2D sampler, the texture is always a 1D texture
 | 
			
		||||
            of n x 1 pixel. The texture size n is provided in ['texsize'] element. 
 | 
			
		||||
            These texture are only used for computer generated texture (colorband, etc).
 | 
			
		||||
            The texture data is provided so that you can make a real image out of it in the
 | 
			
		||||
            exporter.
 | 
			
		||||
            .. code-block:: python
 | 
			
		||||
 | 
			
		||||
        * ['texsize'] : integer
 | 
			
		||||
            horizontal size of texture for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`. 
 | 
			
		||||
            The texture data is in ['texpixels'].
 | 
			
		||||
               la = uniform["lamp"].data
 | 
			
		||||
 | 
			
		||||
    * ['attributes'] : sequence
 | 
			
		||||
        list of attributes used in vertex shader, can be empty. Blender doesn't use
 | 
			
		||||
        standard attributes except for vertex position and normal. All other vertex
 | 
			
		||||
        attributes must be passed using the generic glVertexAttrib functions.
 | 
			
		||||
        The attribute data can be found in the derived mesh custom data using RNA.
 | 
			
		||||
        Each element of the sequence is a dictionary containing the following elements:
 | 
			
		||||
            from which you get la.energy and la.color
 | 
			
		||||
 | 
			
		||||
        * ['varname'] : string
 | 
			
		||||
            name of the uniform in the vertex shader. Always of the form 'att<number>'.
 | 
			
		||||
         * Lamp duplication is not supported: if you have duplicated lamps in your scene
 | 
			
		||||
            (i.e. lamp that are instantiated by dupligroup, etc), this element will only
 | 
			
		||||
            give you a reference to the orignal lamp and you will not know which instance
 | 
			
		||||
            of the lamp it is refering too. You can still handle that case in the exporter
 | 
			
		||||
            by distributing the uniforms amongst the duplicated lamps.
 | 
			
		||||
 | 
			
		||||
        * ['datatype'] : integer
 | 
			
		||||
            data type of vertex attribute, can be one of the following:
 | 
			
		||||
      * ["image"] : :class:`bpy.types.Image`
 | 
			
		||||
         Reference to the image databloc. Set for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE`. You can get the image data from:
 | 
			
		||||
 | 
			
		||||
            * :data:`gpu.GPU_DATA_2F` : use glVertexAttrib2fv
 | 
			
		||||
            * :data:`gpu.GPU_DATA_3F` : use glVertexAttrib3fv
 | 
			
		||||
            * :data:`gpu.GPU_DATA_4F` : use glVertexAttrib4fv
 | 
			
		||||
            * :data:`gpu.GPU_DATA_4UB` : use glVertexAttrib4ubv
 | 
			
		||||
         .. code-block:: python
 | 
			
		||||
 | 
			
		||||
        * ['number'] : integer
 | 
			
		||||
            generic attribute number. This is provided for information only. Blender 
 | 
			
		||||
            doesn't use glBindAttribLocation to place generic attributes at specific location,
 | 
			
		||||
            it lets the shader compiler place the attributes automatically and query the 
 | 
			
		||||
            placement with glGetAttribLocation. The result of this placement is returned in 
 | 
			
		||||
            this element. 
 | 
			
		||||
            # full path to image file
 | 
			
		||||
            uniform["image"].filepath
 | 
			
		||||
            # image size as a 2-dimensional array of int
 | 
			
		||||
            uniform["image"].size
 | 
			
		||||
 | 
			
		||||
            When using this shader in a render engine, you should either use
 | 
			
		||||
            glBindAttribLocation to force the attribute at this location or use 
 | 
			
		||||
            glGetAttribLocation to get the placement chosen by the compiler of your GPU.
 | 
			
		||||
      * ["texnumber"] : integer
 | 
			
		||||
         Channel number to which the texture is bound when drawing the object.
 | 
			
		||||
         Set for uniform types :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`, :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE` and :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`.
 | 
			
		||||
 | 
			
		||||
        * ['type'] : integer
 | 
			
		||||
            type of the mesh custom data from which the vertex attribute is loaded. 
 | 
			
		||||
            See attribute-type_.
 | 
			
		||||
         This is provided for information only: when reusing the shader outside blencer,
 | 
			
		||||
         you are free to assign the textures to the channel of your choice and to pass
 | 
			
		||||
         that number channel to the GPU in the uniform.
 | 
			
		||||
 | 
			
		||||
        * ['name'] : string or integer
 | 
			
		||||
            custom data layer name, used for attribute type :data:`gpu.CD_MTFACE` and :data:`gpu.CD_MCOL`.
 | 
			
		||||
      * ["texpixels"] : byte array
 | 
			
		||||
         texture data for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`. Although
 | 
			
		||||
         the corresponding uniform is a 2D sampler, the texture is always a 1D texture
 | 
			
		||||
         of n x 1 pixel. The texture size n is provided in ["texsize"] element.
 | 
			
		||||
         These texture are only used for computer generated texture (colorband, etc).
 | 
			
		||||
         The texture data is provided so that you can make a real image out of it in the
 | 
			
		||||
         exporter.
 | 
			
		||||
 | 
			
		||||
    Example:
 | 
			
		||||
      * ["texsize"] : integer
 | 
			
		||||
         horizontal size of texture for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`.
 | 
			
		||||
         The texture data is in ["texpixels"].
 | 
			
		||||
 | 
			
		||||
    .. code-block:: python
 | 
			
		||||
   * ["attributes"] : sequence
 | 
			
		||||
      list of attributes used in vertex shader, can be empty. Blender doesn't use
 | 
			
		||||
      standard attributes except for vertex position and normal. All other vertex
 | 
			
		||||
      attributes must be passed using the generic glVertexAttrib functions.
 | 
			
		||||
      The attribute data can be found in the derived mesh custom data using RNA.
 | 
			
		||||
      Each element of the sequence is a dictionary containing the following elements:
 | 
			
		||||
 | 
			
		||||
      * ["varname"] : string
 | 
			
		||||
         name of the uniform in the vertex shader. Always of the form 'att<number>'.
 | 
			
		||||
 | 
			
		||||
      * ["datatype"] : integer
 | 
			
		||||
         data type of vertex attribute, can be one of the following:
 | 
			
		||||
 | 
			
		||||
         * :data:`gpu.GPU_DATA_2F` : use glVertexAttrib2fv
 | 
			
		||||
         * :data:`gpu.GPU_DATA_3F` : use glVertexAttrib3fv
 | 
			
		||||
         * :data:`gpu.GPU_DATA_4F` : use glVertexAttrib4fv
 | 
			
		||||
         * :data:`gpu.GPU_DATA_4UB` : use glVertexAttrib4ubv
 | 
			
		||||
 | 
			
		||||
      * ["number"] : integer
 | 
			
		||||
         generic attribute number. This is provided for information only. Blender
 | 
			
		||||
         doesn't use glBindAttribLocation to place generic attributes at specific location,
 | 
			
		||||
         it lets the shader compiler place the attributes automatically and query the
 | 
			
		||||
         placement with glGetAttribLocation. The result of this placement is returned in
 | 
			
		||||
         this element.
 | 
			
		||||
 | 
			
		||||
         When using this shader in a render engine, you should either use
 | 
			
		||||
         glBindAttribLocation to force the attribute at this location or use
 | 
			
		||||
         glGetAttribLocation to get the placement chosen by the compiler of your GPU.
 | 
			
		||||
 | 
			
		||||
      * ["type"] : integer
 | 
			
		||||
         type of the mesh custom data from which the vertex attribute is loaded.
 | 
			
		||||
         See attribute-type_.
 | 
			
		||||
 | 
			
		||||
      * ["name"] : string or integer
 | 
			
		||||
         custom data layer name, used for attribute type :data:`gpu.CD_MTFACE` and :data:`gpu.CD_MCOL`.
 | 
			
		||||
 | 
			
		||||
   Example:
 | 
			
		||||
 | 
			
		||||
   .. code-block:: python
 | 
			
		||||
 | 
			
		||||
      import gpu
 | 
			
		||||
      # get GLSL shader of material Mat.001 in scene Scene.001
 | 
			
		||||
      scene = bpy.data.scenes["Scene.001"]
 | 
			
		||||
      material = bpy.data.materials["Mat.001"]
 | 
			
		||||
      shader = gpu.export_shader(scene,material)
 | 
			
		||||
      # scan the uniform list and find the images used in the shader
 | 
			
		||||
      for uniform in shader["uniforms"]:
 | 
			
		||||
          if uniform["type"] == gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE:
 | 
			
		||||
              print("uniform {0} is using image {1}".format(uniform["varname"], uniform["image"].filepath))
 | 
			
		||||
      # scan the attribute list and find the UV Map used in the shader
 | 
			
		||||
      for attribute in shader["attributes"]:
 | 
			
		||||
          if attribute["type"] == gpu.CD_MTFACE:
 | 
			
		||||
              print("attribute {0} is using UV Map {1}".format(attribute["varname"], attribute["name"]))
 | 
			
		||||
 | 
			
		||||
        import gpu
 | 
			
		||||
        # get GLSL shader of material Mat.001 in scene Scene.001
 | 
			
		||||
        scene = bpy.data.scenes['Scene.001']
 | 
			
		||||
        material = bpy.data.materials['Mat.001']
 | 
			
		||||
        shader = gpu.export_shader(scene,material)
 | 
			
		||||
        # scan the uniform list and find the images used in the shader
 | 
			
		||||
        for uniform in shader['uniforms']:
 | 
			
		||||
            if uniform['type'] == gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE:
 | 
			
		||||
                print("uniform {0} is using image {1}".format(uniform['varname'], uniform['image'].filepath))
 | 
			
		||||
        # scan the attribute list and find the UV Map used in the shader
 | 
			
		||||
        for attribute in shader['attributes']:
 | 
			
		||||
            if attribute['type'] == gpu.CD_MTFACE:
 | 
			
		||||
                print("attribute {0} is using UV Map {1}".format(attribute['varname'], attribute['name']))
 | 
			
		||||
 | 
			
		||||
*****
 | 
			
		||||
Notes
 | 
			
		||||
*****
 | 
			
		||||
=====
 | 
			
		||||
 | 
			
		||||
.. _mat4_lamp_to_perspective:
 | 
			
		||||
 | 
			
		||||
@@ -511,20 +511,22 @@ Notes
 | 
			
		||||
   The following pseudo code shows how the *mat4_lamp_to_perspective* matrix is computed
 | 
			
		||||
   in blender for uniforms of :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT` type::
 | 
			
		||||
 | 
			
		||||
     #Get the lamp datablock with:
 | 
			
		||||
     lamp=bpy.data.objects[uniform['lamp']].data
 | 
			
		||||
   .. code-block:: python
 | 
			
		||||
 | 
			
		||||
     #Compute the projection matrix:
 | 
			
		||||
     #  You will need these lamp attributes:
 | 
			
		||||
     #  lamp.clipsta : near clip plane in world unit
 | 
			
		||||
     #  lamp.clipend : far clip plane in world unit
 | 
			
		||||
     #  lamp.spotsize : angle in degree of the spot light
 | 
			
		||||
      #Get the lamp datablock with:
 | 
			
		||||
      lamp = bpy.data.objects[uniform["lamp"]].data
 | 
			
		||||
 | 
			
		||||
     #The size of the projection plane is computed with the usual formula:
 | 
			
		||||
     wsize = lamp.clista * tan(lamp.spotsize/2)
 | 
			
		||||
      # Compute the projection matrix:
 | 
			
		||||
      #  You will need these lamp attributes:
 | 
			
		||||
      #  lamp.clipsta : near clip plane in world unit
 | 
			
		||||
      #  lamp.clipend : far clip plane in world unit
 | 
			
		||||
      #  lamp.spotsize : angle in degree of the spot light
 | 
			
		||||
 | 
			
		||||
     #And the projection matrix:
 | 
			
		||||
     mat4_lamp_to_perspective = glFrustum(-wsize,wsize,-wsize,wsize,lamp.clista,lamp.clipend)
 | 
			
		||||
      # The size of the projection plane is computed with the usual formula:
 | 
			
		||||
      wsize = lamp.clista * tan(lamp.spotsize/2)
 | 
			
		||||
 | 
			
		||||
      #And the projection matrix:
 | 
			
		||||
      mat4_lamp_to_perspective = glFrustum(-wsize, wsize, -wsize, wsize, lamp.clista, lamp.clipend)
 | 
			
		||||
 | 
			
		||||
2. Creation of the shadow map for a spot lamp.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1135,7 +1135,9 @@ def rna2sphinx(BASEPATH):
 | 
			
		||||
    fw("\n")
 | 
			
		||||
    fw("Welcome, this document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date))
 | 
			
		||||
    fw("\n")
 | 
			
		||||
    fw("`A PDF version of this document is also available <blender_python_reference_%s.pdf>`_\n" % version_string_pdf)
 | 
			
		||||
 | 
			
		||||
    # fw("`A PDF version of this document is also available <blender_python_reference_%s.pdf>`_\n" % version_string_pdf)
 | 
			
		||||
    fw("`A compressed ZIP file of this site is available <blender_python_reference_%s.zip>`_\n" % version_string_pdf)
 | 
			
		||||
 | 
			
		||||
    fw("\n")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,8 @@
 | 
			
		||||
DO_UPLOAD=true
 | 
			
		||||
DO_EXE_BLENDER=true
 | 
			
		||||
DO_OUT_HTML=true
 | 
			
		||||
DO_OUT_PDF=true
 | 
			
		||||
DO_OUT_HTML_ZIP=true
 | 
			
		||||
DO_OUT_PDF=false
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BLENDER="./blender.bin"
 | 
			
		||||
@@ -61,6 +62,17 @@ if $DO_OUT_HTML ; then
 | 
			
		||||
	# annoying bug in sphinx makes it very slow unless we do this. should report.
 | 
			
		||||
	cd $SPHINXBASE
 | 
			
		||||
	sphinx-build -n -b html sphinx-in sphinx-out
 | 
			
		||||
 | 
			
		||||
	# ------------------------------------------------------------------------
 | 
			
		||||
	# ZIP the HTML dir for upload
 | 
			
		||||
 | 
			
		||||
	if $DO_OUT_HTML_ZIP ; then
 | 
			
		||||
		# lame, temp rename dir
 | 
			
		||||
		mv sphinx-out blender_python_reference_$BLENDER_VERSION
 | 
			
		||||
		zip -r -9 blender_python_reference_$BLENDER_VERSION.zip blender_python_reference_$BLENDER_VERSION
 | 
			
		||||
		mv blender_python_reference_$BLENDER_VERSION sphinx-out
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	cd -
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
@@ -74,6 +86,7 @@ if $DO_OUT_PDF ; then
 | 
			
		||||
	mv $SPHINXBASE/sphinx-out/contents.pdf $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# ----------------------------------------------------------------------------
 | 
			
		||||
# Upload to blender servers, comment this section for testing
 | 
			
		||||
 | 
			
		||||
@@ -89,8 +102,14 @@ if $DO_UPLOAD ; then
 | 
			
		||||
	# better redirect
 | 
			
		||||
	ssh $SSH_USER@emo.blender.org 'echo "<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\" content=\"0;url=../blender_python_api_'$BLENDER_VERSION'/\"></head><body>Redirecting...</body></html>" > '$SSH_UPLOAD'/250PythonDoc/index.html'
 | 
			
		||||
 | 
			
		||||
	# rename so local PDF has matching name.
 | 
			
		||||
	rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
 | 
			
		||||
	if $DO_OUT_PDF ; then
 | 
			
		||||
		# rename so local PDF has matching name.
 | 
			
		||||
		rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if $DO_OUT_HTML_ZIP ; then
 | 
			
		||||
		rsync --progress -avze "ssh -p 22" $SPHINXBASE/blender_python_reference_$BLENDER_VERSION.zip $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/binreloc/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/binreloc/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2008 by The Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/bullet2/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/bullet2/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/carve/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/carve/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/colamd/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/colamd/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2011, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/glew/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/glew/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/libmv/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/libmv/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2011, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/libopenjpeg/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/libopenjpeg/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/libredcode/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/libredcode/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/lzma/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/lzma/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/lzo/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/lzo/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								extern/recastnavigation/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								extern/recastnavigation/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,12 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
/* absolute value */
 | 
			
		||||
template < class T >
 | 
			
		||||
inline T
 | 
			
		||||
ABS( T a )
 | 
			
		||||
{ return (0 < a) ? a : -a ; }
 | 
			
		||||
 | 
			
		||||
// hack for MSVC6.0 compiler
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#if _MSC_VER < 1300
 | 
			
		||||
 
 | 
			
		||||
@@ -177,12 +177,6 @@ inline T
 | 
			
		||||
MAX( T a, T b )
 | 
			
		||||
{ return (a < b) ? b : a ; }
 | 
			
		||||
 | 
			
		||||
/* absolute value */
 | 
			
		||||
template < class T >
 | 
			
		||||
inline T
 | 
			
		||||
ABS( T a )
 | 
			
		||||
{ return (0 < a) ? a : -a ; }
 | 
			
		||||
 | 
			
		||||
/* sign of the value */
 | 
			
		||||
template < class T >
 | 
			
		||||
inline T
 | 
			
		||||
 
 | 
			
		||||
@@ -143,6 +143,7 @@ class CLIP_OT_track_to_empty(Operator):
 | 
			
		||||
        if constraint is None:
 | 
			
		||||
            constraint = ob.constraints.new(type='FOLLOW_TRACK')
 | 
			
		||||
 | 
			
		||||
        constraint.use_active_clip = False
 | 
			
		||||
        constraint.clip = sc.clip
 | 
			
		||||
        constraint.track = track.name
 | 
			
		||||
        constraint.use_3d_position = False
 | 
			
		||||
 
 | 
			
		||||
@@ -35,10 +35,11 @@ class AddPresetBase():
 | 
			
		||||
            name="Name",
 | 
			
		||||
            description="Name of the preset, used to make the path name",
 | 
			
		||||
            maxlen=64,
 | 
			
		||||
            options={'SKIP_SAVE'},
 | 
			
		||||
            )
 | 
			
		||||
    remove_active = bpy.props.BoolProperty(
 | 
			
		||||
            default=False,
 | 
			
		||||
            options={'HIDDEN'},
 | 
			
		||||
            options={'HIDDEN', 'SKIP_SAVE'},
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
 
 | 
			
		||||
@@ -197,7 +197,6 @@ void BLF_dir_free(char **dirs, int count);
 | 
			
		||||
#define BLF_KERNING_DEFAULT (1<<3)
 | 
			
		||||
#define BLF_MATRIX (1<<4)
 | 
			
		||||
#define BLF_ASPECT (1<<5)
 | 
			
		||||
#define BLF_TEXFILTER (1<<6)
 | 
			
		||||
 | 
			
		||||
#define BLF_DRAW_STR_DUMMY_MAX 1024
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -54,8 +54,6 @@
 | 
			
		||||
#include "blf_internal_types.h"
 | 
			
		||||
#include "blf_internal.h"
 | 
			
		||||
 | 
			
		||||
#define _BLF_PADDING 3
 | 
			
		||||
#define _BLF_MIPMAP_LEVELS 3
 | 
			
		||||
 | 
			
		||||
GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi)
 | 
			
		||||
{
 | 
			
		||||
@@ -89,11 +87,7 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
 | 
			
		||||
	gc->cur_tex= -1;
 | 
			
		||||
	gc->x_offs= 0;
 | 
			
		||||
	gc->y_offs= 0;
 | 
			
		||||
	/* Increase padding for each mipmap level: 0->3, 1->4, 2->6, 3->10, ... */
 | 
			
		||||
	if (font->flags & BLF_TEXFILTER)
 | 
			
		||||
		gc->pad= pow(2, _BLF_MIPMAP_LEVELS) + 2;
 | 
			
		||||
	else
 | 
			
		||||
		gc->pad= _BLF_PADDING;
 | 
			
		||||
	gc->pad= 3;
 | 
			
		||||
 | 
			
		||||
	gc->num_glyphs= font->face->num_glyphs;
 | 
			
		||||
	gc->rem_glyphs= font->face->num_glyphs;
 | 
			
		||||
@@ -302,17 +296,13 @@ void blf_glyph_free(GlyphBLF *g)
 | 
			
		||||
 | 
			
		||||
static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, float y2)
 | 
			
		||||
{
 | 
			
		||||
	/* When a string is being rendered as individual glyphs (as in the game
 | 
			
		||||
	 * engine), the leading edge needs to be raised a fraction to prevent
 | 
			
		||||
	 * z-fighting for kerned characters. - z0r */
 | 
			
		||||
	const float twist = (dx1 - dx) * 0.0002f;
 | 
			
		||||
	
 | 
			
		||||
	glBegin(GL_QUADS);
 | 
			
		||||
	glTexCoord2f(uv[0][0], uv[0][1]);
 | 
			
		||||
	glVertex3f(dx, y1, twist);
 | 
			
		||||
	glVertex2f(dx, y1);
 | 
			
		||||
	
 | 
			
		||||
	glTexCoord2f(uv[0][0], uv[1][1]);
 | 
			
		||||
	glVertex3f(dx, y2, twist);
 | 
			
		||||
	glVertex2f(dx, y2);
 | 
			
		||||
	
 | 
			
		||||
	glTexCoord2f(uv[1][0], uv[1][1]);
 | 
			
		||||
	glVertex2f(dx1, y2);
 | 
			
		||||
@@ -415,15 +405,6 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
 | 
			
		||||
 | 
			
		||||
		glBindTexture(GL_TEXTURE_2D, g->tex);
 | 
			
		||||
		glTexSubImage2D(GL_TEXTURE_2D, 0, g->xoff, g->yoff, g->width, g->height, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap);
 | 
			
		||||
		if (font->flags & BLF_TEXFILTER) {
 | 
			
		||||
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
 | 
			
		||||
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL,
 | 
			
		||||
					_BLF_MIPMAP_LEVELS);
 | 
			
		||||
			glGenerateMipmap(GL_TEXTURE_2D);
 | 
			
		||||
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 | 
			
		||||
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
 | 
			
		||||
					GL_LINEAR_MIPMAP_LINEAR);
 | 
			
		||||
		}
 | 
			
		||||
		glPopClientAttrib();
 | 
			
		||||
 | 
			
		||||
		g->uv[0][0]= ((float)g->xoff) / ((float)gc->p2_width);
 | 
			
		||||
 
 | 
			
		||||
@@ -174,7 +174,8 @@ void GPU_extensions_init(void)
 | 
			
		||||
		   strstr(renderer, "R5") || strstr(renderer, "RV5") ||
 | 
			
		||||
		   strstr(renderer, "RS600") || strstr(renderer, "RS690") ||
 | 
			
		||||
		   strstr(renderer, "RS740") || strstr(renderer, "X1") ||
 | 
			
		||||
		   strstr(renderer, "X2"))
 | 
			
		||||
		   strstr(renderer, "X2") || strstr(renderer, "Radeon 9") ||
 | 
			
		||||
		   strstr(renderer, "RADEON 9"))
 | 
			
		||||
			GG.npotdisabled = 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software Foundation,
 | 
			
		||||
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# The Original Code is Copyright (C) 2006, Blender Foundation
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
 
 | 
			
		||||
@@ -136,8 +136,8 @@ void BL_print_game_line(int fontid, const char* text, int size, int dpi, float*
 | 
			
		||||
	/* the actual drawing */
 | 
			
		||||
	glColor4fv(color);
 | 
			
		||||
 | 
			
		||||
	BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER);
 | 
			
		||||
	/* multiply the text matrix by the object matrix */
 | 
			
		||||
	BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT);
 | 
			
		||||
	BLF_matrix(fontid, mat);
 | 
			
		||||
 | 
			
		||||
	/* aspect is the inverse scale that allows you to increase */
 | 
			
		||||
@@ -149,7 +149,7 @@ void BL_print_game_line(int fontid, const char* text, int size, int dpi, float*
 | 
			
		||||
	BLF_position(fontid, 0, 0, 0);
 | 
			
		||||
	BLF_draw(fontid, (char *)text, 65535);
 | 
			
		||||
 | 
			
		||||
	BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER);
 | 
			
		||||
	BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height)
 | 
			
		||||
 
 | 
			
		||||
@@ -292,10 +292,10 @@ void GPC_RenderTools::RenderText3D(	int fontid,
 | 
			
		||||
									float aspect)
 | 
			
		||||
{
 | 
			
		||||
	/* the actual drawing */
 | 
			
		||||
	glColor3fv(color);
 | 
			
		||||
	glColor4fv(color);
 | 
			
		||||
 
 | 
			
		||||
	BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER);
 | 
			
		||||
	/* multiply the text matrix by the object matrix */
 | 
			
		||||
	BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT);
 | 
			
		||||
	BLF_matrix(fontid, mat);
 | 
			
		||||
 | 
			
		||||
	/* aspect is the inverse scale that allows you to increase */
 | 
			
		||||
@@ -307,7 +307,7 @@ void GPC_RenderTools::RenderText3D(	int fontid,
 | 
			
		||||
	BLF_position(fontid, 0, 0, 0);
 | 
			
		||||
	BLF_draw(fontid, text, 65535);
 | 
			
		||||
 | 
			
		||||
	BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER);
 | 
			
		||||
	BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
 | 
			
		||||
	glEnable(GL_DEPTH_TEST);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -173,10 +173,10 @@ void KX_FontObject::DrawText()
 | 
			
		||||
	this->GetObjectColor().getValue(m_color);
 | 
			
		||||
 | 
			
		||||
	/* HARDCODED MULTIPLICATION FACTOR - this will affect the render resolution directly */
 | 
			
		||||
	float RES = BGE_FONT_RES * m_resolution;
 | 
			
		||||
	const float RES = BGE_FONT_RES * m_resolution;
 | 
			
		||||
 | 
			
		||||
	float size = m_fsize * m_object->size[0] * RES;
 | 
			
		||||
	float aspect = 1.f / (m_object->size[0] * RES);
 | 
			
		||||
	const float size = m_fsize * this->NodeGetWorldScaling()[0] * RES;
 | 
			
		||||
	const float aspect = m_fsize / size;
 | 
			
		||||
 | 
			
		||||
	/* Get a working copy of the OpenGLMatrix to use */
 | 
			
		||||
	double mat[16];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user