mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 00:07:35 +00:00
LibGL+LibGPU+LibSoftGPU: Move Light.h to LibGPU
This commit is contained in:
parent
e7450fa940
commit
7da9447619
4 changed files with 7 additions and 7 deletions
|
@ -1236,7 +1236,7 @@ void Device::set_sampler_config(unsigned sampler, GPU::SamplerConfig const& conf
|
|||
m_samplers[sampler].set_config(config);
|
||||
}
|
||||
|
||||
void Device::set_light_state(unsigned int light_id, Light const& light)
|
||||
void Device::set_light_state(unsigned int light_id, GPU::Light const& light)
|
||||
{
|
||||
m_lights.at(light_id) = light;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <LibGPU/DeviceInfo.h>
|
||||
#include <LibGPU/Enums.h>
|
||||
#include <LibGPU/ImageFormat.h>
|
||||
#include <LibGPU/Light.h>
|
||||
#include <LibGPU/SamplerConfig.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Matrix3x3.h>
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include <LibSoftGPU/Clipper.h>
|
||||
#include <LibSoftGPU/Config.h>
|
||||
#include <LibSoftGPU/Image.h>
|
||||
#include <LibSoftGPU/Light/Light.h>
|
||||
#include <LibSoftGPU/Light/Material.h>
|
||||
#include <LibSoftGPU/Sampler.h>
|
||||
#include <LibSoftGPU/Triangle.h>
|
||||
|
@ -134,7 +134,7 @@ public:
|
|||
NonnullRefPtr<Image> create_image(GPU::ImageFormat format, unsigned width, unsigned height, unsigned depth, unsigned levels, unsigned layers);
|
||||
|
||||
void set_sampler_config(unsigned, GPU::SamplerConfig const&);
|
||||
void set_light_state(unsigned, Light const&);
|
||||
void set_light_state(unsigned, GPU::Light const&);
|
||||
void set_material_state(GPU::Face, Material const&);
|
||||
void set_stencil_configuration(GPU::Face, StencilConfiguration const&);
|
||||
|
||||
|
@ -161,7 +161,7 @@ private:
|
|||
Array<Sampler, NUM_SAMPLERS> m_samplers;
|
||||
Vector<size_t> m_enabled_texture_units;
|
||||
AlphaBlendFactors m_alpha_blend_factors;
|
||||
Array<Light, NUM_LIGHTS> m_lights;
|
||||
Array<GPU::Light, NUM_LIGHTS> m_lights;
|
||||
Array<Material, 2u> m_materials;
|
||||
RasterPosition m_raster_position;
|
||||
Array<StencilConfiguration, 2u> m_stencil_configuration;
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Jesse Buhagiar <jooster669@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/Vector3.h>
|
||||
#include <LibGfx/Vector4.h>
|
||||
|
||||
namespace SoftGPU {
|
||||
|
||||
struct Light {
|
||||
bool is_enabled { false };
|
||||
|
||||
// According to the OpenGL 1.5 specification, page 56, all of the parameters
|
||||
// for the following data members (positions, colors, and reals) are all
|
||||
// floating point.
|
||||
Vector4<float> ambient_intensity { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
Vector4<float> diffuse_intensity { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
Vector4<float> specular_intensity { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
Vector4<float> position { 0.0f, 0.0f, 1.0f, 0.0f };
|
||||
Vector3<float> spotlight_direction { 0.0f, 0.0f, -1.0f };
|
||||
|
||||
float spotlight_exponent { 0.0f };
|
||||
float spotlight_cutoff_angle { 180.0f };
|
||||
float constant_attenuation { 1.0f }; // This is referred to `k0i` in the OpenGL spec
|
||||
float linear_attenuation { 0.0f }; // This is referred to `k1i` in the OpenGL spec
|
||||
float quadratic_attenuation { 0.0f }; // This is referred to `k2i` in the OpenGL spec
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue