Large diffs are not rendered by default.

@@ -0,0 +1,124 @@
BL_Texture(CValue)
==================

.. module:: bge.types

base class --- :class:`CValue`

.. class:: BL_Texture(CValue)

A texture object that contains attributes of a material texture.

.. attribute:: diffuseIntensity

Amount texture affects diffuse reflectivity.

:type: float

.. attribute:: diffuseFactor

Amount texture affects diffuse color.

:type: float

.. attribute:: alpha

Amount texture affects alpha.

:type: float

.. attribute:: specularIntensity

Amount texture affects specular reflectivity.

:type: float

.. attribute:: specularFactor

Amount texture affects specular color.

:type: float

.. attribute:: hardness

Amount texture affects hardness.

:type: float

.. attribute:: emit

Amount texture affects emission.

:type: float

.. attribute:: mirror

Amount texture affects mirror color.

:type: float

.. attribute:: normal

Amount texture affects normal values.

:type: float

.. attribute:: parallaxBump

Height of parallax occlusion mapping.

:type: float

.. attribute:: parallaxStep

Number of steps to achieve parallax effect.

:type: float

.. attribute:: lodBias

Amount bias on mipmapping.

:type: float

.. attribute:: bindCode

Texture bind code/Id/number.

:type: integer

.. attribute:: renderer

Texture renderer of this texture.

:type: :class:`KX_CubeMap`, :class:`KX_PlanarMap` or None

.. attribute:: ior

Index Of Refraction used to compute refraction.

:type: float (1.0 to 50.0)

.. attribute:: refractionRatio

Amount refraction mixed with reflection.

:type: float (0.0 to 1.0)

.. attribute:: uvOffset

Offset applied to texture UV coordinates (mainly translation on U and V axis).

:type: :class:`mathutils.Vector`

.. attribute:: uvSize

Scale applied to texture UV coordinates.

:type: :class:`mathutils.Vector`

.. attribute:: uvRotation

Rotation applied to texture UV coordinates.

:type: float (radians)
@@ -0,0 +1,80 @@
KX_2DFilter(BL_Shader)
======================

.. module:: bge.types

base class --- :class:`BL_Shader`

.. class:: KX_2DFilter(BL_Shader)

2D filter shader object. Can be alterated with :class:`BL_Shader`'s functions.

.. warning::

The vertex shader must not apply modelview and projection transformation. It should be similar to:

.. code-block:: glsl
void main()
{
gl_Position = gl_Vertex;
}
.. attribute:: mipmap

Request mipmap generation of the render `bgl_RenderedTexture` texture. Accessing mipmapping level is similar to:

.. code-block:: glsl
uniform sampler2D bgl_RenderedTexture;
void main()
{
float level = 2.0; // mipmap level
gl_FragColor = textureLod(bgl_RenderedTexture, gl_TexCoord[0].st, level);
}
:type: boolean

.. attribute:: offScreen

The custom off screen the filter render to (read-only).

:type: :class:`bge.types.KX_2DFilterOffScreen` or None

.. method:: setTexture(index, bindCode, samplerName="")

Set specified texture bind code :data:`bindCode` in specified slot :data:`index`. Any call to :data:`setTexture`
should be followed by a call to :data:`BL_Shader.setSampler` with the same :data:`index`.

:arg index: The texture slot.
:type index: integer
:arg bindCode: The texture bind code/Id.
:type bindCode: integer
:arg samplerName: The shader sampler name set to :data:`index` if :data:`samplerName` is passed in the function. (optional)
:type samplerName: string

.. method:: addOffScreen(slots, depth=False, width=-1, height=-1, hdr=bge.render.HDR_NONE, mipmap=False)

Register a custom off screen to render the filter to.

:arg slots: The number of color texture attached to the off screen, between 0 and 8 excluded.
:type slots: integer
:arg depth: True of the off screen use a depth texture (optional).
:type depth: boolean
:arg width: The off screen width, -1 if it can be resized dynamically when the viewport dimensions changed (optional).
:type width: integer
:arg height: The off screen height, -1 if it can be resized dynamically when the viewport dimensions changed (optional).
:type height: integer
:arg hdr: The image quality HDR of the color textures (optional).
:type hdr: one of :ref:`these constants<render-hdr>`
:arg mipmap: True if the color texture generate mipmap at the end of the filter rendering (optional).
:type mipmap: boolean

.. note::
If the off screen is created using a dynamic size (`width` and `height` to -1) its bind codes will be unavailable before
the next render of the filter and the it can change when the viewport is resized.

.. method:: removeOffScreen()

Unregister the custom off screen the filter render to.
@@ -0,0 +1,56 @@
KX_2DFilterManager(PyObjectPlus)
================================

.. module:: bge.types

base class --- :class:`PyObjectPlus`

.. class:: KX_2DFilterManager(PyObjectPlus)

2D filter manager used to add, remove and find filters in a scene.

.. method:: addFilter(index, type, fragmentProgram)

Add a filter to the pass index :data:`index`, type :data:`type` and fragment program if custom filter.

:arg index: The filter pass index.
:type index: integer
:arg type: The filter type, one of:

* :data:`bge.logic.RAS_2DFILTER_BLUR`
* :data:`bge.logic.RAS_2DFILTER_DILATION`
* :data:`bge.logic.RAS_2DFILTER_EROSION`
* :data:`bge.logic.RAS_2DFILTER_SHARPEN`
* :data:`bge.logic.RAS_2DFILTER_LAPLACIAN`
* :data:`bge.logic.RAS_2DFILTER_PREWITT`
* :data:`bge.logic.RAS_2DFILTER_SOBEL`
* :data:`bge.logic.RAS_2DFILTER_GRAYSCALE`
* :data:`bge.logic.RAS_2DFILTER_SEPIA`
* :data:`bge.logic.RAS_2DFILTER_CUSTOMFILTER`

:type type: integer
:arg fragmentProgram: The filter shader fragment program.
Specified only if :data:`type` is :data:`bge.logic.RAS_2DFILTER_CUSTOMFILTER`. (optional)
:type fragmentProgram: string
:return: The 2D Filter.
:rtype: :class:`KX_2DFilter`

.. method:: removeFilter(index)

Remove filter to the pass index :data:`index`.

:arg index: The filter pass index.
:type index: integer

.. method:: getFilter(index)

Return filter to the pass index :data:`index`.

:warning: If the 2D Filter is added with a :class:`SCA_2DFilterActuator`, the filter will
be available only after the 2D Filter program is linked. The python script to get the filter
has to be executed one frame later. A delay sensor can be used.

:arg index: The filter pass index.
:type index: integer
:return: The filter in the specified pass index or None.
:rtype: :class:`KX_2DFilter` or None
@@ -0,0 +1,38 @@
KX_2DFilterOffScreen(CValue)
============================

.. module:: bge.types

base class --- :class:`CValue`

.. class:: KX_2DFilterOffScreen(CValue)

2D filter custom off screen.

.. attribute:: width

The off screen width, -1 if the off screen can be resized dynamically (read-only).

:type: integer

.. attribute:: height

The off screen height, -1 if the off screen can be resized dynamically (read-only).

:type: integer

.. attribute:: colorBindCodes

The bind code of the color textures attached to the off screen (read-only).

.. warning:: If the off screen can be resized dynamically (:data:`width` of :data:`height` equal to -1), the bind codes may change.

:type: list of 8 integers

.. attribute:: depthBindCode

The bind code of the depth texture attached to the off screen (read-only).

.. warning:: If the off screen can be resized dynamically (:data:`width` of :data:`height` equal to -1), the bind code may change.

:type: integer
@@ -0,0 +1,46 @@
KX_BatchGroup(CValue)
=====================

.. module:: bge.types

base class --- :class:`CValue`

.. class:: KX_BatchGroup(CValue)

The batch group is class containing a mesh resulting of the merging of meshes used by objects.
The meshes are merged with the transformation of the objects using it.
An instance of this class is not owned by one object but shared between objects.
In consideration an instance of :class:`KX_BatchGroup` have to instanced with as argument a list of at least one object containing the meshes to merge.
This can be done in a way similar to:

.. code-block:: python
import bge
scene = bge.logic.getCurrentScene()
batchGroup = types.KX_BatchGroup([scene.objects["Cube"], scene.objects["Plane"]])
.. attribute:: objects

The list of the objects merged. (read only)

:type: :class:`CListValue` of :class:`KX_GameObject`

.. method:: merge(objects)

Merge meshes using the transformation of the objects using them.

:arg objects: The objects to merge.
:type object: :class:`CListValue` of :class:`KX_GameObject`

.. method:: split(objects)

Split the meshes of the objects using them and restore their original meshes.

:arg objects: The objects to unmerge.
:type object: :class:`CListValue` of :class:`KX_GameObject`

.. method:: destruct()

Destruct the batch group and restore all the objects to their original meshes.
@@ -0,0 +1,57 @@
KX_BoundingBox(PyObjectPlus)
=============================

.. module:: bge.types

base class --- :class:`PyObjectPlus`

.. class:: KX_BoundingBox(PyObjectPlus)

A bounding volume box of a game object. Used to get and alterate the volume box or AABB.

.. code-block:: python
from bge import logic
from mathutils import Vector
owner = logic.getCurrentController().owner
box = owner.cullingBox
# Disable auto update to allow modify the box.
box.autoUpdate = False
print(box)
# Increase the height of the box of 1.
box.max = box.max + Vector((0, 0, 1))
print(box)
.. attribute:: min

The minimal point in x, y and z axis of the bounding box.

:type: :class:`mathutils.Vector`

.. attribute:: max

The maximal point in x, y and z axis of the bounding box.

:type: :class:`mathutils.Vector`

.. attribute:: center

The center of the bounding box. (read only)

:type: :class:`mathutils.Vector`

.. attribute:: radius

The radius of the bounding box. (read only)

:type: float

.. attribute:: autoUpdate

Allow to update the bounding box if the mesh is modified.

:type: boolean
@@ -0,0 +1,79 @@
KX_CollisionContactPoint(CValue)
================================

.. module:: bge.types

base class --- :class:`CValue`

.. class:: KX_CollisionContactPoint(CValue)

A collision contact point passed to the collision callbacks.

.. code-block:: python
import bge
def oncollision(object, point, normal, points):
print("Hit by", object)
for point in points:
print(point.localPointA)
print(point.localPointB)
print(point.worldPoint)
print(point.normal)
print(point.combinedFriction)
print(point.combinedRestitution)
print(point.appliedImpulse)
cont = bge.logic.getCurrentController()
own = cont.owner
own.collisionCallbacks = [oncollision]
.. attribute:: localPointA

The contact point in the owner object space.

:type: :class:`mathutils.Vector`

.. attribute:: localPointB

The contact point in the collider object space.

:type: :class:`mathutils.Vector`

.. attribute:: worldPoint

The contact point in world space.

:type: :class:`mathutils.Vector`

.. attribute:: normal

The contact normal in owner object space.

:type: :class:`mathutils.Vector`

.. attribute:: combinedFriction

The combined friction of the owner and collider object.

:type: float

.. attribute:: combinedRollingFriction

The combined rolling friction of the owner and collider object.

:type: float

.. attribute:: combinedRestitution

The combined restitution of the owner and collider object.

:type: float

.. attribute:: appliedImpulse

The applied impulse to the owner object.

:type: float


@@ -0,0 +1,47 @@
KX_CollisionSensor(SCA_ISensor)
===============================

.. module:: bge.types

base class --- :class:`SCA_ISensor`

.. class:: KX_CollisionSensor(SCA_ISensor)

Collision sensor detects collisions between objects.

.. attribute:: propName

The property or material to collide with.

:type: string

.. attribute:: useMaterial

Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property.

:type: boolean

.. attribute:: usePulseCollision

When enabled, changes to the set of colliding objects generate a pulse.

:type: boolean

.. attribute:: hitObject

The last collided object. (read-only).

:type: :class:`KX_GameObject` or None

.. attribute:: hitObjectList

A list of colliding objects. (read-only).

:type: :class:`CListValue` of :class:`KX_GameObject`

.. attribute:: hitMaterial

The material of the object in the face hit by the ray. (read-only).

:type: string

@@ -0,0 +1,52 @@
KX_LodLevel(PyObjectPlus)
=========================

.. module:: bge.types

base class --- :class:`PyObjectPlus`

.. class:: KX_LodLevel(PyObjectPlus)

A single lod level for a game object lod manager.

.. attribute:: mesh

The mesh used for this lod level. (read only)

:type: :class:`RAS_MeshObject`

.. attribute:: level

The number of the lod level. (read only)

:type: integer

.. attribute:: distance

Distance to begin using this level of detail. (read only)

:type: float (0.0 to infinite)

.. attribute:: hysteresis

Minimum distance factor change required to transition to the previous level of detail in percent. (read only)

:type: float [0.0 to 100.0]

.. attribute:: useMesh

Return True if the lod level uses a different mesh than the original object mesh. (read only)

:type: boolean

.. attribute:: useMaterial

Return True if the lod level uses a different material than the original object mesh material. (read only)

:type: boolean

.. attribute:: useHysteresis

Return true if the lod level uses hysteresis override. (read only)

:type: boolean
@@ -0,0 +1,22 @@
KX_LodManager(PyObjectPlus)
===========================

.. module:: bge.types

base class --- :class:`PyObjectPlus`

.. class:: KX_LodManager(PyObjectPlus)

This class contains a list of all levels of detail used by a game object.

.. attribute:: levels

Return the list of all levels of detail of the lod manager.

:type: list of :class:`KX_LodLevel`

.. attribute:: distanceFactor

Method to multiply the distance to the camera.

:type: float
@@ -0,0 +1,54 @@
SCA_InputEvent(PyObjectPlus)
============================

.. module:: bge.types

base class --- :class:`PyObjectPlus`

.. class:: SCA_InputEvent(PyObjectPlus)

Events for a keyboard or mouse input.

.. attribute:: status

A list of existing status of the input from the last frame.
Can contain :data:`bge.logic.KX_INPUT_NONE` and :data:`bge.logic.KX_INPUT_ACTIVE`.
The list always contains one value.
The first value of the list is the last value of the list in the last frame. (read-only)

:type: list of integer.

.. attribute:: queue

A list of existing events of the input from the last frame.
Can contain :data:`bge.logic.KX_INPUT_JUST_ACTIVATED` and :data:`bge.logic.KX_INPUT_JUST_RELEASED`.
The list can be empty. (read-only)

:type: list of integer.

.. attribute:: values

A list of existing value of the input from the last frame.
For keyboard it contains 1 or 0 and for mouse the coordinate of the mouse or the movement of the wheel mouse.
The list contains always one value, the size of the list is the same than :data:`queue` + 1 only for keyboard inputs.
The first value of the list is the last value of the list in the last frame. (read-only)

Example to get the non-normalized mouse coordinates:

.. code-block:: python
import bge
x = bge.logic.mouse.inputs[bge.events.MOUSEX].values[-1]
y = bge.logic.mouse.inputs[bge.events.MOUSEY].values[-1]
print("Mouse non-normalized position: x: {0}, y: {1}".format(x, y))
:type: list of integer.

.. attribute:: type

The type of the input.
One of :ref:`these constants<keyboard-keys>`

:type: integer
@@ -0,0 +1,60 @@
SCA_VibrationActuator(SCA_IActuator)
====================================

.. module:: bge.types

base class --- :class:`SCA_IActuator`

.. class:: SCA_VibrationActuator(SCA_IActuator)

Vibration Actuator.

.. attribute:: joyindex

Joystick index.

:type: integer (0 to 7)

.. attribute:: strengthLeft

Strength of the Low frequency joystick's motor (placed at left position usually).

:type: float (0.0 to 1.0)

.. attribute:: strengthRight

Strength of the High frequency joystick's motor (placed at right position usually).

:type: float (0.0 to 1.0)

.. attribute:: duration

Duration of the vibration in milliseconds.

:type: integer (0 to infinite)

.. attribute:: isVibrating

Check status of joystick vibration

:type: bool (true vibrating and false stopped)

.. attribute:: hasVibration

Check if the joystick supports vibration

:type: bool (true supported and false not supported)

.. method:: startVibration()

Starts the vibration.

:return: None

.. method:: stopVibration()

Stops the vibration.

:return: None


@@ -0,0 +1,27 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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
* of the License, or (at your option) any later version.
*
* 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,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Tristan Porteries.
*
* ***** END GPL LICENSE BLOCK *****
*/

/** \file moto/include/MT_Config.h
* \ingroup moto
*/

#define GEN_INLINED
@@ -0,0 +1,42 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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
* of the License, or (at your option) any later version.
*
* 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,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Tristan Porteries.
*
* ***** END GPL LICENSE BLOCK *****
*/

/** \file moto/include/MT_Frustum.h
* \ingroup moto
*/

#ifndef __MT_FRUSTUM_H__
#define __MT_FRUSTUM_H__

#include "MT_Config.h"
#include "MT_Matrix4x4.h"

#include <array>

void MT_FrustumBox(const MT_Matrix4x4& mat, std::array<MT_Vector3, 8>& box);
void MT_FrustumAabb(const MT_Matrix4x4& mat, MT_Vector3& min, MT_Vector3& max);

#ifdef GEN_INLINED
# include "MT_Frustum.inl"
#endif

#endif // __MT_FRUSTUM_H__
@@ -0,0 +1,67 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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
* of the License, or (at your option) any later version.
*
* 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,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Tristan Porteries.
*
* ***** END GPL LICENSE BLOCK *****
*/

/** \file moto/include/MT_Frustum.inl
* \ingroup moto
*/

#include "MT_Optimize.h"

static const MT_Vector3 normalizedBox[8] = {
MT_Vector3(-1.0f, -1.0f, -1.0f),
MT_Vector3(-1.0f, 1.0f, -1.0f),
MT_Vector3(1.0f, 1.0f, -1.0f),
MT_Vector3(1.0f, -1.0f, -1.0f),
MT_Vector3(-1.0f, -1.0f, 1.0f),
MT_Vector3(-1.0f, 1.0f, 1.0f),
MT_Vector3(1.0f, 1.0f, 1.0f),
MT_Vector3(1.0f, -1.0f, 1.0f)
};

GEN_INLINE void MT_FrustumBox(const MT_Matrix4x4& mat, std::array<MT_Vector3, 8>& box)
{
for (unsigned short i = 0; i < 8; ++i) {
const MT_Vector3& p3 = normalizedBox[i];
const MT_Vector4 p4 = mat * MT_Vector4(p3.x(), p3.y(), p3.z(), 1.0f);

box[i] = p4.to3d() / p4.w();
}
}

GEN_INLINE void MT_FrustumAabb(const MT_Matrix4x4& mat, MT_Vector3& min, MT_Vector3& max)
{
for (unsigned short i = 0; i < 8; ++i) {
const MT_Vector3& p3 = normalizedBox[i];
const MT_Vector4 p4 = mat * MT_Vector4(p3.x(), p3.y(), p3.z(), 1.0f);
const MT_Vector3 co = p4.to3d() / p4.w();

if (i == 0) {
min = max = co;
}
else {
for (unsigned short axis = 0; axis < 3; ++axis) {
min[axis] = std::min(min[axis], co[axis]);
max[axis] = std::max(max[axis], co[axis]);
}
}
}
}
@@ -0,0 +1,32 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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
* of the License, or (at your option) any later version.
*
* 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,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Tristan Porteries.
*
* ***** END GPL LICENSE BLOCK *****
*/

/** \file moto/include/MT_Frustum.cpp
* \ingroup moto
*/


#include "MT_Frustum.h"

#ifndef GEN_INLINED
# include "MT_Frustum.inl"
#endif
@@ -0,0 +1,34 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# 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
# of the License, or (at your option) any later version.
#
# 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,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****

set(INC
.
)

set(INC_SYS

)

set(SRC
SpindleEncryption.cpp

SpindleEncryption.h
)


blender_add_lib(bf_intern_spindle "${SRC}" "${INC}" "${INC_SYS}")

Large diffs are not rendered by default.

@@ -0,0 +1,56 @@
/**
* ***** BEGIN MIT LICENSE BLOCK *****
* Copyright (C) 2011-2012 by DeltaSpeeds
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END MIT LICENSE BLOCK *****
*/

#ifndef __SPINDLEENCRYPTION_H__
#define __SPINDLEENCRYPTION_H__


#define SPINDLE_NO_ENCRYPTION 0
#define SPINDLE_STATIC_ENCRYPTION 1
#define SPINDLE_DYNAMIC_ENCRYPTION 2


#ifdef __cplusplus
#include <string>
std::string SPINDLE_FindAndSetEncryptionKeys(char **argv, int i);
void SPINDLE_SetFilePath(std::string path);

extern "C" {
#endif
char *SPINDLE_DecryptFromFile(const char *filename, int *fileSize, const char *encryptKey, int typeEncryption);
int SPINDLE_CheckEncryptionFromFile(const char *filepath);
void SPINDLE_SetFilePath(const char *filepath);
const char *SPINDLE_GetFilePath(void);

#ifdef __cplusplus
}
#endif

#endif // __SPINDLEENCRYPTION_H__
@@ -0,0 +1,31 @@
Copyright (c) 2013 by Igor Kalnitsky.
All rights reserved.

Redistribution and use in source and binary forms of the software as well
as documentation, with or without modification, are permitted provided
that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.

THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
@@ -0,0 +1,42 @@
// termcolor //

a library for printing colored messages

by Igor Kalnitsky


~ What is termcolor?

Termcolor is a header-only C++ library for printing colored
messages to the terminal. Written just for fun with a help of
the Force.

And yeah, it's BSD licensed so you are free to do whatever you
want as long as copyright sticks around!


~ How to use?

Add `termcolor.hpp` to the project and use provided stream
manimulators from the `termcolor` namespace.

For example:

std::cout << termcolor::red << termcolor::on_blue
<< "Red text on blue background!"
<< termcolor::reset << std::endl;

Please, don't forgot to reset termcolor's settings on the stream!


~ What terminals are supported?

Termcolor supports ANSI color formatting. This formatting is
supported by most popular terminals on Linux, Unix and Mac OS.
On Windows, WinAPI is used instead, however, some limitations
are applied. Check the docs for details!


~ Where the docs?

https://termcolor.readthedocs.io/

Large diffs are not rendered by default.

@@ -1332,7 +1332,7 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma)
short index = 0, i;

bool use_nodes = BKE_scene_use_new_shading_nodes(scene);
bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene);
bool is_bi = BKE_scene_uses_blender_internal(scene);

/* XXX, for 2.8 testing & development its useful to have non Cycles/BI engines use material nodes
* In the future we may have some way to check this which each engine can define.
@@ -99,4 +99,10 @@ void EDIT_ARMATURE_collection_settings_create(struct IDProperty *properties);
void PAINT_WEIGHT_collection_settings_create(struct IDProperty *properties);
void PAINT_VERTEX_collection_settings_create(struct IDProperty *properties);

/*************************************************Game engine************************************************/
void DRW_game_render_loop_begin(struct GPUOffScreen *ofs, struct Depsgraph *graph,
struct Scene *scene, struct SceneLayer *sl, struct Object *maincam, int viewportsize[2], bool is_first_scene);
void DRW_game_render_loop_end(void);
/********************************************End of game engine**********************************************/

#endif /* __DRW_ENGINE_H__ */
@@ -124,3 +124,11 @@ EEVEE_LampEngineData *EEVEE_lamp_data_get(Object *ob)

return *ledata;
}

/********************Game engine*************************/
EEVEE_Data *EEVEE_engine_data_get(void)
{
EEVEE_Data *data = (EEVEE_Data *)DRW_viewport_engine_data_get(&draw_engine_eevee_type);
return data;
}
/*****************End of Game engine*********************/
@@ -1716,3 +1716,10 @@ void EEVEE_effects_free(void)
DRW_SHADER_FREE_SAFE(e_data.bloom_upsample_sh[1]);
DRW_SHADER_FREE_SAFE(e_data.bloom_resolve_sh[1]);
}

/*************************Game engine**************************/
void EEVEE_effects_replace_e_data_depth(GPUTexture *depth_src)
{
e_data.depth_src = depth_src;
}
/*********************End of Game engine***********************/
@@ -395,3 +395,18 @@ RenderEngineType DRW_engine_viewport_eevee_type = {


#undef EEVEE_ENGINE

/***************************Game engine******************************/
#define GAME_ENGINE "BLENDER_GAME"

RenderEngineType DRW_engine_viewport_game_type = {
NULL, NULL,
GAME_ENGINE, N_("Blender Game"), RE_INTERNAL | RE_USE_SHADING_NODES,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&EEVEE_layer_collection_settings_create, &EEVEE_scene_layer_settings_create,
&draw_engine_eevee_type,
{ NULL, NULL, NULL }
};

#undef GAME_ENGINE
/************************End of Game engine**************************/
@@ -26,6 +26,7 @@
#ifndef __EEVEE_ENGINE_H__
#define __EEVEE_ENGINE_H__

extern RenderEngineType DRW_engine_viewport_eevee_type;
extern struct RenderEngineType DRW_engine_viewport_eevee_type;
extern struct RenderEngineType DRW_engine_viewport_game_type;

#endif /* __EEVEE_ENGINE_H__ */
@@ -501,8 +501,8 @@ static void eevee_shadow_cube_setup(Object *ob, EEVEE_LampsInfo *linfo, EEVEE_La
}

ubo_data->bias = 0.05f * la->bias;
ubo_data->near = la->clipsta;
ubo_data->far = la->clipend;
ubo_data->nearf = la->clipsta;
ubo_data->farf = la->clipend;
ubo_data->exp = (linfo->shadow_method == SHADOW_VSM) ? la->bleedbias : la->bleedexp;

evli->shadowid = (float)(sh_data->shadow_id);
@@ -747,8 +747,8 @@ static void eevee_shadow_cascade_setup(Object *ob, EEVEE_LampsInfo *linfo, EEVEE
}

ubo_data->bias = 0.05f * la->bias;
ubo_data->near = la->clipsta;
ubo_data->far = la->clipend;
ubo_data->nearf = la->clipsta;
ubo_data->farf = la->clipend;
ubo_data->exp = (linfo->shadow_method == SHADOW_VSM) ? la->bleedbias : la->bleedexp;

evli->shadowid = (float)(sh_data->shadow_id);
@@ -1064,4 +1064,16 @@ void EEVEE_lights_free(void)
DRW_SHADER_FREE_SAFE(e_data.shadow_copy_cube_sh[i]);
DRW_SHADER_FREE_SAFE(e_data.shadow_copy_cascade_sh[i]);
}
}
}

/******************Game engine********************/
struct GPUShader *EEVEE_shadow_shader_get()
{
return e_data.shadow_sh;
}

struct GPUShader *EEVEE_shadow_store_shader_get()
{
return e_data.shadow_store_cube_sh[SHADOW_ESM];
}
/**************Enf of Game engine*****************/
@@ -1370,3 +1370,76 @@ void EEVEE_draw_default_passes(EEVEE_PassList *psl)
}
}
}

/*************************************Game engine************************************/
struct DRWShadingGroup *EEVEE_default_shading_group_get_no_pass(bool is_hair, bool is_flat_normal, bool use_blend, bool use_ssr, int shadow_method)
{
static int ssr_id;
ssr_id = (use_ssr) ? 0 : -1;
int options = VAR_MAT_MESH;

if (is_hair) options |= VAR_MAT_HAIR;
if (is_flat_normal) options |= VAR_MAT_FLAT;
if (use_blend) options |= VAR_MAT_BLEND;

options |= eevee_material_shadow_option(shadow_method);

if (e_data.default_lit[options] == NULL) {
create_default_shader(options);
}

return DRW_shgroup_create(e_data.default_lit[options], NULL);
}

void EEVEE_shgroup_add_standard_uniforms_game(DRWShadingGroup *shgrp, EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata,
int *ssr_id, float *refract_depth, bool use_ssrefraction)
{
if (ssr_id == NULL) { // WARNING HERE: For SSR eevee normally needs a valid vedata->stl->g_data->valid_double_buffer
// but it is not valid yet when we add uniforms in BL_BlenderShader -> So we change this
// condition: if (ssr_id == NULL || !vedata->stl->g_data->valid_double_buffer) {
static int no_ssr = -1.0f;
ssr_id = &no_ssr;
}
DRW_shgroup_uniform_block(shgrp, "probe_block", sldata->probe_ubo);
DRW_shgroup_uniform_block(shgrp, "grid_block", sldata->grid_ubo);
DRW_shgroup_uniform_block(shgrp, "planar_block", sldata->planar_ubo);
DRW_shgroup_uniform_block(shgrp, "light_block", sldata->light_ubo);
DRW_shgroup_uniform_block(shgrp, "shadow_block", sldata->shadow_ubo);
DRW_shgroup_uniform_int(shgrp, "light_count", &sldata->lamps->num_light, 1);
DRW_shgroup_uniform_int(shgrp, "probe_count", &sldata->probes->num_render_cube, 1);
DRW_shgroup_uniform_int(shgrp, "grid_count", &sldata->probes->num_render_grid, 1);
DRW_shgroup_uniform_int(shgrp, "planar_count", &sldata->probes->num_planar, 1);
DRW_shgroup_uniform_bool(shgrp, "specToggle", &sldata->probes->specular_toggle, 1);
DRW_shgroup_uniform_bool(shgrp, "ssrToggle", &sldata->probes->ssr_toggle, 1);
DRW_shgroup_uniform_float(shgrp, "lodCubeMax", &sldata->probes->lod_cube_max, 1);
DRW_shgroup_uniform_float(shgrp, "lodPlanarMax", &sldata->probes->lod_planar_max, 1);
DRW_shgroup_uniform_texture(shgrp, "utilTex", e_data.util_tex);
DRW_shgroup_uniform_buffer(shgrp, "probeCubes", &sldata->probe_pool);
DRW_shgroup_uniform_buffer(shgrp, "probePlanars", &vedata->txl->planar_pool);
DRW_shgroup_uniform_buffer(shgrp, "irradianceGrid", &sldata->irradiance_pool);
DRW_shgroup_uniform_buffer(shgrp, "shadowTexture", &sldata->shadow_pool);
DRW_shgroup_uniform_int(shgrp, "outputSsrId", ssr_id, 1);
DRW_shgroup_uniform_vec4(shgrp, "aoParameters[0]", &vedata->stl->effects->ao_dist, 2);
DRW_shgroup_uniform_vec4(shgrp, "viewvecs[0]", (float *)vedata->stl->g_data->viewvecs, 2);
DRW_shgroup_uniform_buffer(shgrp, "maxzBuffer", &vedata->txl->maxzbuffer);
DRW_shgroup_uniform_vec2(shgrp, "mipRatio[0]", (float *)vedata->stl->g_data->mip_ratio, 10);
DRW_shgroup_uniform_vec4(shgrp, "ssrParameters", &vedata->stl->effects->ssr_quality, 1);
if (refract_depth != NULL) {
DRW_shgroup_uniform_float(shgrp, "refractionDepth", refract_depth, 1);
}
if (use_ssrefraction) {
DRW_shgroup_uniform_buffer(shgrp, "colorBuffer", &vedata->txl->refract_color);
DRW_shgroup_uniform_float(shgrp, "borderFadeFactor", &vedata->stl->effects->ssr_border_fac, 1);
DRW_shgroup_uniform_float(shgrp, "maxRoughness", &vedata->stl->effects->ssr_max_roughness, 1);
DRW_shgroup_uniform_int(shgrp, "rayCount", &vedata->stl->effects->ssr_ray_count, 1);
}
if (vedata->stl->effects->use_ao) {
DRW_shgroup_uniform_buffer(shgrp, "horizonBuffer", &vedata->txl->gtao_horizons);
DRW_shgroup_uniform_ivec2(shgrp, "aoHorizonTexSize", (int *)vedata->stl->effects->ao_texsize, 1);
}
else {
/* Use shadow_pool as fallback to avoid sampling problem on certain platform, see: T52593 */
DRW_shgroup_uniform_buffer(shgrp, "horizonBuffer", &sldata->shadow_pool);
}
}
/**********************************End of Game engine************************************/
@@ -26,9 +26,13 @@
#ifndef __EEVEE_PRIVATE_H__
#define __EEVEE_PRIVATE_H__

#include "BLI_listbase.h" // For bge

struct Object;
struct Material;

extern struct DrawEngineType draw_engine_eevee_type;
extern struct DrawEngineType draw_engine_game_type;

/* Minimum UBO is 16384 bytes */
#define MAX_PROBE 128 /* TODO : find size by dividing UBO max size by probe data size */
@@ -219,7 +223,7 @@ typedef struct EEVEE_Light {
} EEVEE_Light;

typedef struct EEVEE_Shadow {
float near, far, bias, exp;
float nearf, farf, bias, exp;
float shadow_start, data_start, multi_shadow_count, pad;
float contact_dist, contact_bias, contact_spread, contact_thickness;
} EEVEE_Shadow;
@@ -650,4 +654,16 @@ static const float cubefacemat[6][4][4] = {
{0.0f, 0.0f, 0.0f, 1.0f}},
};

/****************Game engine********************/
struct GPUShader *EEVEE_shadow_shader_get();
struct GPUShader *EEVEE_shadow_store_shader_get();
void EEVEE_effects_replace_e_data_depth(struct GPUTexture *depth_src);
struct DRWShadingGroup *EEVEE_default_shading_group_get_no_pass(bool is_hair,
bool is_flat_normal, bool use_blend, bool use_ssr, int shadow_method);
void EEVEE_shgroup_add_standard_uniforms_game(struct DRWShadingGroup *shgrp,
EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata,
int *ssr_id, float *refract_depth, bool use_ssrefraction);
EEVEE_Data *EEVEE_engine_data_get(void);
/**************End of Game engine***************/

#endif /* __EEVEE_PRIVATE_H__ */
@@ -445,4 +445,16 @@ typedef struct DRWContextState {

const DRWContextState *DRW_context_state_get(void);

/*****************************GAME ENGINE***********************************/
void *DRW_viewport_engine_data_get(void *engine_type);
void DRW_draw_geometry_prepare(DRWShadingGroup *shgroup, const float(*obmat)[4], const float *texcoloc, const float *texcosize);
void DRW_framebuffer_init_bge(
struct GPUFrameBuffer **fb, void *engine_type, int width, int height,
DRWFboTexture textures[MAX_FBO_TEX], int textures_len);
struct GPUShader *DRW_shgroup_shader_get(DRWShadingGroup *shgroup);
void DRW_bind_shader_shgroup(DRWShadingGroup *shgroup);
void DRW_end_shgroup(void);
void DRW_state_from_pass_set(DRWPass *pass);
/**************************END OF GAME ENGINE*******************************/

#endif /* __DRW_RENDER_H__ */

Large diffs are not rendered by default.

@@ -5694,7 +5694,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
Object *ob = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
Material *ma;
bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene);
bool is_bi = BKE_scene_uses_blender_internal(scene);
Image *ima = NULL;

if (!ob)
@@ -5847,7 +5847,7 @@ static int texture_paint_delete_texture_paint_slot_exec(bContext *C, wmOperator
Object *ob = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
Material *ma;
bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene);
bool is_bi = BKE_scene_uses_blender_internal(scene);
TexPaintSlot *slot;

/* not supported for node-based engines */
@@ -398,7 +398,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
Material *ma = (Material *)id;
ma->nodetree = ntree;

if (BKE_scene_uses_blender_eevee(scene)) {
if (BKE_scene_uses_blender_eevee(scene) || BKE_scene_uses_blender_game(scene)) {
output_type = SH_NODE_OUTPUT_MATERIAL;
shader_type = SH_NODE_BSDF_PRINCIPLED;
}
@@ -82,7 +82,7 @@ endif()

if(WITH_GAMEENGINE)
list(APPEND INC
../../../gameengine/BlenderRoutines
../../../gameengine/Launcher
)
add_definitions(-DWITH_GAMEENGINE)
endif()
@@ -68,14 +68,16 @@

#include "DRW_engine.h"

#include "DEG_depsgraph_build.h" // For bge launch


#ifdef WITH_GAMEENGINE
# include "BLI_listbase.h"
# include "BLI_callbacks.h"

# include "GPU_draw.h"

# include "BL_System.h"
# include "LA_SystemCommandLine.h"
#endif


@@ -1465,8 +1467,8 @@ static int game_engine_poll(bContext *C)
if (CTX_data_mode_enum(C) != CTX_MODE_OBJECT)
return 0;

if (!BKE_scene_uses_blender_game(scene))
return 0;
//if (!BKE_scene_uses_blender_game(scene))
// return 0;

return 1;
}
@@ -1514,6 +1516,10 @@ static int game_engine_exec(bContext *C, wmOperator *op)
/* bad context switch .. */
if (!ED_view3d_context_activate(C))
return OPERATOR_CANCELLED;

for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
DEG_scene_relations_rebuild(bmain, scene);
}

/* redraw to hide any menus/popups, we don't go back to
* the window manager until after this operator exits */
@@ -229,6 +229,11 @@ data_to_c_simple(shaders/gpu_shader_fx_dof_hq_geo.glsl SRC)
data_to_c_simple(shaders/gpu_shader_fx_depth_resolve.glsl SRC)
data_to_c_simple(shaders/gpu_shader_fx_lib.glsl SRC)

data_to_c_simple(shaders/gpu_shader_black_frag.glsl SRC)
data_to_c_simple(shaders/gpu_shader_black_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_frame_buffer_frag.glsl SRC)
data_to_c_simple(shaders/gpu_shader_frame_buffer_vert.glsl SRC)

if(WITH_GAMEENGINE)
add_definitions(-DWITH_GAMEENGINE)
endif()
@@ -79,6 +79,15 @@ void GPU_framebuffer_recursive_downsample(
GPUFrameBuffer *fb, struct GPUTexture *tex, int num_iter,
void (*callback)(void *userData, int level), void *userData);

/********************Game engine*******************/
void GPU_framebuffer_bind_all_attachments(GPUFrameBuffer *fb);
int GPU_framebuffer_color_bindcode(const GPUFrameBuffer *fb);
struct GPUTexture *GPU_framebuffer_color_texture(const GPUFrameBuffer *fb);
struct GPUTexture *GPU_framebuffer_depth_texture(const GPUFrameBuffer *fb);
void GPU_framebuffer_mipmap_texture(GPUFrameBuffer *fb);
void GPU_framebuffer_unmipmap_texture(GPUFrameBuffer *fb);
/****************End of Game engine****************/

/* GPU OffScreen
* - wrapper around framebuffer and texture for simple offscreen drawing
* - changes size if graphics card can't support it */
@@ -90,6 +90,16 @@ void GPU_shader_geometry_stage_primitive_io(GPUShader *shader, int input, int ou

int GPU_shader_get_attribute(GPUShader *shader, const char *name);

/******************************************Game engine*****************************************/
char *GPU_shader_validate(GPUShader *shader);
void GPU_shader_uniform_float(GPUShader *UNUSED(shader), int location, float value);
void GPU_shader_bind_attributes(GPUShader *shader, int *locations, const char **names, int len);
void GPU_shader_bind_instancing_attrib(GPUShader *shader, void *matrixoffset, void *positionoffset, unsigned int stride);
void GPU_shader_unbind_instancing_attrib(GPUShader *shader);
// GPU_shader_get_uniform doesn't handle array uniforms e.g: uniform vec2 bgl_TextureCoordinateOffset[9];
int GPU_shader_get_uniform_location_old(GPUShader *shader, const char *name);
/****************************************End of Game engine************************************/

/* Builtin/Non-generated shaders */
typedef enum GPUBuiltinShader {
GPU_SHADER_VSM_STORE,
@@ -170,6 +180,15 @@ typedef enum GPUBuiltinShader {
GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE,
GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR,

/**********Game engine***********/
GPU_SHADER_DRAW_FRAME_BUFFER,
GPU_SHADER_VSM_STORE_INSTANCING,
GPU_SHADER_BLACK,
GPU_SHADER_BLACK_INSTANCING,
GPU_SHADER_STEREO_STIPPLE,
GPU_SHADER_STEREO_ANAGLYPH,
/*******End of Game engine*******/

GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_SOLID,
GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_WIRE,

@@ -198,6 +198,10 @@ bool GPU_texture_depth(const GPUTexture *tex);
bool GPU_texture_stencil(const GPUTexture *tex);
int GPU_texture_opengl_bindcode(const GPUTexture *tex);

/******************Game engine************************/
void GPU_texture_set_opengl_bindcode(GPUTexture *tex, int bindcode);
/**************End of Game engine*********************/

#ifdef __cplusplus
}
#endif
@@ -619,6 +619,55 @@ void GPU_framebuffer_recursive_downsample(
GPU_texture_unbind(tex);
}

/**************Game engine****************/
void GPU_framebuffer_bind_all_attachments(GPUFrameBuffer *fb)
{
int slots = 0, i;
GLenum attachments[GPU_FB_MAX_SLOTS];

for (i = 0; i < GPU_FB_MAX_SLOTS; i++) {
if (fb->colortex[i]) {
attachments[slots] = GL_COLOR_ATTACHMENT0_EXT + i;
slots++;
}
}

glBindFramebuffer(GL_FRAMEBUFFER, fb->object);
glDrawBuffers(slots, attachments);
glReadBuffer(GL_COLOR_ATTACHMENT0);

GG.currentfb = fb->object;
}

int GPU_framebuffer_color_bindcode(const GPUFrameBuffer *fb)
{
return GPU_texture_opengl_bindcode(fb->colortex[0]);
}

GPUTexture *GPU_framebuffer_color_texture(const GPUFrameBuffer *fb)
{
return fb->colortex[0];
}

GPUTexture *GPU_framebuffer_depth_texture(const GPUFrameBuffer *fb)
{
return fb->depthtex;
}

void GPU_framebuffer_mipmap_texture(GPUFrameBuffer *fb)
{
GPUTexture *tex = GPU_framebuffer_color_texture(fb);
GPU_texture_mipmap_mode(tex, true, false);
GPU_texture_generate_mipmap(tex);
}

void GPU_framebuffer_unmipmap_texture(GPUFrameBuffer *fb)
{
GPUTexture *tex = GPU_framebuffer_color_texture(fb);
GPU_texture_mipmap_mode(tex, false, false);
}
/************End of Game engine***********/

/* GPUOffScreen */

struct GPUOffScreen {
@@ -153,6 +153,13 @@ extern char datatoc_gpu_shader_fx_dof_hq_geo_glsl[];
extern char datatoc_gpu_shader_fx_depth_resolve_glsl[];
extern char datatoc_gpu_shader_fx_lib_glsl[];

/********************Game engine*********************/
extern char datatoc_gpu_shader_black_frag_glsl[];
extern char datatoc_gpu_shader_black_vert_glsl[];
extern char datatoc_gpu_shader_frame_buffer_frag_glsl[];
extern char datatoc_gpu_shader_frame_buffer_vert_glsl[];
/*****************End of Game engine*****************/

/* cache of built-in shaders (each is created on first use) */
static GPUShader *builtin_shaders[GPU_NUM_BUILTIN_SHADERS] = { NULL };

@@ -674,6 +681,101 @@ int GPU_shader_get_attribute(GPUShader *shader, const char *name)
return attrib ? attrib->location : -1;
}

/**********************************Game engine************************************/
char *GPU_shader_validate(GPUShader *shader)
{
int stat = 0;
glValidateProgram(shader->program);
glGetObjectParameterivARB(shader->program, GL_OBJECT_VALIDATE_STATUS_ARB, (GLint *)&stat);

if (stat > 0) {
int charlen = 0;
char *log = (char *)MEM_mallocN(stat, "GPU_shader_validate");

glGetInfoLogARB(shader->program, stat, (GLsizei *)&charlen, log);

return log;
}
return NULL;
}

void GPU_shader_uniform_float(GPUShader *UNUSED(shader), int location, float value)
{
if (location == -1)
return;

glUniform1f(location, value);
}

void GPU_shader_bind_attributes(GPUShader *shader, int *locations, const char **names, int len)
{
GWN_shaderinterface_discard(shader->interface);
for (unsigned short i = 0; i < len; ++i) {
glBindAttribLocation(shader->program, locations[i], names[i]);
}
shader->interface = GWN_shaderinterface_create(shader->program);
}

// Used only for VSM shader with geometry instancing support.
void GPU_shader_bind_instancing_attrib(GPUShader *shader, void *matrixoffset, void *positionoffset, unsigned int stride)
{
//int posloc = GPU_shader_get_attribute(shader, GPU_builtin_name(GPU_INSTANCING_POSITION_ATTRIB));
//int matloc = GPU_shader_get_attribute(shader, GPU_builtin_name(GPU_INSTANCING_MATRIX_ATTRIB));

//// Matrix
//if (matloc != -1) {
// glEnableVertexAttribArrayARB(matloc);
// glEnableVertexAttribArrayARB(matloc + 1);
// glEnableVertexAttribArrayARB(matloc + 2);

// glVertexAttribPointerARB(matloc, 3, GL_FLOAT, GL_FALSE, stride, matrixoffset);
// glVertexAttribPointerARB(matloc + 1, 3, GL_FLOAT, GL_FALSE, stride, ((char *)matrixoffset) + 3 * sizeof(float));
// glVertexAttribPointerARB(matloc + 2, 3, GL_FLOAT, GL_FALSE, stride, ((char *)matrixoffset) + 6 * sizeof(float));

// glVertexAttribDivisorARB(matloc, 1);
// glVertexAttribDivisorARB(matloc + 1, 1);
// glVertexAttribDivisorARB(matloc + 2, 1);
//}

//// Position
//if (posloc != -1) {
// glEnableVertexAttribArrayARB(posloc);
// glVertexAttribPointerARB(posloc, 3, GL_FLOAT, GL_FALSE, stride, positionoffset);
// glVertexAttribDivisorARB(posloc, 1);
//}
}

void GPU_shader_unbind_instancing_attrib(GPUShader *shader)
{
//int posloc = GPU_shader_get_attribute(shader, GPU_builtin_name(GPU_INSTANCING_POSITION_ATTRIB));
//int matloc = GPU_shader_get_attribute(shader, GPU_builtin_name(GPU_INSTANCING_MATRIX_ATTRIB));

//// Matrix
//if (matloc != -1) {
// glDisableVertexAttribArrayARB(matloc);
// glDisableVertexAttribArrayARB(matloc + 1);
// glDisableVertexAttribArrayARB(matloc + 2);

// glVertexAttribDivisorARB(matloc, 0);
// glVertexAttribDivisorARB(matloc + 1, 0);
// glVertexAttribDivisorARB(matloc + 2, 0);
//}

//// Position
//if (posloc != -1) {
// glDisableVertexAttribArrayARB(posloc);
// glVertexAttribDivisorARB(posloc, 0);
//}
}

int GPU_shader_get_uniform_location_old(GPUShader *shader, const char *name)
{
BLI_assert(shader && shader->program);
int loc = glGetUniformLocation(shader->program, name);
return loc;
}
/******************End of Game engine*************/

GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
{
BLI_assert(shader != GPU_NUM_BUILTIN_SHADERS); /* don't be a troll */
@@ -819,6 +921,15 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
datatoc_gpu_shader_simple_lighting_frag_glsl },
[GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_WIRE] = { datatoc_gpu_shader_instance_bone_envelope_wire_vert_glsl,
datatoc_gpu_shader_flat_color_frag_glsl },

/****************************************************Game Engine********************************************************/
[GPU_SHADER_DRAW_FRAME_BUFFER] = { datatoc_gpu_shader_frame_buffer_vert_glsl, datatoc_gpu_shader_frame_buffer_frag_glsl },
[GPU_SHADER_VSM_STORE_INSTANCING] = { datatoc_gpu_shader_vsm_store_vert_glsl, datatoc_gpu_shader_vsm_store_frag_glsl },
[GPU_SHADER_BLACK] = { datatoc_gpu_shader_black_vert_glsl, datatoc_gpu_shader_black_frag_glsl },
[GPU_SHADER_BLACK_INSTANCING] = { datatoc_gpu_shader_black_vert_glsl, datatoc_gpu_shader_black_frag_glsl },
[GPU_SHADER_STEREO_STIPPLE] = { datatoc_gpu_shader_frame_buffer_vert_glsl, datatoc_gpu_shader_frame_buffer_frag_glsl },
[GPU_SHADER_STEREO_ANAGLYPH] = { datatoc_gpu_shader_frame_buffer_vert_glsl, datatoc_gpu_shader_frame_buffer_frag_glsl },
/*************************************************End of Game engine****************************************************/
};

if (builtin_shaders[shader] == NULL) {
@@ -1017,3 +1017,10 @@ void GPU_texture_framebuffer_set(GPUTexture *tex, GPUFrameBuffer *fb, int attach
tex->fb_attachment = attachment;
}

/***********************Game engine**************************/
void GPU_texture_set_opengl_bindcode(GPUTexture *tex, int bindcode)
{
tex->bindcode = bindcode;
}
/********************End of Game engine**********************/

@@ -0,0 +1,6 @@
out vec4 fragColor;

void main()
{
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
@@ -0,0 +1,8 @@
uniform mat4 ModelViewProjectionMatrix;

in vec3 pos;

void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
}
@@ -0,0 +1,51 @@
in vec4 texcovar;
out vec4 fragColor;

#if defined(ANAGLYPH) || defined(STIPPLE)
uniform sampler2D lefteyetex;
uniform sampler2D righteyetex;
#else
uniform sampler2D colortex;
# ifdef DEPTH
uniform sampler2D depthtex;
# endif
#endif

#ifdef STIPPLE
#define STIPPLE_COLUMN 0
#define STIPPLE_ROW 1

uniform int stippleid;
#endif

void main()
{
vec2 co = texcovar.xy;
#ifdef STIPPLE
if (stippleid == STIPPLE_ROW) {
int result = int(mod(gl_FragCoord.y, 2));
if (result != 0) {
fragColor = texture2D(lefteyetex, co);
}
else {
fragColor = texture2D(righteyetex, co);
}
}
else if (stippleid == STIPPLE_COLUMN) {
int result = int(mod(gl_FragCoord.x, 2));
if (result == 0) {
fragColor = texture2D(lefteyetex, co);
}
else {
fragColor = texture2D(righteyetex, co);
}
}
#elif defined(ANAGLYPH)
fragColor = vec4(texture2D(lefteyetex, co).r, texture2D(righteyetex, co).gb, 1.0);
#else
fragColor = texture2D(colortex, co);
# ifdef DEPTH
gl_FragDepth = texture2D(depthtex, co).x;
# endif
#endif
}
@@ -0,0 +1,10 @@
in vec4 bgl_InPosition;
in vec2 bgl_InTexCoord;

out vec4 texcovar;

void main()
{
gl_Position = bgl_InPosition;
texcovar = vec4(bgl_InTexCoord, 0.0, 0.0);
}
@@ -76,7 +76,7 @@ static int gpu_shader_output(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSE
GPU_material_enable_alpha(mat);
#endif

if (BKE_scene_uses_blender_eevee(GPU_material_scene(mat))) {
if (BKE_scene_uses_blender_eevee(GPU_material_scene(mat)) || BKE_scene_uses_blender_game(GPU_material_scene(mat))) {
return false;
}

@@ -28,6 +28,7 @@

void BPy_init_modules(void);
extern PyObject *bpy_package_py;
PyObject *bpy_sys_module_backup; // For bge (KX_PythonInit Line 1829)

/* bpy_interface_atexit.c */
void BPY_atexit_register(void);
@@ -142,8 +142,8 @@ typedef struct RenderEngine {
int last_winx, last_winy;
} RenderEngine;

RenderEngine *RE_engine_create(RenderEngineType *type);
RenderEngine *RE_engine_create_ex(RenderEngineType *type, bool use_for_viewport);
RenderEngine *RE_engine_create(struct RenderEngineType *type);
RenderEngine *RE_engine_create_ex(struct RenderEngineType *type, bool use_for_viewport);
void RE_engine_free(RenderEngine *engine);

void RE_layer_load_from_file(struct RenderLayer *layer, struct ReportList *reports, const char *filename, int x, int y);
@@ -78,25 +78,12 @@ static RenderEngineType internal_render_type = {
{NULL, NULL, NULL}
};

#ifdef WITH_GAMEENGINE

static RenderEngineType internal_game_type = {
NULL, NULL,
"BLENDER_GAME", N_("Blender Game"), RE_INTERNAL | RE_GAME | RE_USE_LEGACY_PIPELINE,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
{NULL, NULL, NULL}
};

#endif

ListBase R_engines = {NULL, NULL};

void RE_engines_init(void)
{
RE_engines_register(NULL, &internal_render_type);
#ifdef WITH_GAMEENGINE
RE_engines_register(NULL, &internal_game_type);
#endif

DRW_engines_register();
}

@@ -41,7 +41,7 @@ set(INC
../makesrna
../nodes
../render/extern/include
../../gameengine/BlenderRoutines
../../gameengine/Launcher
../../../intern/ghost
../../../intern/guardedalloc
../../../intern/glew-mx
@@ -84,7 +84,7 @@
#endif

#ifdef WITH_GAMEENGINE
# include "BL_System.h"
# include "LA_SystemCommandLine.h"
#endif
#include "GHOST_Path-api.h"
#include "GHOST_C-api.h"
@@ -82,8 +82,7 @@ add_dependencies(blenderplayer makesdna)
get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)

list(APPEND BLENDER_LINK_LIBS
ge_player_common
ge_player_ghost
ge_player
blenkernel_blc
)

@@ -100,12 +99,33 @@ endif()
# if(UNIX)
# Sort libraries
set(BLENDER_SORTED_LIBS
ge_player_ghost
ge_player_common
bf_intern_string
bf_intern_ghost
ge_player
ge_launcher
ge_player
ge_logic_ketsji
ge_converter
ge_logic_ketsji
ge_phys_bullet
ge_phys_dummy
ge_logic
ge_device
ge_rasterizer
ge_oglrasterizer
ge_logic_expressions
ge_common
ge_scenegraph
ge_logic_network
ge_videotex

bf_editor_datafiles

bf_rna
bf_blenloader
bf_modifiers
bf_draw
bf_gpu
bf_blenkernel
bf_physics
bf_depsgraph
bf_physics
bf_intern_rigidbody
@@ -131,19 +151,13 @@ endif()
bf_gpu
bf_intern_gawain
bf_imbuf
bf_avi
ge_logic_network
ge_logic_ngnetwork
ge_logic_loopbacknetwork
extern_bullet
bf_intern_guardedalloc
bf_intern_memutil
bf_avi
bf_python_ext
bf_python_mathutils
bf_python_bmesh
bf_intern_utfconv
bf_imbuf_cineon
bf_imbuf_openexr
bf_imbuf_openexr
bf_imbuf_openimageio
extern_openjpeg
bf_imbuf_dds
@@ -157,6 +171,17 @@ endif()
blenkernel_blc
bf_bmesh
bf_blenlib
blenkernel_blc

bf_intern_string
bf_intern_ghost
bf_intern_rigidbody
bf_intern_itasc
bf_intern_iksolver
bf_intern_smoke
bf_intern_moto
bf_intern_guardedalloc
bf_intern_memutil
bf_intern_utfconv
extern_binreloc
extern_minilzo
@@ -166,7 +191,15 @@ endif()
extern_recastnavigation
bf_intern_opencolorio
bf_intern_glew_mx
bf_intern_gawain
bf_intern_eigen
bf_intern_libmv

extern_bullet
extern_openjpeg
extern_binreloc
extern_minilzo
extern_recastnavigation
extern_rangetree
extern_wcwidth
bf_intern_libmv
@@ -217,6 +250,10 @@ endif()
list(APPEND BLENDER_SORTED_LIBS bf_intern_decklink)
endif()

if(WITH_GAMEENGINE_BPPLAYER)
list(APPEND BLENDER_SORTED_LIBS bf_intern_spindle)
endif()

if(WIN32)
list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
endif()
@@ -151,8 +151,10 @@ struct wmManipulatorMap;
#include "../../intern/elbeem/extern/elbeem.h"
#include "../blender/blenkernel/BKE_modifier.h"
#include "../blender/blenkernel/BKE_paint.h"
#include "../blender/blenkernel/BKE_paint.h"
#include "../blender/collada/collada.h"
#include "../blender/compositor/COM_compositor.h"
#include "../blender/editors/include/BIF_glutil.h"
#include "../blender/editors/include/ED_armature.h"
#include "../blender/editors/include/ED_anim_api.h"
#include "../blender/editors/include/ED_buttons.h"
@@ -335,6 +337,7 @@ struct bScreen *WM_window_get_active_screen(const struct wmWindow *win) RET_NULL
struct Scene *WM_window_get_active_scene(const struct wmWindow *win) RET_NULL
void WM_window_change_active_scene(struct Main *bmain, struct bContext *C, struct wmWindow *win, struct Scene *scene_new) RET_NONE
bool WM_window_is_temp_screen(const struct wmWindow *win) RET_ZERO
void wmOrtho2_region_pixelspace(const struct ARegion *ar) RET_NONE

void WM_autosave_init(wmWindowManager *wm) RET_NONE
void WM_jobs_kill_all_except(struct wmWindowManager *wm, void *owner) RET_NONE
@@ -399,6 +402,7 @@ const struct ListBase *WM_manipulatormap_group_list(struct wmManipulatorMap *mma
void WM_manipulator_calc_matrix_final(const struct wmManipulator *mpr, float r_mat[4][4]) RET_NONE
struct wmManipulatorProperty *WM_manipulator_target_property_find(struct wmManipulator *mpr, const char *idname) RET_NULL
bool WM_manipulator_target_property_is_valid(const struct wmManipulatorProperty *mpr_prop) RET_ZERO
void WM_manipulatormap_draw(struct wmManipulatorMap *mmap, const struct bContext *C, const eWM_ManipulatorMapDrawStep drawstep) RET_NONE

#ifdef WITH_INPUT_NDOF
void WM_ndof_deadzone_set(float deadzone) RET_NONE
@@ -432,7 +436,10 @@ void ED_object_facemap_face_remove(struct Object *ob, struct bFaceMap *fmap, int
void ED_node_composit_default(const struct bContext *C, struct Scene *scene) RET_NONE
void *ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *custumdata, int type) RET_ZERO /* XXX this one looks weird */
void *ED_region_draw_cb_customdata(void *handle) RET_ZERO /* XXX This one looks wrong also */
void ED_region_draw_cb_draw(const struct bContext *C, ARegion *ar, int type) RET_NONE
void ED_region_draw_cb_exit(struct ARegionType *art, void *handle) RET_NONE
void ED_region_visible_rect(ARegion *ar, rcti *rect) RET_NONE
void ED_region_pixelspace(struct ARegion *ar) RET_NONE
void ED_area_headerprint(struct ScrArea *sa, const char *str) RET_NONE
void ED_gpencil_parent_location(struct bGPDlayer *gpl, float diff_mat[4][4]) RET_NONE
void UI_view2d_region_to_view(struct View2D *v2d, float x, float y, float *viewx, float *viewy) RET_NONE
@@ -540,15 +547,23 @@ void ED_node_tree_pop(struct SpaceNode *snode) RET_NONE
int ED_view3d_scene_layer_set(int lay, const int *values, int *active) RET_ZERO
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip) RET_NONE
void ED_view3d_from_m4(float mat[4][4], float ofs[3], float quat[4], float *dist) RET_NONE
eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *ar, float perspmat[4][4], const bool is_local,
const float co[3], short r_co[2], const eV3DProjTest flag) RET_ZERO
struct BGpic *ED_view3D_background_image_new(struct View3D *v3d) RET_NULL
void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic) RET_NONE
void ED_view3D_background_image_clear(struct View3D *v3d) RET_NONE
void ED_view3d_update_viewmat(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[4][4], float winmat[4][4], const struct rcti *rect) RET_NONE
float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit) RET_ZERO
void ED_view3d_shade_update(struct Main *bmain, struct Scene *scene, struct View3D *v3d, struct ScrArea *sa) RET_NONE
void ED_view3d_clipping_disable(void) RET_NONE
void ED_view3d_clipping_enable(void) RET_NONE
void ED_region_info_draw_multiline(struct ARegion *ar, const char *text_array[], float fill_color[4], const bool full_redraw) RET_NONE
void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar, const int offset);
void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar, const int offset) RET_NONE
void ED_node_shader_default(const struct bContext *C, struct ID *id) RET_NONE
void ED_screen_animation_timer_update(struct bScreen *screen, int redraws, int refresh) RET_NONE
struct bScreen *ED_screen_animation_playing(const struct wmWindowManager *wm) RET_NULL
struct bScreen *ED_screen_animation_no_scrub(const struct wmWindowManager *wm) RET_NULL
struct Scene *ED_screen_scene_find(const struct bScreen *screen, const struct wmWindowManager *wm) RET_NULL
bool ED_scene_render_layer_delete(struct Main *bmain, Scene *scene, SceneLayer *layer, ReportList *reports) RET_ZERO
void ED_base_object_select(struct BaseLegacy *base, short mode) RET_NONE
@@ -630,7 +645,6 @@ void ED_lattice_editlatt_load(struct Object *obedit) RET_NONE
void ED_curve_editnurb_load(struct Object *obedit) RET_NONE
void ED_curve_editnurb_make(struct Object *obedit) RET_NONE


void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon) RET_NONE

struct PointerRNA uiItemFullO(uiLayout *layout, const char *idname, const char *name, int icon, struct IDProperty *properties, int context, int flag) RET_STRUCT(PointerRNA)
@@ -662,6 +676,10 @@ void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct Pointe
const char *uiLayoutIntrospect(uiLayout *layout) RET_NULL
void UI_reinit_font(void) RET_NONE
int UI_rnaptr_icon_get(struct bContext *C, struct PointerRNA *ptr, int rnaicon, const bool big) RET_ZERO
struct PreviewImage *UI_icon_to_preview(int icon_id) RET_NULL
void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis) RET_NONE
uiStyle *UI_style_get(void) RET_NULL
void UI_FontThemeColor(int fontid, int colorid) RET_NONE
struct bTheme *UI_GetTheme(void) RET_NULL
void UI_GetThemeColor3fv(int colorid, float col[4]) RET_NONE
void UI_GetThemeColor4fv(int colorid, float col[4]) RET_NONE
@@ -671,7 +689,16 @@ void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int of
void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4]) RET_NONE
void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]) RET_NONE
void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4]) RET_NONE

float UI_GetThemeValuef(int colorid) RET_ZERO
int UI_GetThemeValue(int colorid) RET_ZERO
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]) RET_NONE
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]) RET_NONE
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]) RET_NONE
void UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset) RET_NONE
void UI_ThemeClearColorAlpha(int colorid, float alpha) RET_NONE

void setlinestyle(int nr) RET_NONE
void set_inverted_drawing(int enable) RET_NONE
/* rna template */
void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *proptypename, const char *text) RET_NONE
void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *root_ptr, const char *text) RET_NONE
@@ -704,7 +731,7 @@ void uiTemplateRunningJobs(struct uiLayout *layout, struct bContext *C) RET_NONE
void uiTemplateOperatorSearch(struct uiLayout *layout) RET_NONE
void uiTemplateHeader3D(struct uiLayout *layout, struct bContext *C) RET_NONE
void uiTemplateEditModeSelection(struct uiLayout *layout, struct bContext *C) RET_NONE
void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact, int multiview) RET_NONE
void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact, int multiview, int cubemap) RET_NONE
void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic) RET_NONE
void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname) RET_NONE
void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C) RET_NONE
@@ -731,6 +758,7 @@ void uiTemplateCacheFile(uiLayout *layout, struct bContext *C, struct PointerRNA

/* rna render */
struct RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h, const char *layername, const char *viewname) RET_NULL
RenderEngine *RE_engine_create_ex(RenderEngineType *type, bool use_for_viewport) RET_NULL
struct RenderResult *RE_AcquireResultRead(struct Render *re) RET_NULL
struct RenderResult *RE_AcquireResultWrite(struct Render *re) RET_NULL
struct RenderStats *RE_GetStats(struct Render *re) RET_NULL
@@ -768,13 +796,6 @@ float RE_fresnel_dielectric(float incoming[3], float normal[3], float eta) RET_Z
void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl, const char *name, int channels, const char *chanid, int type) RET_NONE
struct SceneLayer *RE_engine_get_scene_layer(struct Render *re) RET_NULL

/* Draw */
void OBJECT_collection_settings_create(struct IDProperty *properties) RET_NONE
void EDIT_MESH_collection_settings_create(struct IDProperty *properties) RET_NONE
void EDIT_ARMATURE_collection_settings_create(struct IDProperty *properties) RET_NONE
void PAINT_WEIGHT_collection_settings_create(struct IDProperty *properties) RET_NONE
void PAINT_VERTEX_collection_settings_create(struct IDProperty *properties) RET_NONE

/* python */
struct wmOperatorType *WM_operatortype_find(const char *idname, bool quiet) RET_NULL
void WM_operatortype_iter(struct GHashIterator *ghi) RET_NONE
@@ -76,7 +76,7 @@ if(WITH_HEADLESS)
endif()

if(WITH_GAMEENGINE)
blender_include_dirs(../gameengine/BlenderRoutines)
blender_include_dirs(../gameengine/Launcher)

add_definitions(-DWITH_GAMEENGINE)
endif()
@@ -84,7 +84,7 @@

/* for passing information between creator and gameengine */
#ifdef WITH_GAMEENGINE
# include "BL_System.h"
# include "LA_SystemCommandLine.h"
#else /* dummy */
# define SYS_SystemHandle int
#endif
@@ -74,7 +74,7 @@

/* for passing information between creator and gameengine */
#ifdef WITH_GAMEENGINE
# include "BL_System.h"
# include "LA_SystemCommandLine.h"
#else /* dummy */
# define SYS_SystemHandle int
#endif
@@ -66,7 +66,7 @@

/* for passing information between creator and gameengine */
#ifdef WITH_GAMEENGINE
# include "BL_System.h"
# include "LA_SystemCommandLine.h"
#else /* dummy */
# define SYS_SystemHandle int
#endif
@@ -82,7 +82,6 @@
#include "KX_EmptyObject.h"
#include "KX_FontObject.h"
#include "KX_LodManager.h"
#include "KX_PythonComponent.h"

#include "RAS_ICanvas.h"
#include "RAS_Polygon.h"
@@ -91,13 +90,11 @@
#include "RAS_BoundingBoxManager.h"
#include "RAS_IPolygonMaterial.h"
#include "KX_BlenderMaterial.h"
#include "KX_TextureRendererManager.h"
#include "BL_Texture.h"

#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_python_component.h"
#include "BL_ModifierDeformer.h"
#include "BL_ShapeDeformer.h"
#include "BL_SkinDeformer.h"
@@ -147,7 +144,6 @@
#include "DNA_action_types.h"
#include "DNA_object_force.h"
#include "DNA_constraint_types.h"
#include "DNA_python_component_types.h"
#include "DNA_layer_types.h"

#include "MEM_guardedalloc.h"
@@ -775,14 +771,6 @@ static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blendero
shapeProps->m_fall_speed = blenderobject->fall_speed;
shapeProps->m_max_jumps = blenderobject->max_jumps;

shapeProps->m_restitution = blenderobject->reflect;
shapeProps->m_friction = blenderobject->friction;
shapeProps->m_rollingFriction = blenderobject->rolling_friction;
shapeProps->m_fh_spring = blenderobject->fh;
shapeProps->m_fh_damping = blenderobject->xyfrict;
shapeProps->m_fh_distance = blenderobject->fhdist;
shapeProps->m_fh_normal = (blenderobject->dynamode & OB_FH_NOR) != 0;

return shapeProps;
}

@@ -932,7 +920,6 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l
lightobj->m_layer = layerflag;
lightobj->m_spotblend = la->spotblend;
lightobj->m_spotsize = la->spotsize;
lightobj->m_staticShadow = la->mode & LA_STATIC_SHADOW;
// Set to true to make at least one shadow render in static mode.
lightobj->m_requestShadowUpdate = true;

@@ -974,18 +961,7 @@ static KX_Camera *gamecamera_from_bcamera(Object *ob, KX_Scene *kxscene)
gamecamera= new KX_Camera(kxscene, KX_Scene::m_callbacks, camdata);
gamecamera->SetName(ca->id.name + 2);

gamecamera->SetShowCameraFrustum(ca->gameflag & GAME_CAM_SHOW_FRUSTUM);
gamecamera->SetLodDistanceFactor(ca->lodfactor);

if (ca->gameflag & GAME_CAM_OVERRIDE_CULLING) {
if (kxscene->GetOverrideCullingCamera()) {
CM_Warning("\"" << gamecamera->GetName() << "\" sets for culling override whereas \""
<< kxscene->GetOverrideCullingCamera()->GetName() << "\" is already used for culling override.");
}
else {
kxscene->SetOverrideCullingCamera(gamecamera);
}
}
kxscene->SetOverrideCullingCamera(gamecamera);

return gamecamera;
}
@@ -1222,86 +1198,6 @@ static void blenderSceneSetBackground(Scene *blenderscene)
}
}

static void BL_ConvertComponentsObject(KX_GameObject *gameobj, Object *blenderobj)
{
#ifdef WITH_PYTHON
PythonComponent *pc = (PythonComponent *)blenderobj->components.first;
PyObject *arg_dict = nullptr, *args = nullptr, *mod = nullptr, *cls = nullptr, *pycomp = nullptr, *ret = nullptr;

if (!pc) {
return;
}

CListValue<KX_PythonComponent> *components = new CListValue<KX_PythonComponent>();

while (pc) {
// Make sure to clean out anything from previous loops
Py_XDECREF(args);
Py_XDECREF(arg_dict);
Py_XDECREF(mod);
Py_XDECREF(cls);
Py_XDECREF(ret);
Py_XDECREF(pycomp);
args = arg_dict = mod = cls = pycomp = ret = nullptr;

// Grab the module
mod = PyImport_ImportModule(pc->module);

if (mod == nullptr) {
if (PyErr_Occurred()) {
PyErr_Print();
}
CM_Error("coulding import the module '" << pc->module << "'");
pc = pc->next;
continue;
}

// Grab the class object
cls = PyObject_GetAttrString(mod, pc->name);
if (cls == nullptr) {
if (PyErr_Occurred()) {
PyErr_Print();
}
CM_Error("python module found, but failed to find the component '" << pc->name << "'");
pc = pc->next;
continue;
}

// Lastly make sure we have a class and it's an appropriate sub type
if (!PyType_Check(cls) || !PyObject_IsSubclass(cls, (PyObject*)&KX_PythonComponent::Type)) {
CM_Error(pc->module << "." << pc->name << " is not a KX_PythonComponent subclass");
pc = pc->next;
continue;
}

// Every thing checks out, now generate the args dictionary and init the component
args = PyTuple_Pack(1, gameobj->GetProxy());

pycomp = PyObject_Call(cls, args, nullptr);

if (PyErr_Occurred()) {
// The component is invalid, drop it
PyErr_Print();
}
else {
KX_PythonComponent *comp = static_cast<KX_PythonComponent *>(BGE_PROXY_REF(pycomp));
comp->SetBlenderPythonComponent(pc);
comp->SetGameObject(gameobj);
components->Add(comp);
}

pc = pc->next;
}

Py_XDECREF(args);
Py_XDECREF(mod);
Py_XDECREF(cls);
Py_XDECREF(pycomp);

gameobj->SetComponents(components);
#endif // WITH_PYTHON
}

/* helper for BL_ConvertBlenderObjects, avoids code duplication
* note: all var names match args are passed from the caller */
static void bl_ConvertBlenderObject_Single(
@@ -1828,70 +1724,14 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
BL_CreatePhysicsObjectNew(gameobj,blenderobject,meshobj,kxscene,layerMask,converter,processCompoundChildren);
}

// Look at every material texture and ask to create realtime cube map.
/*for (KX_GameObject *gameobj : sumolist) {
for (unsigned short i = 0, meshcount = gameobj->GetMeshCount(); i < meshcount; ++i) {
RAS_MeshObject *mesh = gameobj->GetMesh(i);

for (unsigned short j = 0, matcount = mesh->NumMaterials(); j < matcount; ++j) {
RAS_MeshMaterial *meshmat = mesh->GetMeshMaterial(j);
RAS_IPolyMaterial *polymat = meshmat->GetBucket()->GetPolyMaterial();

for (unsigned short k = 0; k < RAS_Texture::MaxUnits; ++k) {
RAS_Texture *tex = polymat->GetTexture(k);
if (!tex || !tex->Ok()) {
continue;
}

EnvMap *env = tex->GetTex()->env;
if (!env || env->stype != ENV_REALT) {
continue;
}

KX_GameObject *viewpoint = gameobj;
if (env->object) {
KX_GameObject *obj = converter.FindGameObject(env->object);
if (obj) {
viewpoint = obj;
}
}

KX_TextureRendererManager::RendererType type = tex->IsCubeMap() ? KX_TextureRendererManager::CUBE : KX_TextureRendererManager::PLANAR;
kxscene->GetTextureRendererManager()->AddRenderer(type, tex, viewpoint);
}
}
}
}*/

// Create and set bounding volume.
for (KX_GameObject *gameobj : sumolist) {
Object *blenderobject = gameobj->GetBlenderObject();
Mesh *predifinedBoundMesh = blenderobject->gamePredefinedBound;

if (predifinedBoundMesh) {
RAS_MeshObject *meshobj = converter.FindGameMesh(predifinedBoundMesh);
// In case of mesh taken in a other scene.
if (!meshobj) {
continue;
}

gameobj->SetAutoUpdateBounds(false);
// The object allow AABB auto update only if there's no predefined bound.
gameobj->SetAutoUpdateBounds(true);

// AABB Box : min/max.
MT_Vector3 aabbMin;
MT_Vector3 aabbMax;
// Get the mesh bounding box for none deformer.
RAS_BoundingBox *boundingBox = meshobj->GetBoundingBox();
// Get the AABB.
boundingBox->GetAabb(aabbMin, aabbMax);
gameobj->SetBoundsAabb(aabbMin, aabbMax);
}
else {
// The object allow AABB auto update only if there's no predefined bound.
gameobj->SetAutoUpdateBounds(true);

gameobj->UpdateBounds(true);
}
gameobj->UpdateBounds(true);
}

// create physics joints
@@ -2000,12 +1840,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
gameobj->ResetState();
}

// Convert the python components of each object.
for (KX_GameObject *gameobj : sumolist) {
Object *blenderobj = gameobj->GetBlenderObject();
BL_ConvertComponentsObject(gameobj, blenderobj);
}

// cleanup converted set of group objects
convertedlist->Release();
sumolist->Release();
@@ -863,35 +863,7 @@ void BL_ConvertActuators(const char* maggiename,
baseact = tmprandomact;
}
break;
case ACT_VIBRATION:
{
bVibrationActuator *vib_act = (bVibrationActuator *)bact->data;
SCA_VibrationActuator * tmp_vib_act = nullptr;
short mode = SCA_VibrationActuator::KX_ACT_VIBRATION_NONE;

switch (vib_act->mode) {
case ACT_VIBRATION_PLAY:
{
mode = SCA_VibrationActuator::KX_ACT_VIBRATION_PLAY;
break;
}
case ACT_VIBRATION_STOP:
{
mode = SCA_VibrationActuator::KX_ACT_VIBRATION_STOP;
break;
}
}

int joyindex = vib_act->joyindex;
float strengthLeft = vib_act->strength;
float strengthRight = vib_act->strength_right;
int duration = vib_act->duration;

tmp_vib_act = new SCA_VibrationActuator(gameobj, mode, joyindex, strengthLeft, strengthRight, duration);

baseact = tmp_vib_act;
}
break;
case ACT_VISIBILITY:
{
bVisibilityActuator *vis_act = (bVisibilityActuator *) bact->data;
@@ -976,7 +948,7 @@ void BL_ConvertActuators(const char* maggiename,
}

tmp = new SCA_2DFilterActuator(gameobj, filtermode, _2dfilter->flag,
_2dfilter->float_arg, _2dfilter->int_arg, _2dfilter->mipmap,
_2dfilter->float_arg, _2dfilter->int_arg, false,
ketsjiEngine->GetRasterizer(), scene->Get2DFilterManager(), scene);

if (_2dfilter->text)
@@ -73,7 +73,6 @@
#include "SCA_PropertySensor.h"
#include "SCA_RandomSensor.h"
#include "KX_RaySensor.h"
#include "KX_MovementSensor.h"
#include "SCA_EventManager.h"
#include "SCA_LogicManager.h"
#include "KX_Scene.h"
@@ -328,7 +327,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
/* give us a focus-aware sensor */
bool bFindMaterial = (bmouse->mode & SENS_COLLISION_MATERIAL);
bool bXRay = (bmouse->flag & SENS_RAY_XRAY);
int mask = bmouse->mask;
int mask = (1 << 20) - 1;
std::string checkname = (bFindMaterial? bmouse->matname : bmouse->propname);

gamesensor = new KX_MouseFocusSensor(eventmgr,
@@ -486,7 +485,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
// don't want to get rays of length 0.0 or so
double distance = (blenderraysensor->range < 0.01f ? 0.01f : blenderraysensor->range);
int axis = blenderraysensor->axisflag;
int mask = blenderraysensor->mask;
int mask = (1 << 20) - 1;

gamesensor = new KX_RaySensor(eventmgr,
gameobj,
@@ -522,23 +521,6 @@ void BL_ConvertSensors(struct Object* blenderobject,
}
break;
}
case SENS_MOVEMENT:
{
bMovementSensor *blendermovsensor = (bMovementSensor *)sens->data;
// some files didn't write movementsensor, avoid crash now for nullptr ptr's
if (blendermovsensor)
{
SCA_EventManager *eventmgr = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR);
if (eventmgr)
{
bool localflag = (blendermovsensor->localflag & SENS_MOVEMENT_LOCAL);
int axis = blendermovsensor->axisflag;
float threshold = blendermovsensor->threshold;
gamesensor = new KX_MovementSensor(eventmgr, gameobj, axis, localflag, threshold);
}
}
break;
}
case SENS_JOYSTICK:
{
int joysticktype = SCA_JoystickSensor::KX_JOYSENSORMODE_NODEF;
@@ -570,11 +552,6 @@ void BL_ConvertSensors(struct Object* blenderobject,
prec = bjoy->precision;
joysticktype = SCA_JoystickSensor::KX_JOYSENSORMODE_AXIS_SINGLE;
break;
case SENS_JOY_SHOULDER_TRIGGER:
axis = bjoy->axis_single;
prec = bjoy->precision;
joysticktype = SCA_JoystickSensor::KX_JOYSENSORMODE_SHOULDER_TRIGGER;
break;
default:
CM_Error("bad case statement");
break;
@@ -268,7 +268,7 @@ static GHOST_IWindow *startScreenSaverPreview(
{
int windowWidth = rc.right - rc.left;
int windowHeight = rc.bottom - rc.top;
std::string title = "";
STR_String title = "";
GHOST_GLSettings glSettings = {0};

if (stereoVisual) {
@@ -365,7 +365,7 @@ static GHOST_IWindow *startScreenSaverFullScreen(

static GHOST_IWindow *startWindow(
GHOST_ISystem *system,
std::string& title,
STR_String& title,
int windowLeft,
int windowTop,
int windowWidth,
@@ -399,7 +399,7 @@ static GHOST_IWindow *startWindow(

static GHOST_IWindow *startEmbeddedWindow(
GHOST_ISystem *system,
std::string& title,
STR_String& title,
const GHOST_TEmbedderWindowID parentWindow,
const bool stereoVisual,
const int alphaBackground)
@@ -594,40 +594,40 @@ static bool quitGame(KX_ExitRequest exitcode)
return (exitcode != KX_ExitRequest::RESTART_GAME && exitcode != KX_ExitRequest::START_OTHER_GAME);
}

#ifdef WITH_GAMEENGINE_BPPLAYER

static BlendFileData *load_encrypted_game_data(const char *filename, std::string encryptKey)
{
ReportList reports;
BlendFileData *bfd = NULL;
char *fileData = NULL;
int fileSize;
std::string localPath(SPINDLE_GetFilePath());
BKE_reports_init(&reports, RPT_STORE);

if (filename == NULL) {
return NULL;
}

if (!localPath.empty() && !encryptKey.empty()) {
// Load file and decrypt.
fileData = SPINDLE_DecryptFromFile(filename, &fileSize, encryptKey.c_str(), 0);
}

if (fileData) {
bfd = BLO_read_from_memory(fileData, fileSize, &reports, BLO_READ_SKIP_USERDEF);
delete[] fileData;
}

if (!bfd) {
BKE_reports_print(&reports, RPT_ERROR);
}

BKE_reports_clear(&reports);
return bfd;
}

#endif // WITH_GAMEENGINE_BPPLAYER
//#ifdef WITH_GAMEENGINE_BPPLAYER
//
//static BlendFileData *load_encrypted_game_data(const char *filename, std::string encryptKey)
//{
// ReportList reports;
// BlendFileData *bfd = NULL;
// char *fileData = NULL;
// int fileSize;
// std::string localPath(SPINDLE_GetFilePath());
// BKE_reports_init(&reports, RPT_STORE);
//
// if (filename == NULL) {
// return NULL;
// }
//
// if (!localPath.empty() && !encryptKey.empty()) {
// // Load file and decrypt.
// fileData = SPINDLE_DecryptFromFile(filename, &fileSize, encryptKey.c_str(), 0);
// }
//
// if (fileData) {
// bfd = BLO_read_from_memory(fileData, fileSize, &reports, BLO_READ_SKIP_USERDEF);
// delete[] fileData;
// }
//
// if (!bfd) {
// BKE_reports_print(&reports, RPT_ERROR);
// }
//
// BKE_reports_clear(&reports);
// return bfd;
//}
//
//#endif // WITH_GAMEENGINE_BPPLAYER

int main(
int argc,
@@ -891,25 +891,25 @@ int main(

break;
}
#ifdef WITH_GAMEENGINE_BPPLAYER
case 'L':
{
// Find the requested base file directory.
if (!useLocalPath) {
SPINDLE_SetFilePath(&argv[i][2]);
useLocalPath = true;
}
i++;
break;
}
case 'K':
{
//Find and set keys
hexKey = SPINDLE_FindAndSetEncryptionKeys(argv, i);
i++;
break;
}
#endif // WITH_GAMEENGINE_BPPLAYER
//#ifdef WITH_GAMEENGINE_BPPLAYER
// case 'L':
// {
// // Find the requested base file directory.
// if (!useLocalPath) {
// SPINDLE_SetFilePath(&argv[i][2]);
// useLocalPath = true;
// }
// i++;
// break;
// }
// case 'K':
// {
// //Find and set keys
// hexKey = SPINDLE_FindAndSetEncryptionKeys(argv, i);
// i++;
// break;
// }
//#endif // WITH_GAMEENGINE_BPPLAYER
case 'f': //fullscreen mode
{
i++;
@@ -1173,18 +1173,18 @@ int main(
}
else
{
#ifdef WITH_GAMEENGINE_BPPLAYER
if (useLocalPath) {
bfd = load_encrypted_game_data(filename[0] ? filename : NULL, hexKey);

// The file is valid and it's the original file name.
if (bfd) {
remove(filename);
KX_SetOrigPath(bfd->main->name);
}
}
else
#endif // WITH_GAMEENGINE_BPPLAYER
//#ifdef WITH_GAMEENGINE_BPPLAYER
// if (useLocalPath) {
// bfd = load_encrypted_game_data(filename[0] ? filename : NULL, hexKey);
//
// // The file is valid and it's the original file name.
// if (bfd) {
// remove(filename);
// KX_SetOrigPath(bfd->main->name);
// }
// }
// else
//#endif // WITH_GAMEENGINE_BPPLAYER
{
bfd = load_game_data(BKE_appdir_program_path(), filename[0] ? filename : NULL);
// The file is valid and it's the original file name.
@@ -1363,10 +1363,11 @@ int main(
else
#endif
{
STR_String strtitle(title.c_str());
if (parentWindow != 0)
window = startEmbeddedWindow(system, title, parentWindow, stereoWindow, alphaBackground);
window = startEmbeddedWindow(system, strtitle, parentWindow, stereoWindow, alphaBackground);
else
window = startWindow(system, title, windowLeft, windowTop, windowWidth,
window = startWindow(system, strtitle, windowLeft, windowTop, windowWidth,
windowHeight, stereoWindow, alphaBackground);
}
}
@@ -23,7 +23,6 @@
*/

#include "BL_Texture.h"
#include "KX_TextureRenderer.h"

#include "DNA_texture_types.h"

@@ -190,13 +189,7 @@ PyAttributeDef BL_Texture::Attributes[] = {
KX_PYATTRIBUTE_RW_FUNCTION("emit", BL_Texture, pyattr_get_emit, pyattr_set_emit),
KX_PYATTRIBUTE_RW_FUNCTION("mirror", BL_Texture, pyattr_get_mirror, pyattr_set_mirror),
KX_PYATTRIBUTE_RW_FUNCTION("normal", BL_Texture, pyattr_get_normal, pyattr_set_normal),
KX_PYATTRIBUTE_RW_FUNCTION("parallaxBump", BL_Texture, pyattr_get_parallax_bump, pyattr_set_parallax_bump),
KX_PYATTRIBUTE_RW_FUNCTION("parallaxStep", BL_Texture, pyattr_get_parallax_step, pyattr_set_parallax_step),
KX_PYATTRIBUTE_RW_FUNCTION("lodBias", BL_Texture, pyattr_get_lod_bias, pyattr_set_lod_bias),
KX_PYATTRIBUTE_RW_FUNCTION("bindCode", BL_Texture, pyattr_get_bind_code, pyattr_set_bind_code),
KX_PYATTRIBUTE_RO_FUNCTION("renderer", BL_Texture, pyattr_get_renderer),
KX_PYATTRIBUTE_RW_FUNCTION("ior", BL_Texture, pyattr_get_ior, pyattr_set_ior),
KX_PYATTRIBUTE_RW_FUNCTION("refractionRatio", BL_Texture, pyattr_get_refraction_ratio, pyattr_set_refraction_ratio),
KX_PYATTRIBUTE_RW_FUNCTION("uvRotation", BL_Texture, pyattr_get_uv_rotation, pyattr_set_uv_rotation),
KX_PYATTRIBUTE_RW_FUNCTION("uvOffset", BL_Texture, pyattr_get_uv_offset, pyattr_set_uv_offset),
KX_PYATTRIBUTE_RW_FUNCTION("uvSize", BL_Texture, pyattr_get_uv_size, pyattr_set_uv_size),
@@ -383,66 +376,6 @@ int BL_Texture::pyattr_set_normal(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF
return PY_SET_ATTR_SUCCESS;
}

PyObject *BL_Texture::pyattr_get_parallax_bump(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
return PyFloat_FromDouble(self->GetMTex()->parallaxbumpsc);
}

int BL_Texture::pyattr_set_parallax_bump(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
float val = PyFloat_AsDouble(value);

if (val == -1 && PyErr_Occurred()) {
PyErr_Format(PyExc_AttributeError, "texture.%s = float: BL_Texture, expected a float", attrdef->m_name.c_str());
return PY_SET_ATTR_FAIL;
}

self->GetMTex()->parallaxbumpsc = val;
return PY_SET_ATTR_SUCCESS;
}

PyObject *BL_Texture::pyattr_get_parallax_step(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
return PyFloat_FromDouble(self->GetMTex()->parallaxsteps);
}

int BL_Texture::pyattr_set_parallax_step(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
float val = PyFloat_AsDouble(value);

if (val == -1 && PyErr_Occurred()) {
PyErr_Format(PyExc_AttributeError, "texture.%s = float: BL_Texture, expected a float", attrdef->m_name.c_str());
return PY_SET_ATTR_FAIL;
}

self->GetMTex()->parallaxsteps = val;
return PY_SET_ATTR_SUCCESS;
}

PyObject *BL_Texture::pyattr_get_lod_bias(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
return PyFloat_FromDouble(self->GetMTex()->lodbias);
}

int BL_Texture::pyattr_set_lod_bias(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
float val = PyFloat_AsDouble(value);

if (val == -1 && PyErr_Occurred()) {
PyErr_Format(PyExc_AttributeError, "texture.%s = float: BL_Texture, expected a float", attrdef->m_name.c_str());
return PY_SET_ATTR_FAIL;
}

self->GetMTex()->lodbias = val;
return PY_SET_ATTR_SUCCESS;
}

PyObject *BL_Texture::pyattr_get_bind_code(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
@@ -464,58 +397,6 @@ int BL_Texture::pyattr_set_bind_code(PyObjectPlus *self_v, const KX_PYATTRIBUTE_
return PY_SET_ATTR_SUCCESS;
}

PyObject *BL_Texture::pyattr_get_renderer(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
KX_TextureRenderer *renderer = static_cast<KX_TextureRenderer *>(self->GetRenderer());
if (renderer) {
return renderer->GetProxy();
}

Py_RETURN_NONE;
}

PyObject *BL_Texture::pyattr_get_ior(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
return PyFloat_FromDouble(self->GetMTex()->ior);
}

int BL_Texture::pyattr_set_ior(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
float val = PyFloat_AsDouble(value);

if (val == -1 && PyErr_Occurred()) {
PyErr_Format(PyExc_AttributeError, "texture.%s = float: BL_Texture, expected a float", attrdef->m_name.c_str());
return PY_SET_ATTR_FAIL;
}

CLAMP(val, 1.0, 50.0);
self->GetMTex()->ior = val;
return PY_SET_ATTR_SUCCESS;
}

PyObject *BL_Texture::pyattr_get_refraction_ratio(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
return PyFloat_FromDouble(self->GetMTex()->refrratio);
}

int BL_Texture::pyattr_set_refraction_ratio(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
float val = PyFloat_AsDouble(value);

if (val == -1 && PyErr_Occurred()) {
PyErr_Format(PyExc_AttributeError, "texture.%s = float: BL_Texture, expected a float", attrdef->m_name.c_str());
return PY_SET_ATTR_FAIL;
}
CLAMP(val, 0.0, 1.0);
self->GetMTex()->refrratio = val;
return PY_SET_ATTR_SUCCESS;
}

PyObject *BL_Texture::pyattr_get_uv_rotation(PyObjectPlus *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_Texture *self = static_cast<BL_Texture *>(self_v);
@@ -92,7 +92,6 @@ set(SRC
KX_CollisionSensor.cpp
KX_ConstraintActuator.cpp
KX_ConstraintWrapper.cpp
KX_CubeMap.cpp
KX_CullingHandler.cpp
KX_CullingNode.cpp
KX_EmptyObject.cpp
@@ -112,20 +111,17 @@ set(SRC
KX_MotionState.cpp
KX_MouseActuator.cpp
KX_MouseFocusSensor.cpp
KX_MovementSensor.cpp
KX_NavMeshObject.cpp
KX_NearSensor.cpp
KX_ObColorIpoSGController.cpp
KX_ObjectActuator.cpp
KX_ObstacleSimulation.cpp
KX_OrientationInterpolator.cpp
KX_ParentActuator.cpp
KX_PlanarMap.cpp
KX_PolyProxy.cpp
KX_PositionInterpolator.cpp
KX_PyConstraintBinding.cpp
KX_PyMath.cpp
KX_PythonComponent.cpp
KX_PythonInit.cpp
KX_PythonInitTypes.cpp
KX_PythonMain.cpp
@@ -146,8 +142,6 @@ set(SRC
KX_StateActuator.cpp
KX_SteeringActuator.cpp
KX_TextMaterial.cpp
KX_TextureRenderer.cpp
KX_TextureRendererManager.cpp
KX_TimeCategoryLogger.cpp
KX_TimeLogger.cpp
KX_TrackToActuator.cpp
@@ -177,7 +171,6 @@ set(SRC
KX_ClientObjectInfo.h
KX_ConstraintActuator.h
KX_ConstraintWrapper.h
KX_CubeMap.h
KX_CullingHandler.h
KX_CullingNode.h
KX_EmptyObject.h
@@ -201,7 +194,6 @@ set(SRC
KX_MotionState.h
KX_MouseActuator.h
KX_MouseFocusSensor.h
KX_MovementSensor.h
KX_NavMeshObject.h
KX_NearSensor.h
KX_ObColorIpoSGController.h
@@ -210,12 +202,10 @@ set(SRC
KX_OrientationInterpolator.h
KX_ParentActuator.h
KX_PhysicsEngineEnums.h
KX_PlanarMap.h
KX_PolyProxy.h
KX_PositionInterpolator.h
KX_PyConstraintBinding.h
KX_PyMath.h
KX_PythonComponent.h
KX_PythonInit.h
KX_PythonInitTypes.h
KX_PythonMain.h
@@ -236,8 +226,6 @@ set(SRC
KX_StateActuator.h
KX_SteeringActuator.h
KX_TextMaterial.h
KX_TextureRenderer.h
KX_TextureRendererManager.h
KX_TimeCategoryLogger.h
KX_TimeLogger.h
KX_CollisionEventManager.h
@@ -89,7 +89,6 @@ KX_BlenderMaterial::KX_BlenderMaterial(

m_rasMode |= (mat->game.flag & GEMAT_BACKCULL) ? 0 : RAS_TWOSIDED;
m_rasMode |= (mat->material_type == MA_TYPE_WIRE) ? RAS_WIRE : 0;
m_rasMode |= (mat->mode2 & MA_DEPTH_TRANSP) ? RAS_DEPTH_ALPHA : 0;

if (ELEM(m_alphablend, GEMAT_CLIP, GEMAT_ALPHA_TO_COVERAGE)) {
m_rasMode |= RAS_ALPHA_SHADOW;