Game Development Reference
In-Depth Information
float m_Phi;
};
These parameters can be set and sent into vertex and pixel shaders by the Light-
Manager class, which you
'
ll see shortly. Here is the definition of the LightNode
class:
class LightNode : public SceneNode
{
protected:
LightProperties m_LightProps;
public:
LightNode(const ActorId actorId, std::string name, const LightProperties &props,
const Color &diffuseColor, const Mat4x4 *t)
const LightProperties &props, const Color &diffuseColor,
const Mat4x4 *t)
: SceneNode(actorId, name, RenderPass_NotRendered, diffuseColor, t)
{
m_LightProps = props;
}
};
The heavy lifting of the LightNode class is really done by SceneNode , since it
already contains the material that defines the light
s color and the transformations
that describe the location and orientation of the light in the 3D world.
Getting lighting information into shaders is done by the LightManager class.
'
typedef std::list<shared_ptr<LightNode> > Lights;
class LightManager
{
friend class Scene;
protected:
Lights
m_Lights;
Vec4
m_vLightDir[MAXIMUM_LIGHTS_SUPPORTED];
Color
m_vLightDiffuse[MAXIMUM_LIGHTS_SUPPORTED];
Vec4
m_vLightAmbient;
public:
int GetLightCount(const SceneNode *node) { return m_Lights.size(); }
const Vec4 *GetLightAmbient(const SceneNode *node)
{ return &m_vLightAmbient; }
const Vec4 *GetLightDirection(const SceneNode *node) { return m_vLightDir; }
const Color *GetLightDiffuse(const SceneNode *node)
{ return m_vLightDiffuse; }
 
Search WWH ::




Custom Search