54 lines
1.9 KiB
C++
54 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include "TerrainProp.h"
|
|
#include "KRenderObject.h"
|
|
#include "KSmartPtr.h"
|
|
|
|
class CTerrainMapEngine;
|
|
class CTerrainSegment;
|
|
|
|
class CTerrainPropForGame : public CTerrainProp
|
|
{
|
|
public:
|
|
CTerrainPropForGame( TERRAINPROP_ID id, const K3DVector& rPos, const K3DVector& rRotate, const K3DVector& rScale, float fZOffset, WORD wPropNum, const CTerrainPropInfo* pPropInfo, CTerrainMapEngine* pMapEngine, const CTerrainSegment* pParent, bool bLockHeight ,int segmentIdx, int propIdx, bool bEnableLightmap, short nTexturegroupindex )
|
|
: CTerrainProp( rPos, rRotate, rScale, fZOffset, wPropNum, pPropInfo, bLockHeight, segmentIdx, propIdx, bEnableLightmap, nTexturegroupindex ),
|
|
m_ID( id ), m_nRefCount( 0 ), m_unContinuousRenderCount( 0 ), m_pMapEngine( pMapEngine ), m_unLastProcessedTick(0), m_pParent( pParent ) { }
|
|
|
|
void Release();
|
|
int AddRef()
|
|
{
|
|
InterlockedIncrement( (volatile LONG *)&m_nRefCount );
|
|
return m_nRefCount;
|
|
}
|
|
int GetRefCount() { return m_nRefCount; }
|
|
|
|
/// 서버로 보낼 prop고유 ID
|
|
TERRAINPROP_ID GetID() const { return m_ID; }
|
|
|
|
bool GetProcessFlagAtThisTick() const;
|
|
void SetProcessFlagAtThisTick();
|
|
|
|
const CTerrainSegment* GetParentSegment() const{ return m_pParent; }
|
|
|
|
/// 최근 몇번이나 연속적으로 렌더링 되었는가?
|
|
unsigned GetContinuousRenderCount() const { return m_unContinuousRenderCount; }
|
|
|
|
void GetNearVertices( float x, float y, K3DVertex* pGetVertices ) const;
|
|
|
|
virtual void Render( KViewportObject* pViewport );
|
|
|
|
private:
|
|
TERRAINPROP_ID m_ID;
|
|
unsigned m_unContinuousRenderCount;
|
|
unsigned m_unLastProcessedTick;
|
|
volatile int m_nRefCount;
|
|
CTerrainMapEngine* m_pMapEngine;
|
|
const CTerrainSegment* m_pParent;
|
|
|
|
protected: // Prop must be deleted by Release()
|
|
virtual ~CTerrainPropForGame() { }
|
|
};
|
|
DECL_SPTR(CTerrainPropForGame)
|
|
|
|
typedef std::vector<CTerrainPropForGameSPtr> TERRAINPROP_VECTOR;
|
|
typedef std::vector<CTerrainPropForGameSPtr> TERRAINMIAPROP_VECTOR; |