Merging r6364 through r6379 from trunk to ogl-es branch

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6380 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2022-05-04 21:38:12 +00:00
parent 993f990036
commit 67a488fc5c
227 changed files with 19006 additions and 5574 deletions

View File

@ -38,8 +38,8 @@ public:
virtual bool getProcessorSpeedMHz(u32* MHz) const = 0;
//! Get the total and available system RAM
/** \param totalBytes: will contain the total system memory in bytes
\param availableBytes: will contain the available memory in bytes
/** \param totalBytes: will contain the total system memory in Kilobytes (1024 B)
\param availableBytes: will contain the available memory in Kilobytes (1024 B)
\return True if successful, false if not */
virtual bool getSystemMemory(u32* totalBytes, u32* availableBytes) const = 0;

View File

@ -616,7 +616,9 @@ namespace scene
virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent=0,
f32 rotateSpeed=-1500.f, f32 zoomSpeed=200.f,
f32 translationSpeed=1500.f, s32 id=-1, f32 distance=70.f,
bool makeActive=true) =0;
bool makeActive=true
, f32 rotX = 0.f, f32 rotY = 0.f
) =0;
//! Adds a camera scene node with an animator which provides mouse and keyboard control appropriate for first person shooters (FPS).
/** This FPS camera is intended to provide a demonstration of a

View File

@ -962,4 +962,11 @@ precision will be lower but speed higher. currently X86 only
#endif
#endif
//! Solve Camera errors - Debug Feature
/* - Allow Camera 90 degree up, Target==Position,buildCameraLookAtMatrixLH
- pre v1.9 CCameraSceneNode moved the up non-particular in the positive x-Direction. not compatible
- Enabled is not compatible with Irrlicht Collision and Response.
*/
//#define _IRR_COMPILE_WITH_90_DEGREE_CAMERA
#endif // IRR_COMPILE_CONFIG_H_INCLUDED

View File

@ -61,6 +61,7 @@ struct SExposedVideoData
void* X11Display;
void* X11Context;
unsigned long X11Window;
unsigned long GLXWindow;
};
struct SOpenGLOSX

View File

@ -50,6 +50,42 @@ namespace irr
#endif
}
/*
For using an alternative camera in the examples.
Try to translate the viewpoint (Maya internal CameraRotation)
*/
static inline void switchToMayaCamera(IrrlichtDevice* device)
{
#if 1
return;
#else
if (!device) return;
scene::ICameraSceneNode* camera = device->getSceneManager()->getActiveCamera();
if (!camera || camera->getID() == 54321) return;
core::vector3df target = camera->getTarget() - camera->getPosition();
core::vector3df relativeRotation = target.getHorizontalAngle();
scene::ICameraSceneNode* maya = device->getSceneManager()->addCameraSceneNodeMaya(
0, -1500, 1000, 1500,
54321,
target.getLength(),
true,
relativeRotation.X + 90, relativeRotation.Y
);
if (maya)
{
maya->setNearValue(camera->getNearValue());
maya->setFarValue(camera->getFarValue());
}
device->getCursorControl()->setVisible(true);
device->setResizable(true);
#endif
}
} // end namespace irr
#endif

View File

@ -1908,10 +1908,10 @@ namespace core
const vector3df& upVector)
{
vector3df zaxis = target - position;
zaxis.normalize();
zaxis.normalize_z();
vector3df xaxis = upVector.crossProduct(zaxis);
xaxis.normalize();
vector3df xaxis = normalize_y(upVector).crossProduct(zaxis);
xaxis.normalize_x();
vector3df yaxis = zaxis.crossProduct(xaxis);

View File

@ -195,6 +195,36 @@ namespace core
return (*this *= newlength);
}
#if defined(_IRR_COMPILE_WITH_90_DEGREE_CAMERA)
vector3d<T>& normalize_camera_direction(const vector3d<T>& def)
{
f64 l = (f64)X * X + (f64)Y * Y + (f64)Z * Z;
if (::fabs(l) < 0.000000001)
{
X = def.X;
Y = def.Y;
Z = def.Z;
}
else
{
l = 1.0 / ::sqrt(l);
f64 v;
v = X * l; X = ::fabs(v) < 0.00000001 ? (T)0 : (T)v;
v = Y * l; Y = ::fabs(v) < 0.00000001 ? (T)0 : (T)v;
v = Z * l; Z = ::fabs(v) < 0.00000001 ? (T)0 : (T)v;
}
return *this;
}
#define normalize_x() normalize_camera_direction(core::vector3df(1.f, 0.f, 0.f))
#define normalize_z() normalize_camera_direction(core::vector3df(0.f, 0.f, 1.f))
#define normalize_y(v) core::vector3df(v).normalize_camera_direction(core::vector3df(0.f, 1.f, 0.f))
#else
#define normalize_x() normalize()
#define normalize_z() normalize()
#define normalize_y(v) v
#endif
//! Inverts the vector.
vector3d<T>& invert()
{