目录 目录 目录 Runtime?PostConfigInit?Voxel
目录 Voxel依赖:
引擎类: "Core", "CoreUObject","Engine" ,"TraceLog" ,"DeveloperSettings" ,"Projects" 网络类:?"Networking", "Sockets","HTTP","zlib" 3D图形:??"RHI", "RenderCore", "nvTessLib", "ForsythTriOptimizer" 2D图形:?"Slate", "SlateCore" 地形:?"Landscape" 物理碰撞:?"PhysX","PhysicsCore"
build.cs 使用了
SetupModulePhysicsSupport(Target); //物理碰撞
PublicDefinitions.Add("VOXEL_DEBUG=1"); PublicDefinitions.Add("VOXEL_PLUGIN_NAME=TEXT(\"VoxelFree\")");
进入Module内文件 250个.h? ,150个.cpp
001插件启动类
Voxel.Build.cs C#编译引导 VoxelModule.h? 模组名:IModuleInterface :{ StartupModule(),??ShutdownModule()?} VoxelModule.cpp?
启动步骤依次为
VoxelValue.h 会有一个编译自检int8/int16对float的转换 打印debug状态 1/0
材质数据校对 //FVoxelMaterial
压缩/解压校对 //FVoxelSerializationUtilities 将VoxelFree重新定位到Voxel
等待下一帧 //FTicker::GetCoreTicker().AddTicker(FTickerDelegate::CreateLambda([=](float){//doSomething;return false;}));
获得当前版本号
int32 VoxelPluginVersion = 0;
GConfig->GetInt(TEXT("VoxelPlugin"), TEXT("VoxelPluginVersion"), VoxelPluginVersion, GEditorPerProjectIni);
如果小于当前版本,就提示去网址看说明书,可点击
const auto OpenLink = [=](const FString& Url)
{
FString Error;
FPlatformProcess::LaunchURL(*Url, nullptr, &Error);
if (!Error.IsEmpty())
{
FMessageDialog::Open(EAppMsgType::Ok, FText::FromString("Failed to open " + Url + "\n:" + Error));
}
};
FVoxelMessages::FNotification Notification;
Notification.UniqueId = OBJECT_LINE_ID();
Notification.Message = "Voxel Plugin has been updated to 1.2!";
Notification.Duration = 1e6f;
Notification.OnClose = FSimpleDelegate::CreateLambda(Close);
auto& Button = Notification.Buttons.Emplace_GetRef();
Button.Text = "Show Release Notes";
Button.Tooltip = "See the latest plugin release notes";
Button.OnClick = FSimpleDelegate::CreateLambda([=]()
{
OpenLink("https://releases.voxelplugin.com");
Close();
});
FVoxelMessages::ShowNotification(Notification);
如果点了网址,就将最后版本设为当前版本,没点就不设置,下次继续提醒
const auto Close = [=]()
{
GConfig->SetInt(TEXT("VoxelPlugin"), TEXT("VoxelPluginVersion"), LatestVoxelPluginVersion, GEditorPerProjectIni);
};
我跟了一下,最终响应在VoxelEditor模组内的FVoxelMessagesEditor, 是一个
?这样的东西,最后还有一个欢迎词,和一些连接,之后就完了。
引用内部包
#include "VoxelValue.h" int8/int16对float的转换,FVoxelValue带自检 #include "VoxelMaterial.h" 材质,暂略 #include "VoxelMessages.h"?FVoxelMessages一种可点击提示信息 #include "IVoxelPool.h" #include "VoxelUtilities/VoxelSerializationUtilities.h"
其中只有IVoxelPool::Shutdown(); 在 ShutdownModule(), 证明常驻 IVoxelPool.h 只引用 VoxelMinimal.h ,?
VoxelMinimal.h 很可能是轮子, 轮子类有
#include "VoxelLog.h" --cpp:VoxelDefinitions.cpp ?//#define LOG_VOXEL(Verbosity, Format, ...) UE_LOG(LogVoxel, Verbosity, Format, ##__VA_ARGS__) 一个简单的log输出macro, 就一行 #include "VoxelStats.h"? 引用 "VoxelDefinitions.h" --cpp:VoxelDefinitions.cpp ?出了一堆 VOXEL_*_SCOPE_ * 和?VOXEL_*_COUNTER_ * 和*VOXEL_MEMORY* 的macro , 应该是性能监察,可知作者用了多少时间去调试 #include "VoxelDebug.h"? 引用 "VoxelEngineVersionHelpers.h" ?里面就一个模板 static?FVoxelDebug::Broadcast<T>(...) #include "VoxelMacros.h"? 引用 "VoxelDefinitions.h" ?这里确定了计算精度是 float 还是 double ?//DATA_CHUNK_SIZE = 16 //VoxelDefinitions.h ?//TNumericLimits<uint16>::Max()0xffff //NumericLimits.h ?static_assert((DATA_CHUNK_SIZE * DATA_CHUNK_SIZE * DATA_CHUNK_SIZE)< TNumericLimits<uint16>::Max(), "CellIndex type is too small");编译时检查chunksize大小 以下这段对vs的Intellisense和rider作了设置,? 填了引擎 CORE_API, ENGINE_API 定义这两个坑
#if defined(__INTELLISENSE__) || defined(__RSCPP_VERSION)
#define INTELLISENSE_PARSER 1
#else
#define INTELLISENSE_PARSER 0
#endif
#if INTELLISENSE_PARSER
#define CORE_API
#define ENGINE_API
#undef VOXEL_DEBUG
#define VOXEL_DEBUG 1
#error "Compiler defined as parser"
#endif
将check(b), ensure(b) 重新 定义为?checkVoxelSlow 和?ensureVoxelSlow 非 debug 不检查 文本转换 FName STATIC_FNAME(Name), FString STATIC_FSTRING(String) 唯一值?UNIQUE_ID() UE对象名称文本值? GET_MEMBER_NAME_STATIC(ClassName, MemberName)?? GET_OWN_MEMBER_NAME(MemberName) DEBUG 相关 OBJECT_LINE_ID() FUNCTION_FNAME?FUNCTION_ERROR??VOXEL_DEPRECATED
#include "VoxelSharedPtr.h"? ?--06详解 ?UE4有自己的智能指针 ?这里插件作者又把UE的指针封装了一遍, 我们看看都有些什么
template<typename T> using TVoxelSharedRef = TSharedRef<T, ESPMode::ThreadSafe>;? using TVoxelSharedPtr = TSharedPtr<T, ESPMode::ThreadSafe>; using TVoxelWeakPtr = TWeakPtr<T, ESPMode::ThreadSafe>; StaticCastVoxel* // const 转 非 const MakeVoxel* // 用构造参数生成 MakeVoxel*Copy // 对象生成 using TVoxelSharedFromThis = TSharedFromThis<T, ESPMode::ThreadSafe>; ? #include "VoxelDefinitions.h" -cpp:VoxelDefinitions.cpp ? ? ? ? 默认的参数设置,? ? ? ? ? #include 客户参数设置 VoxelUserDefinitions.h ????????-cpp:VoxelDefinitions.cpp 同时也是以下声明的定义
- #include "VoxelDefinitions.h" //轮
- #include "VoxelLog.h"?//轮
- #include "VoxelStats.h"?//轮
- #include "VoxelFeedbackContext.h"
- #include "VoxelIntBox.h"
- #include "VoxelItemStack.h"
- #include "VoxelEditorDelegates.h"
- #include "VoxelPlaceableItems/VoxelPlaceableItem.h"
#include "VoxelDelegateHelpers.h"?引用 "VoxelSharedPtr.h" "VoxelEngineVersionHelpers.h"
? ?定义了TBaseSPFunctorDelegateInstance 继承于?TCommonDelegateInstanceState ? ?重定义了TDelegateFromLambda
- MakeLambdaDelegate
- MakeWeakObjectPtrDelegate
- MakeWeakPtrDelegate
- MakeVoxelWeakPtrDelegate
? ?重定义了TLambdaConditionalForward
- MakeWeakPtrLambda
- MakeVoxelWeakPtrLambda
#include "VoxelEngineVersionHelpers.h" 使用版本号作define判断 ?#include "Launch/Resources/Version.h" ?#if ENGINE_MINOR_VERSION < 24
#include "VoxelContainers/NoGrowArray.h"
定义了TNoGrowAllocator using TNoGrowArray = TArray<T, TNoGrowAllocator<TAllocator>>; using TNoGrowArray64 = TArray<T, TNoGrowAllocator<TAllocator>>;
干脆把整个VoxelContainers文件夹都解读了
VoxelArray3.h 定义?TVoxelArray3(int i,int j,int k) {I + J * Size.X + K * Size.X * Size.Y}
VoxelArrayView.h 定义?TVoxelArrayView 就是一个 TArray封装
VoxelSparseArray.h 定义? TVoxelSparseArray 非连续数组 TVoxelTypedSparseArray 对?TVoxelSparseArray封装 #define DEFINE_TYPED_VOXEL_SPARSE_ARRAY_ID(Name) using Name = TVoxelTypedSparseArrayId<class Name##_Unique>;
VoxelStaticArray.h 引用?#include "VoxelUtilities/VoxelBaseUtilities.h" TVoxelStaticArray 一个静态长度数组
template<typename T, uint32 Size, uint32 Alignment = alignof(T)>
class alignas(Alignment) TVoxelStaticArray{
FORCEINLINE T* RESTRICT GetData()
{
return reinterpret_cast<T*>(Data);
}
FORCEINLINE const T* RESTRICT GetData() const
{
return reinterpret_cast<const T*>(Data);
}
private:
uint8 Data[Size * sizeof(T)];
}
TVoxelStaticBitArray 封装了?TVoxelStaticArray<uint32, FVoxelUtilities::DivideCeil(Size, 32)>
FORCEINLINE void Set(uint32 Index)
{
checkVoxelSlow(Index < Size);
Array[Index / 32] |= (1u << (Index % 32));
}
FORCEINLINE void Clear(uint32 Index)
{
checkVoxelSlow(Index < Size);
Array[Index / 32] &= ~(1u << (Index % 32));
}
FORCEINLINE bool Test(uint32 Index) const
{
checkVoxelSlow(Index < Size);
return Array[Index / 32] & (1u << (Index % 32));
}
VoxelUtilities/VoxelBaseUtilities.h
封装了一堆数据方法,以FVoxelUtilities::开头
最后?IVoxelPool.h
virtual IVoxelPool:: 一个等待实现的接口类 ?? ?virtual void QueueTask(EVoxelTaskType Type, IVoxelQueuedWork* Task) = 0; ?? ?virtual void QueueTasks(EVoxelTaskType Type, const TArray<IVoxelQueuedWork*>& Tasks) = 0;
static IVoxelPool:: 静态缓存Pool的方法 分别储存于WorldsPools 和?GlobalPool static TMap<TWeakObjectPtr<UWorld>, TVoxelSharedPtr<IVoxelPool>> IVoxelPool::WorldsPools; static TVoxelSharedPtr<IVoxelPool> IVoxelPool::GlobalPool;
未解读文件:
目录?FastNoise 目录 VoxelAssets 目录 VoxelComponents 目录 VoxelContainers 目录 VoxelCooking 目录 VoxelData 目录 VoxelDebug 目录 VoxelEvents 目录 VoxelGenerators 目录 VoxelImporters 目录 VoxelMultiplayer 目录 VoxelPlaceableItems 目录 VoxelRender 目录 VoxelShaders 目录 VoxelSpawners 目录 VoxelTools 目录 VoxelUtilities FastNoise.h VoxelAsyncWork.h VoxelBoolVector.h VoxelCancelCounter.h VoxelCharacter.h VoxelDefaultPool.h VoxelDiff.h VoxelDirection.h VoxelEditorDelegates.h VoxelEditorDelegatesInterface.h VoxelEnums.h VoxelFeedbackContext.h VoxelIntBox.h VoxelIntBoxLibrary.h VoxelInterpolator.h VoxelInvokerSettings.h VoxelItemStack.h VoxelMacros.h VoxelMaterial.h VoxelMaterialBuilder.h VoxelMinimal.h VoxelObjectArchive.h VoxelOctree.h VoxelOctreeId.h VoxelPriorityHandler.h VoxelQueryZone.h VoxelQueuedWork.h VoxelQueueWithNum.h VoxelRange.h VoxelSaveStruct.h VoxelSettings.h VoxelSharedMutex.h VoxelSharedPtr.h VoxelSimpleOctree.h VoxelStaticWorld.h VoxelTexture.h VoxelThreadPool.h VoxelTickable.h VoxelUniqueError.h VoxelVector.h VoxelWorld.h VoxelWorldCreateInfo.h VoxelWorldInterface.h VoxelWorldRootComponent.h
|