/***********      .---.         .-"-.      *******************\
* -------- *     /   ._.       / ´ ` \     * ---------------- *
* Author's *     \_  (__\      \_°v°_/     * humus@rogers.com *
*   note   *     //   \\       //   \\     * ICQ #47010716    *
* -------- *    ((     ))     ((     ))    * ---------------- *
*          ****--""---""-------""---""--****                  ********\
* This file is a part of the work done by Humus. You are free to use  *
* the code in any way you like, modified, unmodified or copy'n'pasted *
* into your own work. However, I expect you to respect these points:  *
*  @ If you use this file and its contents unmodified, or use a major *
*    part of this file, please credit the author and leave this note. *
*  @ For use in anything commercial, please request my approval.      *
*  @ Share your work and ideas too as much as you can.                *
\*********************************************************************/

#include "../Framework3/Direct3D/D3DApp.h"
#include "../Framework3/Util/Model.h"
#include "../Framework3/Util/BSP.h"
#include "../Framework3/Util/TexturePacker.h"

#define COMPUTE_LIGHTMAP
#define L_SAMPLE_COUNT 32
#define O_SAMPLE_COUNT 1
//#define L_SAMPLE_COUNT 512
//#define O_SAMPLE_COUNT 4096

class App : public D3DApp {
public:
	char *getTitle() const { return "Selective supersampling"; }

	void moveCamera(const vec3 &dir);
	void resetCamera();

	bool onKey(const uint key, const bool pressed);

	bool init();
	void exit();

	bool load();
	void unload();

	void drawEnvironment(const float4x4 &mvp);
	void drawFrame();

protected:
	Model *map;
	BSP bsp;

	vec3 lightDir;
	int sampleMode;
	bool wobbleView;
	bool useDynamicBranching;

	VertexFormatID sbVF;

	ShaderID lighting[12], skyBox;
	TextureID base[3], bump[3], lightMap, env;
	SamplerStateID trilinearAniso, bilinear;
};
