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

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

?? cvshapes.cpp

?? Windows上的MUD客戶端程序
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
			// Set up an array to remember where each point of each face came from
			int *pSource = new int[face_data_size];		   // very conservative
			int iSource = 0;	// running index

			// Set up a table that goes coord num => face num
			int *pCoordToFace = new int[pNode->coordIndex.num];

			// j is first index into coordIndex for each face
			for(j = 0; j< pNode->coordIndex.num; j++, iface++)
			{
				// do a face
				int nVerts = VertCount(pNode->coordIndex, j);	 // # verts in -this face-

				GxVec3f n;
	
				// note that the sense of normals depend upon ccw or cw
				// if the norms point in to the front surface no shading will be done
				// on -either side-
				// Notice the back norm, if kept, is right after the front norm
				if(pNormals->IsPerFace())
				{
					pNormals->GetFaceNormal( iface,  n );
					if(faceNorms[iface] == -1)
					{
						n = -n;
						faceNorms[iface] = numN;
						if(boolBackCull && boolCCW) n = -n;
						#if (defined(FLIP_D3D_NORMALS) && defined(CH_USE_D3D))
						n = -n;
						#endif
						pN[numN++] = n;
						if(!boolBackCull) pN[numN++] = -n;
					}
				}

				for(int k = 0; k < nVerts; k++)
				{
					pCoordToFace[j+k] = iface;	   // Build table for later
				}

				bool boolConvex = IsConvex( j, nVerts );
				int	iNumFacets = 1;				// How many individual convex facets in this face

				ChTriangulator tri;

				//boolConvex = true;  // VSP : temporary fix for this release

				if(!boolConvex)
				{
					#if 1
					if(tri.Attach(pNode->coordIndex.values + j, (GxVec3f*)(pC3->point.values), nVerts))
					{
						iNumFacets = tri.GetCount();
					}
					else
					{
						boolConvex = true;	// triangulation failed. Proceed as if convex
					}
					#endif
				}

				for( int iFacet	= 0; iFacet < iNumFacets; iFacet++)
				{
					int nVertsFacet = boolConvex ? nVerts : 3;
					face_data[ifd] = nVertsFacet;
					if(!boolBackCull) face_data[ifd+2*nVertsFacet+1] = nVertsFacet;
					ifd++;

					int	triIndex[3];

					if(!boolConvex)
					{
						tri.GetTriangle(iFacet, triIndex);
					}
					for(int k = 0; k < nVertsFacet; k++)
					{
						int normIndex;
						int vertIndex;
						int iVertNumber;
						if(boolConvex)
						{
							iVertNumber = j + k;
						}
						else
						{
							iVertNumber = j + triIndex[k];
						}
						int index = pNode->coordIndex.values[iVertNumber];
					
						// First, add a vert to the vert array, and remember where in pV it is
						// To save even more space, we could build a tree where the key is index + texIndex
						// But that would be slower, probably.
						if(boolUseTexture) 
						{
							int texIndex = pTxMap->GetIndex(iVertNumber);
							vertIndex = -1;
							if(verts[index] == -1)
							{
								// Store the first occurrence of a unique vertex into pV, and save where
								// pV will store all the -used- vertices from the C3 node
								// Also save the tex index, so we can see on later verts if their
								// tex coords match. If so, we'll be able to reuse this vertex.
								// This enforces the rule: Different tex coords ==> different verts
								int iC3 = index * 3;
								GxVec3f p;
								p.x() = pC3->point.values[iC3];
								p.y() = pC3->point.values[iC3+1];
								p.z() = pC3->point.values[iC3+2];
								verts[index] = numV;
								vertIndex = numV;
								pV[numV++] = p;
								texIndices[index] = texIndex;
							}
							else if(texIndices[index] == texIndex)
							{
								vertIndex = verts[index];	// tex coords match, use the shared array
							}
							else
							{
								int iC3 = index * 3;	  // Use the unshared array
								GxVec3f p;
								p.x() = pC3->point.values[iC3];
								p.y() = pC3->point.values[iC3+1];
								p.z() = pC3->point.values[iC3+2];
								texVerts[iVertNumber] = numV;
								vertIndex = numV;
								pV[numV++] = p;
							}

						}
						else
						{
							if(verts[index] == -1)
							{
								// Store the first occurrence of a unique vertex into pV, and save where
								// pV will store all the -used- vertices from the C3 node
								int iC3 = index * 3;
								GxVec3f p;
								p.x() = pC3->point.values[iC3];
								p.y() = pC3->point.values[iC3+1];
								p.z() = pC3->point.values[iC3+2];
								verts[index] = numV;
								vertIndex = numV;
								pV[numV++] = p;
							}
							else
							{
								vertIndex = verts[index];
							}
						
						}
						// Get the normal, if it's by vertex or default ....
						// We store it in one of three arrays, and remember its index
						// in the pN array
						if(pNormals->IsPerFace())
						{
							normIndex = faceNorms[iface];
						}
						else if(pNormals->IsPerVertex())
						{	
							// This could be better if we saved 
							// by normal index instead of vertNumber					
							pNormals->GetVertexNormal( iVertNumber,  n );
							n = -n;
							if(uniqueNorms[iVertNumber] == -1)
							{
								uniqueNorms[iVertNumber] = numN;
								//	n.z() = -n.z();

								if(boolBackCull && boolCCW) n = -n;
								#if (defined(FLIP_D3D_NORMALS) && defined(CH_USE_D3D))
								n = -n;
								#endif
								pN[numN++] = n;
								if(!boolBackCull) pN[numN++] = -n;
							}
							normIndex = uniqueNorms[iVertNumber];
						}
						else
						{
							chuint32 normFlag;
							pNormals->GetDefaultNormal( iVertNumber, iface,  n, normFlag );
							n = -n;
							#if (defined(FLIP_D3D_NORMALS) && defined(CH_USE_D3D))
							n = -n;
							#endif
							if(normFlag & GX_NORMAL_FACE)
							{
								if(faceNorms[iface] == -1)
								{
									faceNorms[iface] = numN;
									if(boolBackCull && boolCCW) n = -n;
									pN[numN++] = n;
									if(!boolBackCull) pN[numN++] = -n;
								}
								normIndex = faceNorms[iface];
							}
							else if(normFlag & GX_NORMAL_ALL_FACES)
							{
								if(sharedNorms[index] == -1)
								{
									sharedNorms[index] = numN;
									if(boolBackCull && boolCCW) n = -n;
									#if (defined(FLIP_D3D_NORMALS) && defined(CH_USE_D3D))
									n = -n;
									#endif
									pN[numN++] = n;
									if(!boolBackCull) pN[numN++] = -n;
								}
								normIndex = sharedNorms[index];
							}
							else
							{
								if(uniqueNorms[iVertNumber] == -1)
								{
									uniqueNorms[iVertNumber] = numN;
									if(boolBackCull && boolCCW) n = -n;
									#if (defined(FLIP_D3D_NORMALS) && defined(CH_USE_D3D))
									n = -n;
									#endif
									pN[numN++] = n;
									if(!boolBackCull) pN[numN++] = -n;
								}
								normIndex = uniqueNorms[iVertNumber];
							}
						}

						// Whew, now we have indices for both vert and norm, so add them to 
						// the face_data

						int bump = 0;
						if(!boolBackCull || !boolCCW)
						{
							face_data[ifd+k*2] = vertIndex;
							face_data[ifd+k*2+1] = normIndex++;
							bump = 2 * nVertsFacet + 1;
							pSource[iSource+k] = iVertNumber;
						}

						// Add backface index
						if(!boolBackCull || boolCCW)
						{
							int reverseIndex = ifd + 2 * nVertsFacet - 2 * k - 2 + bump;
							face_data[reverseIndex] = vertIndex;
							face_data[reverseIndex + 1] = normIndex;
							pSource[iSource + nVertsFacet - k - 1 + (bump?nVertsFacet:0)] = iVertNumber;
						}

					
					}
					ifd += nVertsFacet * 2;
					iSource += nVertsFacet;
					if (!boolBackCull)
					{
						ifd += nVertsFacet * 2 + 1;
						iSource += nVertsFacet;
					}
				}
				j += nVerts;   	 // next face  -- the j++ in loop bumps over -1
			}


			face_data[ifd] = 0;

			// Load the verts and faces
			ChNrFaceArray facesAdded;
			int numFacesAdded;
			ChNrMeshAddFaces(mesh,
					       numV,
					       (ChNrVector*) pV,
					       numN,
					       (ChNrVector*) pN,
					       face_data,
					       &numFacesAdded,
					       &facesAdded);
		
			// Assign colors and textures to faces
			int inc = 1;
			if(!boolBackCull) inc *= 2;	 // only every other face if we did back faces
 			unsigned int ifacet;

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

			for( ifacet = 0, j = 0; int(ifacet) < numFacesAdded; ifacet += inc)
			{
				ChNrFace elt;
				int count = ChNrFaceGetVertexCount(GetElement(facesAdded, ifacet, elt));
				D3DRelease(elt);

				for(int k = 0; k < count; k++)
				{				
 					iSource = j * inc + k;
					if(boolCCW && boolBackCull)
					{
						// reverse the texture && material coords; we already reversed the vertex order
						//iSource = j + count - k - 1; 
					}
					int	iVertNumber = pSource[iSource];
					int iface = pCoordToFace[iVertNumber];

					int index = ChNrFaceGetVertexIndex(GetElement(facesAdded,ifacet, elt), k);
					D3DRelease(elt);

					if(boolUseTexture) 
					{
						int iC3 = pNode->coordIndex.values[iVertNumber] * 3;
						GxVec3f textCoord = pTxMap->GetCoord3(iVertNumber, pC3->point.values+iC3);
						ChNrMeshSetTextureCoordinates(mesh, index, textCoord.x(), textCoord.y());
					}
					if(k == 0 || !boolColorByFace)
					{
						// Color the verts if necessary, but just faces if possible
						int iVert = boolColorByFace ? -1 : index;  // -1 means set face color
						materialMap.Set(mesh, GetElement(facesAdded, unsigned(ifacet), elt), iVert, iface, iVertNumber);
						D3DRelease(elt);
					}
				}

				// If we applied a color to the face for some reason (like transparency)
				// we need to copy that color to the backface, if there is one
				// BUG HERE! We are not handling meshes with a mixture of transparency 
				// and opaque
				if( inc > 1  /*!boolBackCull && (ChNrMeshGetColorSource(mesh) == ColorFromFace )*/)
				{
					ChNrFace elt;
					ChNativeColor color = ChNrFaceGetColor(GetElement(facesAdded, ifacet, elt));
					D3DRelease(elt);
					ChNrFaceSetColor(GetElement(facesAdded, ifacet+1, elt), color);
					D3DRelease(elt);
				}

				j += count;
			}

			m_boolCanCollapse = (ChNrMeshGetColorSource(mesh) == ColorFromFace );
			//ChNrFrameSetColor(m_frame, RLCreateColorRGBA(RLVal(0.6), RLVal(0.6), RLVal(0.6),
			//	RLVal(0.4)));

			if(boolUseTexture)
			{
				// This is in case the texture is already arrived
				ChTextureHandle hdl = pTextureData->GetTextureHandle();
				if(hdl)
				{
					// Texture guy got here first, apply it
					//ChNrMeshSetTexture(mesh, hdl);
					SetTexture(pTextureData);

				}
			}  


		 	// Cleanup
			delete [] pN;
			delete [] pV;
			delete [] faceNorms;
			delete [] uniqueNorms;
			delete [] sharedNorms;
			delete [] verts;
			delete [] face_data;
			delete [] texIndices;
			delete [] texVerts;
			delete [] pSource;
			delete [] pCoordToFace;

			ChNrFree(facesAdded);							  
			delete pTxMap;

		}
		else
		{
			// Notify them of the bad node TODO
		}

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

bool ChQvIFSInstance::Draw(ChRenderContext *pRC, ChDrawIterator *pIterator)
{
#if defined( CH_USE_3DR )
	{
		G3dHandle_t hGC = pRC->GetGC();
		Dword_t  hRC = pRC->GetRC();
		QvIndexedFaceSet *pNode = (QvIndexedFaceSet *)GetNode();
		pRC->SetModelTransform(GetTransform());

		pRC->SetShading(this);

		Fixed32_t wMattNum = 0;	  // for now always use material 0
		G3dSetCurrentMatt(hGC, wMattNum );

		// Interpret shapehints; we assume there is at least one there; (we inited to make sure)
		Fixed32_t lIsCCW = (GetShapeHints()->vertexOrdering.value == QvShapeHints::COUNTERCLOCKWISE);
	    G3dSetState( hGC, G3DL_FRONT_CCW, &lIsCCW);

		// Figure out if we can backcull. solid + known order means we can
		bool boolBackCull = ((GetShapeHints()->vertexOrdering.value != QvShapeHints::UNKNOWN_ORDERING) &&
					(GetShapeHints()->shapeType.value == QvShapeHints::SOLID));
		Float_t		cull = boolBackCull;
		G3dSetMatt( hGC,  wMattNum, G3DM_BACK_CULL,	(Float_t *)&cull );
	
		// Make a material mapping; we will use later for each face
		ChQvFaceSetMaterials materialMap( this );	// making this is cheap; don't cache

		// Normals
		int	face = 0;

									/* If they can't write good nodes, don't draw them! */				 
		if(((ChQvIFSRenderData *)m_pRenderData)->IsValid())
		{
		
			ChQvIndexedFaceSetNormals *pNormals = ((ChQvIFSRenderData *)m_pRenderData)->GetNormals();


			/* 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;
	
			ChQvIFSTextures	*pTxMap = 0;
	 
			if(boolUseTexture)
			{
				pRC->SetTexture(pTextureData->GetTextureHandle());
				pTxMap = new ChQvIFSTextures( this );	// efficient except for many-faced
															// textured ifs' with default map,
															// which are unlikely because they
															// would be b ugly, so don't
															// bother to 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av中文字幕不卡| 精品一区二区三区视频在线观看| 精品国产91乱码一区二区三区| 欧美做爰猛烈大尺度电影无法无天| 国产成a人亚洲精品| 国产v日产∨综合v精品视频| 国产综合久久久久影院| 狠狠色丁香婷婷综合久久片| 国内一区二区视频| 国产成人高清在线| 成熟亚洲日本毛茸茸凸凹| 成人综合激情网| 色婷婷久久99综合精品jk白丝| 91啪亚洲精品| 欧美日韩在线观看一区二区| 欧美美女一区二区| 日韩精品中文字幕在线一区| 久久女同精品一区二区| 国产亚洲一二三区| 国产精品女人毛片| 亚洲一区二区在线观看视频| 亚洲电影一级片| 美女视频网站久久| 成人一级片网址| 欧美一a一片一级一片| 日韩午夜小视频| 中文字幕第一区| 亚洲国产欧美在线人成| 久久国产精品99久久久久久老狼| 国产激情一区二区三区四区| 色婷婷综合中文久久一本| 欧美蜜桃一区二区三区| 久久亚洲免费视频| 一区二区三区日韩精品视频| 欧美bbbbb| 成人免费视频caoporn| 欧美老肥妇做.爰bbww视频| 国产欧美日韩在线观看| 午夜视黄欧洲亚洲| 成人精品高清在线| 日韩欧美国产综合一区| 国产精品初高中害羞小美女文| 亚洲sss视频在线视频| 成人a免费在线看| 日韩一区二区在线免费观看| 中文字幕一区二区三区精华液| 日韩电影在线观看电影| 91亚洲精品久久久蜜桃网站| 欧美成人a在线| 午夜亚洲国产au精品一区二区| 国产福利一区二区三区在线视频| 欧美日本在线视频| 亚洲欧美色图小说| 国产精品888| 欧美成人精品高清在线播放| 一区二区三区在线观看欧美| 国产69精品久久99不卡| 精品国产sm最大网站| 亚洲成人一区二区| 色一情一伦一子一伦一区| 国产精品素人视频| 国产成人精品亚洲777人妖| 精品91自产拍在线观看一区| 日韩专区一卡二卡| 欧美日韩久久久一区| 亚洲人成人一区二区在线观看| 国产美女精品人人做人人爽| 日韩网站在线看片你懂的| 午夜成人在线视频| 欧美综合一区二区| 亚洲一二三区视频在线观看| 色婷婷国产精品| 亚洲欧美一区二区三区极速播放| 成人h版在线观看| 中文字幕制服丝袜一区二区三区 | 蜜臀av性久久久久蜜臀aⅴ | 欧美高清在线一区| 精品一区二区三区久久久| 91精品国产综合久久婷婷香蕉| 亚洲成人av免费| 欧美日韩国产影片| 亚洲成人av福利| 欧美狂野另类xxxxoooo| 蜜桃传媒麻豆第一区在线观看| 91精品国产高清一区二区三区蜜臀 | 成人的网站免费观看| 国产亚洲成aⅴ人片在线观看 | 色成人在线视频| 在线免费不卡电影| 色综合久久久久久久| 亚洲摸摸操操av| 欧美色精品在线视频| 午夜精品福利久久久| 91麻豆精品国产91久久久更新时间| 日本亚洲最大的色成网站www| 国产精品主播直播| 麻豆视频一区二区| 视频一区视频二区在线观看| 亚洲欧美日韩国产手机在线 | 奇米在线7777在线精品| 一区二区三区四区视频精品免费| 久久久午夜精品| 日韩三级在线观看| 91麻豆精品国产综合久久久久久| 91在线精品一区二区三区| 高清在线观看日韩| 国产一区二区在线观看视频| 麻豆精品国产传媒mv男同| 午夜精品一区二区三区三上悠亚| 一区二区三区美女视频| 中文字幕一区三区| 日韩毛片精品高清免费| 亚洲欧美综合色| 亚洲青青青在线视频| 亚洲欧美日韩国产成人精品影院| 日韩伦理电影网| 亚洲免费视频中文字幕| 亚洲精品视频在线观看网站| 亚洲人成亚洲人成在线观看图片| 亚洲欧美激情小说另类| 一区二区三区在线视频观看58| 依依成人综合视频| 午夜精品福利一区二区三区蜜桃| 樱花影视一区二区| 视频在线在亚洲| 久久成人免费日本黄色| 国产精品一级片| 成人v精品蜜桃久久一区| 91免费看片在线观看| 91久久一区二区| 91精品麻豆日日躁夜夜躁| 日韩亚洲国产中文字幕欧美| 久久久久国产免费免费| 综合亚洲深深色噜噜狠狠网站| 亚洲欧美日韩精品久久久久| 午夜一区二区三区在线观看| 三级在线观看一区二区| 久久99深爱久久99精品| 成人免费视频网站在线观看| 色婷婷综合久久久中文字幕| 欧美日韩国产乱码电影| 日韩区在线观看| 日本一区二区三区国色天香 | 国产午夜亚洲精品不卡| 亚洲特黄一级片| 天堂av在线一区| 国产精品羞羞答答xxdd| 色成人在线视频| 欧美xxxx在线观看| 国产精品超碰97尤物18| 亚洲444eee在线观看| 国产一区二区精品久久99| 91网站在线播放| 日韩一级大片在线| 中文字幕在线不卡一区| 日韩精品一级中文字幕精品视频免费观看 | 亚洲免费资源在线播放| 日韩中文字幕不卡| 北条麻妃国产九九精品视频| 在线观看三级视频欧美| 2023国产精品视频| 亚洲自拍另类综合| 国产成人在线视频网站| 欧美视频一区二区三区四区| 日韩免费看的电影| 亚洲自拍欧美精品| av一二三不卡影片| 欧美xxx久久| 亚洲sss视频在线视频| 成人性色生活片| 日韩欧美国产一区二区在线播放 | 日韩成人dvd| 色综合色综合色综合色综合色综合| 欧美精品在线视频| 亚洲手机成人高清视频| 国产美女久久久久| 日韩欧美中文字幕精品| 伊人色综合久久天天| 成人18精品视频| 26uuuu精品一区二区| 日韩av成人高清| 欧美亚洲国产bt| 亚洲激情五月婷婷| 成人免费视频视频| 欧美国产精品专区| 激情av综合网| 欧美一级久久久| 亚洲成人av电影| 在线视频一区二区三区| 亚洲视频一区在线| 国产激情视频一区二区在线观看 | 蜜臀av国产精品久久久久| 欧美精品久久久久久久久老牛影院| 国产精品久久久久婷婷二区次| 国产一区二区三区香蕉| 日韩欧美一区在线| 麻豆成人免费电影| 欧美v亚洲v综合ⅴ国产v| 日本少妇一区二区| 欧美一区国产二区|