Add NanoVDBLoader with test support
This commit is contained in:
43
main.cpp
43
main.cpp
@@ -1,8 +1,11 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "BattleFireDirect.h"
|
||||
#include "StaticMeshComponent.h"
|
||||
#include "stbi/stb_image.h"
|
||||
#include "Utils.h"
|
||||
#include "NanoVDBLoader.h"
|
||||
|
||||
#pragma comment(lib,"d3d12.lib")
|
||||
#pragma comment(lib,"dxgi.lib")
|
||||
@@ -11,6 +14,35 @@
|
||||
|
||||
LPCWSTR gWindowClassName = L"BattleFire";
|
||||
|
||||
void RunNanoVDBTest() {
|
||||
ID3D12GraphicsCommandList* commandList = GetCommandList();
|
||||
const char* vdbFiles[] = {
|
||||
"Res/NanoVDB/sphere2.nvdb",
|
||||
"Res/NanoVDB/bunny.nvdb",
|
||||
"Res/NanoVDB/torus_knot_helix.nvdb",
|
||||
"Res/NanoVDB/boat_points.nvdb",
|
||||
"Res/NanoVDB/explosion.nvdb",
|
||||
"Res/NanoVDB/nano_wdas_cloud_half.nvdb"
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(vdbFiles) / sizeof(vdbFiles[0]); i++) {
|
||||
const char* currentVdbFile = vdbFiles[i];
|
||||
printf("[NanoVDB Test] Loading: %s\n", currentVdbFile);
|
||||
|
||||
NanoVDBData vdbData;
|
||||
bool loadSuccess = LoadNanoVDB(currentVdbFile, vdbData, commandList);
|
||||
if (loadSuccess) {
|
||||
printf(" SUCCESS - %llu bytes, %llu elements\n",
|
||||
(unsigned long long)vdbData.byteSize,
|
||||
(unsigned long long)vdbData.elementCount);
|
||||
FreeNanoVDB(vdbData);
|
||||
} else {
|
||||
printf(" FAILED\n");
|
||||
}
|
||||
}
|
||||
printf("[NanoVDB Test] Done.\n");
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WindowProc(HWND inHWND, UINT inMSG, WPARAM inWParam, LPARAM inLParam) {
|
||||
switch (inMSG) {
|
||||
case WM_CLOSE:
|
||||
@@ -70,6 +102,17 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
|
||||
StaticMeshComponent staticMeshComponent;
|
||||
staticMeshComponent.InitFromFile(commandList, "Res/Model/Sphere.lhsm");
|
||||
|
||||
bool runTest = false;
|
||||
for (int i = 0; i < __argc; i++) {
|
||||
if (strcmp(__argv[i], "-test") == 0) {
|
||||
runTest = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (runTest) {
|
||||
RunNanoVDBTest();
|
||||
}
|
||||
|
||||
ID3D12RootSignature* rootSignature = InitRootSignature();
|
||||
D3D12_SHADER_BYTECODE vs,gs,ps;
|
||||
CreateShaderFromFile(L"Res/Shader/gs.hlsl", "MainVS", "vs_5_1", &vs);
|
||||
|
||||
Reference in New Issue
Block a user