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>
131 lines
2.7 KiB
C++
131 lines
2.7 KiB
C++
/**************************
|
|
ROcclusion Header file
|
|
Info : Horizon Occlusion Culling's Header
|
|
|
|
: 대일형 list 이용안한 버젼 입니다.
|
|
: CheckCulling 안에 리스트를 넣어주시면 됩니다.
|
|
: list의 형은 ROcclusionUnit이고 m_Cube 변수만 채워 주시면 되요.
|
|
|
|
************************* */
|
|
|
|
#ifndef __ROCCLUSION_H__
|
|
#define __ROCCLUSION_H__
|
|
#include <d3dx8.h>
|
|
#include <d3d8.h>
|
|
#include "RCube.h"
|
|
|
|
|
|
#define INIT_HEIGHT 10000.0f
|
|
const float FAIL = -32767.0f;
|
|
|
|
// Sorting 용 global Function
|
|
int OcclusionHCompare( const void *arg1, const void *arg2 ); // Horizon Culling 용
|
|
|
|
class ROcclusionUnit //Horizon 용
|
|
{
|
|
protected:
|
|
class ROcclusionBox //projected Screen 2D Box
|
|
{
|
|
public:
|
|
D3DXVECTOR2 m_vecMin;
|
|
D3DXVECTOR2 m_vecMax;
|
|
D3DXVECTOR3 m_vecCenter;
|
|
float m_fZValue; //camera space 에서의 Z Value
|
|
|
|
|
|
ROcclusionBox()
|
|
{
|
|
|
|
m_vecMin = D3DXVECTOR2(0.0f,0.0f);
|
|
m_vecMax = D3DXVECTOR2(0.0f,0.0f);
|
|
m_vecCenter = D3DXVECTOR3(10000.0f,10000.0f,10000.0f);
|
|
m_fZValue = 0.0f;
|
|
|
|
}
|
|
~ROcclusionBox() {}
|
|
|
|
//box 안에 있는지 검사
|
|
bool ROcclusionInBox(ROcclusionBox tb)
|
|
{
|
|
if( ( m_vecMin.x <= tb.m_vecMin.x ) && ( m_vecMin.y <= tb.m_vecMin.y ) &&
|
|
( m_vecMax.x >= tb.m_vecMax.x ) && ( m_vecMax.y >= tb.m_vecMax.y ) )
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
};
|
|
void CreateOccBox(D3DXVECTOR3 min,D3DXVECTOR3 max,D3DXVECTOR3 center,bool projected = false);
|
|
void FindPoint(D3DXVECTOR3 *);
|
|
|
|
public:
|
|
ROcclusionUnit()
|
|
{
|
|
m_bVis = NULL;
|
|
if(m_bVis != NULL)( *m_bVis ) = true;
|
|
|
|
}
|
|
~ROcclusionUnit() {}
|
|
|
|
void Create(LPDIRECT3DDEVICE8 device);
|
|
|
|
RCube m_Cube; // Cube Data
|
|
ROcclusionBox m_OccBox; // 2D Projection Box
|
|
bool *m_bVis;
|
|
|
|
LPDIRECT3DDEVICE8 m_Device;
|
|
|
|
};
|
|
|
|
class ROcclusionVolume // Occlusion Volume
|
|
{
|
|
public:
|
|
float m_Height;
|
|
ROcclusionVolume()
|
|
{
|
|
m_Height = INIT_HEIGHT;
|
|
}
|
|
};
|
|
|
|
class ROcclusion
|
|
{
|
|
public:
|
|
|
|
ROcclusion()
|
|
{
|
|
m_Volume = NULL;
|
|
m_VWidth = 0;
|
|
m_VHeight = 0;
|
|
m_ViewObject = -1;
|
|
m_HidenObject = -1;
|
|
|
|
}
|
|
~ROcclusion()
|
|
{
|
|
if( m_Volume )
|
|
delete[] m_Volume;
|
|
}
|
|
|
|
static void CheckCulling( LPDIRECT3DDEVICE8 ,ROcclusionUnit *,int num,float camera_x,float camera_y,float camera_z );
|
|
static void SortList( ROcclusionUnit *,int num,float camerax,float cameray,float cameraz,LPDIRECT3DDEVICE8 );
|
|
|
|
|
|
//Horizon occlusion culling
|
|
static void Hculling( ROcclusionUnit *list,int listnum,int start_index,float ,float ,float );
|
|
static void HorizonCull( LPDIRECT3DDEVICE8 ,ROcclusionUnit *,int listnum );
|
|
static void InitVolume();
|
|
|
|
static ROcclusionVolume *m_Volume;
|
|
// Screen Width, Height
|
|
static unsigned long m_VWidth;
|
|
static unsigned long m_VHeight;
|
|
|
|
//occlusion info
|
|
static int m_ViewObject;
|
|
static int m_HidenObject;
|
|
|
|
|
|
};
|
|
|
|
#endif
|