O'Reilly logo

Mastering Android NDK by Viktor Latypov, Sergey Kosarevsky

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lights and light nodes

It is very convenient to represent a light source as a part of a 3D scene. When we write "a 3D scene", we mean a scene graph. In order to attach a light source to a scene graph, we need a special node for it. Here is the clLightNode class that holds a pointer to iLight with all light properties:

class clLightNode: public clSceneNode
{
public:
  clLightNode() {}
  clPtr<iLight> GetLight() const
  {
    return m_Light;
  }
  void SetLight( const clPtr<iLight>& L )
  {
    m_Light = L;
  }
  virtual void AcceptTraverser( iSceneTraverser* Traverser )
    override;
  clPtr<iLight> m_Light;
};

The AcceptTraverser() method is similar to those in clGeometryNode and clMaterialNode. But this time, we will call the PreAcceptLightNode() and PostAcceptLightNode()

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required