ReactOS  0.4.13-dev-464-g6b95727
d3drm_private.h
Go to the documentation of this file.
1 /*
2  * Direct3DRM private interfaces (D3DRM.DLL)
3  *
4  * Copyright 2010 Christian Costa
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #ifndef __D3DRM_PRIVATE_INCLUDED__
22 #define __D3DRM_PRIVATE_INCLUDED__
23 
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
26 #define COBJMACROS
27 #include <assert.h>
28 #include <math.h>
29 #include "dxfile.h"
30 #include "d3drmwin.h"
31 #include "rmxfguid.h"
32 #include "wine/debug.h"
33 #include "wine/heap.h"
34 #include "wine/list.h"
35 
37 {
41  const char *classname;
42  char *name;
43 };
44 
46 {
47  struct d3drm_object obj;
48  IDirect3DRMTexture IDirect3DRMTexture_iface;
49  IDirect3DRMTexture2 IDirect3DRMTexture2_iface;
50  IDirect3DRMTexture3 IDirect3DRMTexture3_iface;
51  IDirect3DRM *d3drm;
53  IDirectDrawSurface *surface;
54 };
55 
57 {
58  struct d3drm_object obj;
59  IDirect3DRMFrame IDirect3DRMFrame_iface;
60  IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
61  IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
62  IDirect3DRM *d3drm;
67  IDirect3DRMFrame3 **children;
70  IDirect3DRMVisual **visuals;
73  IDirect3DRMLight **lights;
77 };
78 
80 {
81  struct d3drm_object obj;
83  IDirect3DRMFrame *camera;
84  IDirect3DRMViewport IDirect3DRMViewport_iface;
85  IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
86  IDirect3DViewport *d3d_viewport;
87  IDirect3DMaterial *material;
88  IDirect3DRM *d3drm;
93 };
94 
96 {
97  struct d3drm_object obj;
98  IDirect3DRMDevice IDirect3DRMDevice_iface;
99  IDirect3DRMDevice2 IDirect3DRMDevice2_iface;
100  IDirect3DRMDevice3 IDirect3DRMDevice3_iface;
101  IDirect3DRMWinDevice IDirect3DRMWinDevice_iface;
102  IDirect3DRM *d3drm;
103  IDirectDraw *ddraw;
104  IDirectDrawSurface *primary_surface, *render_target;
105  IDirectDrawClipper *clipper;
106  IDirect3DDevice *device;
112 };
113 
115 {
117  IDirect3DRMFace IDirect3DRMFace_iface;
118  IDirect3DRMFace2 IDirect3DRMFace2_iface;
121 };
122 
124 {
126  IDirect3DRMMeshBuilder2 IDirect3DRMMeshBuilder2_iface;
127  IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface;
129  IDirect3DRM *d3drm;
138  void *pFaceData;
142  IDirect3DRMMaterial2 *material;
143  IDirect3DRMTexture3 *texture;
147 };
148 
150 {
151  unsigned nb_vertices;
153  unsigned nb_faces;
154  unsigned vertex_per_face;
156  unsigned* face_data;
158  IDirect3DRMMaterial2* material;
159  IDirect3DRMTexture3* texture;
160 };
161 
163 {
165  IDirect3DRMMesh IDirect3DRMMesh_iface;
167  IDirect3DRM *d3drm;
171 };
172 
174 {
176  IDirect3DRMLight IDirect3DRMLight_iface;
178  IDirect3DRM *d3drm;
187 };
188 
189 struct color_rgb
190 {
194 };
195 
197 {
199  IDirect3DRMMaterial2 IDirect3DRMMaterial2_iface;
201  IDirect3DRM *d3drm;
206 };
207 
209 {
211  union
212  {
216  } u;
217 };
218 
220 {
224 };
225 
227 {
229  IDirect3DRMAnimation2 IDirect3DRMAnimation2_iface;
230  IDirect3DRMAnimation IDirect3DRMAnimation_iface;
232  IDirect3DRM *d3drm;
233  IDirect3DRMFrame3 *frame;
238 };
239 
241 {
243  IDirect3DRMWrap IDirect3DRMWrap_iface;
245 };
246 
249  IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface) DECLSPEC_HIDDEN;
252  IDirectDrawSurface *surface, BOOL create_z_surface) DECLSPEC_HIDDEN;
253 
254 void d3drm_object_init(struct d3drm_object *object, const char *classname) DECLSPEC_HIDDEN;
259 HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name) DECLSPEC_HIDDEN;
260 void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) DECLSPEC_HIDDEN;
261 
262 struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) DECLSPEC_HIDDEN;
263 struct d3drm_device *unsafe_impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface) DECLSPEC_HIDDEN;
264 
266 HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
268 HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
271 HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
272 HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
273 HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
275 
276 HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data,
277  D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg) DECLSPEC_HIDDEN;
278 
280 {
284 };
285 
286 extern char templates[] DECLSPEC_HIDDEN;
287 
288 static inline BYTE d3drm_color_component(float c)
289 {
290  if (c <= 0.0f)
291  return 0u;
292  if (c >= 1.0f)
293  return 0xffu;
294  return floor(c * 255.0f);
295 }
296 
297 static inline void d3drm_set_color(D3DCOLOR *color, float r, float g, float b, float a)
298 {
301 }
302 
303 BOOL d3drm_array_reserve(void **elements, SIZE_T *capacity, SIZE_T element_count, SIZE_T element_size) DECLSPEC_HIDDEN;
304 
305 #endif /* __D3DRM_PRIVATE_INCLUDED__ */
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
IDirect3DViewport * d3d_viewport
Definition: d3drm_private.h:86
struct d3drm_frame * unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) DECLSPEC_HIDDEN
Definition: frame.c:2926
IDirect3DRMVisual ** visuals
Definition: d3drm_private.h:70
GLint GLint GLsizei width
Definition: gl.h:1546
struct color_rgb specular
struct d3drm_device * device
Definition: d3drm_private.h:82
IDirect3DRM * d3drm
IDirect3DRMFrame3 IDirect3DRMFrame3_iface
Definition: d3drm_private.h:61
D3DVALUE lattenuation
IDirect3DRMMesh IDirect3DRMMesh_iface
IDirect3DRMLight IDirect3DRMLight_iface
struct d3drm_animation_key * keys
HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: light.c:374
const char * classname
Definition: d3drm_private.h:41
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
IDirect3DRMFace IDirect3DRMFace_iface
IDirect3DRMAnimation2 IDirect3DRMAnimation2_iface
IDirect3DRMMeshBuilder2 IDirect3DRMMeshBuilder2_iface
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name) DECLSPEC_HIDDEN
Definition: d3drm_main.c:114
IDirect3DRM * d3drm
struct coords_2d * pCoords2d
struct d3drm_device * unsafe_impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface) DECLSPEC_HIDDEN
Definition: device.c:1628
IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface
IDirect3DRMTexture3 IDirect3DRMTexture3_iface
Definition: d3drm_private.h:50
DWORD D3DRMANIMATIONOPTIONS
Definition: d3drmdef.h:322
struct d3drm_animation_keys rotate
HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: frame.c:3687
#define RGBA_MAKE
Definition: dx7todx8.h:6
D3DRMIMAGE * image
Definition: d3drm_private.h:52
IDirect3DRMFrame3 ** children
Definition: d3drm_private.h:67
SIZE_T visuals_size
Definition: d3drm_private.h:69
IDirect3DRMFrame2 IDirect3DRMFrame2_iface
Definition: d3drm_private.h:60
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN
Definition: d3drm_main.c:75
WCHAR classname[128]
Definition: startup.c:15
HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: material.c:282
DWORD face_data_size
struct mesh_material * materials
HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: device.c:1637
HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: meshbuilder.c:2337
HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN
Definition: d3drm_main.c:58
IDirect3DRMMaterial2 * material
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum light
Definition: glfuncs.h:170
D3DVALUE field
Definition: d3drm_private.h:91
SIZE_T children_size
Definition: d3drm_private.h:66
IDirect3DRMDevice2 IDirect3DRMDevice2_iface
Definition: d3drm_private.h:99
IDirect3DRMFrame IDirect3DRMFrame_iface
Definition: d3drm_private.h:59
HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name) DECLSPEC_HIDDEN
Definition: d3drm_main.c:95
D3DCOLOR color
HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data, D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg) DECLSPEC_HIDDEN
Definition: meshbuilder.c:1022
HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw, IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface) DECLSPEC_HIDDEN
Definition: device.c:72
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
GLuint color
Definition: glext.h:6243
Definition: devices.h:37
void d3drm_device_destroy(struct d3drm_device *device) DECLSPEC_HIDDEN
Definition: device.c:43
SIZE_T groups_size
IDirect3DRMDevice IDirect3DRMDevice_iface
Definition: d3drm_private.h:98
D3DRMANIMATIONOPTIONS options
D3DVALUE front
Definition: d3drm_private.h:90
float D3DVALUE
Definition: d3dtypes.h:89
IDirect3DRMTexture IDirect3DRMTexture_iface
Definition: d3drm_private.h:48
static const WCHAR version[]
Definition: asmname.c:64
D3DVALUE r
IDirect3DRM * d3drm
struct d3drm_animation_keys position
union d3drm_animation_key::@238 u
D3DRMRENDERQUALITY quality
HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw *ddraw, IDirectDrawSurface *surface, BOOL create_z_surface) DECLSPEC_HIDDEN
Definition: device.c:123
D3DVALUE cattenuation
struct color_rgb ambient
IDirect3DRMAnimation IDirect3DRMAnimation_iface
GLboolean GLboolean g
Definition: glext.h:6204
GLfloat f
Definition: glext.h:7540
IDirect3DRMMaterial2 * material
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
D3DVALUE g
GLsizeiptr size
Definition: glext.h:5919
D3DCOLOR color
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:77
struct mesh_group * groups
IDirect3DRMWrap IDirect3DRMWrap_iface
HRESULT d3drm_face_create(struct d3drm_face **face) DECLSPEC_HIDDEN
Definition: face.c:623
D3DVECTOR * vertices
IDirectDrawClipper * clipper
HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: texture.c:1415
const GLubyte * c
Definition: glext.h:8905
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: meshbuilder.c:2836
IDirect3DRMViewport IDirect3DRMViewport_iface
Definition: d3drm_private.h:84
static DWORD cb
Definition: integrity.c:41
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
D3DRMMATRIX4D transform
Definition: d3drm_private.h:74
IDirect3DRMMaterial2 IDirect3DRMMaterial2_iface
void(__cdecl * D3DRMOBJECTCALLBACK)(struct IDirect3DRMObject *obj, void *arg)
Definition: d3drmobj.h:157
unsigned vertex_per_face
IDirectDrawSurface * surface
Definition: d3drm_private.h:53
D3DVALUE qattenuation
IDirect3DRM * d3drm
D3DVALUE D3DRMMATRIX4D[4][4]
Definition: d3drmdef.h:39
SIZE_T nb_children
Definition: d3drm_private.h:65
struct color_rgb emissive
DWORD traversal_options
Definition: d3drm_private.h:76
D3DCOLOR scenebackground
Definition: d3drm_private.h:75
unsigned char BYTE
Definition: mem.h:68
Definition: _list.h:228
DWORD D3DRMRENDERQUALITY
Definition: d3drmdef.h:89
D3DVECTOR * normals
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
IDirect3DRMMeshBuilder * mesh_builder
Definition: d3drm.c:2770
Definition: d3drm.c:191
D3DVALUE range
ULONG_PTR SIZE_T
Definition: typedefs.h:78
BOOL d3drm_array_reserve(void **elements, SIZE_T *capacity, SIZE_T element_count, SIZE_T element_size) DECLSPEC_HIDDEN
Definition: meshbuilder.c:263
unsigned * face_data
SIZE_T lights_size
Definition: d3drm_private.h:72
IDirect3DRMLight ** lights
Definition: d3drm_private.h:73
IDirect3DRM * d3drm
SIZE_T nb_groups
D3DRMLIGHTTYPE type
D3DVALUE b
IDirect3DRMFrame * camera
Definition: d3drm_private.h:83
void d3drm_object_init(struct d3drm_object *object, const char *classname) DECLSPEC_HIDDEN
Definition: d3drm_main.c:42
IDirect3DRM * d3drm
Definition: d3drm_private.h:88
static void d3drm_set_color(D3DCOLOR *color, float r, float g, float b, float a)
IDirect3DDevice * device
enum _D3DRMPROJECTIONTYPE D3DRMPROJECTIONTYPE
char templates [] DECLSPEC_HIDDEN
HRESULT d3drm_wrap_create(struct d3drm_wrap **wrap, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: meshbuilder.c:3022
IDirect3DRMTexture3 * texture
unsigned int UINT
Definition: ndis.h:50
IDirect3DRM * d3drm
Definition: d3drm_private.h:51
D3DRMVERTEX * vertices
SIZE_T nb_lights
Definition: d3drm_private.h:71
D3DVALUE penumbra
IDirect3DMaterial * material
Definition: d3drm_private.h:87
IDirect3DRMFace2 IDirect3DRMFace2_iface
IDirectDrawSurface * render_target
SIZE_T nb_visuals
Definition: d3drm_private.h:68
IDirect3DRMFrame3 * frame
Definition: name.c:36
IDirect3DRM * d3drm
Definition: d3drm_private.h:62
IDirect3DRMDevice3 IDirect3DRMDevice3_iface
unsigned nb_vertices
struct d3drm_frame * parent
Definition: d3drm_private.h:64
#define wrap(journal, var)
Definition: recovery.c:207
HRESULT(__cdecl * D3DRMLOADTEXTURECALLBACK)(char *tex_name, void *arg, struct IDirect3DRMTexture **texture)
Definition: d3drmobj.h:165
struct list destroy_callbacks
Definition: d3drm_private.h:40
IDirect3DRMTexture3 * texture
IDirect3DRM * d3drm
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
char templates[]
Definition: meshbuilder.c:42
D3DRMQUATERNION rotate
HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: viewport.c:1018
HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm) DECLSPEC_HIDDEN
Definition: frame.c:2935
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
IDirectDraw * ddraw
IDirect3DRMTexture2 IDirect3DRMTexture2_iface
Definition: d3drm_private.h:49
static BYTE d3drm_color_component(float c)
IDirect3DRMWinDevice IDirect3DRMWinDevice_iface
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) DECLSPEC_HIDDEN
Definition: d3drm_main.c:156
IDirect3DRMViewport2 IDirect3DRMViewport2_iface
Definition: d3drm_private.h:85
IDirectDrawSurface * primary_surface
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
enum _D3DRMLIGHTTYPE D3DRMLIGHTTYPE
HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name) DECLSPEC_HIDDEN
Definition: d3drm_main.c:138
D3DCOLOR color
D3DRMPROJECTIONTYPE projection
Definition: d3drm_private.h:92
D3DVALUE umbra
unsigned nb_faces