Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fancy2209
SRB2
Commits
636093a5
Commit
636093a5
authored
5 years ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Fix color LUT using the wrong palette
parent
9d9c685d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/m_anigif.c
+5
-13
5 additions, 13 deletions
src/m_anigif.c
src/r_data.c
+8
-4
8 additions, 4 deletions
src/r_data.c
src/r_data.h
+2
-1
2 additions, 1 deletion
src/r_data.h
src/v_video.c
+1
-2
1 addition, 2 deletions
src/v_video.c
src/v_video.h
+1
-4
1 addition, 4 deletions
src/v_video.h
with
17 additions
and
24 deletions
src/m_anigif.c
+
5
−
13
View file @
636093a5
...
...
@@ -624,14 +624,6 @@ static void GIF_framewrite(void)
//
INT32
GIF_open
(
const
char
*
filename
)
{
#if 0
if (rendermode != render_soft)
{
CONS_Alert(CONS_WARNING, M_GetText("GIFs cannot be taken in non-software modes!\n"));
return 0;
}
#endif
gif_out
=
fopen
(
filename
,
"wb"
);
if
(
!
gif_out
)
return
0
;
...
...
@@ -640,13 +632,13 @@ INT32 GIF_open(const char *filename)
gif_downscale
=
(
!!
cv_gif_downscale
.
value
);
// GIF color table
// In hardware mode, uses the master palette
gif_palette
=
((
cv_screenshot_colorprofile
.
value
// In hardware mode, forces the local palette
#ifdef HWRENDER
&&
(
rendermode
==
render_soft
)
if
(
rendermode
==
render_opengl
)
gif_palette
=
pLocalPalette
;
else
#endif
)
?
pLocalPalette
:
pMasterPalette
);
gif_palette
=
((
cv_screenshot_colorprofile
.
value
)
?
pLocalPalette
:
pMasterPalette
);
GIF_headwrite
();
gif_frames
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/r_data.c
+
8
−
4
View file @
636093a5
...
...
@@ -2465,16 +2465,20 @@ extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *ex
// Thanks to quake2 source!
// utils3/qdata/images.c
UINT8
NearestColor
(
UINT8
r
,
UINT8
g
,
UINT8
b
)
UINT8
Nearest
Palette
Color
(
UINT8
r
,
UINT8
g
,
UINT8
b
,
RGBA_t
*
palette
)
{
int
dr
,
dg
,
db
;
int
distortion
,
bestdistortion
=
256
*
256
*
4
,
bestcolor
=
0
,
i
;
// Use master palette if none specified
if
(
palette
==
NULL
)
palette
=
pMasterPalette
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
dr
=
r
-
p
MasterP
alette
[
i
].
s
.
red
;
dg
=
g
-
p
MasterP
alette
[
i
].
s
.
green
;
db
=
b
-
p
MasterP
alette
[
i
].
s
.
blue
;
dr
=
r
-
palette
[
i
].
s
.
red
;
dg
=
g
-
palette
[
i
].
s
.
green
;
db
=
b
-
palette
[
i
].
s
.
blue
;
distortion
=
dr
*
dr
+
dg
*
dg
+
db
*
db
;
if
(
distortion
<
bestdistortion
)
{
...
...
This diff is collapsed.
Click to expand it.
src/r_data.h
+
2
−
1
View file @
636093a5
...
...
@@ -171,7 +171,8 @@ const char *R_NameForColormap(extracolormap_t *extra_colormap);
#define R_PutRgbaRGB(r, g, b) (R_PutRgbaR(r) + R_PutRgbaG(g) + R_PutRgbaB(b))
#define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a))
UINT8
NearestColor
(
UINT8
r
,
UINT8
g
,
UINT8
b
);
UINT8
NearestPaletteColor
(
UINT8
r
,
UINT8
g
,
UINT8
b
,
RGBA_t
*
palette
);
#define NearestColor(r, g, b) NearestPaletteColor(r, g, b, NULL)
extern
INT32
numtextures
;
...
...
This diff is collapsed.
Click to expand it.
src/v_video.c
+
1
−
2
View file @
636093a5
...
...
@@ -3244,7 +3244,6 @@ Unoptimized version
#endif
}
// Taken from my videos-in-SRB2 project
// Generates a color look-up table
// which has up to 64 colors at each channel
// (see the defines in v_video.h)
...
...
@@ -3261,7 +3260,7 @@ void InitColorLUT(RGBA_t *palette)
for
(
r
=
0
;
r
<
CLUTSIZE
;
r
++
)
for
(
g
=
0
;
g
<
CLUTSIZE
;
g
++
)
for
(
b
=
0
;
b
<
CLUTSIZE
;
b
++
)
colorlookup
[
r
][
g
][
b
]
=
NearestColor
(
r
<<
SHIFTCOLORBITS
,
g
<<
SHIFTCOLORBITS
,
b
<<
SHIFTCOLORBITS
);
colorlookup
[
r
][
g
][
b
]
=
Nearest
Palette
Color
(
r
<<
SHIFTCOLORBITS
,
g
<<
SHIFTCOLORBITS
,
b
<<
SHIFTCOLORBITS
,
palette
);
clutinit
=
true
;
lastpalette
=
palette
;
}
...
...
This diff is collapsed.
Click to expand it.
src/v_video.h
+
1
−
4
View file @
636093a5
...
...
@@ -37,10 +37,7 @@ cv_allcaps;
// Allocates buffer screens, call before R_Init.
void
V_Init
(
void
);
// Taken from my videos-in-SRB2 project
// Generates a color look-up table
// which has up to 64 colors at each channel
// Color look-up table
#define COLORBITS 6
#define SHIFTCOLORBITS (8-COLORBITS)
#define CLUTSIZE (1<<COLORBITS)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment