// X3DEffectEditPlane.cpp: implementation of the CX3DEffectEditPlane class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "effectEditor.h" #include "X3DEffectEditPlane.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CX3DEffectEditPlane::CX3DEffectEditPlane() { } CX3DEffectEditPlane::~CX3DEffectEditPlane() { } void CX3DEffectEditPlane::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 CX3DEffectEditPlane::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; } BOOL CX3DEffectEditPlane::ArrangementTexture(const char *strPathName) { if(!strncmp(m_strTextureFile, strPathName, strlen(strPathName))) { strcpy(m_strTextureFile, &m_strTextureFile[strlen(strPathName)]); return TRUE; } else return FALSE; }