Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp5
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp6
-rw-r--r--source/gameengine/Expressions/ListValue.cpp7
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp12
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h41
-rw-r--r--source/gameengine/Expressions/StringValue.h5
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp13
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp23
-rw-r--r--source/gameengine/Ketsji/KX_Camera.h6
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h3
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.h4
-rw-r--r--source/gameengine/Rasterizer/RAS_CameraData.h9
-rw-r--r--source/gameengine/Rasterizer/RAS_FramingManager.cpp59
-rw-r--r--source/gameengine/Rasterizer/RAS_FramingManager.h13
-rw-r--r--source/gameengine/VideoTexture/BlendType.h6
-rw-r--r--source/gameengine/VideoTexture/FilterBase.cpp2
-rw-r--r--source/gameengine/VideoTexture/ImageBase.cpp4
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp6
-rw-r--r--source/gameengine/VideoTexture/Texture.cpp4
-rw-r--r--source/gameengine/VideoTexture/blendVideoTex.cpp2
23 files changed, 161 insertions, 81 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index 6f2ca28c135..a6d02db8cea 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -344,8 +344,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
/* Python functions */
/* ------------------------------------------------------------------------- */
-PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) {
- char *string= _PyUnicode_AsString(value);
+PyObject* BL_ActionActuator::PyGetChannel(PyObject* value)
+{
+ const char *string= _PyUnicode_AsString(value);
if (!string) {
PyErr_SetString(PyExc_TypeError, "expected a single string");
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 77bd6e0f374..57611d65e14 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1579,7 +1579,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
my_get_local_bounds(blenderobject,dm,objprop.m_boundobject.box.m_center,bb.m_extends);
if (blenderobject->gameflag & OB_BOUNDS)
{
- switch (blenderobject->boundtype)
+ switch (blenderobject->collision_boundtype)
{
case OB_BOUND_BOX:
objprop.m_boundclass = KX_BOUNDBOX;
@@ -1648,7 +1648,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
}
- objprop.m_concave = (blenderobject->boundtype & 4) != 0;
+ objprop.m_concave = (blenderobject->collision_boundtype == OB_BOUND_TRIANGLE_MESH);
switch (physics_engine)
{
@@ -1724,7 +1724,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l
static KX_Camera *gamecamera_from_bcamera(Object *ob, KX_Scene *kxscene, KX_BlenderSceneConverter *converter) {
Camera* ca = static_cast<Camera*>(ob->data);
- RAS_CameraData camdata(ca->lens, ca->ortho_scale, ca->clipsta, ca->clipend, ca->type == CAM_PERSP, ca->YF_dofdist);
+ RAS_CameraData camdata(ca->lens, ca->ortho_scale, ca->sensor_x, ca->sensor_y, ca->sensor_fit, ca->clipsta, ca->clipend, ca->type == CAM_PERSP, ca->YF_dofdist);
KX_Camera *gamecamera;
gamecamera= new KX_Camera(kxscene, KX_Scene::m_callbacks, camdata);
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index ade54f6d924..cdd87235fd2 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -339,10 +339,9 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
int index = PyLong_AsSsize_t(pyindex);
return listvalue_buffer_item(self, index); /* wont add a ref */
}
-
- PyObject *pyindex_str = PyObject_Repr(pyindex); /* new ref */
- PyErr_Format(PyExc_KeyError, "CList[key]: '%s' key not in list", _PyUnicode_AsString(pyindex_str));
- Py_DECREF(pyindex_str);
+
+ PyErr_Format(PyExc_KeyError,
+ "CList[key]: '%R' key not in list", pyindex);
return NULL;
}
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 33aa6b8d177..87f776a726e 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -1012,8 +1012,8 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
if (PyUnicode_Check(value))
{
- Py_ssize_t val_len;
- char *val = _PyUnicode_AsStringAndSize(value, &val_len);
+ Py_ssize_t val_size;
+ const char *val = _PyUnicode_AsStringAndSize(value, &val_size);
strncpy(ptr, val, attrdef->m_size);
ptr[attrdef->m_size-1] = 0;
}
@@ -1030,7 +1030,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
if (PyUnicode_Check(value))
{
Py_ssize_t val_len;
- char *val = _PyUnicode_AsStringAndSize(value, &val_len);
+ const char *val = _PyUnicode_AsStringAndSize(value, &val_len); /* XXX, should be 'const' but we do a silly trick to have a shorter string */
if (attrdef->m_clamp)
{
if (val_len < attrdef->m_imin)
@@ -1042,10 +1042,8 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
else if (val_len > attrdef->m_imax)
{
// trim the string
- char c = val[attrdef->m_imax];
- val[attrdef->m_imax] = 0;
- *var = val;
- val[attrdef->m_imax] = c;
+ var->SetLength(attrdef->m_imax);
+ memcpy(var->Ptr(), val, attrdef->m_imax - 1);
break;
}
} else if (val_len < attrdef->m_imin || val_len > attrdef->m_imax)
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 7ee4760c48d..f7bd1b91466 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -69,26 +69,27 @@ typedef struct {
void *link;
} WarnLink;
-#define ShowDeprecationWarning(old_way, new_way) \
-{ \
- static WarnLink wlink = {false, NULL}; \
- if ((m_ignore_deprecation_warnings || wlink.warn_done)==0) \
- { \
- ShowDeprecationWarning_func(old_way, new_way); \
- \
- WarnLink *wlink_last= GetDeprecationWarningLinkLast(); \
- wlink.warn_done = true; \
- wlink.link = NULL; \
- \
- if(wlink_last) { \
- wlink_last->link= (void *)&(wlink); \
- SetDeprecationWarningLinkLast(&(wlink)); \
- } else { \
- SetDeprecationWarningFirst(&(wlink)); \
- SetDeprecationWarningLinkLast(&(wlink)); \
- } \
- } \
-} \
+#define ShowDeprecationWarning(old_way, new_way) \
+{ \
+ static WarnLink wlink = {false, NULL}; \
+ if ((m_ignore_deprecation_warnings || wlink.warn_done)==0) \
+ { \
+ ShowDeprecationWarning_func(old_way, new_way); \
+ \
+ WarnLink *wlink_last= GetDeprecationWarningLinkLast(); \
+ wlink.warn_done = true; \
+ wlink.link = NULL; \
+ \
+ if(wlink_last) { \
+ wlink_last->link= (void *)&(wlink); \
+ SetDeprecationWarningLinkLast(&(wlink)); \
+ } \
+ else { \
+ SetDeprecationWarningFirst(&(wlink)); \
+ SetDeprecationWarningLinkLast(&(wlink)); \
+ } \
+ } \
+} \
diff --git a/source/gameengine/Expressions/StringValue.h b/source/gameengine/Expressions/StringValue.h
index d0f74a6eed8..e5a892ff82d 100644
--- a/source/gameengine/Expressions/StringValue.h
+++ b/source/gameengine/Expressions/StringValue.h
@@ -31,8 +31,7 @@ public:
CStringValue();
CStringValue (const char *txt, const char *name , AllocationTYPE alloctype = CValue::HEAPVALUE);
- virtual ~CStringValue() {
- };
+ virtual ~CStringValue() {}
/// CValue implementation
virtual bool IsEqual(const STR_String & other);
virtual const STR_String & GetText();
@@ -40,7 +39,7 @@ public:
virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
- virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); };
+ virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); }
virtual CValue* GetReplica();
#ifdef WITH_PYTHON
virtual PyObject* ConvertValueToPython() {
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 303b3e9529e..d69358928e6 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -199,7 +199,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
if (PyUnicode_Check(value)) {
/* get the actuator from the name */
- char *name= _PyUnicode_AsString(value);
+ const char *name= _PyUnicode_AsString(value);
for(it = lacts.begin(); it!= lacts.end(); ++it) {
if( name == (*it)->GetName() ) {
return *it;
@@ -214,12 +214,11 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
}
}
}
-
+
/* set the exception */
- PyObject *value_str = PyObject_Repr(value); /* new ref */
- PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str));
- Py_DECREF(value_str);
-
+ PyErr_Format(PyExc_ValueError,
+ "%R not in this python controllers actuator list", value);
+
return NULL;
}
@@ -500,7 +499,7 @@ int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_D
{
SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
- char *scriptArg = _PyUnicode_AsString(value);
+ const char *scriptArg = _PyUnicode_AsString(value);
if (scriptArg==NULL) {
PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text");
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 3b777031831..14a307794db 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -200,7 +200,26 @@ float KX_Camera::GetScale() const
return m_camdata.m_scale;
}
+/*
+* Gets the horizontal size of the sensor - for camera matching.
+*/
+float KX_Camera::GetSensorWidth() const
+{
+ return m_camdata.m_sensor_x;
+}
+/*
+* Gets the vertical size of the sensor - for camera matching.
+*/
+float KX_Camera::GetSensorHeight() const
+{
+ return m_camdata.m_sensor_y;
+}
+/** Gets the mode FOV is calculating from sensor dimensions */
+short KX_Camera::GetSensorFit() const
+{
+ return m_camdata.m_sensor_fit;
+}
float KX_Camera::GetCameraNear() const
{
@@ -883,7 +902,9 @@ bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok
if (*object) {
return true;
} else {
- PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_Camera in this scene", error_prefix, _PyUnicode_AsString(value));
+ PyErr_Format(PyExc_ValueError,
+ "%s, requested name \"%s\" did not match any KX_Camera in this scene",
+ error_prefix, _PyUnicode_AsString(value));
return false;
}
}
diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h
index 4c8cf21a7bf..236e914b9e5 100644
--- a/source/gameengine/Ketsji/KX_Camera.h
+++ b/source/gameengine/Ketsji/KX_Camera.h
@@ -199,6 +199,12 @@ public:
float GetLens() const;
/** Gets the ortho scale. */
float GetScale() const;
+ /** Gets the horizontal size of the sensor - for camera matching */
+ float GetSensorWidth() const;
+ /** Gets the vertical size of the sensor - for camera matching */
+ float GetSensorHeight() const;
+ /** Gets the mode FOV is calculating from sensor dimensions */
+ short GetSensorFit() const;
/** Gets the near clip distance. */
float GetCameraNear() const;
/** Gets the far clip distance. */
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 5de6adc5af4..a9be588e6b2 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -1251,6 +1251,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
cam->GetScale(),
nearfrust,
farfrust,
+ cam->GetSensorFit(),
frustum
);
if (!cam->GetViewport()) {
@@ -1268,6 +1269,9 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
area,
viewport,
cam->GetLens(),
+ cam->GetSensorWidth(),
+ cam->GetSensorHeight(),
+ cam->GetSensorFit(),
nearfrust,
farfrust,
frustum
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index 40f157ef0a4..5a02da07e43 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -387,8 +387,7 @@ public:
void SetUseOverrideFrameColor(bool overrideFrameColor);
/**
- * Enables/disables the use of the framing bar color of the Blender file's scenes.
- * @param useSceneFrameColor The new setting.
+ * Check if the frame color is being overridden.
*/
bool GetUseOverrideFrameColor(void) const;
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 25145e87b78..02e6ebea71b 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -705,7 +705,7 @@ static PyObject *gLibNew(PyObject*, PyObject* args)
KX_Scene *kx_scene= gp_KetsjiScene;
char *path;
char *group;
- char *name;
+ const char *name;
PyObject *names;
int idcode;
@@ -815,7 +815,7 @@ static struct PyMethodDef game_methods[] = {
{"getAverageFrameRate", (PyCFunction) gPyGetAverageFrameRate, METH_NOARGS, (const char *)"Gets the estimated average frame rate"},
{"getBlendFileList", (PyCFunction)gPyGetBlendFileList, METH_VARARGS, (const char *)"Gets a list of blend files in the same directory as the current blend file"},
{"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, (const char *)"Prints GL Extension Info"},
- {"PrintMemInfo", (PyCFunction)pyPrintStats, METH_NOARGS, (const char *)"Print engine stastics"},
+ {"PrintMemInfo", (PyCFunction)pyPrintStats, METH_NOARGS, (const char *)"Print engine statistics"},
/* library functions */
{"LibLoad", (PyCFunction)gLibLoad, METH_VARARGS|METH_KEYWORDS, (const char *)""},
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index 7d7dc39ba32..430dcdbd153 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -189,7 +189,7 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
return NULL;
}
-static PyObjectPlus * KX_PythonSeq_subscript__internal(PyObject *self, char *key)
+static PyObjectPlus * KX_PythonSeq_subscript__internal(PyObject *self, const char *key)
{
PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
@@ -277,7 +277,7 @@ static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key)
return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t( key ));
}
else if ( PyUnicode_Check(key) ) {
- char *name = _PyUnicode_AsString(key);
+ const char *name = _PyUnicode_AsString(key);
PyObjectPlus *ret = KX_PythonSeq_subscript__internal(self, name);
if(ret) {
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.h b/source/gameengine/Ketsji/KX_PythonSeq.h
index 6e9cf9a36aa..1c2d2869be0 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.h
+++ b/source/gameengine/Ketsji/KX_PythonSeq.h
@@ -51,8 +51,8 @@ enum KX_PYGENSEQ_TYPE {
/* The Main PyType Object defined in Main.c */
extern PyTypeObject KX_PythonSeq_Type;
-#define BPy_KX_PythonSeq_Check(v) \
- ((v)->ob_type == &KX_PythonSeq_Type)
+#define BPy_KX_PythonSeq_Check(obj) \
+ (Py_TYPE(obj) == &KX_PythonSeq_Type)
typedef struct {
PyObject_VAR_HEAD
diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h
index 2056068a2ad..2120a18f139 100644
--- a/source/gameengine/Rasterizer/RAS_CameraData.h
+++ b/source/gameengine/Rasterizer/RAS_CameraData.h
@@ -36,6 +36,9 @@ struct RAS_CameraData
{
float m_lens;
float m_scale;
+ float m_sensor_x;
+ float m_sensor_y;
+ short m_sensor_fit;
float m_clipstart;
float m_clipend;
bool m_perspective;
@@ -46,11 +49,15 @@ struct RAS_CameraData
int m_viewporttop;
float m_focallength;
- RAS_CameraData(float lens = 35.0, float scale = 6.0, float clipstart = 0.1, float clipend = 5000.0, bool perspective = true,
+ RAS_CameraData(float lens = 35.0, float scale = 6.0, float sensor_x = 32.0, float sensor_y = 18.0, short sensor_fit = 0,
+ float clipstart = 0.1, float clipend = 5000.0, bool perspective = true,
float focallength = 3.0, bool viewport = false, int viewportleft = 0, int viewportbottom = 0,
int viewportright = 0, int viewporttop = 0) :
m_lens(lens),
m_scale(scale),
+ m_sensor_x(sensor_x),
+ m_sensor_y(sensor_y),
+ m_sensor_fit(sensor_fit),
m_clipstart(clipstart),
m_clipend(clipend),
m_perspective(perspective),
diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp
index da6c230ffc1..8a5c10b3a3b 100644
--- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp
@@ -39,25 +39,35 @@ ComputeDefaultFrustum(
const float camnear,
const float camfar,
const float lens,
+ const float sensor_x, const float sensor_y,
+ const short sensor_fit,
const float design_aspect_ratio,
RAS_FrameFrustum & frustum
-){
-
- /*
- * Magic Blender calculation.
- * Blender does not give a Field of View as lens but a size
- * at 16 units away from the lens.
- */
- float halfSize = 16.f * camnear / lens;
+){
+ float halfSize;
float sizeX;
float sizeY;
- if (design_aspect_ratio > 1.f) {
- // halfsize defines the width
+ if(sensor_fit==RAS_SENSORFIT_AUTO) {
+ halfSize = (sensor_x / 2.f) * camnear / lens;
+
+ if (design_aspect_ratio > 1.f) {
+ // halfsize defines the width
+ sizeX = halfSize;
+ sizeY = halfSize/design_aspect_ratio;
+ } else {
+ // halfsize defines the height
+ sizeX = halfSize * design_aspect_ratio;
+ sizeY = halfSize;
+ }
+ }
+ else if(sensor_fit==RAS_SENSORFIT_HOR) {
+ halfSize = (sensor_x / 2.f) * camnear / lens;
sizeX = halfSize;
sizeY = halfSize/design_aspect_ratio;
- } else {
- // halfsize defines the height
+ }
+ else {
+ halfSize = (sensor_y / 2.f) * camnear / lens;
sizeX = halfSize * design_aspect_ratio;
sizeY = halfSize;
}
@@ -77,6 +87,7 @@ ComputeDefaultOrtho(
const float camfar,
const float scale,
const float design_aspect_ratio,
+ const short sensor_fit,
RAS_FrameFrustum & frustum
)
{
@@ -84,12 +95,22 @@ ComputeDefaultOrtho(
float sizeX;
float sizeY;
- if (design_aspect_ratio > 1.f) {
- // halfsize defines the width
+ if(sensor_fit==RAS_SENSORFIT_AUTO) {
+ if (design_aspect_ratio > 1.f) {
+ // halfsize defines the width
+ sizeX = halfSize;
+ sizeY = halfSize/design_aspect_ratio;
+ } else {
+ // halfsize defines the height
+ sizeX = halfSize * design_aspect_ratio;
+ sizeY = halfSize;
+ }
+ }
+ else if(sensor_fit==RAS_SENSORFIT_HOR) {
sizeX = halfSize;
sizeY = halfSize/design_aspect_ratio;
- } else {
- // halfsize defines the height
+ }
+ else {
sizeX = halfSize * design_aspect_ratio;
sizeY = halfSize;
}
@@ -199,6 +220,7 @@ ComputeFrustum(
const RAS_Rect &availableViewport,
const RAS_Rect &viewport,
const float lens,
+ const float sensor_x, const float sensor_y, const short sensor_fit,
const float camnear,
const float camfar,
RAS_FrameFrustum &frustum
@@ -224,6 +246,9 @@ ComputeFrustum(
camnear,
camfar,
lens,
+ sensor_x,
+ sensor_y,
+ sensor_fit,
design_aspect_ratio,
frustum
);
@@ -269,6 +294,7 @@ RAS_FramingManager::
const float scale,
const float camnear,
const float camfar,
+ const short sensor_fit,
RAS_FrameFrustum &frustum
)
{
@@ -293,6 +319,7 @@ RAS_FramingManager::
camfar,
scale,
design_aspect_ratio,
+ sensor_fit,
frustum
);
diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.h b/source/gameengine/Rasterizer/RAS_FramingManager.h
index 38ea8f4e07a..612142234e3 100644
--- a/source/gameengine/Rasterizer/RAS_FramingManager.h
+++ b/source/gameengine/Rasterizer/RAS_FramingManager.h
@@ -184,6 +184,14 @@ enum RAS_CullingMode
RAS_CULLING_NONE
};
+/* Should match CAMERA_SENSOR_FIT... from DNA_camera_types.h */
+enum RAS_SensorFit
+{
+ RAS_SENSORFIT_AUTO = 0,
+ RAS_SENSORFIT_HOR,
+ RAS_SENSORFIT_VERT
+};
+
/**
* @section RAS_FramingManager
* This class helps to compute a view frustum
@@ -229,6 +237,7 @@ public :
const float scale,
const float camnear,
const float camfar,
+ const short sensor_fit,
RAS_FrameFrustum &frustum
);
@@ -239,6 +248,7 @@ public :
const RAS_Rect &availableViewport,
const RAS_Rect &viewport,
const float lens,
+ const float sensor_x, const float sensor_y, const short sensor_fit,
const float camnear,
const float camfar,
RAS_FrameFrustum &frustum
@@ -250,6 +260,8 @@ public :
const float camnear,
const float camfar,
const float lens,
+ const float sensor_x, const float sensor_y,
+ const short sensor_fit,
const float design_aspect_ratio,
RAS_FrameFrustum & frustum
);
@@ -261,6 +273,7 @@ public :
const float camfar,
const float scale,
const float design_aspect_ratio,
+ const short sensor_fit,
RAS_FrameFrustum & frustum
);
diff --git a/source/gameengine/VideoTexture/BlendType.h b/source/gameengine/VideoTexture/BlendType.h
index 4d63031a363..fad23af922e 100644
--- a/source/gameengine/VideoTexture/BlendType.h
+++ b/source/gameengine/VideoTexture/BlendType.h
@@ -43,15 +43,15 @@ public:
if (m_objType == NULL)
{
// compare names of type
- if (strcmp(obj->ob_type->tp_name, m_name) == 0)
+ if (strcmp(Py_TYPE(obj)->tp_name, m_name) == 0)
// if name of type match, save pointer to type
- m_objType = obj->ob_type;
+ m_objType = Py_TYPE(obj);
else
// if names of type don't match, return NULL
return NULL;
}
// if pointer to type is set and don't match to type of provided object, return NULL
- else if (obj->ob_type != m_objType)
+ else if (Py_TYPE(obj) != m_objType)
return NULL;
// return pointer to object, this class can only be used for KX object =>
// the Py object is actually a proxy
diff --git a/source/gameengine/VideoTexture/FilterBase.cpp b/source/gameengine/VideoTexture/FilterBase.cpp
index 28e36cf80e0..6fa249ff00a 100644
--- a/source/gameengine/VideoTexture/FilterBase.cpp
+++ b/source/gameengine/VideoTexture/FilterBase.cpp
@@ -141,7 +141,7 @@ int Filter_setPrevious (PyFilter * self, PyObject * value, void * closure)
if (self->m_filter != NULL)
{
// check new value
- if (value == NULL || !pyFilterTypes.in(value->ob_type))
+ if (value == NULL || !pyFilterTypes.in(Py_TYPE(value)))
{
// report value error
PyErr_SetString(PyExc_TypeError, "Invalid type of value");
diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp
index 0fe71dd8024..b1d77d8807f 100644
--- a/source/gameengine/VideoTexture/ImageBase.cpp
+++ b/source/gameengine/VideoTexture/ImageBase.cpp
@@ -567,7 +567,7 @@ PyObject * Image_setSource (PyImage * self, PyObject * args)
if (self->m_image != NULL)
{
// check type of object
- if (pyImageTypes.in(obj->ob_type))
+ if (pyImageTypes.in(Py_TYPE(obj)))
{
// convert to image struct
PyImage * img = reinterpret_cast<PyImage*>(obj);
@@ -619,7 +619,7 @@ int Image_setFilter (PyImage * self, PyObject * value, void * closure)
if (self->m_image != NULL)
{
// check new value
- if (value == NULL || !pyFilterTypes.in(value->ob_type))
+ if (value == NULL || !pyFilterTypes.in(Py_TYPE(value)))
{
// report value error
PyErr_SetString(PyExc_TypeError, "Invalid type of value");
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index 912d5864560..a349b45e403 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -214,6 +214,8 @@ void ImageRender::Render()
} else
{
float lens = m_camera->GetLens();
+ float sensor_x = m_camera->GetSensorWidth();
+ float sensor_y = m_camera->GetSensorHeight();
bool orthographic = !m_camera->GetCameraData()->m_perspective;
float nearfrust = m_camera->GetCameraNear();
float farfrust = m_camera->GetCameraFar();
@@ -233,6 +235,7 @@ void ImageRender::Render()
farfrust,
m_camera->GetScale(),
aspect_ratio,
+ m_camera->GetSensorFit(),
frustrum
);
@@ -244,6 +247,9 @@ void ImageRender::Render()
nearfrust,
farfrust,
lens,
+ sensor_x,
+ sensor_y,
+ RAS_SENSORFIT_AUTO,
aspect_ratio,
frustrum);
diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp
index ba9922d455f..e1ddd7fce1e 100644
--- a/source/gameengine/VideoTexture/Texture.cpp
+++ b/source/gameengine/VideoTexture/Texture.cpp
@@ -171,7 +171,7 @@ void Texture_dealloc (Texture * self)
// release scaled image buffer
delete [] self->m_scaledImg;
// release object
- ((PyObject *)self)->ob_type->tp_free((PyObject*)self);
+ Py_TYPE((PyObject *)self)->tp_free((PyObject*)self);
}
@@ -410,7 +410,7 @@ PyObject * Texture_getSource (Texture * self, PyObject * value, void * closure)
int Texture_setSource (Texture * self, PyObject * value, void * closure)
{
// check new value
- if (value == NULL || !pyImageTypes.in(value->ob_type))
+ if (value == NULL || !pyImageTypes.in(Py_TYPE(value)))
{
// report value error
PyErr_SetString(PyExc_TypeError, "Invalid type of value");
diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp
index c93fadada77..abfd0ed49b7 100644
--- a/source/gameengine/VideoTexture/blendVideoTex.cpp
+++ b/source/gameengine/VideoTexture/blendVideoTex.cpp
@@ -91,7 +91,7 @@ static PyObject * imageToArray (PyObject * self, PyObject *args)
// parameter is Image object
PyObject * pyImg;
char *mode = NULL;
- if (!PyArg_ParseTuple(args, "O|s:imageToArray", &pyImg, &mode) || !pyImageTypes.in(pyImg->ob_type))
+ if (!PyArg_ParseTuple(args, "O|s:imageToArray", &pyImg, &mode) || !pyImageTypes.in(Py_TYPE(pyImg)))
{
// if object is incorect, report error
PyErr_SetString(PyExc_TypeError, "VideoTexture.imageToArray(image): The value must be a image source object");