Release 2.9.
[wine.git] / dlls / d3drm / d3drm_private.h
blob033fcffe982a50f68e4743f53a44d8f4d969d44c
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/list.h"
35 #ifndef ARRAY_SIZE
36 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
37 #endif
39 struct d3drm_object
41 LONG ref;
42 DWORD appdata;
43 struct list destroy_callbacks;
46 struct d3drm_texture
48 struct d3drm_object obj;
49 IDirect3DRMTexture IDirect3DRMTexture_iface;
50 IDirect3DRMTexture2 IDirect3DRMTexture2_iface;
51 IDirect3DRMTexture3 IDirect3DRMTexture3_iface;
52 IDirect3DRM *d3drm;
53 D3DRMIMAGE *image;
56 struct d3drm_frame
58 IDirect3DRMFrame IDirect3DRMFrame_iface;
59 IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
60 IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
61 IDirect3DRM *d3drm;
62 LONG ref;
63 struct d3drm_frame *parent;
64 ULONG nb_children;
65 ULONG children_capacity;
66 IDirect3DRMFrame3 **children;
67 ULONG nb_visuals;
68 ULONG visuals_capacity;
69 IDirect3DRMVisual **visuals;
70 ULONG nb_lights;
71 ULONG lights_capacity;
72 IDirect3DRMLight **lights;
73 D3DRMMATRIX4D transform;
74 D3DCOLOR scenebackground;
77 struct d3drm_viewport
79 struct d3drm_object obj;
80 struct d3drm_device *device;
81 IDirect3DRMFrame *camera;
82 IDirect3DRMViewport IDirect3DRMViewport_iface;
83 IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
84 IDirect3DViewport *d3d_viewport;
85 IDirect3DMaterial *material;
86 IDirect3DRM *d3drm;
87 D3DVALUE back;
88 D3DVALUE front;
89 D3DVALUE field;
90 D3DRMPROJECTIONTYPE projection;
93 struct d3drm_device
95 struct d3drm_object obj;
96 IDirect3DRMDevice IDirect3DRMDevice_iface;
97 IDirect3DRMDevice2 IDirect3DRMDevice2_iface;
98 IDirect3DRMDevice3 IDirect3DRMDevice3_iface;
99 IDirect3DRMWinDevice IDirect3DRMWinDevice_iface;
100 IDirect3DRM *d3drm;
101 IDirectDraw *ddraw;
102 IDirectDrawSurface *primary_surface, *render_target;
103 IDirectDrawClipper *clipper;
104 IDirect3DDevice *device;
105 BOOL dither;
106 D3DRMRENDERQUALITY quality;
107 DWORD rendermode;
108 DWORD height;
109 DWORD width;
112 HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
113 HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw,
114 IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface) DECLSPEC_HIDDEN;
115 void d3drm_device_destroy(struct d3drm_device *device) DECLSPEC_HIDDEN;
116 HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw *ddraw,
117 IDirectDrawSurface *surface, BOOL create_z_surface) DECLSPEC_HIDDEN;
119 void d3drm_object_init(struct d3drm_object *object) DECLSPEC_HIDDEN;
120 HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
121 HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
122 void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) DECLSPEC_HIDDEN;
124 struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) DECLSPEC_HIDDEN;
125 struct d3drm_device *unsafe_impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface) DECLSPEC_HIDDEN;
127 HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
128 HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
129 HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
130 HRESULT Direct3DRMFace_create(REFIID riid, IUnknown** ret_iface) DECLSPEC_HIDDEN;
131 HRESULT Direct3DRMLight_create(IUnknown** ppObj) DECLSPEC_HIDDEN;
132 HRESULT Direct3DRMMesh_create(IDirect3DRMMesh** obj) DECLSPEC_HIDDEN;
133 HRESULT Direct3DRMMeshBuilder_create(REFIID riid, IUnknown** ppObj) DECLSPEC_HIDDEN;
134 HRESULT Direct3DRMMaterial_create(IDirect3DRMMaterial2** ret_iface) DECLSPEC_HIDDEN;
136 HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data,
137 D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg) DECLSPEC_HIDDEN;
139 struct d3drm_file_header
141 WORD major;
142 WORD minor;
143 DWORD flags;
146 extern char templates[] DECLSPEC_HIDDEN;
148 static inline BYTE d3drm_color_component(float c)
150 if (c <= 0.0f)
151 return 0u;
152 if (c >= 1.0f)
153 return 0xffu;
154 return floor(c * 255.0f);
157 static inline void d3drm_set_color(D3DCOLOR *color, float r, float g, float b, float a)
159 *color = RGBA_MAKE(d3drm_color_component(r), d3drm_color_component(g),
160 d3drm_color_component(b), d3drm_color_component(a));
163 #endif /* __D3DRM_PRIVATE_INCLUDED__ */