Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
060ea15a
Commit
060ea15a
authored
Nov 10, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3drm: Introduce d3drm_set_color().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b86f6b93
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
28 deletions
+31
-28
d3drm_private.h
dlls/d3drm/d3drm_private.h
+16
-0
frame.c
dlls/d3drm/frame.c
+2
-3
light.c
dlls/d3drm/light.c
+1
-1
math.c
dlls/d3drm/math.c
+9
-20
meshbuilder.c
dlls/d3drm/meshbuilder.c
+3
-4
No files found.
dlls/d3drm/d3drm_private.h
View file @
060ea15a
...
...
@@ -21,6 +21,7 @@
#ifndef __D3DRM_PRIVATE_INCLUDED__
#define __D3DRM_PRIVATE_INCLUDED__
#include <math.h>
#include "d3drm.h"
#include "dxfile.h"
#include "d3drmwin.h"
...
...
@@ -140,4 +141,19 @@ struct d3drm_file_header
extern
char
templates
[]
DECLSPEC_HIDDEN
;
static
inline
BYTE
d3drm_color_component
(
float
c
)
{
if
(
c
<=
0
.
0
f
)
return
0u
;
if
(
c
>=
1
.
0
f
)
return
0xffu
;
return
floor
(
c
*
255
.
0
f
);
}
static
inline
void
d3drm_set_color
(
D3DCOLOR
*
color
,
float
r
,
float
g
,
float
b
,
float
a
)
{
*
color
=
RGBA_MAKE
(
d3drm_color_component
(
r
),
d3drm_color_component
(
g
),
d3drm_color_component
(
b
),
d3drm_color_component
(
a
));
}
#endif
/* __D3DRM_PRIVATE_INCLUDED__ */
dlls/d3drm/frame.c
View file @
060ea15a
...
...
@@ -2004,8 +2004,7 @@ static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundRGB(IDirect3DRMFrame3 *ifac
TRACE
(
"iface %p, red %.8e, green %.8e, blue %.8e.
\n
"
,
iface
,
red
,
green
,
blue
);
frame
->
scenebackground
=
RGBA_MAKE
((
BYTE
)(
red
*
255
.
0
f
),
(
BYTE
)(
green
*
255
.
0
f
),
(
BYTE
)(
blue
*
255
.
0
f
),
0xff
);
d3drm_set_color
(
&
frame
->
scenebackground
,
red
,
green
,
blue
,
1
.
0
f
);
return
D3DRM_OK
;
}
...
...
@@ -2949,7 +2948,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
object
->
IDirect3DRMFrame3_iface
.
lpVtbl
=
&
d3drm_frame3_vtbl
;
object
->
d3drm
=
d3drm
;
object
->
ref
=
1
;
object
->
scenebackground
=
RGBA_MAKE
(
0
,
0
,
0
,
0xf
f
);
d3drm_set_color
(
&
object
->
scenebackground
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
memcpy
(
object
->
transform
,
identity
,
sizeof
(
D3DRMMATRIX4D
));
...
...
dlls/d3drm/light.c
View file @
060ea15a
...
...
@@ -183,7 +183,7 @@ static HRESULT WINAPI d3drm_light_SetColorRGB(IDirect3DRMLight *iface,
TRACE
(
"iface %p, red %.8e, green %.8e, blue %.8e.
\n
"
,
iface
,
red
,
green
,
blue
);
light
->
color
=
RGBA_MAKE
((
BYTE
)(
red
*
255
.
0
f
),
(
BYTE
)(
green
*
255
.
0
f
),
(
BYTE
)(
blue
*
255
.
0
f
),
0xf
f
);
d3drm_set_color
(
&
light
->
color
,
red
,
green
,
blue
,
1
.
0
f
);
return
D3DRM_OK
;
}
...
...
dlls/d3drm/math.c
View file @
060ea15a
...
...
@@ -19,12 +19,10 @@
#define NONAMELESSUNION
#include <math.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "d3drmdef.h"
#include "config.h"
#include "wine/port.h"
#include "d3drm_private.h"
/* Create a RGB color from its components */
D3DCOLOR
WINAPI
D3DRMCreateColorRGB
(
D3DVALUE
red
,
D3DVALUE
green
,
D3DVALUE
blue
)
...
...
@@ -34,20 +32,11 @@ D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE red, D3DVALUE green, D3DVALUE blue)
/* Create a RGBA color from its components */
D3DCOLOR
WINAPI
D3DRMCreateColorRGBA
(
D3DVALUE
red
,
D3DVALUE
green
,
D3DVALUE
blue
,
D3DVALUE
alpha
)
{
int
Red
,
Green
,
Blue
,
Alpha
;
Red
=
floor
(
red
*
255
);
Green
=
floor
(
green
*
255
);
Blue
=
floor
(
blue
*
255
);
Alpha
=
floor
(
alpha
*
255
);
if
(
red
<
0
)
Red
=
0
;
if
(
red
>
1
)
Red
=
255
;
if
(
green
<
0
)
Green
=
0
;
if
(
green
>
1
)
Green
=
255
;
if
(
blue
<
0
)
Blue
=
0
;
if
(
blue
>
1
)
Blue
=
255
;
if
(
alpha
<
0
)
Alpha
=
0
;
if
(
alpha
>
1
)
Alpha
=
255
;
return
(
RGBA_MAKE
(
Red
,
Green
,
Blue
,
Alpha
));
D3DCOLOR
color
;
d3drm_set_color
(
&
color
,
red
,
green
,
blue
,
alpha
);
return
color
;
}
/* Determine the alpha part of a color */
...
...
dlls/d3drm/meshbuilder.c
View file @
060ea15a
...
...
@@ -1235,8 +1235,7 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
values
=
(
float
*
)
ptr
;
This
->
materials
[
i
].
color
=
RGBA_MAKE
((
BYTE
)(
values
[
0
]
*
255
.
0
f
),
(
BYTE
)(
values
[
1
]
*
255
.
0
f
),
(
BYTE
)(
values
[
2
]
*
255
.
0
f
),
(
BYTE
)(
values
[
3
]
*
255
.
0
f
));
d3drm_set_color
(
&
This
->
materials
[
i
].
color
,
values
[
0
],
values
[
1
],
values
[
2
],
values
[
3
]);
IDirect3DRMMaterial2_SetAmbient
(
This
->
materials
[
i
].
material
,
values
[
0
],
values
[
1
],
values
[
2
]);
/* Alpha ignored */
IDirect3DRMMaterial2_SetPower
(
This
->
materials
[
i
].
material
,
values
[
4
]);
...
...
@@ -1694,7 +1693,7 @@ static HRESULT WINAPI d3drm_mesh_builder3_SetColorRGB(IDirect3DRMMeshBuilder3 *i
TRACE
(
"iface %p, red %.8e, green %.8e, blue %.8e.
\n
"
,
iface
,
red
,
green
,
blue
);
mesh_builder
->
color
=
RGBA_MAKE
((
BYTE
)(
red
*
255
.
0
f
),
(
BYTE
)(
green
*
255
.
0
f
),
(
BYTE
)(
blue
*
255
.
0
f
),
0xf
f
);
d3drm_set_color
(
&
mesh_builder
->
color
,
red
,
green
,
blue
,
1
.
0
f
);
return
D3DRM_OK
;
}
...
...
@@ -2595,7 +2594,7 @@ static HRESULT WINAPI d3drm_mesh_SetGroupColorRGB(IDirect3DRMMesh *iface,
if
(
id
>=
mesh
->
nb_groups
)
return
D3DRMERR_BADVALUE
;
mesh
->
groups
[
id
].
color
=
RGBA_MAKE
((
BYTE
)(
red
*
255
.
0
f
),
(
BYTE
)(
green
*
255
.
0
f
),
(
BYTE
)(
blue
*
255
.
0
f
),
0xf
f
);
d3drm_set_color
(
&
mesh
->
groups
[
id
].
color
,
red
,
green
,
blue
,
1
.
0
f
);
return
D3DRM_OK
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment