34
#if defined(WIN32) && !defined(FREE_WINDOWS)
35
// This warning tells us about truncation of __long__ stl-generated names.
36
// It can occasionally cause DevStudio to have internal compiler warnings.
37
#pragma warning( disable : 4786 )
34
/* This warning tells us about truncation of __long__ stl-generated names.
35
* It can occasionally cause DevStudio to have internal compiler warnings. */
36
# pragma warning(disable:4786)
40
39
#include "MT_Point3.h"
60
59
/* ------------------------------------------------------------------------- */
62
61
KX_MouseFocusSensor::KX_MouseFocusSensor(SCA_MouseManager* eventmgr,
69
KX_KetsjiEngine *kxengine,
68
KX_KetsjiEngine *kxengine,
71
70
: SCA_MouseSensor(eventmgr, startx, starty, mousemode, gameobj),
72
71
m_focusmode(focusmode),
73
72
m_bTouchPulse(bTouchPulse),
142
141
KX_GameObject* hitKXObj = client_info->m_gameobject;
144
143
/* Is this me? In the ray test, there are a lot of extra checks
145
* for aliasing artefacts from self-hits. That doesn't happen
144
* for aliasing artifacts from self-hits. That doesn't happen
146
145
* here, so a simple test suffices. Or does the camera also get
147
146
* self-hits? (No, and the raysensor shouldn't do it either, since
148
147
* self-hits are excluded by setting the correct ignore-object.)
240
239
/* build the from and to point in normalized device coordinates
241
240
* Normalized device coordinates are [-1,1] in x, y, z
243
242
* The actual z coordinates used don't have to be exact just infront and
244
243
* behind of the near and far clip planes.
309
308
list<class KX_Camera*>* cameras = m_kxscene->GetCameras();
310
309
list<KX_Camera*>::iterator it = cameras->begin();
312
while(it != cameras->end())
311
while (it != cameras->end()) {
314
312
if (((*it) != cam) && (*it)->GetViewport())
315
313
if (ParentObjectHasFocusCamera(*it))
395
PyObject* KX_MouseFocusSensor::pyattr_get_ray_source(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
393
PyObject *KX_MouseFocusSensor::pyattr_get_ray_source(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
397
KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
395
KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
398
396
return PyObjectFrom(self->RaySource());
401
PyObject* KX_MouseFocusSensor::pyattr_get_ray_target(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
399
PyObject *KX_MouseFocusSensor::pyattr_get_ray_target(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
403
KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
401
KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
404
402
return PyObjectFrom(self->RayTarget());
407
PyObject* KX_MouseFocusSensor::pyattr_get_ray_direction(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
405
PyObject *KX_MouseFocusSensor::pyattr_get_ray_direction(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
409
KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
407
KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
410
408
MT_Vector3 dir = self->RayTarget() - self->RaySource();
411
409
if (MT_fuzzyZero(dir)) dir.setValue(0,0,0);
412
410
else dir.normalize();
413
411
return PyObjectFrom(dir);
416
PyObject* KX_MouseFocusSensor::pyattr_get_hit_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
414
PyObject *KX_MouseFocusSensor::pyattr_get_hit_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
418
KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
416
KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
420
418
if (self->m_hitObject)
421
419
return self->m_hitObject->GetProxy();
426
PyObject* KX_MouseFocusSensor::pyattr_get_hit_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
424
PyObject *KX_MouseFocusSensor::pyattr_get_hit_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
428
KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
426
KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
429
427
return PyObjectFrom(self->HitPosition());
432
PyObject* KX_MouseFocusSensor::pyattr_get_hit_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
430
PyObject *KX_MouseFocusSensor::pyattr_get_hit_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
434
KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
432
KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
435
433
return PyObjectFrom(self->HitNormal());
438
PyObject* KX_MouseFocusSensor::pyattr_get_hit_uv(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
436
PyObject *KX_MouseFocusSensor::pyattr_get_hit_uv(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
440
KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
438
KX_MouseFocusSensor* self = static_cast<KX_MouseFocusSensor*>(self_v);
441
439
return PyObjectFrom(self->HitUV());