-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor various Graphics/ classes with clearer names
- Loading branch information
1 parent
3041060
commit fee3c80
Showing
46 changed files
with
503 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
#include <iosfwd> | ||
|
||
namespace osc | ||
{ | ||
enum class DepthStencilRenderBufferFormat { | ||
|
||
// two-component, 32-bit packed, with 24 unsigned normalized bits for | ||
// the depth (D) component and 8 unsigned integer bits for the stencil (S) | ||
// component | ||
D24_UNorm_S8_UInt, | ||
|
||
// 32-bit signed floating point format for the depth (D) component | ||
D32_SFloat, | ||
|
||
NUM_OPTIONS, | ||
|
||
Default = D24_UNorm_S8_UInt, | ||
}; | ||
|
||
std::ostream& operator<<(std::ostream&, DepthStencilRenderBufferFormat); | ||
} |
8 changes: 4 additions & 4 deletions
8
src/oscar/Graphics/DepthRenderBufferParams.h → ...Graphics/DepthStencilRenderBufferParams.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
#pragma once | ||
|
||
#include <oscar/Graphics/AntiAliasingLevel.h> | ||
#include <oscar/Graphics/DepthStencilFormat.h> | ||
#include <oscar/Graphics/DepthStencilRenderBufferFormat.h> | ||
#include <oscar/Graphics/RenderTextureReadWrite.h> | ||
#include <oscar/Graphics/TextureDimensionality.h> | ||
#include <oscar/Maths/Vec2.h> | ||
|
||
namespace osc | ||
{ | ||
struct DepthRenderBufferParams final { | ||
struct DepthStencilRenderBufferParams final { | ||
|
||
friend bool operator==(const DepthRenderBufferParams&, const DepthRenderBufferParams&) = default; | ||
friend bool operator==(const DepthStencilRenderBufferParams&, const DepthStencilRenderBufferParams&) = default; | ||
|
||
Vec2i dimensions = {1, 1}; | ||
TextureDimensionality dimensionality = TextureDimensionality::Tex2D; | ||
AntiAliasingLevel anti_aliasing_level = AntiAliasingLevel{1}; | ||
DepthStencilFormat format = DepthStencilFormat::Default; | ||
DepthStencilRenderBufferFormat format = DepthStencilRenderBufferFormat::Default; | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
src/oscar/Graphics/Detail/DepthStencilRenderBufferFormatHelpers.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
#include <oscar/Graphics/Detail/CPUDataType.h> | ||
#include <oscar/Graphics/Detail/CPUImageFormat.h> | ||
#include <oscar/Graphics/Detail/DepthStencilRenderBufferFormatList.h> | ||
#include <oscar/Graphics/Detail/DepthStencilRenderBufferFormatTraits.h> | ||
#include <oscar/Utils/CStringView.h> | ||
|
||
#include <array> | ||
|
||
namespace osc::detail | ||
{ | ||
constexpr bool has_stencil_component(DepthStencilRenderBufferFormat format) | ||
{ | ||
constexpr auto lut = []<DepthStencilRenderBufferFormat... Formats>(OptionList<DepthStencilRenderBufferFormat, Formats...>) { | ||
return std::to_array({ DepthStencilRenderBufferFormatTraits<Formats>::has_stencil_component... }); | ||
}(DepthStencilRenderBufferFormatList{}); | ||
|
||
return lut.at(to_index(format)); | ||
} | ||
|
||
constexpr CStringView get_label(DepthStencilRenderBufferFormat format) | ||
{ | ||
constexpr auto lut = []<DepthStencilRenderBufferFormat... Formats>(OptionList<DepthStencilRenderBufferFormat, Formats...>) { | ||
return std::to_array({ DepthStencilRenderBufferFormatTraits<Formats>::label... }); | ||
}(DepthStencilRenderBufferFormatList{}); | ||
|
||
return lut.at(to_index(format)); | ||
} | ||
|
||
constexpr CPUImageFormat equivalent_cpu_image_format_of(DepthStencilRenderBufferFormat format) | ||
{ | ||
constexpr auto lut = []<DepthStencilRenderBufferFormat... Formats>(OptionList<DepthStencilRenderBufferFormat, Formats...>) { | ||
return std::to_array({ DepthStencilRenderBufferFormatTraits<Formats>::equivalent_cpu_image_format... }); | ||
}(DepthStencilRenderBufferFormatList{}); | ||
|
||
return lut.at(to_index(format)); | ||
} | ||
|
||
constexpr CPUDataType equivalent_cpu_datatype_of(DepthStencilRenderBufferFormat format) | ||
{ | ||
constexpr auto lut = []<DepthStencilRenderBufferFormat... Formats>(OptionList<DepthStencilRenderBufferFormat, Formats...>) { | ||
return std::to_array({ DepthStencilRenderBufferFormatTraits<Formats>::equivalent_cpu_datatype... }); | ||
}(DepthStencilRenderBufferFormatList{}); | ||
|
||
return lut.at(to_index(format)); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/oscar/Graphics/Detail/DepthStencilRenderBufferFormatList.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <oscar/Graphics/DepthStencilRenderBufferFormat.h> | ||
#include <oscar/Utils/EnumHelpers.h> | ||
|
||
namespace osc::detail | ||
{ | ||
using DepthStencilRenderBufferFormatList = OptionList<DepthStencilRenderBufferFormat, | ||
DepthStencilRenderBufferFormat::D24_UNorm_S8_UInt, | ||
DepthStencilRenderBufferFormat::D32_SFloat | ||
>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.