2010-01-07 22:43:25 +01:00
|
|
|
/*
|
|
|
|
* Direct3DRM private interfaces (D3DRM.DLL)
|
|
|
|
*
|
|
|
|
* Copyright 2010 Christian Costa
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __D3DRM_PRIVATE_INCLUDED__
|
|
|
|
#define __D3DRM_PRIVATE_INCLUDED__
|
|
|
|
|
2016-11-10 16:17:40 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2016-11-10 16:17:39 +01:00
|
|
|
#define COBJMACROS
|
2016-11-10 16:17:40 +01:00
|
|
|
#include <assert.h>
|
2016-11-10 16:17:37 +01:00
|
|
|
#include <math.h>
|
2012-03-26 22:35:12 +02:00
|
|
|
#include "dxfile.h"
|
2016-07-12 19:07:25 +02:00
|
|
|
#include "d3drmwin.h"
|
2016-11-10 16:17:41 +01:00
|
|
|
#include "rmxfguid.h"
|
2016-11-10 16:17:40 +01:00
|
|
|
#include "wine/debug.h"
|
2016-03-03 09:10:21 +01:00
|
|
|
#include "wine/list.h"
|
|
|
|
|
2016-06-29 15:39:01 +02:00
|
|
|
#ifndef ARRAY_SIZE
|
|
|
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
|
|
|
|
#endif
|
|
|
|
|
2016-03-01 17:45:29 +01:00
|
|
|
struct d3drm_object
|
|
|
|
{
|
|
|
|
LONG ref;
|
|
|
|
DWORD appdata;
|
2016-03-03 09:10:21 +01:00
|
|
|
struct list destroy_callbacks;
|
2016-03-01 17:45:29 +01:00
|
|
|
};
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2016-03-21 17:06:45 +01:00
|
|
|
struct d3drm_texture
|
|
|
|
{
|
2016-04-17 22:58:07 +02:00
|
|
|
struct d3drm_object obj;
|
2016-03-21 17:06:45 +01:00
|
|
|
IDirect3DRMTexture IDirect3DRMTexture_iface;
|
|
|
|
IDirect3DRMTexture2 IDirect3DRMTexture2_iface;
|
|
|
|
IDirect3DRMTexture3 IDirect3DRMTexture3_iface;
|
2016-05-20 23:07:38 +02:00
|
|
|
IDirect3DRM *d3drm;
|
2016-05-20 23:07:40 +02:00
|
|
|
D3DRMIMAGE *image;
|
2016-03-21 17:06:45 +01:00
|
|
|
};
|
|
|
|
|
2016-06-19 21:28:08 +02:00
|
|
|
struct d3drm_frame
|
|
|
|
{
|
|
|
|
IDirect3DRMFrame IDirect3DRMFrame_iface;
|
|
|
|
IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
|
|
|
|
IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
|
|
|
|
IDirect3DRM *d3drm;
|
|
|
|
LONG ref;
|
|
|
|
struct d3drm_frame *parent;
|
|
|
|
ULONG nb_children;
|
|
|
|
ULONG children_capacity;
|
|
|
|
IDirect3DRMFrame3 **children;
|
|
|
|
ULONG nb_visuals;
|
|
|
|
ULONG visuals_capacity;
|
|
|
|
IDirect3DRMVisual **visuals;
|
|
|
|
ULONG nb_lights;
|
|
|
|
ULONG lights_capacity;
|
|
|
|
IDirect3DRMLight **lights;
|
|
|
|
D3DRMMATRIX4D transform;
|
|
|
|
D3DCOLOR scenebackground;
|
|
|
|
};
|
|
|
|
|
2016-06-19 21:28:09 +02:00
|
|
|
struct d3drm_viewport
|
|
|
|
{
|
|
|
|
struct d3drm_object obj;
|
2016-07-28 19:18:52 +02:00
|
|
|
struct d3drm_device *device;
|
2016-07-28 19:18:47 +02:00
|
|
|
IDirect3DRMFrame *camera;
|
2016-06-19 21:28:09 +02:00
|
|
|
IDirect3DRMViewport IDirect3DRMViewport_iface;
|
|
|
|
IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
|
2016-07-28 19:18:47 +02:00
|
|
|
IDirect3DViewport *d3d_viewport;
|
|
|
|
IDirect3DMaterial *material;
|
2016-06-19 21:28:09 +02:00
|
|
|
IDirect3DRM *d3drm;
|
|
|
|
D3DVALUE back;
|
|
|
|
D3DVALUE front;
|
|
|
|
D3DVALUE field;
|
|
|
|
D3DRMPROJECTIONTYPE projection;
|
|
|
|
};
|
|
|
|
|
2016-07-12 19:07:25 +02:00
|
|
|
struct d3drm_device
|
|
|
|
{
|
2016-07-10 18:41:11 +02:00
|
|
|
struct d3drm_object obj;
|
2016-07-12 19:07:25 +02:00
|
|
|
IDirect3DRMDevice IDirect3DRMDevice_iface;
|
|
|
|
IDirect3DRMDevice2 IDirect3DRMDevice2_iface;
|
|
|
|
IDirect3DRMDevice3 IDirect3DRMDevice3_iface;
|
|
|
|
IDirect3DRMWinDevice IDirect3DRMWinDevice_iface;
|
|
|
|
IDirect3DRM *d3drm;
|
|
|
|
IDirectDraw *ddraw;
|
|
|
|
IDirectDrawSurface *primary_surface, *render_target;
|
|
|
|
IDirectDrawClipper *clipper;
|
|
|
|
IDirect3DDevice *device;
|
|
|
|
BOOL dither;
|
|
|
|
D3DRMRENDERQUALITY quality;
|
|
|
|
DWORD rendermode;
|
|
|
|
DWORD height;
|
|
|
|
DWORD width;
|
|
|
|
};
|
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw,
|
|
|
|
IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface) DECLSPEC_HIDDEN;
|
|
|
|
void d3drm_device_destroy(struct d3drm_device *device) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw *ddraw,
|
|
|
|
IDirectDrawSurface *surface, BOOL create_z_surface) DECLSPEC_HIDDEN;
|
|
|
|
|
2016-03-03 09:10:21 +01:00
|
|
|
void d3drm_object_init(struct d3drm_object *object) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
|
|
|
|
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) DECLSPEC_HIDDEN;
|
|
|
|
|
2016-07-28 19:18:47 +02:00
|
|
|
struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) DECLSPEC_HIDDEN;
|
2016-07-28 19:18:52 +02:00
|
|
|
struct d3drm_device *unsafe_impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface) DECLSPEC_HIDDEN;
|
2016-07-28 19:18:47 +02:00
|
|
|
|
2016-05-20 23:07:38 +02:00
|
|
|
HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
2016-06-19 21:28:08 +02:00
|
|
|
HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
2016-06-19 21:28:09 +02:00
|
|
|
HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
2013-05-09 14:43:39 +02:00
|
|
|
HRESULT Direct3DRMFace_create(REFIID riid, IUnknown** ret_iface) DECLSPEC_HIDDEN;
|
2012-05-01 22:15:39 +02:00
|
|
|
HRESULT Direct3DRMLight_create(IUnknown** ppObj) DECLSPEC_HIDDEN;
|
2012-06-17 15:35:18 +02:00
|
|
|
HRESULT Direct3DRMMesh_create(IDirect3DRMMesh** obj) DECLSPEC_HIDDEN;
|
2011-12-29 02:25:42 +01:00
|
|
|
HRESULT Direct3DRMMeshBuilder_create(REFIID riid, IUnknown** ppObj) DECLSPEC_HIDDEN;
|
2012-05-22 22:05:32 +02:00
|
|
|
HRESULT Direct3DRMMaterial_create(IDirect3DRMMaterial2** ret_iface) DECLSPEC_HIDDEN;
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2012-12-14 08:37:38 +01:00
|
|
|
HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data,
|
|
|
|
D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg) DECLSPEC_HIDDEN;
|
2012-03-26 22:35:12 +02:00
|
|
|
|
2013-10-03 23:31:48 +02:00
|
|
|
struct d3drm_file_header
|
|
|
|
{
|
2012-03-26 22:35:12 +02:00
|
|
|
WORD major;
|
|
|
|
WORD minor;
|
|
|
|
DWORD flags;
|
2013-10-03 23:31:48 +02:00
|
|
|
};
|
2012-03-26 22:35:12 +02:00
|
|
|
|
2015-03-16 18:58:17 +01:00
|
|
|
extern char templates[] DECLSPEC_HIDDEN;
|
2012-03-26 22:35:12 +02:00
|
|
|
|
2016-11-10 16:17:37 +01:00
|
|
|
static inline BYTE d3drm_color_component(float c)
|
|
|
|
{
|
|
|
|
if (c <= 0.0f)
|
|
|
|
return 0u;
|
|
|
|
if (c >= 1.0f)
|
|
|
|
return 0xffu;
|
|
|
|
return floor(c * 255.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void d3drm_set_color(D3DCOLOR *color, float r, float g, float b, float a)
|
|
|
|
{
|
|
|
|
*color = RGBA_MAKE(d3drm_color_component(r), d3drm_color_component(g),
|
|
|
|
d3drm_color_component(b), d3drm_color_component(a));
|
|
|
|
}
|
|
|
|
|
2010-01-07 22:43:25 +01:00
|
|
|
#endif /* __D3DRM_PRIVATE_INCLUDED__ */
|