17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 08:39:19 +02:00
Files
maszyna/rendering/openglcolor.cppm
maj00r b8f040e6fd propagate template headers transitively, import Console where used
AnimModel.cpp reaches cParser through the simulation core, not a direct
import, so the previous pass missed it; the propagation now follows the
whole import closure. Train.cpp, drivermode.cpp and Globals.cpp call
Console:: inside _WIN32 guards without importing eu07.console - invisible
on Linux, where those blocks are skipped.
2026-09-10 01:41:24 +02:00

91 lines
2.0 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
// encapsulation of the fixed pipeline opengl color
module;
#include <array>
#include <chrono>
#include <cstddef>
#include <deque>
#include <limits>
#include <mutex>
#include <sstream>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
#include <ostream>
#include <string>
#include <glad/glad.h>
#include "utilities/Globals_macros.h"
export module eu07.rendering.openglcolor;
import eu07.glm;
import eu07.utilities.globals;
export {
class opengl_color {
public:
// constructors:
opengl_color() = default;
// methods:
inline
void
color3( glm::vec3 const &Color ) {
return color4( glm::vec4{ Color, 1.f } ); }
inline
void
color3( float const Red, float const Green, float const Blue ) {
return color3( glm::vec3 { Red, Green, Blue } ); }
inline
void
color3( float const *Value ) {
return color3( glm::make_vec3( Value ) ); }
inline
void
color4( glm::vec4 const &Color ) {
if( ( Color != m_color ) || ( false == Global.bUseVBO ) ) {
m_color = Color;
::glColor4fv( glm::value_ptr( m_color ) ); } }
inline
void
color4( float const Red, float const Green, float const Blue, float const Alpha ) {
return color4( glm::vec4{ Red, Green, Blue, Alpha } ); }
inline
void
color4( float const *Value ) {
return color4( glm::make_vec4( Value ) );
}
inline
glm::vec4 const &
data() const {
return m_color; }
inline
float const *
data_array() const {
return glm::value_ptr( m_color ); }
private:
// members:
glm::vec4 m_color { -1 };
};
extern opengl_color OpenGLColor;
//---------------------------------------------------------------------------
} // export