16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 17:29:18 +02:00

build 170628. enabled support for specular component in lighting calculations

This commit is contained in:
tmj-fstate
2017-06-28 21:02:54 +02:00
parent 8e37307ff5
commit 49aad85597
20 changed files with 249 additions and 198 deletions

View File

@@ -1,8 +1,5 @@
#pragma once
#include "dumb3d.h"
#include "float3d.h"
// sky gradient based on "A practical analytic model for daylight"
// by A. J. Preetham Peter Shirley Brian Smits (University of Utah)
@@ -13,7 +10,7 @@ public:
void Generate();
void RebuildColors();
bool SetSunPosition( Math3D::vector3 const &Direction );
bool SetSunPosition( glm::vec3 const &Direction );
void SetTurbidity( const float Turbidity = 5.0f );
void SetExposure( const bool Linearexposure, const float Expfactor );
@@ -21,30 +18,30 @@ public:
void SetGammaCorrection( const float Gamma = 2.2f );
// update skydome
void Update( Math3D::vector3 const &Sun );
void Update( glm::vec3 const &Sun );
// render skydome to screen
void Render();
// retrieves average colour of the sky dome
float3 GetAverageColor() { return m_averagecolour; }
glm::vec3 GetAverageColor() { return m_averagecolour; }
private:
// shading parametrs
float3 m_sundirection;
glm::vec3 m_sundirection;
float m_thetasun, m_phisun;
float m_turbidity;
bool m_linearexpcontrol;
float m_expfactor;
float m_overcast;
float m_gammacorrection;
float3 m_averagecolour;
glm::vec3 m_averagecolour;
// data
int const m_tesselation;
std::vector<float3> m_vertices;
std::vector<glm::vec3> m_vertices;
std::vector<std::uint16_t> m_indices;
// std::vector<float3> m_normals;
std::vector<float3> m_colours;
std::vector<glm::vec3> m_colours;
GLuint m_vertexbuffer{ (GLuint)-1 };
GLuint m_indexbuffer{ (GLuint)-1 };
GLuint m_coloursbuffer{ (GLuint)-1 };