Радиус действия источника
This commit is contained in:
@@ -97,6 +97,7 @@ void Light::toData()
|
||||
|
||||
data[index].position = glm::vec3(result_transform[3]); // Позиция из матрицы трансформации
|
||||
data[index].color = color; // Цвет
|
||||
data[index].radius = radius; // Радиус действия источника
|
||||
}
|
||||
|
||||
// Возвращает ссылку на новый источник света
|
||||
@@ -143,7 +144,7 @@ Light& Light::findByIndex(GLuint index)
|
||||
}
|
||||
|
||||
// Конструктор без параметров
|
||||
Light::Light() : Node(), index(-1), uploadReq(false), color(1.0f)
|
||||
Light::Light() : Node(), index(-1), uploadReq(false), color(1.0f), radius(10.0f)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -157,6 +158,7 @@ Light& Light::operator=(const Light& other)
|
||||
index = other.index; // Переносим индекс
|
||||
uploadReq = other.uploadReq; // Необходимость загрузки
|
||||
color = other.color;
|
||||
radius = other.radius;
|
||||
|
||||
Node::operator=(other);
|
||||
}
|
||||
@@ -186,3 +188,17 @@ void Light::render(ShaderProgram &shaderProgram, UBO &material_buffer)
|
||||
bulb.render(shaderProgram, material_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
// Константный доступ к радиусу
|
||||
const float& Light::c_radius() const
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
|
||||
// Неконстантная ссылка для изменений радиуса
|
||||
float& Light::e_radius()
|
||||
{
|
||||
uploadReq = true;
|
||||
|
||||
return radius;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user