Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
192
Engine/Caldron/Src/Scene/Mesh.h
Normal file
192
Engine/Caldron/Src/Scene/Mesh.h
Normal file
@@ -0,0 +1,192 @@
|
||||
#pragma once
|
||||
|
||||
#pragma warning( disable : 4786 )
|
||||
#include "../../include/Caldron.h"
|
||||
|
||||
|
||||
namespace Caldron
|
||||
{
|
||||
namespace Scene
|
||||
{
|
||||
|
||||
class CBaseMesh
|
||||
{
|
||||
public:
|
||||
CBaseMesh()
|
||||
{
|
||||
m_nLockCount = 0;
|
||||
}
|
||||
|
||||
virtual ~CBaseMesh()
|
||||
{
|
||||
// m_nLockCount <20><> 0<><30> <20>ƴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><DEBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD>.
|
||||
}
|
||||
|
||||
void Lock()
|
||||
{
|
||||
// thread safe code <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
||||
++m_nLockCount;
|
||||
}
|
||||
|
||||
void Unlock()
|
||||
{
|
||||
// thread safe code <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
||||
if( m_nLockCount > 0 )
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> lock count <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><DEBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
--m_nLockCount;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsLocked()
|
||||
{
|
||||
return (m_nLockCount>0);
|
||||
}
|
||||
|
||||
// VB <20><> vertex <20><><EFBFBD><EFBFBD> upload <20><> <20><><EFBFBD><EFBFBD>
|
||||
virtual void UploadVertexData( void* p ) = 0;
|
||||
// IB <20><> index <20><><EFBFBD><EFBFBD> upload <20><> <20><><EFBFBD><EFBFBD>
|
||||
virtual void UploadIndexData( void* p ) = 0;
|
||||
|
||||
//
|
||||
virtual int GetVertexCount() = 0;
|
||||
virtual int GetIndexCount() = 0;
|
||||
|
||||
|
||||
virtual int GetVertexSize() = 0;
|
||||
virtual DWORD GetFVF() = 0;
|
||||
|
||||
|
||||
bool IsIndexed()
|
||||
{
|
||||
return m_bIndexed;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
int m_nLockCount;
|
||||
bool m_bIndexed;
|
||||
};
|
||||
|
||||
|
||||
template <class _T>
|
||||
class CMesh : public CBaseMesh
|
||||
{
|
||||
public:
|
||||
CMesh()
|
||||
{
|
||||
}
|
||||
|
||||
~CMesh()
|
||||
{
|
||||
}
|
||||
|
||||
// VB <20><> vertex <20><><EFBFBD><EFBFBD> upload <20><> <20><><EFBFBD><EFBFBD>
|
||||
void UploadVertexData( void* p )
|
||||
{
|
||||
if( 0 == m_vecVertexData.size() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MoveMemory( p, &(m_vecVertexData[0]), sizeof(_T) * m_vecVertexData.size() );
|
||||
}
|
||||
|
||||
// IB <20><> index <20><><EFBFBD><EFBFBD> upload <20><> <20><><EFBFBD><EFBFBD>
|
||||
void UploadIndexData( void* p )
|
||||
{
|
||||
if( 0 == m_vecIndexData.size() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MoveMemory( p, &(m_vecIndexData[0]), sizeof(_T) * m_vecIndexData.size() );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
int GetVertexCount()
|
||||
{
|
||||
return m_vecVertexData.size();
|
||||
}
|
||||
//
|
||||
int GetIndexCount()
|
||||
{
|
||||
return m_vecIndexData.size();
|
||||
}
|
||||
|
||||
|
||||
int GetVertexSize()
|
||||
{
|
||||
return sizeof( _T );
|
||||
}
|
||||
|
||||
DWORD GetFVF()
|
||||
{
|
||||
return _T::GetFVF();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// vertex <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>Ȯ<EFBFBD><C8AE>)
|
||||
void SetVertexCount( int n )
|
||||
{
|
||||
m_vecVertexData.resize( n );
|
||||
}
|
||||
|
||||
// <20>ش<EFBFBD> index <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD> Ȯ<><C8AE>)
|
||||
void SetIndexCount( int n )
|
||||
{
|
||||
m_vecIndexData.resize( n );
|
||||
|
||||
if( 0 == n )
|
||||
{
|
||||
m_bIndexed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIndexed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
_T* GetVertexWritePtr()
|
||||
{
|
||||
if( IsLocked() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( 0 == m_vecVertexData.size() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &(m_vecVertexData[0]);
|
||||
}
|
||||
|
||||
WORD* GetIndexWritePtr()
|
||||
{
|
||||
if( IsLocked() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( 0 == m_vecIndexData.size() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &(m_vecIndexData[0]);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::vector< _T > m_vecVertexData;
|
||||
std::vector< WORD > m_vecIndexData;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user