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