This Vertex shader for OGLES2
//the way to use
SLight spotLightData;
ILightSceneNode* scnode = smgr->addLightSceneNode(0, core::vector3df(0,5,20), video::SColorf(1.0f, 1.0f, 1.0f, 1.0f), 100.0f, -1);
spotLightData = scnode->getLightData();
spotLightData.Type = video::ELT_SPOT;
spotLightData.Direction = core::vector3df(-0.5,0.20,1);
spotLightData.Falloff = 60.0f;
spotLightData.OuterCone = 15;
scnode->setLightData(spotLightData);
//and I mark LightData.Direction in void CLightSceneNode::doLightRecalc()
if ((LightData.Type == video::ELT_SPOT) || (LightData.Type == video::ELT_DIRECTIONAL))
{
//LightData.Direction = core::vector3df(.0f,.0f,1.0f); //mark here
getAbsoluteTransformation().rotateVect(LightData.Direction);
LightData.Direction.normalize();
}
//
fixe the directnal light and add spotlight function
Work good if you want to use vertex shader.
If want to use inner cone for spot light, maybe we can add smoothstep GLSL API in spot light shader.
CuteAlien wrote:@feelthat: I appreciate that you post code. But please also talk and explain what this is about. Is this code to show what you are working at? Or is it something you want us to add to the engine? Or do you want us to replace an engine shader by it?