gltut / Tut 12 Dynamic Range / Lights.h

#ifndef LIGHTS_H
#define LIGHTS_H

#include <map>
#include "../framework/Timer.h"
#include <glm/glm.hpp>
#include "../framework/Interpolators.h"

struct PerLight
	glm::vec4 cameraSpaceLightPos;
	glm::vec4 lightIntensity;

const int NUMBER_OF_LIGHTS = 4;

struct LightBlock
	glm::vec4 ambientIntensity;
	float lightAttenuation;
	float padding[3];
	PerLight lights[NUMBER_OF_LIGHTS];

struct SunlightValue
	float normTime;
	glm::vec4 ambient;
	glm::vec4 sunlightIntensity;
	glm::vec4 backgroundColor;

enum TimerTypes

class LightManager

	void SetSunlightValues(const std::vector<SunlightValue> &values);
	void SetSunlightValues(SunlightValue *pValues, int iSize);

	void UpdateTime();
	void TogglePause(TimerTypes eTimer);
	void SetPause(TimerTypes eTimer, bool pause = true);
	bool IsPaused(TimerTypes eTimer) const;

	void RewindTime(TimerTypes eTimer, float secRewind);
	void FastForwardTime(TimerTypes eTimer, float secRewind);

	LightBlock GetLightPositions(const glm::mat4 &worldToCameraMat) const;
	glm::vec4 GetBackgroundColor() const;

	glm::vec4 GetSunlightDirection() const;
	glm::vec4 GetSunlightIntensity() const;

	int GetNumberOfPointLights() const;
	glm::vec3 GetWorldLightPosition(int iLightIx) const;
	void SetPointLightIntensity(int iLightIx, const glm::vec4 &intensity);
	glm::vec4 GetPointLightIntensity(int iLightIx) const;

	void CreateTimer(const std::string &timerName, Framework::Timer::Type eType, float fDuration);
	float GetTimerValue(const std::string &timerName) const;
	float GetSunTime() const;

	typedef Framework::ConstVelLinearInterpolator<glm::vec3> LightInterpolator;
	typedef std::map<std::string, Framework::Timer> ExtraTimerMap;

	Framework::Timer m_sunTimer;
	Framework::TimedLinearInterpolator<glm::vec4> m_ambientInterpolator;
	Framework::TimedLinearInterpolator<glm::vec4> m_backgroundInterpolator;
	Framework::TimedLinearInterpolator<glm::vec4> m_sunlightInterpolator;

	std::vector<LightInterpolator> m_lightPos;
	std::vector<glm::vec4> m_lightIntensity;
	std::vector<Framework::Timer> m_lightTimers;
	ExtraTimerMap m_extraTimers;

#endif //LIGHTS_H
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.