I trying to fix the Model change from Pixel Source, however, after a couple of Minutes of Loading it crashing neuz and there's an error message saying
ErrorOnDraw Func.:
Code:
void CWndModelChange::OnDraw( C2DRender* p2DRender )
{
if( m_bStart )
{
static CRect rectStaticTemp;
LPWNDCTRL lpStatic = GetWndCtrl( WIDC_PC_DELAY );
rectStaticTemp.TopLeft().y = lpStatic->rect.top+2;
rectStaticTemp.TopLeft().x = lpStatic->rect.left+2;
rectStaticTemp.BottomRight().y = lpStatic->rect.bottom;
int nGaugeWidth(lpStatic->rect.left + static_cast<int>(static_cast<float>(lpStatic->rect.right - lpStatic->rect.left) * m_fGaugeRate));
nGaugeWidth = nGaugeWidth < lpStatic->rect.right ? nGaugeWidth : lpStatic->rect.right;
rectStaticTemp.BottomRight().x = nGaugeWidth;
assert(m_pVBSmeltGauge != NULL);
m_pTheme->RenderGauge(p2DRender, &rectStaticTemp, 0xffffffff, m_pVBSmeltGauge, &m_texGauEmptyNormal);
}
if( m_pMainItem && m_pItemElem )
{
CItemElem* pCurrentElem = m_pItemElem;
LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetSamplerState ( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetSamplerState ( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetRenderState( D3DRS_AMBIENT, D3DCOLOR_ARGB( 255, 255,255,255) );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
CRect rect = GetClientRect();
if( pCurrentElem->GetProp()->dwItemKind1 != IK1_ARMOR )
{
D3DVIEWPORT9 viewport;
D3DXMATRIXA16 matWorld;
D3DXMATRIXA16 matScale;
D3DXMATRIXA16 matRot;
D3DXMATRIXA16 matTrans;
D3DXCOLOR color;
D3DXMatrixIdentity(&matScale);
D3DXMatrixIdentity(&matTrans);
D3DXMatrixIdentity(&matWorld);
D3DXVECTOR3 vEyePt(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 vLookatPt(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 vUpVec(0.0f, 1.0f, 0.0f);
if( (pCurrentElem->GetProp()->dwItemKind3 == IK3_AXE || pCurrentElem->GetProp()->dwItemKind3 == IK3_SWD ) )
{
if(pCurrentElem->GetProp()->dwHanded == HD_ONE)
{
vEyePt.x = 0.0f;
vEyePt.y = 3.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 0.6f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
else if(pCurrentElem->GetProp()->dwHanded == HD_TWO )
{
vEyePt.x = 1.0f;
vEyePt.y = 5.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 1.2f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
}
else if(pCurrentElem->GetProp()->dwItemKind3 == IK3_YOYO ||
pCurrentElem->GetProp()->dwItemKind3 == IK3_KNUCKLEHAMMER ||
pCurrentElem->GetProp()->dwItemKind3 == IK3_BOW
#ifdef __16_DATA
|| pCurrentElem->GetProp()->dwItemKind3 == IK3_CROSSBOW
#endif
)
{
vEyePt.x = 0.0f;
vEyePt.y = 3.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 0.01f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
else if(pCurrentElem->GetProp()->dwItemKind3 == IK3_WAND)
{
vEyePt.x = 0.0f;
vEyePt.y = 3.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 0.4f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
else if(pCurrentElem->GetProp()->dwItemKind3 == IK3_CHEERSTICK ||
pCurrentElem->GetProp()->dwItemKind3 == IK3_STAFF)
{
vEyePt.x = 0.0f;
vEyePt.y = 4.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 0.01f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
if(m_nStatus == 1)
{
vEyePt.y += m_nEyeYPos;
}
D3DXMATRIXA16 matView;
D3DXMatrixLookAtLH(&matView, &vEyePt, &vLookatPt, &vUpVec);
pd3dDevice->SetTransform(D3DTS_VIEW, &matView);
D3DXMATRIXA16 matProj;
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
m_fRotate += m_fAddRot;
D3DXMatrixRotationX(&matRot, D3DXToRadian( m_fRotate ) );
D3DXMatrixScaling(&matScale, 1.5f, 1.5f, 1.5f);
LPWNDCTRL lpFace = GetWndCtrl( WIDC_CUSTOM1 );
viewport.X = p2DRender->m_ptOrigin.x + lpFace->rect.left;
viewport.Y = p2DRender->m_ptOrigin.y + lpFace->rect.top;
viewport.Width = lpFace->rect.Width();
viewport.Height = lpFace->rect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0xffa08080, 1.0f, 0 );
D3DXMatrixMultiply(&matWorld,&matWorld,&matScale);
D3DXMatrixMultiply(&matWorld, &matWorld, &matRot );
D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans );
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
::SetLight( FALSE );
::SetFog( FALSE );
SetDiffuse( 1.0f, 1.0f, 1.0f );
SetAmbient( 1.0f, 1.0f, 1.0f );
D3DXVECTOR4 vConst( 1.0f, 1.0f, 1.0f, 1.0f );
pd3dDevice->SetVertexShaderConstantF( 95, (float*)&vConst, 1 );
::SetTransformView( matView );
::SetTransformProj( matProj );
m_pMainItem->Render( p2DRender->m_pd3dDevice, &matWorld );
viewport.X = p2DRender->m_ptOrigin.x;
viewport.Y = p2DRender->m_ptOrigin.y;
viewport.Width = p2DRender->m_clipRect.Width();
viewport.Height = p2DRender->m_clipRect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
}
else
{
D3DVIEWPORT9 viewport;
LPWNDCTRL lpFace = GetWndCtrl( WIDC_CUSTOM1 );
viewport.X = p2DRender->m_ptOrigin.x + lpFace->rect.left;
viewport.Y = p2DRender->m_ptOrigin.y + lpFace->rect.top;
viewport.Width = lpFace->rect.Width();
viewport.Height = lpFace->rect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0xffa08080, 1.0f, 0 ) ;
POINT point = GetMousePoint();
point.x -= 280;
point.y -= 15;
CRect rectViewport( 0, 0, viewport.Width, viewport.Height );
D3DXMATRIX matProj;
D3DXMatrixIdentity( &matProj );
FLOAT fAspect = ( (FLOAT) viewport.Width ) / (FLOAT) viewport.Height ;
FLOAT fov = D3DX_PI / 4.0f;//796.0f;
FLOAT h = cos( fov / 2 ) / sin( fov / 2 );
FLOAT w = h * fAspect;
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
D3DXMATRIX matView;
D3DXVECTOR3 vecLookAt( 0.0f, 0.0f, 3.0f );
D3DXVECTOR3 vecPos( 0.0f, 0.0f, -5.0f );
if(m_nStatus == 1)
{
vecPos.y += m_nEyeYPos;
}
D3DXMatrixLookAtLH( &matView, &vecPos, &vecLookAt, &D3DXVECTOR3(0.0f,1.0f,0.0f) );
pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
D3DXMATRIXA16 matWorld;
D3DXMATRIXA16 matScale;
D3DXMATRIXA16 matRot;
D3DXMATRIXA16 matTrans;
D3DXMatrixIdentity(&matScale);
D3DXMatrixIdentity(&matRot);
D3DXMatrixIdentity(&matTrans);
D3DXMatrixIdentity(&matWorld);
m_fRotate += m_fAddRot;
D3DXMatrixRotationY(&matRot, D3DXToRadian( m_fRotate ) );
D3DXMatrixScaling(&matScale,1.5f,1.5f,1.5f);//1.4f,1.4f,1.4f
D3DXMatrixTranslation(&matTrans,0.0f,-1.1f,0.0f);
D3DXMatrixMultiply(&matWorld,&matWorld,&matScale);
D3DXMatrixMultiply(&matWorld, &matWorld,&matRot);
D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans );
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );//m_bViewLight );
::SetLight( FALSE );
::SetFog( FALSE );
SetDiffuse( 1.0f, 1.0f, 1.0f );
SetAmbient( 1.0f, 1.0f, 1.0f );
m_pMainItem->FrameMove();
D3DXVECTOR4 vConst( 1.0f, 1.0f, 1.0f, 1.0f );
#ifdef __YENV
g_Neuz.m_pEffect->SetVector( g_Neuz.m_hvFog, &vConst );
#else //__YENV
pd3dDevice->SetVertexShaderConstantF( 95, (float*)&vConst, 1 );
#endif //__YENV
::SetTransformView( matView );
::SetTransformProj( matProj );
O3D_ELEMENT* pElem = m_pMainItem->GetParts( PARTS_HAIR );
if( pElem && pElem->m_pObject3D )
{
if( m_Player.m_bySex == SEX_MALE )
{
pElem->m_pObject3D->m_fAmbient[0] = (nMaleHairColor[m_Player.m_byHairMesh][0])/255.f;
pElem->m_pObject3D->m_fAmbient[1] = (nMaleHairColor[m_Player.m_byHairMesh][1])/255.f;
pElem->m_pObject3D->m_fAmbient[2] = (nMaleHairColor[m_Player.m_byHairMesh][2])/255.f;
}
else
{
pElem->m_pObject3D->m_fAmbient[0] = (nFeMaleHairColor[m_Player.m_byHairMesh][0])/255.f;
pElem->m_pObject3D->m_fAmbient[1] = (nFeMaleHairColor[m_Player.m_byHairMesh][1])/255.f;
pElem->m_pObject3D->m_fAmbient[2] = (nFeMaleHairColor[m_Player.m_byHairMesh][2])/255.f;
}
}
m_pMainItem->Render( p2DRender->m_pd3dDevice, &matWorld );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
viewport.X = p2DRender->m_ptOrigin.x;// + 5;
viewport.Y = p2DRender->m_ptOrigin.y;// + 5;
viewport.Width = p2DRender->m_clipRect.Width();
viewport.Height = p2DRender->m_clipRect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
}
}
//Test Costumbox 2
if( m_pSkinItem && m_pSkinElem > NULL )
{
CItemElem* pCurrentElem = m_pSkinElem;
LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetSamplerState ( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetSamplerState ( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetRenderState( D3DRS_AMBIENT, D3DCOLOR_ARGB( 255, 255,255,255) );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
CRect rect = GetClientRect();
if( pCurrentElem->GetProp()->dwItemKind1 != IK1_ARMOR )
{
D3DVIEWPORT9 viewport;
D3DXMATRIXA16 matWorld;
D3DXMATRIXA16 matScale;
D3DXMATRIXA16 matRot;
D3DXMATRIXA16 matTrans;
D3DXCOLOR color;
D3DXMatrixIdentity(&matScale);
D3DXMatrixIdentity(&matTrans);
D3DXMatrixIdentity(&matWorld);
D3DXVECTOR3 vEyePt(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 vLookatPt(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 vUpVec(0.0f, 1.0f, 0.0f);
if( (pCurrentElem->GetProp()->dwItemKind3 == IK3_AXE || pCurrentElem->GetProp()->dwItemKind3 == IK3_SWD ) )
{
if(pCurrentElem->GetProp()->dwHanded == HD_ONE)
{
vEyePt.x = 0.0f;
vEyePt.y = 3.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 0.6f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
else if(pCurrentElem->GetProp()->dwHanded == HD_TWO )
{
vEyePt.x = 1.0f;
vEyePt.y = 5.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 1.2f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
}
else if(pCurrentElem->GetProp()->dwItemKind3 == IK3_YOYO ||
pCurrentElem->GetProp()->dwItemKind3 == IK3_KNUCKLEHAMMER ||
pCurrentElem->GetProp()->dwItemKind3 == IK3_BOW
#ifdef __16_DATA
|| pCurrentElem->GetProp()->dwItemKind3 == IK3_CROSSBOW
#endif
)
{
vEyePt.x = 0.0f;
vEyePt.y = 3.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 0.01f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
else if(pCurrentElem->GetProp()->dwItemKind3 == IK3_WAND)
{
vEyePt.x = 0.0f;
vEyePt.y = 3.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 0.4f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
else if(pCurrentElem->GetProp()->dwItemKind3 == IK3_CHEERSTICK ||
pCurrentElem->GetProp()->dwItemKind3 == IK3_STAFF)
{
vEyePt.x = 0.0f;
vEyePt.y = 4.0f;
vEyePt.z = 0.0f;
vLookatPt.x = 0.01f;
vLookatPt.y = -0.2f;
vLookatPt.z = 0.0f;
}
if(m_nStatus == 1)
{
vEyePt.y += m_nEyeYPos;
}
D3DXMATRIXA16 matView;
D3DXMatrixLookAtLH(&matView, &vEyePt, &vLookatPt, &vUpVec);
pd3dDevice->SetTransform(D3DTS_VIEW, &matView);
D3DXMATRIXA16 matProj;
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
m_fRotate += m_fAddRot;
D3DXMatrixRotationX(&matRot, D3DXToRadian( m_fRotate ) );
D3DXMatrixScaling(&matScale, 1.5f, 1.5f, 1.5f);
LPWNDCTRL lpFace = GetWndCtrl( WIDC_CUSTOM2 );
viewport.X = p2DRender->m_ptOrigin.x + lpFace->rect.left;
viewport.Y = p2DRender->m_ptOrigin.y + lpFace->rect.top;
viewport.Width = lpFace->rect.Width();
viewport.Height = lpFace->rect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0xffa08080, 1.0f, 0 );
D3DXMatrixMultiply(&matWorld,&matWorld,&matScale);
D3DXMatrixMultiply(&matWorld, &matWorld, &matRot );
D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans );
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
::SetLight( FALSE );
::SetFog( FALSE );
SetDiffuse( 1.0f, 1.0f, 1.0f );
SetAmbient( 1.0f, 1.0f, 1.0f );
D3DXVECTOR4 vConst( 1.0f, 1.0f, 1.0f, 1.0f );
pd3dDevice->SetVertexShaderConstantF( 95, (float*)&vConst, 1 );
::SetTransformView( matView );
::SetTransformProj( matProj );
m_pSkinItem->Render( p2DRender->m_pd3dDevice, &matWorld );
viewport.X = p2DRender->m_ptOrigin.x;
viewport.Y = p2DRender->m_ptOrigin.y;
viewport.Width = p2DRender->m_clipRect.Width();
viewport.Height = p2DRender->m_clipRect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
}
else
{
D3DVIEWPORT9 viewport;
LPWNDCTRL lpFace = GetWndCtrl( WIDC_CUSTOM2 );
viewport.X = p2DRender->m_ptOrigin.x + lpFace->rect.left;
viewport.Y = p2DRender->m_ptOrigin.y + lpFace->rect.top;
viewport.Width = lpFace->rect.Width();
viewport.Height = lpFace->rect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0xffa08080, 1.0f, 0 ) ;
POINT point = GetMousePoint();
point.x -= 280;
point.y -= 15;
CRect rectViewport( 0, 0, viewport.Width, viewport.Height );
D3DXMATRIX matProj;
D3DXMatrixIdentity( &matProj );
FLOAT fAspect = ( (FLOAT) viewport.Width ) / (FLOAT) viewport.Height ;
FLOAT fov = D3DX_PI / 4.0f;//796.0f;
FLOAT h = cos( fov / 2 ) / sin( fov / 2 );
FLOAT w = h * fAspect;
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
// Ä«¸Þ¶ó
D3DXMATRIX matView;
D3DXVECTOR3 vecLookAt( 0.0f, 0.0f, 3.0f );
D3DXVECTOR3 vecPos( 0.0f, 0.0f, -5.0f );
if(m_nStatus == 1)
{
vecPos.y += m_nEyeYPos;
}
D3DXMatrixLookAtLH( &matView, &vecPos, &vecLookAt, &D3DXVECTOR3(0.0f,1.0f,0.0f) );
pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
D3DXMATRIXA16 matWorld;
D3DXMATRIXA16 matScale;
D3DXMATRIXA16 matRot;
D3DXMATRIXA16 matTrans;
D3DXMatrixIdentity(&matScale);
D3DXMatrixIdentity(&matRot);
D3DXMatrixIdentity(&matTrans);
D3DXMatrixIdentity(&matWorld);
m_fRotate += m_fAddRot;
D3DXMatrixRotationY(&matRot, D3DXToRadian( m_fRotate ) );
D3DXMatrixScaling(&matScale,1.5f,1.5f,1.5f);//1.4f,1.4f,1.4f
D3DXMatrixTranslation(&matTrans,0.0f,-1.1f,0.0f);
D3DXMatrixMultiply(&matWorld,&matWorld,&matScale);
D3DXMatrixMultiply(&matWorld, &matWorld,&matRot);
D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans );
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
// ·£´õ¸µ
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );//m_bViewLight );
::SetLight( FALSE );
::SetFog( FALSE );
SetDiffuse( 1.0f, 1.0f, 1.0f );
SetAmbient( 1.0f, 1.0f, 1.0f );
m_pSkinItem->FrameMove();
D3DXVECTOR4 vConst( 1.0f, 1.0f, 1.0f, 1.0f );
#ifdef __YENV
g_Neuz.m_pEffect->SetVector( g_Neuz.m_hvFog, &vConst );
#else //__YENV
pd3dDevice->SetVertexShaderConstantF( 95, (float*)&vConst, 1 );
#endif //__YENV
::SetTransformView( matView );
::SetTransformProj( matProj );
O3D_ELEMENT* pElem = m_pSkinItem->GetParts( PARTS_HAIR );
if( pElem && pElem->m_pObject3D )
{
if( m_Player.m_bySex == SEX_MALE )
{
pElem->m_pObject3D->m_fAmbient[0] = (nMaleHairColor[m_Player.m_byHairMesh][0])/255.f;
pElem->m_pObject3D->m_fAmbient[1] = (nMaleHairColor[m_Player.m_byHairMesh][1])/255.f;
pElem->m_pObject3D->m_fAmbient[2] = (nMaleHairColor[m_Player.m_byHairMesh][2])/255.f;
}
else
{
pElem->m_pObject3D->m_fAmbient[0] = (nFeMaleHairColor[m_Player.m_byHairMesh][0])/255.f;
pElem->m_pObject3D->m_fAmbient[1] = (nFeMaleHairColor[m_Player.m_byHairMesh][1])/255.f;
pElem->m_pObject3D->m_fAmbient[2] = (nFeMaleHairColor[m_Player.m_byHairMesh][2])/255.f;
}
}
m_pSkinItem->Render( p2DRender->m_pd3dDevice, &matWorld );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
viewport.X = p2DRender->m_ptOrigin.x;// + 5;
viewport.Y = p2DRender->m_ptOrigin.y;// + 5;
viewport.Width = p2DRender->m_clipRect.Width();
viewport.Height = p2DRender->m_clipRect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
}
}
if(m_pItemElem != NULL)
{
CTexture* pTexture;
ItemProp* pItemProp;
LPWNDCTRL pWndCtrl = GetWndCtrl( WIDC_STATIC1 );//main
pItemProp = m_pItemElem->GetProp();
if(pItemProp != NULL)
{
pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pItemProp->szIcon), 0xffff00ff );
if(pTexture != NULL)
pTexture->Render( p2DRender, CPoint( pWndCtrl->rect.left, pWndCtrl->rect.top ) );
}
}
if( m_pSkinElem != NULL )
{
CTexture* pTexture;
ItemProp* pItemProp;
LPWNDCTRL pWndCtrl = GetWndCtrl( WIDC_STATIC2 );//skin
pItemProp = m_pSkinElem->GetProp();
if(pItemProp != NULL)
{
pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pItemProp->szIcon), 0xffff00ff );
if(pTexture != NULL)
pTexture->Render( p2DRender, CPoint( pWndCtrl->rect.left, pWndCtrl->rect.top ) );
}
}
}






