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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cvshapes.cpp

?? Windows上的MUD客戶端程序
?? CPP
?? 第 1 頁 / 共 5 頁
字號(hào):
			v[facet].x() = -sintheta * r;
			v[facet].y() = -h2;
			v[facet].z() = -costheta * r;

			v[facet + numFacets].set(0,h2,0);  // top vertex

			n[facet*2].normalize();
			//n[facet*2].z() = -n[facet*2].z();
			if(!boolCull)
			{
				n[facet*2+normStep] = -n[facet*2];	// inside normal
			}

			theta = (facet +.5) * twoPi / numFacets;	// halfway to next point for top vert
			n[facet*2+1].x() = -sin(theta);
			n[facet*2+1].y() = ynorm;	// width / height, then mormalize
			n[facet*2+1].z() = -cos(theta);
			n[facet*2+1].normalize();
			if(!boolCull)
			{
				n[facet*2+1+normStep] = -n[facet*2+1];	// point's inside normal
			}
		}
		n[numFacets*2].set(0,-1,0);  // bottom's normal
		if(!boolCull)
		{
			n[numFacets*2+normStep] = -n[numFacets*2];	// bottom's inside normal
		}
		// Dupe the bottom verts, to use for sides, if we have texture
		if(boolUseTexture)
		{
			for( int i = 0; i < numFacets; i ++)
			{
				v[i+vertStep] = v[i];
			}
		}
		

		// Do the bottom
		if(pNode->parts.value & QvCone::BOTTOM)
		{
		 	 // TODO : Make sure this order is right when we do textures
			face_data[ifd++] = numFacets;	// count
			for( int j = 0; j < numFacets; j ++)
			{
					// Use the vertices, in mangled order

				int index = ( j % (numFacets));
				face_data[ifd++] = index;			// vertex
				face_data[ifd++] = numFacets * 2;		// normal
			}
			if(!boolCull)
			{
				face_data[ifd++] = numFacets;	// count
				for( int j = 0; j < numFacets; j ++)
				{
					// Use the vertices, in even more mangled order

					int index = (numFacets - j) % (numFacets);
					face_data[ifd++] = index;			// vertex
					face_data[ifd++] = numFacets * 2 + normStep;		// normal
				}
			}
		}

		// Do the sides
		if(pNode->parts.value & QvCone::SIDES)
		{
			for( int facet = 0; facet < numFacets; facet ++)
			{
				face_data[ifd++] = 3;	// face vertex count

				face_data[ifd++] = facet + vertStep;							  // v        
				face_data[ifd++] = facet * 2;						  // n, etc.  
				face_data[ifd++] = facet + numFacets;				  // top vertex
				face_data[ifd++] = facet * 2 + 1;
				face_data[ifd++] = ((facet + 1) % numFacets)  + vertStep;
				face_data[ifd++] = (facet * 2 + 2) % (2 * numFacets);
			}
			if(!boolCull)
			{
				for( int facet = 0; facet < numFacets; facet ++)
				{
					face_data[ifd++] = 3;	// face vertex count
											// change the order of pt[1] and [2]

	 				face_data[ifd++] = facet + vertStep;							// v
					face_data[ifd++] = facet * 2 + normStep;			// n, etc.
					face_data[ifd++] = ((facet + 1) % numFacets) + vertStep;
					face_data[ifd++] = (facet * 2 + 2) % (2 * numFacets) + normStep;
					face_data[ifd++] = facet + numFacets;				// top vertex
					face_data[ifd++] = facet * 2 + 1 + normStep;
				}
			}
		}

		face_data[ifd] = 0;	// terminate array

		// Load the verts and faces
		ChNrFaceArray facesAdded;
		int numFacesAdded;
		ChNrMeshAddFaces(mesh,
				       numVerts,
				       (ChNrVector*) v,
				       numNorms,
				       (ChNrVector*) n,
				       face_data,
				       &numFacesAdded,
				       &facesAdded);
		
		// Assign colors to faces
		int iface = 0;

		#if defined(CH_USE_D3D)
		numFacesAdded = facesAdded->GetSize();
		#endif

		ChNrFace elt;	// scratch space
		// Do the bottom
		if(pNode->parts.value & QvCone::BOTTOM)
		{
			int count = 1;	// count
			if(!boolCull) count *= 2;
			for( int j = 0; j < count; j ++)
			{
				GetElement(facesAdded, unsigned(iface), elt);
				if(boolUseTexture)
				{ 
					SetTextureCoordinates(pTxMap, mesh, elt, Bottom); 
				}
				materialMap.Set(mesh, elt, ChQvConeMaterials::Bottom);
				iface++;
				D3DRelease(elt);
			}
		}

		// Do the sides
		if(pNode->parts.value & QvCone::SIDES)
		{
			int count = numFacets;	// count
			if(!boolCull) count *= 2;
			for( int j = 0; j < count; j ++)
			{
				GetElement(facesAdded, unsigned(iface), elt);
				if(boolUseTexture && j < numFacets)
				{ 
					SetTextureCoordinates(pTxMap, mesh, elt, Sides, j); 
				}
				materialMap.Set(mesh, elt, ChQvConeMaterials::Sides);
				iface++;
				D3DRelease(elt);
			}
		}

		if(boolUseTexture)
		{
			ChTextureHandle hdl = pTextureData->GetTextureHandle();
			if(hdl)
			{
				// Texture guy got here first, apply it
				//ChNrMeshSetTexture(mesh, hdl);
				SetTexture(pTextureData);

			}
		}  
	
													  // Cleanup time
 		ChNrFree(facesAdded);							  
		delete [] v;
		delete [] n;
		delete [] face_data;
		delete [] pTxMap;

		pIterator->DidAShape();
		pRC->UnlockScene();		
		pRC->UnlockQv();		   // Unlock tree 
	}
#endif
	return true;
}


bool ChQvConeInstance::Draw(ChRenderContext *pRC, ChDrawIterator *pIterator)
{
#if defined( CH_USE_3DR )
	long On = 1;
	long Off = 0;

	G3dHandle_t hGC = pRC->GetGC();
	Dword_t  hRC = pRC->GetRC();
	QvCone *pNode = (QvCone *)GetNode();
	pRC->SetModelTransform(GetTransform());

	pRC->SetShading(this);


	Float_t		cull = 0;
	Fixed32_t wMattNum = 0;	  // always use material 0

	if(pNode->parts.value == QvCone::ALL) cull = 1;	// if all sides are present, then cull
	G3dSetMatt( hGC,  wMattNum, G3DM_BACK_CULL,	(Float_t *)&cull );
	
	int numFacets = CalcConeFacetCount(this, pRC);

	// Make a material mapping; we will use later for each facet and bottom
	ChQvConeMaterials materialMap( this);

	/* Do the texture stuff - find it, make the map, set up 3dr for it, */
	int boolUseTexture = false;
	
	ChQvTextureRenderData *pTextureData = 0;
	pTextureData = (ChQvTextureRenderData*)(GetTexture2()->GetRenderData());
	if (pTextureData->GetTextureHandle()) boolUseTexture = true;
	
	ChQvConeTextures	*pTxMap = 0;
	 
	if(boolUseTexture)
	{
		pRC->SetTexture(pTextureData->GetTextureHandle());
		pTxMap = new ChQvConeTextures( this, numFacets );
	}

	float h2 = pNode->height.value / 2.;
	float r = pNode->bottomRadius.value;

	Fixed32_t lCCW;
	G3dGetState( hGC, G3DL_FRONT_CCW, &lCCW); // save CCW state
	G3dSetState( hGC, G3DL_FRONT_CCW, &On);

	
	bool boolPureEmissive;
	float pi = atan(1.) * 4.;
	float twoPi = pi * 2;

	// Do the sides
	if(pNode->parts.value & QvCone::SIDES)
	{
		materialMap.Set(hRC, hGC, 0, &boolPureEmissive);
		pRC->SetModulation( boolUseTexture, boolPureEmissive);

		G3dBeginPrim(hGC, G3D_PRM_QUADSTRIP, numFacets * 2 + 2);
		for( int facet = 0; facet <= numFacets; facet ++)
		{
			PointF_t n, v1, v2;
			float theta = facet * twoPi / numFacets;

			// get better norm from RLab Code TODO!!!
			n.x = -sin(theta);
			n.y = 0;
			n.z = -cos(theta);
		 
			v1.x = 0;
			v1.y = h2;
			v1.z = 0;

			v2.x = n.x * r;
			v2.y = -h2;
			v2.z = n.z * r;

			if(boolUseTexture)
			{
				PointF_t textCoord = pTxMap->GetCoord3(0, facet, 0);
				G3dAddPrimVtxF(hGC, &v1, &n, &textCoord, 0);

				textCoord = pTxMap->GetCoord3(0, facet, 1);
				G3dAddPrimVtxF(hGC, &v2, &n, &textCoord, 0);
			}
			else
			{
				G3dAddPrimVtxF(hGC, &v1, &n, 0, 0);
				G3dAddPrimVtxF(hGC, &v2, &n, 0, 0);
			}
		}
		try
		{
			G3dEndPrim(hGC);
		}
		catch(...)
		{
			//TRACE("Exception in drawing cylinder caught\r\n");
		}
	}


	// Do the bottom
	G3dSetState( hGC, G3DL_FRONT_CCW, &Off);
	if(pNode->parts.value & QvCone::BOTTOM)
	{
		materialMap.Set(hRC, hGC, 1 /*bottom*/, &boolPureEmissive);
		pRC->SetModulation( boolUseTexture, boolPureEmissive);

		G3dBeginPrim(hGC, G3D_PRM_POLYGON, numFacets);
		PointF_t n, v1;
		n.x = 0;
		n.y = -1;
		n.z = 0;
		for( int j = 0; j <= numFacets; j ++)
		{
			float theta = j * twoPi / numFacets;
			v1.x = sin(theta + pi) * r;
			v1.y = -h2;
			v1.z = cos(theta + pi) * r;
		 
			if(boolUseTexture)
			{
				PointF_t textCoord = pTxMap->GetCoord3(1, 0, j);
				G3dAddPrimVtxF(hGC, &v1, &n, &textCoord, 0);
			}
			else
			{
				G3dAddPrimVtxF(hGC, &v1, &n, 0, 0);
			}
		}
		G3dEndPrim(hGC);
	}

	G3dSetState( hGC, G3DL_FRONT_CCW, &lCCW);
	if(boolUseTexture)
	{
		pRC->SetTexture(0);							// turn off texture
		delete pTxMap;
	}
#elif (defined(CH_USE_RLAB) || defined(CH_USE_D3D))
#endif //defined( CH_USE_3DR )
	return true;
}


#if (defined(CH_USE_RLAB) || defined(CH_USE_D3D))
void ChQvConeInstance::SetTextureCoordinates(ChQvConeTextures *pTxMap, ChNrMesh mesh, ChNrFace face, Parts part, int facet)
{

	int count = ChNrFaceGetVertexCount(face);
	for(int j = 0; j < count; j++)
	{
		GxVec3f textCoord = pTxMap->GetCoord3(part, facet, j);
		int index = ChNrFaceGetVertexIndex(face, j);
		ChNrMeshSetTextureCoordinates(mesh, index, textCoord.x(), textCoord.y());
	}
}
#endif


ChQvCubeInstance::ChQvCubeInstance() : ChQvShapeInstance()
{
}

bool ChQvCubeInstance::Construct(ChRenderContext *pRC, ChConstructionIterator *pIterator)
{
#if (defined(CH_USE_RLAB) || defined(CH_USE_D3D))
	{
		ASSERT(m_frame );
		pRC->LockQv();		   // Lock tree so other threads don't kill our data
		if(!pIterator->IsOKToProceed(this))	 // This locks scene if available
		{
			pRC->UnlockQv();		   // Unlock tree 
			return 0;
		}
		if(IsConstructed())
		{
			pRC->UnlockScene();
			pRC->UnlockQv();		   // Unlock tree 
			return 1;
		}
		m_boolConstructed = true;
		
		static long indices[6][4] =
		{
			{0, 1, 5, 4},	// front
			{2, 3, 7, 6},	// back
			{3, 0, 4, 7},	// left
			{1, 2, 6, 5},	// right
			{3, 2, 1, 0},	// top
			{4, 5, 6, 7}	// bottom
		};
		static  GxVec3f fSigns[8] =
		{
			GxVec3f(-1, 1, 1),	// top front left
			GxVec3f( 1, 1, 1),	// top right
			GxVec3f( 1, 1, -1),	// top right back
			GxVec3f(-1, 1, -1),	// top left back
			GxVec3f(-1, -1, 1),	// bottom left
			GxVec3f( 1, -1, 1),	// bottom right
			GxVec3f( 1, -1, -1),	// bottom right back
			GxVec3f(-1, -1, -1)	// bottom left back
		};
		#if 0
		static  GxVec3f fNorms[6] =		
		{									// indexed by face
			GxVec3f( 0, 0, 1),// 
			GxVec3f( 0, 0, -1),	// 
			GxVec3f(-1, 0, 0),	// 
			GxVec3f( 1, 0, 0),	// 
			GxVec3f( 0, 1, 0),	// 
			GxVec3f( 0, -1, 0)	// bottom 
		};
		#else
		static  GxVec3f fNorms[6] =		
		{									// indexed by face
			GxVec3f( 0, 0, -1),// 
			GxVec3f( 0, 0, 1),	// 
			GxVec3f(1, 0, 0),	// 
			GxVec3f( -1, 0, 0),	// 
			GxVec3f( 0, -1, 0),	// 
			GxVec3f( 0, 1, 0)	// bottom 
		};
		#endif
		QvCube *pNode = (QvCube *)GetNode();

		// Make a material mapping; we will use later for each face
		ChQvCubeMaterials materialMap( this );
		pRC->AdjustTransparency(materialMap);

		/* Do the texture stuff - find it, make the map, set up 3dr for it, */
		ChQvCubeTextures	*pTxMap =  new ChQvCubeTextures( this );
		ChQvTextureRenderData *pTextureData = (ChQvTextureRenderData*)(GetTexture2()->GetRenderData());
		bool boolUseTexture = !(pTextureData->IsEmpty());  // one -might- arrive


		float h2 = pNode->height.value / 2.;
		float w2 = pNode->width.value / 2.;
		float d2 = pNode->depth.value / 2.;

		ChNrMesh mesh = m_mesh = pRC->CreateMesh();
		ChNrFrameAddVisual(GetFrame(), mesh);				   
		D3DRelease(mesh);

		ChNrObjectSetAppData(mesh, (unsigned long)this);
		ChNrMeshSetColorSource(mesh,ColorFromFace); // alternative: ChNativeColorFromVertex 
		ChNrMeshSetPerspective(mesh,true);  

		// Need to reserve space for vertices, normals, and faces - 
		int numFaces = 6, numVerts = 8, numNorms = 6;
		int vertStep = 0;		// step to find verts for sides
		if (boolUseTexture)
		{
			vertStep = numVerts;
			numVerts *= 3;
		}

		ChNrMeshReserveSpace(mesh, numVerts, numNorms, numFaces);  
		ChNrFaceData * face_data = new ChNrFaceData[48 + 6 + 1];

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
制服丝袜激情欧洲亚洲| 精品人伦一区二区色婷婷| 日本免费在线视频不卡一不卡二 | 粉嫩av一区二区三区粉嫩| 亚洲另类一区二区| 国产日韩精品视频一区| 欧美日韩视频在线第一区| 风流少妇一区二区| 蜜臂av日日欢夜夜爽一区| 亚洲人一二三区| 精品国产乱码91久久久久久网站| 在线亚洲欧美专区二区| 国产成人精品影视| 青青草一区二区三区| 亚洲综合一二三区| 国产精品视频你懂的| 久久综合网色—综合色88| 欧美精品在线观看一区二区| 91丨国产丨九色丨pron| 国产老肥熟一区二区三区| 日韩中文字幕一区二区三区| 亚洲免费色视频| 中国色在线观看另类| 亚洲愉拍自拍另类高清精品| 国产日韩影视精品| 久久久久久久综合| 精品久久一区二区| 日韩天堂在线观看| 欧美日韩免费观看一区二区三区| 99精品国产热久久91蜜凸| 懂色av噜噜一区二区三区av| 国产美女一区二区三区| 狠狠狠色丁香婷婷综合久久五月| 日韩高清电影一区| 日韩国产欧美在线观看| 首页国产欧美久久| 日韩精品久久理论片| 亚洲成av人片一区二区梦乃| 亚洲福利视频一区二区| 亚洲一区二区在线免费看| 综合久久综合久久| 亚洲激情一二三区| 亚洲人成7777| 亚洲国产aⅴ成人精品无吗| 一区二区三区在线不卡| 亚洲精品国产高清久久伦理二区| 亚洲四区在线观看| 亚洲精品高清在线| 亚洲chinese男男1069| 亚洲福利一区二区三区| 免费三级欧美电影| 久久国产夜色精品鲁鲁99| 国产一区二区三区最好精华液| 国产一区二区三区| 国产成人aaa| 972aa.com艺术欧美| 91国偷自产一区二区开放时间| 欧美性感一区二区三区| 91精品国产综合久久蜜臀 | 欧美成人vps| 3atv一区二区三区| 精品三级在线观看| 国产女主播视频一区二区| 亚洲天堂成人在线观看| 亚洲国产aⅴ成人精品无吗| 日本欧美在线观看| 国产乱码精品一品二品| 91视频在线观看| 69堂精品视频| 久久夜色精品国产噜噜av| 中文字幕亚洲在| 午夜激情一区二区| 国产高清不卡一区| www.99精品| 欧美电影在哪看比较好| 26uuu欧美| 亚洲激情在线激情| 久久av资源网| 色就色 综合激情| 亚洲精品一区二区三区99| 亚洲视频 欧洲视频| 午夜精品成人在线视频| 丁香婷婷深情五月亚洲| 欧美视频一区在线| 国产人久久人人人人爽| 亚洲第四色夜色| 国产高清在线精品| 欧美精品vⅰdeose4hd| 国产欧美日韩不卡免费| 婷婷六月综合亚洲| eeuss鲁片一区二区三区在线看| 欧美丰满嫩嫩电影| 国产精品传媒视频| 国产在线视频一区二区| 欧美在线播放高清精品| 欧美精品一区二区三区视频| 夜夜嗨av一区二区三区中文字幕 | 91免费版pro下载短视频| 日韩一区二区三区观看| 亚洲欧美国产三级| 狠狠色狠狠色综合| 91精品国产综合久久久蜜臀图片 | 亚洲777理论| 99国产精品一区| 久久青草欧美一区二区三区| 天堂午夜影视日韩欧美一区二区| 大桥未久av一区二区三区中文| 91精品国产入口在线| 亚洲美女在线一区| 国产.欧美.日韩| 日韩一级成人av| 香蕉成人啪国产精品视频综合网| 成人美女视频在线看| 欧美大片在线观看一区| 婷婷开心激情综合| 欧美图片一区二区三区| 亚洲精品国产a久久久久久| 大尺度一区二区| 久久精品一区蜜桃臀影院| 久久国产精品第一页| 欧美精品xxxxbbbb| 丝袜亚洲另类欧美综合| 欧美性色黄大片| 亚洲在线观看免费| 欧美主播一区二区三区美女| 国产精品成人免费在线| 波多野结衣中文字幕一区二区三区| 精品国产免费久久| 青草av.久久免费一区| 欧美色精品在线视频| 亚洲午夜精品网| 精品视频123区在线观看| 亚洲夂夂婷婷色拍ww47| 在线观看不卡一区| 一区二区欧美视频| 欧美视频精品在线| 亚洲成精国产精品女| 欧美精品国产精品| 美女一区二区久久| 日韩一级黄色片| 国产乱淫av一区二区三区| 国产欧美一区二区精品性色超碰| 国产成人综合网| 国产精品国产三级国产有无不卡 | 久久爱www久久做| 精品免费日韩av| 色狠狠色狠狠综合| 亚洲国产精品一区二区久久| 欧美日韩一区二区三区免费看 | 日韩一区二区三| 久久成人18免费观看| 精品福利在线导航| 国产成人午夜视频| 国产精品成人在线观看| 欧美日韩在线播放三区四区| 日本欧美大码aⅴ在线播放| 精品国产乱码久久| 成人av网站大全| 亚洲一区二区在线观看视频| 欧美一区二区精品在线| 久久99国产精品免费| 久久久久久**毛片大全| 色综合一个色综合| 免费av网站大全久久| 国产欧美一区二区三区在线看蜜臀 | 99re成人精品视频| 亚洲成人www| 国产亚洲精品7777| 日本乱人伦一区| 免费成人你懂的| 国产精品久久久久一区二区三区| 色婷婷国产精品久久包臀| 蜜臀av国产精品久久久久| 国产精品丝袜久久久久久app| 欧美中文字幕久久| 国产乱一区二区| 亚洲成av人片在线观看无码| 久久众筹精品私拍模特| 欧美影视一区在线| 狠狠久久亚洲欧美| 一区二区三区免费看视频| 日韩亚洲电影在线| 99久久99久久精品国产片果冻| 亚洲18影院在线观看| 国产亚洲午夜高清国产拍精品| 欧美亚洲禁片免费| 国产精品996| 天天av天天翘天天综合网| 国产欧美视频一区二区| 欧美日韩国产综合视频在线观看| 国产成人精品综合在线观看| 亚洲国产精品久久一线不卡| 国产午夜精品久久久久久免费视 | 欧美一区二区三区色| 国产91精品免费| 美女在线视频一区| 亚洲主播在线观看| 国产精品久久久久久久久免费樱桃| 欧美精品久久久久久久多人混战| 97久久超碰国产精品电影|