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"
|
2018-02-08 22:58:47 +01:00
|
|
|
#include "wine/heap.h"
|
2016-03-03 09:10:21 +01:00
|
|
|
#include "wine/list.h"
|
|
|
|
|
2019-06-20 13:21:53 +02:00
|
|
|
struct d3drm_matrix
|
|
|
|
{
|
|
|
|
float _11, _12, _13, _14;
|
|
|
|
float _21, _22, _23, _24;
|
|
|
|
float _31, _32, _33, _34;
|
|
|
|
float _41, _42, _43, _44;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct d3drm_matrix *d3drm_matrix(D3DRMMATRIX4D m)
|
|
|
|
{
|
|
|
|
return (struct d3drm_matrix *)m;
|
|
|
|
}
|
|
|
|
|
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;
|
2017-06-06 13:10:34 +02:00
|
|
|
const char *classname;
|
2017-06-21 14:39:30 +02:00
|
|
|
char *name;
|
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;
|
2017-06-05 01:07:30 +02:00
|
|
|
IDirectDrawSurface *surface;
|
2016-03-21 17:06:45 +01:00
|
|
|
};
|
|
|
|
|
2016-06-19 21:28:08 +02:00
|
|
|
struct d3drm_frame
|
|
|
|
{
|
2017-06-06 13:10:34 +02:00
|
|
|
struct d3drm_object obj;
|
2016-06-19 21:28:08 +02:00
|
|
|
IDirect3DRMFrame IDirect3DRMFrame_iface;
|
|
|
|
IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
|
|
|
|
IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
|
|
|
|
IDirect3DRM *d3drm;
|
|
|
|
LONG ref;
|
|
|
|
struct d3drm_frame *parent;
|
2017-07-10 12:40:46 +02:00
|
|
|
SIZE_T nb_children;
|
|
|
|
SIZE_T children_size;
|
2016-06-19 21:28:08 +02:00
|
|
|
IDirect3DRMFrame3 **children;
|
2017-07-10 12:40:48 +02:00
|
|
|
SIZE_T nb_visuals;
|
|
|
|
SIZE_T visuals_size;
|
2016-06-19 21:28:08 +02:00
|
|
|
IDirect3DRMVisual **visuals;
|
2017-07-10 12:40:47 +02:00
|
|
|
SIZE_T nb_lights;
|
|
|
|
SIZE_T lights_size;
|
2016-06-19 21:28:08 +02:00
|
|
|
IDirect3DRMLight **lights;
|
2019-06-20 13:21:53 +02:00
|
|
|
struct d3drm_matrix transform;
|
2016-06-19 21:28:08 +02:00
|
|
|
D3DCOLOR scenebackground;
|
2017-07-04 09:43:11 +02:00
|
|
|
DWORD traversal_options;
|
2016-06-19 21:28:08 +02:00
|
|
|
};
|
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
struct d3drm_box
|
|
|
|
{
|
|
|
|
float left;
|
|
|
|
float top;
|
|
|
|
float right;
|
|
|
|
float bottom;
|
|
|
|
float front;
|
|
|
|
float back;
|
|
|
|
};
|
|
|
|
|
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;
|
2019-08-30 21:23:52 +02:00
|
|
|
struct d3drm_box clip;
|
2016-06-19 21:28:09 +02:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2017-06-09 01:36:48 +02:00
|
|
|
struct d3drm_face
|
|
|
|
{
|
|
|
|
struct d3drm_object obj;
|
|
|
|
IDirect3DRMFace IDirect3DRMFace_iface;
|
|
|
|
IDirect3DRMFace2 IDirect3DRMFace2_iface;
|
|
|
|
LONG ref;
|
2017-07-04 09:43:12 +02:00
|
|
|
D3DCOLOR color;
|
2017-06-09 01:36:48 +02:00
|
|
|
};
|
|
|
|
|
2017-06-09 01:36:49 +02:00
|
|
|
struct d3drm_mesh_builder
|
|
|
|
{
|
|
|
|
struct d3drm_object obj;
|
|
|
|
IDirect3DRMMeshBuilder2 IDirect3DRMMeshBuilder2_iface;
|
|
|
|
IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface;
|
|
|
|
LONG ref;
|
|
|
|
IDirect3DRM *d3drm;
|
|
|
|
SIZE_T nb_vertices;
|
|
|
|
SIZE_T vertices_size;
|
|
|
|
D3DVECTOR *vertices;
|
|
|
|
SIZE_T nb_normals;
|
|
|
|
SIZE_T normals_size;
|
|
|
|
D3DVECTOR *normals;
|
|
|
|
DWORD nb_faces;
|
|
|
|
DWORD face_data_size;
|
|
|
|
void *pFaceData;
|
|
|
|
DWORD nb_coords2d;
|
|
|
|
struct coords_2d *pCoords2d;
|
|
|
|
D3DCOLOR color;
|
|
|
|
IDirect3DRMMaterial2 *material;
|
|
|
|
IDirect3DRMTexture3 *texture;
|
|
|
|
DWORD nb_materials;
|
|
|
|
struct mesh_material *materials;
|
|
|
|
DWORD *material_indices;
|
|
|
|
};
|
|
|
|
|
2017-06-21 14:39:32 +02:00
|
|
|
struct mesh_group
|
|
|
|
{
|
|
|
|
unsigned nb_vertices;
|
|
|
|
D3DRMVERTEX* vertices;
|
|
|
|
unsigned nb_faces;
|
|
|
|
unsigned vertex_per_face;
|
|
|
|
DWORD face_data_size;
|
|
|
|
unsigned* face_data;
|
|
|
|
D3DCOLOR color;
|
|
|
|
IDirect3DRMMaterial2* material;
|
|
|
|
IDirect3DRMTexture3* texture;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct d3drm_mesh
|
|
|
|
{
|
|
|
|
struct d3drm_object obj;
|
|
|
|
IDirect3DRMMesh IDirect3DRMMesh_iface;
|
|
|
|
LONG ref;
|
|
|
|
IDirect3DRM *d3drm;
|
2017-07-10 12:40:49 +02:00
|
|
|
SIZE_T nb_groups;
|
|
|
|
SIZE_T groups_size;
|
2017-06-21 14:39:32 +02:00
|
|
|
struct mesh_group *groups;
|
|
|
|
};
|
|
|
|
|
2017-06-11 17:52:28 +02:00
|
|
|
struct d3drm_light
|
|
|
|
{
|
|
|
|
struct d3drm_object obj;
|
|
|
|
IDirect3DRMLight IDirect3DRMLight_iface;
|
|
|
|
LONG ref;
|
|
|
|
IDirect3DRM *d3drm;
|
|
|
|
D3DRMLIGHTTYPE type;
|
|
|
|
D3DCOLOR color;
|
|
|
|
D3DVALUE range;
|
|
|
|
D3DVALUE cattenuation;
|
|
|
|
D3DVALUE lattenuation;
|
|
|
|
D3DVALUE qattenuation;
|
|
|
|
D3DVALUE umbra;
|
|
|
|
D3DVALUE penumbra;
|
|
|
|
};
|
|
|
|
|
2017-06-21 14:39:29 +02:00
|
|
|
struct color_rgb
|
|
|
|
{
|
|
|
|
D3DVALUE r;
|
|
|
|
D3DVALUE g;
|
|
|
|
D3DVALUE b;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct d3drm_material
|
|
|
|
{
|
|
|
|
struct d3drm_object obj;
|
|
|
|
IDirect3DRMMaterial2 IDirect3DRMMaterial2_iface;
|
|
|
|
LONG ref;
|
|
|
|
IDirect3DRM *d3drm;
|
|
|
|
struct color_rgb emissive;
|
|
|
|
struct color_rgb specular;
|
|
|
|
D3DVALUE power;
|
|
|
|
struct color_rgb ambient;
|
|
|
|
};
|
|
|
|
|
2017-07-07 02:18:40 +02:00
|
|
|
struct d3drm_animation_key
|
|
|
|
{
|
|
|
|
D3DVALUE time;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
D3DVECTOR position;
|
|
|
|
D3DVECTOR scale;
|
|
|
|
D3DRMQUATERNION rotate;
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct d3drm_animation_keys
|
|
|
|
{
|
|
|
|
struct d3drm_animation_key *keys;
|
|
|
|
SIZE_T count;
|
|
|
|
SIZE_T size;
|
|
|
|
};
|
|
|
|
|
2017-06-23 15:15:00 +02:00
|
|
|
struct d3drm_animation
|
|
|
|
{
|
|
|
|
struct d3drm_object obj;
|
|
|
|
IDirect3DRMAnimation2 IDirect3DRMAnimation2_iface;
|
|
|
|
IDirect3DRMAnimation IDirect3DRMAnimation_iface;
|
|
|
|
LONG ref;
|
|
|
|
IDirect3DRM *d3drm;
|
2017-06-27 10:17:11 +02:00
|
|
|
IDirect3DRMFrame3 *frame;
|
2017-06-27 16:36:33 +02:00
|
|
|
D3DRMANIMATIONOPTIONS options;
|
2017-07-07 02:18:40 +02:00
|
|
|
struct d3drm_animation_keys position;
|
|
|
|
struct d3drm_animation_keys scale;
|
|
|
|
struct d3drm_animation_keys rotate;
|
2017-06-23 15:15:00 +02:00
|
|
|
};
|
|
|
|
|
2017-06-26 01:16:12 +02:00
|
|
|
struct d3drm_wrap
|
|
|
|
{
|
|
|
|
struct d3drm_object obj;
|
|
|
|
IDirect3DRMWrap IDirect3DRMWrap_iface;
|
|
|
|
LONG ref;
|
|
|
|
};
|
2017-06-23 15:15:00 +02:00
|
|
|
|
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;
|
|
|
|
|
2017-06-06 13:10:34 +02:00
|
|
|
void d3drm_object_init(struct d3drm_object *object, const char *classname) DECLSPEC_HIDDEN;
|
2016-03-03 09:10:21 +01:00
|
|
|
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;
|
2017-06-06 13:10:34 +02:00
|
|
|
HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name) DECLSPEC_HIDDEN;
|
2017-06-21 14:39:30 +02:00
|
|
|
HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name) DECLSPEC_HIDDEN;
|
2016-03-03 09:10:21 +01:00
|
|
|
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;
|
2019-08-30 21:23:50 +02:00
|
|
|
struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *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;
|
2017-06-09 01:36:48 +02:00
|
|
|
HRESULT d3drm_face_create(struct d3drm_face **face) DECLSPEC_HIDDEN;
|
2016-06-19 21:28:09 +02:00
|
|
|
HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
2017-06-09 01:36:49 +02:00
|
|
|
HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
2017-06-11 17:52:28 +02:00
|
|
|
HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
2017-06-21 14:39:29 +02:00
|
|
|
HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
2017-06-21 14:39:32 +02:00
|
|
|
HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
2017-06-23 15:15:00 +02:00
|
|
|
HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
|
2017-06-26 01:16:12 +02:00
|
|
|
HRESULT d3drm_wrap_create(struct d3drm_wrap **wrap, IDirect3DRM *d3drm) 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));
|
|
|
|
}
|
|
|
|
|
2017-07-07 02:18:40 +02:00
|
|
|
BOOL d3drm_array_reserve(void **elements, SIZE_T *capacity, SIZE_T element_count, SIZE_T element_size) DECLSPEC_HIDDEN;
|
|
|
|
|
2010-01-07 22:43:25 +01:00
|
|
|
#endif /* __D3DRM_PRIVATE_INCLUDED__ */
|