mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 01:39:20 +02:00
Editor terrain: area fill with blurred or sharp edge, texture rotation
This commit is contained in:
@@ -289,6 +289,10 @@ material_handle opengl33_terrain_materials::make(material_handle const Reuse, st
|
||||
table[i * 4 + 2] = layer.normalmap ? 1.f : 0.f;
|
||||
table[i * 4 + 3] = layer.specgloss ? 1.f : 0.f;
|
||||
table[(max_layers + i) * 4 + 0] = layer.reflection;
|
||||
// the textures turned by the layer of the chunk (the same material can be turned differently in another layer)
|
||||
auto const angle{glm::radians(static_cast<double>(Layers[i].rotation))};
|
||||
table[(max_layers + i) * 4 + 1] = static_cast<float>(std::cos(angle));
|
||||
table[(max_layers + i) * 4 + 2] = static_cast<float>(std::sin(angle));
|
||||
}
|
||||
bind_for_upload(m_textures.texture(entry.table));
|
||||
::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, static_cast<GLsizei>(max_layers), 2, 0, GL_RGBA, GL_FLOAT, table.data());
|
||||
|
||||
@@ -28,6 +28,7 @@ struct terrain_layer
|
||||
{
|
||||
material_handle material{null_handle};
|
||||
float size{0.f};
|
||||
float rotation{0.f}; // degrees the textures are turned by
|
||||
};
|
||||
} // namespace gfx
|
||||
|
||||
|
||||
Reference in New Issue
Block a user