- 新增Math库: Vector2/3/4, Matrix3/4, Quaternion, Transform, Color等 - 新增测试框架: Google Test (gtest) - 新增140个单元测试,覆盖Vector, Matrix, Quaternion, Geometry - VolumeRenderer支持vcpkg的NanoVDB - 添加TESTING.md测试文档
28 lines
467 B
C++
28 lines
467 B
C++
#pragma once
|
|
|
|
#include <atomic>
|
|
|
|
namespace XCEngine {
|
|
namespace Core {
|
|
|
|
class RefCounted {
|
|
public:
|
|
RefCounted() : m_refCount(1) {}
|
|
virtual ~RefCounted() = default;
|
|
|
|
void AddRef() { ++m_refCount; }
|
|
void Release() {
|
|
if (--m_refCount == 0) {
|
|
delete this;
|
|
}
|
|
}
|
|
|
|
uint32_t GetRefCount() const { return m_refCount.load(); }
|
|
|
|
protected:
|
|
std::atomic<uint32_t> m_refCount;
|
|
};
|
|
|
|
} // namespace Core
|
|
} // namespace XCEngine
|