mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 08:09:19 +02:00
pre-merge renames
This commit is contained in:
71
skydome.h
71
skydome.h
@@ -1,71 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "gl/vao.h"
|
||||
#include "gl/shader.h"
|
||||
#include "gl/buffer.h"
|
||||
#include <memory>
|
||||
|
||||
// sky gradient based on "A practical analytic model for daylight"
|
||||
// by A. J. Preetham Peter Shirley Brian Smits (University of Utah)
|
||||
|
||||
class CSkyDome {
|
||||
public:
|
||||
CSkyDome( int const Tesselation = 54 );
|
||||
~CSkyDome();
|
||||
void Generate();
|
||||
void RebuildColors();
|
||||
|
||||
bool SetSunPosition( glm::vec3 const &Direction );
|
||||
|
||||
void SetTurbidity( const float Turbidity = 5.0f );
|
||||
void SetExposure( const bool Linearexposure, const float Expfactor );
|
||||
void SetOvercastFactor( const float Overcast = 0.0f );
|
||||
void SetGammaCorrection( const float Gamma = 2.2f );
|
||||
|
||||
// update skydome
|
||||
void Update( glm::vec3 const &Sun );
|
||||
// render skydome to screen
|
||||
void Render();
|
||||
|
||||
// retrieves average colour of the sky dome
|
||||
glm::vec3 GetAverageColor() { return m_averagecolour * 8.f / 6.f; }
|
||||
glm::vec3 GetAverageHorizonColor() { return m_averagehorizoncolour; }
|
||||
|
||||
private:
|
||||
// shading parametrs
|
||||
glm::vec3 m_sundirection;
|
||||
float m_thetasun, m_phisun;
|
||||
float m_turbidity;
|
||||
bool m_linearexpcontrol;
|
||||
float m_expfactor;
|
||||
float m_overcast;
|
||||
float m_gammacorrection;
|
||||
glm::vec3 m_averagecolour;
|
||||
glm::vec3 m_averagehorizoncolour;
|
||||
|
||||
// data
|
||||
int const m_tesselation;
|
||||
std::vector<glm::vec3> m_vertices;
|
||||
std::vector<std::uint16_t> m_indices;
|
||||
// std::vector<float3> m_normals;
|
||||
std::vector<glm::vec3> m_colours;
|
||||
|
||||
static float m_distributionluminance[ 5 ][ 2 ];
|
||||
static float m_distributionxcomp[ 5 ][ 2 ];
|
||||
static float m_distributionycomp[ 5 ][ 2 ];
|
||||
|
||||
static float m_zenithxmatrix[ 3 ][ 4 ];
|
||||
static float m_zenithymatrix[ 3 ][ 4 ];
|
||||
|
||||
// coloring
|
||||
void GetPerez( float *Perez, float Distribution[ 5 ][ 2 ], const float Turbidity );
|
||||
float GetZenith( float Zenithmatrix[ 3 ][ 4 ], const float Theta, const float Turbidity );
|
||||
float PerezFunctionO1( float Perezcoeffs[ 5 ], const float Thetasun, const float Zenithval );
|
||||
float PerezFunctionO2( float Perezcoeffs[ 5 ], const float Icostheta, const float Gamma, const float Cosgamma2, const float Zenithval );
|
||||
|
||||
std::optional<gl::buffer> m_vertexbuffer;
|
||||
std::optional<gl::buffer> m_indexbuffer;
|
||||
std::optional<gl::buffer> m_coloursbuffer;
|
||||
std::optional<gl::program> m_shader;
|
||||
std::optional<gl::vao> m_vao;
|
||||
};
|
||||
Reference in New Issue
Block a user