summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL/GLLights.cpp
blob: 5a797dfd4bee736e99eb93b2afd01127768a909a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
 * Copyright (c) 2021, Jelle Raaijmakers <jelle@gmta.nl>
 * Copyright (c) 2022, Jesse Buhagiar <jooster669@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include "GL/gl.h"
#include "GLContext.h"
#include <AK/Debug.h>

extern GL::GLContext* g_gl_context;

void glColorMaterial(GLenum face, GLenum mode)
{
    g_gl_context->gl_color_material(face, mode);
}

void glLightf(GLenum light, GLenum pname, GLfloat param)
{
    g_gl_context->gl_lightf(light, pname, param);
}

void glLightfv(GLenum light, GLenum pname, GLfloat const* param)
{
    g_gl_context->gl_lightfv(light, pname, param);
}

void glLighti(GLenum light, GLenum pname, GLint param)
{
    g_gl_context->gl_lightf(light, pname, param);
}

void glLightiv(GLenum light, GLenum pname, GLint const* params)
{
    g_gl_context->gl_lightiv(light, pname, params);
}

void glLightModelf(GLenum pname, GLfloat param)
{
    g_gl_context->gl_light_model(pname, param, 0.0f, 0.0f, 0.0f);
}

void glLightModelfv(GLenum pname, GLfloat const* params)
{
    switch (pname) {
    case GL_LIGHT_MODEL_AMBIENT:
        g_gl_context->gl_light_model(pname, params[0], params[1], params[2], params[3]);
        break;
    default:
        g_gl_context->gl_light_model(pname, params[0], 0.0f, 0.0f, 0.0f);
        break;
    }
}

void glLightModeliv(GLenum pname, GLint const* params)
{
    switch (pname) {
    case GL_LIGHT_MODEL_AMBIENT:
        g_gl_context->gl_light_model(pname, params[0], params[1], params[2], params[3]);
        break;
    default:
        g_gl_context->gl_light_model(pname, params[0], 0.0f, 0.0f, 0.0f);
        break;
    }
}

void glLightModeli(GLenum pname, GLint param)
{
    g_gl_context->gl_light_model(pname, param, 0.0f, 0.0f, 0.0f);
}

void glMaterialf(GLenum face, GLenum pname, GLfloat param)
{
    g_gl_context->gl_materialf(face, pname, param);
}

void glMaterialfv(GLenum face, GLenum pname, GLfloat const* params)
{
    g_gl_context->gl_materialfv(face, pname, params);
}

void glMateriali(GLenum face, GLenum pname, GLint param)
{
    g_gl_context->gl_materialf(face, pname, param);
}

void glMaterialiv(GLenum face, GLenum pname, GLint const* params)
{
    g_gl_context->gl_materialiv(face, pname, params);
}

void glShadeModel(GLenum mode)
{
    g_gl_context->gl_shade_model(mode);
}

void glGetLightfv(GLenum light, GLenum pname, GLfloat* params)
{
    g_gl_context->gl_get_light(light, pname, params, GL_FLOAT);
}

void glGetLightiv(GLenum light, GLenum pname, GLint* params)
{
    g_gl_context->gl_get_light(light, pname, params, GL_INT);
}

void glGetMaterialfv(GLenum face, GLenum pname, GLfloat* params)
{
    g_gl_context->gl_get_material(face, pname, params, GL_FLOAT);
}

void glGetMaterialiv(GLenum face, GLenum pname, GLint* params)
{
    g_gl_context->gl_get_material(face, pname, params, GL_INT);
}