mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-11 14:43:34 +00:00
adding waves to water, improving water color, fixing underwater view
This commit is contained in:
@@ -42,7 +42,7 @@ fn main(input: VertIn) -> VertOut
|
||||
output.uv = input.uv;
|
||||
output.norm = normalize(input.normal);
|
||||
output.transformed_norm = mat3[f32](model.normal) * output.norm.xyz;
|
||||
output.frag_position = model.matrix * input.pos;
|
||||
output.frag_position = model.matrix * vec4[f32](input.pos.xyz, 1.0);
|
||||
output.camera_position = viewer_data.camera_position;
|
||||
output.pos = viewer_data.view_proj_matrix * output.frag_position;
|
||||
return output;
|
||||
|
||||
@@ -31,10 +31,22 @@ namespace Scop
|
||||
|
||||
class GraphicPipeline : public Pipeline
|
||||
{
|
||||
friend class Render2DPass;
|
||||
friend class FinalPass;
|
||||
friend class ForwardPass;
|
||||
friend class PostProcessPass;
|
||||
friend class SkyboxPass;
|
||||
|
||||
public:
|
||||
GraphicPipeline() = default;
|
||||
|
||||
void Init(GraphicPipelineDescriptor descriptor);
|
||||
inline void Setup(GraphicPipelineDescriptor descriptor)
|
||||
{
|
||||
if(!descriptor.vertex_shader || !descriptor.fragment_shader)
|
||||
FatalError("Vulkan: invalid shaders");
|
||||
m_description = std::move(descriptor);
|
||||
}
|
||||
|
||||
bool BindPipeline(VkCommandBuffer command_buffer, std::size_t framebuffer_index, std::array<float, 4> clear) noexcept;
|
||||
void EndPipeline(VkCommandBuffer command_buffer) noexcept override;
|
||||
void Destroy() noexcept;
|
||||
@@ -48,6 +60,7 @@ namespace Scop
|
||||
inline ~GraphicPipeline() noexcept { Destroy(); }
|
||||
|
||||
private:
|
||||
void Init(GraphicPipelineDescriptor descriptor);
|
||||
void CreateFramebuffers(const std::vector<NonOwningPtr<Texture>>& render_targets, bool clear_attachments);
|
||||
void TransitionAttachments(VkCommandBuffer cmd = VK_NULL_HANDLE);
|
||||
|
||||
|
||||
@@ -10,10 +10,7 @@ namespace Scop
|
||||
{
|
||||
void GraphicPipeline::Init(GraphicPipelineDescriptor descriptor)
|
||||
{
|
||||
if(!descriptor.vertex_shader || !descriptor.fragment_shader)
|
||||
FatalError("Vulkan: invalid shaders");
|
||||
|
||||
m_description = std::move(descriptor);
|
||||
Setup(std::move(descriptor));
|
||||
|
||||
m_description.vertex_shader->SetPipelineInUse(this);
|
||||
m_description.fragment_shader->SetPipelineInUse(this);
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace Scop
|
||||
if(pipeline->GetDescription().depth != NonOwningPtr<DepthImage>{ &scene.GetDepth() })
|
||||
{
|
||||
GraphicPipelineDescriptor descriptor = pipeline->GetDescription();
|
||||
pipeline->Destroy();
|
||||
descriptor.color_attachments = { &render_target };
|
||||
descriptor.depth = &scene.GetDepth();
|
||||
descriptor.renderer = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user