/***********      .---.         .-"-.      ******************\
* -------- *     /   ._.       / ´ ` \     * --------------- *
* Author's *     \_  (__\      \_°v°_/     * humus@comhem.se *
*   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/Direct3D10/D3D10App.h"
#include "../Framework3/Util/Model.h"

#define BUILDING_COUNT 16

struct Building {
	Building(){}
	Building(const float x, const float z, const float sx, const float sy, const float sz){
		pos.x = x;
		pos.y = z;
		size.x = sx;
		size.y = sy;
		size.z = sz;
	}
	float2 pos;
	float3 size;

	// For sorting
	float distance;

	bool operator < (const Building &other){
		return distance < other.distance;
	}
};

class App : public D3D10App {
public:
	char *getTitle() const { return "Interior Mapping"; }

	void resetCamera();

	bool init();
	void exit();

	bool load();
	void unload();

	void drawFrame();

protected:
	ShaderID walls, ceiling, ground, stars;

	TextureID cube, wallTex, ceilingTex, groundTex;
	SamplerStateID cubeFilter, anisoFilter;

	VertexBufferID boxVB;
	IndexBufferID  boxIB;
	VertexFormatID boxVF;

	DepthStateID depthLessEqual;

	Building buildings[BUILDING_COUNT];

	Slider *lightsSlider;
};
