Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/Ketsji/KX_Camera.cpp
| Show First 20 Lines • Show All 880 Lines • ▼ Show 20 Lines | int KX_Camera::pyattr_set_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) | ||||
| self->SetProjectionMatrix(mat); | self->SetProjectionMatrix(mat); | ||||
| return PY_SET_ATTR_SUCCESS; | return PY_SET_ATTR_SUCCESS; | ||||
| } | } | ||||
| PyObject *KX_Camera::pyattr_get_modelview_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) | PyObject *KX_Camera::pyattr_get_modelview_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) | ||||
| { | { | ||||
| KX_Camera* self = static_cast<KX_Camera*>(self_v); | KX_Camera* self = static_cast<KX_Camera*>(self_v); | ||||
| return PyObjectFrom(self->GetModelviewMatrix()); | return PyObjectFrom(self->GetWorldToCamera()); | ||||
hg1: UpdateModelviewMatrix() is wrong must be self->UpdateModelviewMatrix();
Please always test… | |||||
| } | } | ||||
| PyObject *KX_Camera::pyattr_get_camera_to_world(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) | PyObject *KX_Camera::pyattr_get_camera_to_world(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) | ||||
| { | { | ||||
| KX_Camera* self = static_cast<KX_Camera*>(self_v); | KX_Camera* self = static_cast<KX_Camera*>(self_v); | ||||
| return PyObjectFrom(self->GetCameraToWorld()); | return PyObjectFrom(self->GetCameraToWorld()); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | if (!PyVecTo(value, vect)) | ||||
| } | } | ||||
| } | } | ||||
| const GLint *viewport; | const GLint *viewport; | ||||
| GLdouble win[3]; | GLdouble win[3]; | ||||
| GLdouble modelmatrix[16]; | GLdouble modelmatrix[16]; | ||||
| GLdouble projmatrix[16]; | GLdouble projmatrix[16]; | ||||
| MT_Matrix4x4 m_modelmatrix = this->GetModelviewMatrix(); | MT_Matrix4x4 m_modelmatrix = this->GetWorldToCamera(); | ||||
| MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); | MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); | ||||
| m_modelmatrix.getValue(modelmatrix); | m_modelmatrix.getValue(modelmatrix); | ||||
| m_projmatrix.getValue(projmatrix); | m_projmatrix.getValue(projmatrix); | ||||
| viewport = KX_GetActiveEngine()->GetCanvas()->GetViewPort(); | viewport = KX_GetActiveEngine()->GetCanvas()->GetViewPort(); | ||||
| gluProject(vect[0], vect[1], vect[2], modelmatrix, projmatrix, viewport, &win[0], &win[1], &win[2]); | gluProject(vect[0], vect[1], vect[2], modelmatrix, projmatrix, viewport, &win[0], &win[1], &win[2]); | ||||
| Show All 26 Lines | ) | ||||
| MT_Vector3 vect; | MT_Vector3 vect; | ||||
| MT_Point3 campos, screenpos; | MT_Point3 campos, screenpos; | ||||
| const GLint *viewport; | const GLint *viewport; | ||||
| GLdouble win[3]; | GLdouble win[3]; | ||||
| GLdouble modelmatrix[16]; | GLdouble modelmatrix[16]; | ||||
| GLdouble projmatrix[16]; | GLdouble projmatrix[16]; | ||||
| MT_Matrix4x4 m_modelmatrix = this->GetModelviewMatrix(); | MT_Matrix4x4 m_modelmatrix = this->GetWorldToCamera(); | ||||
| MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); | MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); | ||||
| m_modelmatrix.getValue(modelmatrix); | m_modelmatrix.getValue(modelmatrix); | ||||
| m_projmatrix.getValue(projmatrix); | m_projmatrix.getValue(projmatrix); | ||||
| viewport = KX_GetActiveEngine()->GetCanvas()->GetViewPort(); | viewport = KX_GetActiveEngine()->GetCanvas()->GetViewPort(); | ||||
| vect[0] = x * viewport[2]; | vect[0] = x * viewport[2]; | ||||
| ▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines | |||||
UpdateModelviewMatrix() is wrong must be self->UpdateModelviewMatrix();
Please always test your code changes before uploading it.