// Add a light to this model instance void PicoModelNode::insertLight(const RendererLight& light) { // Calculate transform from the superclass const Matrix4& l2w = localToWorld(); // If the light's AABB intersects the oriented AABB of this model instance, // add the light to our light list if (light.intersectsAABB(AABB::createFromOrientedAABB(_picoModel->localAABB(), l2w))) { _lights.addLight(light); } }
// Local helper inline void Surface_addLight(const MD5Surface& surface, render::lib::VectorLightList& lights, const Matrix4& localToWorld, const RendererLight& light) { if (light.intersectsAABB( AABB::createFromOrientedAABB(surface.localAABB(), localToWorld) ) ) { lights.addLight(light); } }
bool MD5ModelNode::intersectsLight(const RendererLight& light) const { return light.intersectsAABB(worldAABB()); }