Fix some errors with meshrenderer moving to engine that gemini didnt have time to fix
Will have to resync how to load more meshes. Probably need a command to do it but for now not needed.
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
#include <Graphics/Mesh.h>
|
||||
#include <Graphics/MeshRenderer.h>
|
||||
#include <Graphics/RenderPass.h>
|
||||
#include <Graphics/VertexData.h>
|
||||
#include <Graphics/SkyboxRenderer.h>
|
||||
#include <Graphics/VertexData.h>
|
||||
|
||||
#ifdef JULIET_ENABLE_IMGUI
|
||||
#include <imgui.h>
|
||||
@@ -64,18 +64,13 @@ namespace
|
||||
} Game;
|
||||
|
||||
const char* GameFunctionTable[] = { "GameInit", "GameShutdown", "GameUpdate" };
|
||||
|
||||
Arena* PlatformArena = nullptr;
|
||||
} // namespace
|
||||
|
||||
void JulietApplication::Init()
|
||||
void JulietApplication::Init(NonNullPtr<Arena>)
|
||||
{
|
||||
Log(LogLevel::Message, LogCategory::Tool, "Initializing Juliet Application...");
|
||||
|
||||
Log(LogLevel::Message, LogCategory::Tool, "%s", CStr(GetBasePath()));
|
||||
|
||||
PlatformArena = ArenaAllocate({ .AllowRealloc = true } JULIET_DEBUG_PARAM("Platform Arena"));
|
||||
|
||||
GraphicsConfig config;
|
||||
#if JULIET_DEBUG
|
||||
config.EnableDebug = true;
|
||||
@@ -90,8 +85,6 @@ void JulietApplication::Init()
|
||||
{
|
||||
AttachToWindow(GraphicsDevice, MainWindow);
|
||||
{
|
||||
Running = InitializeMeshRenderer(PlatformArena, GraphicsDevice, MainWindow);
|
||||
|
||||
// Create Depth Buffer
|
||||
TextureCreateInfo depthCI = {};
|
||||
depthCI.Type = TextureType::Texture_2D;
|
||||
@@ -121,64 +114,11 @@ void JulietApplication::Init()
|
||||
float x = static_cast<float>(col) * kSpacing - kOffset;
|
||||
float y = static_cast<float>(row) * kSpacing - kOffset;
|
||||
|
||||
float seed = static_cast<float>(row * kGridSize + col);
|
||||
float seed = static_cast<float>(row * kGridSize + col);
|
||||
Matrix rotation = MatrixRotation(seed * 0.73f, seed * 1.17f, seed * 0.53f);
|
||||
SetMeshTransform(cube, MatrixTranslation(x, y, 0.0f) * rotation);
|
||||
}
|
||||
}
|
||||
|
||||
CommandList* loadCmd = AcquireCommandList(GraphicsDevice);
|
||||
LoadMeshesOnGPU(loadCmd);
|
||||
SubmitCommandLists(loadCmd);
|
||||
|
||||
if (Running == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Create Skybox Pipeline
|
||||
String skyboxVSEntry = WrapString("main");
|
||||
ShaderCreateInfo skyboxVSCI = {};
|
||||
skyboxVSCI.EntryPoint = skyboxVSEntry;
|
||||
skyboxVSCI.Stage = ShaderStage::Vertex;
|
||||
String vsPath = GetAssetPath(WrapString("Skybox.vert.dxil"));
|
||||
Shader* skyboxVS = CreateShader(GraphicsDevice, vsPath, skyboxVSCI);
|
||||
|
||||
String skyboxFSEntry = WrapString("main");
|
||||
ShaderCreateInfo skyboxFSCI = {};
|
||||
skyboxFSCI.EntryPoint = skyboxFSEntry;
|
||||
skyboxFSCI.Stage = ShaderStage::Fragment;
|
||||
String fsPath = GetAssetPath(WrapString("Skybox.frag.dxil"));
|
||||
Shader* skyboxFS = CreateShader(GraphicsDevice, fsPath, skyboxFSCI);
|
||||
|
||||
ColorTargetDescription colorTargetDesc = {};
|
||||
colorTargetDesc.Format = GetSwapChainTextureFormat(GraphicsDevice, MainWindow);
|
||||
|
||||
GraphicsPipelineCreateInfo skyboxPipelineCI = {};
|
||||
skyboxPipelineCI.VertexShader = skyboxVS;
|
||||
skyboxPipelineCI.FragmentShader = skyboxFS;
|
||||
skyboxPipelineCI.PrimitiveType = PrimitiveType::TriangleList;
|
||||
skyboxPipelineCI.TargetInfo.ColorTargetDescriptions = &colorTargetDesc;
|
||||
skyboxPipelineCI.TargetInfo.NumColorTargets = 1;
|
||||
skyboxPipelineCI.TargetInfo.DepthStencilFormat = TextureFormat::D32_FLOAT;
|
||||
skyboxPipelineCI.TargetInfo.HasDepthStencilTarget = true;
|
||||
skyboxPipelineCI.RasterizerState.FillMode = FillMode::Solid;
|
||||
skyboxPipelineCI.RasterizerState.CullMode = CullMode::None;
|
||||
skyboxPipelineCI.RasterizerState.FrontFace = FrontFace::Clockwise;
|
||||
skyboxPipelineCI.DepthStencilState.EnableDepthTest = true;
|
||||
skyboxPipelineCI.DepthStencilState.EnableDepthWrite = false;
|
||||
skyboxPipelineCI.DepthStencilState.CompareOperation = CompareOperation::LessOrEqual;
|
||||
|
||||
SkyboxPipeline = CreateGraphicsPipeline(GraphicsDevice, skyboxPipelineCI);
|
||||
if (SkyboxPipeline == nullptr)
|
||||
{
|
||||
LogError(LogCategory::Graphics, "Failed to create skybox pipeline!");
|
||||
Running = false;
|
||||
}
|
||||
|
||||
if (skyboxVS) DestroyShader(GraphicsDevice, skyboxVS);
|
||||
if (skyboxFS) DestroyShader(GraphicsDevice, skyboxFS);
|
||||
|
||||
}
|
||||
|
||||
GameCode.Functions = reinterpret_cast<void**>(&Game);
|
||||
@@ -215,8 +155,6 @@ void JulietApplication::Shutdown()
|
||||
DestroyTexture(GraphicsDevice, DepthBuffer);
|
||||
}
|
||||
|
||||
ShutdownMeshRenderer();
|
||||
|
||||
if (MainWindow && GraphicsDevice)
|
||||
{
|
||||
DetachFromWindow(GraphicsDevice, MainWindow);
|
||||
@@ -232,8 +170,6 @@ void JulietApplication::Shutdown()
|
||||
DestroyGraphicsDevice(GraphicsDevice);
|
||||
}
|
||||
|
||||
ArenaRelease(PlatformArena);
|
||||
|
||||
Log(LogLevel::Message, LogCategory::Tool, "Juliet App shutdown Completed");
|
||||
}
|
||||
|
||||
@@ -262,7 +198,7 @@ void JulietApplication::Update()
|
||||
{
|
||||
float fps = static_cast<float>(fpsFrames) / fpsTimer;
|
||||
float ms = (fpsTimer / static_cast<float>(fpsFrames)) * 1000.0f;
|
||||
char title[64];
|
||||
char title[64];
|
||||
snprintf(title, sizeof(title), "Juliet | %.1f FPS | %.2f ms", static_cast<double>(fps), static_cast<double>(ms));
|
||||
SetWindowTitle(MainWindow, WrapString(title));
|
||||
fpsTimer = 0.0f;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Juliet
|
||||
class JulietApplication : public Juliet::IApplication
|
||||
{
|
||||
protected:
|
||||
void Init() override;
|
||||
void Init(Juliet::NonNullPtr<Juliet::Arena> arena) override;
|
||||
void Shutdown() override;
|
||||
void Update() override;
|
||||
bool IsRunning() override;
|
||||
@@ -43,13 +43,12 @@ class JulietApplication : public Juliet::IApplication
|
||||
Juliet::HotReloadCode GameCode = {};
|
||||
Juliet::GraphicsPipeline* GraphicsPipeline = {};
|
||||
Juliet::Texture* DepthBuffer = {};
|
||||
Juliet::GraphicsPipeline* SkyboxPipeline = {};
|
||||
Juliet::Arena* GameArena = nullptr;
|
||||
Juliet::Arena* GameScratchArena = nullptr;
|
||||
|
||||
int AutoCloseFrameCount = -1;
|
||||
bool Running = false;
|
||||
float CameraTime = 0.0f;
|
||||
int AutoCloseFrameCount = -1;
|
||||
bool Running = false;
|
||||
float CameraTime = 0.0f;
|
||||
};
|
||||
|
||||
JulietApplication& GetEditorApplication();
|
||||
|
||||
Reference in New Issue
Block a user