Code: Select all
// Lets make a cube
IMeshSceneNode* cube=smgr->addCubeSceneNode();
// Get the mesh from the cube node
smgr->getMeshManipulator()->makePlanarTextureMapping(cube->getMesh(), 0.003f);
// Lets make the tangent from the cubes mesh
IMesh* tangent=smgr->getMeshManipulator()->createMeshWithTangents( cube->getMesh(),true);
// And now make a clone using the tangent mesh
IMeshSceneNode* cube2= smgr->addMeshSceneNode(tangent);
// put the cube where the camera is so I can find it better :)
cube2->setPosition(camera->getPosition());
// make a normal mapped texture
ITexture* normalMap = driver->getTexture("rockwall_height.bmp");
driver->makeNormalMapTexture(normalMap, 3.0f);
// Now set the first texture
cube2->setMaterialTexture(0,driver->getTexture("rockwall.jpg"));
// And then the normal map as the second texture
cube2->setMaterialTexture(1, normalMap);
// I dont know what this does, but the tutorial did it so I am copying, monkey see monkey do :)
cube2->getMaterial(0).SpecularColor.set(0,0,0,0);
// I also tried with EMT_PARALLAX_MAP to same dissapointment
cube2->setMaterialType(EMT_NORMAL_MAP_SOLID );
// Set bumpyness value
cube2->getMaterial(0).MaterialTypeParam = 0.035f;
// And drop the tangent since its no longer needed
tangent->drop();