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
6d9630f3
Commit
6d9630f3
authored
Jan 20, 2003
by
Christian Costa
Committed by
Alexandre Julliard
Jan 20, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make D3D1..3 lights code rely on D3D7.
parent
f5885def
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
42 deletions
+64
-42
d3d_private.h
dlls/ddraw/d3d_private.h
+8
-0
d3dlight.c
dlls/ddraw/d3dlight.c
+33
-42
d3dviewport.c
dlls/ddraw/d3dviewport.c
+23
-0
No files found.
dlls/ddraw/d3d_private.h
View file @
6d9630f3
...
@@ -90,8 +90,13 @@ struct IDirect3DLightImpl
...
@@ -90,8 +90,13 @@ struct IDirect3DLightImpl
DWORD
ref
;
DWORD
ref
;
/* IDirect3DLight fields */
/* IDirect3DLight fields */
IDirect3DImpl
*
d3d
;
IDirect3DImpl
*
d3d
;
/* If this light is active for one viewport, put the viewport here */
IDirect3DViewportImpl
*
active_viewport
;
D3DLIGHT2
light
;
D3DLIGHT2
light
;
D3DLIGHT7
light7
;
DWORD
dwLightIndex
;
/* Chained list used for adding / removing from viewports */
/* Chained list used for adding / removing from viewports */
IDirect3DLightImpl
*
next
;
IDirect3DLightImpl
*
next
;
...
@@ -132,6 +137,9 @@ struct IDirect3DViewportImpl
...
@@ -132,6 +137,9 @@ struct IDirect3DViewportImpl
/* If this viewport is active for one device, put the device here */
/* If this viewport is active for one device, put the device here */
IDirect3DDeviceImpl
*
active_device
;
IDirect3DDeviceImpl
*
active_device
;
DWORD
num_lights
;
DWORD
map_lights
;
int
use_vp2
;
int
use_vp2
;
union
{
union
{
D3DVIEWPORT
vp1
;
D3DVIEWPORT
vp1
;
...
...
dlls/ddraw/d3dlight.c
View file @
6d9630f3
...
@@ -79,16 +79,46 @@ static void dump_light(LPD3DLIGHT2 light)
...
@@ -79,16 +79,46 @@ static void dump_light(LPD3DLIGHT2 light)
DPRINTF
(
" - dwSize : %ld
\n
"
,
light
->
dwSize
);
DPRINTF
(
" - dwSize : %ld
\n
"
,
light
->
dwSize
);
}
}
static
const
float
zero_value
[]
=
{
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
};
HRESULT
WINAPI
HRESULT
WINAPI
Main_IDirect3DLightImpl_1_SetLight
(
LPDIRECT3DLIGHT
iface
,
Main_IDirect3DLightImpl_1_SetLight
(
LPDIRECT3DLIGHT
iface
,
LPD3DLIGHT
lpLight
)
LPD3DLIGHT
lpLight
)
{
{
ICOM_THIS_FROM
(
IDirect3DLightImpl
,
IDirect3DLight
,
iface
);
ICOM_THIS_FROM
(
IDirect3DLightImpl
,
IDirect3DLight
,
iface
);
LPD3DLIGHT7
light7
=
&
(
This
->
light7
);
TRACE
(
"(%p/%p)->(%p)
\n
"
,
This
,
iface
,
lpLight
);
TRACE
(
"(%p/%p)->(%p)
\n
"
,
This
,
iface
,
lpLight
);
if
(
TRACE_ON
(
ddraw
))
{
if
(
TRACE_ON
(
ddraw
))
{
TRACE
(
" Light definition :
\n
"
);
TRACE
(
" Light definition :
\n
"
);
dump_light
((
LPD3DLIGHT2
)
lpLight
);
dump_light
((
LPD3DLIGHT2
)
lpLight
);
}
}
if
(
(
lpLight
->
dltType
==
0
)
||
(
lpLight
->
dltType
>
D3DLIGHT_PARALLELPOINT
)
)
return
DDERR_INVALIDPARAMS
;
if
(
lpLight
->
dltType
==
D3DLIGHT_PARALLELPOINT
)
FIXME
(
"D3DLIGHT_PARALLELPOINT no supported
\n
"
);
/* Translate D3DLIGH2 structure to D3DLIGHT7 */
light7
->
dltType
=
lpLight
->
dltType
;
light7
->
dcvDiffuse
=
lpLight
->
dcvColor
;
if
((((
LPD3DLIGHT2
)
lpLight
)
->
dwFlags
&
D3DLIGHT_NO_SPECULAR
)
!=
0
)
light7
->
dcvSpecular
=
lpLight
->
dcvColor
;
else
light7
->
dcvSpecular
=
*
(
D3DCOLORVALUE
*
)
zero_value
;
light7
->
dcvAmbient
=
lpLight
->
dcvColor
;
light7
->
dvPosition
=
lpLight
->
dvPosition
;
light7
->
dvDirection
=
lpLight
->
dvDirection
;
light7
->
dvRange
=
lpLight
->
dvRange
;
light7
->
dvFalloff
=
lpLight
->
dvFalloff
;
light7
->
dvAttenuation0
=
lpLight
->
dvAttenuation0
;
light7
->
dvAttenuation1
=
lpLight
->
dvAttenuation1
;
light7
->
dvAttenuation2
=
lpLight
->
dvAttenuation2
;
light7
->
dvTheta
=
lpLight
->
dvTheta
;
light7
->
dvPhi
=
lpLight
->
dvPhi
;
memcpy
(
&
This
->
light
,
lpLight
,
lpLight
->
dwSize
);
memcpy
(
&
This
->
light
,
lpLight
,
lpLight
->
dwSize
);
if
((
This
->
light
.
dwFlags
&
D3DLIGHT_ACTIVE
)
!=
0
)
{
if
((
This
->
light
.
dwFlags
&
D3DLIGHT_ACTIVE
)
!=
0
)
{
This
->
update
(
This
);
This
->
update
(
This
);
...
@@ -113,50 +143,10 @@ Main_IDirect3DLightImpl_1_GetLight(LPDIRECT3DLIGHT iface,
...
@@ -113,50 +143,10 @@ Main_IDirect3DLightImpl_1_GetLight(LPDIRECT3DLIGHT iface,
/*******************************************************************************
/*******************************************************************************
* Light static functions
* Light static functions
*/
*/
static
const
float
zero_value
[]
=
{
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
};
static
void
update
(
IDirect3DLightImpl
*
This
)
{
static
void
update
(
IDirect3DLightImpl
*
This
)
{
IDirect3DLightGLImpl
*
glThis
=
(
IDirect3DLightGLImpl
*
)
This
;
IDirect3DDeviceImpl
*
device
=
This
->
active_viewport
->
active_device
;
ENTER_GL
();
IDirect3DDevice7_SetLight
(
ICOM_INTERFACE
(
device
,
IDirect3DDevice7
),
This
->
dwLightIndex
,
&
(
This
->
light7
));
switch
(
glThis
->
parent
.
light
.
dltType
)
{
case
D3DLIGHT_POINT
:
/* 1 */
FIXME
(
"Activating POINT - not supported yet
\n
"
);
break
;
case
D3DLIGHT_SPOT
:
/* 2 */
FIXME
(
"Activating SPOT - not supported yet
\n
"
);
break
;
case
D3DLIGHT_DIRECTIONAL
:
{
/* 3 */
float
direction
[
4
];
if
(
TRACE_ON
(
ddraw
))
{
TRACE
(
"Activating DIRECTIONAL
\n
"
);
DPRINTF
(
" - direction : "
);
dump_D3DVECTOR
(
&
(
glThis
->
parent
.
light
.
dvDirection
));
DPRINTF
(
"
\n
"
);
DPRINTF
(
" - color : "
);
dump_D3DCOLORVALUE
(
&
(
glThis
->
parent
.
light
.
dcvColor
));
DPRINTF
(
"
\n
"
);
}
glLightfv
(
glThis
->
light_num
,
GL_AMBIENT
,
(
float
*
)
zero_value
);
glLightfv
(
glThis
->
light_num
,
GL_DIFFUSE
,
(
float
*
)
&
(
glThis
->
parent
.
light
.
dcvColor
));
direction
[
0
]
=
-
glThis
->
parent
.
light
.
dvDirection
.
u1
.
x
;
direction
[
1
]
=
-
glThis
->
parent
.
light
.
dvDirection
.
u2
.
y
;
direction
[
2
]
=
-
glThis
->
parent
.
light
.
dvDirection
.
u3
.
z
;
direction
[
3
]
=
0
.
0
;
/* This is a directional light */
glLightfv
(
glThis
->
light_num
,
GL_POSITION
,
(
float
*
)
direction
);
}
break
;
case
D3DLIGHT_PARALLELPOINT
:
/* 4 */
FIXME
(
"Activating PARRALLEL-POINT - not supported yet
\n
"
);
break
;
default:
WARN
(
"Not a known Light Type: %d
\n
"
,
glThis
->
parent
.
light
.
dltType
);
break
;
}
LEAVE_GL
();
}
}
static
void
activate
(
IDirect3DLightImpl
*
This
)
{
static
void
activate
(
IDirect3DLightImpl
*
This
)
{
...
@@ -236,6 +226,7 @@ HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirect3DImpl *d3d, GLenum lig
...
@@ -236,6 +226,7 @@ HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirect3DImpl *d3d, GLenum lig
object
->
activate
=
activate
;
object
->
activate
=
activate
;
object
->
desactivate
=
desactivate
;
object
->
desactivate
=
desactivate
;
object
->
update
=
update
;
object
->
update
=
update
;
object
->
active_viewport
=
NULL
;
gl_object
->
light_num
=
light_num
;
gl_object
->
light_num
=
light_num
;
ICOM_INIT_INTERFACE
(
object
,
IDirect3DLight
,
VTABLE_IDirect3DLight
);
ICOM_INIT_INTERFACE
(
object
,
IDirect3DLight
,
VTABLE_IDirect3DLight
);
...
...
dlls/ddraw/d3dviewport.c
View file @
6d9630f3
...
@@ -271,13 +271,30 @@ Main_IDirect3DViewportImpl_3_2_1_AddLight(LPDIRECT3DVIEWPORT3 iface,
...
@@ -271,13 +271,30 @@ Main_IDirect3DViewportImpl_3_2_1_AddLight(LPDIRECT3DVIEWPORT3 iface,
{
{
ICOM_THIS_FROM
(
IDirect3DViewportImpl
,
IDirect3DViewport3
,
iface
);
ICOM_THIS_FROM
(
IDirect3DViewportImpl
,
IDirect3DViewport3
,
iface
);
IDirect3DLightImpl
*
lpDirect3DLightImpl
=
ICOM_OBJECT
(
IDirect3DLightImpl
,
IDirect3DLight
,
lpDirect3DLight
);
IDirect3DLightImpl
*
lpDirect3DLightImpl
=
ICOM_OBJECT
(
IDirect3DLightImpl
,
IDirect3DLight
,
lpDirect3DLight
);
DWORD
i
=
0
;
DWORD
map
=
This
->
map_lights
;
TRACE
(
"(%p/%p)->(%p)
\n
"
,
This
,
iface
,
lpDirect3DLight
);
TRACE
(
"(%p/%p)->(%p)
\n
"
,
This
,
iface
,
lpDirect3DLight
);
if
(
This
->
num_lights
>=
8
)
return
DDERR_INVALIDPARAMS
;
/* Find a light number and update both light and viewports objects accordingly */
while
(
map
&
1
)
{
map
>>=
1
;
i
++
;
}
lpDirect3DLightImpl
->
dwLightIndex
=
i
;
This
->
num_lights
++
;
This
->
map_lights
|=
1
<<
i
;
/* Add the light in the 'linked' chain */
/* Add the light in the 'linked' chain */
lpDirect3DLightImpl
->
next
=
This
->
lights
;
lpDirect3DLightImpl
->
next
=
This
->
lights
;
This
->
lights
=
lpDirect3DLightImpl
;
This
->
lights
=
lpDirect3DLightImpl
;
/* Attach the light to the viewport */
lpDirect3DLightImpl
->
active_viewport
=
This
;
/* If active, activate the light */
/* If active, activate the light */
if
(
This
->
active_device
!=
NULL
)
{
if
(
This
->
active_device
!=
NULL
)
{
lpDirect3DLightImpl
->
activate
(
lpDirect3DLightImpl
);
lpDirect3DLightImpl
->
activate
(
lpDirect3DLightImpl
);
...
@@ -301,6 +318,10 @@ Main_IDirect3DViewportImpl_3_2_1_DeleteLight(LPDIRECT3DVIEWPORT3 iface,
...
@@ -301,6 +318,10 @@ Main_IDirect3DViewportImpl_3_2_1_DeleteLight(LPDIRECT3DVIEWPORT3 iface,
lpDirect3DLightImpl
->
desactivate
(
lpDirect3DLightImpl
);
lpDirect3DLightImpl
->
desactivate
(
lpDirect3DLightImpl
);
if
(
prev_light
==
NULL
)
This
->
lights
=
cur_light
->
next
;
if
(
prev_light
==
NULL
)
This
->
lights
=
cur_light
->
next
;
else
prev_light
->
next
=
cur_light
->
next
;
else
prev_light
->
next
=
cur_light
->
next
;
/* Detach the light to the viewport */
cur_light
->
active_viewport
=
NULL
;
This
->
num_lights
--
;
This
->
map_lights
&=
~
(
1
<<
lpDirect3DLightImpl
->
dwLightIndex
);
return
DD_OK
;
return
DD_OK
;
}
}
prev_light
=
cur_light
;
prev_light
=
cur_light
;
...
@@ -450,6 +471,8 @@ HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirect3DImpl *d3d)
...
@@ -450,6 +471,8 @@ HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirect3DImpl *d3d)
object
->
use_vp2
=
0xFF
;
object
->
use_vp2
=
0xFF
;
object
->
next
=
NULL
;
object
->
next
=
NULL
;
object
->
lights
=
NULL
;
object
->
lights
=
NULL
;
object
->
num_lights
=
0
;
object
->
map_lights
=
0
;
ICOM_INIT_INTERFACE
(
object
,
IDirect3DViewport3
,
VTABLE_IDirect3DViewport3
);
ICOM_INIT_INTERFACE
(
object
,
IDirect3DViewport3
,
VTABLE_IDirect3DViewport3
);
...
...
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