mf/session: Implement support for sinks that provide sample allocators.
[wine.git] / dlls / d3drm / d3drm_private.h
blobb5d60e518f8f032a66fab9f4a9010d5526908a6a
1 /*
2 * Direct3DRM private interfaces (D3DRM.DLL)
4 * Copyright 2010 Christian Costa
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.
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.
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
21 #ifndef __D3DRM_PRIVATE_INCLUDED__
22 #define __D3DRM_PRIVATE_INCLUDED__
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"
36 struct d3drm_matrix
38 float _11, _12, _13, _14;
39 float _21, _22, _23, _24;
40 float _31, _32, _33, _34;
41 float _41, _42, _43, _44;
44 static inline struct d3drm_matrix *d3drm_matrix(D3DRMMATRIX4D m)
46 return (struct d3drm_matrix *)m;
49 struct d3drm_object
51 LONG ref;
52 DWORD appdata;
53 struct list destroy_callbacks;
54 const char *classname;
55 char *name;
58 struct d3drm_texture
60 struct d3drm_object obj;
61 IDirect3DRMTexture IDirect3DRMTexture_iface;
62 IDirect3DRMTexture2 IDirect3DRMTexture2_iface;
63 IDirect3DRMTexture3 IDirect3DRMTexture3_iface;
64 IDirect3DRM *d3drm;
65 D3DRMIMAGE *image;
66 IDirectDrawSurface *surface;
69 struct d3drm_frame
71 struct d3drm_object obj;
72 IDirect3DRMFrame IDirect3DRMFrame_iface;
73 IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
74 IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
75 IDirect3DRM *d3drm;
76 LONG ref;
77 struct d3drm_frame *parent;
78 SIZE_T nb_children;
79 SIZE_T children_size;
80 IDirect3DRMFrame3 **children;
81 SIZE_T nb_visuals;
82 SIZE_T visuals_size;
83 IDirect3DRMVisual **visuals;
84 SIZE_T nb_lights;
85 SIZE_T lights_size;
86 IDirect3DRMLight **lights;
87 struct d3drm_matrix transform;
88 D3DCOLOR scenebackground;
89 DWORD traversal_options;
92 struct d3drm_box
94 float left;
95 float top;
96 float right;
97 float bottom;
98 float front;
99 float back;
102 struct d3drm_viewport
104 struct d3drm_object obj;
105 struct d3drm_device *device;
106 IDirect3DRMFrame *camera;
107 IDirect3DRMViewport IDirect3DRMViewport_iface;
108 IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
109 IDirect3DViewport *d3d_viewport;
110 IDirect3DMaterial *material;
111 IDirect3DRM *d3drm;
112 struct d3drm_box clip;
113 D3DRMPROJECTIONTYPE projection;
116 struct d3drm_device
118 struct d3drm_object obj;
119 IDirect3DRMDevice IDirect3DRMDevice_iface;
120 IDirect3DRMDevice2 IDirect3DRMDevice2_iface;
121 IDirect3DRMDevice3 IDirect3DRMDevice3_iface;
122 IDirect3DRMWinDevice IDirect3DRMWinDevice_iface;
123 IDirect3DRM *d3drm;
124 IDirectDraw *ddraw;
125 IDirectDrawSurface *primary_surface, *render_target;
126 IDirectDrawClipper *clipper;
127 IDirect3DDevice *device;
128 BOOL dither;
129 D3DRMRENDERQUALITY quality;
130 DWORD rendermode;
131 DWORD height;
132 DWORD width;
135 struct d3drm_face
137 struct d3drm_object obj;
138 IDirect3DRMFace IDirect3DRMFace_iface;
139 IDirect3DRMFace2 IDirect3DRMFace2_iface;
140 LONG ref;
141 D3DCOLOR color;
144 struct d3drm_mesh_builder
146 struct d3drm_object obj;
147 IDirect3DRMMeshBuilder2 IDirect3DRMMeshBuilder2_iface;
148 IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface;
149 LONG ref;
150 IDirect3DRM *d3drm;
151 SIZE_T nb_vertices;
152 SIZE_T vertices_size;
153 D3DVECTOR *vertices;
154 SIZE_T nb_normals;
155 SIZE_T normals_size;
156 D3DVECTOR *normals;
157 DWORD nb_faces;
158 DWORD face_data_size;
159 void *pFaceData;
160 DWORD nb_coords2d;
161 struct coords_2d *pCoords2d;
162 D3DCOLOR color;
163 IDirect3DRMMaterial2 *material;
164 IDirect3DRMTexture3 *texture;
165 DWORD nb_materials;
166 struct mesh_material *materials;
167 DWORD *material_indices;
170 struct mesh_group
172 unsigned nb_vertices;
173 D3DRMVERTEX* vertices;
174 unsigned nb_faces;
175 unsigned vertex_per_face;
176 DWORD face_data_size;
177 unsigned* face_data;
178 D3DCOLOR color;
179 IDirect3DRMMaterial2* material;
180 IDirect3DRMTexture3* texture;
183 struct d3drm_mesh
185 struct d3drm_object obj;
186 IDirect3DRMMesh IDirect3DRMMesh_iface;
187 LONG ref;
188 IDirect3DRM *d3drm;
189 SIZE_T nb_groups;
190 SIZE_T groups_size;
191 struct mesh_group *groups;
194 struct d3drm_light
196 struct d3drm_object obj;
197 IDirect3DRMLight IDirect3DRMLight_iface;
198 LONG ref;
199 IDirect3DRM *d3drm;
200 D3DRMLIGHTTYPE type;
201 D3DCOLOR color;
202 D3DVALUE range;
203 D3DVALUE cattenuation;
204 D3DVALUE lattenuation;
205 D3DVALUE qattenuation;
206 D3DVALUE umbra;
207 D3DVALUE penumbra;
210 struct color_rgb
212 D3DVALUE r;
213 D3DVALUE g;
214 D3DVALUE b;
217 struct d3drm_material
219 struct d3drm_object obj;
220 IDirect3DRMMaterial2 IDirect3DRMMaterial2_iface;
221 LONG ref;
222 IDirect3DRM *d3drm;
223 struct color_rgb emissive;
224 struct color_rgb specular;
225 D3DVALUE power;
226 struct color_rgb ambient;
229 struct d3drm_animation_key
231 D3DVALUE time;
232 union
234 D3DVECTOR position;
235 D3DVECTOR scale;
236 D3DRMQUATERNION rotate;
237 } u;
240 struct d3drm_animation_keys
242 struct d3drm_animation_key *keys;
243 SIZE_T count;
244 SIZE_T size;
247 struct d3drm_animation
249 struct d3drm_object obj;
250 IDirect3DRMAnimation2 IDirect3DRMAnimation2_iface;
251 IDirect3DRMAnimation IDirect3DRMAnimation_iface;
252 LONG ref;
253 IDirect3DRM *d3drm;
254 IDirect3DRMFrame3 *frame;
255 D3DRMANIMATIONOPTIONS options;
256 struct d3drm_animation_keys position;
257 struct d3drm_animation_keys scale;
258 struct d3drm_animation_keys rotate;
261 struct d3drm_wrap
263 struct d3drm_object obj;
264 IDirect3DRMWrap IDirect3DRMWrap_iface;
265 LONG ref;
268 HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
269 HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw,
270 IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface) DECLSPEC_HIDDEN;
271 void d3drm_device_destroy(struct d3drm_device *device) DECLSPEC_HIDDEN;
272 HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw *ddraw,
273 IDirectDrawSurface *surface, BOOL create_z_surface) DECLSPEC_HIDDEN;
275 void d3drm_object_init(struct d3drm_object *object, const char *classname) DECLSPEC_HIDDEN;
276 HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
277 HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
278 HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name) DECLSPEC_HIDDEN;
279 HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name) DECLSPEC_HIDDEN;
280 HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name) DECLSPEC_HIDDEN;
281 void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) DECLSPEC_HIDDEN;
283 struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) DECLSPEC_HIDDEN;
284 struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface) DECLSPEC_HIDDEN;
286 struct d3drm_device *unsafe_impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface) DECLSPEC_HIDDEN;
288 HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
289 HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
290 HRESULT d3drm_face_create(struct d3drm_face **face) DECLSPEC_HIDDEN;
291 HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
292 HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
293 HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
294 HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
295 HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
296 HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
297 HRESULT d3drm_wrap_create(struct d3drm_wrap **wrap, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
299 HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data,
300 D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg) DECLSPEC_HIDDEN;
302 struct d3drm_file_header
304 WORD major;
305 WORD minor;
306 DWORD flags;
309 extern char templates[] DECLSPEC_HIDDEN;
311 static inline BYTE d3drm_color_component(float c)
313 if (c <= 0.0f)
314 return 0u;
315 if (c >= 1.0f)
316 return 0xffu;
317 return floor(c * 255.0f);
320 static inline void d3drm_set_color(D3DCOLOR *color, float r, float g, float b, float a)
322 *color = RGBA_MAKE(d3drm_color_component(r), d3drm_color_component(g),
323 d3drm_color_component(b), d3drm_color_component(a));
326 BOOL d3drm_array_reserve(void **elements, SIZE_T *capacity, SIZE_T element_count, SIZE_T element_size) DECLSPEC_HIDDEN;
328 #endif /* __D3DRM_PRIVATE_INCLUDED__ */