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
eb6e8307
Commit
eb6e8307
authored
Jan 02, 2003
by
Lionel Ulmer
Committed by
Alexandre Julliard
Jan 02, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement GetTransform and rework a bit the matrices storage.
parent
7a025001
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
52 deletions
+81
-52
d3d_private.h
dlls/ddraw/d3d_private.h
+5
-0
main.c
dlls/ddraw/d3ddevice/main.c
+26
-1
mesa.c
dlls/ddraw/d3ddevice/mesa.c
+33
-29
d3dexecutebuffer.c
dlls/ddraw/d3dexecutebuffer.c
+17
-17
mesa_private.h
dlls/ddraw/mesa_private.h
+0
-5
No files found.
dlls/ddraw/d3d_private.h
View file @
eb6e8307
...
...
@@ -181,6 +181,11 @@ struct IDirect3DDeviceImpl
IDirectDrawSurfaceImpl
*
current_texture
[
MAX_TEXTURES
];
/* Current transformation matrices */
D3DMATRIX
*
world_mat
;
D3DMATRIX
*
view_mat
;
D3DMATRIX
*
proj_mat
;
void
(
*
set_context
)(
IDirect3DDeviceImpl
*
);
HRESULT
(
*
clear
)(
IDirect3DDeviceImpl
*
This
,
DWORD
dwCount
,
...
...
dlls/ddraw/d3ddevice/main.c
View file @
eb6e8307
...
...
@@ -211,7 +211,32 @@ Main_IDirect3DDeviceImpl_7_3T_2T_GetTransform(LPDIRECT3DDEVICE7 iface,
LPD3DMATRIX
lpD3DMatrix
)
{
ICOM_THIS_FROM
(
IDirect3DDeviceImpl
,
IDirect3DDevice7
,
iface
);
FIXME
(
"(%p/%p)->(%08x,%p): stub!
\n
"
,
This
,
iface
,
dtstTransformStateType
,
lpD3DMatrix
);
TRACE
(
"(%p/%p)->(%08x,%p)
\n
"
,
This
,
iface
,
dtstTransformStateType
,
lpD3DMatrix
);
switch
(
dtstTransformStateType
)
{
case
D3DTRANSFORMSTATE_WORLD
:
{
TRACE
(
" returning D3DTRANSFORMSTATE_WORLD :
\n
"
);
memcpy
(
lpD3DMatrix
,
This
->
world_mat
,
16
*
sizeof
(
D3DVALUE
));
dump_mat
(
lpD3DMatrix
);
}
break
;
case
D3DTRANSFORMSTATE_VIEW
:
{
TRACE
(
" returning D3DTRANSFORMSTATE_VIEW :
\n
"
);
memcpy
(
lpD3DMatrix
,
This
->
world_mat
,
16
*
sizeof
(
D3DVALUE
));
dump_mat
(
lpD3DMatrix
);
}
break
;
case
D3DTRANSFORMSTATE_PROJECTION
:
{
TRACE
(
" returning D3DTRANSFORMSTATE_PROJECTION :
\n
"
);
memcpy
(
lpD3DMatrix
,
This
->
world_mat
,
16
*
sizeof
(
D3DVALUE
));
dump_mat
(
lpD3DMatrix
);
}
break
;
default:
ERR
(
"Unknown transform type %08x !!!
\n
"
,
dtstTransformStateType
);
return
DDERR_INVALIDPARAMS
;
}
return
DD_OK
;
}
...
...
dlls/ddraw/d3ddevice/mesa.c
View file @
eb6e8307
...
...
@@ -306,6 +306,10 @@ GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
/* And warn the D3D object that this device is no longer active... */
This
->
d3d
->
removed_device
(
This
->
d3d
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
world_mat
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
view_mat
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
proj_mat
);
ENTER_GL
();
glXDestroyContext
(
glThis
->
display
,
glThis
->
gl_context
);
LEAVE_GL
();
...
...
@@ -624,25 +628,31 @@ GL_IDirect3DDeviceImpl_7_3T_2T_SetTransform(LPDIRECT3DDEVICE7 iface,
switch
(
dtstTransformStateType
)
{
case
D3DTRANSFORMSTATE_WORLD
:
{
TRACE
(
" D3DTRANSFORMSTATE_WORLD :
\n
"
);
conv_mat
(
lpD3DMatrix
,
glThis
->
world_mat
);
conv_mat
(
lpD3DMatrix
,
This
->
world_mat
);
if
(
glThis
->
last_vertices_transformed
==
FALSE
)
{
glMatrixMode
(
GL_MODELVIEW
);
glLoadMatrixf
((
float
*
)
glThis
->
view_mat
);
glMultMatrixf
((
float
*
)
glThis
->
world_mat
);
glLoadMatrixf
((
float
*
)
This
->
view_mat
);
glMultMatrixf
((
float
*
)
This
->
world_mat
);
}
}
break
;
case
D3DTRANSFORMSTATE_VIEW
:
{
TRACE
(
" D3DTRANSFORMSTATE_VIEW :
\n
"
);
conv_mat
(
lpD3DMatrix
,
glThis
->
view_mat
);
conv_mat
(
lpD3DMatrix
,
This
->
view_mat
);
if
(
glThis
->
last_vertices_transformed
==
FALSE
)
{
glMatrixMode
(
GL_MODELVIEW
);
glLoadMatrixf
((
float
*
)
glThis
->
view_mat
);
glMultMatrixf
((
float
*
)
glThis
->
world_mat
);
glLoadMatrixf
((
float
*
)
This
->
view_mat
);
glMultMatrixf
((
float
*
)
This
->
world_mat
);
}
}
break
;
case
D3DTRANSFORMSTATE_PROJECTION
:
{
TRACE
(
" D3DTRANSFORMSTATE_PROJECTION :
\n
"
);
conv_mat
(
lpD3DMatrix
,
glThis
->
proj_mat
);
conv_mat
(
lpD3DMatrix
,
This
->
proj_mat
);
if
(
glThis
->
last_vertices_transformed
==
FALSE
)
{
glMatrixMode
(
GL_PROJECTION
);
glLoadMatrixf
((
float
*
)
glThis
->
proj_mat
);
glLoadMatrixf
((
float
*
)
This
->
proj_mat
);
}
}
break
;
default
:
...
...
@@ -651,9 +661,6 @@ GL_IDirect3DDeviceImpl_7_3T_2T_SetTransform(LPDIRECT3DDEVICE7 iface,
}
LEAVE_GL
();
/* And set the 'matrix changed' flag */
glThis
->
matrices_changed
=
TRUE
;
return
DD_OK
;
}
...
...
@@ -696,26 +703,26 @@ static void draw_primitive_start_GL(D3DPRIMITIVETYPE d3dpt)
}
}
static
void
draw_primitive_handle_GL_state
(
IDirect3DDevice
GLImpl
*
gl
This
,
static
void
draw_primitive_handle_GL_state
(
IDirect3DDevice
Impl
*
This
,
BOOLEAN
vertex_transformed
,
BOOLEAN
vertex_lit
)
{
IDirect3DDeviceGLImpl
*
glThis
=
(
IDirect3DDeviceGLImpl
*
)
This
;
/* Puts GL in the correct lighting / transformation mode */
if
((
vertex_transformed
==
FALSE
)
&&
((
glThis
->
last_vertices_transformed
==
TRUE
)
||
(
glThis
->
matrices_changed
==
TRUE
)))
{
(
glThis
->
last_vertices_transformed
==
TRUE
))
{
/* Need to put the correct transformation again if we go from Transformed
vertices to non-transformed ones.
*/
glMatrixMode
(
GL_MODELVIEW
);
glLoadMatrixf
((
float
*
)
gl
This
->
view_mat
);
glMultMatrixf
((
float
*
)
gl
This
->
world_mat
);
glLoadMatrixf
((
float
*
)
This
->
view_mat
);
glMultMatrixf
((
float
*
)
This
->
world_mat
);
glMatrixMode
(
GL_PROJECTION
);
glLoadMatrixf
((
float
*
)
gl
This
->
proj_mat
);
glLoadMatrixf
((
float
*
)
This
->
proj_mat
);
if
(
glThis
->
render_state
.
fog_on
==
TRUE
)
glEnable
(
GL_FOG
);
}
else
if
((
vertex_transformed
==
TRUE
)
&&
((
glThis
->
last_vertices_transformed
==
FALSE
)
||
(
glThis
->
matrices_changed
==
TRUE
)))
{
(
glThis
->
last_vertices_transformed
==
FALSE
))
{
GLfloat
height
,
width
;
GLfloat
trans_mat
[
16
];
...
...
@@ -739,7 +746,6 @@ static void draw_primitive_handle_GL_state(IDirect3DDeviceGLImpl *glThis,
/* Remove also fogging... */
glDisable
(
GL_FOG
);
}
glThis
->
matrices_changed
=
FALSE
;
if
((
glThis
->
last_vertices_lit
==
TRUE
)
&&
(
vertex_lit
==
FALSE
))
{
glEnable
(
GL_LIGHTING
);
...
...
@@ -976,7 +982,7 @@ static void draw_primitive_strided_7(IDirect3DDeviceImpl *This,
}
ENTER_GL
();
draw_primitive_handle_GL_state
(
gl
This
,
draw_primitive_handle_GL_state
(
This
,
(
d3dvtVertexType
&
D3DFVF_POSITION_MASK
)
!=
D3DFVF_XYZ
,
(
d3dvtVertexType
&
D3DFVF_NORMAL
)
==
0
);
draw_primitive_start_GL
(
d3dptPrimitiveType
);
...
...
@@ -1958,14 +1964,12 @@ d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfa
gl_object
->
render_state
.
fog_on
=
FALSE
;
/* Allocate memory for the matrices */
gl_object
->
world_mat
=
(
D3DMATRIX
*
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
16
*
sizeof
(
float
));
gl_object
->
view_mat
=
(
D3DMATRIX
*
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
16
*
sizeof
(
float
));
gl_object
->
proj_mat
=
(
D3DMATRIX
*
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
16
*
sizeof
(
float
));
gl_object
->
matrices_changed
=
TRUE
;
memcpy
(
gl_object
->
world_mat
,
id_mat
,
16
*
sizeof
(
float
));
memcpy
(
gl_object
->
view_mat
,
id_mat
,
16
*
sizeof
(
float
));
memcpy
(
gl_object
->
proj_mat
,
id_mat
,
16
*
sizeof
(
float
));
object
->
world_mat
=
(
D3DMATRIX
*
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
16
*
sizeof
(
float
));
object
->
view_mat
=
(
D3DMATRIX
*
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
16
*
sizeof
(
float
));
object
->
proj_mat
=
(
D3DMATRIX
*
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
16
*
sizeof
(
float
));
memcpy
(
object
->
world_mat
,
id_mat
,
16
*
sizeof
(
float
));
memcpy
(
object
->
view_mat
,
id_mat
,
16
*
sizeof
(
float
));
memcpy
(
object
->
proj_mat
,
id_mat
,
16
*
sizeof
(
float
));
/* Initialisation */
TRACE
(
" setting current context
\n
"
);
...
...
dlls/ddraw/d3dexecutebuffer.c
View file @
eb6e8307
...
...
@@ -243,16 +243,16 @@ static void execute(IDirect3DExecuteBufferImpl *This,
glLoadIdentity
();
/* The model transformation was done during the
transformation phase */
glMatrixMode
(
GL_PROJECTION
);
TRACE
(
" Projection Matrix : (%p)
\n
"
,
lpDevice
GL
->
proj_mat
);
dump_mat
(
lpDevice
GL
->
proj_mat
);
TRACE
(
" View Matrix : (%p)
\n
"
,
lpDevice
GL
->
view_mat
);
dump_mat
(
lpDevice
GL
->
view_mat
);
TRACE
(
" Projection Matrix : (%p)
\n
"
,
lpDevice
->
proj_mat
);
dump_mat
(
lpDevice
->
proj_mat
);
TRACE
(
" View Matrix : (%p)
\n
"
,
lpDevice
->
view_mat
);
dump_mat
(
lpDevice
->
view_mat
);
/* Although z axis is inverted between OpenGL and Direct3D, the z projected coordinates
are always 0.0 at the front viewing volume and 1.0 at the back with Direct 3D and with
the default behaviour of OpenGL. So, no additional transformation is required. */
glLoadMatrixf
((
float
*
)
lpDevice
GL
->
proj_mat
);
glMultMatrixf
((
float
*
)
lpDevice
GL
->
view_mat
);
glLoadMatrixf
((
float
*
)
lpDevice
->
proj_mat
);
glMultMatrixf
((
float
*
)
lpDevice
->
view_mat
);
break
;
case
D3DVT_LVERTEX
:
...
...
@@ -265,16 +265,16 @@ static void execute(IDirect3DExecuteBufferImpl *This,
transformation phase */
glMatrixMode
(
GL_PROJECTION
);
TRACE
(
" Projection Matrix : (%p)
\n
"
,
lpDevice
GL
->
proj_mat
);
dump_mat
(
lpDevice
GL
->
proj_mat
);
TRACE
(
" View Matrix : (%p)
\n
"
,
lpDevice
GL
->
view_mat
);
dump_mat
(
lpDevice
GL
->
view_mat
);
TRACE
(
" Projection Matrix : (%p)
\n
"
,
lpDevice
->
proj_mat
);
dump_mat
(
lpDevice
->
proj_mat
);
TRACE
(
" View Matrix : (%p)
\n
"
,
lpDevice
->
view_mat
);
dump_mat
(
lpDevice
->
view_mat
);
/* Although z axis is inverted between OpenGL and Direct3D, the z projected coordinates
are always 0 at the front viewing volume and 1 at the back with Direct 3D and with
the default behaviour of OpenGL. So, no additional transformation is required. */
glLoadMatrixf
((
float
*
)
lpDevice
GL
->
proj_mat
);
glMultMatrixf
((
float
*
)
lpDevice
GL
->
view_mat
);
glLoadMatrixf
((
float
*
)
lpDevice
->
proj_mat
);
glMultMatrixf
((
float
*
)
lpDevice
->
view_mat
);
break
;
case
D3DVT_TLVERTEX
:
{
...
...
@@ -379,17 +379,17 @@ static void execute(IDirect3DExecuteBufferImpl *This,
switch
(
ci
->
u1
.
dtstTransformStateType
)
{
case
D3DTRANSFORMSTATE_WORLD
:
{
TRACE
(
" WORLD (%p)
\n
"
,
(
D3DMATRIX
*
)
ci
->
u2
.
dwArg
[
0
]);
lpDevice
GL
->
world_mat
=
(
D3DMATRIX
*
)
ci
->
u2
.
dwArg
[
0
];
lpDevice
->
world_mat
=
(
D3DMATRIX
*
)
ci
->
u2
.
dwArg
[
0
];
}
break
;
case
D3DTRANSFORMSTATE_VIEW
:
{
TRACE
(
" VIEW (%p)
\n
"
,
(
D3DMATRIX
*
)
ci
->
u2
.
dwArg
[
0
]);
lpDevice
GL
->
view_mat
=
(
D3DMATRIX
*
)
ci
->
u2
.
dwArg
[
0
];
lpDevice
->
view_mat
=
(
D3DMATRIX
*
)
ci
->
u2
.
dwArg
[
0
];
}
break
;
case
D3DTRANSFORMSTATE_PROJECTION
:
{
TRACE
(
" PROJECTION (%p)
\n
"
,
(
D3DMATRIX
*
)
ci
->
u2
.
dwArg
[
0
]);
lpDevice
GL
->
proj_mat
=
(
D3DMATRIX
*
)
ci
->
u2
.
dwArg
[
0
];
lpDevice
->
proj_mat
=
(
D3DMATRIX
*
)
ci
->
u2
.
dwArg
[
0
];
}
break
;
default:
...
...
@@ -538,7 +538,7 @@ static void execute(IDirect3DExecuteBufferImpl *This,
int
nb
;
D3DVERTEX
*
src
=
((
LPD3DVERTEX
)
(
This
->
desc
.
lpData
+
vs
))
+
ci
->
wStart
;
OGL_Vertex
*
dst
=
((
OGL_Vertex
*
)
(
This
->
vertex_data
))
+
ci
->
wDest
;
D3DMATRIX
*
mat
=
lpDevice
GL
->
world_mat
;
D3DMATRIX
*
mat
=
lpDevice
->
world_mat
;
TRACE
(
" World Matrix : (%p)
\n
"
,
mat
);
dump_mat
(
mat
);
...
...
@@ -567,7 +567,7 @@ static void execute(IDirect3DExecuteBufferImpl *This,
int
nb
;
D3DLVERTEX
*
src
=
((
LPD3DLVERTEX
)
(
This
->
desc
.
lpData
+
vs
))
+
ci
->
wStart
;
OGL_LVertex
*
dst
=
((
OGL_LVertex
*
)
(
This
->
vertex_data
))
+
ci
->
wDest
;
D3DMATRIX
*
mat
=
lpDevice
GL
->
world_mat
;
D3DMATRIX
*
mat
=
lpDevice
->
world_mat
;
TRACE
(
" World Matrix : (%p)
\n
"
,
mat
);
dump_mat
(
mat
);
...
...
dlls/ddraw/mesa_private.h
View file @
eb6e8307
...
...
@@ -118,11 +118,6 @@ typedef struct IDirect3DDeviceGLImpl
BOOLEAN
last_vertices_transformed
;
BOOLEAN
last_vertices_lit
;
D3DMATRIX
*
world_mat
;
D3DMATRIX
*
view_mat
;
D3DMATRIX
*
proj_mat
;
BOOLEAN
matrices_changed
;
Display
*
display
;
Drawable
drawable
;
}
IDirect3DDeviceGLImpl
;
...
...
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