void Light::sync(GLuint handle, std::size_t lightID) { auto lightRef = "lights[" + std::to_string(lightID) + "]"; GLint posLoc = glGetUniformLocation(handle, (lightRef + ".position").c_str()); glUniform3fv(posLoc, 1, glm::value_ptr(getPosition())); GLint colorLoc = glGetUniformLocation(handle, (lightRef + ".color").c_str()); glUniform3fv(colorLoc, 1, glm::value_ptr(getColor())); GLint powerLoc = glGetUniformLocation(handle, (lightRef + ".power").c_str()); float power = isEmitting() ? getPower() : 0; glUniform1f(powerLoc, power); //std::cout << handle << " " << lightID << " " << nLights_ << " " << posLoc << " " << colorLoc << " " << powerLoc << std::endl; if (posLoc < 0 || colorLoc < 0 || powerLoc < 0) throw std::runtime_error("Unable to find Light uniform variables!"); }
bool CC3ParticleEmitter::isActive() { return isEmitting() || m_particleCount > 0; }