亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? videomanrendererogl.cpp

?? VideoMan (Video Manager) is an open-source C++ library that helps you developing video based applica
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
			int iniC = screenSize.right * despC;
			int finC = screenSize.right * despCs;
			int iniF = screenSize.top * despF;
			int finF = screenSize.top * despFs;
			float tamX = finC - iniC;
			float tamY = finF - iniF;

			float aspectX = (float)tamX / (float)inputList[v].width;
			float aspectY = (float)tamY / (float)inputList[v].height;
			if ( aspectX < aspectY )
			{
				inputList[v].screenCoords.left = iniC;
				inputList[v].screenCoords.right = tamX;
				inputList[v].screenCoords.top = (float)inputList[v].height * aspectX;
				inputList[v].screenCoords.bottom = iniF;//+((float)tamY - (float)videoList[v].screenCoords.top)*0.5f;
			}
			else
			{
				inputList[v].screenCoords.bottom = iniF;
				inputList[v].screenCoords.top = tamY;
				inputList[v].screenCoords.right = (float)inputList[v].width * aspectY;
				inputList[v].screenCoords.left = iniC + ( (float)tamX - (float)inputList[v].screenCoords.right ) * 0.5f;
			}
			inputList[v].activated = true;
		
			v++;
		}
	}*/
}

void VideoManRendererOGL::activateVideoInput( size_t v )
{
	assert( v >= 0  &&  v < inputList.size() && "activateVideoInput: Index out of range");

	if ( inputList[v].activated || !inputList[v].supported )
		return;

	activatedInputs++;
	inputList[v].activated = true;
	changeScreenSize( screenSize.left,screenSize.bottom,screenSize.width,screenSize.height  );	
}

void VideoManRendererOGL::deactivateAllVideoInputs()
{
	activatedInputs = 0;
	for( size_t v = 0; v < inputList.size(); v++ )
	{
		inputList[v].activated = false;
	}
	changeScreenSize( screenSize.left,screenSize.bottom,screenSize.width,screenSize.height  );
}

void VideoManRendererOGL::deactivateVideoInput( size_t v )
{
	assert ( v >= 0  &&  v < inputList.size() && "deactivateVideoInput: Index out of range");

	if ( !inputList[v].activated )
		return;
	activatedInputs--;
	inputList[v].activated=false;
	changeScreenSize( screenSize.left,screenSize.bottom,screenSize.width,screenSize.height  );
}

bool VideoManRendererOGL::isActivated( size_t v )
{
	assert ( v >= 0  &&  v < inputList.size() && "deactivateVideoInput: Index out of range");

	return ( inputList[v].activated );
}

void VideoManRendererOGL::changeVisualizationMode( int vM )
{
	visualizationMode = vM;
	changeScreenSize( screenSize.left, screenSize.bottom, screenSize.width, screenSize.height  );	
}

void VideoManRendererOGL::changeMainVisualizationInput( const size_t &v )
{
	assert ( v >= 0  &&  v < inputList.size() && "changeMainVisualizationInput: Index out of range");
	if ( inputList[v].activated )
	{
		mainVisualizationInput = v;
		changeScreenSize( screenSize.left, screenSize.bottom, screenSize.width, screenSize.height  );	
	}
}

void VideoManRendererOGL::changeScreenSize( int left, int bottom, int width, int height )
{
	screenSize.init( left, bottom, width, height );
	if ( screenSize.height <= 0 || screenSize.width <= 0 )
		return;
	if ( inputList.size() == 0 || activatedInputs == 0 )
		return;

	switch ( visualizationMode )
	{
		case 0:
		default:
		{
			changeScreenSizeV0( left, bottom, width, height );
			break;
		}
		case 1:
		{
			if ( activatedInputs <= 1 )
				changeScreenSizeV0( left, bottom, width, height );
			else
				changeScreenSizeV1( left, bottom, width, height );
			break;
		}
	}
}


void VideoManRendererOGL::changeScreenSizeV0( int left, int bottom, int width, int height )
{
	float numColsF = sqrt( ( (float)screenSize.width / (float)screenSize.height ) * 1.33333f * (float) activatedInputs );
	int numCols = static_cast<int>( floor( numColsF ) );
	if ( numCols == 0 ) numCols = 1;
	if ( numCols > activatedInputs ) numCols = activatedInputs;
	//if ((numColsF-numCols)>(numColsF-(numCols+1)))
	//	numCols=numCols+1;
	int numFils = static_cast<int>( ceil( (float)activatedInputs / (float)numCols ) );

	float despC = 0.0f;
	float despF = 0.0f;
	float despCs = 0.0f;
	float despFs = 0.0f;	
	int actual = 0;
	for ( int i = 0; i < (int)inputList.size(); i++ )
	{
		if ( inputList[i].activated )
		{
			//Calculate Which is its row
			int row = static_cast<int>( floor( (float)actual / (float)numCols ) );
			//Calculate Which is its column
			int col = actual % numCols;
			despC = (float)col / (float)numCols;
			despF = (float)row / (float)numFils;
			despCs = (float)(col+1) / (float)numCols;
			despFs = (float)(row+1) / (float)numFils;
			int iniC = static_cast<int>( screenSize.width * despC );
			int finC = static_cast<int>( screenSize.width * despCs );
			int iniF = static_cast<int>( screenSize.height - screenSize.height * despFs );
			int finF = static_cast<int>( screenSize.height - screenSize.height * despF);
			int tamX = finC - iniC;
			int tamY = finF - iniF;

			calculateAspectRatio( iniC, iniF, tamX, tamY, i );
			
			actual++;
		}
	}	
}

void VideoManRendererOGL::calculateAspectRatio( int left, int bottom, int width, int height, size_t index )
{
	float aspectX = (float)width / (float)inputList[index].width;
	float aspectY = (float)height / (float)inputList[index].height;
	if ( aspectX < aspectY )
	{
		inputList[index].screenCoords.left = left;
		inputList[index].screenCoords.width = static_cast<long>( width );
		inputList[index].screenCoords.height = static_cast<long>( (float)inputList[index].height * aspectX );
		//inputList[i].screenCoords.bottom = iniF;//+((float)tamY - (float)videoList[v].screenCoords.top)*0.5f;
		inputList[index].screenCoords.bottom = static_cast<long>( bottom + (height - aspectX*inputList[index].height)*0.5f );		
		
	}
	else
	{
		inputList[index].screenCoords.bottom = bottom;
		inputList[index].screenCoords.height = static_cast<long>( height );
		inputList[index].screenCoords.width = static_cast<long>( (float)inputList[index].width * aspectY );
		inputList[index].screenCoords.left = static_cast<long>( left + ( (float)width - (float)inputList[index].screenCoords.width ) * 0.5f );
	}
}


void VideoManRendererOGL::changeScreenSizeV1( int left, int bottom, int width, int height )
{
	int despY = height / static_cast<int>( inputList.size() );
	for ( int i = 0; i < (int)inputList.size(); i++ )
	{
		if ( inputList[i].activated )
		{
			if ( mainVisualizationInput == i )
			{
				calculateAspectRatio( left + width * 1 / 4, bottom, width * 3 / 4, height, i );								
			}
			else
			{
				calculateAspectRatio( left, bottom +  despY * i, width * 1 / 4, despY, i );				
			}
		}
	}
}



int VideoManRendererOGL::screenToImageCoords( float &x, float &y )
{
	size_t i = 0;
	int selected = -1;
	y = screenSize.height - y;
	while( selected == -1 && i<inputList.size() )
	{	
		if ( inputList[i].activated )
		{
			float dY = y - inputList[i].screenCoords.bottom;
			float dX = x - inputList[i].screenCoords.left;
			if ( dX >= 0 && dX <= inputList[i].screenCoords.width &&
				dY >= 0 && dY <= inputList[i].screenCoords.height )
			{
				selected = static_cast<int>( i );
			}
		}
		i++;
	}
	if ( selected != -1 )
	{
		x = static_cast<float>( inputList[selected].width ) * ( x - static_cast<float>( inputList[selected].screenCoords.left ) ) / static_cast<float>( inputList[selected].screenCoords.width );	
		y = static_cast<float>( inputList[selected].height ) * ( y - static_cast<float>( inputList[selected].screenCoords.bottom ) ) / static_cast<float>( inputList[selected].screenCoords.height );
		y = static_cast<float>( inputList[selected].height ) - y;
		if ( x >= 0 && x < inputList[selected].width && y >= 0 && y < inputList[selected].height )
			return selected;
		else
			return -1;

	}
	return selected;
}

bool VideoManRendererOGL::imageToScreenCoords( const size_t &v, float &x, float &y )
{
	assert( v >= 0  &&  v < inputList.size() && "imageToScreenCoords: Index out of range");

	//x = static_cast<float>( inputList[selected].width ) * ( x - static_cast<float>( inputList[selected].screenCoords.left ) ) / static_cast<float>( inputList[selected].screenCoords.right );	
	x = static_cast<float>( inputList[v].screenCoords.left ) + static_cast<float>( inputList[v].screenCoords.width ) * x / static_cast<float>( inputList[v].width );	
	//y = static_cast<float>( inputList[selected].height ) * ( y - static_cast<float>( inputList[selected].screenCoords.bottom ) ) / static_cast<float>( inputList[selected].screenCoords.top );
	y = static_cast<float>( inputList[v].screenCoords.bottom ) + static_cast<float>( inputList[v].screenCoords.height ) * y / static_cast<float>( inputList[v].height );		

	return true;
}

bool VideoManRendererOGL::getScreenCoords( const size_t &v, int &left, int &bottom, int &width, int &height )
{
	assert( v >= 0  &&  v < inputList.size() && "getScreenCoords: Index out of range");
	if ( !inputList[v].activated )
		return false;
	left = inputList[v].screenCoords.left;
	bottom = inputList[v].screenCoords.bottom;
	width = inputList[v].screenCoords.width;
	height = inputList[v].screenCoords.height;
	return true;
}

void VideoManRendererOGL::getTextureCoords( const size_t &input, float &left, float &bottom, float &right, float &up )
{
	assert( input >= 0  &&  input < inputList.size() && "getTextureCoords: Index out of range");
	left = inputList[input].tu1;
	right = inputList[input].tu2;
	up = inputList[input].tv2;
	bottom = inputList[input].tv1;

}

inline void VideoManRendererOGL::activateViewport( const size_t &v )
{
	assert( v >= 0  &&  v < inputList.size() && "activateViewport: Index out of range");
	glViewport( inputList[v].screenCoords.left, inputList[v].screenCoords.bottom, inputList[v].screenCoords.width, inputList[v].screenCoords.height);
}


inline void VideoManRendererOGL::activateTexture( const size_t &v )
{
	assert( v >= 0  &&  v < inputList.size() && "activateTexture: Index out of range");
	glBindTexture(GL_TEXTURE_2D, inputList[v].texture);
}

void VideoManRendererOGL::setVerticalFlip( const size_t &v, bool value )
{
	assert( v >= 0  &&  v < inputList.size() && "setVerticalFlip: Index out of range");
	
	if ( value != inputList[v].verticalFlip )
	{
		inputList[v].verticalFlip = value;	
		float aux = inputList[v].tv1;
		inputList[v].tv1 = inputList[v].tv2; 
		inputList[v].tv2 = aux;
	}
}

bool VideoManRendererOGL::getVerticalFlip( const size_t &v )
{
	assert( v >= 0  &&  v < inputList.size() && "getVerticalFlip: Index out of range");
	return inputList[v].verticalFlip;
}

void VideoManRendererOGL::setHorizontalFlip( const size_t &v, bool value )
{
	assert( v >= 0  &&  v < inputList.size() && "setHorizontalFlip: Index out of range");

	if ( value != inputList[v].horizontalFlip )
	{
		inputList[v].horizontalFlip = value;

		float aux = inputList[v].tu1;
		inputList[v].tu1 = inputList[v].tu2;
		inputList[v].tu2 = aux;
	}
}

bool VideoManRendererOGL::getHorizontalFlip( const size_t &v )
{
	assert( v >= 0  &&  v < inputList.size() && "getHorizontalFlip: Index out of range");
	return inputList[v].horizontalFlip;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美亚洲动漫另类| 美美哒免费高清在线观看视频一区二区| 欧美性三三影院| 日本久久电影网| 99精品视频在线观看免费| 国产一区二区按摩在线观看| 久久精品国内一区二区三区 | 国产一区在线精品| 日本成人在线网站| 老司机一区二区| 久久99久国产精品黄毛片色诱| 美腿丝袜亚洲色图| 九色综合国产一区二区三区| 激情欧美日韩一区二区| 国模大尺度一区二区三区| 国产一区二区调教| 99久久国产综合精品麻豆| 91麻豆精品秘密| 欧美日韩一区二区不卡| 91精品国产综合久久精品性色| 日韩欧美不卡在线观看视频| 26uuu另类欧美亚洲曰本| 日本一区免费视频| 亚洲视频在线一区| 亚洲国产成人精品视频| 久久国内精品自在自线400部| 精品一区二区三区欧美| 不卡的电影网站| 欧美天堂亚洲电影院在线播放| 欧美精品一区二区三区在线| 国产精品网站在线播放| 亚洲精品高清在线观看| 日本成人在线电影网| 国产成人亚洲精品青草天美| 91农村精品一区二区在线| 欧美日韩在线观看一区二区| 精品电影一区二区| 综合激情成人伊人| 免费在线观看一区| 波多野结衣91| 日韩精品一区二区三区老鸭窝| 中日韩av电影| 轻轻草成人在线| 成人午夜激情片| 日韩美女天天操| 一区二区三区电影在线播| 国产在线精品一区二区不卡了| 色婷婷综合久久久久中文 | 丰满亚洲少妇av| 欧美日韩国产高清一区二区三区 | 国产成人免费在线| 欧美日韩亚洲丝袜制服| 国产精品丝袜一区| 久久99精品国产麻豆婷婷洗澡| 91理论电影在线观看| 26uuu亚洲综合色| 亚洲h在线观看| 99精品热视频| 欧美国产禁国产网站cc| 免费精品99久久国产综合精品| 色综合久久天天| 国产亚洲一本大道中文在线| 热久久久久久久| 欧美三级电影在线看| 亚洲精品视频免费观看| 成人午夜视频免费看| 欧美r级电影在线观看| 亚洲超碰精品一区二区| 在线免费观看日本欧美| 亚洲丝袜美腿综合| 99re成人精品视频| 国产精品乱人伦| 不卡免费追剧大全电视剧网站| 国产精品免费视频网站| 免费看日韩a级影片| 欧美日韩综合色| 亚洲成a人在线观看| 欧美性受xxxx| 日韩国产欧美视频| 4438x亚洲最大成人网| 婷婷六月综合网| 欧美裸体bbwbbwbbw| 亚洲成人一区在线| 911精品国产一区二区在线| 五月天欧美精品| 日韩欧美一级特黄在线播放| 老司机免费视频一区二区三区| 欧美大片在线观看一区二区| 另类综合日韩欧美亚洲| 精品国产伦一区二区三区免费| 韩国v欧美v亚洲v日本v| 国产欧美日韩亚州综合| 99久久er热在这里只有精品66| 1000部国产精品成人观看| 91精品办公室少妇高潮对白| 丝瓜av网站精品一区二区| 日韩欧美在线综合网| 国产精品99久| 亚洲激情中文1区| 正在播放亚洲一区| 国产精品亚洲视频| 亚洲精品自拍动漫在线| 91精品国产综合久久精品图片| 久久99精品国产麻豆婷婷| 国产精品免费视频一区| 欧美日韩国产一区二区三区地区| 久久99这里只有精品| 欧美激情中文字幕一区二区| 在线精品视频免费观看| 国内精品伊人久久久久av影院 | 亚洲欧美国产高清| 欧美日韩高清一区二区不卡| 国产乱码一区二区三区| 中文字幕综合网| 日韩一区二区免费在线电影 | 曰韩精品一区二区| 欧美成人精品1314www| 成人美女视频在线看| 久久99国产精品免费| 国产精品久久久久久久久动漫| 欧美在线免费视屏| 国产成人久久精品77777最新版本| 一区二区三区日韩精品| 久久久99精品久久| 欧美绝品在线观看成人午夜影视| 国产99久久久国产精品| 日韩中文字幕亚洲一区二区va在线 | 欧洲视频一区二区| 国产综合色精品一区二区三区| 亚洲综合在线视频| 欧美激情一区二区三区在线| 欧美一区二区在线视频| 91论坛在线播放| 精品一区在线看| 亚洲chinese男男1069| 亚洲欧洲精品成人久久奇米网| 日韩精品在线一区二区| 欧美日韩一本到| 色婷婷久久综合| 99久久99久久综合| 国产一区不卡精品| 韩日欧美一区二区三区| 青青草97国产精品免费观看 | 91麻豆精品国产91久久久久| 91蝌蚪国产九色| 成人精品国产一区二区4080| 国产在线精品国自产拍免费| 久久er精品视频| 久久国产视频网| 另类专区欧美蜜桃臀第一页| 蜜桃视频在线观看一区| 日韩国产欧美在线观看| 日本免费在线视频不卡一不卡二| 亚洲国产精品嫩草影院| 亚洲国产视频a| 亚洲成在线观看| 亚洲成人一二三| 日韩av一二三| 日韩有码一区二区三区| 日韩电影在线观看电影| 青青草精品视频| 久久99国产精品久久99果冻传媒| 蜜桃av一区二区三区| 久久精品国产99国产精品| 精品一区二区av| 国产剧情一区在线| 国产成人自拍在线| 成人av午夜影院| 91久久国产最好的精华液| 9191国产精品| 国产亚洲制服色| 中文字幕一区二区三区在线不卡 | 日本丶国产丶欧美色综合| 色婷婷av一区二区三区gif | 欧美一区二区三区不卡| 日韩精品资源二区在线| 久久伊99综合婷婷久久伊| 亚洲一区二区三区在线看| 亚洲综合一区二区三区| 日韩一区精品字幕| 国产精品一区二区在线播放| 99精品国产视频| 欧美一区二区久久| 国产亚洲精品超碰| 亚洲精品成人在线| 久久精品免费看| 91天堂素人约啪| 日韩一级片网址| 中文字幕亚洲精品在线观看| 丝袜诱惑制服诱惑色一区在线观看| 免费成人在线观看视频| 成人免费不卡视频| 欧美在线色视频| 中文字幕国产一区二区| 日韩高清电影一区| av电影一区二区| 欧美va在线播放| 亚洲香肠在线观看| 成人夜色视频网站在线观看| 欧美一区二区三区免费视频|