mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 05:44:58 +00:00
LibGL+LibGPU+LibSoftGPU: Move Material.h to LibGPU
This commit is contained in:
parent
7da9447619
commit
b652db1f54
5 changed files with 8 additions and 8 deletions
|
@ -3413,7 +3413,7 @@ void GLContext::gl_materialfv(GLenum face, GLenum pname, GLfloat const* params)
|
|||
RETURN_WITH_ERROR_IF(!(pname == GL_AMBIENT || pname == GL_DIFFUSE || pname == GL_SPECULAR || pname == GL_EMISSION || pname == GL_SHININESS || pname == GL_AMBIENT_AND_DIFFUSE), GL_INVALID_ENUM);
|
||||
RETURN_WITH_ERROR_IF((pname == GL_SHININESS && *params > 128.0f), GL_INVALID_VALUE);
|
||||
|
||||
auto update_material = [](SoftGPU::Material& material, GLenum pname, GLfloat const* params) {
|
||||
auto update_material = [](GPU::Material& material, GLenum pname, GLfloat const* params) {
|
||||
switch (pname) {
|
||||
case GL_AMBIENT:
|
||||
material.ambient = { params[0], params[1], params[2], params[3] };
|
||||
|
@ -3460,7 +3460,7 @@ void GLContext::gl_materialiv(GLenum face, GLenum pname, GLint const* params)
|
|||
RETURN_WITH_ERROR_IF(!(pname == GL_AMBIENT || pname == GL_DIFFUSE || pname == GL_SPECULAR || pname == GL_EMISSION || pname == GL_SHININESS || pname == GL_AMBIENT_AND_DIFFUSE), GL_INVALID_ENUM);
|
||||
RETURN_WITH_ERROR_IF((pname == GL_SHININESS && *params > 128), GL_INVALID_VALUE);
|
||||
|
||||
auto update_material = [](SoftGPU::Material& material, GLenum pname, GLint const* params) {
|
||||
auto update_material = [](GPU::Material& material, GLenum pname, GLint const* params) {
|
||||
switch (pname) {
|
||||
case GL_AMBIENT:
|
||||
material.ambient = { static_cast<float>(params[0]), static_cast<float>(params[1]), static_cast<float>(params[2]), static_cast<float>(params[3]) };
|
||||
|
|
|
@ -439,7 +439,7 @@ private:
|
|||
// Lighting configuration
|
||||
bool m_lighting_enabled { false };
|
||||
Vector<GPU::Light> m_light_states;
|
||||
Array<SoftGPU::Material, 2u> m_material_states;
|
||||
Array<GPU::Material, 2u> m_material_states;
|
||||
|
||||
// Color material
|
||||
bool m_color_material_enabled { false };
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <LibGfx/Vector4.h>
|
||||
|
||||
namespace SoftGPU {
|
||||
namespace GPU {
|
||||
|
||||
struct Material {
|
||||
FloatVector4 ambient { 0.2f, 0.2f, 0.2f, 1.0f };
|
|
@ -1241,7 +1241,7 @@ void Device::set_light_state(unsigned int light_id, GPU::Light const& light)
|
|||
m_lights.at(light_id) = light;
|
||||
}
|
||||
|
||||
void Device::set_material_state(GPU::Face face, Material const& material)
|
||||
void Device::set_material_state(GPU::Face face, GPU::Material const& material)
|
||||
{
|
||||
m_materials[face] = material;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <LibGPU/Enums.h>
|
||||
#include <LibGPU/ImageFormat.h>
|
||||
#include <LibGPU/Light.h>
|
||||
#include <LibGPU/Material.h>
|
||||
#include <LibGPU/SamplerConfig.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Matrix3x3.h>
|
||||
|
@ -27,7 +28,6 @@
|
|||
#include <LibSoftGPU/Clipper.h>
|
||||
#include <LibSoftGPU/Config.h>
|
||||
#include <LibSoftGPU/Image.h>
|
||||
#include <LibSoftGPU/Light/Material.h>
|
||||
#include <LibSoftGPU/Sampler.h>
|
||||
#include <LibSoftGPU/Triangle.h>
|
||||
#include <LibSoftGPU/Vertex.h>
|
||||
|
@ -135,7 +135,7 @@ public:
|
|||
|
||||
void set_sampler_config(unsigned, GPU::SamplerConfig const&);
|
||||
void set_light_state(unsigned, GPU::Light const&);
|
||||
void set_material_state(GPU::Face, Material const&);
|
||||
void set_material_state(GPU::Face, GPU::Material const&);
|
||||
void set_stencil_configuration(GPU::Face, StencilConfiguration const&);
|
||||
|
||||
RasterPosition raster_position() const { return m_raster_position; }
|
||||
|
@ -162,7 +162,7 @@ private:
|
|||
Vector<size_t> m_enabled_texture_units;
|
||||
AlphaBlendFactors m_alpha_blend_factors;
|
||||
Array<GPU::Light, NUM_LIGHTS> m_lights;
|
||||
Array<Material, 2u> m_materials;
|
||||
Array<GPU::Material, 2u> m_materials;
|
||||
RasterPosition m_raster_position;
|
||||
Array<StencilConfiguration, 2u> m_stencil_configuration;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue