Esempio n. 1
0
    /*************************************************************//**
     *
     *  @brief  残りのロード処理を行う
     *  @param  なし
     *  @return 正常終了:true
     *  @return 異常終了:false
     *
     ****************************************************************/
    bool C_PauseScene::RemainLoadProcess()
    {
        // UI用カメラを取得
        assert(Camera::C_CameraManager::s_GetInstance()->GetCamera(ID::Camera::s_pUI));
        pUiCamera_ = Camera::C_CameraManager::s_GetInstance()->GetCamera(ID::Camera::s_pUI).get();

        // 各テクスチャの作成
        const char* pTexturePathList[] =
        {
            Path::Texture::s_pPAUSE_BACKGROUND,
        };

        for (size_t i = 0, arraySize = Common::C_CommonHelper::s_ArraySize(pTexturePathList); i < arraySize; ++i)
        {
            if (!Texture::C_TextureManager::s_GetInstance()->GetTextureData(pTexturePathList[i]))
            {
                if (Texture::C_TextureManager::s_GetInstance()->Create2DFromFile(pTexturePathList[i]) == false) return false;
            }
        }

        // 各スプライトクリエイターを作成
        const char* pSpriteIdList[] = 
        {
            ID::Sprite::s_pPAUSE_BACKGROUND,
        };

        const char* pSpriteTextureDataIdList[] =
        {
            Path::Texture::s_pPAUSE_BACKGROUND,
        };

        const float spritePriorityList[] =
        {
            Priority::Sprite::s_BACKGROUND,
        };

        for (size_t i = 0, arraySize = Common::C_CommonHelper::s_ArraySize(pSpriteIdList); i < arraySize; ++i)
        {
            if (!Sprite::C_SpriteCreaterManager::s_GetInstance()->GetSpriteCreater(pSpriteIdList[i]))
            {
                auto pTextureData = Texture::C_TextureManager::s_GetInstance()->GetTextureData(pSpriteTextureDataIdList[i]);
                assert(pTextureData);

                if (Sprite::C_SpriteCreaterManager::s_GetInstance()->Create(pSpriteIdList[i], pUiCamera_, pTextureData.get(), 3, spritePriorityList[i]) == false) return false;
               
                // カメラのタイプを正投影に設定
                auto pSpriteCreater = Sprite::C_SpriteCreaterManager::s_GetInstance()->GetSpriteCreater(pSpriteIdList[i]).get().lock();
                pSpriteCreater->SetCameraType(Camera::ORTHOGRAPHIC);
            }
        }

        Sprite::C_SpriteCreaterManager::s_GetInstance()->Sort();

        return true;
    }
Esempio n. 2
0
void NetworkPanel::SetInfo(INFO_DATA* pInfo)
{
	memcpy(&m_InfoData,pInfo,sizeof(INFO_DATA));
	FillInfoData();
//	static bool bFirst=true;
	if(m_bFirst)
	{
		SetCameraType(m_InfoData.btType);
		m_bFirst=false;
	}
}
Esempio n. 3
0
/* This is the main camera initialization function and must be called before StartFrameCapture is called, or any
 * attempts to write to the camera I2C interface.  This function will set the PLB burst size, perform a hard reset
 * test the I2C to discover which sensor is being used, and then configure the sensor appropriately.  This way,
 * the sensor can be swapped out without any software changes.  There is a section in this init code for both
 * types of sensors, so make sure it is configuring both sensors the way you want.  Once this init code is finished
 * the sensor is ready to capture data, but this code does NOT assert a start capture, that is left to the user */
void Init_Camera()
{
	/* camera-independent defaults */
	SetPLBBurstSize(512);
	SetPixelOutputFormat(VISION_SAVE_OPTIONS_CAM_BYTES_ALL);  //both bytes, this only changes if you want grayscale from the MT9V111
	SetCameraSerialAddress(0xB8);

	CameraHardReset();
	ClockDelay(100000000);  //wait for camera to come back online
	ClockDelay(100000000);  //wait for camera to come back online
	ClockDelay(100000000);  //wait for camera to come back online
	Xuint16 CameraVersion = ReadCameraRegister(0xFF);
	//Xuint16 CameraVersion = 0x1324;
	xil_printf("Chip Version: %x\n\r", CameraVersion);
	Xuint8 spiaddr = 0;
	int timeout = 0;
	xil_printf("waiting for camera I2C interface...");
	/*while(CameraVersion != 0x823A && CameraVersion != 0x1324)
	{
		SetCameraSerialAddress(spiaddr++);
		CameraVersion = ReadCameraRegister(0xFF);
		xil_printf("%x.%x.\n", spiaddr, CameraVersion);
		ClockDelay(100000);  //wait for camera to come back online
		timeout++;
		if( CameraVersion == 0 )
		{
			SetCameraSerialAddress(0xB8);
			CameraVersion = ReadCameraRegister(0xFF);
			break;
		}
	}*/
	SetCameraSerialAddress(0xE0);				//I have no idea why but this is important
	CameraVersion = ReadCameraRegister(0xFF);
	SetCameraSerialAddress(0xB8);
	CameraVersion = ReadCameraRegister(0xFF);
	//CameraVersion = 0x1324;		// we're currently having some trouble finding this camera
	if(CameraVersion == 0)	//probably the MT9V111, make sure...
	{
		SelectSensorRegisterBank(); //in case we're using the MT9V111
	}
	xil_printf("Found camera version %x\r\n", CameraVersion);
	
	switch(CameraVersion)
	{
		case 0x823A:
		case 0x0:
			xil_printf("Using MT9V111 image sensor\r\n");
			DAUGHTER_BOARD = DAUGHTER_BOARD_GBV;
		break;
		case 0x1324:
			xil_printf("Using MT9V024 image sensor\r\n");
			DAUGHTER_BOARD = DAUGHTER_BOARD_GAME;
		break;
		default:
			xil_printf("ERROR, camera version %x NOT SUPPORTED\r\n", CameraVersion);
	}		
	xil_printf("Done!\r\n");	
	SetCameraType(DAUGHTER_BOARD);
	ResetCameraCore();
	ResetCameraSensor();

if (DAUGHTER_BOARD == DAUGHTER_BOARD_GBV)
	{
		SelectSensorRegisterBank();
		SelectIPFRegisterBank();
		WriteCameraRegister(0xA7, FRAME_WIDTH);
		WriteCameraRegister(0xAA, FRAME_HEIGHT);					

		// Reset camera's image flow processor
		WriteCameraRegister(0x05, 0);     // Turn off sharpenning
		WriteCameraRegister(0x08,0xD800); //set output to RGB
		WriteCameraRegister(0x3A,0x00);   //set output to RGB565

		xil_printf("Selecting Core register set\r\n");
		SelectSensorRegisterBank();
		xil_printf("Camera version: %0x\r\n", ReadCameraRegister(0x36));
		SelectIPFRegisterBank();
		xil_printf("Window width: %0d\r\n", ReadCameraRegister(0xA7)); //seems to default to 647, 487???
		xil_printf("Window height: %0d\r\n", ReadCameraRegister(0xAA));
		xil_printf("Output Register1: %x\r\n", ReadCameraRegister(0x08));
		xil_printf("Output Register2: %x\r\n", ReadCameraRegister(0x3A));
		//DisplayTestPattern(XPAR_PLB_VISION_0_BASEADDR);
		//DisableTestPattern(XPAR_PLB_VISION_0_BASEADDR);
	}	
else if (DAUGHTER_BOARD == DAUGHTER_BOARD_GAME)
	{
		//EnableColorCorrection();
		DisableColorCorrection();
		WriteCameraRegister(0x04, FRAME_WIDTH); //set window width
		WriteCameraRegister(0x03, FRAME_HEIGHT); //set window height		

		// Set FPS
		/*
		 	 	 940 (0x3AC) = 30 fps
				 800 (0x320) = 32 fps
				 700 (0x2BC) = 35 fps
				 600 (0x258) = 38 fps
				 580 (0x244) = 38 fps
				 94  (0x05E) = 60 fps
		*/
		//WriteCameraRegister(0x05, 0x3AC);  //3AC set Horizontal blanking to 940(30 FPS)
		WriteCameraRegister(0x05, 0x05E);  //05E set Horizontal blanking to 94 (60 FPS)

		/********** COLOR MODE *******************/
		WriteCameraRegister(0x0F, 0x02);	//set sensor to default color mode
		//WriteCameraRegister(0x0F, 0x15); 	//set sensor to color & no high dynamic range
		//WriteCameraRegister(0x0F, 0x55);	//set sensor to color & high dynamic range
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR, 0x0A, 0x0022);	//Control of 2-Knee High Dynamic range 
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR, 0xC2, 0x0940);	// Enable .75 attenuation of pixel voltage before Analog-to-Digital conversion


		/********** AUTO EXPOSURE/AUTO GAIN CONTROL **********/	
		WriteCameraRegister(0xAF, 0x03); //turn on auto exposure and auto gain (Default)
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR, 0xAF, 0x02); //turn off auto exposure 
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR, 0xAF, 0x01); //turn off auto gain
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR, 0xAF, 0x00); //turn off both
		/********** ANALOG GAIN  ****************/
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR, 0x35, 0x10); //increase/decrease analog gain (default 1x = 0x10)
	
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR, 0x47, 0x8081); //override black level calibration
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR, 0x48, 0x007E); //black level calibration value (override only) max
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR, 0x48, 0x0082); //black level calibration value (override only) min
		
	   /********** IMAGE MIRRORING *************/
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR,0x0D, 0x310); //mirror the rows (flip the image vertically)
		//WriteCameraRegister(XPAR_PLB_VISION_0_BASEADDR,0x0D, 0x0330); //mirror the rows (flip the image vertically & horrizontally)

		//WriteCameraRegister(0x70, 0x0014); // Test Pattern: Disable Noise Correction
		//WriteCameraRegister(0x7F, 0x3000); // Test Pattern: Vertical shades 
		//DisableTestPattern();
		xil_printf("Camera Version %x, Window Size: %dx%d, Output Format: %x  (0x0 = Monochrome, 0x1 = Color)\r\n", 
			ReadCameraRegister(0xFF),
			ReadCameraRegister(0x04),
			ReadCameraRegister(0x03),
			ReadCameraRegister(0x0F)
			);
	}
}