| 118 | } |
| 119 | |
| 120 | void SetLightInstance(HRenderContext render_context, HLightInstance instance, dmVMath::Point3 position, dmVMath::Quat rotation) |
| 121 | { |
| 122 | LightInstance* light_instance = render_context->m_RenderLights.Get(instance); |
| 123 | if (!light_instance) |
| 124 | { |
| 125 | return; |
| 126 | } |
| 127 | |
| 128 | dmVMath::Vector3 direction = dmVMath::Rotate(rotation, light_instance->m_LightPrototype->m_Direction); |
| 129 | bool needs_commit = !Vector3Equals(dmVMath::Vector3(position), dmVMath::Vector3(light_instance->m_Position)) || !Vector3Equals(direction, light_instance->m_Direction); |
| 130 | |
| 131 | light_instance->m_Position = position; |
| 132 | light_instance->m_Direction = direction; |
| 133 | |
| 134 | if (needs_commit) |
| 135 | { |
| 136 | CommitLightInstance(render_context, light_instance); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | //////////////////////////////// |
| 141 | // Light buffer |