增加材质和纹理

This commit is contained in:
2025-10-26 20:07:32 +08:00
parent f847154ba2
commit 8db6f7b115
45 changed files with 1124 additions and 281 deletions
+3 -2
View File
@@ -11,8 +11,8 @@
#include "ui/ui_main.h"
#include "adapter/adapter_texture.h"
#include "device/dvc_render_target.h"
#include <scene/dvc_scene.h>
#include "device/dvc_device.h"
#include "scene/dvc_scene.h"
int32_t g_screenWidth = 2048;
int32_t g_screenHeight = 1024;
@@ -24,6 +24,7 @@ davinci::AntiAliasingTech g_aaTech = davinci::AntiAliasingTech::AA_None;
int32_t g_canvasWidth = 1024;
int32_t g_canvasHeight = 512;
davinci::Device g_device;
davinci::Scene g_scene;
//-------------------------------------------------------------------------------------
+6 -3
View File
@@ -9,6 +9,7 @@
#include "scene/dvu_load_gltf.h"
#include "pipe/dvc_render_pipe.h"
#include "device/dvc_device.h"
#include "device/dvc_render_target.h"
#include "shader/dvc_shader_interface.h"
#include "buffer/dvu_dump_buffer.h"
@@ -20,6 +21,7 @@
SDL_Window* main_window;
extern davinci::Device g_device;
extern davinci::Scene g_scene;
extern davinci::RenderTarget g_renderTarget;
extern davinci::AntiAliasingTech g_aaTech;
@@ -72,10 +74,11 @@ void OpenFileDialogFileCallback(void* userdata, const char* const* filelist, int
{
if (filelist == nullptr || *filelist == nullptr) return;
g_device.clear();
g_scene.clear();
const char* szFileName = *filelist;
if (!davinci_utils::load_scene_from_gltf(szFileName, g_scene))
if (!davinci_utils::load_scene_from_gltf(szFileName, g_device, g_scene))
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Open glf scene file error", main_window);
}
@@ -99,13 +102,13 @@ void drawMainUI()
}
if (ImGui::Button("Export"))
{
davinci_utils::export_mesh_to_obj(g_scene);
davinci_utils::export_mesh_to_obj(g_device, g_scene);
}
const char* aaItem[] = { "None", "MSAA_2X2", "MSAA_4X4"};
ImGui::Combo("AntiAliasing", (int*)(&g_aaTech), aaItem, IM_ARRAYSIZE(aaItem));
if (ImGui::Button("Render"))
{
davinci::RenderPipe pipe;
davinci::RenderPipe pipe(g_device);
davinci::UniformBuffer& uniformBuffer = pipe.getUniformBuffer();
uniformBuffer.updateStandardAttribute(g_scene);