i have made a program, wich allows you real head tracking with a kinect. I am working with modified view and projection matrices. The screenshot is just an example for a better understanding, with customized matrices the room sticks always with the front corners at the corners of my screen. With head tracking you have the illusion to look in that box. If the room would be a normal scene node or an imported mesh, this effect could not happen so i need to draw it into the screen. Btw. the headtracking is working fine now i want to add some cool effects.
I want to place a light in the room so the walls and the object in the mid are illuminated. The cube and the light you see are normal scene nodes added to the smgr.
My room is based on self defined verticles drawn by drawIndexedTriangleList(). To see something the ambient light is set to 0.3f.
Because the walls are affected by this (if not they where just black and not visible, because the material lightning is set to true) i conclude lightning the walls would be possible?!
But i have no idea how i can manage this. If its possible to draw shadows on the walls too, id be very happy.
Here is the code of my test room
Code: Select all
class C3DRoomSceneNode : public scene::ISceneNode
{
core::aabbox3d<f32> m_BoxCeiling, m_BoxBottom, m_BoxLeft,
m_BoxRight, m_BoxBack;
video::S3DVertex m_bottom[4];
video::S3DVertex m_top[4];
video::S3DVertex m_left[4];
video::S3DVertex m_right[4];
video::S3DVertex m_back[4];
video::IVideoDriver* m_pDriver;
video::ITexture * m_img;
video::SMaterial m_walls,
m_floor,
m_ceiling;
u16 m_indices[6];
f32 m_screenAspect,
m_BoxHeight,
m_BoxWidth,
m_BoxDepth;
public:
C3DRoomSceneNode(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
: scene::ISceneNode(parent, mgr, id)
{
// get video driver
m_pDriver = SceneManager->getVideoDriver();
// load texture
m_img = m_pDriver->getTexture("textures/wall1.jpg");
// get aspect ratio
m_screenAspect = (f32)m_pDriver->getScreenSize().Width/m_pDriver->getScreenSize().Height;
// set up box size
m_BoxHeight = 100;
m_BoxDepth = 100;
m_BoxWidth = 100 * m_screenAspect;
// set materials
m_walls.Wireframe = false;
m_walls.Lighting = true;
if(m_img)
m_walls.setTexture(0,m_img);
m_ceiling.Wireframe = false;
m_ceiling.Lighting = true;
m_ceiling.FrontfaceCulling = true;
if(m_img)
m_ceiling.setTexture(0,m_img);
// create planes
// bottom plane
m_bottom[0].Pos = vector3df( -m_BoxWidth/2 , -m_BoxHeight/2, m_BoxDepth );
m_bottom[1].Pos = vector3df( -m_BoxWidth/2 , -m_BoxHeight/2, -m_BoxDepth );
m_bottom[2].Pos = vector3df( m_BoxWidth/2 , -m_BoxHeight/2, -m_BoxDepth );
m_bottom[3].Pos = vector3df( m_BoxWidth/2 , -m_BoxHeight/2, m_BoxDepth );
// top plane
m_top[0].Pos = vector3df( -m_BoxWidth/2 , m_BoxHeight/2, m_BoxDepth );
m_top[1].Pos = vector3df( -m_BoxWidth/2 , m_BoxHeight/2, -m_BoxDepth );
m_top[2].Pos = vector3df( m_BoxWidth/2 , m_BoxHeight/2, -m_BoxDepth );
m_top[3].Pos = vector3df( m_BoxWidth/2 , m_BoxHeight/2, m_BoxDepth );
// left plane
m_left[0].Pos = vector3df( -m_BoxWidth/2 , m_BoxHeight/2, -m_BoxDepth );
m_left[1].Pos = vector3df( -m_BoxWidth/2 , -m_BoxHeight/2, -m_BoxDepth );
m_left[2].Pos = vector3df( -m_BoxWidth/2 , -m_BoxHeight/2, m_BoxDepth );
m_left[3].Pos = vector3df( -m_BoxWidth/2 , m_BoxHeight/2, m_BoxDepth );
// right plane
m_right[0].Pos = vector3df( m_BoxWidth/2 , m_BoxHeight/2, m_BoxDepth );
m_right[1].Pos = vector3df( m_BoxWidth/2 , -m_BoxHeight/2, m_BoxDepth );
m_right[2].Pos = vector3df( m_BoxWidth/2 , -m_BoxHeight/2, -m_BoxDepth );
m_right[3].Pos = vector3df( m_BoxWidth/2 , m_BoxHeight/2, -m_BoxDepth );