-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Am 2016-07-07 um 14:52 schrieb Aaryaman Vasishta:
- {&CLSID_CDirect3DRMTexture, d3drm_create_texture_object}, - {&CLSID_CDirect3DRMDevice, d3drm_create_device_object}, + { &CLSID_CDirect3DRMTexture, d3drm_create_texture_object }, + { &CLSID_CDirect3DRMDevice, d3drm_create_device_object }, + { &CLSID_CDirect3DRMViewport, d3drm_create_viewport_object }, I guess Visual Studio or xcode re-added the spaces between { and &. Henri removed them in the slightly modified version of "d3drm: Use a table in d3drm3_CreateObject() to create objects in a generic manner."
+ if (FAILED(hr = IDirect3DRMFrame3_QueryInterface(camera, &IID_IDirect3DRMFrame, (void **)&viewport->camera))) + goto cleanup; Aren't you more likely to need the implementation structure of the camera in the future?
+ + color = IDirect3DRMFrame3_GetSceneBackground(camera); + /* Create material (ambient/diffuse/emissive?), set material */ + if (FAILED(hr = IDirect3D_CreateMaterial(d3d1, &material, NULL))) + goto cleanup; + + memset(&mat, 0, sizeof(mat)); + memcpy(&mat.diffuse, &color, sizeof(color)); + + if (FAILED(hr = IDirect3DMaterial_SetMaterial(material, &mat))) + goto cleanup; + + if (FAILED(hr = IDirect3DMaterial_GetHandle(material, d3d_device, &hmat))) + goto cleanup; + + hr = IDirect3DViewport_SetBackground(viewport->d3d_viewport, hmat); + +cleanup: + + if (material) + IDirect3DMaterial_Release(material); In the success case this will destroy the material you just created. Our IDirect3DViewport::SetBackground implementation does not AddRef the material. I don't think we have any tests for this, but because SetBackground accepts a handle instead of a COM object I don't expect it to AddRef.
Overall it seems questionable to call camera->GetSceneBackground and apply the color here. I'd expect that the camera background can be changed after creating the viewport. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXgnMdAAoJEN0/YqbEcdMwk+IP/2DZH4tPgtCN/PHoB/ZdsVwJ oodz6Sax5LZUaumbXZme4CPgPZKSKr44ue3qho/5cQicRISuJ3G6I6vFmkiiHol6 nFmY9cTJiNeXzd6NcJq5KK6IUmgrzO5YjGgXIbzgzEiTycbws/lo5fVwF74LSYn7 RMPg+U4qMaHVT/w/rb7dWWqPugSbm8cIGfp8Zjz2VrO+JX+S1Qs3ymCZViyMfCRz A1VtyJh/u72GlfCoRoUiT6DDsMjw1BCMogR4asDkQmoTdkc7XFRU3MYQwUN7cFY2 bxos78d6xozUwvDRoezrtRLh4gQis9gudaNYv4Dt4fZjNOSvCtA8fMbl35gXuJog ooROiaXSoW5oBrzv++Fvp38cixS0j9MMECNDgs1yCCKt0a/B4/IFEQMvyGt5LzRG zeJ2XzDEZI3ntsbeVdKPRuH6m7ROlQLfp+Q0ac+MrhJSQtnAd88mXVfU5U8330b4 DNyeSmyPhBpaRp62WZxMCeOct7psy1p4LYkbbE5QZ3eFS2QhHlnPC6PzNtcUbDqI RG4J+ZhquDnT57ViyjX1vKt6tXPlDOkwJf0AApwQ84OGs7ATNci/7Z1WuyULx9sR xPrpNYUPbFIxcadmvaa7jO+aaOXoNWFQQz7rJdCVBxUY1T4Bz8+FyzQ0O8Ld/xNj b7LndQJz3AbU//fQ1gdO =8gsI -----END PGP SIGNATURE-----