Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ac95c302
Commit
ac95c302
authored
Apr 21, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Replace the light list with a standard Wine list.
parent
f50ad122
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
59 deletions
+57
-59
ddraw_private.h
dlls/ddraw/ddraw_private.h
+2
-5
viewport.c
dlls/ddraw/viewport.c
+55
-54
No files found.
dlls/ddraw/ddraw_private.h
View file @
ac95c302
...
...
@@ -416,8 +416,7 @@ struct IDirect3DLightImpl
DWORD
dwLightIndex
;
/* Chained list used for adding / removing from viewports */
IDirect3DLightImpl
*
next
;
struct
list
entry
;
};
/* Helper functions */
...
...
@@ -473,9 +472,7 @@ struct IDirect3DViewportImpl
}
viewports
;
struct
list
entry
;
/* Lights list */
IDirect3DLightImpl
*
lights
;
struct
list
light_list
;
/* Background material */
IDirect3DMaterialImpl
*
background
;
...
...
dlls/ddraw/viewport.c
View file @
ac95c302
...
...
@@ -36,18 +36,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
* activates the viewport using IDirect3DDevice7::SetViewport
*
*****************************************************************************/
void
viewport_activate
(
IDirect3DViewportImpl
*
This
,
BOOL
ignore_lights
)
{
IDirect3DLightImpl
*
light
;
void
viewport_activate
(
IDirect3DViewportImpl
*
This
,
BOOL
ignore_lights
)
{
D3DVIEWPORT7
vp
;
if
(
!
ignore_lights
)
{
/* Activate all the lights associated with this context */
light
=
This
->
lights
;
if
(
!
ignore_lights
)
{
IDirect3DLightImpl
*
light
;
while
(
light
)
/* Activate all the lights associated with this context */
LIST_FOR_EACH_ENTRY
(
light
,
&
This
->
light_list
,
IDirect3DLightImpl
,
entry
)
{
light_activate
(
light
);
light
=
light
->
next
;
}
}
...
...
@@ -749,8 +749,7 @@ IDirect3DViewportImpl_AddLight(IDirect3DViewport3 *iface,
This
->
map_lights
|=
1
<<
i
;
/* Add the light in the 'linked' chain */
lpDirect3DLightImpl
->
next
=
This
->
lights
;
This
->
lights
=
lpDirect3DLightImpl
;
list_add_head
(
&
This
->
light_list
,
&
lpDirect3DLightImpl
->
entry
);
IDirect3DLight_AddRef
(
lpDirect3DLight
);
/* Attach the light to the viewport */
...
...
@@ -782,33 +781,29 @@ IDirect3DViewportImpl_DeleteLight(IDirect3DViewport3 *iface,
IDirect3DLight
*
lpDirect3DLight
)
{
IDirect3DViewportImpl
*
This
=
(
IDirect3DViewportImpl
*
)
iface
;
IDirect3DLightImpl
*
lpDirect3DLightImpl
=
(
IDirect3DLightImpl
*
)
lpDirect3DLight
;
IDirect3DLightImpl
*
cur_light
,
*
prev_light
=
NULL
;
IDirect3DLightImpl
*
l
=
(
IDirect3DLightImpl
*
)
lpDirect3DLight
;
TRACE
(
"iface %p, light %p.
\n
"
,
iface
,
lpDirect3DLight
);
EnterCriticalSection
(
&
ddraw_cs
);
cur_light
=
This
->
lights
;
while
(
cur_light
!=
NULL
)
{
if
(
cur_light
==
lpDirect3DLightImpl
)
{
light_deactivate
(
lpDirect3DLightImpl
);
if
(
!
prev_light
)
This
->
lights
=
cur_light
->
next
;
else
prev_light
->
next
=
cur_light
->
next
;
/* Detach the light from the viewport. */
cur_light
->
active_viewport
=
NULL
;
IDirect3DLight_Release
((
IDirect3DLight
*
)
cur_light
);
--
This
->
num_lights
;
This
->
map_lights
&=
~
(
1
<<
lpDirect3DLightImpl
->
dwLightIndex
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
D3D_OK
;
}
prev_light
=
cur_light
;
cur_light
=
cur_light
->
next
;
if
(
l
->
active_viewport
!=
This
)
{
WARN
(
"Light %p active viewport is %p.
\n
"
,
l
,
l
->
active_viewport
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
DDERR_INVALIDPARAMS
;
}
light_deactivate
(
l
);
list_remove
(
&
l
->
entry
);
l
->
active_viewport
=
NULL
;
IDirect3DLight_Release
(
lpDirect3DLight
);
--
This
->
num_lights
;
This
->
map_lights
&=
~
(
1
<<
l
->
dwLightIndex
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
D
DERR_INVALIDPARAMS
;
return
D
3D_OK
;
}
/*****************************************************************************
...
...
@@ -831,7 +826,9 @@ IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface,
DWORD
dwFlags
)
{
IDirect3DViewportImpl
*
This
=
(
IDirect3DViewportImpl
*
)
iface
;
IDirect3DLightImpl
*
cur_light
,
*
prev_light
=
NULL
;
IDirect3DLightImpl
*
l
=
(
IDirect3DLightImpl
*
)
lpDirect3DLight
;
struct
list
*
entry
;
HRESULT
hr
;
TRACE
(
"iface %p, light %p, next_light %p, flags %#x.
\n
"
,
iface
,
lpDirect3DLight
,
lplpDirect3DLight
,
dwFlags
);
...
...
@@ -839,47 +836,50 @@ IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface,
if
(
!
lplpDirect3DLight
)
return
DDERR_INVALIDPARAMS
;
*
lplpDirect3DLight
=
NULL
;
EnterCriticalSection
(
&
ddraw_cs
);
cur_light
=
This
->
lights
;
switch
(
dwFlags
)
{
switch
(
dwFlags
)
{
case
D3DNEXT_NEXT
:
if
(
!
lpDirect3DLight
)
{
LeaveCriticalSection
(
&
ddraw_cs
);
return
DDERR_INVALIDPARAMS
;
}
while
(
cur_light
!=
NULL
)
{
if
(
cur_light
==
(
IDirect3DLightImpl
*
)
lpDirect3DLight
)
{
*
lplpDirect3DLight
=
(
IDirect3DLight
*
)
cur_light
->
next
;
break
;
}
cur_light
=
cur_light
->
next
;
if
(
!
l
||
l
->
active_viewport
!=
This
)
{
if
(
l
)
WARN
(
"Light %p active viewport is %p.
\n
"
,
l
,
l
->
active_viewport
);
entry
=
NULL
;
}
else
entry
=
list_next
(
&
This
->
light_list
,
&
l
->
entry
);
break
;
case
D3DNEXT_HEAD
:
*
lplpDirect3DLight
=
(
IDirect3DLight
*
)
This
->
lights
;
entry
=
list_head
(
&
This
->
light_list
)
;
break
;
case
D3DNEXT_TAIL
:
while
(
cur_light
!=
NULL
)
{
prev_light
=
cur_light
;
cur_light
=
cur_light
->
next
;
}
*
lplpDirect3DLight
=
(
IDirect3DLight
*
)
prev_light
;
entry
=
list_tail
(
&
This
->
light_list
);
break
;
default:
ERR
(
"Unknown flag %d
\n
"
,
dwFlags
);
entry
=
NULL
;
WARN
(
"Invalid flags %#x.
\n
"
,
dwFlags
);
break
;
}
if
(
*
lplpDirect3DLight
)
if
(
entry
)
{
*
lplpDirect3DLight
=
(
IDirect3DLight
*
)
LIST_ENTRY
(
entry
,
IDirect3DLightImpl
,
entry
);
IDirect3DLight_AddRef
(
*
lplpDirect3DLight
);
hr
=
D3D_OK
;
}
else
{
*
lplpDirect3DLight
=
NULL
;
hr
=
DDERR_INVALIDPARAMS
;
}
LeaveCriticalSection
(
&
ddraw_cs
);
return
*
lplpDirect3DLight
?
D3D_OK
:
DDERR_INVALIDPARAMS
;
return
hr
;
}
/*****************************************************************************
...
...
@@ -1131,4 +1131,5 @@ void d3d_viewport_init(IDirect3DViewportImpl *viewport, IDirectDrawImpl *ddraw)
viewport
->
ref
=
1
;
viewport
->
ddraw
=
ddraw
;
viewport
->
use_vp2
=
0xff
;
list_init
(
&
viewport
->
light_list
);
}
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