a) debug Camera Matrices. enable with _IRR_COMPILE_WITH_90_DEGREE_CAMERA.

- allow ICameraSceneNode to accept any values and correct in buildCameraLookAtMatrixLH with normalize_camera_direction.
 if disabled defaults to the current v1.9 normalize
b) add initial Rotation to MayaCamera Constructor default 0,0
c) switchToMayaCamera in Examples. Clones FPSCamera default disabled


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6366 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
engineer_apple
2022-05-01 01:11:45 +00:00
parent e08e37fc0f
commit 3285a0147a
15 changed files with 156 additions and 23 deletions

View File

@ -291,6 +291,7 @@ int main()
// disable mouse cursor
device->getCursorControl()->setVisible(false);
switchToMayaCamera(device);
s32 lastFPS = -1;

View File

@ -212,6 +212,8 @@ int main()
// disable mouse cursor
device->getCursorControl()->setVisible(false);
switchToMayaCamera(device);
/*
Because we want the whole scene to look a little bit scarier, we add
some fog to it. This is done by a call to IVideoDriver::setFog(). There

View File

@ -450,6 +450,12 @@ void CMaterialControl::init(IrrlichtDevice * device, const core::position2d<s32>
TypicalColorsControl = new CTypicalColorsControl(guiEnv, core::position2d<s32>(pos.X, top), true, guiEnv->getRootGUIElement());
top += 300;
guiEnv->addStaticText(L"Shininess", core::rect<s32>(pos.X, top, pos.X + 150, top + 15), true, false, 0, -1, true);
top += 15;
ShininessControl = guiEnv->addScrollBar(true, core::rect<s32>(pos.X, top, pos.X + 150, top + 15));
ShininessControl->setMax(10000);
top += 20;
// Controls for selecting the material textures
guiEnv->addStaticText(L"Textures", core::rect<s32>(pos.X, top, pos.X+150, top+15), true, false, 0, -1, true);
top += 15;
@ -475,6 +481,9 @@ void CMaterialControl::setMaterial(const irr::video::SMaterial & material)
TypicalColorsControl->setColorsToMaterialColors(material);
for (irr::u32 i=0; i<TextureControls.size(); ++i)
TextureControls[i]->setDirty();
if (ShininessControl)
ShininessControl->setPos((int)(material.Shininess*100.f));
}
void CMaterialControl::update(scene::IMeshSceneNode* sceneNode, scene::IMeshSceneNode* sceneNode2T, scene::IMeshSceneNode* sceneNodeTangents)
@ -558,6 +567,7 @@ void CMaterialControl::updateMaterial(video::SMaterial & material)
material.TextureLayer[i].Texture = Driver->findTexture( io::path(TextureControls[i]->getSelectedTextureName()) );
}
}
material.Shininess = ShininessControl->getPos() * 0.01f;
}
/*
@ -765,6 +775,7 @@ bool CApp::init(int argc, char *argv[])
ComboMeshType->setAlignment(irr::gui::EGUIA_LOWERRIGHT, irr::gui::EGUIA_LOWERRIGHT, irr::gui::EGUIA_UPPERLEFT, irr::gui::EGUIA_UPPERLEFT);
ComboMeshType->addItem(L"cube");
ComboMeshType->addItem(L"sphere");
ComboMeshType->addItem(L"sphere highres");
ControlVertexColors = new CColorControl( guiEnv, core::position2d<s32>(440, controlsTop+30), L"Vertex colors", guiEnv->getRootGUIElement());
ControlVertexColors->setAlignment(irr::gui::EGUIA_LOWERRIGHT, irr::gui::EGUIA_LOWERRIGHT, irr::gui::EGUIA_UPPERLEFT, irr::gui::EGUIA_UPPERLEFT);
ControlVertexColors->setColor(irr::video::SColor(255,255,255,255));
@ -817,8 +828,8 @@ bool CApp::update()
GlobalAmbient->resetDirty();
}
const float zoomSpeed = 10.f * deltaTime;
const float rotationSpeed = 100.f * deltaTime;
const float zoomSpeed = (KeysPressed[KEY_LSHIFT] ? 40.f : 10.f) * deltaTime;
const float rotationSpeed = (KeysPressed[KEY_LSHIFT] ? 20.f : 100.f) * deltaTime;
// Let the user move the light around
irr::gui::IGUIElement* focus=guiEnv->getFocus(); // some checks to prevent interfering with UI input
@ -843,7 +854,7 @@ bool CApp::update()
}
// Let the user move the camera around
if (MousePressed)
if (MousePressed && !focus)
{
gui::ICursorControl* cursorControl = Device->getCursorControl();
const core::position2d<s32>& mousePos = cursorControl->getPosition ();
@ -1051,13 +1062,13 @@ void CApp::setActiveMeshNodeType(ENodeType nodeType)
// add the nodes which are used to show the materials
const irr::f32 size = 35.f;
if ( nodeType == ENT_CUBE)
if ( nodeType == ENT_CUBE )
{
SceneNode = smgr->addCubeSceneNode (size, 0, -1,
core::vector3df(0, 0, 0),
core::vector3df(0.f, 45.f, 0.f),
core::vector3df(1.0f, 1.0f, 1.0f),
scene::ECMT_1BUF_24VTX_NP);
scene::ECMT_1BUF_24VTX_NP);
// avoid wrong colored lines at cube-borders (uv's go from 0-1 currently, which does not work well with interpolation)
for ( u32 i=0; i < irr::video::MATERIAL_MAX_TEXTURES_USED; ++i)
{
@ -1067,8 +1078,14 @@ void CApp::setActiveMeshNodeType(ENodeType nodeType)
}
else
{
SceneNode = smgr->addSphereSceneNode(size*0.5f);
SceneNode = smgr->addSphereSceneNode(size * 0.5f, nodeType == ENT_SPHERE_HIGHRES ? 128 : 16);
}
// off center to test shader
//SceneNode->setPosition(core::vector3df(20.f, -4.f, 10.f));
//SceneNode->setScale(core::vector3df(1.f, 0.2f, 1.5f));
//SceneNode->setRotation(core::vector3df(0.f, 30.f, -10.f));
//defaultMaterial.NormalizeNormals = true;
SceneNode->getMaterial(0) = defaultMaterial;
// SceneNode->setDebugDataVisible(scene::EDS_NORMALS); // showing normals can sometimes be useful to understand what's going on

View File

@ -146,6 +146,7 @@ public:
CMaterialControl()
: Initialized(false), Driver(0)
, TypicalColorsControl(0), ButtonLighting(0), InfoLighting(0), ComboMaterial(0)
, ShininessControl(0)
{}
// Destructor
@ -183,6 +184,8 @@ protected:
irr::gui::IGUIStaticText* InfoLighting;
irr::gui::IGUIComboBox * ComboMaterial;
irr::core::array<CTextureControl*> TextureControls;
irr::gui::IGUIScrollBar* ShininessControl;
};
/*
@ -302,7 +305,8 @@ protected:
enum ENodeType
{
ENT_CUBE,
ENT_SPHERE
ENT_SPHERE,
ENT_SPHERE_HIGHRES,
};
void setActiveMeshNodeType(ENodeType nodeType);

View File

@ -17,11 +17,10 @@ written in HLSL and GLSL.
We include all headers and define necessary variables as we have done before.
*/
#include <irrlicht.h>
#include "driverChoice.h"
#include "exampleHelper.h"
#include <irrlicht.h>
using namespace irr;
#ifdef _MSC_VER