chore: 清理构建产物和临时文件

This commit is contained in:
2026-03-15 00:19:57 +08:00
parent 15f42a1af5
commit 827a0c6302
14 changed files with 0 additions and 502 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

View File

@@ -1,99 +0,0 @@
struct VertexData{
float4 position:POSITION;
float4 texcoord:TEXCOORD0;
float4 normal:NORMAL;
float4 tangent:TANGENT;
};
struct VSOut{
float4 position:SV_POSITION;
float4 normal:NORMAL;
float4 texcoord:TEXCOORD0;
};
static const float PI=3.141592;
cbuffer globalConstants:register(b0){
float4 misc;
};
Texture2D T_DiffuseTexture:register(t0);
SamplerState samplerState:register(s0);
struct MaterialData{
float r;
};
StructuredBuffer<MaterialData> materialData:register(t0,space1);
cbuffer DefaultVertexCB:register(b1){
float4x4 ProjectionMatrix;
float4x4 ViewMatrix;
float4x4 ModelMatrix;
float4x4 IT_ModelMatrix;
float4x4 ReservedMemory[1020];
};
VSOut MainVS(VertexData inVertexData){
VSOut vo;
vo.normal=mul(IT_ModelMatrix,inVertexData.normal);
float4 positionWS=mul(ModelMatrix,inVertexData.position);
float4 positionVS=mul(ViewMatrix,positionWS);
vo.position=mul(ProjectionMatrix,positionVS);
//vo.position=float4(positionWS.xyz+vo.normal.xyz*sin(misc.x)*0.2f,1.0f);
vo.texcoord=inVertexData.texcoord;
return vo;
}
[maxvertexcount(4)]
void MainGS(triangle VSOut inPoint[3],uint inPrimitiveID:SV_PrimitiveID,
inout TriangleStream<VSOut> outTriangleStream){
outTriangleStream.Append(inPoint[0]);
outTriangleStream.Append(inPoint[1]);
outTriangleStream.Append(inPoint[2]);
/*VSOut vo;
float3 positionWS=inPoint[0].position.xyz;
float3 N=normalize(inPoint[0].normal.xyz);
vo.normal=float4(N,0.0f);
float3 helperVec=abs(N.y)>0.999?float3(0.0f,0.0f,1.0f):float3(0.0f,1.0f,0.0f);
float3 tangent=normalize(cross(N,helperVec));//u
float3 bitangent=normalize(cross(tangent,N));//v
float scale=materialData[inPrimitiveID].r;
float3 p0WS=positionWS-(bitangent*0.5f-tangent*0.5f)*scale;//left bottom
float4 p0VS=mul(ViewMatrix,float4(p0WS,1.0f));
vo.position=mul(ProjectionMatrix,p0VS);
vo.texcoord=float4(0.0f,1.0f,0.0f,0.0f);
outTriangleStream.Append(vo);
float3 p1WS=positionWS-(bitangent*0.5f+tangent*0.5f)*scale;//right bottom
float4 p1VS=mul(ViewMatrix,float4(p1WS,1.0f));
vo.position=mul(ProjectionMatrix,p1VS);
vo.texcoord=float4(1.0f,1.0f,0.0f,0.0f);
outTriangleStream.Append(vo);
float3 p2WS=positionWS+(bitangent*0.5f+tangent*0.5f)*scale;//left top
float4 p2VS=mul(ViewMatrix,float4(p2WS,1.0f));
vo.position=mul(ProjectionMatrix,p2VS);
vo.texcoord=float4(0.0f,0.0f,0.0f,0.0f);
outTriangleStream.Append(vo);
float3 p3WS=positionWS+(bitangent*0.5f-tangent*0.5f)*scale;//right top
float4 p3VS=mul(ViewMatrix,float4(p3WS,1.0f));
vo.position=mul(ProjectionMatrix,p3VS);
vo.texcoord=float4(1.0f,0.0f,0.0f,0.0f);
outTriangleStream.Append(vo);*/
}
float4 MainPS(VSOut inPSInput):SV_TARGET{
float3 N=normalize(inPSInput.normal.xyz);
float3 bottomColor=float3(0.1f,0.4f,0.6f);
float3 topColor=float3(0.7f,0.7f,0.7f);
float theta=asin(N.y);//-PI/2 ~ PI/2
theta/=PI;//-0.5~0.5
theta+=0.5f;//0.0~1.0
float ambientColorIntensity=1.0;
float3 ambientColor=lerp(bottomColor,topColor,theta)*ambientColorIntensity;
float4 diffuseColor=T_DiffuseTexture.Sample(samplerState,inPSInput.texcoord.xy);
float3 surfaceColor=diffuseColor.rgb;
return float4(surfaceColor,1.0f);
}

View File

@@ -1,65 +0,0 @@
struct VertexData{
float4 position:POSITION;
float4 texcoord:TEXCOORD0;
float4 normal:NORMAL;
float4 tangent:TANGENT;
};
struct VSOut{
float4 position:SV_POSITION;
float4 normal:NORMAL;
float4 texcoord:TEXCOORD0;
float4 positionWS:TEXCOORD1;
};
static const float PI=3.141592;
cbuffer globalConstants:register(b0){
float4 misc;
};
cbuffer DefaultVertexCB:register(b1){
float4x4 ProjectionMatrix;
float4x4 ViewMatrix;
float4x4 ModelMatrix;
float4x4 IT_ModelMatrix;
float4x4 ReservedMemory[1020];
};
VSOut MainVS(VertexData inVertexData){
VSOut vo;
vo.normal=mul(IT_ModelMatrix,inVertexData.normal);
float3 positionMS=inVertexData.position.xyz+vo.normal*sin(misc.x);
float4 positionWS=mul(ModelMatrix,float4(positionMS,1.0));
float4 positionVS=mul(ViewMatrix,positionWS);
vo.position=mul(ProjectionMatrix,positionVS);
vo.positionWS=positionWS;
vo.texcoord=inVertexData.texcoord;
return vo;
}
float4 MainPS(VSOut inPSInput):SV_TARGET{
float3 N=normalize(inPSInput.normal.xyz);
float3 bottomColor=float3(0.1f,0.4f,0.6f);
float3 topColor=float3(0.7f,0.7f,0.7f);
float theta=asin(N.y);//-PI/2 ~ PI/2
theta/=PI;//-0.5~0.5
theta+=0.5f;//0.0~1.0
float ambientColorIntensity=0.2;
float3 ambientColor=lerp(bottomColor,topColor,theta)*ambientColorIntensity;
float3 L=normalize(float3(1.0f,1.0f,-1.0f));
float diffuseIntensity=max(0.0f,dot(N,L));
float3 diffuseLightColor=float3(0.1f,0.4f,0.6f);
float3 diffuseColor=diffuseLightColor*diffuseIntensity;
float3 specularColor=float3(0.0f,0.0f,0.0f);
if(diffuseIntensity>0.0f){
float3 cameraPositionWS=float3(0.0f,0.0f,0.0f);
float3 V=normalize(cameraPositionWS.xyz-inPSInput.positionWS.xyz);
float3 R=normalize(reflect(-L,N));
float specularIntensity=pow(max(0.0f,dot(V,R)),128.0f);
specularColor=float3(1.0f,1.0f,1.0f)*specularIntensity;
}
float3 surfaceColor=ambientColor+diffuseColor+specularColor;
return float4(surfaceColor,1.0f);
}

Binary file not shown.

View File

@@ -1,21 +0,0 @@
cmake_minimum_required(VERSION 3.15)
add_executable(XCEngineDemo
WIN32
main.cpp
)
target_compile_definitions(XCEngineDemo PRIVATE
UNICODE
_UNICODE
)
target_include_directories(XCEngineDemo PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/mvs/XCEngineDemo
)
target_link_libraries(XCEngineDemo PRIVATE
XCEngine
XCEngineD3D12
)

View File

@@ -1,268 +0,0 @@
#include <windows.h>
#include <stdio.h>
#include <RHI\IRHIDevice.h>
#include <RHI\IRHIResources.h>
#include <Rendering\Resources.h>
#include <Rendering\RenderContext.h>
#include <Rendering\StaticMeshComponent.h>
#include <Rendering\Shader.h>
#include <RHI\D3D12\D3D12RHI.h>
#include <RHI\D3D12\D3D12Resources.h>
#pragma comment(lib,"d3d12.lib")
#pragma comment(lib,"dxgi.lib")
#pragma comment(lib,"d3dcompiler.lib")
#pragma comment(lib,"winmm.lib")
void EngineLog(const char* msg, ...);
using namespace XCEngine;
using namespace XCEngine::RHI;
LPCWSTR gWindowClassName = L"XCEngineDemo";
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
switch (msg) {
case WM_CLOSE:
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hInstancePrev, LPWSTR lpCmdLine, int nShowCmd) {
AttachConsole(ATTACH_PARENT_PROCESS);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
printf("=== XCEngine Demo Started ===\n");
printf("Registering window class...\n");
WNDCLASSEX wndClass = {};
wndClass.cbSize = sizeof(WNDCLASSEX);
wndClass.style = CS_HREDRAW | CS_VREDRAW;
wndClass.hInstance = hInstance;
wndClass.lpszClassName = gWindowClassName;
wndClass.lpfnWndProc = WindowProc;
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
if (!RegisterClassEx(&wndClass)) {
printf("RegisterClassEx failed!\n");
return -1;
}
printf("Window class registered\n");
printf("Creating window...\n");
int width = 1280;
int height = 720;
RECT rect = {0, 0, width, height};
AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
HWND hwnd = CreateWindowExW(NULL, gWindowClassName, L"XCEngine Demo",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, hInstance, NULL);
if (!hwnd) {
printf("CreateWindowExW failed!\n");
return -1;
}
printf("Window created\n");
printf("Creating D3D12Device...\n");
D3D12Device* device = new D3D12Device();
if (!device->Initialize(hwnd, width, height)) {
printf("D3D12Device Init Failed!\n");
return -1;
}
printf("D3D12Device initialized\n");
RenderContext renderContext(device);
if (!renderContext.Initialize(width, height)) {
printf("RenderContext Init Failed!\n");
return -1;
}
ICommandList* cmdList = renderContext.GetCommandList();
ShaderBytecode vs, ps, gs = {};
if (!CompileShader("Res/Shader/gs.hlsl", "MainVS", "vs_5_1", vs)) {
printf("Compile VS Failed!\n");
return -1;
}
if (!CompileShader("Res/Shader/gs.hlsl", "MainPS", "ps_5_1", ps)) {
printf("Compile PS Failed!\n");
return -1;
}
if (!CompileShader("Res/Shader/gs.hlsl", "MainGS", "gs_5_1", gs)) {
printf("Compile GS Failed!\n");
return -1;
}
printf("Shaders compiled: VS=%llu, PS=%llu, GS=%llu\n",
(unsigned long long)vs.size, (unsigned long long)ps.size, (unsigned long long)gs.size);
RootParameter params[4] = {};
params[0].type = RootParameterType::CBV;
params[0].shaderRegister = 1;
params[0].registerSpace = 0;
params[0].visibility = ShaderVisibility::All;
params[1].type = RootParameterType::Constants;
params[1].shaderRegister = 0;
params[1].registerSpace = 0;
params[1].num32BitValues = 4;
params[1].visibility = ShaderVisibility::Vertex;
params[2].type = RootParameterType::DescriptorTable;
params[2].shaderRegister = 0;
params[2].registerSpace = 0;
params[2].visibility = ShaderVisibility::Pixel;
params[3].type = RootParameterType::SRV;
params[3].shaderRegister = 0;
params[3].registerSpace = 1;
params[3].visibility = ShaderVisibility::All;
RootSignatureDesc rsDesc = {};
rsDesc.parameters = params;
rsDesc.parameterCount = 4;
IRootSignature* rootSignature = nullptr;
if (!device->CreateRootSignature(&rootSignature, rsDesc)) {
printf("CreateRootSignature Failed!\n");
return -1;
}
printf("RootSignature created\n");
InputElementDesc inputElements[4] = {};
inputElements[0].semanticName = "POSITION";
inputElements[0].semanticIndex = 0;
inputElements[0].format = Format::R32G32B32A32_Float;
inputElements[0].inputSlot = 0;
inputElements[0].alignedByteOffset = 0;
inputElements[1].semanticName = "TEXCOORD";
inputElements[1].semanticIndex = 0;
inputElements[1].format = Format::R32G32B32A32_Float;
inputElements[1].inputSlot = 0;
inputElements[1].alignedByteOffset = 16;
inputElements[2].semanticName = "NORMAL";
inputElements[2].semanticIndex = 0;
inputElements[2].format = Format::R32G32B32A32_Float;
inputElements[2].inputSlot = 0;
inputElements[2].alignedByteOffset = 32;
inputElements[3].semanticName = "TANGENT";
inputElements[3].semanticIndex = 0;
inputElements[3].format = Format::R32G32B32A32_Float;
inputElements[3].inputSlot = 0;
inputElements[3].alignedByteOffset = 48;
InputLayoutDesc inputLayout = {};
inputLayout.elements = inputElements;
inputLayout.elementCount = 4;
PipelineDesc psoDesc = {};
psoDesc.rootSignature = rootSignature;
psoDesc.vertexShader = vs;
psoDesc.pixelShader = ps;
psoDesc.geometryShader = gs;
psoDesc.inputLayout = inputLayout;
psoDesc.topologyType = PrimitiveTopologyType::Triangle;
psoDesc.numRenderTargets = 1;
psoDesc.rtvFormats[0] = Format::R8G8B8A8_UNorm;
psoDesc.dsvFormat = Format::D24_UNorm_S8_UInt;
IPipelineState* pso = nullptr;
printf("Creating PipelineState...\n");
if (!device->CreatePipelineState(&pso, psoDesc)) {
printf("CreatePipelineState Failed!\n");
return -1;
}
printf("PipelineState created\n");
EngineLog("After PSO created");
IConstantBuffer* cb = nullptr;
if (!CreateConstantBuffer(device, 65536, &cb)) {
printf("CreateConstantBuffer Failed!\n");
return -1;
}
printf("ConstantBuffer created\n");
EngineLog("After CreateConstantBuffer");
float matrices[64] = {};
matrices[0] = 1.0f; matrices[5] = 1.0f; matrices[10] = 1.0f; matrices[15] = 1.0f;
matrices[16] = 1.0f; matrices[21] = 1.0f; matrices[26] = 1.0f; matrices[31] = 1.0f;
matrices[32] = 1.0f; matrices[37] = 1.0f; matrices[42] = 1.0f; matrices[47] = 1.0f;
matrices[48] = 1.0f; matrices[53] = 1.0f; matrices[58] = 1.0f; matrices[63] = 1.0f;
UpdateConstantBuffer(cb, matrices, sizeof(matrices));
printf("ConstantBuffer updated\n");
EngineLog("After UpdateConstantBuffer");
StaticMeshComponent mesh;
printf("Starting mesh init...\n");
EngineLog("Before mesh.Initialize");
if (!mesh.Initialize(cmdList, "Res/Model/Sphere.lhsm")) {
printf("Load Mesh Failed!\n");
return -1;
}
printf("Mesh loaded\n");
EngineLog("After mesh.Initialize");
cmdList->Close();
printf("CommandList closed\n");
EngineLog("After cmdList->Close");
ICommandQueue* queue = device->GetCommandQueue();
void* cmdListPtr = cmdList->GetNativeCommandList();
queue->ExecuteCommandLists(&cmdListPtr, 1);
printf("Commands executed\n");
EngineLog("After ExecuteCommandLists");
ShowWindow(hwnd, nShowCmd);
UpdateWindow(hwnd);
MSG msg = {};
while (true) {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
} else {
EngineLog("MainLoop: 1");
renderContext.BeginFrame();
EngineLog("MainLoop: 2");
renderContext.SetViewport((float)width, (float)height);
renderContext.SetScissor(width, height);
float color[4] = {0.5f, 0.5f, 0.5f, 1.0f};
renderContext.ClearRenderTarget(color);
renderContext.ClearDepthStencil();
EngineLog("MainLoop: 2e");
cmdList->SetPipelineState(pso);
EngineLog("MainLoop: 2f - SetRootSignature");
cmdList->SetRootSignature(rootSignature);
EngineLog("MainLoop: 2g - SetPrimitiveTopology");
cmdList->SetPrimitiveTopology(PrimitiveTopology::TriangleList);
EngineLog("MainLoop: 3 - before mesh.Render");
mesh.Render(cmdList);
EngineLog("MainLoop: 4");
renderContext.EndFrame();
EngineLog("MainLoop: 5");
renderContext.Present();
EngineLog("MainLoop: 6");
}
}
renderContext.Shutdown();
delete pso;
delete rootSignature;
delete cb;
delete device;
return 0;
}

View File

View File

View File

@@ -1,25 +0,0 @@
@echo off
cd /d D:\Xuanchi\高斯泼溅\XCEngine
echo Starting XCEngineDemo...
echo Current directory: %CD%
echo.
echo Running Debug version...
build\mvs\XCEngineDemo\Debug\XCEngineDemo.exe
echo.
echo Program exited with code: %ERRORLEVEL%
echo.
echo Checking log files...
if exist D:\xcengine_debug.log (
echo === D:\xcengine_debug.log (first 100 lines) ===
type D:\xcengine_debug.log | more +1
) else (
echo D:\xcengine_debug.log not found
)
echo.
if exist D:\XCEngineDemo_main.log (
echo === D:\XCEngineDemo_main.log ===
type D:\XCEngineDemo_main.log
) else (
echo D:\XCEngineDemo_main.log not found
)
pause

View File

@@ -1,16 +0,0 @@
@echo off
cd /d D:\Xuanchi\高斯泼溅\XCEngine
echo Starting XCEngineDemo...
echo Current directory: %CD%
echo.
build\mvs\XCEngineDemo\Debug\XCEngineDemo.exe
echo.
echo Program exited with code: %ERRORLEVEL%
echo.
if exist XCEngineDemo.log (
echo === Log file contents ===
type XCEngineDemo.log
) else (
echo No log file found
)
pause

View File

@@ -1,2 +0,0 @@
cmake_minimum_required(VERSION 3.15)
add_executable(test WIN32 test.cpp)

View File

@@ -1,6 +0,0 @@
#include <windows.h>
int WINAPI wWinMain(HINSTANCE h, HINSTANCE p, LPWSTR c, int s) {
MessageBoxW(NULL, L"Hello World!", L"Test", MB_OK);
return 0;
}