ReactOS 0.4.15-dev-8231-g29a56f3
material.c File Reference
#include "d3drm_private.h"
Include dependency graph for material.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3drm)
 
static struct d3drm_materialimpl_from_IDirect3DRMMaterial2 (IDirect3DRMMaterial2 *iface)
 
static HRESULT WINAPI d3drm_material_QueryInterface (IDirect3DRMMaterial2 *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3drm_material_AddRef (IDirect3DRMMaterial2 *iface)
 
static ULONG WINAPI d3drm_material_Release (IDirect3DRMMaterial2 *iface)
 
static HRESULT WINAPI d3drm_material_Clone (IDirect3DRMMaterial2 *iface, IUnknown *outer, REFIID iid, void **out)
 
static HRESULT WINAPI d3drm_material_AddDestroyCallback (IDirect3DRMMaterial2 *iface, D3DRMOBJECTCALLBACK cb, void *ctx)
 
static HRESULT WINAPI d3drm_material_DeleteDestroyCallback (IDirect3DRMMaterial2 *iface, D3DRMOBJECTCALLBACK cb, void *ctx)
 
static HRESULT WINAPI d3drm_material_SetAppData (IDirect3DRMMaterial2 *iface, DWORD data)
 
static DWORD WINAPI d3drm_material_GetAppData (IDirect3DRMMaterial2 *iface)
 
static HRESULT WINAPI d3drm_material_SetName (IDirect3DRMMaterial2 *iface, const char *name)
 
static HRESULT WINAPI d3drm_material_GetName (IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
 
static HRESULT WINAPI d3drm_material_GetClassName (IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
 
static HRESULT WINAPI d3drm_material_SetPower (IDirect3DRMMaterial2 *iface, D3DVALUE power)
 
static HRESULT WINAPI d3drm_material_SetSpecular (IDirect3DRMMaterial2 *iface, D3DVALUE r, D3DVALUE g, D3DVALUE b)
 
static HRESULT WINAPI d3drm_material_SetEmissive (IDirect3DRMMaterial2 *iface, D3DVALUE r, D3DVALUE g, D3DVALUE b)
 
static D3DVALUE WINAPI d3drm_material_GetPower (IDirect3DRMMaterial2 *iface)
 
static HRESULT WINAPI d3drm_material_GetSpecular (IDirect3DRMMaterial2 *iface, D3DVALUE *r, D3DVALUE *g, D3DVALUE *b)
 
static HRESULT WINAPI d3drm_material_GetEmissive (IDirect3DRMMaterial2 *iface, D3DVALUE *r, D3DVALUE *g, D3DVALUE *b)
 
static HRESULT WINAPI d3drm_material_GetAmbient (IDirect3DRMMaterial2 *iface, D3DVALUE *r, D3DVALUE *g, D3DVALUE *b)
 
static HRESULT WINAPI d3drm_material_SetAmbient (IDirect3DRMMaterial2 *iface, D3DVALUE r, D3DVALUE g, D3DVALUE b)
 
HRESULT d3drm_material_create (struct d3drm_material **material, IDirect3DRM *d3drm)
 

Variables

static const struct IDirect3DRMMaterial2Vtbl d3drm_material_vtbl
 

Function Documentation

◆ d3drm_material_AddDestroyCallback()

static HRESULT WINAPI d3drm_material_AddDestroyCallback ( IDirect3DRMMaterial2 *  iface,
D3DRMOBJECTCALLBACK  cb,
void ctx 
)
static

Definition at line 85 of file material.c.

87{
88 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
89
90 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
91
92 return d3drm_object_add_destroy_callback(&material->obj, cb, ctx);
93}
static struct d3drm_material * impl_from_IDirect3DRMMaterial2(IDirect3DRMMaterial2 *iface)
Definition: material.c:25
HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx)
Definition: d3drm_main.c:55
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
#define TRACE(s)
Definition: solgame.cpp:4
struct d3drm_object obj

◆ d3drm_material_AddRef()

static ULONG WINAPI d3drm_material_AddRef ( IDirect3DRMMaterial2 *  iface)
static

Definition at line 50 of file material.c.

51{
52 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
53 ULONG refcount = InterlockedIncrement(&material->ref);
54
55 TRACE("%p increasing refcount to %u.\n", iface, refcount);
56
57 return refcount;
58}
#define InterlockedIncrement
Definition: armddk.h:53
uint32_t ULONG
Definition: typedefs.h:59

◆ d3drm_material_Clone()

static HRESULT WINAPI d3drm_material_Clone ( IDirect3DRMMaterial2 *  iface,
IUnknown outer,
REFIID  iid,
void **  out 
)
static

Definition at line 77 of file material.c.

79{
80 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
81
82 return E_NOTIMPL;
83}
#define FIXME(fmt,...)
Definition: debug.h:114
#define E_NOTIMPL
Definition: ddrawi.h:99
#define debugstr_guid
Definition: kernel32.h:35
static FILE * out
Definition: regtests2xml.c:44

◆ d3drm_material_create()

HRESULT d3drm_material_create ( struct d3drm_material **  material,
IDirect3DRM *  d3drm 
)

Definition at line 279 of file material.c.

280{
281 static const char classname[] = "Material";
282 struct d3drm_material *object;
283
284 TRACE("material %p, d3drm %p.\n", material, d3drm);
285
286 if (!(object = heap_alloc_zero(sizeof(*object))))
287 return E_OUTOFMEMORY;
288
289 object->IDirect3DRMMaterial2_iface.lpVtbl = &d3drm_material_vtbl;
290 object->ref = 1;
291 object->d3drm = d3drm;
293
294 object->specular.r = 1.0f;
295 object->specular.g = 1.0f;
296 object->specular.b = 1.0f;
297
299
300 *material = object;
301
302 return S_OK;
303}
static const struct IDirect3DRMMaterial2Vtbl d3drm_material_vtbl
Definition: material.c:256
#define IDirect3DRM_AddRef(p)
Definition: d3drm.h:110
void d3drm_object_init(struct d3drm_object *object, const char *classname)
Definition: d3drm_main.c:39
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
WCHAR classname[128]
Definition: startup.c:15
IDirect3DRM * d3drm
Definition: d3drm.c:189

Referenced by d3drm3_CreateMaterial(), d3drm_create_material_object(), and load_mesh_data().

◆ d3drm_material_DeleteDestroyCallback()

static HRESULT WINAPI d3drm_material_DeleteDestroyCallback ( IDirect3DRMMaterial2 *  iface,
D3DRMOBJECTCALLBACK  cb,
void ctx 
)
static

Definition at line 95 of file material.c.

97{
98 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
99
100 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
101
102 return d3drm_object_delete_destroy_callback(&material->obj, cb, ctx);
103}
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx)
Definition: d3drm_main.c:72

◆ d3drm_material_GetAmbient()

static HRESULT WINAPI d3drm_material_GetAmbient ( IDirect3DRMMaterial2 *  iface,
D3DVALUE r,
D3DVALUE g,
D3DVALUE b 
)
static

Definition at line 228 of file material.c.

230{
231 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
232
233 TRACE("iface %p, r %p, g %p, b %p.\n", iface, r, g, b);
234
235 *r = material->ambient.r;
236 *g = material->ambient.g;
237 *b = material->ambient.b;
238
239 return D3DRM_OK;
240}
#define D3DRM_OK
Definition: d3drm.h:486
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
struct color_rgb ambient

◆ d3drm_material_GetAppData()

static DWORD WINAPI d3drm_material_GetAppData ( IDirect3DRMMaterial2 *  iface)
static

Definition at line 116 of file material.c.

117{
118 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
119
120 TRACE("iface %p.\n", iface);
121
122 return material->obj.appdata;
123}

◆ d3drm_material_GetClassName()

static HRESULT WINAPI d3drm_material_GetClassName ( IDirect3DRMMaterial2 *  iface,
DWORD size,
char name 
)
static

Definition at line 143 of file material.c.

144{
145 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
146
147 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
148
149 return d3drm_object_get_class_name(&material->obj, size, name);
150}
HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name)
Definition: d3drm_main.c:92
GLsizeiptr size
Definition: glext.h:5919
Definition: name.c:39

◆ d3drm_material_GetEmissive()

static HRESULT WINAPI d3drm_material_GetEmissive ( IDirect3DRMMaterial2 *  iface,
D3DVALUE r,
D3DVALUE g,
D3DVALUE b 
)
static

Definition at line 214 of file material.c.

216{
217 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
218
219 TRACE("iface %p, r %p, g %p, b %p.\n", iface, r, g, b);
220
221 *r = material->emissive.r;
222 *g = material->emissive.g;
223 *b = material->emissive.b;
224
225 return D3DRM_OK;
226}
struct color_rgb emissive

◆ d3drm_material_GetName()

static HRESULT WINAPI d3drm_material_GetName ( IDirect3DRMMaterial2 *  iface,
DWORD size,
char name 
)
static

Definition at line 134 of file material.c.

135{
136 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
137
138 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
139
140 return d3drm_object_get_name(&material->obj, size, name);
141}
HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name)
Definition: d3drm_main.c:111

◆ d3drm_material_GetPower()

static D3DVALUE WINAPI d3drm_material_GetPower ( IDirect3DRMMaterial2 *  iface)
static

Definition at line 191 of file material.c.

192{
193 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
194
195 TRACE("iface %p.\n", iface);
196
197 return material->power;
198}

◆ d3drm_material_GetSpecular()

static HRESULT WINAPI d3drm_material_GetSpecular ( IDirect3DRMMaterial2 *  iface,
D3DVALUE r,
D3DVALUE g,
D3DVALUE b 
)
static

Definition at line 200 of file material.c.

202{
203 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
204
205 TRACE("iface %p, r %p, g %p, b %p.\n", iface, r, g, b);
206
207 *r = material->specular.r;
208 *g = material->specular.g;
209 *b = material->specular.b;
210
211 return D3DRM_OK;
212}
struct color_rgb specular

◆ d3drm_material_QueryInterface()

static HRESULT WINAPI d3drm_material_QueryInterface ( IDirect3DRMMaterial2 *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 30 of file material.c.

31{
32 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
33
34 if (IsEqualGUID(riid, &IID_IDirect3DRMMaterial2)
35 || IsEqualGUID(riid, &IID_IDirect3DRMMaterial)
36 || IsEqualGUID(riid, &IID_IDirect3DRMObject)
38 {
40 *out = iface;
41 return S_OK;
42 }
43
44 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
45
46 *out = NULL;
47 return E_NOINTERFACE;
48}
const GUID IID_IUnknown
#define WARN(fmt,...)
Definition: debug.h:115
#define IDirect3DRMMaterial2_AddRef(p)
Definition: d3drmobj.h:3731
#define NULL
Definition: types.h:112
REFIID riid
Definition: atlbase.h:39
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ d3drm_material_Release()

static ULONG WINAPI d3drm_material_Release ( IDirect3DRMMaterial2 *  iface)
static

Definition at line 60 of file material.c.

61{
62 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
63 ULONG refcount = InterlockedDecrement(&material->ref);
64
65 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
66
67 if (!refcount)
68 {
69 d3drm_object_cleanup((IDirect3DRMObject *)iface, &material->obj);
70 IDirect3DRM_Release(material->d3drm);
71 heap_free(material);
72 }
73
74 return refcount;
75}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52
#define IDirect3DRM_Release(p)
Definition: d3drm.h:111
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
Definition: d3drm_main.c:153

◆ d3drm_material_SetAmbient()

static HRESULT WINAPI d3drm_material_SetAmbient ( IDirect3DRMMaterial2 *  iface,
D3DVALUE  r,
D3DVALUE  g,
D3DVALUE  b 
)
static

Definition at line 242 of file material.c.

244{
245 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
246
247 TRACE("iface %p, r %.8e, g %.8e, b %.8e.\n", iface, r, g, b);
248
249 material->ambient.r = r;
250 material->ambient.g = g;
251 material->ambient.b = b;
252
253 return D3DRM_OK;
254}
#define b
Definition: ke_i.h:79

◆ d3drm_material_SetAppData()

static HRESULT WINAPI d3drm_material_SetAppData ( IDirect3DRMMaterial2 *  iface,
DWORD  data 
)
static

Definition at line 105 of file material.c.

106{
107 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
108
109 TRACE("iface %p, data %#x.\n", iface, data);
110
111 material->obj.appdata = data;
112
113 return D3DRM_OK;
114}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ d3drm_material_SetEmissive()

static HRESULT WINAPI d3drm_material_SetEmissive ( IDirect3DRMMaterial2 *  iface,
D3DVALUE  r,
D3DVALUE  g,
D3DVALUE  b 
)
static

Definition at line 177 of file material.c.

179{
180 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
181
182 TRACE("iface %p, r %.8e, g %.8e, b %.8e.\n", iface, r, g, b);
183
184 material->emissive.r = r;
185 material->emissive.g = g;
186 material->emissive.b = b;
187
188 return D3DRM_OK;
189}

◆ d3drm_material_SetName()

static HRESULT WINAPI d3drm_material_SetName ( IDirect3DRMMaterial2 *  iface,
const char name 
)
static

Definition at line 125 of file material.c.

126{
127 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
128
129 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
130
131 return d3drm_object_set_name(&material->obj, name);
132}
HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name)
Definition: d3drm_main.c:135
#define debugstr_a
Definition: kernel32.h:31

◆ d3drm_material_SetPower()

static HRESULT WINAPI d3drm_material_SetPower ( IDirect3DRMMaterial2 *  iface,
D3DVALUE  power 
)
static

Definition at line 152 of file material.c.

153{
154 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
155
156 TRACE("iface %p, power %.8e.\n", iface, power);
157
158 material->power = power;
159
160 return D3DRM_OK;
161}
float power
Definition: d3drm.c:3372

◆ d3drm_material_SetSpecular()

static HRESULT WINAPI d3drm_material_SetSpecular ( IDirect3DRMMaterial2 *  iface,
D3DVALUE  r,
D3DVALUE  g,
D3DVALUE  b 
)
static

Definition at line 163 of file material.c.

165{
166 struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
167
168 TRACE("iface %p, r %.8e, g %.8e, b %.8e.\n", iface, r, g, b);
169
170 material->specular.r = r;
171 material->specular.g = g;
172 material->specular.b = b;
173
174 return D3DRM_OK;
175}

◆ impl_from_IDirect3DRMMaterial2()

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3drm  )

Variable Documentation

◆ d3drm_material_vtbl

const struct IDirect3DRMMaterial2Vtbl d3drm_material_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3drm_material_AddDestroyCallback(IDirect3DRMMaterial2 *iface, D3DRMOBJECTCALLBACK cb, void *ctx)
Definition: material.c:85
static HRESULT WINAPI d3drm_material_SetName(IDirect3DRMMaterial2 *iface, const char *name)
Definition: material.c:125
static HRESULT WINAPI d3drm_material_DeleteDestroyCallback(IDirect3DRMMaterial2 *iface, D3DRMOBJECTCALLBACK cb, void *ctx)
Definition: material.c:95
static HRESULT WINAPI d3drm_material_SetEmissive(IDirect3DRMMaterial2 *iface, D3DVALUE r, D3DVALUE g, D3DVALUE b)
Definition: material.c:177
static HRESULT WINAPI d3drm_material_GetName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
Definition: material.c:134
static ULONG WINAPI d3drm_material_AddRef(IDirect3DRMMaterial2 *iface)
Definition: material.c:50
static HRESULT WINAPI d3drm_material_GetSpecular(IDirect3DRMMaterial2 *iface, D3DVALUE *r, D3DVALUE *g, D3DVALUE *b)
Definition: material.c:200
static HRESULT WINAPI d3drm_material_Clone(IDirect3DRMMaterial2 *iface, IUnknown *outer, REFIID iid, void **out)
Definition: material.c:77
static ULONG WINAPI d3drm_material_Release(IDirect3DRMMaterial2 *iface)
Definition: material.c:60
static HRESULT WINAPI d3drm_material_GetClassName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
Definition: material.c:143
static HRESULT WINAPI d3drm_material_GetAmbient(IDirect3DRMMaterial2 *iface, D3DVALUE *r, D3DVALUE *g, D3DVALUE *b)
Definition: material.c:228
static HRESULT WINAPI d3drm_material_SetSpecular(IDirect3DRMMaterial2 *iface, D3DVALUE r, D3DVALUE g, D3DVALUE b)
Definition: material.c:163
static HRESULT WINAPI d3drm_material_SetAppData(IDirect3DRMMaterial2 *iface, DWORD data)
Definition: material.c:105
static HRESULT WINAPI d3drm_material_GetEmissive(IDirect3DRMMaterial2 *iface, D3DVALUE *r, D3DVALUE *g, D3DVALUE *b)
Definition: material.c:214
static D3DVALUE WINAPI d3drm_material_GetPower(IDirect3DRMMaterial2 *iface)
Definition: material.c:191
static HRESULT WINAPI d3drm_material_QueryInterface(IDirect3DRMMaterial2 *iface, REFIID riid, void **out)
Definition: material.c:30
static HRESULT WINAPI d3drm_material_SetPower(IDirect3DRMMaterial2 *iface, D3DVALUE power)
Definition: material.c:152
static DWORD WINAPI d3drm_material_GetAppData(IDirect3DRMMaterial2 *iface)
Definition: material.c:116
static HRESULT WINAPI d3drm_material_SetAmbient(IDirect3DRMMaterial2 *iface, D3DVALUE r, D3DVALUE g, D3DVALUE b)
Definition: material.c:242

Definition at line 256 of file material.c.

Referenced by d3drm_material_create().