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