Is there anyway to get this working without C++11 ? I'm trying to use boost to replace unordered_set but unique_ptr does not exists and I was wondering if an auto_ptr would be enough. Anyway it would be great to have this also working for non C++11 compilers. I also noticed some errors at compilation like determining a class a friend of himself.
Thanks, keep up the good work!
Edit: I tried what I said and I managed to correctly launch the example you provide. But I still don't know if an auto_ptr is enough for you or not. I can upload what I modified if you want. I really like your light and being able to use it would be great!
Edit: There are a lot of warning I'm trying to correct, also not used variables like m_render in convexhull and not initialized variables on constructors. Not initialized variables may give unexpected behaviours
Edit: I found this portion of code weird:
void Light_Point::RenderLightSolidPortion()
{
float renderIntensity = m_intensity;
// Clamp the render intensity
if(renderIntensity > 1.0f)
renderIntensity = 1.0f;
assert(renderIntensity >= 0.0f);
float r = m_color.r * m_intensity;
float g = m_color.g * m_intensity;
float b = m_color.b * m_intensity;
glBegin(GL_TRIANGLE_FAN);
glVertex2f(m_center.x, m_center.y);
// Set the edge color for rest of shape
int numSubdivisions = static_cast<int>(m_spreadAngle / m_lightSubdivisionSize);
float startAngle = m_directionAngle - m_spreadAngle / 2.0f;
for(int currentSubDivision = 0; currentSubDivision <= numSubdivisions; currentSubDivision++)
{
float angle = startAngle + currentSubDivision * m_lightSubdivisionSize;
glVertex2f(m_radius * cosf(angle) + m_center.x, m_radius * sinf(angle) + m_center.y);
}
glEnd();
}
You don't use the color created, also why calculating renderIntensity and then use m_itensity? Is that what you meant to write? :
...
Color3f(m_color.r * renderIntensity, m_color.g * renderIntensity, m_color.b * renderIntensity).GL_Set();
glBegin(....