The way you're iterating the color array is not correct.
For RTS_TL_BYREF or RTS_TL_BYREF_POSD you use:
XSI_RTS_ColorRGBA *color =
in_pGeom->m_pColorPtrArray[index][color_stream_index];
And for RTS_TL_SINGLE_INDEX_ARRAY:
XSI_RTS_ColorRGBA *color =
&in_pGeom->m_pColorArray[m_pIndices[index]][color_stream_index]
So you have to handle both code paths...
Wessam Bahnassi
Microsoft DirectX MVP,
Programmer
Electronic Arts
--
In|Structurez Arabic Gamedev Community
www.instructurez.com
> -----Original Message-----
> From: owner-3dgames(at)Softimage.COM [mailto:owner-3dgames(at)Softimage.COM] On
> Behalf Of Byron Atinson-Jones
> Sent: Saturday, August 19, 2006 5:51 PM
> To: 3DGames(at)Softimage.COM
> Subject:
>
> My first pass code looks like:
>
> XSI_RTS_ColorRGBA *color = in_pGeom->m_pColorPtrArray[0];
>
> for(DWORD dwI = 0; dwI < in_pGeom->m_NbVertices; dwI++)
> {
> XSI_RTS_ColorRGBA a = *color;
>
> color->m_alpha = 0;
> color->m_blue = a.m_red;
> color->m_green = a.m_green;
> color->m_red = a.m_blue;
> ++color;
> }
>
> When applied to something simple like a cube it appears to work fine. When
> I
> moved onto more complex meshes like a sphere it begins to go a bit wrong:
>
> This is the view in shaded:
>
> www.xiotex.com/shaded.JPG
>
> and the same view in dx:
>
> www.xiotex.com/dx.JPG
>
> Any clues you can give me about what I am doing wrong...
>
>
>
> >In XSI_RTS_TriangulatedGeometry's definition:
> >XSI_RTS_ColorRGBA *m_pColorArray;
> >
> >So you have to swizzle that before you use it your shader. Since you're
> >modifying the DXDraw node's code, then you can do the swizzle there or
> >probably better at the graphics sequencer level.
> >
> >Also, the code for DXDraw and the DX graphics sequencer shows what states
> >are overwritten by these nodes. Note that they use a state block to
> preserve
> >original device state after EndScene().
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe 3dgames
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe 3dgames