27 float midR,
float midG,
float midB,
28 float botR,
float botG,
float botB)
29 : m_mode(SkyboxMode::Gradient),
30 m_topR(topR), m_topG(topG), m_topB(topB),
31 m_midR(midR), m_midG(midG), m_midB(midB),
32 m_botR(botR), m_botG(botG), m_botB(botB) {}
41 if (m_initialized)
return;
45 cube.
vertices.
AddVertex(
Vertex(-1, -1, 1, 0,0,0, 0,0,0,0, 0,0));
46 cube.
vertices.
AddVertex(
Vertex(-1, 1, 1, 0,0,0, 0,0,0,0, 0,0));
47 cube.
vertices.
AddVertex(
Vertex( 1, 1, 1, 0,0,0, 0,0,0,0, 0,0));
48 cube.
vertices.
AddVertex(
Vertex( 1, -1, 1, 0,0,0, 0,0,0,0, 0,0));
49 cube.
vertices.
AddVertex(
Vertex(-1, -1, -1, 0,0,0, 0,0,0,0, 0,0));
50 cube.
vertices.
AddVertex(
Vertex(-1, 1, -1, 0,0,0, 0,0,0,0, 0,0));
51 cube.
vertices.
AddVertex(
Vertex( 1, 1, -1, 0,0,0, 0,0,0,0, 0,0));
52 cube.
vertices.
AddVertex(
Vertex( 1, -1, -1, 0,0,0, 0,0,0,0, 0,0));
81 m_constantBuffer->SetSlot(0);
85 "assets/shaders/skybox.hlsl"));
86 if (!m_shader.IsValid()) {
87 SLEAK_ERROR(
"Skybox: Failed to create skybox shader");
92 if (m_mode == SkyboxMode::Cubemap) {
95 if (!m_cubemapTexture.IsValid()) {
96 SLEAK_WARN(
"Skybox: Failed to load cubemap faces, falling back to panorama");
97 m_mode = SkyboxMode::Default;
98 m_panoramaPath =
"assets/textures/default_skybox.hdr";
102 if (m_mode == SkyboxMode::Panorama || m_mode == SkyboxMode::Default) {
103 m_cubemapTexture =
RefPtr(
105 if (!m_cubemapTexture.IsValid()) {
106 SLEAK_WARN(
"Skybox: Failed to load panorama '{}', falling back to gradient",
108 m_mode = SkyboxMode::Gradient;
112 if (m_mode == SkyboxMode::Gradient) {
113 SLEAK_INFO(
"Skybox: Using gradient mode (no cubemap texture)");
116 m_initialized =
true;
117 SLEAK_INFO(
"Skybox initialized successfully (mode: {})",
118 m_mode == SkyboxMode::Cubemap ?
"cubemap" :
119 m_mode == SkyboxMode::Panorama ?
"panorama" :
120 m_mode == SkyboxMode::Gradient ?
"gradient" :
"default");
Abstract interface for high-level graphics command execution and resource management.
virtual void BindTexture(RefPtr< Sleak::Texture > texture, uint32_t slot=0)
virtual void SetCullEnabled(bool enabled)
virtual void SetDepthCompare(DepthCompare compare)
virtual void BindVertexBuffer(RefPtr< BufferBase > buffer, uint32_t slot=0)=0
virtual void BeginSkyboxPass()
virtual void BindIndexBuffer(RefPtr< BufferBase > buffer, uint32_t slot=0)=0
virtual void SetDepthWrite(bool enabled)
virtual void EndSkyboxPass()
virtual void BindConstantBuffer(RefPtr< BufferBase > buffer, uint32_t slot=0)=0
virtual void DrawIndexed(uint32_t indexCount)=0
Indexed draw from the currently bound vertex/index buffers.