Files
Client/GameTools/EffectEditor/X3DEffectEditSphere.cpp
LGram16 dd97ddec92 Restructure repository to include all source folders
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>
2025-11-29 20:17:20 +09:00

94 lines
2.6 KiB
C++

// X3DEffectEditSphere.cpp: implementation of the CX3DEffectEditSphere class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "effectEditor.h"
#include "X3DEffectEditSphere.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CX3DEffectEditSphere::CX3DEffectEditSphere()
{
}
CX3DEffectEditSphere::~CX3DEffectEditSphere()
{
}
void CX3DEffectEditSphere::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->SetIndices(m_lpVerticeIndex, 0);
m_lpD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, m_dwNumVertex, 0, m_dwPrimitive);
}
unsigned long CX3DEffectEditSphere::GetPick(vector3 &vecStart, vector3 &vecEnd, float &fLength)
{
vector3 vecVertices[3];
unsigned long i;
LVertex *pVertices;
if(FAILED( m_lpVertices->Lock( 0, (m_dwSidePlane + 1) * (m_dwSegment + 1) * 2 * sizeof(LVertex), (unsigned char **)&pVertices, 0 ) ) )
return FALSE;
unsigned short *pVerticeIndex;
m_lpVerticeIndex->Lock(0, m_dwSidePlane * m_dwTotalSegment * 2 * 3 * sizeof(unsigned short), (unsigned char **)&pVerticeIndex, 0);
for(i = 0; i < m_dwSidePlane * m_dwTotalSegment; i++)
{
vecVertices[0] = pVertices[pVerticeIndex[i * 6 + 0]].v;
vecVertices[1] = pVertices[pVerticeIndex[i * 6 + 1]].v;
vecVertices[2] = pVertices[pVerticeIndex[i * 6 + 2]].v;
if(CIntersection::PolygonRay(vecStart, vecEnd, vecVertices, fLength))
{
m_lpVerticeIndex->Unlock();
m_lpVertices->Unlock();
return m_dwEffectKind;
}
vecVertices[0] = pVertices[pVerticeIndex[i * 6 + 3]].v;
vecVertices[1] = pVertices[pVerticeIndex[i * 6 + 4]].v;
vecVertices[2] = pVertices[pVerticeIndex[i * 6 + 5]].v;
if(CIntersection::PolygonRay(vecStart, vecEnd, vecVertices, fLength))
{
m_lpVerticeIndex->Unlock();
m_lpVertices->Unlock();
return m_dwEffectKind;
}
}
fLength = 0.0f;
m_lpVerticeIndex->Unlock();
m_lpVertices->Unlock();
return 0xFFFFFFFF;
}
BOOL CX3DEffectEditSphere::ArrangementTexture(const char *strPathName)
{
if(!strncmp(m_strTextureFile, strPathName, strlen(strPathName)))
{
strcpy(m_strTextureFile, &m_strTextureFile[strlen(strPathName)]);
return TRUE;
} else
return FALSE;
}