add blend
This commit is contained in:
parent
d2605d9108
commit
bc49540a95
@ -54,9 +54,22 @@ namespace ZL {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& particle : particles) {
|
||||
if (!particle.active) continue;
|
||||
std::vector<std::pair<const SparkParticle*, float>> sortedParticles;
|
||||
sortedParticles.reserve(getActiveParticleCount());
|
||||
|
||||
for (const auto& particle : particles) {
|
||||
if (particle.active) {
|
||||
sortedParticles.push_back({ &particle, particle.position.v[2] });
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(sortedParticles.begin(), sortedParticles.end(),
|
||||
[](const auto& a, const auto& b) {
|
||||
return a.second > b.second;
|
||||
});
|
||||
|
||||
for (const auto& [particlePtr, depth] : sortedParticles) {
|
||||
const auto& particle = *particlePtr;
|
||||
Vector3f pos = particle.position;
|
||||
float size = 0.04f * particle.scale;
|
||||
|
||||
@ -116,6 +129,9 @@ namespace ZL {
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture->getTexID());
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);// Аддитивное смешивание для эффекта свечения
|
||||
|
||||
renderer.PushMatrix();
|
||||
renderer.LoadIdentity();
|
||||
renderer.TranslateMatrix({ 0, 0, -1.0f * zoom });
|
||||
@ -124,6 +140,9 @@ namespace ZL {
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
renderer.DisableVertexAttribArray(vPositionName);
|
||||
renderer.DisableVertexAttribArray(vTexCoordName);
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user