16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 17:09:19 +02:00

indexed geometry tangent calculation, explicit optional material parameters, uint8 serialization fix

This commit is contained in:
tmj-fstate
2020-10-20 17:23:58 +02:00
parent ccfdf5e003
commit f9a8c1fbb3
7 changed files with 35 additions and 25 deletions

View File

@@ -1736,7 +1736,7 @@ gfx::geometry_handle opengl33_renderer::Insert( gfx::index_array &Indices, gfx::
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
gfx::geometry_handle opengl33_renderer::Insert(gfx::vertex_array &Vertices, gfx::geometrybank_handle const &Geometry, int const Type)
{
gfx::calculate_tangents(Vertices, Type);
gfx::calculate_tangents(Vertices, gfx::index_array(), Type);
return m_geometry.create_chunk(Vertices, Geometry, Type);
}
@@ -1744,7 +1744,7 @@ gfx::geometry_handle opengl33_renderer::Insert(gfx::vertex_array &Vertices, gfx:
// replaces data of specified chunk with the supplied vertex data, starting from specified offset
bool opengl33_renderer::Replace(gfx::vertex_array &Vertices, gfx::geometry_handle const &Geometry, int const Type, std::size_t const Offset)
{
gfx::calculate_tangents(Vertices, Type);
gfx::calculate_tangents(Vertices, gfx::index_array(), Type);
return m_geometry.replace(Vertices, Geometry, Offset);
}
@@ -1752,7 +1752,7 @@ bool opengl33_renderer::Replace(gfx::vertex_array &Vertices, gfx::geometry_handl
// adds supplied vertex data at the end of specified chunk
bool opengl33_renderer::Append(gfx::vertex_array &Vertices, gfx::geometry_handle const &Geometry, int const Type)
{
gfx::calculate_tangents(Vertices, Type);
gfx::calculate_tangents(Vertices, gfx::index_array(), Type);
return m_geometry.append(Vertices, Geometry);
}
@@ -1863,17 +1863,17 @@ void opengl33_renderer::Bind_Material( material_handle const Material, TSubModel
if( entry.size == 1 ) {
// HACK: convert color to luminosity, if it's passed as single value
src == glm::vec4 { colors::RGBtoHSV( glm::vec3 { src } ).z };
src = glm::vec4 { colors::RGBtoHSV( glm::vec3 { src } ).z };
}
for (size_t j = 0; j < entry.size; j++)
model_ubs.param[entry.location][entry.offset + j] = src[j];
}
if( !std::isnan( material.opacity ) ) {
if( material.opacity ) {
model_ubs.opacity = (
m_blendingenabled ?
-material.opacity :
material.opacity );
-material.opacity.value() :
material.opacity.value() );
}
else {
model_ubs.opacity = (