PinOverModelExample::PinOverModelExample(
    Eegeo::Modules::Core::RenderingModule& renderingModule,
    Eegeo::Modules::IPlatformAbstractionModule& platformAbstractionModule,
    Eegeo::Modules::Map::MapModule& mapModule,
    Eegeo::Rendering::AsyncTexturing::IAsyncTextureRequestor& textureRequestor,
    Eegeo::Lighting::GlobalFogging& fogging,
    Eegeo::Rendering::Materials::NullMaterialFactory& nullMaterialFactory,
    Eegeo::Camera::GlobeCamera::GlobeCameraController* pCameraController,
    Eegeo::Camera::GlobeCamera::GlobeCameraTouchController& cameraTouchController,
    const Eegeo::Rendering::ScreenProperties& initialScreenProperties
)
	: GlobeCameraExampleBase(pCameraController, cameraTouchController)
    , m_pin0UserData("Pin Zero(0) User Data")
	,m_pPin0(NULL)
	,m_fileIO(platformAbstractionModule.GetFileIO())
	,m_textureRequestor(textureRequestor)
	,m_pModel(NULL)
	,m_globalFogging(fogging)
	,m_renderableFilters(renderingModule.GetRenderableFilters())
	,m_nullMaterialFactory(nullMaterialFactory)
    ,m_pNullMaterial(NULL)
{
    Eegeo::Helpers::ITextureFileLoader& textureLoader = platformAbstractionModule.GetTextureFileLoader();

	textureLoader.LoadTexture(m_pinIconsTexture, "pin_over_model_example/PinIconTexturePage.png", true);
	Eegeo_ASSERT(m_pinIconsTexture.textureId != 0);

	// This example uses a texture page containing 2 x 2 icons.
	// Increase the following number to use a texture page containing more icons
	// (e.g. 3 for a page containing 3 x 3 icons)
	int numberOfTilesAlongEachAxisOfTexturePage = 2;
	m_pPinIconsTexturePageLayout = Eegeo_NEW(Eegeo::Rendering::RegularTexturePageLayout)(numberOfTilesAlongEachAxisOfTexturePage);

	// The following values specify the size and shape of the Pins within the 3D world.
	int spriteWidthInMetres = 64;
	int spriteHeightInMetres = 64;

	// N.B. The implementation for PinModule is given in PinModule.h as a guide for Apps that
	// require an alternate configuration of the various Pin related components.
    m_pPinsModule = Eegeo::Pins::PinsModule::Create(
                                    renderingModule,
                                    platformAbstractionModule,
                                    mapModule,
                                    m_pinIconsTexture.textureId,
                                    *m_pPinIconsTexturePageLayout,
                                    Eegeo::Rendering::LayerIds::PlaceNames,
                                    spriteWidthInMetres,
                                    spriteHeightInMetres,
                                    initialScreenProperties,
                                    false);

	CreateExamplePins();
}
PinsExample::PinsExample(
    Eegeo::Modules::Core::RenderingModule& renderingModule,
    Eegeo::Modules::IPlatformAbstractionModule& platformAbstractionModule,
    Eegeo::Modules::Map::MapModule& mapModule,
    Eegeo::Rendering::EnvironmentFlatteningService& environmentFlatteningService,
    Eegeo::Camera::GlobeCamera::GlobeCameraController* pCameraController,
    Eegeo::Camera::GlobeCamera::GlobeCameraTouchController& cameraTouchController,
    const Eegeo::Rendering::ScreenProperties& initialScreenProperties
)
	: GlobeCameraExampleBase(pCameraController, cameraTouchController)
    , m_pin0UserData("Pin Zero(0) User Data")
	, m_pin1UserData("Pin One(1) User Data")
	, m_pin2UserData("Pin Two(2) User Data")
	, m_pin3UserData("Pin Three(3) User Data")
	, m_addRemoveTimer(0.0f)
	, m_pPin0(NULL)
{
    Eegeo::Helpers::ITextureFileLoader& textureLoader = platformAbstractionModule.GetTextureFileLoader();
    
	textureLoader.LoadTexture(m_pinIconsTexture, "pins_example/PinIconTexturePage.png", true);
	Eegeo_ASSERT(m_pinIconsTexture.textureId != 0);

	// This example uses a texture page containing 2 x 2 icons.
	// Increase the following number to use a texture page containing more icons
	// (e.g. 3 for a page containing 3 x 3 icons)
	int numberOfTilesAlongEachAxisOfTexturePage = 2;
	m_pPinIconsTexturePageLayout = Eegeo_NEW(Eegeo::Rendering::RegularTexturePageLayout)(numberOfTilesAlongEachAxisOfTexturePage);

	// The following values specify the size and shape of the Pins within the 3D world.
	int spriteWidthInMetres = 64;
	int spriteHeightInMetres = 64;

	// N.B. The implementation for PinModule is given in PinModule.h as a guide for Apps that
	// require an alternate configuration of the various Pin related components.
    m_pPinsModule = Eegeo::Pins::PinsModule::Create(
        renderingModule,
        platformAbstractionModule,
        mapModule,
        m_pinIconsTexture.textureId,
        *m_pPinIconsTexturePageLayout,
        Eegeo::Rendering::LayerIds::PlaceNames,
        spriteWidthInMetres,
        spriteHeightInMetres,
        initialScreenProperties,
        false);

	CreateExamplePins();
}