Advertisement
Guest User

Untitled

a guest
Jan 25th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. in sky.cpp add that at line #86
  2.  
  3. sun = mgr->addLightSceneNode(this,
  4. core::vector3df(0,10000*BS*2,0),
  5. video::SColorf(1.0f, 1.0f, 1.0f, 1.0f), 30000);
  6. video::SLight *ldata = &sun->getLightData();
  7. ldata->AmbientColor = video::SColorf(0.2f, 0.2f, 0.2f, 1.0f);
  8.  
  9. you will set up light source for our world.
  10.  
  11. now set materials in mapblock_mesh.cpp #1202:
  12.  
  13. material.setFlag(video::EMF_LIGHTING, true);
  14.  
  15. now you have ligths enabled
  16.  
  17. start the game without shaders: you will see that world is lit by the source
  18.  
  19. enable shaders now,
  20.  
  21. world is not lit by light source, it still works on vertex colors we have set.
  22.  
  23. conclusion: when you are using default materials, irrlicht is adding own shaders
  24.  
  25. when you are modyfing them you have to do your own light calculations.
  26. All the lightsource data are passed into your shader. Pos, ambient, specular etc.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement