openframeworks/openFrameworks — pull request #1603 by tgfrerer (2012-09-19 14:15:55+00:00)
Title: fix-ofLight-globalPosition, globalOrientation

Fixes ofLight position & orientation issues when ofLight is parented.

getGlobalPosition() is used to calculate it's position, so that the position is still correct, if the light is parented.

For Spotlights, the lookAt direction is calculated using getGlobalTransformMatrix() using an ofVec4 (this also takes scale into account), so that the orientation is correct -- relative to eye space even when the ofLight is parented:

ofVec3f lookAtDir = ( getGlobalTransformMatrix().getInverse() * ofVec4f(0,0,-1, 1) ).getNormalized();

this also includes the globalPosition fix proposed by @underdoeg in #1601