// X3DEffectEditBillboard.cpp: implementation of the CX3DEffectEditBillboard class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "effectEditor.h" #include "X3DEffectEditBillboard.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CX3DEffectEditBillboard::CX3DEffectEditBillboard() { } CX3DEffectEditBillboard::~CX3DEffectEditBillboard() { } void CX3DEffectEditBillboard::RenderNoTexture(unsigned long dwFrame) { m_lpD3DDevice->SetTexture(0, NULL); m_lpD3DDevice->SetRenderState(D3DRS_SRCBLEND, m_dwSrcBlending); m_lpD3DDevice->SetRenderState(D3DRS_DESTBLEND, m_dwDestBlending); m_lpD3DDevice->SetStreamSource(0, m_lpVertices, sizeof(LVertex)); m_lpD3DDevice->SetVertexShader(LVERTEXFVF); m_lpD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); } unsigned long CX3DEffectEditBillboard::GetPick(vector3 &vecStart, vector3 &vecEnd, float &fLength) { vector3 vecVertices[3]; LVertex *pVertices; if(FAILED( m_lpVertices->Lock( 0, 4 * sizeof(LVertex), (unsigned char **)&pVertices, 0 ) ) ) return FALSE; vecVertices[0] = pVertices[0].v; vecVertices[1] = pVertices[1].v; vecVertices[2] = pVertices[2].v; if(CIntersection::PolygonRay(vecStart, vecEnd, vecVertices, fLength)) { m_lpVertices->Unlock(); return m_dwEffectKind; } vecVertices[0] = pVertices[1].v; vecVertices[1] = pVertices[2].v; vecVertices[2] = pVertices[3].v; if(CIntersection::PolygonRay(vecStart, vecEnd, vecVertices, fLength)) { m_lpVertices->Unlock(); return m_dwEffectKind; } m_lpVertices->Unlock(); fLength = 0.0f; return 0xFFFFFFFF; } /*void CX3DEffectEditBillboard::EditFrame(unsigned long dwFrame, unsigned long dwNewFrame) { LPPlaneKey pPlaneKey; if(!m_lstAniKey.empty()) { PlaneKeyList::iterator it = m_lstAniKey.find(dwFrame); if(it != m_lstAniKey.end()) { pPlaneKey = (LPPlaneKey)((*it).second); m_lstAniKey.erase(it); pPlaneKey->dwFrame = dwNewFrame; m_lstAniKey.insert(PL_VT(pPlaneKey->dwFrame, pPlaneKey)); } } }*/ BOOL CX3DEffectEditBillboard::ArrangementTexture(const char *strPathName) { if(!strncmp(m_strTextureFile, strPathName, strlen(strPathName))) { strcpy(m_strTextureFile, &m_strTextureFile[strlen(strPathName)]); return TRUE; } else return FALSE; }