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();
}
	PinsWithAttachedJavaUIExample::PinsWithAttachedJavaUIExample(
							Eegeo::EegeoWorld& world,
							AndroidNativeState& nativeState,
							Eegeo::Rendering::RenderContext& renderContext,
                            Eegeo::Helpers::ITextureFileLoader& textureLoader,
                            Eegeo::Rendering::GlBufferPool& glBufferPool,
                            Eegeo::Rendering::Shaders::ShaderIdGenerator& shaderIdGenerator,
                            Eegeo::Rendering::Materials::MaterialIdGenerator& materialIdGenerator,
                            Eegeo::Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool,
                            Eegeo::Rendering::VertexLayouts::VertexLayoutPool& vertexLayoutPool,
                            Eegeo::Rendering::RenderableFilters& renderableFilters,
                            const Eegeo::Camera::ICameraProvider& cameraProvider,
                            Eegeo::Resources::Terrain::Heights::TerrainHeightProvider& terrainHeightProvider,
                            Eegeo::Rendering::EnvironmentFlatteningService& environmentFlatteningService
                            )
	: m_nativeState(nativeState)
	, m_renderContext(renderContext)
	, m_world(world)
    , m_pinUserData("Pin User Data")
    {
        textureLoader.LoadTexture(m_pinIconsTexture, "PinIconTexturePage.png", true);
        Eegeo_ASSERT(m_pinIconsTexture.textureId != 0);

        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 = 100;
        int spriteHeightInMetres = 100;

        m_pPinsModule = Eegeo_NEW(Eegeo::Pins::PinsModule)(
        		m_pinIconsTexture.textureId,
        		*m_pPinIconsTexturePageLayout,
        		glBufferPool,
				shaderIdGenerator,
				materialIdGenerator,
				vertexBindingPool,
				vertexLayoutPool,
				renderableFilters,
				cameraProvider,
				terrainHeightProvider,
				spriteWidthInMetres,
				spriteHeightInMetres,
				Eegeo::Rendering::LayerIds::PlaceNames,
				environmentFlatteningService);

        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();
}
    PinOverModelExample::PinOverModelExample(
                                             Eegeo::Helpers::ITextureFileLoader& textureLoader,
                                             Eegeo::Rendering::GlBufferPool& glBufferPool,
                                             Eegeo::Rendering::Shaders::ShaderIdGenerator& shaderIdGenerator,
                                             Eegeo::Rendering::Materials::MaterialIdGenerator& materialIdGenerator,
                                             Eegeo::Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool,
                                             Eegeo::Rendering::VertexLayouts::VertexLayoutPool& vertexLayoutPool,
                                             Eegeo::Rendering::RenderableFilters& renderableFilters,
                                             const Eegeo::Camera::ICameraProvider& cameraProvider,
                                             Eegeo::Resources::Terrain::Heights::TerrainHeightProvider& terrainHeightProvider,
                                             Eegeo::Rendering::EnvironmentFlatteningService& environmentFlatteningService,
                                             Eegeo::Rendering::RenderContext& renderContext,
                                             Eegeo::Helpers::IFileIO& fileIO,
                                             Eegeo::Rendering::AsyncTexturing::IAsyncTextureRequestor& textureRequestor,
                                             Eegeo::Lighting::GlobalFogging& fogging,
                                             Eegeo::Rendering::Materials::NullMaterial& nullMat
                                             )
    : m_pin0UserData("Pin Zero(0) User Data")
    , m_pPin0(NULL)
    , renderContext(renderContext)
    ,fileIO(fileIO)
    ,textureRequestor(textureRequestor)
    ,pModel(NULL)
    ,globalFogging(fogging)
    ,renderableFilters(renderableFilters)
    ,nullMat(nullMat)
    {
        textureLoader.LoadTexture(m_pinIconsTexture, "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 = 100;
        int spriteHeightInMetres = 100;

        // 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_NEW(Eegeo::Pins::PinsModule)(
                                                           m_pinIconsTexture.textureId,
                                                           *m_pPinIconsTexturePageLayout,
                                                           glBufferPool,
                                                           shaderIdGenerator,
                                                           materialIdGenerator,
                                                           vertexBindingPool,
                                                           vertexLayoutPool,
                                                           renderableFilters,
                                                           cameraProvider,
                                                           terrainHeightProvider,
                                                           spriteWidthInMetres,
                                                           spriteHeightInMetres,
                                                           Eegeo::Rendering::LayerIds::PlaceNames,
                                                           environmentFlatteningService
                                                           );

        CreateExamplePins();
    }