RE: DirectX vertex colours

Date : Sun, 20 Aug 2006 20:42:51 +0100
To : 3DGames(at)Softimage.COM
From : Byron Atinson-Jones <byron(at)xiotex.free-online.co.uk>
Subject : RE: DirectX vertex colours
Resolution:

The rogue vertex colours were solved by triangulating the source mesh.

In the end I took a look at the DX9 sequencer - which I was surprised to find in
the SDK - my swizzle code now looks like:

	XSI_RTS_TriangulatedGeometry	tmpGeom = *in_pGeom; 

	if(in_pGeom->m_Type == RTS_TL_BYREF || in_pGeom->m_Type == RTS_TL_BYREF_POSD)
	{
		for(DWORD i = 0; i < in_pGeom->m_lNbTriangleLists; i++)
		{
			if(tmpGeom.m_pColorPtrArray)
			{
				tmpGeom.m_pColorPtrArray = in_pGeom->m_pColorPtrArray +
in_pGeom->m_pTriangleLists[i].m_lOffset;
			}


			for(DWORD j = 0; j < in_pGeom->m_pTriangleLists[i].m_lNbVertices; j++)
			{	
				// Colors
				if(in_pGeom->m_pColorPtrArray)
				{

					color1 = *tmpGeom.m_pColorPtrArray[j];
					color.m_alpha = color1.m_alpha;
					color.m_red = color1.m_blue;
					color.m_green = color1.m_green;
					color.m_blue = color1.m_red;
					*tmpGeom.m_pColorPtrArray[j] = color;

				}
			}

		}
	}
	else
	{
		ULONG* pIndex = in_pGeom->m_pIndices;
		DWORD j;

		// Draw triangles by ref (DOUBLE position)
		for(DWORD i = 0; i < in_pGeom->m_lNbTriangleLists; i++)
		{

			for(j = 0, pIndex = in_pGeom->m_pIndices +
in_pGeom->m_pTriangleLists[i].m_lOffset; j <
in_pGeom->m_pTriangleLists[i].m_lNbVertices; j++, pIndex++)
			{	

				int l_index = *pIndex;

				if(in_pGeom->m_pColorArray)
				{
					color1 = in_pGeom->m_pColorArray[l_index];
					color.m_alpha = color1.m_alpha;
					color.m_red = color1.m_blue;
					color.m_green = color1.m_green;
					color.m_blue = color1.m_red;
					in_pGeom->m_pColorArray[l_index] = color;
				}
			}
		}

	}


---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe 3dgames


Search the 3D Games List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.