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
be29e370
Commit
be29e370
authored
Oct 31, 2005
by
Christian Costa
Committed by
Alexandre Julliard
Oct 31, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish moving d3d[1..3] light code to use d3d7.
parent
5c256c51
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
55 deletions
+35
-55
direct3d_opengl.c
dlls/ddraw/direct3d_opengl.c
+2
-21
light.c
dlls/ddraw/light.c
+31
-25
opengl_private.h
dlls/ddraw/opengl_private.h
+2
-9
No files found.
dlls/ddraw/direct3d_opengl.c
View file @
be29e370
...
...
@@ -97,22 +97,12 @@ GL_IDirect3DImpl_3_2T_1T_CreateLight(LPDIRECT3D3 iface,
IUnknown
*
pUnkOuter
)
{
ICOM_THIS_FROM
(
IDirectDrawImpl
,
IDirect3D3
,
iface
);
IDirect3DGLImpl
*
glThis
=
(
IDirect3DGLImpl
*
)
This
->
d3d_private
;
int
fl
;
IDirect3DLightImpl
*
d3dlimpl
;
HRESULT
ret_value
;
TRACE
(
"(%p/%p)->(%p,%p)
\n
"
,
This
,
iface
,
lplpDirect3DLight
,
pUnkOuter
);
for
(
fl
=
0
;
fl
<
MAX_LIGHTS
;
fl
++
)
{
if
((
glThis
->
free_lights
&
(
0x01
<<
fl
))
!=
0
)
{
glThis
->
free_lights
&=
~
(
0x01
<<
fl
);
break
;
}
}
if
(
fl
==
MAX_LIGHTS
)
{
return
DDERR_INVALIDPARAMS
;
/* No way to say 'max lights reached' ... */
}
ret_value
=
d3dlight_create
(
&
d3dlimpl
,
This
,
GL_LIGHT0
+
fl
);
ret_value
=
d3dlight_create
(
&
d3dlimpl
,
This
);
*
lplpDirect3DLight
=
ICOM_INTERFACE
(
d3dlimpl
,
IDirect3DLight
);
return
ret_value
;
...
...
@@ -306,12 +296,6 @@ GL_IDirect3DImpl_7_3T_CreateVertexBuffer(LPDIRECT3D7 iface,
return
res
;
}
static
void
light_released
(
IDirectDrawImpl
*
This
,
GLenum
light_num
)
{
IDirect3DGLImpl
*
glThis
=
(
IDirect3DGLImpl
*
)
This
->
d3d_private
;
glThis
->
free_lights
|=
(
light_num
-
GL_LIGHT0
);
}
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3D7.fun))
#else
...
...
@@ -453,9 +437,6 @@ HRESULT direct3d_create(IDirectDrawImpl *This)
ICOM_INIT_INTERFACE
(
This
,
IDirect3D3
,
VTABLE_IDirect3D3
);
ICOM_INIT_INTERFACE
(
This
,
IDirect3D7
,
VTABLE_IDirect3D7
);
globject
->
free_lights
=
(
0x01
<<
MAX_LIGHTS
)
-
1
;
/* There are, in total, 8 lights in OpenGL */
globject
->
light_released
=
light_released
;
This
->
d3d_private
=
globject
;
TRACE
(
" creating OpenGL private storage at %p.
\n
"
,
globject
);
...
...
dlls/ddraw/light.c
View file @
be29e370
...
...
@@ -156,54 +156,63 @@ Main_IDirect3DLightImpl_1_GetLight(LPDIRECT3DLIGHT iface,
* Light static functions
*/
static
void
update
(
IDirect3DLightImpl
*
This
)
{
static
void
update
(
IDirect3DLightImpl
*
This
)
{
IDirect3DDeviceImpl
*
device
;
if
(
!
This
->
active_viewport
||!
This
->
active_viewport
->
active_device
)
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
This
->
active_viewport
||
!
This
->
active_viewport
->
active_device
)
return
;
device
=
This
->
active_viewport
->
active_device
;
IDirect3DDevice7_SetLight
(
ICOM_INTERFACE
(
device
,
IDirect3DDevice7
),
This
->
dwLightIndex
,
&
(
This
->
light7
));
IDirect3DDevice7_SetLight
(
ICOM_INTERFACE
(
device
,
IDirect3DDevice7
),
This
->
dwLightIndex
,
&
(
This
->
light7
));
}
static
void
activate
(
IDirect3DLightImpl
*
This
)
{
IDirect3DLightGLImpl
*
glThis
=
(
IDirect3DLightGLImpl
*
)
This
;
static
void
activate
(
IDirect3DLightImpl
*
This
)
{
IDirect3DDeviceImpl
*
device
;
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
This
->
active_viewport
||
!
This
->
active_viewport
->
active_device
)
return
;
device
=
This
->
active_viewport
->
active_device
;
ENTER_GL
();
update
(
This
);
/* If was not active, activate it */
if
((
glThis
->
parent
.
light
.
dwFlags
&
D3DLIGHT_ACTIVE
)
==
0
)
{
glEnable
(
glThis
->
light_num
);
glThis
->
parent
.
light
.
dwFlags
|=
D3DLIGHT_ACTIVE
;
if
((
This
->
light
.
dwFlags
&
D3DLIGHT_ACTIVE
)
==
0
)
{
IDirect3DDevice7_LightEnable
(
ICOM_INTERFACE
(
device
,
IDirect3DDevice7
),
This
->
dwLightIndex
,
TRUE
);
This
->
light
.
dwFlags
|=
D3DLIGHT_ACTIVE
;
}
LEAVE_GL
();
}
static
void
desactivate
(
IDirect3DLightImpl
*
This
)
{
IDirect3DLightGLImpl
*
glThis
=
(
IDirect3DLightGLImpl
*
)
This
;
static
void
desactivate
(
IDirect3DLightImpl
*
This
)
{
IDirect3DDeviceImpl
*
device
;
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
This
->
active_viewport
||
!
This
->
active_viewport
->
active_device
)
return
;
device
=
This
->
active_viewport
->
active_device
;
ENTER_GL
();
/* If was not active, activate it */
if
((
glThis
->
parent
.
light
.
dwFlags
&
D3DLIGHT_ACTIVE
)
!=
0
)
{
glDisable
(
glThis
->
light_num
);
glThis
->
parent
.
light
.
dwFlags
&=
~
D3DLIGHT_ACTIVE
;
if
((
This
->
light
.
dwFlags
&
D3DLIGHT_ACTIVE
)
!=
0
)
{
IDirect3DDevice7_LightEnable
(
ICOM_INTERFACE
(
device
,
IDirect3DDevice7
),
This
->
dwLightIndex
,
FALSE
);
This
->
light
.
dwFlags
&=
~
D3DLIGHT_ACTIVE
;
}
LEAVE_GL
();
}
ULONG
WINAPI
GL_IDirect3DLightImpl_1_Release
(
LPDIRECT3DLIGHT
iface
)
{
ICOM_THIS_FROM
(
IDirect3DLightImpl
,
IDirect3DLight
,
iface
);
IDirect3DLightGLImpl
*
glThis
=
(
IDirect3DLightGLImpl
*
)
This
;
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p/%p)->() decrementing from %lu.
\n
"
,
This
,
iface
,
ref
+
1
);
if
(
!
ref
)
{
((
IDirect3DGLImpl
*
)
This
->
d3d
->
d3d_private
)
->
light_released
(
This
->
d3d
,
glThis
->
light_num
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
...
...
@@ -233,14 +242,12 @@ static const IDirect3DLightVtbl VTABLE_IDirect3DLight =
HRESULT
d3dlight_create
(
IDirect3DLightImpl
**
obj
,
IDirectDrawImpl
*
d3d
,
GLenum
light_num
)
HRESULT
d3dlight_create
(
IDirect3DLightImpl
**
obj
,
IDirectDrawImpl
*
d3d
)
{
IDirect3DLightImpl
*
object
;
IDirect3DLightGLImpl
*
gl_object
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirect3DLight
GL
Impl
));
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirect3DLightImpl
));
if
(
object
==
NULL
)
return
DDERR_OUTOFMEMORY
;
gl_object
=
(
IDirect3DLightGLImpl
*
)
object
;
object
->
ref
=
1
;
object
->
d3d
=
d3d
;
...
...
@@ -249,7 +256,6 @@ HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirectDrawImpl *d3d, GLenum l
object
->
desactivate
=
desactivate
;
object
->
update
=
update
;
object
->
active_viewport
=
NULL
;
gl_object
->
light_num
=
light_num
;
ICOM_INIT_INTERFACE
(
object
,
IDirect3DLight
,
VTABLE_IDirect3DLight
);
...
...
dlls/ddraw/opengl_private.h
View file @
be29e370
...
...
@@ -48,16 +48,9 @@ typedef enum {
/* This structure is used for the 'd3d_private' field of the IDirectDraw structure */
typedef
struct
IDirect3DGLImpl
{
DWORD
free_lights
;
void
(
*
light_released
)(
IDirectDrawImpl
*
,
GLenum
light_num
);
int
dummy
;
/* Empty for the moment */
}
IDirect3DGLImpl
;
typedef
struct
IDirect3DLightGLImpl
{
struct
IDirect3DLightImpl
parent
;
GLenum
light_num
;
}
IDirect3DLightGLImpl
;
/* This structure is used for the 'private' field of the IDirectDrawSurfaceImpl structure */
typedef
struct
IDirect3DTextureGLImpl
{
...
...
@@ -185,7 +178,7 @@ extern GL_EXTENSIONS_LIST GL_extensions;
/* All non-static functions 'exported' by various sub-objects */
extern
HRESULT
direct3d_create
(
IDirectDrawImpl
*
This
);
extern
HRESULT
d3dtexture_create
(
IDirectDrawImpl
*
d3d
,
IDirectDrawSurfaceImpl
*
surf
,
BOOLEAN
at_creation
,
IDirectDrawSurfaceImpl
*
main_surf
);
extern
HRESULT
d3dlight_create
(
IDirect3DLightImpl
**
obj
,
IDirectDrawImpl
*
d3d
,
GLenum
light_num
);
extern
HRESULT
d3dlight_create
(
IDirect3DLightImpl
**
obj
,
IDirectDrawImpl
*
d3d
);
extern
HRESULT
d3dexecutebuffer_create
(
IDirect3DExecuteBufferImpl
**
obj
,
IDirectDrawImpl
*
d3d
,
IDirect3DDeviceImpl
*
d3ddev
,
LPD3DEXECUTEBUFFERDESC
lpDesc
);
extern
HRESULT
d3dmaterial_create
(
IDirect3DMaterialImpl
**
obj
,
IDirectDrawImpl
*
d3d
);
extern
HRESULT
d3dviewport_create
(
IDirect3DViewportImpl
**
obj
,
IDirectDrawImpl
*
d3d
);
...
...
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