Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
90 lines
2.4 KiB
C++
90 lines
2.4 KiB
C++
// X3DEffectEditCylinder.cpp: implementation of the CX3DEffectEditCylinder class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "effectEditor.h"
|
|
#include "X3DEffectEditCylinder.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CX3DEffectEditCylinder::CX3DEffectEditCylinder()
|
|
{
|
|
|
|
}
|
|
|
|
CX3DEffectEditCylinder::~CX3DEffectEditCylinder()
|
|
{
|
|
|
|
}
|
|
|
|
void CX3DEffectEditCylinder::RenderNoTexture(unsigned long dwFrame)
|
|
{
|
|
if(m_lpVertices == NULL) return;
|
|
|
|
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, m_dwPrimitive);
|
|
}
|
|
|
|
unsigned long CX3DEffectEditCylinder::GetPick(vector3 &vecStart, vector3 &vecEnd, float &fLength)
|
|
{
|
|
vector3 vecVertices[3];
|
|
|
|
unsigned long i;
|
|
|
|
LVertex *pVertices;
|
|
if(FAILED( m_lpVertices->Lock( 0, ((m_dwSidePlane + 1) * 2) * sizeof(LVertex), (unsigned char **)&pVertices, 0 ) ) )
|
|
return FALSE;
|
|
|
|
for(i = 0; i < m_dwSidePlane; i++)
|
|
{
|
|
vecVertices[0] = pVertices[i * 2 + 0].v;
|
|
vecVertices[1] = pVertices[i * 2 + 1].v;
|
|
vecVertices[2] = pVertices[i * 2 + 2].v;
|
|
|
|
if(!(vecVertices[0] == vecVertices[1] || vecVertices[0] == vecVertices[2] || vecVertices[1] == vecVertices[2]))
|
|
if(CIntersection::PolygonRay(vecStart, vecEnd, vecVertices, fLength))
|
|
{
|
|
m_lpVertices->Unlock();
|
|
return m_dwEffectKind;
|
|
}
|
|
|
|
vecVertices[0] = pVertices[i * 2 + 1].v;
|
|
vecVertices[1] = pVertices[i * 2 + 3].v;
|
|
vecVertices[2] = pVertices[i * 2 + 2].v;
|
|
|
|
if(!(vecVertices[0] == vecVertices[1] || vecVertices[0] == vecVertices[2] || vecVertices[1] == vecVertices[2]))
|
|
if(CIntersection::PolygonRay(vecStart, vecEnd, vecVertices, fLength))
|
|
{
|
|
m_lpVertices->Unlock();
|
|
return m_dwEffectKind;
|
|
}
|
|
}
|
|
|
|
m_lpVertices->Unlock();
|
|
fLength = 0.0f;
|
|
return 0xFFFFFFFF;
|
|
}
|
|
|
|
BOOL CX3DEffectEditCylinder::ArrangementTexture(const char *strPathName)
|
|
{
|
|
if(!strncmp(m_strTextureFile, strPathName, strlen(strPathName)))
|
|
{
|
|
strcpy(m_strTextureFile, &m_strTextureFile[strlen(strPathName)]);
|
|
return TRUE;
|
|
} else
|
|
return FALSE;
|
|
}
|