2021-12-26 21:19:38 +01:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2014-08-13 18:52:52 +02:00
|
|
|
*
|
2021-12-26 21:19:38 +01:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
2014-08-13 18:52:52 +02:00
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 18:47:58 +01:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2014-08-13 18:52:52 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-08-13 18:52:52 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2022-03-08 15:47:20 +01:00
|
|
|
* This file is based on, or a modified version of code from TinyGL (C) 1997-2022 Fabrice Bellard,
|
|
|
|
* which is licensed under the MIT license (see LICENSE).
|
2014-08-13 18:52:52 +02:00
|
|
|
* It also has modifications by the ResidualVM-team, which are covered under the GPLv2 (or later).
|
|
|
|
*/
|
2005-01-12 15:20:02 +00:00
|
|
|
|
2009-05-08 07:32:33 +00:00
|
|
|
#include "graphics/tinygl/zgl.h"
|
2014-08-07 17:54:53 +02:00
|
|
|
#include "graphics/tinygl/zdirtyrect.h"
|
2005-01-12 15:20:02 +00:00
|
|
|
|
2009-05-25 13:19:29 +00:00
|
|
|
namespace TinyGL {
|
|
|
|
|
2021-12-07 09:54:19 +01:00
|
|
|
void GLContext::glopClearColor(GLParam *p) {
|
2021-12-07 00:58:14 +01:00
|
|
|
clear_color = Vector4(p[1].f, p[2].f, p[3].f, p[4].f);
|
2005-01-12 15:20:02 +00:00
|
|
|
}
|
|
|
|
|
2021-12-07 09:54:19 +01:00
|
|
|
void GLContext::glopClearDepth(GLParam *p) {
|
2021-12-07 00:58:14 +01:00
|
|
|
clear_depth = p[1].f;
|
2006-05-16 14:52:36 +00:00
|
|
|
}
|
2005-01-12 15:20:02 +00:00
|
|
|
|
2021-12-09 21:10:53 +01:00
|
|
|
void GLContext::glopClearStencil(GLParam *p) {
|
|
|
|
clear_stencil = p[1].i & 0xFF;
|
|
|
|
}
|
|
|
|
|
2021-12-07 09:54:19 +01:00
|
|
|
void GLContext::glopClear(GLParam *p) {
|
2006-05-16 14:52:36 +00:00
|
|
|
int mask = p[1].i;
|
2021-12-07 00:58:14 +01:00
|
|
|
int z = (int)(clear_depth * ((1 << ZB_Z_BITS) - 1));
|
|
|
|
int r = (int)(clear_color.X * 255);
|
|
|
|
int g = (int)(clear_color.Y * 255);
|
|
|
|
int b = (int)(clear_color.Z * 255);
|
2021-12-09 21:10:53 +01:00
|
|
|
int s = (int)(clear_stencil);
|
2014-07-25 15:41:32 +02:00
|
|
|
|
2021-12-09 21:10:53 +01:00
|
|
|
issueDrawCall(new ClearBufferDrawCall(mask & TGL_DEPTH_BUFFER_BIT, z,
|
2021-12-15 23:55:36 +01:00
|
|
|
mask & TGL_COLOR_BUFFER_BIT, r, g, b,
|
|
|
|
mask & TGL_STENCIL_BUFFER_BIT, s));
|
2005-01-12 15:20:02 +00:00
|
|
|
}
|
2009-05-25 13:19:29 +00:00
|
|
|
|
|
|
|
} // end of namespace TinyGL
|