mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
LibGPU+LibSoftGPU: Move LightModelParameters into LibGPU
This commit is contained in:
parent
5a5596b381
commit
5bf224708f
3 changed files with 26 additions and 11 deletions
21
Userland/Libraries/LibGPU/LightModelParameters.h
Normal file
21
Userland/Libraries/LibGPU/LightModelParameters.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Jesse Buhagiar <jooster669@gmail.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibGPU/Enums.h>
|
||||||
|
#include <LibGfx/Vector4.h>
|
||||||
|
|
||||||
|
namespace GPU {
|
||||||
|
|
||||||
|
struct LightModelParameters {
|
||||||
|
FloatVector4 scene_ambient_color { 0.2f, 0.2f, 0.2f, 1.0f };
|
||||||
|
bool viewer_at_infinity { false };
|
||||||
|
GPU::ColorControl color_control { GPU::ColorControl::SingleColor };
|
||||||
|
bool two_sided_lighting { false };
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -1198,7 +1198,7 @@ void Device::set_options(RasterizerOptions const& options)
|
||||||
setup_blend_factors();
|
setup_blend_factors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::set_light_model_params(LightModelParameters const& lighting_model)
|
void Device::set_light_model_params(GPU::LightModelParameters const& lighting_model)
|
||||||
{
|
{
|
||||||
m_lighting_model = lighting_model;
|
m_lighting_model = lighting_model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <LibGPU/Enums.h>
|
#include <LibGPU/Enums.h>
|
||||||
#include <LibGPU/ImageFormat.h>
|
#include <LibGPU/ImageFormat.h>
|
||||||
#include <LibGPU/Light.h>
|
#include <LibGPU/Light.h>
|
||||||
|
#include <LibGPU/LightModelParameters.h>
|
||||||
#include <LibGPU/Material.h>
|
#include <LibGPU/Material.h>
|
||||||
#include <LibGPU/RasterPosition.h>
|
#include <LibGPU/RasterPosition.h>
|
||||||
#include <LibGPU/SamplerConfig.h>
|
#include <LibGPU/SamplerConfig.h>
|
||||||
|
@ -79,13 +80,6 @@ struct RasterizerOptions {
|
||||||
GPU::ColorMaterialMode color_material_mode { GPU::ColorMaterialMode::AmbientAndDiffuse };
|
GPU::ColorMaterialMode color_material_mode { GPU::ColorMaterialMode::AmbientAndDiffuse };
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LightModelParameters {
|
|
||||||
FloatVector4 scene_ambient_color { 0.2f, 0.2f, 0.2f, 1.0f };
|
|
||||||
bool viewer_at_infinity { false };
|
|
||||||
GPU::ColorControl color_control { GPU::ColorControl::SingleColor };
|
|
||||||
bool two_sided_lighting { false };
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PixelQuad;
|
struct PixelQuad;
|
||||||
|
|
||||||
class Device final {
|
class Device final {
|
||||||
|
@ -103,9 +97,9 @@ public:
|
||||||
void blit_to_color_buffer_at_raster_position(Gfx::Bitmap const&);
|
void blit_to_color_buffer_at_raster_position(Gfx::Bitmap const&);
|
||||||
void blit_to_depth_buffer_at_raster_position(Vector<GPU::DepthType> const&, int, int);
|
void blit_to_depth_buffer_at_raster_position(Vector<GPU::DepthType> const&, int, int);
|
||||||
void set_options(RasterizerOptions const&);
|
void set_options(RasterizerOptions const&);
|
||||||
void set_light_model_params(LightModelParameters const&);
|
void set_light_model_params(GPU::LightModelParameters const&);
|
||||||
RasterizerOptions options() const { return m_options; }
|
RasterizerOptions options() const { return m_options; }
|
||||||
LightModelParameters light_model() const { return m_lighting_model; }
|
GPU::LightModelParameters light_model() const { return m_lighting_model; }
|
||||||
GPU::ColorType get_color_buffer_pixel(int x, int y);
|
GPU::ColorType get_color_buffer_pixel(int x, int y);
|
||||||
GPU::DepthType get_depthbuffer_value(int x, int y);
|
GPU::DepthType get_depthbuffer_value(int x, int y);
|
||||||
|
|
||||||
|
@ -131,7 +125,7 @@ private:
|
||||||
|
|
||||||
RefPtr<FrameBuffer<GPU::ColorType, GPU::DepthType, GPU::StencilType>> m_frame_buffer {};
|
RefPtr<FrameBuffer<GPU::ColorType, GPU::DepthType, GPU::StencilType>> m_frame_buffer {};
|
||||||
RasterizerOptions m_options;
|
RasterizerOptions m_options;
|
||||||
LightModelParameters m_lighting_model;
|
GPU::LightModelParameters m_lighting_model;
|
||||||
Clipper m_clipper;
|
Clipper m_clipper;
|
||||||
Vector<Triangle> m_triangle_list;
|
Vector<Triangle> m_triangle_list;
|
||||||
Vector<Triangle> m_processed_triangles;
|
Vector<Triangle> m_processed_triangles;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue