mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 19:09:18 +02:00
virtual opengl color, overcast level based tweaks to light glare and freespot strength, precipitation based fog density adjustment, overcast level included in the light activation threshold
This commit is contained in:
69
openglcolor.h
Normal file
69
openglcolor.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
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/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// encapsulation of the fixed pipeline opengl color
|
||||
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 ) {
|
||||
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;
|
||||
|
||||
// NOTE: standard opengl calls re-definitions
|
||||
#define glColor3f OpenGLColor.color3
|
||||
#define glColor3fv OpenGLColor.color3
|
||||
#define glColor4f OpenGLColor.color4
|
||||
#define glColor4fv OpenGLColor.color4
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user