mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
heating power source fix, particle color support
This commit is contained in:
16
renderer.cpp
16
renderer.cpp
@@ -142,6 +142,12 @@ opengl_particles::update( opengl_camera const &Camera ) {
|
||||
particle_vertex vertex;
|
||||
for( auto const &source : sources ) {
|
||||
|
||||
auto const particlecolor {
|
||||
glm::clamp(
|
||||
source.second.color()
|
||||
* ( glm::vec3 { Global.DayLight.ambient } + 0.35f * glm::vec3{ Global.DayLight.diffuse } )
|
||||
* 255.f,
|
||||
glm::vec3{ 0.f }, glm::vec3{ 255.f } ) };
|
||||
auto const &particles { source.second.sequence() };
|
||||
// TODO: put sanity cap on the overall amount of particles that can be drawn
|
||||
auto const sizestep { 256.0 * billboard_vertices.size() };
|
||||
@@ -149,9 +155,9 @@ opengl_particles::update( opengl_camera const &Camera ) {
|
||||
sizestep * std::ceil( m_particlevertices.size() + ( particles.size() * billboard_vertices.size() ) / sizestep ) );
|
||||
for( auto const &particle : particles ) {
|
||||
// TODO: particle color support
|
||||
vertex.color[ 0 ] =
|
||||
vertex.color[ 1 ] =
|
||||
vertex.color[ 2 ] = static_cast<std::uint8_t>( Global.fLuminance * 32 );
|
||||
vertex.color[ 0 ] = static_cast<std::uint_fast8_t>( particlecolor.r );
|
||||
vertex.color[ 1 ] = static_cast<std::uint_fast8_t>( particlecolor.g );
|
||||
vertex.color[ 2 ] = static_cast<std::uint_fast8_t>( particlecolor.b );
|
||||
vertex.color[ 3 ] = clamp<std::uint8_t>( particle.opacity * 255, 0, 255 );
|
||||
|
||||
auto const offset { glm::vec3{ particle.position - Camera.position() } };
|
||||
@@ -3157,6 +3163,10 @@ opengl_renderer::Render_particles() {
|
||||
|
||||
Bind_Texture( m_smoketexture );
|
||||
m_particlerenderer.render( m_diffusetextureunit );
|
||||
if( Global.bUseVBO ) {
|
||||
// shouldn't be strictly necessary but, eh
|
||||
gfx::opengl_vbogeometrybank::reset();
|
||||
}
|
||||
|
||||
::glDepthMask( GL_TRUE );
|
||||
::glEnable( GL_LIGHTING );
|
||||
|
||||
Reference in New Issue
Block a user